scorm-again 3.1.5 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/cross-frame-api.js +6 -13
- package/dist/cross-frame-api.js.map +1 -1
- package/dist/cross-frame-api.min.js +1 -1
- package/dist/cross-frame-lms.js +2 -6
- package/dist/cross-frame-lms.js.map +1 -1
- package/dist/esm/scorm-again.js +48 -11
- package/dist/esm/scorm-again.js.map +1 -1
- package/dist/esm/scorm-again.min.js +1 -1
- package/dist/esm/scorm-again.min.js.map +1 -1
- package/dist/esm/scorm12.js +46 -10
- package/dist/esm/scorm12.js.map +1 -1
- package/dist/esm/scorm12.min.js +1 -1
- package/dist/esm/scorm12.min.js.map +1 -1
- package/dist/esm/scorm2004.js +48 -11
- package/dist/esm/scorm2004.js.map +1 -1
- package/dist/esm/scorm2004.min.js +1 -1
- package/dist/esm/scorm2004.min.js.map +1 -1
- package/dist/scorm-again.js +697 -1070
- package/dist/scorm-again.js.map +1 -1
- package/dist/scorm-again.min.js +1 -1
- package/dist/scorm12.js +293 -406
- package/dist/scorm12.js.map +1 -1
- package/dist/scorm12.min.js +1 -1
- package/dist/scorm2004.js +597 -911
- package/dist/scorm2004.js.map +1 -1
- package/dist/scorm2004.min.js +1 -1
- package/dist/types/BaseAPI.d.ts +1 -1
- package/dist/types/interfaces/services.d.ts +1 -1
- package/dist/types/services/AsynchronousHttpService.d.ts +1 -0
- package/dist/types/services/ErrorHandlingService.d.ts +4 -4
- package/dist/types/services/SynchronousHttpService.d.ts +1 -0
- package/dist/types/types/api_types.d.ts +4 -0
- package/dist/types/utilities/core.d.ts +2 -0
- package/package.json +4 -4
package/dist/scorm-again.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||n(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||n(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,i){if(t){if("string"==typeof t)return e(t,i);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,i):void 0}}var r={D:86400,H:3600,M:60,S:1},o=function(e){if(!e||0>=e)return"00:00:00";var t=Math.floor(e/3600),i=new Date(1e3*e),n=i.getUTCMinutes(),r=i.getSeconds(),o=e%1,a="";return d(o)>0&&(a="."+(a=d(o)>2?o.toFixed(2):o+"").split(".")[1]),(t+":"+n+":"+r).replace(/\b\d\b/g,"0$&")+a},a=function(e){if(!e||0>=e)return"PT0S";var i="P",n=e;return Object.entries(r).forEach(function(e){var r=t(e,2),o=r[0],a=r[1],s=Math.floor(n/a);d(n%=a)>2&&(n=+(+n).toFixed(2)),"S"===o&&n>0&&(s+=n),s&&((i.indexOf("D")>0||["H","M","S"].includes(o))&&-1===i.indexOf("T")&&(i+="T"),i+="".concat(s).concat(o))}),i},s=v(function(e,t){if("number"!=typeof e&&"boolean"!=typeof e||(e+=""),"string"==typeof t&&(t=RegExp(t)),!e)return 0;if(!e.match(t))return/^\d+(?:\.\d+)?$/.test(e)?+e:0;var i=e.split(":");return 3600*+i[0]+60*+i[1]+ +i[2]},function(e,t){var i,n="string"==typeof t?t:null!==(i=null==t?void 0:""+t)&&void 0!==i?i:"";return"".concat("string"==typeof e?e:(null!=e?e:"")+"",":").concat(n)}),c=v(function(e,i){var n,r,o,a;if("string"==typeof i&&(i=RegExp(i)),!e||!(null==e||null===(r=e.match)||void 0===r?void 0:r.call(e,i)))return 0;var s=t(null!==(n=null===(o=(a=RegExp(i)).exec)||void 0===o?void 0:o.call(a,e))&&void 0!==n?n:[],8),result=0;return result+=+s[7]||0,result+=60*+s[6]||0,result+=3600*+s[5]||0,result+=86400*+s[4]||0,result+=604800*+s[3]||0,(result+=2592e3*+s[2]||0)+(31536e3*+s[1]||0)},function(e,t){var i,n="string"==typeof t?t:null!==(i=null==t?void 0:""+t)&&void 0!==i?i:"";return"".concat(null!=e?e:"",":").concat(n)}),l=v(function(e,t){var i;return"string"==typeof t&&(t=RegExp(t)),!(!e||!(null==e||null===(i=e.match)||void 0===i?void 0:i.call(e,t)))});function u(e){var result={};return function e(t,i){if(Object(t)!==t)result[i]=t;else if(Array.isArray(t))t.forEach(function(t,n){e(t,"".concat(i,"[").concat(n,"]"))}),0===t.length&&(result[i]=[]);else{var n=Object.keys(t).filter(function(e){return{}.hasOwnProperty.call(t,e)}),r=0===n.length;n.forEach(function(n){e(t[n],i?"".concat(i,".").concat(n):n)}),r&&i&&(result[i]={})}}(e,""),result}function d(e){var t,i,n,r;if(Math.floor(e)===e||0>(null===(n=e+"")||void 0===n||null===(i=n.indexOf)||void 0===i?void 0:i.call(n,".")))return 0;var o=null===(r=(""+e).split("."))||void 0===r?void 0:r[1];return null!==(t=null==o?void 0:o.length)&&void 0!==t?t:0}function f(e,t){return"string"==typeof e&&RegExp(t).test(e)}function v(e,t,n){var r=new Map;return function(){for(var o=arguments.length,a=Array(o),s=0;o>s;s++)a[s]=arguments[s];var result,c=t?t.apply(void 0,i(a)):JSON.stringify(a);return void 0!==(null==n?void 0:n.maxKeyLength)&&c.length>n.maxKeyLength?e.apply(void 0,i(a)):r.has(c)?r.get(c):(result=e.apply(void 0,i(a)),void 0===(null==n?void 0:n.maxEntries)||n.maxEntries>r.size||r.delete(r.keys().next().value),r.set(c,result),result)}}var h=function(e,t,i){var n=e.indexOf("#"),r=-1===n?e:e.slice(0,n),o=-1===n?"":e.slice(n),a=r.includes("?")?r.endsWith("?")||r.endsWith("&")?"":"&":"?",s="".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(i+""));return"".concat(r).concat(a).concat(s).concat(o)};function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function g(e,t){return g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},g(e,t)}function _(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function b(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(b=function(){return!!result})()}var S=Object.defineProperty,w=function(e,t,i){return function(e,t,i){return t in e?S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":_(t))?t+"":t,i)},O=function(){function e(t){m(this,e),w(this,"jsonString",!1),w(this,"_cmi_element"),w(this,"_initialized",!1),this._cmi_element=t}return p(e,[{key:"initialized",get:function(){return this._initialized}},{key:"initialize",value:function(){this._initialized=!0}}]),e}(),C=function(e){function t(){var e;return m(this,t),e=function(e,t,i){return t=y(t),n=e,!(r=b()?Reflect.construct(t,i||[],y(e).constructor):t.apply(e,i))||"object"!==_(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,arguments),w(e,"_start_time"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(t,e),p(t,[{key:"start_time",get:function(){return this._start_time}},{key:"setStartTime",value:function(){if(void 0!==this._start_time)throw Error("Start time has already been set.");this._start_time=(new Date).getTime()}}]),t}(O);function E(e,t,i){return t=R(t),n=e,!(r=P()?Reflect.construct(t,i||[],R(e).constructor):t.apply(e,i))||"object"!==x(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t,i){return k=P()?Reflect.construct:function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&T(r,i.prototype),r},k.apply(null,arguments)}function j(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}function M(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&T(e,t)}function T(e,t){return T=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},T(e,t)}function x(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function I(e){var t="function"==typeof Map?new Map:void 0;return I=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return k(e,arguments,R(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),T(i,e)},I(e)}function P(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(P=function(){return!!result})()}var N=Object.defineProperty,D=function(e,t,i){return function(e,t,i){return t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":x(t))?t+"":t,i)},q=function(e){function t(e,i){var n;return A(this,t),n=E(this,t,["".concat(e," : ").concat(""+i)]),D(n,"_errorCode"),n._errorCode=i,Object.setPrototypeOf(n,t.prototype),n}return M(t,e),j(t,[{key:"errorCode",get:function(){return this._errorCode}}]),t}(I(Error)),L=function(e){function t(e,i,n,r){var o;return A(this,t),o=E(this,t,[e,i]),D(o,"_errorMessage"),D(o,"_detailedMessage",""),o.message="".concat(e," : ").concat(n),o._errorMessage=n,r&&(o._detailedMessage=r),Object.setPrototypeOf(o,t.prototype),o}return M(t,e),j(t,[{key:"errorMessage",get:function(){return this._errorMessage}},{key:"detailedMessage",get:function(){return this._detailedMessage}}]),t}(q),z="true",F="false",B={cmi_children:"core,suspend_data,launch_data,comments,objectives,student_data,student_preference,interactions",core_children:"student_id,student_name,lesson_location,credit,lesson_status,entry,score,total_time,lesson_mode,exit,session_time",score_children:"raw,min,max",objectives_children:"id,score,status",correct_responses_children:"pattern",student_data_children:"mastery_score,max_time_allowed,time_limit_action",student_preference_children:"audio,language,speed,text",interactions_children:"id,objectives,time,type,correct_responses,weighting,student_response,result,latency",error_descriptions:{0:{basicMessage:"No Error",detailMessage:"No error occurred, the previous API call was successful."},101:{basicMessage:"General Exception",detailMessage:"No specific error code exists to describe the error."},201:{basicMessage:"Invalid argument error",detailMessage:"Indicates that an argument represents an invalid data model element or is otherwise incorrect."},202:{basicMessage:"Element cannot have children",detailMessage:'Indicates that LMSGetValue was called with a data model element name that ends in "_children" for a data model element that does not support the "_children" suffix.'},203:{basicMessage:"Element not an array - cannot have count",detailMessage:'Indicates that LMSGetValue was called with a data model element name that ends in "_count" for a data model element that does not support the "_count" suffix.'},301:{basicMessage:"Not initialized",detailMessage:"Indicates that an API call was made before the call to lmsInitialize."},401:{basicMessage:"Not implemented error",detailMessage:"The data model element indicated in a call to LMSGetValue or LMSSetValue is valid, but was not implemented by this LMS. SCORM 1.2 defines a set of data model elements as being optional for an LMS to implement."},402:{basicMessage:"Invalid set value, element is a keyword",detailMessage:'Indicates that LMSSetValue was called on a data model element that represents a keyword (elements that end in "_children" and "_count").'},403:{basicMessage:"Element is read only",detailMessage:"LMSSetValue was called with a data model element that can only be read."},404:{basicMessage:"Element is write only",detailMessage:"LMSGetValue was called on a data model element that can only be written to."},405:{basicMessage:"Incorrect Data Type",detailMessage:"LMSSetValue was called with a value that is not consistent with the data format of the supplied data model element."},407:{basicMessage:"Element Value Out Of Range",detailMessage:"The numeric value supplied to a LMSSetValue call is outside of the numeric range allowed for the supplied data model element."},408:{basicMessage:"Data Model Dependency Not Established",detailMessage:"Some data model elements cannot be set until another data model element was set. This error condition indicates that the prerequisite element was not set before the dependent element."}}},V={cmi_children:"_version,comments_from_learner,comments_from_lms,completion_status,completion_threshold,credit,entry,exit,interactions,launch_data,learner_id,learner_name,learner_preference,location,max_time_allowed,mode,objectives,progress_measure,scaled_passing_score,score,session_time,success_status,suspend_data,time_limit_action,total_time",comments_children:"comment,timestamp,location",score_children:"max,raw,scaled,min",objectives_children:"progress_measure,completion_status,success_status,description,score,id",correct_responses_children:"pattern",student_preference_children:"audio_level,audio_captioning,delivery_speed,language",interactions_children:"id,type,objectives,timestamp,correct_responses,weighting,learner_response,result,latency,description",adl_data_children:"id,store",error_descriptions:{0:{basicMessage:"No Error",detailMessage:"No error occurred, the previous API call was successful."},101:{basicMessage:"General Exception",detailMessage:"No specific error code exists to describe the error."},102:{basicMessage:"General Initialization Failure",detailMessage:"Call to Initialize failed for an unknown reason."},103:{basicMessage:"Already Initialized",detailMessage:"Call to Initialize failed because Initialize was already called."},104:{basicMessage:"Content Instance Terminated",detailMessage:"Call to Initialize failed because Terminate was already called."},111:{basicMessage:"General Termination Failure",detailMessage:"Call to Terminate failed for an unknown reason."},112:{basicMessage:"Termination Before Initialization",detailMessage:"Call to Terminate failed because it was made before the call to Initialize."},113:{basicMessage:"Termination After Termination",detailMessage:"Call to Terminate failed because Terminate was already called."},122:{basicMessage:"Retrieve Data Before Initialization",detailMessage:"Call to GetValue failed because it was made before the call to Initialize."},123:{basicMessage:"Retrieve Data After Termination",detailMessage:"Call to GetValue failed because it was made after the call to Terminate."},132:{basicMessage:"Store Data Before Initialization",detailMessage:"Call to SetValue failed because it was made before the call to Initialize."},133:{basicMessage:"Store Data After Termination",detailMessage:"Call to SetValue failed because it was made after the call to Terminate."},142:{basicMessage:"Commit Before Initialization",detailMessage:"Call to Commit failed because it was made before the call to Initialize."},143:{basicMessage:"Commit After Termination",detailMessage:"Call to Commit failed because it was made after the call to Terminate."},201:{basicMessage:"General Argument Error",detailMessage:"An invalid argument was passed to an API method (usually indicates that Initialize, Commit or Terminate did not receive the expected empty string argument."},301:{basicMessage:"General Get Failure",detailMessage:"Indicates a failed GetValue call where no other specific error code is applicable. Use GetDiagnostic for more information."},351:{basicMessage:"General Set Failure",detailMessage:"Indicates a failed SetValue call where no other specific error code is applicable. Use GetDiagnostic for more information."},391:{basicMessage:"General Commit Failure",detailMessage:"Indicates a failed Commit call where no other specific error code is applicable. Use GetDiagnostic for more information."},401:{basicMessage:"Undefined Data Model Element",detailMessage:"The data model element name passed to GetValue or SetValue is not a valid SCORM data model element."},402:{basicMessage:"Unimplemented Data Model Element",detailMessage:"The data model element indicated in a call to GetValue or SetValue is valid, but was not implemented by this LMS. In SCORM 2004, this error would indicate an LMS that is not fully SCORM conformant."},403:{basicMessage:"Data Model Element Value Not Initialized",detailMessage:"Attempt to read a data model element that has not been initialized by the LMS or through a SetValue call. This error condition is often reached during normal execution of a SCO."},404:{basicMessage:"Data Model Element Is Read Only",detailMessage:"SetValue was called with a data model element that can only be read."},405:{basicMessage:"Data Model Element Is Write Only",detailMessage:"GetValue was called on a data model element that can only be written to."},406:{basicMessage:"Data Model Element Type Mismatch",detailMessage:"SetValue was called with a value that is not consistent with the data format of the supplied data model element."},407:{basicMessage:"Data Model Element Value Out Of Range",detailMessage:"The numeric value supplied to a SetValue call is outside of the numeric range allowed for the supplied data model element."},408:{basicMessage:"Data Model Dependency Not Established",detailMessage:"Some data model elements cannot be set until another data model element was set. This error condition indicates that the prerequisite element was not set before the dependent element."}}};function H(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function U(e,t,i){return t=G(t),n=e,!(r=Y()?Reflect.construct(t,i||[],G(e).constructor):t.apply(e,i))||"object"!=((o=r)&&"undefined"!=typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)&&"function"!=typeof r?H(n):r;var n,r,o}function G(e){return G=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},G(e)}function K(e,t){return K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},K(e,t)}function Y(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Y=function(){return!!result})()}var W=B.error_descriptions,J=function(e){function t(e,i){var n,r,o,a,s,c;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n={}.hasOwnProperty.call(W,i+"")?U(this,t,[e,i,(null===(r=W[i+""])||void 0===r?void 0:r.basicMessage)||"Unknown error",null===(o=W[i+""])||void 0===o?void 0:o.detailMessage]):U(this,t,[e,101,null!==(a=null===(s=W[101])||void 0===s?void 0:s.basicMessage)&&void 0!==a?a:"General error",null===(c=W[101])||void 0===c?void 0:c.detailMessage]),Object.setPrototypeOf(H(n),t.prototype),H(n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&K(e,t)}(t,e),t}(L);function $(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function X(e,t,i){return t=Q(t),n=e,!(r=ee()?Reflect.construct(t,i||[],Q(e).constructor):t.apply(e,i))||"object"!=((o=r)&&"undefined"!=typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)&&"function"!=typeof r?$(n):r;var n,r,o}function Q(e){return Q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Q(e)}function Z(e,t){return Z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Z(e,t)}function ee(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ee=function(){return!!result})()}var te=V.error_descriptions,ie=function(e){function t(e,i){var n,r,o,a,s;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n={}.hasOwnProperty.call(te,i+"")?X(this,t,[e,i,(null===(r=te[i+""])||void 0===r?void 0:r.basicMessage)||"Unknown error",null===(o=te[i+""])||void 0===o?void 0:o.detailMessage]):X(this,t,[e,101,(null===(a=te[101])||void 0===a?void 0:a.basicMessage)||"General error",null===(s=te[101])||void 0===s?void 0:s.detailMessage]),Object.setPrototypeOf($(n),t.prototype),$(n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Z(e,t)}(t,e),t}(L);function ne(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function re(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){ne(e,t,i[t])})}return e}function oe(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}),e}var ae={GENERAL:101,INITIALIZATION_FAILED:101,INITIALIZED:101,TERMINATED:101,TERMINATION_FAILURE:101,TERMINATION_BEFORE_INIT:101,MULTIPLE_TERMINATION:101,RETRIEVE_BEFORE_INIT:101,RETRIEVE_AFTER_TERM:101,STORE_BEFORE_INIT:101,STORE_AFTER_TERM:101,COMMIT_BEFORE_INIT:101,COMMIT_AFTER_TERM:101,ARGUMENT_ERROR:101,CHILDREN_ERROR:101,COUNT_ERROR:101,GENERAL_GET_FAILURE:101,GENERAL_SET_FAILURE:101,GENERAL_COMMIT_FAILURE:101,UNDEFINED_DATA_MODEL:101,UNIMPLEMENTED_ELEMENT:101,VALUE_NOT_INITIALIZED:101,INVALID_SET_VALUE:101,READ_ONLY_ELEMENT:101,WRITE_ONLY_ELEMENT:101,TYPE_MISMATCH:101,VALUE_OUT_OF_RANGE:101,DEPENDENCY_NOT_ESTABLISHED:101},se=oe(re({},ae),{RETRIEVE_BEFORE_INIT:301,STORE_BEFORE_INIT:301,COMMIT_BEFORE_INIT:301,ARGUMENT_ERROR:201,CHILDREN_ERROR:202,COUNT_ERROR:203,UNDEFINED_DATA_MODEL:401,UNIMPLEMENTED_ELEMENT:401,VALUE_NOT_INITIALIZED:301,INVALID_SET_VALUE:402,READ_ONLY_ELEMENT:403,WRITE_ONLY_ELEMENT:404,TYPE_MISMATCH:405,VALUE_OUT_OF_RANGE:405,DEPENDENCY_NOT_ESTABLISHED:408}),ce=oe(re({},ae),{INITIALIZATION_FAILED:102,INITIALIZED:103,TERMINATED:104,TERMINATION_FAILURE:111,TERMINATION_BEFORE_INIT:112,MULTIPLE_TERMINATION:113,MULTIPLE_TERMINATIONS:113,RETRIEVE_BEFORE_INIT:122,RETRIEVE_AFTER_TERM:123,STORE_BEFORE_INIT:132,STORE_AFTER_TERM:133,COMMIT_BEFORE_INIT:142,COMMIT_AFTER_TERM:143,ARGUMENT_ERROR:201,GENERAL_GET_FAILURE:301,GENERAL_SET_FAILURE:351,GENERAL_COMMIT_FAILURE:391,UNDEFINED_DATA_MODEL:401,UNIMPLEMENTED_ELEMENT:402,VALUE_NOT_INITIALIZED:403,READ_ONLY_ELEMENT:404,WRITE_ONLY_ELEMENT:405,TYPE_MISMATCH:406,VALUE_OUT_OF_RANGE:407,DEPENDENCY_NOT_ESTABLISHED:408});function le(e){return le=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},le(e)}function ue(e,t){return ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ue(e,t)}function de(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function fe(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(fe=function(){return!!result})()}var ve=Object.defineProperty,he=function(e,t,i){return function(e,t,i){return t in e?ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":de(t))?t+"":t,i)},me=function(e){function t(e){var i,n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=le(t),n=e,!(r=fe()?Reflect.construct(t,i||[],le(e).constructor):t.apply(e,i))||"object"!==de(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,[e.CMIElement]),he(i,"_errorCode"),he(i,"_errorClass"),he(i,"__children"),he(i,"childArray"),i.__children=e.children,i._errorCode=null!==(n=e.errorCode)&&void 0!==n?n:se.GENERAL,i._errorClass=e.errorClass||q,i.childArray=[],i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ue(e,t)}(t,e),i=t,n=[{key:"reset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._initialized=!1,e)this.childArray=[];else for(var t=0;this.childArray.length>t;t++){var i;null===(i=this.childArray[t])||void 0===i||i.reset()}}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new this._errorClass(this._cmi_element+"._children",this._errorCode)}},{key:"_count",get:function(){return this.childArray.length},set:function(_count){throw new this._errorClass(this._cmi_element+"._count",this._errorCode)}},{key:"toJSON",value:function(){this.jsonString=!0;for(var result={},e=0;this.childArray.length>e;e++)result[e+""]=this.childArray[e];return this.jsonString=!1,result}}],n&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O),pe="unknown",ye="true",ge="false",_e="passed",be="failed",Se="unknown",we="completed",Oe="incomplete",Ce="unknown",Ee={_:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5};function Ae(e,t,i,n,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(n,r)}var ke={autocommit:!1,autocommitSeconds:10,throttleCommits:!1,useAsynchronousCommits:!1,sendFullCommit:!0,lmsCommitUrl:!1,dataCommitFormat:"json",commitRequestDataType:"application/json;charset=UTF-8",autoProgress:!1,logLevel:Ee.ERROR,selfReportSessionTime:!1,alwaysSendTotalTime:!1,renderCommonCommitFields:!1,autoCompleteLessonStatus:!1,strict_errors:!0,xhrHeaders:{},xhrWithCredentials:!1,fetchMode:"cors",asyncModeBeaconBehavior:"never",includeCommitSequence:!1,responseHandler:function(e){return(t=function(){var t,i;return function(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:c(0)}),s(a,"throw",{value:c(1)}),s(a,"return",{value:c(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function c(s){return function(c){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(n){switch(n.label){case 0:if(void 0===e)return[3,8];t=null,n.label=1;case 1:return n.trys.push([1,6,,7]),"function"!=typeof e.json?[3,3]:[4,e.json()];case 2:return t=n.sent(),[3,5];case 3:return"function"!=typeof e.text?[3,5]:[4,e.text()];case 4:(i=n.sent())&&(t=JSON.parse(i)),n.label=5;case 5:return[3,7];case 6:return n.sent(),[3,7];case 7:return null!==t&&{}.hasOwnProperty.call(t,"result")?[2,{result:t.result,errorCode:"number"==typeof t.errorCode?t.errorCode:!0===t.result||t.result===z?0:101}]:200===e.status?[2,{result:z,errorCode:0}]:[2,{result:F,errorCode:101}];case 8:return[2,{result:F,errorCode:101}]}})},function(){var e=this,i=arguments;return new Promise(function(n,r){var o=t.apply(e,i);function a(e){Ae(o,n,r,a,s,"next",e)}function s(e){Ae(o,n,r,a,s,"throw",e)}a(void 0)})})();var t},xhrResponseHandler:function(e){if(void 0!==e){var t=null;if(200>e.status||e.status>299)return{result:F,errorCode:101};try{t=JSON.parse(e.responseText)}catch(e){}return null!==t&&{}.hasOwnProperty.call(t,"result")?{result:t.result,errorCode:"number"==typeof t.errorCode?t.errorCode:!0===t.result||t.result===z?0:101}:{result:z,errorCode:0}}return{result:F,errorCode:101}},requestHandler:function(e){return e},onLogMessage:je,mastery_override:!1,score_overrides_status:!1,completion_status_on_failed:"completed",scoItemIds:[],scoItemIdValidator:!1,globalObjectiveIds:[],enableOfflineSupport:!1,courseId:"",syncOnInitialize:!0,syncOnTerminate:!0,maxSyncAttempts:5,scoId:"",autoPopulateCommitMetadata:!1,httpService:null,globalStudentPreferences:!1};function je(e,t){switch(e){case"4":case 4:case"ERROR":case Ee.ERROR:console.error(t);break;case"3":case 3:case"WARN":case Ee.WARN:console.warn(t);break;case"2":case 2:case"INFO":case Ee.INFO:console.info(t);break;case"1":case 1:case"DEBUG":case Ee.DEBUG:console.debug?console.debug(t):console.log(t)}}var Re="^[\\s\\S]{0,255}$",Me="^([0-9]+):([0-9]{2}):([0-9]{2})(\\.\\d{1,2})?$",Te="^-?([0-9]+)$",xe="^-?([0-9]{0,10})(\\.[0-9]*)?$",Ie="^[\\u0021-\\u007E\\s]{0,255}$",Pe="^.*$",Ne="^(passed|completed|failed|incomplete|browsed|not attempted)$",De="0#100",qe="^[\\u0000-\\uFFFF]{0,4000}$",Le="^[\\u0000-\\uFFFF]{0,64000}$",ze="^({lang=([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,250}$)?$",Fe="^({lang=([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).*$)?$",Be="^({lang=([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,4000}$)?$",Ve="^(19[7-9][0-9]|[2-9][0-9]{3})((-(0[1-9]|1[0-2]))((-(0[1-9]|[1-2][0-9]|3[0-1]))(T([0-1][0-9]|2[0-3])((:[0-5][0-9])((:[0-5][0-9])((\\.[0-9]{1,6})((Z|([+|-]([0-1][0-9]|2[0-3])))(:[0-5][0-9])?)?)?)?)?)?)?)?$",He="^P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?(?:T?(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:(\\d+(?:\\.\\d{1,2})?)S)?)?$",Ue="^-?([0-9]{1,10})(\\.[0-9]{1,18})?$",Ge="^(?=.*\\w)[\\w\\-\\(\\)\\+\\.\\:\\=\\@\\;\\$\\_\\!\\*\\'\\%\\/\\#]{1,250}$",Ke="^(?:(?!urn:)\\S{1,4000}|urn:[A-Za-z0-9-]{1,31}:\\S{1,4000}|.{1,4000})$",Ye="^(completed|incomplete|not attempted|unknown)$",We="^(passed|failed|unknown)$",Je="^(_?(start|resumeAll|previous|continue|exit|exitAll|abandon|abandonAll|suspendAll|retry|retryAll)|_none_|(\\{target=(?<choice_target>\\S{0,}[a-zA-Z0-9-_]+)})?choice|(\\{target=(?<jump_target>\\S{0,}[a-zA-Z0-9-_]+)})?jump)$",$e="^(unknown|true|false)$",Xe="^{target=\\S{0,}[a-zA-Z0-9-_]+}$",Qe="^$|"+Ge,Ze="(?![\\s\\S]*(?:\\[,\\]|\\[\\.\\]|\\[:\\]))[\\s\\S]{1,250}",et={"true-false":{format:"^true$|^false$",max:1,delimiter:"",unique:!1},choice:{format:Ke,max:36,delimiter:"[,]",unique:!0},"fill-in":{format:ze,max:10,delimiter:"[,]",unique:!1},"long-fill-in":{format:Be,max:1,delimiter:"",unique:!1},matching:{format:Ge,format2:Ge,max:36,delimiter:"[,]",delimiter2:"[.]",unique:!1},performance:{format:Qe,format2:"^(?:|"+Ze+")$",max:250,delimiter:"[,]",delimiter2:"[.]",unique:!1},sequencing:{format:Ge,max:36,delimiter:"[,]",unique:!1},likert:{format:Ge,max:1,delimiter:"",unique:!1},numeric:{format:Ue,max:1,delimiter:"",unique:!1},other:{format:qe,max:1,delimiter:"",unique:!1}},tt={"true-false":{max:1,delimiter:"",unique:!1,duplicate:!1,format:"^true$|^false$",limit:1},choice:{max:36,delimiter:"[,]",unique:!0,duplicate:!1,format:Ke},"fill-in":{max:10,delimiter:"[,]",unique:!1,duplicate:!1,format:"^(({lang=([a-zA-Z]{1,8}|i|x)?(-[a-zA-Z0-9-]{2,8})?})?(.{0,250})?)?$"},"long-fill-in":{max:1,delimiter:"",unique:!1,duplicate:!0,format:Be},matching:{max:36,delimiter:"[,]",delimiter2:"[.]",unique:!1,duplicate:!1,format:Ge,format2:Ge},performance:{max:250,delimiter:"[,]",delimiter2:"[.]",unique:!1,duplicate:!1,format:Qe,format2:"^(?:|(?:-?\\d+(?:\\.\\d+)?)?\\[:\\](?:-?\\d+(?:\\.\\d+)?)?|"+Ze+")$"},sequencing:{max:36,delimiter:"[,]",unique:!1,duplicate:!1,format:Ge},likert:{max:1,delimiter:"",unique:!1,duplicate:!1,format:Ge,limit:1},numeric:{max:2,delimiter:"[:]",unique:!1,duplicate:!1,format:Ue,limit:1},other:{max:1,delimiter:"",unique:!1,duplicate:!1,format:qe,limit:1}};function it(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}!function(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){it(e,t,i[t])})}}({},{"NB.2.1-1":"Sequencing session already started","NB.2.1-2":"Current activity not defined / sequencing not begun","NB.2.1-3":"No suspended activity to resume","NB.2.1-4":"Flow not enabled / current activity is root","NB.2.1-5":"Violates control mode (forward only or flow disabled)","NB.2.1-6":"Cannot move backward from root","NB.2.1-7":"Forward/Backward navigation not supported","NB.2.1-8":"Forward-only constraint violation","NB.2.1-9":"Activity path empty","NB.2.1-10":"Choice control disabled on parent","NB.2.1-11":"Target activity does not exist","NB.2.1-12":"Activity already terminated","NB.2.1-13":"Undefined navigation request","NB.2.1-14":"No current activity for EXIT_ALL","NB.2.1-15":"No current activity for ABANDON","NB.2.1-16":"No current activity for ABANDON_ALL","NB.2.1-17":"No current activity for SUSPEND_ALL","NB.2.1-18":"Invalid navigation request type"},{"TB.2.3-1":"No current activity to terminate","TB.2.3-2":"Current activity already terminated","TB.2.3-3":"Nothing to suspend (root activity)","TB.2.3-4":"Cannot EXIT_PARENT from root activity","TB.2.3-5":"Activity path is empty during suspend","TB.2.3-6":"Nothing to abandon","TB.2.3-7":"Undefined termination request"},{"SB.2.1-2":"No available children to deliver","SB.2.1-3":"Reached beginning of course","SB.2.1-4":"Forward only violation - cannot traverse backward"},{"SB.2.2-1":"Flow control disabled on parent","SB.2.2-2":"Activity not available"},{"SB.2.7-1":"Sequencing session not begun (current activity not terminated)","SB.2.7-2":"Cannot continue - flow disabled or no activity available"},{"SB.2.8-1":"Current activity not terminated","SB.2.8-2":"Cannot go previous - at beginning or forwardOnly enabled"},{"SB.2.9-1":"Target activity does not exist","SB.2.9-2":"Target activity not in tree","SB.2.9-3":"Cannot choose root activity","SB.2.9-4":"Activity hidden from choice","SB.2.9-5":"Choice control is not allowed","SB.2.9-6":"Current activity not terminated","SB.2.9-7":"No activity available from target","SB.2.9-8":"choiceExit prevents navigation outside ancestor subtree"},{"SB.2.4-1":"Stop forward traversal rule evaluates to true","SB.2.4-2":"Constrained choice requires forward traversal from leaf","SB.2.4-3":"Cannot walk backward from root of activity tree"},{"SB.2.10-1":"Current activity not defined","SB.2.10-2":"Activity is still active or suspended","SB.2.10-3":"Flow subprocess returned false (nothing to deliver)"},{"SB.2.11-1":"Exit not allowed - no parent","SB.2.11-2":"Exit not allowed by sequencing controls"},{"SB.2.12-1":"No current activity","SB.2.12-5":"No target activity specified","SB.2.12-6":"Undefined sequencing request"},{"SB.2.13-1":"Target activity does not exist","SB.2.13-2":"Target activity not in tree","SB.2.13-3":"Target not available"},{"SB.2.5-1":"No activity tree","SB.2.5-2":"Sequencing session already begun","SB.2.5-3":"No activity available"},{"SB.2.6-1":"No suspended activity","SB.2.6-2":"Current activity already defined"},{"SB.2.15-1":"Cannot suspend root"});var nt=["aa","ab","ae","af","ak","am","an","ar","as","av","ay","az","ba","be","bg","bh","bi","bm","bn","bo","br","bs","ca","ce","ch","co","cr","cs","cu","cv","cy","da","de","dv","dz","ee","el","en","eo","es","et","eu","fa","ff","fi","fj","fo","fr","fy","ga","gd","gl","gn","gu","gv","ha","he","hi","ho","hr","ht","hu","hy","hz","ia","id","ie","ig","ii","ik","io","is","it","iu","ja","jv","ka","kg","ki","kj","kk","kl","km","kn","ko","kr","ks","ku","kv","kw","ky","la","lb","lg","li","ln","lo","lt","lu","lv","mg","mh","mi","mk","ml","mn","mo","mr","ms","mt","my","na","nb","nd","ne","ng","nl","nn","no","nr","nv","ny","oc","oj","om","or","os","pa","pi","pl","ps","pt","qu","rm","rn","ro","ru","rw","sa","sc","sd","se","sg","sh","si","sk","sl","sm","sn","so","sq","sr","ss","st","su","sv","sw","ta","te","tg","th","ti","tk","tl","tn","to","tr","ts","tt","tw","ty","ug","uk","ur","uz","ve","vi","vo","wa","wo","xh","yi","yo","za","zh","zu","aar","abk","ave","afr","aka","amh","arg","ara","asm","ava","aym","aze","bak","bel","bul","bih","bis","bam","ben","tib","bod","bre","bos","cat","che","cha","cos","cre","cze","ces","chu","chv","wel","cym","dan","ger","deu","div","dzo","ewe","gre","ell","eng","epo","spa","est","baq","eus","per","fas","ful","fin","fij","fao","fre","fra","fry","gle","gla","glg","grn","guj","glv","hau","heb","hin","hmo","hrv","hat","hun","arm","hye","her","ina","ind","ile","ibo","iii","ipk","ido","ice","isl","ita","iku","jpn","jav","geo","kat","kon","kik","kua","kaz","kal","khm","kan","kor","kau","kas","kur","kom","cor","kir","lat","ltz","lug","lim","lin","lao","lit","lub","lav","mlg","mah","mao","mri","mac","mkd","mal","mon","mol","mar","may","msa","mlt","bur","mya","nau","nob","nde","nep","ndo","dut","nld","nno","nor","nbl","nav","nya","oci","oji","orm","ori","oss","pan","pli","pol","pus","por","que","roh","run","rum","ron","rus","kin","san","srd","snd","sme","sag","slo","sin","slk","slv","smo","sna","som","alb","sqi","srp","ssw","sot","sun","swe","swa","tam","tel","tgk","tha","tir","tuk","tgl","tsn","ton","tur","tso","tat","twi","tah","uig","ukr","urd","uzb","ven","vie","vol","wln","wol","xho","yid","yor","zha","chi","zho","zul"];function rt(e,t,i,n,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(n,r)}var ot=Object.defineProperty,at=function(e,t,i){return function(e,t,i){return t in e?ot(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},st=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),at(this,"_API"),at(this,"_cancelled",!1),at(this,"_timeout"),at(this,"_callback"),this._API=t,this._timeout=setTimeout(this.wrapper.bind(this),i),this._callback=n}return t=e,i=[{key:"cancel",value:function(){this._cancelled=!0,this._timeout&&clearTimeout(this._timeout)}},{key:"wrapper",value:function(){var e;this._cancelled||this._API.isInitialized()&&(e=function(){return function(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:c(0)}),s(a,"throw",{value:c(1)}),s(a,"return",{value:c(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function c(s){return function(c){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(e){switch(e.label){case 0:return[4,this._API.commit(this._callback,!1,"autocommit")];case 1:return[2,e.sent()]}})},function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){rt(o,n,r,a,s,"next",e)}function s(e){rt(o,n,r,a,s,"throw",e)}a(void 0)})}).call(this)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}(),ct=["continue","previous","exit","exitAll","abandon","abandonAll","suspendAll"];function lt(e,t,i){return t=vt(t),n=e,!(r=gt()?Reflect.construct(t,i||[],vt(e).constructor):t.apply(e,i))||"object"!==yt(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function ut(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dt(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ft(e,t,i){return t&&dt(e.prototype,t),i&&dt(e,i),e}function vt(e){return vt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},vt(e)}function ht(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pt(e,t)}function mt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function pt(e,t){return pt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},pt(e,t)}function yt(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function gt(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(gt=function(){return!!result})()}var _t=Object.defineProperty,bt=function(e,t,i){return function(e,t,i){return t in e?_t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":yt(t))?t+"":t,i)},St=function(e){return e.SKIP="skip",e.DISABLED="disabled",e.HIDE_FROM_CHOICE="hiddenFromChoice",e.STOP_FORWARD_TRAVERSAL="stopForwardTraversal",e.EXIT_PARENT="exitParent",e.EXIT_ALL="exitAll",e.RETRY="retry",e.RETRY_ALL="retryAll",e.CONTINUE="continue",e.PREVIOUS="previous",e.EXIT="exit",e}(St||{});var wt=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"always",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Map;return ut(this,t),e=lt(this,t,["ruleCondition"]),bt(e,"_condition","always"),bt(e,"_operator",null),bt(e,"_parameters",new Map),bt(e,"_referencedObjective",null),e._condition=i,e._operator=n,e._parameters=r,e}return ht(t,e),ft(t,[{key:"reset",value:function(){this._initialized=!1,this._condition="always",this._operator=null,this._parameters=new Map}},{key:"condition",get:function(){return this._condition},set:function(e){this._condition=e}},{key:"operator",get:function(){return this._operator},set:function(e){this._operator=e}},{key:"parameters",get:function(){return this._parameters},set:function(e){this._parameters=e}},{key:"referencedObjective",get:function(){return this._referencedObjective},set:function(e){this._referencedObjective=e}},{key:"resolveReferencedObjective",value:function(e){var t,i=this;return this._referencedObjective?(null===(t=e.primaryObjective)||void 0===t?void 0:t.id)===this._referencedObjective?e.primaryObjective:(e.objectives||[]).find(function(e){return e.id===i._referencedObjective})||null:null}},{key:"evaluate",value:function(e){var result,t,i=null!==this._referencedObjective,n=this.resolveReferencedObjective(e);switch(this._condition){case"satisfied":case"objectiveSatisfied":result=!(i&&!n)&&(n?n.satisfiedStatusKnown||n.progressStatus?!0===n.satisfiedStatus:"unknown":e.objectiveSatisfiedStatusKnown?!0===e.objectiveSatisfiedStatus:e.successStatus!==Se?e.successStatus===_e:"unknown");break;case"objectiveStatusKnown":result=!(i&&!n||(n?!n.satisfiedStatusKnown:!e.objectiveSatisfiedStatusKnown));break;case"objectiveMeasureKnown":result=!(i&&!n||(n?!n.measureStatus:!e.objectiveMeasureStatus));break;case"objectiveMeasureGreaterThan":if(i&&!n){result=!1;break}var r=this._parameters.get("threshold")||0;result=(n?n.measureStatus:e.objectiveMeasureStatus)?(n?n.normalizedMeasure:e.objectiveNormalizedMeasure)>r:"unknown";break;case"objectiveMeasureLessThan":if(i&&!n){result=!1;break}var o=this._parameters.get("threshold")||0;result=(n?n.measureStatus:e.objectiveMeasureStatus)?o>(n?n.normalizedMeasure:e.objectiveNormalizedMeasure):"unknown";break;case"completed":case"activityCompleted":result=!(i&&!n)&&(n?n.completionStatus===Ce?"unknown":n.completionStatus===we:e.completionStatus===Ce?"unknown":e.completionStatus===we);break;case"progressKnown":case"activityProgressKnown":result=!(i&&!n)&&(n?n.completionStatus!==Ce:"unknown"!==e.completionStatus);break;case"attempted":result=e.attemptCount>0;break;case"attemptLimitExceeded":result=e.hasAttemptLimitExceeded();break;case"timeLimitExceeded":result=this.evaluateTimeLimitExceeded(e);break;case"outsideAvailableTimeRange":result=this.evaluateOutsideAvailableTimeRange(e);break;case"always":result=!0;break;default:result=!1}return"not"===this._operator&&(result="unknown"===(t=result)?"unknown":!t),result}},{key:"evaluateTimeLimitExceeded",value:function(e){var i=e.timeLimitDuration;if(!i&&e.attemptAbsoluteDurationLimit&&(i=e.attemptAbsoluteDurationLimit),!i)return!1;var n=c(i,He);if(0>=n)return!1;var r=0;if(t._getElapsedSecondsHook)try{var o=t._getElapsedSecondsHook(e);"number"!=typeof o||Number.isNaN(o)||0>o||(r=o)}catch(e){r=0}if(0===r&&e.attemptExperiencedDuration){var a=c(e.attemptExperiencedDuration,He);a>0&&(r=a)}if(0===r&&e.attemptAbsoluteStartTime)try{var s=new Date(e.attemptAbsoluteStartTime).getTime(),l=t._now().getTime();Number.isNaN(s)||Number.isNaN(l)||s>l||(r=(l-s)/1e3)}catch(e){r=0}return r>n}},{key:"evaluateOutsideAvailableTimeRange",value:function(e){var i=e.beginTimeLimit,n=e.endTimeLimit;if(!i&&!n)return!1;var r=t._now();return!(!i||r>=new Date(i))||!(!n||new Date(n)>=r)}},{key:"parseISO8601Duration",value:function(e){return 1e3*c(e,He)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={condition:this._condition,operator:this._operator,parameters:Object.fromEntries(this._parameters)};return this.jsonString=!1,result}}],[{key:"setNowProvider",value:function(e){"function"==typeof e&&(t._now=e)}},{key:"setElapsedSecondsHook",value:function(e){t._getElapsedSecondsHook=e}}]),t}(O);bt(wt,"_now",function(){return new Date}),bt(wt,"_getElapsedSecondsHook");var Ot=wt,Ct=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"skip",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"and";return ut(this,t),e=lt(this,t,["sequencingRule"]),bt(e,"_conditions",[]),bt(e,"_action","skip"),bt(e,"_conditionCombination","and"),e._action=i,e._conditionCombination=n,e}return ht(t,e),ft(t,[{key:"reset",value:function(){this._initialized=!1,this._conditions=[],this._action="skip",this._conditionCombination="and"}},{key:"conditions",get:function(){return this._conditions}},{key:"addCondition",value:function(e){if(!mt(e,Ot))throw new ie(this._cmi_element+".conditions",ce.TYPE_MISMATCH);this._conditions.includes(e)||this._conditions.push(e)}},{key:"removeCondition",value:function(e){if(!mt(e,Ot))throw new ie(this._cmi_element+".conditions",ce.TYPE_MISMATCH);var t=this._conditions.indexOf(e);return-1!==t&&(this._conditions.splice(t,1),!0)}},{key:"action",get:function(){return this._action},set:function(e){this._action=e}},{key:"conditionCombination",get:function(){return this._conditionCombination},set:function(e){this._conditionCombination=e}},{key:"evaluate",value:function(e){return!0===(t=this._conditions.map(function(t){return t.evaluate(e)}),i=this._conditionCombination,0!==t.length&&("all"===i||"and"===i?function(e){var t=!1,i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(!1===s)return!1;"unknown"===s&&(t=!0)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return!t||"unknown"}(t):("any"===i||"or"===i)&&function(e){var t=!1,i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(!0===s)return!0;"unknown"===s&&(t=!0)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return!!t&&"unknown"}(t)));var t,i}},{key:"toJSON",value:function(){this.jsonString=!0;var result={conditions:this._conditions,action:this._action,conditionCombination:this._conditionCombination};return this.jsonString=!1,result}}]),t}(O),Et=function(e){function t(){var e;return ut(this,t),e=lt(this,t,["sequencingRules"]),bt(e,"_preConditionRules",[]),bt(e,"_exitConditionRules",[]),bt(e,"_postConditionRules",[]),e}return ht(t,e),ft(t,[{key:"reset",value:function(){this._initialized=!1,this._preConditionRules=[],this._exitConditionRules=[],this._postConditionRules=[]}},{key:"preConditionRules",get:function(){return this._preConditionRules}},{key:"addPreConditionRule",value:function(e){if(!mt(e,Ct))throw new ie(this._cmi_element+".preConditionRules",ce.TYPE_MISMATCH);this._preConditionRules.push(e)}},{key:"exitConditionRules",get:function(){return this._exitConditionRules}},{key:"addExitConditionRule",value:function(e){if(!mt(e,Ct))throw new ie(this._cmi_element+".exitConditionRules",ce.TYPE_MISMATCH);this._exitConditionRules.push(e)}},{key:"postConditionRules",get:function(){return this._postConditionRules}},{key:"addPostConditionRule",value:function(e){if(!mt(e,Ct))throw new ie(this._cmi_element+".postConditionRules",ce.TYPE_MISMATCH);this._postConditionRules.push(e)}},{key:"evaluatePreConditionRules",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=this._preConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.evaluate(e))return a.action}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"evaluateExitConditionRules",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=this._exitConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.evaluate(e))return a.action}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"evaluatePostConditionRules",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=this._postConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.evaluate(e))return a.action}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"toJSON",value:function(){this.jsonString=!0;var result={preConditionRules:this._preConditionRules,exitConditionRules:this._exitConditionRules,postConditionRules:this._postConditionRules};return this.jsonString=!1,result}}]),t}(O);var At=Object.defineProperty,kt=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),n=t,function(e,t,i){t in e?At(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="activityTree")?i+"":i,n)}return t=e,(i=[{key:"isInTree",value:function(e){return this.activityTree.getAllActivities().includes(e)}},{key:"isAncestorOf",value:function(e,t){for(var i=t;i;){if(i===e)return!0;i=i.parent}return!1}},{key:"findCommonAncestor",value:function(e,t){if(!e||!t)return null;for(var i=[],n=e;n;)i.push(n),n=n.parent;for(n=t;n;){if(i.includes(n))return n;n=n.parent}return null}},{key:"findChildInPath",value:function(e,t){for(var i=t;i&&i.parent;){if(i.parent===e)return i;i=i.parent}return null}},{key:"isLastInTree",value:function(e){if(e.children.length>0)return!1;for(var t=e;t;){if(this.activityTree.getNextSibling(t))return!1;t=t.parent}return!0}},{key:"getCurrentInParent",value:function(e){if(e.children){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.isActive)return a}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}return null}},{key:"isMandatory",value:function(e){if(e.sequencingRules&&e.sequencingRules.preConditionRules){var t=!0,i=!1,n=void 0;try{for(var r,o=e.sequencingRules.preConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if("skip"===a.action&&a.conditions&&0===a.conditions.length)return!1}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}return!0===e.mandatory}},{key:"isCompleted",value:function(e){return"completed"===e.completionStatus||"passed"===e.completionStatus||"passed"===e.successStatus}},{key:"isAvailableForChoice",value:function(e){return e.isVisible&&!e.isHiddenFromChoice&&e.isAvailable&&(!e.sequencingControls||e.sequencingControls.choice)}},{key:"getAncestors",value:function(e){for(var t=[],i=e.parent;i;)t.push(i),i=i.parent;return t}},{key:"getPathToRoot",value:function(e){for(var t=[e],i=e.parent;i;)t.push(i),i=i.parent;return t}},{key:"isLeaf",value:function(e){return 0===e.children.length}},{key:"isCluster",value:function(e){return e.children.length>0}},{key:"getDepth",value:function(e){for(var t=0,i=e.parent;i;)t++,i=i.parent;return t}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var jt=Object.defineProperty,Rt=function(e,t,i){return function(e,t,i){return t in e?jt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Mt=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Rt(this,"activityTree",t),Rt(this,"treeQueries",i)}return t=e,i=[{key:"validateChoice",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!this.treeQueries.isInTree(t))return{valid:!1,exception:"SB.2.9-2"};if(t===this.activityTree.root)return{valid:!1,exception:"SB.2.9-3"};var n=this.validatePathToRoot(t);if(!n.valid)return n;if(i.checkAvailability&&!t.isAvailable)return{valid:!1,exception:"SB.2.9-7"};if(!e)return{valid:!0,exception:null};var r=this.validateChoiceExit(e,t);if(!r.valid)return r;var o=this.validateAncestorConstraints(e,t);return o.valid?{valid:!0,exception:null}:o}},{key:"validatePathToRoot",value:function(e){for(var t=e;t;){if(t.isHiddenFromChoice)return{valid:!1,exception:"SB.2.9-4"};if(t.parent&&!t.parent.sequencingControls.choice)return{valid:!1,exception:"SB.2.9-5"};if(t.parent&&t.parent.sequencingControls.preventActivation&&0===e.attemptCount&&!e.isActive)return{valid:!1,exception:"SB.2.9-6"};t=t.parent}return{valid:!0,exception:null}}},{key:"validateChoiceExit",value:function(e,t){for(var i=e.parent;i;){if(i.isActive&&!i.sequencingControls.choiceExit){if(!this.treeQueries.isAncestorOf(i,t))return{valid:!1,exception:"SB.2.9-8"};break}i=i.parent}return{valid:!0,exception:null}}},{key:"validateAncestorConstraints",value:function(e,t){for(var i=t.parent;i;){var n=this.validateConstraintsAtLevel(i,e,t);if(!n.valid)return n;i=i.parent}return{valid:!0,exception:null}}},{key:"validateConstraintsAtLevel",value:function(e,t,i){var n=this.treeQueries.findChildInPath(e,i),r=this.treeQueries.findChildInPath(e,t);if(!n||!r)return{valid:!0,exception:null};var o=e.children,a=o.indexOf(n),s=o.indexOf(r);if(-1===a||-1===s)return{valid:!0,exception:null};if(e.sequencingControls.forwardOnly&&s>a)return{valid:!1,exception:"SB.2.9-5"};if(a>s)for(var c=s+1;a>c;c++){var l=o[c];if(l&&this.treeQueries.isMandatory(l)&&!this.treeQueries.isCompleted(l))return{valid:!1,exception:"SB.2.9-6"}}if(e.sequencingControls.constrainChoice){if(a>s+1)return{valid:!1,exception:"SB.2.9-7"};if(s>a&&"completed"!==i.completionStatus&&"passed"!==i.completionStatus)return{valid:!1,exception:"SB.2.9-7"}}return e.sequencingControls.preventActivation&&0===i.attemptCount&&!i.isActive?{valid:!1,exception:"SB.2.9-6"}:{valid:!0,exception:null}}},{key:"checkForwardOnlyViolation",value:function(e){for(var t=e.parent;t;){if(t.sequencingControls.forwardOnly)return{valid:!1,exception:"SB.2.9-5"};t=t.parent}return{valid:!0,exception:null}}},{key:"isAvailableForChoice",value:function(e){return this.treeQueries.isAvailableForChoice(e)}},{key:"validateFlowConstraints",value:function(e,t){var i=[],n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;this.meetsFlowConstraints(c,e)&&i.push(c)}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return{valid:i.length>0,validChildren:i}}},{key:"meetsFlowConstraints",value:function(e,t){return!(!e.isAvailable||e.isHiddenFromChoice)&&(!t.sequencingControls.constrainChoice||this.validateConstrainChoiceForFlow(e,t))}},{key:"validateConstrainChoiceForFlow",value:function(e,t){if(!t.sequencingControls||!t.sequencingControls.constrainChoice)return!0;var i=t.children;if(!i||0===i.length)return!0;var n=i.indexOf(e);if(-1===n)return!1;var r=this.treeQueries.getCurrentInParent(t);if(!r)return this.isAvailableForChoice(e);var o=i.indexOf(r);return-1===o||(t.sequencingControls.flow?t.sequencingControls.forwardOnly&&o>n?"completed"===e.completionStatus||"passed"===e.completionStatus:o>n?o>n&&("completed"===e.completionStatus||"passed"===e.completionStatus)&&this.isAvailableForChoice(e):(n===o||n===o+1)&&this.isAvailableForChoice(e):this.isAvailableForChoice(e)&&("completed"===e.completionStatus||"unknown"===e.completionStatus||"incomplete"===e.completionStatus))}},{key:"validateTraversalConstraints",value:function(e){var t,i,n=!0,r=!0;return(null===(t=e.parent)||void 0===t?void 0:t.sequencingControls.constrainChoice)&&(n=this.evaluateConstrainChoiceForTraversal(e)),e.sequencingControls&&e.sequencingControls.stopForwardTraversal&&(r=!1),(null===(i=e.parent)||void 0===i?void 0:i.sequencingControls.forwardOnly)&&(r=this.evaluateForwardOnlyForChoice(e)),{canTraverse:n,canTraverseInto:r}}},{key:"evaluateConstrainChoiceForTraversal",value:function(e){if(!e.parent)return!0;for(var t=e.parent;t;){if(t.sequencingControls&&t.sequencingControls.constrainChoice){var i=t.children,n=this.treeQueries.findChildInPath(t,e);if(n){var r=i.indexOf(n),o=this.treeQueries.getCurrentInParent(t);if(o){var a=i.indexOf(o);if(-1!==a&&-1!==r){if(r>a)for(var s=a+1;r>s;s++){var c=i[s];if(c&&this.treeQueries.isMandatory(c)&&!this.treeQueries.isCompleted(c))return!1}if(t.sequencingControls.forwardOnly&&a>r&&!this.treeQueries.isCompleted(e))return!1}}}}t=t.parent}return this.isAvailableForChoice(e)}},{key:"evaluateForwardOnlyForChoice",value:function(e){if(!e.parent)return!0;var t=e.parent;if(!t.sequencingControls||!t.sequencingControls.forwardOnly)return!0;var i=t.children;if(!i||0===i.length)return!0;var n=i.indexOf(e);if(-1===n)return!1;var r=this.treeQueries.getCurrentInParent(t);if(!r)return this.isAvailableForChoice(e);var o=i.indexOf(r);return-1===o||(o>n?!("completed"!==e.completionStatus&&"passed"!==e.completionStatus||!e.sequencingControls||!e.sequencingControls.choice):this.isAvailableForChoice(e))}},{key:"hasTimeBoundaryViolation",value:function(e,t){if(e.beginTimeLimit)try{if(new Date(e.beginTimeLimit)>t)return!0}catch(e){}if(e.endTimeLimit)try{if(t>new Date(e.endTimeLimit))return!0}catch(e){}return!1}},{key:"hasAttemptLimitViolation",value:function(e){return!(!e.attemptLimit||e.attemptLimit>e.attemptCount)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Tt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var xt=Object.defineProperty,It=function(e,t,i){return function(e,t,i){return t in e?xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Pt=function(e){return e.START="start",e.RESUME_ALL="resumeAll",e.CONTINUE="continue",e.PREVIOUS="previous",e.CHOICE="choice",e.JUMP="jump",e.EXIT="exit",e.EXIT_PARENT="exitParent",e.EXIT_ALL="exitAll",e.ABANDON="abandon",e.ABANDON_ALL="abandonAll",e.SUSPEND_ALL="suspendAll",e.RETRY="retry",e.RETRY_ALL="retryAll",e}(Pt||{}),Nt=function(e){return e.DELIVER="deliver",e.DO_NOT_DELIVER="doNotDeliver",e}(Nt||{}),Dt=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"doNotDeliver",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Tt(this,e),It(this,"deliveryRequest"),It(this,"targetActivity"),It(this,"exception"),It(this,"endSequencingSession"),this.deliveryRequest=t,this.targetActivity=i,this.exception=n,this.endSequencingSession=r},qt=function e(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Tt(this,e),It(this,"identifiedActivity"),It(this,"deliverable"),It(this,"exception"),It(this,"endSequencingSession"),this.identifiedActivity=t,this.deliverable=i,this.exception=n,this.endSequencingSession=r},Lt=function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Tt(this,e),It(this,"activity"),It(this,"exception"),this.activity=t,this.exception=i},zt=function(e){return e.FORWARD="forward",e.BACKWARD="backward",e}(zt||{});var Ft=Object.defineProperty,Bt=function(e,t,i){return function(e,t,i){return t in e?Ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Vt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Bt(this,"now"),Bt(this,"getAttemptElapsedSecondsHook"),this.now=t.now||function(){return new Date},this.getAttemptElapsedSecondsHook=t.getAttemptElapsedSecondsHook||null}return t=e,(i=[{key:"checkSequencingRules",value:function(e,t){var i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(this.checkRuleSubprocess(e,s))return s.action}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"checkRuleSubprocess",value:function(e,t){return t.evaluate(e)}},{key:"evaluateExitRules",value:function(e){var t=this.checkSequencingRules(e,e.sequencingRules.exitConditionRules);return t===St.EXIT||t===St.EXIT_PARENT||t===St.EXIT_ALL?t:null}},{key:"evaluatePostConditionAction",value:function(e){var t=this.checkSequencingRules(e,e.sequencingRules.postConditionRules);return t&&[St.EXIT_PARENT,St.EXIT_ALL,St.RETRY,St.RETRY_ALL,St.CONTINUE,St.PREVIOUS,St.STOP_FORWARD_TRAVERSAL].includes(t)?t:null}},{key:"evaluatePostConditions",value:function(e){var t=this.evaluatePostConditionAction(e);if(!t)return{sequencingRequest:null,terminationRequest:null};switch(t){case St.EXIT_PARENT:return{sequencingRequest:null,terminationRequest:Pt.EXIT_PARENT};case St.EXIT_ALL:return{sequencingRequest:null,terminationRequest:Pt.EXIT_ALL};case St.RETRY:return{sequencingRequest:Pt.RETRY,terminationRequest:null};case St.RETRY_ALL:return{sequencingRequest:Pt.RETRY,terminationRequest:Pt.EXIT_ALL};case St.CONTINUE:return{sequencingRequest:Pt.CONTINUE,terminationRequest:null};case St.PREVIOUS:return{sequencingRequest:Pt.PREVIOUS,terminationRequest:null};case St.STOP_FORWARD_TRAVERSAL:return e.sequencingControls.stopForwardTraversal=!0,{sequencingRequest:null,terminationRequest:null};default:return{sequencingRequest:null,terminationRequest:null}}}},{key:"checkLimitConditions",value:function(e){if(null!==e.attemptLimit&&e.attemptCount>=e.attemptLimit)return!0;if(null!==e.attemptAbsoluteDurationLimit){var t=this.parseDuration(e.attemptAbsoluteDurationLimit);if(t>0&&this.parseDuration(e.attemptExperiencedDuration)>=t)return!0}if(null!==e.activityAbsoluteDurationLimit){var i=this.parseDuration(e.activityAbsoluteDurationLimit);if(i>0&&this.parseDuration(e.activityExperiencedDuration)>=i)return!0}return!1}},{key:"parseDuration",value:function(e){if(!e||"string"!=typeof e)return 0;var t=e.match(/^P(?:(\d+(?:\.\d+)?)Y)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)W)?(?:(\d+(?:\.\d+)?)D)?(?:T(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?)?$/);if(!t||"P"===e||e.endsWith("T"))return 0;var i=0;return i+=315576e5*parseFloat(t[1]||"0"),i+=30.44*24*parseFloat(t[2]||"0")*36e5,i+=6048e5*parseFloat(t[3]||"0"),i+=864e5*parseFloat(t[4]||"0"),i+=36e5*parseFloat(t[5]||"0"),(i+=6e4*parseFloat(t[6]||"0"))+1e3*parseFloat(t[7]||"0")}},{key:"getElapsedSeconds",value:function(e){if(this.getAttemptElapsedSecondsHook)try{return this.getAttemptElapsedSecondsHook(e)||0}catch(e){return 0}if(e.attemptAbsoluteStartTime){var t=new Date(e.attemptAbsoluteStartTime).getTime(),i=this.now().getTime();if(!Number.isNaN(t)&&i>t)return Math.max(0,(i-t)/1e3)}return 0}},{key:"isTimeLimitExceeded",value:function(e){var t=e.timeLimitDuration;if(!t&&e.attemptAbsoluteDurationLimit&&(t=e.attemptAbsoluteDurationLimit),!t)return!1;var i=c(t,He);return i>0&&this.getElapsedSeconds(e)>i}},{key:"isOutsideAvailableTimeRange",value:function(e){var t=this.now();if(e.beginTimeLimit)try{var i=new Date(e.beginTimeLimit);if(!Number.isNaN(i.getTime())&&i>t)return!0}catch(e){}if(e.endTimeLimit)try{var n=new Date(e.endTimeLimit);if(!Number.isNaN(n.getTime())&&t>n)return!0}catch(e){}return!1}},{key:"canDeliverActivity",value:function(e){if(this.checkLimitConditions(e))return{canDeliver:!1,wasSkipped:!1};var t=this.checkSequencingRules(e,e.sequencingRules.preConditionRules);return{canDeliver:t!==St.SKIP&&t!==St.DISABLED,wasSkipped:t===St.SKIP}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Ht(e){return Ht=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ht(e)}function Ut(e,t){return Ut=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ut(e,t)}function Gt(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Kt(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Kt=function(){return!!result})()}var Yt=Object.defineProperty,Wt=function(e,t,i){return function(e,t,i){return t in e?Yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Gt(t))?t+"":t,i)},Jt=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(Jt||{}),$t=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}($t||{}),Xt=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Ht(t),n=e,!(r=Kt()?Reflect.construct(t,i||[],Ht(e).constructor):t.apply(e,i))||"object"!==Gt(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["sequencingControls"]),Wt(e,"_enabled",!0),Wt(e,"_choice",!0),Wt(e,"_choiceExit",!0),Wt(e,"_flow",!0),Wt(e,"_forwardOnly",!1),Wt(e,"_useCurrentAttemptObjectiveInfo",!0),Wt(e,"_useCurrentAttemptProgressInfo",!0),Wt(e,"_preventActivation",!1),Wt(e,"_constrainChoice",!1),Wt(e,"_stopForwardTraversal",!1),Wt(e,"_rollupObjectiveSatisfied",!0),Wt(e,"_rollupProgressCompletion",!0),Wt(e,"_objectiveMeasureWeight",1),Wt(e,"_selectionTiming","never"),Wt(e,"_selectCount",null),Wt(e,"_selectionCountStatus",!1),Wt(e,"_randomizeChildren",!1),Wt(e,"_randomizationTiming","never"),Wt(e,"_reorderChildren",!1),Wt(e,"_completionSetByContent",!1),Wt(e,"_objectiveSetByContent",!1),Wt(e,"_tracked",!0),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ut(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1,this._enabled=!0,this._choice=!0,this._choiceExit=!0,this._flow=!0,this._forwardOnly=!1,this._useCurrentAttemptObjectiveInfo=!0,this._useCurrentAttemptProgressInfo=!0,this._preventActivation=!1,this._constrainChoice=!1,this._stopForwardTraversal=!1,this._rollupObjectiveSatisfied=!0,this._rollupProgressCompletion=!0,this._objectiveMeasureWeight=1,this._selectionTiming="never",this._selectCount=null,this._selectionCountStatus=!1,this._randomizeChildren=!1,this._randomizationTiming="never",this._reorderChildren=!1,this._completionSetByContent=!1,this._objectiveSetByContent=!1,this._tracked=!0}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}},{key:"choice",get:function(){return this._choice},set:function(e){this._choice=e}},{key:"choiceExit",get:function(){return this._choiceExit},set:function(e){this._choiceExit=e}},{key:"flow",get:function(){return this._flow},set:function(e){this._flow=e}},{key:"forwardOnly",get:function(){return this._forwardOnly},set:function(e){this._forwardOnly=e}},{key:"useCurrentAttemptObjectiveInfo",get:function(){return this._useCurrentAttemptObjectiveInfo},set:function(e){this._useCurrentAttemptObjectiveInfo=e}},{key:"useCurrentAttemptProgressInfo",get:function(){return this._useCurrentAttemptProgressInfo},set:function(e){this._useCurrentAttemptProgressInfo=e}},{key:"preventActivation",get:function(){return this._preventActivation},set:function(e){this._preventActivation=e}},{key:"constrainChoice",get:function(){return this._constrainChoice},set:function(e){this._constrainChoice=e}},{key:"stopForwardTraversal",get:function(){return this._stopForwardTraversal},set:function(e){this._stopForwardTraversal=e}},{key:"rollupObjectiveSatisfied",get:function(){return this._rollupObjectiveSatisfied},set:function(e){this._rollupObjectiveSatisfied=e}},{key:"rollupProgressCompletion",get:function(){return this._rollupProgressCompletion},set:function(e){this._rollupProgressCompletion=e}},{key:"objectiveMeasureWeight",get:function(){return this._objectiveMeasureWeight},set:function(e){0>e||(this._objectiveMeasureWeight=e)}},{key:"isChoiceNavigationAllowed",value:function(){return this._enabled&&!this._constrainChoice}},{key:"isFlowNavigationAllowed",value:function(){return this._enabled&&this._flow}},{key:"isForwardNavigationAllowed",value:function(){return this._enabled&&this._flow}},{key:"isBackwardNavigationAllowed",value:function(){return this._enabled&&this._flow&&!this._forwardOnly}},{key:"selectionTiming",get:function(){return this._selectionTiming},set:function(e){this._selectionTiming=e}},{key:"selectCount",get:function(){return this._selectCount},set:function(e){(null===e||e>0)&&(this._selectCount=e)}},{key:"selectionCountStatus",get:function(){return this._selectionCountStatus},set:function(e){this._selectionCountStatus=e}},{key:"randomizeChildren",get:function(){return this._randomizeChildren},set:function(e){this._randomizeChildren=e}},{key:"randomizationTiming",get:function(){return this._randomizationTiming},set:function(e){this._randomizationTiming=e}},{key:"reorderChildren",get:function(){return this._reorderChildren},set:function(e){this._reorderChildren=e}},{key:"completionSetByContent",get:function(){return this._completionSetByContent},set:function(e){this._completionSetByContent=e}},{key:"objectiveSetByContent",get:function(){return this._objectiveSetByContent},set:function(e){this._objectiveSetByContent=e}},{key:"tracked",get:function(){return this._tracked},set:function(e){this._tracked=e}},{key:"toJSON",value:function(){this.jsonString=!0;var result={enabled:this._enabled,choice:this._choice,choiceExit:this._choiceExit,flow:this._flow,forwardOnly:this._forwardOnly,useCurrentAttemptObjectiveInfo:this._useCurrentAttemptObjectiveInfo,useCurrentAttemptProgressInfo:this._useCurrentAttemptProgressInfo,preventActivation:this._preventActivation,constrainChoice:this._constrainChoice,stopForwardTraversal:this._stopForwardTraversal,rollupObjectiveSatisfied:this._rollupObjectiveSatisfied,rollupProgressCompletion:this._rollupProgressCompletion,objectiveMeasureWeight:this._objectiveMeasureWeight,selectionTiming:this._selectionTiming,selectCount:this._selectCount,selectionCountStatus:this._selectionCountStatus,randomizeChildren:this._randomizeChildren,randomizationTiming:this._randomizationTiming,reorderChildren:this._reorderChildren,completionSetByContent:this._completionSetByContent,objectiveSetByContent:this._objectiveSetByContent,tracked:this._tracked};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function Qt(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Zt(e){return function(e){if(Array.isArray(e))return Qt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Qt(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Qt(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ei=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,i=[{key:"selectChildrenProcess",value:function(e){var t=e.sequencingControls,i=Zt(e.children);if(t.selectionTiming===Jt.NEVER)return i;if(t.selectionTiming===Jt.ONCE&&t.selectionCountStatus)return i;if(t.selectionTiming!==Jt.ONCE&&!t.selectionCountStatus)return i;var n=t.selectCount;if(null===n||n>=i.length)return t.selectionTiming===Jt.ONCE&&(t.selectionCountStatus=!0),i;for(var r=[],o=i.map(function(e,t){return t}),a=0;n>a&&0!==o.length;a++){var s=Math.floor(Math.random()*o.length),c=o[s];void 0!==c&&i[c]&&r.push(i[c]),o.splice(s,1)}t.selectionTiming===Jt.ONCE&&(t.selectionCountStatus=!0);var l=!0,u=!1,d=void 0;try{for(var f,v=i[Symbol.iterator]();!(l=(f=v.next()).done);l=!0){var h=f.value;r.includes(h)||(h.isHiddenFromChoice=!0,h.isAvailable=!1)}}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}return r}},{key:"randomizeChildrenProcess",value:function(e){var t,i=e.sequencingControls,n=Zt(e.children);if(i.randomizationTiming===$t.NEVER)return n;if(i.randomizationTiming===$t.ONCE&&i.reorderChildren)return n;if(!i.randomizeChildren)return n;for(var r=Zt(n),o=r.length-1;o>0;o--){var a=Math.floor(Math.random()*(o+1)),s=r[o],c=r[a];s&&c&&(r[o]=c,r[a]=s)}return i.randomizationTiming===$t.ONCE&&(i.reorderChildren=!0),e.children.length=0,(t=e.children).push.apply(t,Zt(r)),r}},{key:"applySelectionAndRandomization",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=e.sequencingControls;if(!t&&(e.isActive||e.isSuspended))return e.children;var n=!1,r=!1;i.selectionTiming===Jt.ON_EACH_NEW_ATTEMPT?(n=t,t&&(i.selectionCountStatus=!0)):i.selectionTiming===Jt.ONCE&&(n=!i.selectionCountStatus),i.randomizationTiming===$t.ON_EACH_NEW_ATTEMPT?(r=t,t&&(i.reorderChildren=!1)):i.randomizationTiming===$t.ONCE&&(r=!i.reorderChildren),n&&this.selectChildrenProcess(e),r&&this.randomizeChildrenProcess(e);var o=e.children.filter(function(e){return e.isAvailable});return e.setProcessedChildren(o),o}},{key:"isSelectionNeeded",value:function(e){var t=e.sequencingControls;return t.selectionTiming!==Jt.NEVER&&(t.selectionTiming!==Jt.ONCE||!t.selectionCountStatus)&&null!==t.selectCount&&e.children.length>t.selectCount}},{key:"isRandomizationNeeded",value:function(e){var t=e.sequencingControls;return t.randomizationTiming!==$t.NEVER&&(t.randomizationTiming!==$t.ONCE||!t.reorderChildren)&&t.randomizeChildren}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t,i),e;var t,i}();var ti=Object.defineProperty,ii=function(e,t,i){return function(e,t,i){return t in e?ti(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ni=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ii(this,"activityTree",t),ii(this,"ruleEngine",i)}return t=e,i=[{key:"flowSubprocess",value:function(e,t){for(var i=e,n=!0,r=!1,o=t,a=null;i;){var s=this.flowTreeTraversalSubprocess(i,o,n,a);if(!s.activity){var c=null;return s.exception?c=s.exception:t===zt.BACKWARD?c="SB.2.1-3":r&&(c="SB.2.1-2"),new qt(i,!1,c,s.endSequencingSession)}var l=s.direction||o;s.forwardOnlyCluster&&(a=s.forwardOnlyCluster),r=s.activity.children.length>0&&0===s.activity.getAvailableChildren().length;var u=this.flowActivityTraversalSubprocess(s.activity,l===zt.FORWARD,!0,l);if(u)return new qt(u,!0,null,!1);i=s.activity,o=l,n=!1}return new qt(null,!1,null,!1)}},{key:"flowTreeTraversalSubprocess",value:function(e,t){return t===zt.FORWARD?this.traverseForward(e,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]?arguments[3]:null):this.traverseBackward(e)}},{key:"traverseForward",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(i&&!this.isDescendantOfOrSelf(e,i))return{activity:null,endSequencingSession:!1};if(!i&&t&&this.isActivityLastOverall(e))return this.activityTree.root&&this.terminateDescendentAttempts(this.activityTree.root),{activity:null,endSequencingSession:!0};if(!t){this.ensureSelectionAndRandomization(e);var n=e.getAvailableChildren();if(n.length>0)return{activity:n[0]||null,endSequencingSession:!1}}for(var r=e;r;){var o=this.activityTree.getNextSibling(r);if(o)return{activity:o,endSequencingSession:!1};if(i&&(r===i||r.parent===i))return{activity:null,endSequencingSession:!1};r=r.parent}return this.activityTree.root&&this.terminateDescendentAttempts(this.activityTree.root),{activity:null,endSequencingSession:!0}}},{key:"traverseBackward",value:function(e){if(e.parent&&e.parent.sequencingControls.forwardOnly)return{activity:null,endSequencingSession:!1,exception:"SB.2.1-4"};var t=this.activityTree.getPreviousSibling(e);if(t)return this.getBackwardTraversalEntry(t);for(var i=e,n=0;i&&i.parent;){if(++n>1e4)throw Error("Infinite loop detected in backward traversal");var r=this.activityTree.getPreviousSibling(i.parent);if(r)return this.getBackwardTraversalEntry(r);i=i.parent}return{activity:null,endSequencingSession:!1}}},{key:"getBackwardTraversalEntry",value:function(e){for(var t=e,i=0;;){if(++i>1e4)throw Error("Infinite loop detected while getting backward traversal entry");this.ensureSelectionAndRandomization(t);var n=t.getAvailableChildren();if(0===n.length)break;if(t.sequencingControls.forwardOnly)return{activity:n[0]||null,endSequencingSession:!1,direction:zt.FORWARD,forwardOnlyCluster:t};var r=n[n.length-1];if(!r)break;t=r}return{activity:t,endSequencingSession:!1}}},{key:"isDescendantOfOrSelf",value:function(e,t){for(var i=e;i;){if(i===t)return!0;i=i.parent}return!1}},{key:"flowActivityTraversalSubprocess",value:function(e,t,i,mode){var n=e.parent;if(n&&!n.sequencingControls.flow)return null;if(!e.isAvailable)return null;if(mode===zt.FORWARD&&e.sequencingControls.stopForwardTraversal)return null;if(i){this.ensureSelectionAndRandomization(e);var r=e.getAvailableChildren(),o=!0,a=!1,s=void 0;try{for(var c,l=r[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=this.flowActivityTraversalSubprocess(c.value,mode===zt.FORWARD,!0,mode);if(u)return u}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}}return 0===e.children.length&&this.checkActivityProcess(e)?e:null}},{key:"checkActivityProcess",value:function(e){if(!e.isAvailable)return!1;if(0===e.children.length&&!e.isVisible)return!1;if(this.ruleEngine.checkLimitConditions(e))return!1;var t=this.ruleEngine.canDeliverActivity(e);return e.wasSkipped=t.wasSkipped,t.canDeliver}},{key:"ensureSelectionAndRandomization",value:function(e){e.getAvailableChildren()===e.children&&(ei.isSelectionNeeded(e)||ei.isRandomizationNeeded(e))&&ei.applySelectionAndRandomization(e,e.isNewAttempt)}},{key:"isActivityLastOverall",value:function(e){if(e.children.length>0)return!1;for(var t=e;t;){if(this.activityTree.getNextSibling(t))return!1;t=t.parent}return!0}},{key:"terminateDescendentAttempts",value:function(e){e.isActive=!1;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateDescendentAttempts(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"findFirstDeliverableActivity",value:function(e){if(0===e.children.length)return this.checkActivityProcess(e)?e:null;this.ensureSelectionAndRandomization(e);var t=e.getAvailableChildren(),i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=this.flowActivityTraversalSubprocess(o.value,!0,!0,zt.FORWARD);if(s)return s}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"canDeliver",value:function(e){return this.checkActivityProcess(e)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var ri=Object.defineProperty,oi=function(e,t,i){return function(e,t,i){return t in e?ri(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ai=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),oi(this,"activityTree",t),oi(this,"traversalService",i)}return t=e,(i=[{key:"handleStart",value:function(){var result=new Dt;if(!this.activityTree.root)return result.exception="SB.2.5-1",result;if(this.activityTree.currentActivity)return result.exception="SB.2.5-2",result;var e=this.traversalService.findFirstDeliverableActivity(this.activityTree.root);return e?(result.deliveryRequest=Nt.DELIVER,result.targetActivity=e,result):(result.exception="SB.2.5-3",result)}},{key:"handleResumeAll",value:function(){var result=new Dt;return this.activityTree.suspendedActivity?this.activityTree.currentActivity?(result.exception="SB.2.6-2",result):(result.deliveryRequest=Nt.DELIVER,result.targetActivity=this.activityTree.suspendedActivity,result):(result.exception="SB.2.6-1",result)}},{key:"handleContinue",value:function(e){var result=new Dt;if(e.isActive)return result.exception="SB.2.7-1",result;if(e.parent&&!e.parent.sequencingControls.flow)return result.exception="SB.2.7-2",result;var t=this.traversalService.flowSubprocess(e,zt.FORWARD);return result.endSequencingSession=t.endSequencingSession,t.deliverable&&t.identifiedActivity?(result.deliveryRequest=Nt.DELIVER,result.targetActivity=t.identifiedActivity,result):(result.exception=t.exception||"SB.2.7-2",result)}},{key:"handlePrevious",value:function(e){var result=new Dt;if(e.isActive)return result.exception="SB.2.8-1",result;if(e.parent&&!e.parent.sequencingControls.flow)return result.exception="SB.2.8-2",result;var t=this.checkForwardOnlyViolation(e);if(t)return result.exception=t,result;var i=this.traversalService.flowSubprocess(e,zt.BACKWARD);return i.deliverable&&i.identifiedActivity?(result.deliveryRequest=Nt.DELIVER,result.targetActivity=i.identifiedActivity,result):(result.exception=i.exception||"SB.2.8-3",result)}},{key:"checkForwardOnlyViolation",value:function(e){for(var t=e.parent;t;){if(t.sequencingControls.forwardOnly)return"SB.2.9-5";t=t.parent}return null}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var si=Object.defineProperty,ci=function(e,t,i){return function(e,t,i){return t in e?si(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},li=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ci(this,"activityTree",t),ci(this,"constraintValidator",i),ci(this,"traversalService",n),ci(this,"treeQueries",r)}return t=e,i=[{key:"handleChoice",value:function(e,t){var result=new Dt,i=this.activityTree.getActivity(e);if(!i)return result.exception="SB.2.9-1",result;if(t&&t.isActive)return result.exception="SB.2.9-6",result;var n=this.constraintValidator.validateChoice(t,i,{checkAvailability:!0});if(!n.valid)return result.exception=n.exception,result;var r=this.treeQueries.findCommonAncestor(t,i);t&&this.terminateDescendentAttemptsProcess(r||this.activityTree.root);var o=this.buildActivityPath(i,r),a=!0,s=!1,c=void 0;try{for(var l,u=o[Symbol.iterator]();!(a=(l=u.next()).done);a=!0)if(!this.traversalService.checkActivityProcess(l.value))return result}catch(e){s=!0,c=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw c}}var d=i;if(i.children.length>0){var f=this.choiceFlowSubprocess(i);if(!f)return result.exception="SB.2.9-7",result;d=f}return result.deliveryRequest=Nt.DELIVER,result.targetActivity=d,result}},{key:"handleJump",value:function(e){var result=new Dt,t=this.activityTree.getActivity(e);return t?this.treeQueries.isInTree(t)?t.isAvailable?(result.deliveryRequest=Nt.DELIVER,result.targetActivity=t,result):(result.exception="SB.2.13-3",result):(result.exception="SB.2.13-2",result):(result.exception="SB.2.13-1",result)}},{key:"getAvailableChoices",value:function(){var e=this.activityTree.getAllActivities(),t=this.activityTree.currentActivity,i=[],n=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;c!==this.activityTree.root&&!c.isHiddenFromChoice&&c.isAvailable&&c.isVisible&&(c.parent&&!c.parent.sequencingControls.choice||this.constraintValidator.validateChoice(t,c).valid&&i.push(c))}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return i}},{key:"buildActivityPath",value:function(e,t){for(var i=[],n=e;n&&n!==t;)i.unshift(n),n=n.parent;return i}},{key:"choiceFlowSubprocess",value:function(e){return 0===e.children.length?e:this.choiceFlowTreeTraversal(e)}},{key:"choiceFlowTreeTraversal",value:function(e){this.traversalService.ensureSelectionAndRandomization(e);var t=e.getAvailableChildren(),i=this.constraintValidator.validateFlowConstraints(e,t);if(!i.valid)return null;var n=!0,r=!1,o=void 0;try{for(var a,s=i.validChildren[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=this.enhancedChoiceTraversal(a.value);if(c.activity)return c.activity}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return null}},{key:"enhancedChoiceTraversal",value:function(e){var t;if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&e===this.activityTree.root)return new Lt(null,"SB.2.4-3");if(!e.isAvailable)return new Lt(null,null);if(e.isHiddenFromChoice)return new Lt(null,null);if(e.sequencingControls&&e.sequencingControls.stopForwardTraversal)return new Lt(null,"SB.2.4-1");var i=this.constraintValidator.validateTraversalConstraints(e);if(!i.canTraverse)return new Lt(null,null);if(0===e.children.length)return this.traversalService.checkActivityProcess(e)?new Lt(e,null):new Lt(null,null);if((null===(t=e.parent)||void 0===t?void 0:t.sequencingControls.constrainChoice)&&!i.canTraverseInto)return new Lt(null,"SB.2.4-2");if(i.canTraverseInto){var n=this.choiceFlowTreeTraversal(e);return new Lt(n,null)}return new Lt(null,null)}},{key:"terminateDescendentAttemptsProcess",value:function(e){e.isActive=!1;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateDescendentAttemptsProcess(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var ui=Object.defineProperty,di=function(e,t,i){return function(e,t,i){return t in e?ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},fi=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),di(this,"activityTree",t),di(this,"ruleEngine",i)}return t=e,i=[{key:"handleExit",value:function(e){var result=new Dt;return e.parent?e.parent.sequencingControls.choiceExit?(this.terminateDescendentAttempts(e),result):(result.exception="SB.2.11-2",result):(result.exception="SB.2.11-1",result)}},{key:"handleExitAll",value:function(){var result=new Dt;return this.activityTree.root&&this.terminateDescendentAttempts(this.activityTree.root),result}},{key:"handleAbandon",value:function(e){var result=new Dt;return e.isActive=!1,this.activityTree.currentActivity=e.parent,result}},{key:"handleAbandonAll",value:function(){var result=new Dt;return this.activityTree.currentActivity=null,result}},{key:"handleSuspendAll",value:function(e){var result=new Dt;return e===this.activityTree.root?(result.exception="SB.2.15-1",result):(e.isSuspended=!0,this.activityTree.suspendedActivity=e,this.activityTree.currentActivity=null,result)}},{key:"terminateDescendentAttempts",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;t||(i=this.ruleEngine.evaluateExitRules(e)),e.isActive=!1;var n=!0,r=!1,o=void 0;try{for(var a,s=e.children[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)this.terminateDescendentAttempts(a.value,t)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}i&&!t&&this.processDeferredExitAction(i,e)}},{key:"processDeferredExitAction",value:function(e,t){switch(e){case St.EXIT:break;case St.EXIT_PARENT:t.parent&&t.parent.isActive&&this.terminateDescendentAttempts(t.parent,!0);break;case St.EXIT_ALL:this.activityTree.root&&this.activityTree.root!==t&&this.activityTree.getAllActivities().some(function(e){return e.isActive})&&this.terminateDescendentAttempts(this.activityTree.root,!0)}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var vi=Object.defineProperty,hi=function(e,t,i){return function(e,t,i){return t in e?vi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},mi=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),hi(this,"activityTree",t),hi(this,"traversalService",i)}return t=e,(i=[{key:"handleRetry",value:function(e){var result=new Dt;if(e.isActive||e.isSuspended)return result.exception="SB.2.10-2",result;if(e.children.length>0){this.traversalService.ensureSelectionAndRandomization(e);var t=e.getAvailableChildren(),i=null,n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&!(i=this.traversalService.flowActivityTraversalSubprocess(a.value,!0,!0,zt.FORWARD));n=!0);}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return i?(result.deliveryRequest=Nt.DELIVER,result.targetActivity=i,result):(result.exception="SB.2.10-3",result)}return this.terminateDescendentAttempts(e),result.deliveryRequest=Nt.DELIVER,result.targetActivity=e,result}},{key:"handleRetryAll",value:function(){if(this.activityTree.currentActivity=null,!this.activityTree.root){var e=new Dt;return e.exception="SB.2.10-1",e}var t=this.traversalService.findFirstDeliverableActivity(this.activityTree.root),result=new Dt;return t?(result.deliveryRequest=Nt.DELIVER,result.targetActivity=t,result):(result.exception="SB.2.10-3",result)}},{key:"terminateDescendentAttempts",value:function(e){e.isActive=!1;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateDescendentAttempts(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var pi=Object.defineProperty,yi=function(e,t,i){return function(e,t,i){return t in e?pi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},gi=function(){function e(t,i,n){var r=arguments.length>4?arguments[4]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),yi(this,"activityTree"),yi(this,"treeQueries"),yi(this,"constraintValidator"),yi(this,"ruleEngine"),yi(this,"traversalService"),yi(this,"flowHandler"),yi(this,"choiceHandler"),yi(this,"exitHandler"),yi(this,"retryHandler"),yi(this,"_now"),yi(this,"_getAttemptElapsedSecondsHook"),this.activityTree=t,this._now=(null==r?void 0:r.now)||function(){return new Date},this._getAttemptElapsedSecondsHook=null==r?void 0:r.getAttemptElapsedSeconds,this.treeQueries=new kt(t),this.ruleEngine=new Vt({now:this._now,getAttemptElapsedSecondsHook:this._getAttemptElapsedSecondsHook}),this.constraintValidator=new Mt(t,this.treeQueries),this.traversalService=new ni(t,this.ruleEngine),this.flowHandler=new ai(t,this.traversalService),this.choiceHandler=new li(t,this.constraintValidator,this.traversalService,this.treeQueries),this.exitHandler=new fi(t,this.ruleEngine),this.retryHandler=new mi(t,this.traversalService)}return t=e,i=[{key:"now",get:function(){return this._now},set:function(e){this._now=e,Ot.setNowProvider(e),this.ruleEngine=new Vt({now:e,getAttemptElapsedSecondsHook:this._getAttemptElapsedSecondsHook}),this.traversalService=new ni(this.activityTree,this.ruleEngine),this.flowHandler=new ai(this.activityTree,this.traversalService),this.choiceHandler=new li(this.activityTree,this.constraintValidator,this.traversalService,this.treeQueries),this.retryHandler=new mi(this.activityTree,this.traversalService)}},{key:"getAttemptElapsedSecondsHook",get:function(){return this._getAttemptElapsedSecondsHook},set:function(e){this._getAttemptElapsedSecondsHook=e,Ot.setElapsedSecondsHook(e),this.ruleEngine=new Vt({now:this._now,getAttemptElapsedSecondsHook:e}),this.traversalService=new ni(this.activityTree,this.ruleEngine),this.flowHandler=new ai(this.activityTree,this.traversalService),this.choiceHandler=new li(this.activityTree,this.constraintValidator,this.traversalService,this.treeQueries),this.retryHandler=new mi(this.activityTree,this.traversalService)}},{key:"sequencingRequestProcess",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=this.activityTree.currentActivity;switch(request){case Pt.START:return this.flowHandler.handleStart();case Pt.RESUME_ALL:return this.flowHandler.handleResumeAll();case Pt.CONTINUE:return t?this.flowHandler.handleContinue(t):new Dt(Nt.DO_NOT_DELIVER,null,"SB.2.12-1");case Pt.PREVIOUS:return t?this.flowHandler.handlePrevious(t):new Dt(Nt.DO_NOT_DELIVER,null,"SB.2.12-1");case Pt.CHOICE:return e?this.choiceHandler.handleChoice(e,t):new Dt(Nt.DO_NOT_DELIVER,null,"SB.2.12-5");case Pt.JUMP:return e?this.choiceHandler.handleJump(e):new Dt(Nt.DO_NOT_DELIVER,null,"SB.2.12-5");case Pt.EXIT:return t?this.exitHandler.handleExit(t):new Dt(Nt.DO_NOT_DELIVER,null,"SB.2.12-1");case Pt.EXIT_ALL:return t?this.exitHandler.handleExitAll():new Dt(Nt.DO_NOT_DELIVER,null,"SB.2.12-1");case Pt.ABANDON:return t?this.exitHandler.handleAbandon(t):new Dt(Nt.DO_NOT_DELIVER,null,"SB.2.12-1");case Pt.ABANDON_ALL:return t?this.exitHandler.handleAbandonAll():new Dt(Nt.DO_NOT_DELIVER,null,"SB.2.12-1");case Pt.SUSPEND_ALL:return t?this.exitHandler.handleSuspendAll(t):new Dt(Nt.DO_NOT_DELIVER,null,"SB.2.12-1");case Pt.RETRY:return t?this.retryHandler.handleRetry(t):new Dt(Nt.DO_NOT_DELIVER,null,"SB.2.12-1");case Pt.RETRY_ALL:return this.retryHandler.handleRetryAll();default:return new Dt(Nt.DO_NOT_DELIVER,null,"SB.2.12-6")}}},{key:"evaluatePostConditionRules",value:function(e){return this.ruleEngine.evaluatePostConditions(e)}},{key:"canActivityBeDelivered",value:function(e){return this.traversalService.canDeliver(e)}},{key:"validateNavigationRequest",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!Object.values(Pt).includes(request))return{valid:!1,exception:"SB.2.12-6"};switch(request){case Pt.CONTINUE:case Pt.PREVIOUS:if(!t)return{valid:!1,exception:"SB.2.12-1"};if(t.isActive)return{valid:!1,exception:request===Pt.CONTINUE?"SB.2.7-1":"SB.2.8-1"};if(t.parent&&!t.parent.sequencingControls.flow)return{valid:!1,exception:request===Pt.CONTINUE?"SB.2.7-2":"SB.2.8-2"};if(request===Pt.PREVIOUS){var i=this.constraintValidator.checkForwardOnlyViolation(t);if(!i.valid)return i}break;case Pt.CHOICE:if(!e)return{valid:!1,exception:"SB.2.12-5"};var n=this.activityTree.getActivity(e);if(!n)return{valid:!1,exception:"SB.2.9-1"};var r=this.constraintValidator.validateChoice(t,n,{checkAvailability:!0});if(!r.valid)return r;if(!this.traversalService.canDeliver(n))return{valid:!1,exception:"SB.2.9-6"};if(this.ruleEngine.checkSequencingRules(n,n.sequencingRules.preConditionRules)===St.HIDE_FROM_CHOICE)return{valid:!1,exception:"SB.2.9-4"};break;case Pt.JUMP:if(!e)return{valid:!1,exception:"SB.2.12-5"};if(!this.activityTree.getActivity(e))return{valid:!1,exception:"SB.2.13-1"}}return{valid:!0,exception:null}}},{key:"getAvailableChoices",value:function(){return this.choiceHandler.getAvailableChoices()}},{key:"getTreeQueries",value:function(){return this.treeQueries}},{key:"getConstraintValidator",value:function(){return this.constraintValidator}},{key:"getRuleEngine",value:function(){return this.ruleEngine}},{key:"getTraversalService",value:function(){return this.traversalService}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function _i(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var bi=Object.defineProperty,Si=function(e,t,i){return function(e,t,i){return t in e?bi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},wi=function(){function e(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Si(this,"eventService"),Si(this,"loggingService"),Si(this,"callbacks"),Si(this,"currentDeliveredActivity",null),Si(this,"pendingDelivery",null),this.eventService=t,this.loggingService=i,this.callbacks=n}return t=e,i=[{key:"processSequencingResult",value:function(result){var e,t,i,n;if(result.exception)return this.loggingService.error("Sequencing error: ".concat(result.exception)),void(null===(i=(n=this.callbacks).onSequencingError)||void 0===i||i.call(n,result.exception));result.deliveryRequest===Nt.DELIVER&&result.targetActivity?this.deliverActivity(result.targetActivity):this.loggingService.info("Sequencing completed with no delivery request"),null===(e=(t=this.callbacks).onSequencingComplete)||void 0===e||e.call(t,result)}},{key:"deliverActivity",value:function(e){var t,i;this.currentDeliveredActivity!==e?(this.currentDeliveredActivity&&this.unloadActivity(this.currentDeliveredActivity),this.pendingDelivery=e,this.loggingService.info("Delivering activity: ".concat(e.id," - ").concat(e.title)),this.eventService.processListeners("ActivityDelivery",e.id,e),null===(t=(i=this.callbacks).onDeliverActivity)||void 0===t||t.call(i,e),this.currentDeliveredActivity=e,this.pendingDelivery=null,e.isActive=!0):this.loggingService.info("Skipping delivery - activity already delivered: ".concat(e.id))}},{key:"unloadActivity",value:function(e){var t,i;this.loggingService.info("Unloading activity: ".concat(e.id," - ").concat(e.title)),this.eventService.processListeners("ActivityUnload",e.id,e),null===(t=(i=this.callbacks).onUnloadActivity)||void 0===t||t.call(i,e),e.isActive=!1}},{key:"getCurrentDeliveredActivity",value:function(){return this.currentDeliveredActivity}},{key:"getPendingDelivery",value:function(){return this.pendingDelivery}},{key:"updateCallbacks",value:function(e){this.callbacks=function(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){_i(e,t,i[t])})}return e}({},this.callbacks,e)}},{key:"reset",value:function(){this.currentDeliveredActivity&&this.unloadActivity(this.currentDeliveredActivity),this.currentDeliveredActivity=null,this.pendingDelivery=null}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Oi(e,t,i,n,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(n,r)}function Ci(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){Oi(o,n,r,a,s,"next",e)}function s(e){Oi(o,n,r,a,s,"throw",e)}a(void 0)})}}function Ei(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ai(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function ki(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Ei(e,t,i[t])})}return e}function ji(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:c(0)}),s(a,"throw",{value:c(1)}),s(a,"return",{value:c(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function c(s){return function(c){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}var Ri=Object.defineProperty,Mi=function(e,t,i){return function(e,t,i){return t in e?Ri(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Ti=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Mi(this,"reportsRequestCompletion",!0),Mi(this,"settings"),Mi(this,"error_codes"),this.settings=t,this.error_codes=i}return t=e,i=[{key:"processHttpRequest",value:function(e,t){return this._performAsyncRequest(e,t,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3?arguments[3]:void 0,arguments.length>4?arguments[4]:void 0,arguments.length>5?arguments[5]:void 0,arguments.length>6?arguments[6]:void 0),{result:z,errorCode:0}}},{key:"_performAsyncRequest",value:function(e,t,i,n,r,o,a){return Ci(function(){var s,c,l,result,u,d;return ji(this,function(f){switch(f.label){case 0:return f.trys.push([0,6,7,8]),s=void 0===o?this.settings.requestHandler(t):this.settings.requestHandler(t,o),c=s,i&&"never"!==this.settings.asyncModeBeaconBehavior?[4,this.performBeacon(e,c)]:[3,2];case 1:return l=f.sent(),[3,4];case 2:return[4,this.performFetch(e,c)];case 3:l=f.sent(),f.label=4;case 4:return[4,this.transformResponse(l,r)];case 5:return result=f.sent(),this._isSuccessResponse(l,result)?r("CommitSuccess"):r("CommitError",void 0,result.errorCode),[3,8];case 6:return u=f.sent(),d=Ai(u,Error)?u.message:u+"",n("processHttpRequest","Async request failed: ".concat(d),Ee.ERROR),r("CommitError",void 0,this.error_codes.GENERAL_COMMIT_FAILURE||391),[3,8];case 7:return null==a||a(),[7];case 8:return[2]}})}).call(this)}},{key:"_prepareRequestBody",value:function(e){return{body:Ai(e,Array)?e.join("&"):JSON.stringify(e),contentType:Ai(e,Array)?"application/x-www-form-urlencoded":this.settings.commitRequestDataType}}},{key:"performFetch",value:function(e,t){return Ci(function(){var i,n,r;return ji(this,function(o){return"always"===this.settings.asyncModeBeaconBehavior?[2,this.performBeacon(e,t)]:(i=this._prepareRequestBody(t),n=i.contentType,r={method:"POST",mode:this.settings.fetchMode,body:i.body,headers:(a=ki({},this.settings.xhrHeaders),s={"Content-Type":n},s=null!=s?s:{},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(s)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(s)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(s,e))}),a),keepalive:!0},this.settings.xhrWithCredentials&&(r.credentials="include"),[2,fetch(e,r)]);var a,s})}).call(this)}},{key:"performBeacon",value:function(e,t){return Ci(function(){var i,n,r;return ji(this,function(o){return i=this,n=this._prepareRequestBody(t),r=navigator.sendBeacon(e,new Blob([n.body],{type:n.contentType})),[2,Promise.resolve({status:r?200:0,ok:r,json:function(){return Ci(function(){return ji(this,function(e){return[2,{result:r?"true":"false",errorCode:r?0:this.error_codes.GENERAL_COMMIT_FAILURE||391}]})}).call(i)},text:function(){return Ci(function(){return ji(this,function(e){return[2,JSON.stringify({result:r?"true":"false",errorCode:r?0:this.error_codes.GENERAL_COMMIT_FAILURE||391})]})}).call(i)}})]})}).call(this)}},{key:"transformResponse",value:function(e,t){return Ci(function(){var result,t,i,n;return ji(this,function(r){switch(r.label){case 0:return r.trys.push([0,5,,7]),"function"!=typeof this.settings.responseHandler?[3,2]:[4,this.settings.responseHandler(e)];case 1:return t=r.sent(),[3,4];case 2:return[4,e.json()];case 3:t=r.sent(),r.label=4;case 4:return result=t,[3,7];case 5:return i=r.sent(),[4,e.text().catch(function(){return"Unable to read response text"})];case 6:return n=r.sent(),[2,{result:F,errorCode:this.error_codes.GENERAL_COMMIT_FAILURE||391,errorMessage:"Failed to parse LMS response: ".concat(Ai(i,Error)?i.message:i+""),errorDetails:JSON.stringify({status:e.status,statusText:e.statusText,url:e.url,responseText:n.substring(0,500),parseError:Ai(i,Error)?i.message:i+""})}];case 7:return Object.hasOwnProperty.call(result,"errorCode")||(result.errorCode=this._isSuccessResponse(e,result)?0:this.error_codes.GENERAL_COMMIT_FAILURE||391),this._isSuccessResponse(e,result)||(result.errorDetails=ki({status:e.status,statusText:e.statusText,url:e.url},result.errorDetails)),[2,result]}})}).call(this)}},{key:"_isSuccessResponse",value:function(e,result){var t=result.result;return!(200>e.status||e.status>299||!0!==t&&"true"!==t&&t!==z)}},{key:"updateSettings",value:function(e){this.settings=e}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function xi(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var Ii=Object.defineProperty,Pi="{target=";function Ni(e,t){var i,n=e[t];return void 0===n?(void 0!==console&&console.warn&&console.warn("CMIValueAccessService: Unknown error code key: ".concat(t)),null!==(i=e.GENERAL)&&void 0!==i?i:0):n}var Di=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?Ii(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="context")?i+"":i,n),this.context=t}return t=e,(i=[{key:"getUndefinedDataModelErrorCode",value:function(){return Ni(this.context.errorCodes,"UNDEFINED_DATA_MODEL")}},{key:"setCMIValue",value:function(e,t,i,n){if(!i||""===i)return t&&this.context.throwSCORMError(i,Ni(this.context.errorCodes,"GENERAL_SET_FAILURE"),"The data model element was not specified"),F;this.context.setLastErrorCode("0");for(var r=i.split("."),o=this.context.getDataModel(),a=F,s=!1,c="The data model element passed to ".concat(e," (").concat(i,") is not a valid SCORM data model element."),l=this.getUndefinedDataModelErrorCode(),u=0;r.length>u;u++){if(u===r.length-1){a=this.setFinalAttribute(o,r[u],n,i,t,l,c);break}var d=this.traverseToNextLevel(o,r,u,n,i,t,s,l,c);if(d.error)break;o=d.refObject,u=d.idx,s=d.foundFirstIndex}return a===F&&this.context.apiLog(e,"There was an error setting the value for: ".concat(i,", value of: ").concat(n),Ee.WARN),a}},{key:"getCMIValue",value:function(e,t,i){if(!i||""===i)return t&&this.context.throwSCORMError(i,Ni(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element was not specified"),"";if(t&&i.endsWith("._version")&&"cmi._version"!==i)return this.context.throwSCORMError(i,Ni(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The _version keyword was used incorrectly"),"";this.context.setLastErrorCode("0");for(var n=i.split("."),r=this.context.getDataModel(),o=null,a="The data model element passed to ".concat(e," (").concat(i,") has not been initialized."),s="The data model element passed to ".concat(e," (").concat(i,") is not a valid SCORM data model element."),c=this.getUndefinedDataModelErrorCode(),l=0;n.length>l;l++){var u=this.validateGetAttribute(r,o=n[l],i,t,c,s,l===n.length-1);if(void 0!==u.returnValue)return u.returnValue;if(u.error)return"";if(null==o){this.context.throwSCORMError(i,c,s);break}if(void 0===(r=r[o])){this.context.throwSCORMError(i,c,s);break}if(xi(r,me)){var d=this.handleGetArrayAccess(r,n,l,i,a);if(d.error)return"";r=d.refObject,l=d.idx}}return null==r?(t||("_children"===o?this.context.throwSCORMError(i,Ni(this.context.errorCodes,"CHILDREN_ERROR"),void 0):"_count"===o&&this.context.throwSCORMError(i,Ni(this.context.errorCodes,"COUNT_ERROR"),void 0)),""):r}},{key:"setFinalAttribute",value:function(e,t,i,n,r,o,a){return r&&(null==t?void 0:t.startsWith(Pi))?this.context.isInitialized()?(this.context.throwSCORMError(n,Ni(this.context.errorCodes,"READ_ONLY_ELEMENT")),F):z:void 0!==t&&this.context.checkObjectHasProperty(e,t)?f(n,"\\.correct_responses\\.\\d+$")&&this.context.isInitialized()&&"pattern"!==t&&(this.context.validateCorrectResponse(n,i),"0"!==this.context.getLastErrorCode())?(this.context.throwSCORMError(n,Ni(this.context.errorCodes,"TYPE_MISMATCH")),F):r&&"0"!==this.context.getLastErrorCode()?F:void 0===t||"__proto__"===t||"constructor"===t?(this.context.throwSCORMError(n,o,a),F):r&&"id"===t&&this.context.isInitialized()&&this.context.checkForDuplicateId(n,i)?(this.context.throwSCORMError(n,Ni(this.context.errorCodes,"GENERAL_SET_FAILURE")),F):(e[t]=i,z):(this.context.throwSCORMError(n,o,a),F)}},{key:"traverseToNextLevel",value:function(e,t,i,n,r,o,a,s,c){var l=t[i];if(void 0===l||!this.context.checkObjectHasProperty(e,l))return this.context.throwSCORMError(r,s,c),{refObject:e,idx:i,foundFirstIndex:a,error:!0};if(!(e=e[l]))return this.context.throwSCORMError(r,s,c),{refObject:e,idx:i,foundFirstIndex:a,error:!0};if(xi(e,me)){var u=this.handleSetArrayAccess(e,t,i,n,r,o,a,s,c);return u.error?{refObject:e,idx:i,foundFirstIndex:a,error:!0}:u}return{refObject:e,idx:i,foundFirstIndex:a,error:!1}}},{key:"handleSetArrayAccess",value:function(e,t,i,n,r,o,a,s,c){var l=parseInt(t[i+1]||"0",10);if(!isNaN(l)){var u=e.childArray[l];if(u)return{refObject:u,idx:i+1,foundFirstIndex:!0,error:!1};if(l>e.childArray.length){var d=o?Ni(this.context.errorCodes,"GENERAL_SET_FAILURE"):Ni(this.context.errorCodes,"INVALID_SET_VALUE")||Ni(this.context.errorCodes,"GENERAL_SET_FAILURE");return this.context.throwSCORMError(r,d,"Cannot set array element at index ".concat(l,". Array indices must be sequential. Current array length is ").concat(e.childArray.length,", expected index ").concat(e.childArray.length,".")),{refObject:e,idx:i,foundFirstIndex:a,error:!0}}var f=this.context.getChildElement(r,n,a);return f?(e.initialized&&f.initialize(),e.childArray[l]=f,{refObject:f,idx:i+1,foundFirstIndex:!0,error:!1}):("0"===this.context.getLastErrorCode()&&this.context.throwSCORMError(r,s,c),{refObject:e,idx:i,foundFirstIndex:a,error:!0})}return{refObject:e,idx:i,foundFirstIndex:a,error:!1}}},{key:"validateGetAttribute",value:function(e,t,i,n,r,o,a){if(n){var s=t+"";if(s.startsWith(Pi)&&"function"==typeof e._isTargetValid){var c=s.substring(8,s.length-1);return{error:!1,returnValue:e._isTargetValid(c)}}if(void 0===t||!this.context.checkObjectHasProperty(e,t))return"_children"===t?(this.context.throwSCORMError(i,Ni(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element does not have children"),{error:!0}):"_count"===t?(this.context.throwSCORMError(i,Ni(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element is not a collection and therefore does not have a count"),{error:!0}):(this.context.throwSCORMError(i,r,o),{error:!0})}else if(a&&(void 0===t||!this.context.checkObjectHasProperty(e,t)))return"_children"===t?this.context.throwSCORMError(i,Ni(this.context.errorCodes,"CHILDREN_ERROR")):"_count"===t?this.context.throwSCORMError(i,Ni(this.context.errorCodes,"COUNT_ERROR")):this.context.throwSCORMError(i,r,o),{error:!0};return{error:!1}}},{key:"handleGetArrayAccess",value:function(e,t,i,n,r){var o=parseInt(t[i+1]||"",10);if(!isNaN(o)){var a=e.childArray[o];return a?{refObject:a,idx:i+1,error:!1}:(this.context.throwSCORMError(n,Ni(this.context.errorCodes,"VALUE_NOT_INITIALIZED"),r),{refObject:e,idx:i,error:!0})}return{refObject:e,idx:i,error:!1}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function qi(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var Li=Object.defineProperty,zi=function(e,t,i){return function(e,t,i){return t in e?Li(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Fi=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),zi(this,"_logLevel",Ee.ERROR),zi(this,"_logHandler"),this._logHandler=je}var t,i,n;return t=e,n=[{key:"getInstance",value:function(){return e._instance||(e._instance=new e),e._instance}}],(i=[{key:"setLogLevel",value:function(e){this._logLevel=e}},{key:"getLogLevel",value:function(){return this._logLevel}},{key:"setLogHandler",value:function(e){this._logHandler=e}},{key:"log",value:function(e,t){this.shouldLog(e)&&this._logHandler(e,t)}},{key:"error",value:function(e){this.log(Ee.ERROR,e)}},{key:"warn",value:function(e){this.log(Ee.WARN,e)}},{key:"info",value:function(e){this.log(Ee.INFO,e)}},{key:"debug",value:function(e){this.log(Ee.DEBUG,e)}},{key:"shouldLog",value:function(e){return this.getNumericLevel(e)>=this.getNumericLevel(this._logLevel)}},{key:"getNumericLevel",value:function(e){if(void 0===e)return Ee.NONE;if("number"==typeof e)return e;switch("string"==typeof e?e.toUpperCase():e){case"1":case"DEBUG":return Ee.DEBUG;case"2":case"INFO":return Ee.INFO;case"3":case"WARN":return Ee.WARN;case"4":case"ERROR":default:return Ee.ERROR;case"5":case"NONE":return Ee.NONE}}}])&&qi(t.prototype,i),n&&qi(t,n),e}();zi(Fi,"_instance");var Bi=Fi;function Vi(){return Bi.getInstance()}function Hi(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var Ui=Object.defineProperty,Gi=function(e,t,i){return function(e,t,i){return t in e?Ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Ki=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Gi(this,"_lastErrorCode","0"),Gi(this,"_lastDiagnostic",""),Gi(this,"_errorCodes"),Gi(this,"_apiLog"),Gi(this,"_getLmsErrorMessageDetails"),Gi(this,"_loggingService"),this._errorCodes=t,this._apiLog=i,this._getLmsErrorMessageDetails=n,this._loggingService=r||Vi()}return t=e,(i=[{key:"lastErrorCode",get:function(){return this._lastErrorCode},set:function(e){this._lastErrorCode=e}},{key:"lastDiagnostic",get:function(){return this._lastDiagnostic}},{key:"throwSCORMError",value:function(e,t,i){this._lastDiagnostic=i||"",i||(i=this._getLmsErrorMessageDetails(t,!0));var n="SCORM Error ".concat(t,": ").concat(i).concat(e?" [Element: ".concat(e,"]"):"");this._apiLog("throwSCORMError",t+": "+i,Ee.ERROR,e),this._loggingService.error(n),this._lastErrorCode=t+""}},{key:"clearSCORMError",value:function(e){void 0!==e&&e!==F&&(this._lastErrorCode="0")}},{key:"handleValueAccessException",value:function(e,t,i){if(Hi(t,L)){var n=t;this._lastErrorCode=n.errorCode+"",this._lastDiagnostic="";var r="Validation Error ".concat(n.errorCode,": ").concat(n.message," [Element: ").concat(e,"]");this._loggingService.warn(r),i=F}else if(Hi(t,Error)){var o=t.constructor.name,a="".concat(o,": ").concat(t.message," [Element: ").concat(e,"]"),s=t.stack||"";this._loggingService.error("".concat(a,"\n").concat(s)),this.throwSCORMError(e,this._errorCodes.GENERAL,"".concat(o,": ").concat(t.message)),i=F}else{this._loggingService.error("Unknown error occurred while accessing [Element: ".concat(e,"]"));try{var c=JSON.stringify(t);this._loggingService.error("Error details: ".concat(c))}catch(e){this._loggingService.error("Could not stringify error object for details")}this.throwSCORMError(e,this._errorCodes.GENERAL,"Unknown error"),i=F}return i}},{key:"errorCodes",get:function(){return this._errorCodes}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Yi=Object.defineProperty,Wi=function(e,t,i){return function(e,t,i){return t in e?Yi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Ji=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Wi(this,"listenerMap",new Map),Wi(this,"listenerCount",0),Wi(this,"apiLog"),this.apiLog=t}return t=e,(i=[{key:"parseListenerName",value:function(e){if(!e)return null;var t=e.split("."),i=t[0],n=null;return t.length>1&&(n=e.replace("".concat(i,"."),"")),{functionName:null!=i?i:e,CMIElement:n}}},{key:"on",value:function(e,t){if(t){var i=e.split(" "),n=!0,r=!1,o=void 0;try{for(var a,s=i[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c,l=this.parseListenerName(a.value);if(l){var u=l.functionName,d=l.CMIElement,f=null!==(c=this.listenerMap.get(u))&&void 0!==c?c:[];f.push({functionName:u,CMIElement:d,callback:t}),this.listenerMap.set(u,f),this.listenerCount++,this.apiLog("on","Added event listener: ".concat(this.listenerCount),Ee.INFO,u)}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}}},{key:"off",value:function(e,t){if(t){var i=e.split(" "),n=!0,r=!1,o=void 0;try{for(var a,s,c=function(){var e=a.parseListenerName(s.value);if(!e)return"continue";var i=e.functionName,n=e.CMIElement,r=a.listenerMap.get(i);if(!r)return"continue";var o=r.findIndex(function(e){return e.CMIElement===n&&e.callback===t});-1!==o&&(r.splice(o,1),a.listenerCount--,0===r.length&&a.listenerMap.delete(i),a.apiLog("off","Removed event listener: ".concat(a.listenerCount),Ee.INFO,i))},l=i[Symbol.iterator]();!(n=(s=l.next()).done);n=!0)a=this,c()}catch(e){r=!0,o=e}finally{try{n||null==l.return||l.return()}finally{if(r)throw o}}}}},{key:"clear",value:function(e){var t=e.split(" "),i=!0,n=!1,r=void 0;try{for(var o,a,s=function(){var e=o.parseListenerName(a.value);if(!e)return"continue";var t=e.functionName,i=e.CMIElement;if(o.listenerMap.has(t)){var n=o.listenerMap.get(t),r=null===i?[]:n.filter(function(e){return e.CMIElement!==i});o.listenerCount-=n.length-r.length,0===r.length?o.listenerMap.delete(t):o.listenerMap.set(t,r)}},c=t[Symbol.iterator]();!(i=(a=c.next()).done);i=!0)o=this,s()}catch(e){n=!0,r=e}finally{try{i||null==c.return||c.return()}finally{if(n)throw r}}}},{key:"processListeners",value:function(e,t,i,n){this.apiLog(e,i,Ee.INFO,t);var r=this.listenerMap.get(e);if(r){var o=!0,a=!1,s=void 0;try{for(var c,l=r[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value,d=!!u.CMIElement,f=!1;if(t&&u.CMIElement)if(u.CMIElement.endsWith("*")){var v=u.CMIElement.slice(0,-1);f=t.startsWith(v)}else f=u.CMIElement===t;d&&!f||(this.apiLog("processListeners","Processing listener: ".concat(u.functionName),Ee.DEBUG,t),e.startsWith("Sequence")?u.callback(i):"CommitError"===e?void 0!==n?u.callback(i,n):u.callback(i):"CommitSuccess"===e?void 0!==n?u.callback(n):u.callback():u.callback(t,i))}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}}}},{key:"reset",value:function(){this.listenerMap.clear(),this.listenerCount=0}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function $i(e,t,i,n,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(n,r)}function Xi(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){$i(o,n,r,a,s,"next",e)}function s(e){$i(o,n,r,a,s,"throw",e)}a(void 0)})}}function Qi(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Zi(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function en(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Qi(e,t,i[t])})}return e}function tn(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:c(0)}),s(a,"throw",{value:c(1)}),s(a,"return",{value:c(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function c(s){return function(c){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}var nn=Object.defineProperty,rn=function(e,t,i){return function(e,t,i){return t in e?nn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},an=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),rn(this,"apiLog",n),rn(this,"settings"),rn(this,"error_codes"),rn(this,"storeName","scorm_again_offline_data"),rn(this,"syncQueue","scorm_again_sync_queue"),rn(this,"isOnline",navigator.onLine),rn(this,"syncInProgress",!1),rn(this,"boundOnlineStatusChangeHandler"),rn(this,"boundCustomNetworkStatusHandler"),this.settings=t,this.error_codes=i,this.boundOnlineStatusChangeHandler=this.handleOnlineStatusChange.bind(this),this.boundCustomNetworkStatusHandler=this.handleCustomNetworkStatus.bind(this),window.addEventListener("online",this.boundOnlineStatusChangeHandler),window.addEventListener("offline",this.boundOnlineStatusChangeHandler),window.addEventListener("scorm-again:network-status",this.boundCustomNetworkStatusHandler)}return t=e,(i=[{key:"handleOnlineStatusChange",value:function(){var e=this,t=this.isOnline;this.isOnline=navigator.onLine,!t&&this.isOnline?(this.apiLog("OfflineStorageService","Device is back online, attempting to sync...",Ee.INFO),this.syncOfflineData().then(function(t){t?e.apiLog("OfflineStorageService","Sync completed successfully",Ee.INFO):e.apiLog("OfflineStorageService","Sync failed",Ee.ERROR)},function(t){e.apiLog("OfflineStorageService","Error during sync: ".concat(t),Ee.ERROR)})):t&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",Ee.INFO)}},{key:"handleCustomNetworkStatus",value:function(e){var t=this;if(Zi(e,CustomEvent)){var i=e.detail.online;if("boolean"==typeof i){var n=this.isOnline;this.isOnline=i,this.apiLog("OfflineStorageService","Network status updated via custom event: ".concat(i?"online":"offline"),Ee.INFO),!n&&this.isOnline?(this.apiLog("OfflineStorageService","Device is back online, attempting to sync...",Ee.INFO),this.syncOfflineData().then(function(e){e?t.apiLog("OfflineStorageService","Sync completed successfully",Ee.INFO):t.apiLog("OfflineStorageService","Sync failed",Ee.ERROR)},function(e){t.apiLog("OfflineStorageService","Error during sync: ".concat(e),Ee.ERROR)})):n&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",Ee.INFO)}else this.apiLog("OfflineStorageService","Invalid online status value in custom event",Ee.WARN)}else this.apiLog("OfflineStorageService","Invalid network status event received",Ee.WARN)}},{key:"storeOffline",value:function(e,t,i){try{var n=en({id:"".concat(e,"_").concat(Date.now(),"_").concat(Math.random().toString(36).substring(2,9)),courseId:e,timestamp:Date.now(),data:t,syncAttempts:0},void 0!==(null==i?void 0:i.isTerminateCommit)?{isTerminateCommit:i.isTerminateCommit}:{},void 0!==(null==i?void 0:i.sequence)?{sequence:i.sequence}:{}),r=this.getFromStorage(this.syncQueue)||[];return r.push(n),this.saveToStorage(this.syncQueue,r),this.saveToStorage("".concat(this.storeName,"_").concat(e),t),this.apiLog("OfflineStorageService","Stored data offline for course ".concat(e),Ee.INFO),{result:z,errorCode:0}}catch(t){var o,a=(Zi(t,Error)?t.message:t+"").includes("storage quota");return this.apiLog("OfflineStorageService",a?"storage quota exceeded - cannot store offline data for course ".concat(e):"Error storing offline data: ".concat(t),Ee.ERROR),{result:F,errorCode:null!==(o=this.error_codes.GENERAL)&&void 0!==o?o:0}}}},{key:"getOfflineData",value:function(e){return Xi(function(){return tn(this,function(t){try{return[2,this.getFromStorage("".concat(this.storeName,"_").concat(e))||null]}catch(e){return this.apiLog("OfflineStorageService","Error retrieving offline data: ".concat(e),Ee.ERROR),[2,null]}return[2]})}).call(this)}},{key:"syncOfflineData",value:function(){return Xi(function(){var e,t,i,n,r,o,a,s,c,l,u,d,f,v;return tn(this,function(h){switch(h.label){case 0:if(this.syncInProgress||!this.isOnline)return[2,!1];this.syncInProgress=!0,h.label=1;case 1:if(h.trys.push([1,12,,13]),0===(e=this.getFromStorage(this.syncQueue)||[]).length)return this.syncInProgress=!1,[2,!0];this.apiLog("OfflineStorageService","Found ".concat(e.length," items to sync"),Ee.INFO),t=[],i=!0,n=!1,r=void 0,h.label=2;case 2:h.trys.push([2,9,10,11]),o=e[Symbol.iterator](),h.label=3;case 3:if(i=(a=o.next()).done)return[3,8];if(l=null!==(c=this.settings.maxSyncAttempts)&&void 0!==c?c:5,(s=a.value).syncAttempts>=l)return this.apiLog("OfflineStorageService","Removing abandoned item ".concat(s.id," after ").concat(l," failed sync attempts"),Ee.WARN),[3,7];h.label=4;case 4:return h.trys.push([4,6,,7]),[4,this.sendDataToLMS(s.data,en({},void 0!==s.isTerminateCommit?{isTerminateCommit:s.isTerminateCommit}:{},void 0!==s.sequence?{sequence:s.sequence}:{}))];case 5:return!0===(u=h.sent()).result||u.result===z?this.apiLog("OfflineStorageService","Successfully synced item ".concat(s.id),Ee.INFO):(s.syncAttempts++,t.push(s),this.apiLog("OfflineStorageService","Failed to sync item ".concat(s.id,", attempt #").concat(s.syncAttempts),Ee.WARN)),[3,7];case 6:return d=h.sent(),s.syncAttempts++,t.push(s),this.apiLog("OfflineStorageService","Error syncing item ".concat(s.id,": ").concat(d),Ee.ERROR),[3,7];case 7:return i=!0,[3,3];case 8:return[3,11];case 9:return f=h.sent(),n=!0,r=f,[3,11];case 10:try{i||null==o.return||o.return()}finally{if(n)throw r}return[7];case 11:return this.saveToStorage(this.syncQueue,t),this.apiLog("OfflineStorageService","Sync completed. ".concat(e.length-t.length," items synced, ").concat(t.length," items remaining"),Ee.INFO),this.syncInProgress=!1,[2,!0];case 12:return v=h.sent(),this.apiLog("OfflineStorageService","Error during sync process: ".concat(v),Ee.ERROR),this.syncInProgress=!1,[2,!1];case 13:return[2]}})}).call(this)}},{key:"sendDataToLMS",value:function(e,t){return Xi(function(){var i,n,r,o,a,s,c,result,l,u;return tn(this,function(d){switch(d.label){case 0:if(!(i=this.settings.lmsCommitUrl))return[2,{result:F,errorCode:this.error_codes.GENERAL||101}];d.label=1;case 1:return d.trys.push([1,7,,8]),r=i+"",o=this.settings.requestHandler(e,en({isTerminateCommit:null!==(n=null==t?void 0:t.isTerminateCommit)&&void 0!==n&&n,trigger:"offline-replay"},void 0!==(null==t?void 0:t.sequence)?{sequence:t.sequence}:{})),a=(null==t?void 0:t.isTerminateCommit)&&this.settings.terminateCommitParam?h(r,this.settings.terminateCommitParam,"true"):r,s={method:"POST",mode:this.settings.fetchMode,body:JSON.stringify(o),headers:(f=en({},this.settings.xhrHeaders),v={"Content-Type":this.settings.commitRequestDataType},v=null!=v?v:{},Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(v)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(v)).forEach(function(e){Object.defineProperty(f,e,Object.getOwnPropertyDescriptor(v,e))}),f)},this.settings.xhrWithCredentials&&(s.credentials="include"),[4,fetch(a,s)];case 2:return c=d.sent(),"function"!=typeof this.settings.responseHandler?[3,4]:[4,this.settings.responseHandler(c)];case 3:return l=d.sent(),[3,6];case 4:return[4,c.json()];case 5:l=d.sent(),d.label=6;case 6:return result=l,200>c.status||c.status>299||!0!==result.result&&result.result!==z?(Object.hasOwnProperty.call(result,"errorCode")||(result.errorCode=this.error_codes.GENERAL),[2,result]):(Object.hasOwnProperty.call(result,"errorCode")||(result.errorCode=0),[2,result]);case 7:return u=d.sent(),this.apiLog("OfflineStorageService","Error sending data to LMS: ".concat(u),Ee.ERROR),[2,{result:F,errorCode:this.error_codes.GENERAL||101}];case 8:return[2]}var f,v})}).call(this)}},{key:"isDeviceOnline",value:function(){return this.isOnline}},{key:"getFromStorage",value:function(e){var t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){return null}return null}},{key:"saveToStorage",value:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){if(Zi(e,DOMException)&&"QuotaExceededError"===e.name)throw Error("storage quota exceeded - localStorage is full",{cause:e});throw e}}},{key:"hasPendingOfflineData",value:function(e){return Xi(function(){return tn(this,function(t){return[2,(this.getFromStorage(this.syncQueue)||[]).some(function(t){return t.courseId===e})]})}).call(this)}},{key:"updateSettings",value:function(e){this.settings=e}},{key:"destroy",value:function(){window.removeEventListener("online",this.boundOnlineStatusChangeHandler),window.removeEventListener("offline",this.boundOnlineStatusChangeHandler),window.removeEventListener("scorm-again:network-status",this.boundCustomNetworkStatusHandler)}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}(),sn=v(function(e,t,i,n,r,o){if("string"!=typeof t)return!1;var a=RegExp(i),s=t.match(a);if(o&&""===t)return!0;if(!s||""===s[0])throw new r(e,n);return!0},function(e,t,i,n,r,o){var a,s="string"==typeof t?t:"[".concat(void 0===t?"undefined":(a=t)&&"undefined"!=typeof Symbol&&a.constructor===Symbol?"symbol":typeof a,"]");return"".concat(e,":").concat(s,":").concat(i,":").concat(n,":").concat(o||!1)},{maxEntries:1e3,maxKeyLength:2e3}),cn=v(function(e,t,i,n,r){var o=i.split("#");if(isNaN(t=+t))throw new r(e,n);var a=o[0],s=o[1],c=void 0!==s&&""!==s&&"*"!==s;if(void 0!==a&&""!==a&&+a>t)throw new r(e,n);if(c&&t>+s)throw new r(e,n);return!0},function(e,t,i,n,r){return"".concat(e,":").concat(t,":").concat(i,":").concat(n)},{maxEntries:1e3});function ln(e,t,i,n){return sn(e,t,i,ce.TYPE_MISMATCH,ie,n)}function un(e,t,i){return cn(e,t,i,ce.VALUE_OUT_OF_RANGE,ie)}function dn(e,t,i){return t=hn(t),n=e,!(r=_n()?Reflect.construct(t,i||[],hn(e).constructor):t.apply(e,i))||"object"!==gn(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function fn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vn(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function hn(e){return hn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},hn(e)}function mn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&yn(e,t)}function pn(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function yn(e,t){return yn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},yn(e,t)}function gn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _n(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_n=function(){return!!result})()}var bn=Object.defineProperty,Sn=function(e,t,i){return function(e,t,i){return t in e?bn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":gn(t))?t+"":t,i)},wn=function(e){return e.SATISFIED="satisfied",e.NOT_SATISFIED="notSatisfied",e.COMPLETED="completed",e.INCOMPLETE="incomplete",e}(wn||{}),On=function(e){return e.ALL="all",e.ANY="any",e.NONE="none",e.AT_LEAST_COUNT="atLeastCount",e.AT_LEAST_PERCENT="atLeastPercent",e}(On||{}),Cn=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"always",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Map;return fn(this,t),e=dn(this,t,["rollupCondition"]),Sn(e,"_condition","always"),Sn(e,"_parameters",new Map),e._condition=i,e._parameters=n,e}return mn(t,e),vn(t,[{key:"reset",value:function(){this._initialized=!1}},{key:"condition",get:function(){return this._condition},set:function(e){this._condition=e}},{key:"parameters",get:function(){return this._parameters},set:function(e){this._parameters=e}},{key:"evaluate",value:function(e){switch(this._condition){case"satisfied":return!0===e.objectiveSatisfiedStatus||e.successStatus===_e;case"objectiveStatusKnown":return e.objectiveSatisfiedStatusKnown;case"objectiveMeasureKnown":return e.objectiveMeasureStatus;case"objectiveMeasureGreaterThan":var t=this._parameters.get("threshold")||0;return e.objectiveMeasureStatus&&e.objectiveNormalizedMeasure>t;case"objectiveMeasureLessThan":var i=this._parameters.get("threshold")||0;return e.objectiveMeasureStatus&&i>e.objectiveNormalizedMeasure;case"completed":return e.isCompleted;case"progressKnown":return e.completionStatus!==Ce;case"attempted":return e.attemptCount>0;case"notAttempted":return 0===e.attemptCount;case"always":return!0;default:return!1}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={condition:this._condition,parameters:Object.fromEntries(this._parameters)};return this.jsonString=!1,result}}]),t}(O),En=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"satisfied",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return fn(this,t),e=dn(this,t,["rollupRule"]),Sn(e,"_conditions",[]),Sn(e,"_action","satisfied"),Sn(e,"_consideration","all"),Sn(e,"_minimumCount",0),Sn(e,"_minimumPercent",0),e._action=i,e._consideration=n,e._minimumCount=r,e._minimumPercent=o,e}return mn(t,e),vn(t,[{key:"reset",value:function(){this._initialized=!1,this._conditions=[]}},{key:"conditions",get:function(){return this._conditions}},{key:"addCondition",value:function(e){if(!pn(e,Cn))throw new ie(this._cmi_element+".conditions",ce.TYPE_MISMATCH);this._conditions.push(e)}},{key:"removeCondition",value:function(e){var t=this._conditions.indexOf(e);return-1!==t&&(this._conditions.splice(t,1),!0)}},{key:"action",get:function(){return this._action},set:function(e){this._action=e}},{key:"consideration",get:function(){return this._consideration},set:function(e){this._consideration=e}},{key:"minimumCount",get:function(){return this._minimumCount},set:function(e){0>e||(this._minimumCount=e)}},{key:"minimumPercent",get:function(){return this._minimumPercent},set:function(e){0>e||e>100||(this._minimumPercent=e)}},{key:"evaluate",value:function(e){var t=this;if(0===e.length)return!1;var i=e.filter(function(e){return t._conditions.every(function(t){return t.evaluate(e)})});switch(this._consideration){case"all":return i.length===e.length;case"any":return i.length>0;case"none":return 0===i.length;case"atLeastCount":return i.length>=this._minimumCount;case"atLeastPercent":return i.length/e.length*100>=this._minimumPercent;default:return!1}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={conditions:this._conditions,action:this._action,consideration:this._consideration,minimumCount:this._minimumCount,minimumPercent:this._minimumPercent};return this.jsonString=!1,result}}]),t}(O),An=function(e){function t(){var e;return fn(this,t),e=dn(this,t,["rollupRules"]),Sn(e,"_rules",[]),e}return mn(t,e),vn(t,[{key:"reset",value:function(){this._initialized=!1,this._rules=[]}},{key:"rules",get:function(){return this._rules}},{key:"addRule",value:function(e){if(!pn(e,En))throw new ie(this._cmi_element+".rules",ce.TYPE_MISMATCH);this._rules.push(e)}},{key:"removeRule",value:function(e){var t=this._rules.indexOf(e);return-1!==t&&(this._rules.splice(t,1),!0)}},{key:"processRollup",value:function(e){if(e&&0!==e.children.length){var t=e.getAvailableChildren(),i=!1,n=!1;if(e.sequencingControls.rollupObjectiveSatisfied&&null!==this._objectiveRollupUsingMeasure(e,t)&&(n=!0),!n){var r=!0,o=!1,a=void 0;try{for(var s,c=this._rules[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var l=s.value;if(l.evaluate(t))switch(l.action){case"satisfied":e.successStatus=_e,n=!0;break;case"notSatisfied":e.successStatus=be,n=!0;break;case"completed":e.completionStatus=we,e.isCompleted=!0,i=!0;break;case"incomplete":e.completionStatus=Oe,e.isCompleted=!1,i=!0}}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}}i||this._defaultCompletionRollup(e,t),n||this._defaultSuccessRollup(e,t)}}},{key:"_defaultCompletionRollup",value:function(e,t){t.every(function(e){return e.isCompleted})?(e.completionStatus=we,e.isCompleted=!0):t.some(function(e){return e.completionStatus===Oe})&&(e.completionStatus=Oe,e.isCompleted=!1)}},{key:"_objectiveRollupUsingMeasure",value:function(e,t){if(0>=e.sequencingControls.objectiveMeasureWeight)return null;var i=0,n=0,r=!1,o=!0,a=!1,s=void 0;try{for(var c,l=t[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value;if(u.sequencingControls.rollupObjectiveSatisfied&&u.objectiveMeasureStatus&&!0===u.objectiveMeasureStatus){var d=u.sequencingControls.objectiveMeasureWeight;d>0&&(n+=u.objectiveNormalizedMeasure*d,i+=d,r=!0)}}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}if(!r||0===i)return null;var f=n/i;return e.objectiveNormalizedMeasure=f,e.objectiveMeasureStatus=!0,e.scaledPassingScore>f?(e.successStatus=be,e.objectiveSatisfiedStatus=!1,!1):(e.successStatus=_e,e.objectiveSatisfiedStatus=!0,!0)}},{key:"_defaultSuccessRollup",value:function(e,t){t.every(function(e){return e.successStatus===_e})?e.successStatus=_e:t.some(function(e){return e.successStatus===be})&&(e.successStatus=be)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={rules:this._rules};return this.jsonString=!1,result}}]),t}(O);function kn(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function jn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rn(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Mn(e,t,i){return t&&Rn(e.prototype,t),i&&Rn(e,i),e}function Tn(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function xn(e,t,i){return xn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=In(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},xn(e,t,i||e)}function In(e){return In=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},In(e)}function Pn(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Tn(e,t,i[t])})}return e}function Nn(e,t){return Nn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Nn(e,t)}function Dn(e){return function(e){if(Array.isArray(e))return kn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return kn(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?kn(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Ln(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ln=function(){return!!result})()}var zn=Object.defineProperty,Fn=function(e,t,i){return function(e,t,i){return t in e?zn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":qn(t))?t+"":t,i)},Bn=function(){function e(id){var t,i,n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};jn(this,e),Fn(this,"_id"),Fn(this,"_description"),Fn(this,"_satisfiedByMeasure"),Fn(this,"_minNormalizedMeasure"),Fn(this,"_mapInfo"),Fn(this,"_isPrimary"),Fn(this,"_satisfiedStatus",!1),Fn(this,"_satisfiedStatusKnown",!1),Fn(this,"_measureStatus",!1),Fn(this,"_normalizedMeasure",0),Fn(this,"_rawScore",""),Fn(this,"_rawScoreKnown",!1),Fn(this,"_minScore",""),Fn(this,"_minScoreKnown",!1),Fn(this,"_maxScore",""),Fn(this,"_maxScoreKnown",!1),Fn(this,"_progressMeasure",0),Fn(this,"_progressMeasureStatus",!1),Fn(this,"_completionStatus",Ce),Fn(this,"_progressStatus",!1),Fn(this,"_satisfiedStatusDirty",!1),Fn(this,"_normalizedMeasureDirty",!1),Fn(this,"_completionStatusDirty",!1),Fn(this,"_progressMeasureDirty",!1),Fn(this,"_rawScoreDirty",!1),Fn(this,"_minScoreDirty",!1),Fn(this,"_maxScoreDirty",!1),this._id=id,this._description=null!==(t=o.description)&&void 0!==t?t:null,this._satisfiedByMeasure=null!==(i=o.satisfiedByMeasure)&&void 0!==i&&i,this._minNormalizedMeasure=null!==(n=o.minNormalizedMeasure)&&void 0!==n?n:null,this._mapInfo=o.mapInfo?Dn(o.mapInfo):[],this._isPrimary=null!==(r=o.isPrimary)&&void 0!==r&&r}return Mn(e,[{key:"id",get:function(){return this._id}},{key:"description",get:function(){return this._description}},{key:"satisfiedByMeasure",get:function(){return this._satisfiedByMeasure},set:function(e){this._satisfiedByMeasure=e}},{key:"minNormalizedMeasure",get:function(){return this._minNormalizedMeasure},set:function(e){this._minNormalizedMeasure=e}},{key:"mapInfo",get:function(){return this._mapInfo},set:function(e){this._mapInfo=Dn(e)}},{key:"isPrimary",get:function(){return this._isPrimary},set:function(e){this._isPrimary=e}},{key:"satisfiedStatus",get:function(){return this._satisfiedStatus},set:function(e){this._satisfiedStatus!==e&&(this._satisfiedStatus=e,this._satisfiedStatusDirty=!0,this._satisfiedStatusKnown=!0,this._progressStatus=!0)}},{key:"satisfiedStatusKnown",get:function(){return this._satisfiedStatusKnown},set:function(e){this._satisfiedStatusKnown=e}},{key:"measureStatus",get:function(){return this._measureStatus},set:function(e){this._measureStatus=e}},{key:"normalizedMeasure",get:function(){return this._normalizedMeasure},set:function(e){this._normalizedMeasure!==e&&(this._normalizedMeasure=e,this._normalizedMeasureDirty=!0)}},{key:"rawScore",get:function(){return this._rawScore},set:function(e){this._rawScore!==e&&(this._rawScore=e,this._rawScoreDirty=!0),this._rawScoreKnown=""!==e}},{key:"rawScoreKnown",get:function(){return this._rawScoreKnown},set:function(e){this._rawScoreKnown=e}},{key:"minScore",get:function(){return this._minScore},set:function(e){this._minScore!==e&&(this._minScore=e,this._minScoreDirty=!0),this._minScoreKnown=""!==e}},{key:"minScoreKnown",get:function(){return this._minScoreKnown},set:function(e){this._minScoreKnown=e}},{key:"maxScore",get:function(){return this._maxScore},set:function(e){this._maxScore!==e&&(this._maxScore=e,this._maxScoreDirty=!0),this._maxScoreKnown=""!==e}},{key:"maxScoreKnown",get:function(){return this._maxScoreKnown},set:function(e){this._maxScoreKnown=e}},{key:"progressMeasure",get:function(){return this._progressMeasure},set:function(e){this._progressMeasure!==e&&(this._progressMeasure=e,this._progressMeasureDirty=!0)}},{key:"progressMeasureStatus",get:function(){return this._progressMeasureStatus},set:function(e){this._progressMeasureStatus=e}},{key:"completionStatus",get:function(){return this._completionStatus},set:function(e){this._completionStatus!==e&&(this._completionStatus=e,this._completionStatusDirty=!0)}},{key:"progressStatus",get:function(){return this._progressStatus},set:function(e){this._progressStatus=e}},{key:"isDirty",value:function(e){switch(e){case"satisfiedStatus":return this._satisfiedStatusDirty;case"normalizedMeasure":return this._normalizedMeasureDirty;case"completionStatus":return this._completionStatusDirty;case"progressMeasure":return this._progressMeasureDirty;case"rawScore":return this._rawScoreDirty;case"minScore":return this._minScoreDirty;case"maxScore":return this._maxScoreDirty}}},{key:"clearDirty",value:function(e){switch(e){case"satisfiedStatus":this._satisfiedStatusDirty=!1;break;case"normalizedMeasure":this._normalizedMeasureDirty=!1;break;case"completionStatus":this._completionStatusDirty=!1;break;case"progressMeasure":this._progressMeasureDirty=!1;break;case"rawScore":this._rawScoreDirty=!1;break;case"minScore":this._minScoreDirty=!1;break;case"maxScore":this._maxScoreDirty=!1}}},{key:"clearAllDirty",value:function(){this._satisfiedStatusDirty=!1,this._normalizedMeasureDirty=!1,this._completionStatusDirty=!1,this._progressMeasureDirty=!1,this._rawScoreDirty=!1,this._minScoreDirty=!1,this._maxScoreDirty=!1}},{key:"initializeFromCMI",value:function(e,t,i){this._satisfiedStatus=e,this._satisfiedStatusDirty=!0,this._normalizedMeasure=t,this._normalizedMeasureDirty=!0,this._measureStatus=i}},{key:"initializeScoreFromCMI",value:function(score){void 0!==score.rawScore&&""!==score.rawScore&&(this._rawScore=score.rawScore,this._rawScoreKnown=!0,this._rawScoreDirty=!0),void 0!==score.minScore&&""!==score.minScore&&(this._minScore=score.minScore,this._minScoreKnown=!0,this._minScoreDirty=!0),void 0!==score.maxScore&&""!==score.maxScore&&(this._maxScore=score.maxScore,this._maxScoreKnown=!0,this._maxScoreDirty=!0)}},{key:"applyReadMappedState",value:function(e){void 0!==e.satisfiedStatus&&(this._satisfiedStatus=e.satisfiedStatus,this._satisfiedStatusKnown=!0,this._progressStatus=!0),void 0!==e.normalizedMeasure&&(this._normalizedMeasure=e.normalizedMeasure,this._measureStatus=!0),void 0!==e.completionStatus&&(this._completionStatus=e.completionStatus),void 0!==e.progressMeasure&&(this._progressMeasure=e.progressMeasure,this._progressMeasureStatus=!0),void 0!==e.rawScore&&(this._rawScore=e.rawScore,this._rawScoreKnown=!0),void 0!==e.minScore&&(this._minScore=e.minScore,this._minScoreKnown=!0),void 0!==e.maxScore&&(this._maxScore=e.maxScore,this._maxScoreKnown=!0)}},{key:"resetState",value:function(){this._satisfiedStatus=!1,this._satisfiedStatusKnown=!1,this._measureStatus=!1,this._normalizedMeasure=0,this._rawScore="",this._rawScoreKnown=!1,this._minScore="",this._minScoreKnown=!1,this._maxScore="",this._maxScoreKnown=!1,this._progressMeasure=0,this._progressMeasureStatus=!1,this._completionStatus=Ce,this._progressStatus=!1,this.clearAllDirty()}},{key:"updateFromActivity",value:function(e){this._satisfiedStatus!==e.objectiveSatisfiedStatus&&(this._satisfiedStatus=e.objectiveSatisfiedStatus,this._satisfiedStatusDirty=!0),this._satisfiedStatusKnown=e.objectiveSatisfiedStatusKnown,this._measureStatus=e.objectiveMeasureStatus,this._normalizedMeasure!==e.objectiveNormalizedMeasure&&(this._normalizedMeasure=e.objectiveNormalizedMeasure,this._normalizedMeasureDirty=!0),this._progressMeasure!==e.progressMeasure&&(this._progressMeasure=e.progressMeasure,this._progressMeasureDirty=!0),this._progressMeasureStatus=e.progressMeasureStatus,this._completionStatus!==e.completionStatus&&(this._completionStatus=e.completionStatus,this._completionStatusDirty=!0)}},{key:"applyToActivity",value:function(e){this._isPrimary&&e.setPrimaryObjectiveState(this._satisfiedStatus,this._measureStatus,this._normalizedMeasure,this._progressMeasure,this._progressMeasureStatus,this._completionStatus,this._progressStatus||this._satisfiedStatusKnown)}}]),e}(),Vn=function(e){function t(){var e,id=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return jn(this,t),e=function(e,t,i){return t=In(t),n=e,!(r=Ln()?Reflect.construct(t,i||[],In(e).constructor):t.apply(e,i))||"object"!==qn(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["activity"]),Fn(e,"_id",""),Fn(e,"_title",""),Fn(e,"_children",[]),Fn(e,"_parent",null),Fn(e,"_isVisible",!0),Fn(e,"_isActive",!1),Fn(e,"_isSuspended",!1),Fn(e,"_isCompleted",!1),Fn(e,"_completionStatus",Ce),Fn(e,"_successStatus",Se),Fn(e,"_attemptCount",0),Fn(e,"_attemptCompletionAmount",0),Fn(e,"_attemptAbsoluteDuration","PT0H0M0S"),Fn(e,"_attemptExperiencedDuration","PT0H0M0S"),Fn(e,"_activityAbsoluteDuration","PT0H0M0S"),Fn(e,"_activityExperiencedDuration","PT0H0M0S"),Fn(e,"_attemptAbsoluteDurationValue","PT0H0M0S"),Fn(e,"_attemptExperiencedDurationValue","PT0H0M0S"),Fn(e,"_activityAbsoluteDurationValue","PT0H0M0S"),Fn(e,"_activityExperiencedDurationValue","PT0H0M0S"),Fn(e,"_activityStartTimestampUtc",null),Fn(e,"_attemptStartTimestampUtc",null),Fn(e,"_activityEndedDate",null),Fn(e,"_objectiveSatisfiedStatus",!1),Fn(e,"_objectiveSatisfiedStatusKnown",!1),Fn(e,"_objectiveMeasureStatus",!1),Fn(e,"_objectiveNormalizedMeasure",0),Fn(e,"_scaledPassingScore",.7),Fn(e,"_objectiveSatisfiedStatusDirty",!1),Fn(e,"_objectiveNormalizedMeasureDirty",!1),Fn(e,"_objectiveMeasureStatusDirty",!1),Fn(e,"_progressMeasure",0),Fn(e,"_progressMeasureStatus",!1),Fn(e,"_location",""),Fn(e,"_attemptAbsoluteStartTime",""),Fn(e,"_learnerPrefs",null),Fn(e,"_activityAttemptActive",!1),Fn(e,"_isHiddenFromChoice",!1),Fn(e,"_isAvailable",!0),Fn(e,"_hideLmsUi",[]),Fn(e,"_auxiliaryResources",[]),Fn(e,"_attemptLimit",null),Fn(e,"_attemptAbsoluteDurationLimit",null),Fn(e,"_activityAbsoluteDurationLimit",null),Fn(e,"_timeLimitAction",null),Fn(e,"_timeLimitDuration",null),Fn(e,"_beginTimeLimit",null),Fn(e,"_endTimeLimit",null),Fn(e,"_launchData",""),Fn(e,"_credit","credit"),Fn(e,"_maxTimeAllowed",""),Fn(e,"_completionThreshold",""),Fn(e,"_sequencingControls"),Fn(e,"_sequencingRules"),Fn(e,"_rollupRules"),Fn(e,"_processedChildren",null),Fn(e,"_isNewAttempt",!1),Fn(e,"_primaryObjective",null),Fn(e,"_objectives",[]),Fn(e,"_rollupConsiderations",{requiredForSatisfied:"always",requiredForNotSatisfied:"always",requiredForCompleted:"always",requiredForIncomplete:"always",measureSatisfactionIfActive:!0}),Fn(e,"_requiredForSatisfied","always"),Fn(e,"_requiredForNotSatisfied","always"),Fn(e,"_requiredForCompleted","always"),Fn(e,"_requiredForIncomplete","always"),Fn(e,"_wasSkipped",!1),Fn(e,"_attemptProgressStatus",!1),Fn(e,"_wasAutoCompleted",!1),Fn(e,"_wasAutoSatisfied",!1),Fn(e,"_completedByMeasure",!1),Fn(e,"_minProgressMeasure",1),Fn(e,"_progressWeight",1),Fn(e,"_attemptCompletionAmountStatus",!1),e._id=id,e._title=i,e._sequencingControls=new Xt,e._sequencingRules=new Et,e._rollupRules=new An,e._primaryObjective=null,e._objectives=[],e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Nn(e,t)}(t,e),Mn(t,[{key:"initialize",value:function(){xn(In(t.prototype),"initialize",this).call(this);var e=!0,i=!1,n=void 0;try{for(var r,o=this._children[Symbol.iterator]();!(e=(r=o.next()).done);e=!0)r.value.initialize()}catch(e){i=!0,n=e}finally{try{e||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"reset",value:function(){this._initialized=!1,this._isActive=!1,this._isSuspended=!1,this._isCompleted=!1,this._completionStatus=Ce,this._successStatus=Se,this._attemptCount=0,this._attemptCompletionAmount=0,this._attemptAbsoluteDuration="PT0H0M0S",this._attemptExperiencedDuration="PT0H0M0S",this._activityAbsoluteDuration="PT0H0M0S",this._activityExperiencedDuration="PT0H0M0S",this._attemptAbsoluteDurationValue="PT0H0M0S",this._attemptExperiencedDurationValue="PT0H0M0S",this._activityAbsoluteDurationValue="PT0H0M0S",this._activityExperiencedDurationValue="PT0H0M0S",this._activityStartTimestampUtc=null,this._attemptStartTimestampUtc=null,this._activityEndedDate=null,this._objectiveSatisfiedStatus=!1,this._objectiveSatisfiedStatusKnown=!1,this._objectiveMeasureStatus=!1,this._objectiveNormalizedMeasure=0,this._progressMeasure=0,this._progressMeasureStatus=!1,this._location="",this._attemptAbsoluteStartTime="",this._learnerPrefs=null,this._activityAttemptActive=!1,this._primaryObjective&&(this._primaryObjective.resetState(),this._primaryObjective.updateFromActivity(this));var e=!0,t=!1,i=void 0;try{for(var n,r=this._objectives[Symbol.iterator]();!(e=(n=r.next()).done);e=!0)n.value.resetState()}catch(e){t=!0,i=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw i}}var o=!0,a=!1,s=void 0;try{for(var c,l=this._children[Symbol.iterator]();!(o=(c=l.next()).done);o=!0)c.value.reset()}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}this._wasSkipped=!1,this._attemptProgressStatus=!1,this._wasAutoCompleted=!1,this._wasAutoSatisfied=!1,this._completedByMeasure=!1,this._minProgressMeasure=1,this._progressWeight=1,this._attemptCompletionAmountStatus=!1,this.clearAllObjectiveDirty()}},{key:"id",get:function(){return this._id},set:function(id){ln(this._cmi_element+".id",id,Ke)&&(this._id=id)}},{key:"title",get:function(){return this._title},set:function(e){ln(this._cmi_element+".title",e,ze)&&(this._title=e)}},{key:"children",get:function(){return this._children}},{key:"addChild",value:function(e){if(i=e,!(null!=(n=t)&&"undefined"!=typeof Symbol&&n[Symbol.hasInstance]?n[Symbol.hasInstance](i):i instanceof n))throw new ie(this._cmi_element+".children",ce.TYPE_MISMATCH);var i,n;e._parent=this,this._children.push(e)}},{key:"setChildOrder",value:function(e){if(0!==e.length){var t,i=new Map(this._children.map(function(e){return[e.id,e]})),n=[],r=!0,o=!1,a=void 0;try{for(var s,c=e[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var id=s.value,l=i.get(id);l&&(n.push(l),i.delete(id))}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}if(i.size>0){var u=!0,d=!1,f=void 0;try{for(var v,h=this._children[Symbol.iterator]();!(u=(v=h.next()).done);u=!0){var m=v.value;i.has(m.id)&&(n.push(m),i.delete(m.id))}}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}}n.length===this._children.length&&(t=this._children).splice.apply(t,[0,this._children.length].concat(Dn(n)))}}},{key:"removeChild",value:function(e){var t=this._children.indexOf(e);return-1!==t&&(this._children.splice(t,1),e._parent=null,!0)}},{key:"parent",get:function(){return this._parent}},{key:"isVisible",get:function(){return this._isVisible},set:function(e){this._isVisible=e}},{key:"isActive",get:function(){return this._isActive},set:function(e){this._isActive=e}},{key:"isSuspended",get:function(){return this._isSuspended},set:function(e){this._isSuspended=e}},{key:"isCompleted",get:function(){return this._isCompleted},set:function(e){this._isCompleted=e,this._completionStatus=e?we:Oe}},{key:"completionStatus",get:function(){return this._completionStatus},set:function(e){this._completionStatus=e,this._isCompleted=e===we,this.updatePrimaryObjectiveFromActivity()}},{key:"successStatus",get:function(){return this._successStatus},set:function(e){this._successStatus=e}},{key:"attemptCount",get:function(){return this._attemptCount},set:function(e){this._attemptCount=e}},{key:"attemptCompletionAmount",get:function(){return this._attemptCompletionAmount},set:function(e){this._attemptCompletionAmount=e}},{key:"incrementAttemptCount",value:function(){this._attemptCount++,this._isNewAttempt=!0;var e=this._sequencingControls;"onEachNewAttempt"!==e.selectionTiming&&"onEachNewAttempt"!==e.randomizationTiming||(this._processedChildren=null)}},{key:"objectiveSatisfiedStatus",get:function(){return this._objectiveSatisfiedStatus},set:function(e){this._objectiveSatisfiedStatus!==e&&(this._objectiveSatisfiedStatus=e,this._objectiveSatisfiedStatusDirty=!0),this._objectiveSatisfiedStatusKnown=!0,this._successStatus=e?_e:be,this.updatePrimaryObjectiveFromActivity()}},{key:"objectiveSatisfiedStatusKnown",get:function(){return this._objectiveSatisfiedStatusKnown},set:function(e){this._objectiveSatisfiedStatusKnown=e}},{key:"objectiveMeasureStatus",get:function(){return this._objectiveMeasureStatus},set:function(e){this._objectiveMeasureStatus!==e&&(this._objectiveMeasureStatus=e,this._objectiveMeasureStatusDirty=!0),this.updatePrimaryObjectiveFromActivity()}},{key:"objectiveNormalizedMeasure",get:function(){return this._objectiveNormalizedMeasure},set:function(e){this._objectiveNormalizedMeasure!==e&&(this._objectiveNormalizedMeasure=e,this._objectiveNormalizedMeasureDirty=!0),this.updatePrimaryObjectiveFromActivity()}},{key:"scaledPassingScore",get:function(){return this._scaledPassingScore},set:function(e){-1>e||e>1||(this._scaledPassingScore=e)}},{key:"progressMeasure",get:function(){return this._progressMeasure},set:function(e){this._progressMeasure=e,this.updatePrimaryObjectiveFromActivity()}},{key:"progressMeasureStatus",get:function(){return this._progressMeasureStatus},set:function(e){this._progressMeasureStatus=e,this.updatePrimaryObjectiveFromActivity()}},{key:"location",get:function(){return this._location},set:function(location){this._location=location}},{key:"attemptAbsoluteStartTime",get:function(){return this._attemptAbsoluteStartTime},set:function(e){this._attemptAbsoluteStartTime=e}},{key:"learnerPrefs",get:function(){return this._learnerPrefs},set:function(e){this._learnerPrefs=e}},{key:"activityAttemptActive",get:function(){return this._activityAttemptActive},set:function(e){this._activityAttemptActive=e}},{key:"isHiddenFromChoice",get:function(){return this._isHiddenFromChoice},set:function(e){this._isHiddenFromChoice=e}},{key:"isAvailable",get:function(){return this._isAvailable},set:function(e){this._isAvailable=e}},{key:"attemptLimit",get:function(){return this._attemptLimit},set:function(e){this._attemptLimit=e}},{key:"hasAttemptLimitExceeded",value:function(){return null!==this._attemptLimit&&this._attemptCount>=this._attemptLimit}},{key:"timeLimitDuration",get:function(){return this._timeLimitDuration},set:function(e){this._timeLimitDuration=e}},{key:"timeLimitAction",get:function(){return this._timeLimitAction},set:function(e){this._timeLimitAction=e}},{key:"beginTimeLimit",get:function(){return this._beginTimeLimit},set:function(e){this._beginTimeLimit=e}},{key:"endTimeLimit",get:function(){return this._endTimeLimit},set:function(e){this._endTimeLimit=e}},{key:"attemptAbsoluteDurationLimit",get:function(){return this._attemptAbsoluteDurationLimit},set:function(e){if(null!==e&&!l(e,He))throw new ie(this._cmi_element+".attemptAbsoluteDurationLimit",ce.TYPE_MISMATCH);this._attemptAbsoluteDurationLimit=e}},{key:"attemptExperiencedDuration",get:function(){return this._attemptExperiencedDuration},set:function(e){if(!l(e,He))throw new ie(this._cmi_element+".attemptExperiencedDuration",ce.TYPE_MISMATCH);this._attemptExperiencedDuration=e}},{key:"activityAbsoluteDurationLimit",get:function(){return this._activityAbsoluteDurationLimit},set:function(e){if(null!==e&&!l(e,He))throw new ie(this._cmi_element+".activityAbsoluteDurationLimit",ce.TYPE_MISMATCH);this._activityAbsoluteDurationLimit=e}},{key:"activityExperiencedDuration",get:function(){return this._activityExperiencedDuration},set:function(e){if(!l(e,He))throw new ie(this._cmi_element+".activityExperiencedDuration",ce.TYPE_MISMATCH);this._activityExperiencedDuration=e}},{key:"attemptAbsoluteDuration",get:function(){return this._attemptAbsoluteDurationLimit||"PT0H0M0S"},set:function(e){this._attemptAbsoluteDurationLimit=e}},{key:"activityAbsoluteDuration",get:function(){return this._activityAbsoluteDurationLimit||"PT0H0M0S"},set:function(e){this._activityAbsoluteDurationLimit=e}},{key:"attemptAbsoluteDurationValue",get:function(){return this._attemptAbsoluteDurationValue},set:function(e){if(!l(e,He))throw new ie(this._cmi_element+".attemptAbsoluteDurationValue",ce.TYPE_MISMATCH);this._attemptAbsoluteDurationValue=e}},{key:"attemptExperiencedDurationValue",get:function(){return this._attemptExperiencedDurationValue},set:function(e){if(!l(e,He))throw new ie(this._cmi_element+".attemptExperiencedDurationValue",ce.TYPE_MISMATCH);this._attemptExperiencedDurationValue=e}},{key:"activityAbsoluteDurationValue",get:function(){return this._activityAbsoluteDurationValue},set:function(e){if(!l(e,He))throw new ie(this._cmi_element+".activityAbsoluteDurationValue",ce.TYPE_MISMATCH);this._activityAbsoluteDurationValue=e}},{key:"activityExperiencedDurationValue",get:function(){return this._activityExperiencedDurationValue},set:function(e){if(!l(e,He))throw new ie(this._cmi_element+".activityExperiencedDurationValue",ce.TYPE_MISMATCH);this._activityExperiencedDurationValue=e}},{key:"activityStartTimestampUtc",get:function(){return this._activityStartTimestampUtc},set:function(timestamp){this._activityStartTimestampUtc=timestamp}},{key:"attemptStartTimestampUtc",get:function(){return this._attemptStartTimestampUtc},set:function(timestamp){this._attemptStartTimestampUtc=timestamp}},{key:"activityEndedDate",get:function(){return this._activityEndedDate},set:function(e){this._activityEndedDate=e}},{key:"sequencingControls",get:function(){return this._sequencingControls},set:function(e){this._sequencingControls=e}},{key:"sequencingRules",get:function(){return this._sequencingRules},set:function(e){this._sequencingRules=e}},{key:"rollupRules",get:function(){return this._rollupRules},set:function(e){this._rollupRules=e}},{key:"rollupConsiderations",get:function(){return Pn({},this._rollupConsiderations)},set:function(e){this._rollupConsiderations=Pn({},e)}},{key:"applyRollupConsiderations",value:function(e){this._rollupConsiderations=Pn({},this._rollupConsiderations,e)}},{key:"requiredForSatisfied",get:function(){return this._requiredForSatisfied},set:function(e){this._requiredForSatisfied=e}},{key:"requiredForNotSatisfied",get:function(){return this._requiredForNotSatisfied},set:function(e){this._requiredForNotSatisfied=e}},{key:"requiredForCompleted",get:function(){return this._requiredForCompleted},set:function(e){this._requiredForCompleted=e}},{key:"requiredForIncomplete",get:function(){return this._requiredForIncomplete},set:function(e){this._requiredForIncomplete=e}},{key:"wasSkipped",get:function(){return this._wasSkipped},set:function(e){this._wasSkipped=e}},{key:"attemptProgressStatus",get:function(){return this._attemptProgressStatus},set:function(e){this._attemptProgressStatus=e}},{key:"wasAutoCompleted",get:function(){return this._wasAutoCompleted},set:function(e){this._wasAutoCompleted=e}},{key:"wasAutoSatisfied",get:function(){return this._wasAutoSatisfied},set:function(e){this._wasAutoSatisfied=e}},{key:"completedByMeasure",get:function(){return this._completedByMeasure},set:function(e){this._completedByMeasure=e}},{key:"minProgressMeasure",get:function(){return this._minProgressMeasure},set:function(e){if(0>e||e>1)throw new ie(this._cmi_element+".minProgressMeasure",ce.TYPE_MISMATCH);this._minProgressMeasure=e}},{key:"progressWeight",get:function(){return this._progressWeight},set:function(e){if(0>e)throw new ie(this._cmi_element+".progressWeight",ce.TYPE_MISMATCH);this._progressWeight=e}},{key:"attemptCompletionAmountStatus",get:function(){return this._attemptCompletionAmountStatus},set:function(e){this._attemptCompletionAmountStatus=e}},{key:"primaryObjective",get:function(){return this._primaryObjective},set:function(e){var t;(this._primaryObjective=e,this._primaryObjective)&&(this._primaryObjective.isPrimary=!0,null!==this._primaryObjective.minNormalizedMeasure&&(this._scaledPassingScore=null!==(t=this._primaryObjective.minNormalizedMeasure)&&void 0!==t?t:this._scaledPassingScore),this._primaryObjective.updateFromActivity(this));this.syncPrimaryObjectiveCollection()}},{key:"objectives",get:function(){var e=this;return this._objectives.filter(function(t){var i;return t.id!==(null===(i=e._primaryObjective)||void 0===i?void 0:i.id)})},set:function(objectives){this._objectives=Dn(objectives),this.syncPrimaryObjectiveCollection()}},{key:"addObjective",value:function(e){this._objectives.find(function(t){return t.id===e.id})||this._objectives.push(e)}},{key:"syncPrimaryObjectiveCollection",value:function(){var e=this;if(this._primaryObjective){var t=this._objectives.findIndex(function(t){var i;return t.id===(null===(i=e._primaryObjective)||void 0===i?void 0:i.id)});0>t?this._objectives=[this._primaryObjective].concat(Dn(this._objectives)):this._objectives[t]=this._primaryObjective}else this._objectives=this._objectives.filter(function(e){return!e.isPrimary})}},{key:"getObjectiveById",value:function(e){var t;if((null===(t=this._primaryObjective)||void 0===t?void 0:t.id)===e)return{objective:this._primaryObjective,isPrimary:!0};var i=this._objectives.find(function(t){return t.id===e});return i?{objective:i,isPrimary:!1}:null}},{key:"getAllObjectives",value:function(){var e=this,objectives=[];this._primaryObjective&&objectives.push(this._primaryObjective);var t=this._objectives.filter(function(t){var i;return t!==e._primaryObjective&&t.id!==(null===(i=e._primaryObjective)||void 0===i?void 0:i.id)});return objectives.concat(t)}},{key:"updatePrimaryObjectiveFromActivity",value:function(){this._primaryObjective&&this._primaryObjective.updateFromActivity(this)}},{key:"isObjectiveDirty",value:function(e){switch(e){case"satisfiedStatus":return this._objectiveSatisfiedStatusDirty;case"normalizedMeasure":return this._objectiveNormalizedMeasureDirty;case"measureStatus":return this._objectiveMeasureStatusDirty}}},{key:"clearObjectiveDirty",value:function(e){switch(e){case"satisfiedStatus":this._objectiveSatisfiedStatusDirty=!1;break;case"normalizedMeasure":this._objectiveNormalizedMeasureDirty=!1;break;case"measureStatus":this._objectiveMeasureStatusDirty=!1}}},{key:"clearAllObjectiveDirty",value:function(){this._objectiveSatisfiedStatusDirty=!1,this._objectiveNormalizedMeasureDirty=!1,this._objectiveMeasureStatusDirty=!1}},{key:"setPrimaryObjectiveState",value:function(e,t,i,n,r,o){var a=6>=arguments.length||void 0===arguments[6]||arguments[6];this._objectiveSatisfiedStatus!==e&&(this._objectiveSatisfiedStatus=e,this._objectiveSatisfiedStatusDirty=!0),this._objectiveSatisfiedStatusKnown=a,this._objectiveMeasureStatus!==t&&(this._objectiveMeasureStatus=t,this._objectiveMeasureStatusDirty=!0),this._objectiveNormalizedMeasure!==i&&(this._objectiveNormalizedMeasure=i,this._objectiveNormalizedMeasureDirty=!0),this._progressMeasure=n,this._progressMeasureStatus=r,this._completionStatus=o,this._primaryObjective&&(this._primaryObjective.satisfiedStatus=e,this._primaryObjective.measureStatus=t,this._primaryObjective.normalizedMeasure=i,this._primaryObjective.progressMeasure=n,this._primaryObjective.progressMeasureStatus=r,this._primaryObjective.completionStatus=o,this._primaryObjective.satisfiedStatusKnown=a,this._primaryObjective.progressStatus=a)}},{key:"getObjectiveStateSnapshot",value:function(){var e;return{primary:this._primaryObjective?{id:this._primaryObjective.id,satisfiedStatus:this.objectiveSatisfiedStatus,measureStatus:this.objectiveMeasureStatus,normalizedMeasure:this.objectiveNormalizedMeasure,rawScore:this._primaryObjective.rawScore,rawScoreKnown:this._primaryObjective.rawScoreKnown,minScore:this._primaryObjective.minScore,minScoreKnown:this._primaryObjective.minScoreKnown,maxScore:this._primaryObjective.maxScore,maxScoreKnown:this._primaryObjective.maxScoreKnown,progressMeasure:null!==(e=this.progressMeasure)&&void 0!==e?e:0,progressMeasureStatus:this.progressMeasureStatus,progressStatus:this._primaryObjective.progressStatus,completionStatus:this.completionStatus,satisfiedByMeasure:this._primaryObjective.satisfiedByMeasure,minNormalizedMeasure:this._primaryObjective.minNormalizedMeasure}:null,objectives:this._objectives.map(function(e){return{id:e.id,satisfiedStatus:e.satisfiedStatus,measureStatus:e.measureStatus,normalizedMeasure:e.normalizedMeasure,rawScore:e.rawScore,rawScoreKnown:e.rawScoreKnown,minScore:e.minScore,minScoreKnown:e.minScoreKnown,maxScore:e.maxScore,maxScoreKnown:e.maxScoreKnown,progressMeasure:e.progressMeasure,progressMeasureStatus:e.progressMeasureStatus,progressStatus:e.progressStatus,completionStatus:e.completionStatus,satisfiedByMeasure:e.satisfiedByMeasure,minNormalizedMeasure:e.minNormalizedMeasure}})}}},{key:"applyObjectiveStateSnapshot",value:function(e){if(e.primary){var t=this.getObjectiveById(e.primary.id);if(t&&t.isPrimary){var i,n=e.primary;t.objective.satisfiedByMeasure=null!==(i=n.satisfiedByMeasure)&&void 0!==i?i:t.objective.satisfiedByMeasure,t.objective.minNormalizedMeasure=void 0!==n.minNormalizedMeasure?n.minNormalizedMeasure:t.objective.minNormalizedMeasure,this.setPrimaryObjectiveState(n.satisfiedStatus,n.measureStatus,n.normalizedMeasure,n.progressMeasure,n.progressMeasureStatus,n.completionStatus,n.progressStatus),this.applyObjectiveScoreSnapshot(t.objective,n)}}var r=!0,o=!1,a=void 0;try{for(var s,c=e.objectives[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var l=s.value,u=this.getObjectiveById(l.id);if(u&&!u.isPrimary){var d,f=u.objective;f.satisfiedStatus=l.satisfiedStatus,f.measureStatus=l.measureStatus,f.normalizedMeasure=l.normalizedMeasure,f.progressMeasure=l.progressMeasure,f.progressMeasureStatus=l.progressMeasureStatus,f.completionStatus=l.completionStatus,this.applyObjectiveScoreSnapshot(f,l),f.satisfiedByMeasure=null!==(d=l.satisfiedByMeasure)&&void 0!==d?d:f.satisfiedByMeasure,f.minNormalizedMeasure=void 0!==l.minNormalizedMeasure?l.minNormalizedMeasure:f.minNormalizedMeasure}}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}}},{key:"applyObjectiveScoreSnapshot",value:function(e,t){var i={};t.rawScoreKnown&&(i.rawScore=t.rawScore),t.minScoreKnown&&(i.minScore=t.minScore),t.maxScoreKnown&&(i.maxScore=t.maxScore),e.applyReadMappedState(i)}},{key:"getAvailableChildren",value:function(){return 0===this._children.length?[]:null!==this._processedChildren?this._processedChildren:this._children}},{key:"setProcessedChildren",value:function(e){this._processedChildren=e}},{key:"resetProcessedChildren",value:function(){this._processedChildren=null}},{key:"isNewAttempt",get:function(){return this._isNewAttempt},set:function(e){this._isNewAttempt=e}},{key:"launchData",get:function(){return this._launchData},set:function(e){this._launchData=e}},{key:"credit",get:function(){return this._credit},set:function(credit){this._credit=credit}},{key:"maxTimeAllowed",get:function(){return this._maxTimeAllowed},set:function(e){this._maxTimeAllowed=e}},{key:"completionThreshold",get:function(){return this._completionThreshold},set:function(e){this._completionThreshold=e}},{key:"getSuspensionState",value:function(){return{id:this._id,title:this._title,isVisible:this._isVisible,isActive:this._isActive,isSuspended:this._isSuspended,isCompleted:this._isCompleted,completionStatus:this._completionStatus,successStatus:this._successStatus,attemptCount:this._attemptCount,attemptCompletionAmount:this._attemptCompletionAmount,attemptAbsoluteDuration:this._attemptAbsoluteDuration,attemptExperiencedDuration:this._attemptExperiencedDuration,activityAbsoluteDuration:this._activityAbsoluteDuration,activityExperiencedDuration:this._activityExperiencedDuration,attemptAbsoluteDurationValue:this._attemptAbsoluteDurationValue,attemptExperiencedDurationValue:this._attemptExperiencedDurationValue,activityAbsoluteDurationValue:this._activityAbsoluteDurationValue,activityExperiencedDurationValue:this._activityExperiencedDurationValue,activityStartTimestampUtc:this._activityStartTimestampUtc,attemptStartTimestampUtc:this._attemptStartTimestampUtc,objectiveSatisfiedStatus:this._objectiveSatisfiedStatus,objectiveSatisfiedStatusKnown:this._objectiveSatisfiedStatusKnown,objectiveMeasureStatus:this._objectiveMeasureStatus,objectiveNormalizedMeasure:this._objectiveNormalizedMeasure,scaledPassingScore:this._scaledPassingScore,progressMeasure:this._progressMeasure,progressMeasureStatus:this._progressMeasureStatus,location:this._location,attemptAbsoluteStartTime:this._attemptAbsoluteStartTime,activityAttemptActive:this._activityAttemptActive,isHiddenFromChoice:this._isHiddenFromChoice,isAvailable:this._isAvailable,rollupConsiderations:Pn({},this._rollupConsiderations),wasSkipped:this._wasSkipped,attemptProgressStatus:this._attemptProgressStatus,wasAutoCompleted:this._wasAutoCompleted,wasAutoSatisfied:this._wasAutoSatisfied,completedByMeasure:this._completedByMeasure,minProgressMeasure:this._minProgressMeasure,progressWeight:this._progressWeight,attemptCompletionAmountStatus:this._attemptCompletionAmountStatus,processedChildren:this._processedChildren?this._processedChildren.map(function(e){return e.id}):null,isNewAttempt:this._isNewAttempt,selectionCountStatus:this._sequencingControls.selectionCountStatus,reorderChildren:this._sequencingControls.reorderChildren,primaryObjective:this._primaryObjective?{id:this._primaryObjective.id,satisfiedStatus:this._primaryObjective.satisfiedStatus,measureStatus:this._primaryObjective.measureStatus,normalizedMeasure:this._primaryObjective.normalizedMeasure,progressMeasure:this._primaryObjective.progressMeasure,progressMeasureStatus:this._primaryObjective.progressMeasureStatus,completionStatus:this._primaryObjective.completionStatus,satisfiedByMeasure:this._primaryObjective.satisfiedByMeasure,minNormalizedMeasure:this._primaryObjective.minNormalizedMeasure,progressStatus:this._primaryObjective.progressStatus,mapInfo:this._primaryObjective.mapInfo}:null,objectives:this._objectives.map(function(e){return{id:e.id,satisfiedStatus:e.satisfiedStatus,measureStatus:e.measureStatus,normalizedMeasure:e.normalizedMeasure,progressMeasure:e.progressMeasure,progressMeasureStatus:e.progressMeasureStatus,completionStatus:e.completionStatus,satisfiedByMeasure:e.satisfiedByMeasure,minNormalizedMeasure:e.minNormalizedMeasure,progressStatus:e.progressStatus,mapInfo:e.mapInfo}}),children:this._children.map(function(e){return e.getSuspensionState()})}}},{key:"restoreSuspensionState",value:function(e){var t,i,n,r,o,a,s,c,l,u,d,f,v,h,m,p,y,g,_,b,S,w,O,C,E,A,k,j,R,M,T,x,I,P,N,D,q,L,z;if(e){if(this._isVisible=null!==(t=e.isVisible)&&void 0!==t?t:this._isVisible,this._isActive=null!==(i=e.isActive)&&void 0!==i?i:this._isActive,this._isSuspended=null!==(n=e.isSuspended)&&void 0!==n?n:this._isSuspended,this._isCompleted=null!==(r=e.isCompleted)&&void 0!==r?r:this._isCompleted,this._completionStatus=null!==(o=e.completionStatus)&&void 0!==o?o:this._completionStatus,this._successStatus=null!==(a=e.successStatus)&&void 0!==a?a:this._successStatus,this._attemptCount=null!==(s=e.attemptCount)&&void 0!==s?s:this._attemptCount,this._attemptCompletionAmount=null!==(c=e.attemptCompletionAmount)&&void 0!==c?c:this._attemptCompletionAmount,this._attemptAbsoluteDuration=null!==(l=e.attemptAbsoluteDuration)&&void 0!==l?l:this._attemptAbsoluteDuration,this._attemptExperiencedDuration=null!==(u=e.attemptExperiencedDuration)&&void 0!==u?u:this._attemptExperiencedDuration,this._activityAbsoluteDuration=null!==(d=e.activityAbsoluteDuration)&&void 0!==d?d:this._activityAbsoluteDuration,this._activityExperiencedDuration=null!==(f=e.activityExperiencedDuration)&&void 0!==f?f:this._activityExperiencedDuration,this._attemptAbsoluteDurationValue=null!==(v=e.attemptAbsoluteDurationValue)&&void 0!==v?v:this._attemptAbsoluteDurationValue,this._attemptExperiencedDurationValue=null!==(h=e.attemptExperiencedDurationValue)&&void 0!==h?h:this._attemptExperiencedDurationValue,this._activityAbsoluteDurationValue=null!==(m=e.activityAbsoluteDurationValue)&&void 0!==m?m:this._activityAbsoluteDurationValue,this._activityExperiencedDurationValue=null!==(p=e.activityExperiencedDurationValue)&&void 0!==p?p:this._activityExperiencedDurationValue,this._activityStartTimestampUtc=null!==(y=e.activityStartTimestampUtc)&&void 0!==y?y:this._activityStartTimestampUtc,this._attemptStartTimestampUtc=null!==(g=e.attemptStartTimestampUtc)&&void 0!==g?g:this._attemptStartTimestampUtc,this._objectiveSatisfiedStatus=null!==(_=e.objectiveSatisfiedStatus)&&void 0!==_?_:this._objectiveSatisfiedStatus,this._objectiveSatisfiedStatusKnown=null!==(b=e.objectiveSatisfiedStatusKnown)&&void 0!==b?b:this._objectiveSatisfiedStatusKnown,this._objectiveMeasureStatus=null!==(S=e.objectiveMeasureStatus)&&void 0!==S?S:this._objectiveMeasureStatus,this._objectiveNormalizedMeasure=null!==(w=e.objectiveNormalizedMeasure)&&void 0!==w?w:this._objectiveNormalizedMeasure,this._scaledPassingScore=null!==(O=e.scaledPassingScore)&&void 0!==O?O:this._scaledPassingScore,this._progressMeasure=null!==(C=e.progressMeasure)&&void 0!==C?C:this._progressMeasure,this._progressMeasureStatus=null!==(E=e.progressMeasureStatus)&&void 0!==E?E:this._progressMeasureStatus,this._location=null!==(A=e.location)&&void 0!==A?A:this._location,this._attemptAbsoluteStartTime=null!==(k=e.attemptAbsoluteStartTime)&&void 0!==k?k:this._attemptAbsoluteStartTime,this._activityAttemptActive=null!==(j=e.activityAttemptActive)&&void 0!==j?j:this._activityAttemptActive,this._isHiddenFromChoice=null!==(R=e.isHiddenFromChoice)&&void 0!==R?R:this._isHiddenFromChoice,this._isAvailable=null!==(M=e.isAvailable)&&void 0!==M?M:this._isAvailable,e.rollupConsiderations&&(this._rollupConsiderations=Pn({},e.rollupConsiderations)),this._wasSkipped=null!==(T=e.wasSkipped)&&void 0!==T?T:this._wasSkipped,this._attemptProgressStatus=null!==(x=e.attemptProgressStatus)&&void 0!==x?x:this._attemptProgressStatus,this._wasAutoCompleted=null!==(I=e.wasAutoCompleted)&&void 0!==I?I:this._wasAutoCompleted,this._wasAutoSatisfied=null!==(P=e.wasAutoSatisfied)&&void 0!==P?P:this._wasAutoSatisfied,this._completedByMeasure=null!==(N=e.completedByMeasure)&&void 0!==N?N:this._completedByMeasure,this._minProgressMeasure=null!==(D=e.minProgressMeasure)&&void 0!==D?D:this._minProgressMeasure,this._progressWeight=null!==(q=e.progressWeight)&&void 0!==q?q:this._progressWeight,this._attemptCompletionAmountStatus=null!==(L=e.attemptCompletionAmountStatus)&&void 0!==L?L:this._attemptCompletionAmountStatus,this._isNewAttempt=null!==(z=e.isNewAttempt)&&void 0!==z?z:this._isNewAttempt,void 0!==e.selectionCountStatus&&(this._sequencingControls.selectionCountStatus=e.selectionCountStatus),void 0!==e.reorderChildren&&(this._sequencingControls.reorderChildren=e.reorderChildren),e.processedChildren){var F=new Map(this._children.map(function(e){return[e.id,e]}));this._processedChildren=e.processedChildren.map(function(id){return F.get(id)}).filter(function(e){return void 0!==e})}else this._processedChildren=null;var B,V,H,U,G,K,Y;if(e.primaryObjective&&this._primaryObjective&&(this._primaryObjective.satisfiedStatus=null!==(B=e.primaryObjective.satisfiedStatus)&&void 0!==B?B:this._primaryObjective.satisfiedStatus,this._primaryObjective.measureStatus=null!==(V=e.primaryObjective.measureStatus)&&void 0!==V?V:this._primaryObjective.measureStatus,this._primaryObjective.normalizedMeasure=null!==(H=e.primaryObjective.normalizedMeasure)&&void 0!==H?H:this._primaryObjective.normalizedMeasure,this._primaryObjective.progressMeasure=null!==(U=e.primaryObjective.progressMeasure)&&void 0!==U?U:this._primaryObjective.progressMeasure,this._primaryObjective.progressMeasureStatus=null!==(G=e.primaryObjective.progressMeasureStatus)&&void 0!==G?G:this._primaryObjective.progressMeasureStatus,this._primaryObjective.completionStatus=null!==(K=e.primaryObjective.completionStatus)&&void 0!==K?K:this._primaryObjective.completionStatus,this._primaryObjective.progressStatus=null!==(Y=e.primaryObjective.progressStatus)&&void 0!==Y?Y:this._primaryObjective.progressStatus),e.objectives){var W=!0,J=!1,$=void 0;try{for(var X,Q,Z=function(){var e,t,i,n,r,o,a,s=Q.value,c=X._objectives.find(function(e){return e.id===s.id});c&&(c.satisfiedStatus=null!==(e=s.satisfiedStatus)&&void 0!==e?e:c.satisfiedStatus,c.measureStatus=null!==(t=s.measureStatus)&&void 0!==t?t:c.measureStatus,c.normalizedMeasure=null!==(i=s.normalizedMeasure)&&void 0!==i?i:c.normalizedMeasure,c.progressMeasure=null!==(n=s.progressMeasure)&&void 0!==n?n:c.progressMeasure,c.progressMeasureStatus=null!==(r=s.progressMeasureStatus)&&void 0!==r?r:c.progressMeasureStatus,c.completionStatus=null!==(o=s.completionStatus)&&void 0!==o?o:c.completionStatus,c.progressStatus=null!==(a=s.progressStatus)&&void 0!==a?a:c.progressStatus)},ee=e.objectives[Symbol.iterator]();!(W=(Q=ee.next()).done);W=!0)X=this,Z()}catch(e){J=!0,$=e}finally{try{W||null==ee.return||ee.return()}finally{if(J)throw $}}}if(e.children&&Array.isArray(e.children))for(var te,ie=function(t){var i=e.children[t],n=te._children.find(function(e){return e.id===i.id});n&&n.restoreSuspensionState(i)},ne=0;e.children.length>ne&&this._children.length>ne;ne++)te=this,ie(ne)}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this._id,title:this._title,isVisible:this._isVisible,isActive:this._isActive,isSuspended:this._isSuspended,isCompleted:this._isCompleted,completionStatus:this._completionStatus,successStatus:this._successStatus,attemptCount:this._attemptCount,attemptCompletionAmount:this._attemptCompletionAmount,attemptAbsoluteDuration:this._attemptAbsoluteDuration,attemptExperiencedDuration:this._attemptExperiencedDuration,activityAbsoluteDuration:this._activityAbsoluteDuration,activityExperiencedDuration:this._activityExperiencedDuration,objectiveSatisfiedStatus:this._objectiveSatisfiedStatus,objectiveSatisfiedStatusKnown:this._objectiveSatisfiedStatusKnown,objectiveMeasureStatus:this._objectiveMeasureStatus,objectiveNormalizedMeasure:this._objectiveNormalizedMeasure,rollupConsiderations:Pn({},this._rollupConsiderations),wasSkipped:this._wasSkipped,completedByMeasure:this._completedByMeasure,minProgressMeasure:this._minProgressMeasure,progressWeight:this._progressWeight,attemptCompletionAmountStatus:this._attemptCompletionAmountStatus,hideLmsUi:Dn(this._hideLmsUi),auxiliaryResources:this._auxiliaryResources.map(function(e){return Pn({},e)}),children:this._children.map(function(e){return e.toJSON()})};return this.jsonString=!1,result}},{key:"auxiliaryResources",get:function(){return this._auxiliaryResources.map(function(e){return Pn({},e)})},set:function(e){var t=[],i=new Set,n=!0,r=!1,o=void 0;try{for(var a,s=(e||[])[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;if(c){var l="string"==typeof c.resourceId?c.resourceId.trim():"",u="string"==typeof c.purpose?c.purpose.trim():"";l&&!i.has(l)&&(i.add(l),t.push({resourceId:l,purpose:u}))}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}this._auxiliaryResources=t}},{key:"addAuxiliaryResource",value:function(e){this.auxiliaryResources=Dn(this._auxiliaryResources).concat([e])}},{key:"captureRollupStatus",value:function(){return{measureStatus:this._objectiveMeasureStatus,normalizedMeasure:this._objectiveNormalizedMeasure,objectiveProgressStatus:null!=this._objectiveSatisfiedStatus,objectiveSatisfiedStatus:this._objectiveSatisfiedStatus,attemptProgressStatus:this._completionStatus!==Ce,attemptCompletionStatus:this._completionStatus===we}}},{key:"hideLmsUi",get:function(){return Dn(this._hideLmsUi)},set:function(e){var t=new Set(ct),i=new Set,n=[],r=!0,o=!1,a=void 0;try{for(var s,c=e[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var l=s.value;t.has(l)&&!i.has(l)&&(i.add(l),n.push(l))}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}this._hideLmsUi=n}}],[{key:"compareRollupStatus",value:function(e,t){return e.measureStatus===t.measureStatus&&1e-4>Math.abs(e.normalizedMeasure-t.normalizedMeasure)&&e.objectiveProgressStatus===t.objectiveProgressStatus&&e.objectiveSatisfiedStatus===t.objectiveSatisfiedStatus&&e.attemptProgressStatus===t.attemptProgressStatus&&e.attemptCompletionStatus===t.attemptCompletionStatus}}]),t}(O);var Hn=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,(i=[{key:"checkChildForRollupSubprocess",value:function(e,t,i){if(!1===e.sequencingControls.tracked)return!1;var n=!1;if("measure"===t||"objective"===t){if(!e.sequencingControls.rollupObjectiveSatisfied)return!1;n=!0;var r=e.requiredForSatisfied,o=e.requiredForNotSatisfied;"satisfied"===i&&"ifNotSuspended"===r||"notSatisfied"===i&&"ifNotSuspended"===o?(!e.attemptProgressStatus||e.attemptCount>0&&e.isSuspended)&&(n=!1):"satisfied"===i&&"ifAttempted"===r||"notSatisfied"===i&&"ifAttempted"===o?e.attemptProgressStatus&&0!==e.attemptCount||(n=!1):("satisfied"===i&&"ifNotSkipped"===r||"notSatisfied"===i&&"ifNotSkipped"===o)&&e.wasSkipped&&(n=!1)}if("progress"===t){if(!e.sequencingControls.rollupProgressCompletion)return!1;n=!0;var a=e.requiredForCompleted,s=e.requiredForIncomplete;"completed"===i&&"ifNotSuspended"===a||"incomplete"===i&&"ifNotSuspended"===s?(!e.attemptProgressStatus||e.attemptCount>0&&e.isSuspended)&&(n=!1):"completed"===i&&"ifAttempted"===a||"incomplete"===i&&"ifAttempted"===s?e.attemptProgressStatus&&0!==e.attemptCount||(n=!1):("completed"===i&&"ifNotSkipped"===a||"incomplete"===i&&"ifNotSkipped"===s)&&e.wasSkipped&&(n=!1)}return!(n&&!e.isAvailable)&&n}},{key:"filterChildrenForRequirement",value:function(e,t,mode,i){var n=this;return e.filter(function(e){return n.shouldIncludeChildForRollup(e,t,mode,i)})}},{key:"shouldIncludeChildForRollup",value:function(e,t,mode,i){return!(!this.checkChildForRollupSubprocess(e,t,mode)||"objective"===t&&!i.measureSatisfactionIfActive&&(e.activityAttemptActive||e.isActive))}},{key:"isChildSatisfiedForRollup",value:function(e){return!0===e.objectiveSatisfiedStatus||!1!==e.objectiveSatisfiedStatus&&e.successStatus===_e}},{key:"isChildCompletedForRollup",value:function(e){return!("completed"!==e.completionStatus&&!e.isCompleted)}},{key:"getTrackableChildren",value:function(e){return e.children.filter(function(e){return!1!==e.sequencingControls.tracked})}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Un=Object.defineProperty,Gn=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?Un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="childFilter")?i+"":i,n),this.childFilter=t}return t=e,(i=[{key:"evaluateRollupRule",value:function(e,t){var i=e.getAvailableChildren(),n=0,r=0,o=!0,a=!1,s=void 0;try{for(var c,l=i[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value,d=!1;switch(t.action){case wn.SATISFIED:d=this.childFilter.checkChildForRollupSubprocess(u,"objective","satisfied");break;case wn.NOT_SATISFIED:d=this.childFilter.checkChildForRollupSubprocess(u,"objective","notSatisfied");break;case wn.COMPLETED:d=this.childFilter.checkChildForRollupSubprocess(u,"progress","completed");break;case wn.INCOMPLETE:d=this.childFilter.checkChildForRollupSubprocess(u,"progress","incomplete")}d&&(n++,this.evaluateRollupConditionsSubprocess(u,t)&&r++)}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}return t.consideration===On.ALL?n>0&&r===n:null!==t.minimumCount?r>=t.minimumCount:null!==t.minimumPercent?(n>0?r/n:0)>=t.minimumPercent:n>0&&r===n}},{key:"evaluateRollupConditionsSubprocess",value:function(e,t){if(0===t.conditions.length)return!0;switch(t.consideration){case On.ALL:return t.conditions.every(function(t){return t.evaluate(e)});case On.ANY:return t.conditions.some(function(t){return t.evaluate(e)});case On.NONE:return!t.conditions.some(function(t){return t.evaluate(e)});case On.AT_LEAST_COUNT:case On.AT_LEAST_PERCENT:return t.conditions.every(function(t){return t.evaluate(e)});default:return!1}}},{key:"evaluateRulesForAction",value:function(e,t,i){var n=t.filter(function(e){return e.action===i});if(0===n.length)return null;var r=!0,o=!1,a=void 0;try{for(var s,c=n[Symbol.iterator]();!(r=(s=c.next()).done);r=!0)if(this.evaluateRollupRule(e,s.value))return!0}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Kn=Object.defineProperty,Yn=function(e,t,i){return function(e,t,i){return t in e?Kn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Wn=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Yn(this,"childFilter"),Yn(this,"eventCallback"),this.childFilter=t,this.eventCallback=i||null}return t=e,i=[{key:"measureRollupProcess",value:function(e){var t=this;if(!e.sequencingControls.rollupObjectiveSatisfied)return[];var i=e.getAvailableChildren();if(0===i.length)return[];var n=e.rollupConsiderations,r=i.filter(function(e){return!(!t.childFilter.checkChildForRollupSubprocess(e,"measure")||!e.objectiveMeasureStatus||null===e.objectiveNormalizedMeasure||!n.measureSatisfactionIfActive&&(e.activityAttemptActive||e.isActive))});if(0===r.length)return e.objectiveMeasureStatus=!1,[];var o=this.calculateComplexWeightedMeasure(e,r,{enableThresholdBias:!1});return e.objectiveNormalizedMeasure=o,e.objectiveMeasureStatus=!0,this.identifyActivityClusters(r)}},{key:"completionMeasureRollupProcess",value:function(e){var t=e.getAvailableChildren();if(0!==t.length){var i=t.filter(function(e){return e.attemptCompletionAmountStatus});if(0!==i.length){var n=0,r=0,o=!0,a=!1,s=void 0;try{for(var c,l=i[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value;n+=u.attemptCompletionAmount*u.progressWeight,r+=u.progressWeight}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}r>0&&(e.attemptCompletionAmount=n/r,e.attemptCompletionAmountStatus=!0)}else e.attemptCompletionAmountStatus=!1}}},{key:"calculateComplexWeightedMeasure",value:function(e,t,i){var n,r,o=0,a=0,s=[],c=null===(n=null==i?void 0:i.enableThresholdBias)||void 0===n||n,l=!0,u=!1,d=void 0;try{for(var f,v=t[Symbol.iterator]();!(l=(f=v.next()).done);l=!0){var h=f.value;if(this.childFilter.checkChildForRollupSubprocess(h,"measure")&&h.objectiveMeasureStatus&&null!==h.objectiveNormalizedMeasure){var m=this.calculateAdjustedWeight(h,h.sequencingControls.objectiveMeasureWeight,c);o+=h.objectiveNormalizedMeasure*m,a+=m,s.push({childId:h.id,measure:h.objectiveNormalizedMeasure,weight:m})}}}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}return null===(r=this.eventCallback)||void 0===r||r.call(this,"complex_weighting_calculated",{activityId:e.id,weightingDetails:s,totalWeight:a,totalWeightedMeasure:o,result:a>0?o/a:0}),a>0?o/a:0}},{key:"calculateAdjustedWeight",value:function(e,t){var i,n=2>=arguments.length||void 0===arguments[2]||arguments[2],r=t;return"completed"!==e.completionStatus&&(r*=.8),e.attemptCount>1&&(r*=Math.max(.5,1-.1*(e.attemptCount-1))),e.hasAttemptLimitExceeded()&&(r*=.6),n&&e.objectiveMeasureStatus&&(r*=(null!==(i=e.scaledPassingScore)&&void 0!==i?i:.7)>e.objectiveNormalizedMeasure?.95:1.05),Math.max(0,r)}},{key:"identifyActivityClusters",value:function(e){var t=[],i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.children.length>0&&s.sequencingControls.flow&&t.push(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Jn=Object.defineProperty,$n=function(e,t,i){return function(e,t,i){return t in e?Jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Xn=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),$n(this,"childFilter"),$n(this,"ruleEvaluator"),$n(this,"eventCallback"),this.childFilter=t,this.ruleEvaluator=i,this.eventCallback=n||null}return t=e,(i=[{key:"objectiveRollupProcess",value:function(e){var t=this.objectiveRollupUsingRules(e,e.rollupRules.rules);if(null!==t)return e.objectiveSatisfiedStatus=t,void this.syncPrimaryObjectiveFromActivity(e);var i=this.objectiveRollupUsingMeasure(e);if(null!==i)return e.objectiveSatisfiedStatus=i,void this.syncPrimaryObjectiveFromActivity(e);e.objectiveSatisfiedStatus=this.objectiveRollupUsingDefault(e),this.syncPrimaryObjectiveFromActivity(e)}},{key:"objectiveRollupUsingRules",value:function(e,t){var i=t.filter(function(e){return e.action===wn.SATISFIED}),n=t.filter(function(e){return e.action===wn.NOT_SATISFIED}),r=!0,o=!1,a=void 0;try{for(var s,c=i[Symbol.iterator]();!(r=(s=c.next()).done);r=!0)if(this.ruleEvaluator.evaluateRollupRule(e,s.value))return!0}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}var l=!0,u=!1,d=void 0;try{for(var f,v=n[Symbol.iterator]();!(l=(f=v.next()).done);l=!0)if(this.ruleEvaluator.evaluateRollupRule(e,f.value))return!1}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}return null}},{key:"objectiveRollupUsingMeasure",value:function(e){return e.objectiveMeasureStatus&&null!==e.scaledPassingScore?e.objectiveNormalizedMeasure>=e.scaledPassingScore:null}},{key:"objectiveRollupUsingDefault",value:function(e){var t=this,i=e.getAvailableChildren();if(0===i.length)return!1;var n=e.rollupConsiderations,r=i.filter(function(e){return!(!t.childFilter.checkChildForRollupSubprocess(e,"objective","satisfied")||!t.childFilter.checkChildForRollupSubprocess(e,"objective","notSatisfied")||!n.measureSatisfactionIfActive&&(e.activityAttemptActive||e.isActive))});return 0!==r.length&&!r.some(function(e){return!t.childFilter.isChildSatisfiedForRollup(e)})&&r.every(function(e){return t.childFilter.isChildSatisfiedForRollup(e)})}},{key:"syncPrimaryObjectiveFromActivity",value:function(e){e.primaryObjective&&(e.primaryObjective.satisfiedStatus=e.objectiveSatisfiedStatus,e.primaryObjective.satisfiedStatusKnown=e.objectiveSatisfiedStatusKnown,e.primaryObjective.measureStatus=e.objectiveMeasureStatus,e.primaryObjective.normalizedMeasure=e.objectiveNormalizedMeasure,e.primaryObjective.progressMeasure=e.progressMeasure,e.primaryObjective.progressMeasureStatus=e.progressMeasureStatus,e.primaryObjective.completionStatus=e.completionStatus)}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Qn=Object.defineProperty,Zn=function(e,t,i){return function(e,t,i){return t in e?Qn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},er=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Zn(this,"childFilter"),Zn(this,"ruleEvaluator"),Zn(this,"objectiveProcessor"),Zn(this,"eventCallback"),this.childFilter=t,this.ruleEvaluator=i,this.objectiveProcessor=n,this.eventCallback=r||null}return t=e,(i=[{key:"activityProgressRollupProcess",value:function(e){var t=this;if(!this.activityProgressRollupUsingMeasure(e)){var i=e.rollupRules,n=i.rules.filter(function(e){return e.action===wn.COMPLETED}),r=i.rules.filter(function(e){return e.action===wn.INCOMPLETE}),o=!0,a=!1,s=void 0;try{for(var c,l=n[Symbol.iterator]();!(o=(c=l.next()).done);o=!0)if(this.ruleEvaluator.evaluateRollupRule(e,c.value))return e.completionStatus=we,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e)}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}var u=!0,d=!1,f=void 0;try{for(var v,h=r[Symbol.iterator]();!(u=(v=h.next()).done);u=!0)if(this.ruleEvaluator.evaluateRollupRule(e,v.value))return e.completionStatus=Oe,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e)}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}var m=e.getAvailableChildren().filter(function(e){return t.childFilter.checkChildForRollupSubprocess(e,"progress","completed")&&t.childFilter.checkChildForRollupSubprocess(e,"progress","incomplete")});if(0===m.length)return e.completionStatus=Oe,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e);if(m.some(function(e){return!t.childFilter.isChildCompletedForRollup(e)}))return e.completionStatus=Oe,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e);e.completionStatus=we,this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e)}}},{key:"activityProgressRollupUsingMeasure",value:function(e){return!!e.completedByMeasure&&(e.attemptCompletionAmountStatus?(e.completionStatus=e.minProgressMeasure>e.attemptCompletionAmount?Oe:we,this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e),!0):(e.completionStatus=Ce,this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e),!0))}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var tr=Object.defineProperty,ir=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="eventCallback")?i+"":i,n),this.eventCallback=t||null}return t=e,(i=[{key:"durationRollupProcess",value:function(e){if(0!==e.children.length){var t=e.getAvailableChildren();if(0!==t.length){var i=null,n=null,r=null,o=null,s=0,l=0,u=!0,d=!1,f=void 0;try{for(var v,h=t[Symbol.iterator]();!(u=(v=h.next()).done);u=!0){var m=v.value;m.activityStartTimestampUtc&&(i&&m.activityStartTimestampUtc>=i||(i=m.activityStartTimestampUtc)),m.activityEndedDate&&(r&&r>=m.activityEndedDate||(r=m.activityEndedDate));var p="PT0H0M0S"!==m.activityExperiencedDurationValue?m.activityExperiencedDurationValue:m.activityExperiencedDuration;if(p&&"PT0H0M0S"!==p&&(s+=c(p,He)),!e.attemptStartTimestampUtc||m.attemptStartTimestampUtc&&m.attemptStartTimestampUtc>=e.attemptStartTimestampUtc){m.attemptStartTimestampUtc&&(n&&m.attemptStartTimestampUtc>=n||(n=m.attemptStartTimestampUtc)),m.activityEndedDate&&(o&&o>=m.activityEndedDate||(o=m.activityEndedDate));var y="PT0H0M0S"!==m.attemptExperiencedDurationValue?m.attemptExperiencedDurationValue:m.attemptExperiencedDuration;y&&"PT0H0M0S"!==y&&(l+=c(y,He))}}}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}if(null!==i){var g;if(e.activityStartTimestampUtc=i,!e.attemptStartTimestampUtc&&n&&(e.attemptStartTimestampUtc=n),e.activityEndedDate=r,r&&e.activityStartTimestampUtc){var _=new Date(e.activityStartTimestampUtc),b=r.getTime()-_.getTime();e.activityAbsoluteDurationValue=a(Math.max(0,b/1e3))}if(o&&e.attemptStartTimestampUtc){var S=new Date(e.attemptStartTimestampUtc),w=o.getTime()-S.getTime();e.attemptAbsoluteDurationValue=a(Math.max(0,w/1e3))}e.activityExperiencedDurationValue=a(s),e.attemptExperiencedDurationValue=a(l),null===(g=this.eventCallback)||void 0===g||g.call(this,"duration_rollup_completed",{activityId:e.id,activityAbsoluteDuration:e.activityAbsoluteDurationValue,attemptAbsoluteDuration:e.attemptAbsoluteDurationValue,activityExperiencedDuration:e.activityExperiencedDurationValue,attemptExperiencedDuration:e.attemptExperiencedDurationValue,childCount:t.length})}}}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var nr=Object.defineProperty,rr=function(e,t,i){return function(e,t,i){return t in e?nr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},or=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),rr(this,"measureProcessor"),rr(this,"objectiveProcessor"),rr(this,"progressProcessor"),rr(this,"eventCallback"),rr(this,"processingClusters",new Set),this.measureProcessor=t,this.objectiveProcessor=i,this.progressProcessor=n,this.eventCallback=r||null}return t=e,i=[{key:"processCrossClusterDependencies",value:function(e,t){var i,n,r,o,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(10>a)if(this.processingClusters.has(e.id))null===(i=this.eventCallback)||void 0===i||i.call(this,"cross_cluster_skip_reentrant",{activityId:e.id});else try{var s,c;this.processingClusters.add(e.id),null===(s=this.eventCallback)||void 0===s||s.call(this,"cross_cluster_processing_started",{activityId:e.id,clusterCount:t.length,depth:a});var l=new Map,u=!0,d=!1,f=void 0;try{for(var v,h=t[Symbol.iterator]();!(u=(v=h.next()).done);u=!0)this.analyzeCrossClusterDependencies(v.value,l)}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}var m=this.resolveDependencyOrder(l),p=!0,y=!1,g=void 0;try{for(var _,b,S=function(){var e=b.value,i=t.find(function(t){return t.id===e});i&&_.processClusterRollup(i,a)},w=m[Symbol.iterator]();!(p=(b=w.next()).done);p=!0)_=this,S()}catch(e){y=!0,g=e}finally{try{p||null==w.return||w.return()}finally{if(y)throw g}}null===(c=this.eventCallback)||void 0===c||c.call(this,"cross_cluster_processing_completed",{activityId:e.id,processedClusters:m.length,dependencyMap:Array.from(l.entries())})}catch(t){var O;null===(O=this.eventCallback)||void 0===O||O.call(this,"cross_cluster_processing_error",{activityId:e.id,error:(n=t,r=Error,(null!=r&&"undefined"!=typeof Symbol&&r[Symbol.hasInstance]?r[Symbol.hasInstance](n):n instanceof r)?t.message:t+"")})}finally{this.processingClusters.delete(e.id)}else null===(o=this.eventCallback)||void 0===o||o.call(this,"cross_cluster_max_depth_reached",{activityId:e.id,depth:a,maxDepth:10})}},{key:"identifyActivityClusters",value:function(e){var t=[],i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.children.length>0&&s.sequencingControls.flow&&t.push(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"analyzeCrossClusterDependencies",value:function(e,t){t.set(e.id,[])}},{key:"resolveDependencyOrder",value:function(e){var t=this,i=[],n=new Set,r=function(id){if(!i.includes(id))if(n.has(id)){var o,a;null===(o=(a=t).eventCallback)||void 0===o||o.call(a,"circular_dependency_detected",{activityId:id})}else{n.add(id);var s=e.get(id)||[],c=!0,l=!1,u=void 0;try{for(var d,f=s[Symbol.iterator]();!(c=(d=f.next()).done);c=!0)r(d.value)}catch(e){l=!0,u=e}finally{try{c||null==f.return||f.return()}finally{if(l)throw u}}n.delete(id),i.push(id)}},o=!0,a=!1,s=void 0;try{for(var c,l=Array.from(e.keys())[Symbol.iterator]();!(o=(c=l.next()).done);o=!0)r(c.value)}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}return i}},{key:"processClusterRollup",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.measureProcessor.measureRollupProcess(e);e.sequencingControls.rollupObjectiveSatisfied&&this.objectiveProcessor.objectiveRollupProcess(e),e.sequencingControls.rollupProgressCompletion&&this.progressProcessor.activityProgressRollupProcess(e),i.length>1&&this.processCrossClusterDependencies(e,i,t+1)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function ar(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function sr(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var cr=Object.defineProperty,lr=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?cr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="eventCallback")?i+"":i,n),this.eventCallback=t||null}var t,i,n;return t=e,n=[{key:"getGlobalObjectiveReadState",value:function(e,t,i,n){var r={};if(i.readSatisfiedStatus&&n.satisfiedStatusKnown&&(r.satisfiedStatus=n.satisfiedStatus),i.readNormalizedMeasure&&n.normalizedMeasureKnown&&(r.normalizedMeasure=n.normalizedMeasure,t.satisfiedByMeasure)){var o,a,s=null!==(o=null!==(a=t.minNormalizedMeasure)&&void 0!==a?a:e.scaledPassingScore)&&void 0!==o?o:.7;r.satisfiedStatus=n.normalizedMeasure>=s}return i.readCompletionStatus&&n.completionStatusKnown&&(r.completionStatus=n.completionStatus),i.readProgressMeasure&&n.progressMeasureKnown&&(r.progressMeasure=n.progressMeasure),i.readRawScore&&n.rawScoreKnown&&(r.rawScore=n.rawScore),i.readMinScore&&n.minScoreKnown&&(r.minScore=n.minScore),i.readMaxScore&&n.maxScoreKnown&&(r.maxScore=n.maxScore),r}}],(i=[{key:"processGlobalObjectiveMapping",value:function(e,t){try{var i,n;null===(i=this.eventCallback)||void 0===i||i.call(this,"global_objective_processing_started",{activityId:e.id,globalObjectiveCount:t.size});var r=[];this.collectActivitiesRecursive(e,r);var o=!0,a=!1,s=void 0;try{for(var c,l=r[Symbol.iterator]();!(o=(c=l.next()).done);o=!0)this.syncGlobalObjectivesWritePhase(c.value,t)}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}var u=!0,d=!1,f=void 0;try{for(var v,h=r[Symbol.iterator]();!(u=(v=h.next()).done);u=!0)this.syncGlobalObjectivesReadPhase(v.value,t)}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}null===(n=this.eventCallback)||void 0===n||n.call(this,"global_objective_processing_completed",{activityId:e.id,processedObjectives:t.size})}catch(t){var m;null===(m=this.eventCallback)||void 0===m||m.call(this,"global_objective_processing_error",{activityId:e.id,error:sr(t,Error)?t.message:t+""})}}},{key:"collectActivitiesRecursive",value:function(e,result){result.push(e);var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.collectActivitiesRecursive(r.value,result)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"syncGlobalObjectivesWritePhase",value:function(e,t){if(this.canWriteGlobalObjectives(e)){var objectives=e.getAllObjectives(),i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,c=s.mapInfo.length>0?s.mapInfo:[this.createDefaultMapInfo(s)],l=new Set,u=!0,d=!1,f=void 0;try{for(var v,h=c[Symbol.iterator]();!(u=(v=h.next()).done);u=!0){var m=v.value,p=this.ensureGlobalObjectiveEntry(t,m.targetObjectiveID||s.id,s);if(m.writeSatisfiedStatus&&this.hasKnownSatisfiedStatus(s)&&s.isDirty("satisfiedStatus")&&(p.satisfiedStatus=s.satisfiedStatus,p.satisfiedStatusKnown=!0,l.add("satisfiedStatus")),m.writeNormalizedMeasure&&s.measureStatus&&s.isDirty("normalizedMeasure")&&(p.normalizedMeasure=s.normalizedMeasure,p.normalizedMeasureKnown=!0,l.add("normalizedMeasure"),m.writeSatisfiedStatus&&s.satisfiedByMeasure)){var y,g,_=null!==(y=null!==(g=s.minNormalizedMeasure)&&void 0!==g?g:e.scaledPassingScore)&&void 0!==y?y:.7;p.satisfiedStatus=s.normalizedMeasure>=_,p.satisfiedStatusKnown=!0,l.add("satisfiedStatus")}m.writeCompletionStatus&&s.completionStatus!==Ce&&s.isDirty("completionStatus")&&(p.completionStatus=s.completionStatus,p.completionStatusKnown=!0,l.add("completionStatus")),m.writeRawScore&&s.rawScoreKnown&&s.isDirty("rawScore")&&(p.rawScore=s.rawScore,p.rawScoreKnown=!0,l.add("rawScore")),m.writeMinScore&&s.minScoreKnown&&s.isDirty("minScore")&&(p.minScore=s.minScore,p.minScoreKnown=!0,l.add("minScore")),m.writeMaxScore&&s.maxScoreKnown&&s.isDirty("maxScore")&&(p.maxScore=s.maxScore,p.maxScoreKnown=!0,l.add("maxScore")),m.writeProgressMeasure&&s.progressMeasureStatus&&s.isDirty("progressMeasure")&&(p.progressMeasure=s.progressMeasure,p.progressMeasureKnown=!0,l.add("progressMeasure")),m.updateAttemptData&&this.updateActivityAttemptData(e,p,s)}}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}var b=!0,S=!1,w=void 0;try{for(var O,C=l[Symbol.iterator]();!(b=(O=C.next()).done);b=!0)s.clearDirty(O.value)}catch(e){S=!0,w=e}finally{try{b||null==C.return||C.return()}finally{if(S)throw w}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}},{key:"syncGlobalObjectivesReadPhase",value:function(t,i){var objectives=t.getAllObjectives(),n=!0,r=!1,o=void 0;try{for(var a,s=objectives[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value,l=c.mapInfo.length>0?c.mapInfo:[this.createDefaultMapInfo(c)],u=!0,d=!1,f=void 0;try{for(var v,h=l[Symbol.iterator]();!(u=(v=h.next()).done);u=!0){var m,p=v.value,y=i.get(p.targetObjectiveID||c.id);if(y){var g=c.isPrimary,_=e.getGlobalObjectiveReadState(t,c,p,y);this.applyGlobalObjectiveReadState(c,_),g&&c.applyToActivity(t),null===(m=this.eventCallback)||void 0===m||m.call(this,"objective_synchronized",{activityId:t.id,objectiveId:c.id,globalState:y,synchronizationTime:(new Date).toISOString()})}}}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}},{key:"synchronizeGlobalObjectives",value:function(e,t){var objectives=e.getAllObjectives(),i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,c=s.mapInfo.length>0?s.mapInfo:[this.createDefaultMapInfo(s)],l=!0,u=!1,d=void 0;try{for(var f,v=c[Symbol.iterator]();!(l=(f=v.next()).done);l=!0){var h=f.value,m=this.ensureGlobalObjectiveEntry(t,h.targetObjectiveID||s.id,s);this.syncObjectiveState(e,s,h,m)}}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}},{key:"syncObjectiveState",value:function(t,i,n,r){try{var o,a=this.getLocalObjectiveState(t,i,i.isPrimary),s=e.getGlobalObjectiveReadState(t,i,n,r);if(this.applyGlobalObjectiveReadState(i,s),i.isPrimary&&i.applyToActivity(t),this.canWriteGlobalObjectives(t)){if(n.writeSatisfiedStatus&&this.hasKnownSatisfiedStatus(i)&&(r.satisfiedStatus=i.satisfiedStatus,r.satisfiedStatusKnown=!0),n.writeNormalizedMeasure&&i.measureStatus&&(r.normalizedMeasure=i.normalizedMeasure,r.normalizedMeasureKnown=!0,n.writeSatisfiedStatus&&i.satisfiedByMeasure)){var c,l,u=null!==(c=null!==(l=i.minNormalizedMeasure)&&void 0!==l?l:t.scaledPassingScore)&&void 0!==c?c:.7;r.satisfiedStatus=i.normalizedMeasure>=u,r.satisfiedStatusKnown=!0}n.writeCompletionStatus&&i.completionStatus!==Ce&&(r.completionStatus=i.completionStatus,r.completionStatusKnown=!0),n.writeRawScore&&i.rawScoreKnown&&(r.rawScore=i.rawScore,r.rawScoreKnown=!0),n.writeMinScore&&i.minScoreKnown&&(r.minScore=i.minScore,r.minScoreKnown=!0),n.writeMaxScore&&i.maxScoreKnown&&(r.maxScore=i.maxScore,r.maxScoreKnown=!0),n.writeProgressMeasure&&i.progressMeasureStatus&&(r.progressMeasure=i.progressMeasure,r.progressMeasureKnown=!0),n.updateAttemptData&&this.updateActivityAttemptData(t,r,i)}null===(o=this.eventCallback)||void 0===o||o.call(this,"objective_synchronized",{activityId:t.id,objectiveId:i.id,localState:a,globalState:r,synchronizationTime:(new Date).toISOString()})}catch(e){var d;null===(d=this.eventCallback)||void 0===d||d.call(this,"objective_sync_error",{activityId:t.id,objectiveId:i.id,error:sr(e,Error)?e.message:e+"",timestamp:(new Date).toISOString()})}}},{key:"applyGlobalObjectiveReadState",value:function(e,t){e.applyReadMappedState(t)}},{key:"ensureGlobalObjectiveEntry",value:function(e,t,i){return e.has(t)||e.set(t,{id:t,satisfiedStatus:!1,satisfiedStatusKnown:!1,normalizedMeasure:0,normalizedMeasureKnown:!1,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasure:0,progressMeasureKnown:!1,completionStatus:Ce,completionStatusKnown:!1,satisfiedByMeasure:i.satisfiedByMeasure,minNormalizedMeasure:i.minNormalizedMeasure}),e.get(t)}},{key:"createDefaultMapInfo",value:function(e){return{targetObjectiveID:e.id,readSatisfiedStatus:!1,writeSatisfiedStatus:!0,readNormalizedMeasure:!1,writeNormalizedMeasure:!0,readCompletionStatus:!1,writeCompletionStatus:!0,readProgressMeasure:!1,writeProgressMeasure:!0,readRawScore:!1,writeRawScore:!1,readMinScore:!1,writeMinScore:!1,readMaxScore:!1,writeMaxScore:!1,updateAttemptData:e.isPrimary}}},{key:"hasKnownSatisfiedStatus",value:function(e){return e.progressStatus||e.satisfiedStatusKnown}},{key:"canWriteGlobalObjectives",value:function(e){return!1!==e.sequencingControls.tracked}},{key:"getLocalObjectiveState",value:function(e,t,i){return i?{id:t.id,satisfiedStatus:e.objectiveSatisfiedStatus,measureStatus:e.objectiveMeasureStatus,normalizedMeasure:e.objectiveNormalizedMeasure,rawScore:t.rawScore,rawScoreKnown:t.rawScoreKnown,minScore:t.minScore,minScoreKnown:t.minScoreKnown,maxScore:t.maxScore,maxScoreKnown:t.maxScoreKnown,progressMeasure:e.progressMeasure,progressMeasureStatus:e.progressMeasureStatus,completionStatus:e.completionStatus,scaledPassingScore:e.scaledPassingScore}:{id:t.id,satisfiedStatus:t.satisfiedStatus,measureStatus:t.measureStatus,normalizedMeasure:t.normalizedMeasure,rawScore:t.rawScore,rawScoreKnown:t.rawScoreKnown,minScore:t.minScore,minScoreKnown:t.minScoreKnown,maxScore:t.maxScore,maxScoreKnown:t.maxScoreKnown,progressMeasure:t.progressMeasure,progressMeasureStatus:t.progressMeasureStatus,completionStatus:t.completionStatus,scaledPassingScore:t.minNormalizedMeasure}}},{key:"updateActivityAttemptData",value:function(e,t,i){try{if(!i.isPrimary&&!t.updateAttemptData)return;var n=e.rollupRules.rules.some(function(e){return"completed"===e.action||"incomplete"===e.action});t.satisfiedStatusKnown&&t.satisfiedStatus&&(n||e.sequencingControls.completionSetByContent||e.attemptProgressStatus||e.completionStatus!==Ce&&e.completionStatus!==Oe||(e.completionStatus=we),"unknown"===e.successStatus&&(e.successStatus="passed")),t.attemptCount&&t.attemptCount>e.attemptCount&&(e.attemptCount=t.attemptCount),t.progressMeasureKnown&&void 0!==t.progressMeasure&&(e.attemptCompletionAmount=t.progressMeasure),t.attemptAbsoluteDuration&&(e.attemptAbsoluteDuration=t.attemptAbsoluteDuration),t.attemptExperiencedDuration&&(e.attemptExperiencedDuration=t.attemptExperiencedDuration),t.activityAbsoluteDuration&&(e.activityAbsoluteDuration=t.activityAbsoluteDuration),t.activityExperiencedDuration&&(e.activityExperiencedDuration=t.activityExperiencedDuration),void 0!==t.location&&(e.location=t.location),void 0!==t.suspendData&&(e.isSuspended=t.suspendData.length>0)}catch(t){var r;null===(r=this.eventCallback)||void 0===r||r.call(this,"attempt_data_update_error",{activityId:e.id,error:sr(t,Error)?t.message:t+"",timestamp:(new Date).toISOString()})}}}])&&ar(t.prototype,i),n&&ar(t,n),e}();function ur(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}var dr=Object.defineProperty,fr=function(e,t,i){return function(e,t,i){return t in e?dr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},vr=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),fr(this,"rollupStateLog",[]),fr(this,"childFilter"),fr(this,"eventCallback"),this.childFilter=t,this.eventCallback=i||null}return t=e,(i=[{key:"validateRollupStateConsistency",value:function(e){try{var t,i;null===(t=this.eventCallback)||void 0===t||t.call(this,"rollup_validation_started",{activityId:e.id,timestamp:(new Date).toISOString()});var n,r=[];return this.validateActivityRollupState(e,r),r.length>0?(null===(n=this.eventCallback)||void 0===n||n.call(this,"rollup_state_inconsistencies",{activityId:e.id,inconsistencies:r,count:r.length}),!1):(null===(i=this.eventCallback)||void 0===i||i.call(this,"rollup_validation_completed",{activityId:e.id,result:"consistent"}),!0)}catch(t){var o;return null===(o=this.eventCallback)||void 0===o||o.call(this,"rollup_validation_error",{activityId:e.id,error:(a=t,s=Error,(null!=s&&"undefined"!=typeof Symbol&&s[Symbol.hasInstance]?s[Symbol.hasInstance](a):a instanceof s)?t.message:t+"")}),!1}var a,s}},{key:"validateActivityRollupState",value:function(e,t){var i=this,n=e.id;e.objectiveMeasureStatus&&null===e.objectiveNormalizedMeasure&&t.push("Activity ".concat(n,": measure status true but normalized measure is null")),e.objectiveMeasureStatus&&null!==e.scaledPassingScore&&"unknown"!==e.successStatus&&e.objectiveSatisfiedStatus!==e.objectiveNormalizedMeasure>=e.scaledPassingScore&&t.push("Activity ".concat(n,": satisfaction status inconsistent with measure"));var r=e.sequencingControls,o=e.getAvailableChildren();if(o.length>0&&r.rollupObjectiveSatisfied){var a=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"objective","satisfied")&&i.childFilter.isChildSatisfiedForRollup(e)}),s=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"objective","notSatisfied")&&!i.childFilter.isChildSatisfiedForRollup(e)});a.length>0&&0===s.length&&!1===e.objectiveSatisfiedStatus&&0===e.rollupRules.rules.length&&t.push("Activity ".concat(n,": all children satisfied but parent is not satisfied (no rollup rules to override)"))}if(o.length>0&&r.rollupProgressCompletion){var c=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"progress","completed")&&i.childFilter.isChildCompletedForRollup(e)}),l=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"progress","incomplete")&&!i.childFilter.isChildCompletedForRollup(e)});c.length>0&&0===l.length&&"completed"!==e.completionStatus&&0===e.rollupRules.rules.length&&t.push("Activity ".concat(n,": all children completed but parent is incomplete (no rollup rules to override)"))}var u=!0,d=!1,f=void 0;try{for(var v,h=o[Symbol.iterator]();!(u=(v=h.next()).done);u=!0)this.validateActivityRollupState(v.value,t)}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}this.rollupStateLog.push({activity:n,timestamp:(new Date).toISOString(),state:{measureStatus:e.objectiveMeasureStatus,measure:e.objectiveNormalizedMeasure,satisfiedStatus:e.objectiveSatisfiedStatus,completionStatus:e.completionStatus}})}},{key:"getRollupStateLog",value:function(){return function(e){if(Array.isArray(e))return ur(e)}(e=this.rollupStateLog)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return ur(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ur(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();var e}},{key:"clearRollupStateLog",value:function(){this.rollupStateLog=[]}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var hr=Object.defineProperty,mr=function(e,t,i){return function(e,t,i){return t in e?hr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},pr=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),mr(this,"childFilter"),mr(this,"ruleEvaluator"),mr(this,"measureProcessor"),mr(this,"objectiveProcessor"),mr(this,"progressProcessor"),mr(this,"durationProcessor"),mr(this,"globalObjectiveSynchronizer"),mr(this,"stateValidator"),mr(this,"crossClusterProcessor"),mr(this,"eventCallback"),this.eventCallback=t||null,this.childFilter=new Hn,this.ruleEvaluator=new Gn(this.childFilter),this.measureProcessor=new Wn(this.childFilter,t),this.objectiveProcessor=new Xn(this.childFilter,this.ruleEvaluator,t),this.progressProcessor=new er(this.childFilter,this.ruleEvaluator,this.objectiveProcessor,t),this.durationProcessor=new ir(t),this.globalObjectiveSynchronizer=new lr(t),this.stateValidator=new vr(this.childFilter,t),this.crossClusterProcessor=new or(this.measureProcessor,this.objectiveProcessor,this.progressProcessor,t)}return t=e,(i=[{key:"overallRollupProcess",value:function(e){for(var t=[],i=e.parent,n=!1,r=!0;i;){if(i.children.length>0&&this.durationProcessor.durationRollupProcess(i),!n){var o=i.captureRollupStatus();if(i.sequencingControls.rollupObjectiveSatisfied||i.sequencingControls.rollupProgressCompletion){if(i.children.length>0){var a=this.measureProcessor.measureRollupProcess(i);this.measureProcessor.completionMeasureRollupProcess(i),a.length>1&&this.crossClusterProcessor.processCrossClusterDependencies(i,a)}i.sequencingControls.rollupObjectiveSatisfied&&this.objectiveProcessor.objectiveRollupProcess(i),i.sequencingControls.rollupProgressCompletion&&this.progressProcessor.activityProgressRollupProcess(i)}var s,c=i.captureRollupStatus();r||Vn.compareRollupStatus(o,c)&&(null===(s=this.eventCallback)||void 0===s||s.call(this,"rollup_optimization_activated",{activityId:i.id,depth:t.length}),n=!0),!r&&Vn.compareRollupStatus(o,c)||t.push(i)}i=i.parent,r=!1}return t}},{key:"validateRollupStateConsistency",value:function(e){return this.stateValidator.validateRollupStateConsistency(e)}},{key:"processGlobalObjectiveMapping",value:function(e,t){this.globalObjectiveSynchronizer.processGlobalObjectiveMapping(e,t)}},{key:"calculateComplexWeightedMeasure",value:function(e,t,i){return this.measureProcessor.calculateComplexWeightedMeasure(e,t,i)}},{key:"processCrossClusterDependencies",value:function(e,t){this.crossClusterProcessor.processCrossClusterDependencies(e,t)}},{key:"getChildFilter",value:function(){return this.childFilter}},{key:"getRuleEvaluator",value:function(){return this.ruleEvaluator}},{key:"getMeasureProcessor",value:function(){return this.measureProcessor}},{key:"getObjectiveProcessor",value:function(){return this.objectiveProcessor}},{key:"getProgressProcessor",value:function(){return this.progressProcessor}},{key:"getDurationProcessor",value:function(){return this.durationProcessor}},{key:"getGlobalObjectiveSynchronizer",value:function(){return this.globalObjectiveSynchronizer}},{key:"getStateValidator",value:function(){return this.stateValidator}},{key:"getCrossClusterProcessor",value:function(){return this.crossClusterProcessor}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function yr(e){var t=e.completionThreshold,i=e.progressMeasure,n=e.storedCompletionStatus;if(""!==t&&null!=t){var r=parseFloat(t+"");if(!isNaN(r)){if(""!==i&&null!=i){var o=parseFloat(i+"");if(!isNaN(o))return r>o?Oe:we}return Ce}}return n||Ce}var gr=Object.defineProperty,_r=[we,Oe,Ce],br=[_e,be,Se];function Sr(e){return e&&_r.includes(e)?e:null}function wr(e){return e&&br.includes(e)?e:null}var Or=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?gr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="context")?i+"":i,n),this.context=t}return t=e,(i=[{key:"transferRteData",value:function(e){if(this.context.getCMIData){var t=this.context.getCMIData();t&&(this.transferPrimaryObjective(e,t),this.transferNonPrimaryObjectives(e,t),this.context.fireEvent("onRteDataTransfer",{activityId:e.id,timestamp:(new Date).toISOString()}))}}},{key:"transferPrimaryObjective",value:function(e,t){var i=!1;if(t.progress_measure&&""!==t.progress_measure){var n=parseFloat(t.progress_measure);isNaN(n)||(i=!0,e.progressMeasure=n,e.progressMeasureStatus=!0,e.attemptCompletionAmount=n,e.attemptCompletionAmountStatus=!0,e.primaryObjective&&(e.primaryObjective.progressMeasure=n,e.primaryObjective.progressMeasureStatus=!0))}if(i||(e.attemptCompletionAmountStatus=!1),e.completedByMeasure){var r=yr({completionThreshold:e.minProgressMeasure,progressMeasure:t.progress_measure,storedCompletionStatus:Ce});e.completionStatus=r,e.attemptProgressStatus=r!==Ce}else{var o=Sr(t.completion_status);o&&o!==Ce&&(e.completionStatus=o,e.attemptProgressStatus=!0)}var a=!1,s=!1,c=!1,l=0,u=wr(t.success_status);if(u&&u!==Se&&(a=!0,e.objectiveSatisfiedStatus=s=u===_e,e.objectiveSatisfiedStatusKnown=!0,e.successStatus=u),t.score){var d;null===(d=e.primaryObjective)||void 0===d||d.initializeScoreFromCMI(this.getObjectiveScoreState(t.score));var f=this.normalizeScore(t.score);null!==f&&(c=!0,e.objectiveNormalizedMeasure=l=f,e.objectiveMeasureStatus=!0)}e.primaryObjective&&(a||c)&&(e.primaryObjective.initializeFromCMI(a?s:e.primaryObjective.satisfiedStatus,c?l:e.primaryObjective.normalizedMeasure,c),a&&(e.primaryObjective.satisfiedStatusKnown=!0,e.primaryObjective.progressStatus=!0))}},{key:"transferNonPrimaryObjectives",value:function(e,t){if(t.objectives&&0!==t.objectives.length){var i=!0,n=!1,r=void 0;try{for(var o,a=t.objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.id){var c=e.getObjectiveById(s.id);if(c){var l=c.objective,u=c.isPrimary,d=!1,f=!1,v=!1,h=0,m=!1,p=!1,y=wr(s.success_status);y&&y!==Se&&(f=y===_e,d=!0,l.progressStatus=!0);var g=Sr(s.completion_status);if(g&&g!==Ce&&(l.completionStatus=g,m=!0),s.score){l.initializeScoreFromCMI(this.getObjectiveScoreState(s.score));var _=this.normalizeScore(s.score);null!==_&&(h=_,v=!0)}if((d||v)&&(l.initializeFromCMI(d?f:l.satisfiedStatus,v?h:l.normalizedMeasure,v),d&&(l.satisfiedStatusKnown=!0)),s.progress_measure&&""!==s.progress_measure){var b=parseFloat(s.progress_measure);isNaN(b)||(l.progressMeasure=b,l.progressMeasureStatus=!0,p=!0)}u&&(d||v||m||p)&&(l.applyToActivity(e),y&&y!==Se&&(e.successStatus=y),m&&(e.attemptProgressStatus=!0),p&&(e.attemptCompletionAmount=l.progressMeasure,e.attemptCompletionAmountStatus=!0))}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}},{key:"normalizeScore",value:function(score){if(score.scaled&&""!==score.scaled){var e=parseFloat(score.scaled);if(!isNaN(e))return e}if(score.raw&&""!==score.raw&&score.min&&""!==score.min&&score.max&&""!==score.max){var t=parseFloat(score.raw),i=parseFloat(score.min),n=parseFloat(score.max);if(!isNaN(t)&&!isNaN(i)&&!isNaN(n)&&n>i)return Math.max(-1,Math.min(1,(t-i)/(n-i)))}return null}},{key:"getObjectiveScoreState",value:function(score){var e={};return void 0!==score.raw&&(e.rawScore=score.raw),void 0!==score.min&&(e.minScore=score.min),void 0!==score.max&&(e.maxScore=score.max),e}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Cr=Object.defineProperty,Er=function(e,t,i){return function(e,t,i){return t in e?Cr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Ar=function(){function e(t,i,n,r){var o=this,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5?arguments[5]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Er(this,"activityTree"),Er(this,"sequencingProcess"),Er(this,"rollupProcess"),Er(this,"globalObjectiveMap"),Er(this,"eventCallback"),Er(this,"getCMIData"),Er(this,"is4thEdition"),Er(this,"invalidateCacheCallback",null),Er(this,"_rteDataTransferService"),this.activityTree=t,this.sequencingProcess=i,this.rollupProcess=n,this.globalObjectiveMap=r,this.eventCallback=a,this.getCMIData=(null==s?void 0:s.getCMIData)||null,this.is4thEdition=(null==s?void 0:s.is4thEdition)||!1,this._rteDataTransferService=new Or({getCMIData:this.getCMIData,fireEvent:function(e,t){return o.fireEvent(e,t)}})}return t=e,i=[{key:"setInvalidateCacheCallback",value:function(e){this.invalidateCacheCallback=e}},{key:"processTerminationRequest",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=arguments.length>2?arguments[2]:void 0,i=this.activityTree.currentActivity;if(!i)return{terminationRequest:request,sequencingRequest:null,exception:"TB.2.3-1",valid:!1};if((request===Pt.EXIT||request===Pt.ABANDON)&&!i.isActive)return{terminationRequest:request,sequencingRequest:null,exception:"TB.2.3-2",valid:!1};if(this.fireEvent("onTerminationRequestProcessing",{request:request,hasSequencingRequest:e,currentActivity:i.id,exitType:t}),"logout"===t)return this.fireEvent("onSequencingDebug",{message:"cmi.exit='logout' detected, treating as EXIT_ALL",activityId:i.id}),this.handleExitAll(i);switch(request){case Pt.EXIT:return this.handleExit(i,e);case Pt.EXIT_ALL:return this.handleExitAll(i);case Pt.ABANDON:return this.handleAbandon(i,e);case Pt.ABANDON_ALL:return this.handleAbandonAll(i);case Pt.SUSPEND_ALL:return this.handleSuspendAll(i);default:return{terminationRequest:request,sequencingRequest:null,exception:"TB.2.3-7",valid:!1}}}},{key:"handleExitTermination",value:function(e,t){return this.handleExit(e,t)}},{key:"handleExit",value:function(e,t){e.children.length>0&&this.terminateDescendants(e),this.endAttempt(e);var i=this.evaluateExitRules(e);if("EXIT_ALL"===i.action)return this.handleExitAll(e);"EXIT_PARENT"===i.action&&e.parent&&(this.activityTree.currentActivity=e.parent,this.endAttempt(this.activityTree.currentActivity));var n,r,o=this.applyAncestorExitActionRules(e);if("EXIT_ALL"===o.action)return this.handleExitAll(o.activity||e);if(o.exception)return{terminationRequest:Pt.EXIT,sequencingRequest:null,exception:o.exception,valid:!1};do{if(n=!1,(r=this.evaluatePostConditions(this.activityTree.currentActivity||e)).terminationRequest===Pt.EXIT_ALL)return this.fireEvent("onPostConditionExitAll",{activity:(this.activityTree.currentActivity||e).id}),this.handleExitAll(this.activityTree.root);if(r.terminationRequest===Pt.EXIT_PARENT){var a=this.activityTree.currentActivity||e;if(!a.parent)return{terminationRequest:Pt.EXIT_PARENT,sequencingRequest:null,exception:"TB.2.3-4",valid:!1};this.activityTree.currentActivity=a.parent,this.endAttempt(this.activityTree.currentActivity),n=!0,this.fireEvent("onPostConditionExitParent",{fromActivity:a.id,toActivity:this.activityTree.currentActivity.id})}if(!n&&(this.activityTree.currentActivity||e)===this.activityTree.root&&r.sequencingRequest!==Pt.RETRY)return{terminationRequest:Pt.EXIT,sequencingRequest:Pt.EXIT,exception:null,valid:!0}}while(n);return{terminationRequest:Pt.EXIT,sequencingRequest:r.sequencingRequest,exception:null,valid:!0}}},{key:"handleExitAll",value:function(e){return this.activityTree.root&&this.handleMultiLevelExit(this.activityTree.root),this.activityTree.root&&this.endAttempt(this.activityTree.root),this.activityTree.currentActivity=null,this.cleanupSuspendedActivity(),{terminationRequest:Pt.EXIT_ALL,sequencingRequest:Pt.EXIT,exception:null,valid:!0}}},{key:"handleAbandon",value:function(e,t){return e.isActive=!1,t||(this.activityTree.currentActivity=e.parent),{terminationRequest:Pt.ABANDON,sequencingRequest:null,exception:null,valid:!0}}},{key:"handleAbandonAll",value:function(e){for(var t=[],i=e;null!==i;)t.push(i),i=i.parent;if(0===t.length)return{terminationRequest:Pt.ABANDON_ALL,sequencingRequest:null,exception:"TB.2.3-6",valid:!1};var n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)a.value.isActive=!1}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return this.activityTree.currentActivity=null,this.cleanupSuspendedActivity(),{terminationRequest:Pt.ABANDON_ALL,sequencingRequest:null,exception:null,valid:!0}}},{key:"handleSuspendAll",value:function(e){var t=this.processSuspendAllRequest(e);return t.valid?{terminationRequest:Pt.SUSPEND_ALL,sequencingRequest:Pt.EXIT,exception:null,valid:!0}:t}},{key:"processSuspendAllRequest",value:function(e){var t=this.activityTree.root;if(!e||!t)return this.fireEvent("onSuspendError",{exception:"TB.2.3-1",message:"No current activity to suspend",activity:null==e?void 0:e.id}),{terminationRequest:Pt.SUSPEND_ALL,sequencingRequest:null,exception:"TB.2.3-1",valid:!1};if(e===t&&!e.isActive&&!e.isSuspended)return this.fireEvent("onSuspendError",{exception:"TB.2.3-3",message:"Nothing to suspend (root activity)",activity:e.id}),{terminationRequest:Pt.SUSPEND_ALL,sequencingRequest:null,exception:"TB.2.3-3",valid:!1};this.activityTree.suspendedActivity=e;for(var i=e,n=[],r=i;null!==r;)n.push(r),r=r.parent;if(0===n.length)return this.fireEvent("onSuspendError",{exception:"TB.2.3-5",message:"Activity path is empty",activity:null==i?void 0:i.id}),{terminationRequest:Pt.SUSPEND_ALL,sequencingRequest:null,exception:"TB.2.3-5",valid:!1};var o=!0,a=!1,s=void 0;try{for(var c,l=n[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value;u.isActive=!1,u.isSuspended=!0}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}return this.activityTree.currentActivity=t,t.isActive=!1,this.fireEvent("onActivitySuspended",{activity:null==i?void 0:i.id,suspendedPath:n.map(function(e){return e.id}),pathLength:n.length,timestamp:(new Date).toISOString()}),{terminationRequest:Pt.SUSPEND_ALL,sequencingRequest:null,exception:null,valid:!0}}},{key:"evaluateExitRules",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t++;var i=e.sequencingRules.exitConditionRules,n=!0,r=!1,o=void 0;try{for(var a,s=i[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;if(c.evaluate(e)){if(c.action===St.EXIT)return{action:"EXIT",recursionDepth:t};if(c.action===St.EXIT_PARENT)return{action:"EXIT_PARENT",recursionDepth:t};if(c.action===St.EXIT_ALL)return{action:"EXIT_ALL",recursionDepth:t}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return{action:null,recursionDepth:t}}},{key:"evaluatePostConditions",value:function(e){var t=this.sequencingProcess.evaluatePostConditionRules(e);return(t.sequencingRequest||t.terminationRequest)&&this.fireEvent("onPostConditionEvaluated",{activity:e.id,sequencingRequest:t.sequencingRequest,terminationRequest:t.terminationRequest,timestamp:(new Date).toISOString()}),t}},{key:"handleMultiLevelExit",value:function(e){this.processExitAtLevel(e,0),this.terminateAll(e)}},{key:"applyAncestorExitActionRules",value:function(e){for(var t=[],i=e.parent;i;)t.unshift(i),i=i.parent;var n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value,l=this.exitActionRulesSubprocess(c);if("EXIT_ALL"===l)return this.fireEvent("onAncestorExitAction",{activity:c.id,action:l}),{action:"EXIT_ALL",activity:c};if("EXIT_PARENT"===l)return c.parent?(this.terminateDescendants(c.parent),this.activityTree.currentActivity=c.parent,this.endAttempt(c.parent),this.fireEvent("onAncestorExitAction",{activity:c.id,action:l,currentActivity:c.parent.id}),{action:"EXIT_PARENT",activity:c.parent}):{action:"EXIT_PARENT",activity:c,exception:"TB.2.3-4"};if("EXIT"===l)return this.terminateDescendants(c),this.activityTree.currentActivity=c,this.endAttempt(c),this.fireEvent("onAncestorExitAction",{activity:c.id,action:l}),{action:"EXIT",activity:c}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return{action:null}}},{key:"processExitAtLevel",value:function(e,t){var i=this.evaluateExitRules(e,0);i.action&&this.fireEvent("onMultiLevelExitAction",{activity:e.id,level:t,action:i.action});var n=!0,r=!1,o=void 0;try{for(var a,s=e.children[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)this.processExitAtLevel(a.value,t+1)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}},{key:"cleanupSuspendedActivity",value:function(){var e=this.activityTree.suspendedActivity;if(e){for(var t=e,i=[];t;)t.isSuspended&&(t.isSuspended=!1,i.push(t.id)),t=t.parent;this.activityTree.suspendedActivity=null,this.fireEvent("onSuspendedActivityCleanup",{cleanedActivities:i,originalSuspendedActivity:e.id})}}},{key:"terminateAll",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateAll(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}e.isActive&&this.endAttempt(e)}},{key:"terminateDescendants",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;a.children.length>0&&this.terminateDescendants(a);var s=this.exitActionRulesSubprocess(a);a.isActive&&("EXIT_ALL"===s&&this.terminateDescendants(a),this.endAttempt(a))}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"exitActionRulesSubprocess",value:function(e){var t=e.sequencingRules.exitConditionRules,i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.evaluate(e)){if(s.action===St.EXIT)return"EXIT";if(s.action===St.EXIT_PARENT)return"EXIT_PARENT";if(s.action===St.EXIT_ALL)return"EXIT_ALL"}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"clearSuspendedActivity",value:function(){if(this.activityTree.suspendedActivity){for(var e=this.activityTree.suspendedActivity;e;)e.isSuspended=!1,e=e.parent;this.activityTree.suspendedActivity=null}}},{key:"endAttempt",value:function(e){if(e.isActive){if(this._rteDataTransferService.transferRteData(e),e.isActive=!1,e.activityAttemptActive=!1,0===e.children.length){if(!e.isSuspended&&(e.sequencingControls.completionSetByContent||e.attemptProgressStatus||(e.attemptProgressStatus=!0,e.completionStatus="completed",e.wasAutoCompleted=!0,this.fireEvent("onAutoCompletion",{activityId:e.id,timestamp:(new Date).toISOString()})),!e.sequencingControls.objectiveSetByContent)){var t=e.primaryObjective;t&&(t.progressStatus||(t.progressStatus=!0,t.satisfiedStatus=!0,e.objectiveSatisfiedStatus=!0,e.successStatus="passed",e.wasAutoSatisfied=!0,this.fireEvent("onAutoSatisfaction",{activityId:e.id,timestamp:(new Date).toISOString()})))}}else{var i=e.children.some(function(e){return e.isSuspended});e.isSuspended=i}"unknown"===e.completionStatus&&(e.completionStatus="incomplete"),"unknown"===e.successStatus&&e.objectiveSatisfiedStatus&&(e.successStatus=e.objectiveSatisfiedStatus?"passed":"failed"),this.rollupProcess.processGlobalObjectiveMapping(this.activityTree.root||e,this.globalObjectiveMap),this.rollupProcess.overallRollupProcess(e),this.invalidateCacheCallback&&this.invalidateCacheCallback(),this.activityTree.root&&this.rollupProcess.validateRollupStateConsistency(this.activityTree.root),ei.applySelectionAndRandomization(e,!1)}}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function kr(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function jr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rr(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Mr(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Rr(e,t,i[t])})}return e}function Tr(e){return function(e){if(Array.isArray(e))return kr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return kr(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?kr(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var xr=Object.defineProperty,Ir=function(e,t,i){return function(e,t,i){return t in e?xr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Pr=function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;jr(this,e),Ir(this,"valid"),Ir(this,"targetActivity"),Ir(this,"exception"),this.valid=t,this.targetActivity=i,this.exception=n},Nr=function(){function e(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5?arguments[5]:void 0;jr(this,e),Ir(this,"activityTree"),Ir(this,"rollupProcess"),Ir(this,"globalObjectiveMap"),Ir(this,"adlNav"),Ir(this,"eventCallback"),Ir(this,"now"),Ir(this,"defaultHideLmsUi"),Ir(this,"defaultAuxiliaryResources"),Ir(this,"_deliveryInProgress",!1),Ir(this,"contentDelivered",!1),Ir(this,"checkActivityCallback",null),Ir(this,"invalidateCacheCallback",null),Ir(this,"updateNavigationValidityCallback",null),Ir(this,"clearSuspendedActivityCallback",null),this.activityTree=t,this.rollupProcess=i,this.globalObjectiveMap=n,this.adlNav=r,this.eventCallback=o,this.now=(null==a?void 0:a.now)||function(){return new Date},this.defaultHideLmsUi=(null==a?void 0:a.defaultHideLmsUi)?Tr(a.defaultHideLmsUi):[],this.defaultAuxiliaryResources=(null==a?void 0:a.defaultAuxiliaryResources)?a.defaultAuxiliaryResources.map(function(e){return Mr({},e)}):[]}return t=e,i=[{key:"setCheckActivityCallback",value:function(e){this.checkActivityCallback=e}},{key:"setInvalidateCacheCallback",value:function(e){this.invalidateCacheCallback=e}},{key:"setUpdateNavigationValidityCallback",value:function(e){this.updateNavigationValidityCallback=e}},{key:"setClearSuspendedActivityCallback",value:function(e){this.clearSuspendedActivityCallback=e}},{key:"isDeliveryInProgress",value:function(){return this._deliveryInProgress}},{key:"hasContentBeenDelivered",value:function(){return this.contentDelivered}},{key:"resetContentDelivered",value:function(){this.contentDelivered=!1}},{key:"setContentDelivered",value:function(e){this.contentDelivered=e}},{key:"processDeliveryRequest",value:function(e){if(this.fireEvent("onDeliveryRequestProcessing",{activity:e.id,timestamp:(new Date).toISOString()}),e.children.length>0)return new Pr(!1,null,"DB.1.1-1");var t=this.getActivityPath(e,!0);if(0===t.length)return new Pr(!1,null,"DB.1.1-2");var i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(this.checkActivityCallback&&!this.checkActivityCallback(o.value))return new Pr(!1,null,"DB.1.1-3")}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return new Pr(!0,e)}},{key:"contentDeliveryEnvironmentProcess",value:function(e){this._deliveryInProgress=!0;try{var t=e.isSuspended;this.activityTree.suspendedActivity&&this.clearSuspendedActivityCallback&&this.clearSuspendedActivityCallback();var i=this.getActivityPath(e,!0),n=!0,r=!1,o=void 0;try{for(var a,s=i[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;c.isActive||(t||c.isSuspended?c.isSuspended=!1:c.incrementAttemptCount(),c.isActive=!0,ei.applySelectionAndRandomization(c,1>=c.attemptCount))}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}this.activityTree.currentActivity=e,this.initializeForDelivery(e),this.setupAttemptTracking(e),this.contentDelivered=!0,this.adlNav&&this.updateNavigationValidityCallback&&this.updateNavigationValidityCallback(),this.fireDeliveryEvent(e)}finally{this._deliveryInProgress=!1}}},{key:"initializeForDelivery",value:function(e){"unknown"===e.completionStatus&&0===e.children.length&&(e.completionStatus="not attempted"),null===e.objectiveSatisfiedStatus&&(e.objectiveSatisfiedStatus=!1),null===e.progressMeasure&&(e.progressMeasure=0,e.progressMeasureStatus=!1),null===e.objectiveNormalizedMeasure&&(e.objectiveNormalizedMeasure=0,e.objectiveMeasureStatus=!1),e.attemptAbsoluteDuration="PT0H0M0S",e.attemptExperiencedDuration="PT0H0M0S",e.isAvailable=!0}},{key:"setupAttemptTracking",value:function(e){e.wasSkipped=!1,e.attemptAbsoluteStartTime=this.now().toISOString(),e.location||(e.location=""),e.activityAttemptActive=!0,e.learnerPrefs||(e.learnerPrefs={audioCaptioning:"0",audioLevel:"1",deliverySpeed:"1",language:""})}},{key:"fireDeliveryEvent",value:function(e){try{this.eventCallback&&this.eventCallback("onActivityDelivery",e),console.debug("Activity delivered: ".concat(e.id," - ").concat(e.title))}catch(e){console.warn("Failed to fire activity delivery event: ".concat(e))}}},{key:"getEffectiveHideLmsUi",value:function(t){var i=new Set,n=!0,r=!1,o=void 0;try{for(var a,s=this.defaultHideLmsUi[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)i.add(a.value)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}for(var c=t;c;){var l=!0,u=!1,d=void 0;try{for(var f,v=c.hideLmsUi[Symbol.iterator]();!(l=(f=v.next()).done);l=!0)i.add(f.value)}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}c=c.parent}return e.HIDE_LMS_UI_ORDER.filter(function(e){return i.has(e)})}},{key:"getEffectiveAuxiliaryResources",value:function(e){var t=new Map,i=!0,n=!1,r=void 0;try{for(var o,a=this.defaultAuxiliaryResources[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.resourceId&&t.set(s.resourceId,Mr({},s))}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}for(var c=[],l=e;l;)c.push(l),l=l.parent;var u=!0,d=!1,f=void 0;try{for(var v,h=c.reverse()[Symbol.iterator]();!(u=(v=h.next()).done);u=!0){var m=v.value,p=!0,y=!1,g=void 0;try{for(var _,b=m.auxiliaryResources[Symbol.iterator]();!(p=(_=b.next()).done);p=!0){var S=_.value;S.resourceId&&t.set(S.resourceId,Mr({},S))}}catch(e){y=!0,g=e}finally{try{p||null==b.return||b.return()}finally{if(y)throw g}}}}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}return Array.from(t.values())}},{key:"getContentActivityData",value:function(e){var t;return{hideLmsUi:this.getEffectiveHideLmsUi(e),auxiliaryResources:this.getEffectiveAuxiliaryResources(e),location:e.location||"",credit:e.credit||"credit",launchData:e.launchData||"",maxTimeAllowed:e.attemptAbsoluteDurationLimit||"",completionThreshold:(null===(t=e.completionThreshold)||void 0===t?void 0:""+t)||"",timeLimitAction:e.timeLimitAction||"continue,no message"}}},{key:"getActivityPath",value:function(e){for(var t=1>=arguments.length||void 0===arguments[1]||arguments[1],i=[],n=e;null!==n;)i.unshift(n),n=n.parent;return!t&&i.length>0&&i.pop(),i}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();Ir(Nr,"HIDE_LMS_UI_ORDER",Tr(ct));var Dr=Nr;var qr=Object.defineProperty,Lr=function(e,t,i){return function(e,t,i){return t in e?qr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},zr=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Lr(this,"activityTree"),Lr(this,"sequencingProcess"),Lr(this,"cache",null),Lr(this,"isDirty",!0),this.activityTree=t,this.sequencingProcess=i}return t=e,(i=[{key:"predictContinueEnabled",value:function(){var e,t;return this.ensureCacheValid(),null!==(e=null===(t=this.cache)||void 0===t?void 0:t.continueEnabled)&&void 0!==e&&e}},{key:"predictPreviousEnabled",value:function(){var e,t;return this.ensureCacheValid(),null!==(e=null===(t=this.cache)||void 0===t?void 0:t.previousEnabled)&&void 0!==e&&e}},{key:"predictChoiceEnabled",value:function(e){var t,i;return this.ensureCacheValid(),null!==(t=null===(i=this.cache)||void 0===i?void 0:i.choiceEnabledMap.get(e))&&void 0!==t&&t}},{key:"getAvailableChoices",value:function(){var e,t;return this.ensureCacheValid(),Array.from(null!==(e=null===(t=this.cache)||void 0===t?void 0:t.availableChoices)&&void 0!==e?e:[])}},{key:"getAllPredictions",value:function(){var e,t,i,n,r,o;return this.ensureCacheValid(),{continueEnabled:null!==(e=null===(n=this.cache)||void 0===n?void 0:n.continueEnabled)&&void 0!==e&&e,previousEnabled:null!==(t=null===(r=this.cache)||void 0===r?void 0:r.previousEnabled)&&void 0!==t&&t,availableChoices:Array.from(null!==(i=null===(o=this.cache)||void 0===o?void 0:o.availableChoices)&&void 0!==i?i:[])}}},{key:"invalidateCache",value:function(){this.isDirty=!0}},{key:"updateCache",value:function(){this.isDirty=!0,this.ensureCacheValid()}},{key:"ensureCacheValid",value:function(){var e=this.calculateTreeStateHash();!this.isDirty&&this.cache&&this.cache.treeStateHash===e||(this.recalculateCache(e),this.isDirty=!1)}},{key:"recalculateCache",value:function(e){var t=this.activityTree.currentActivity;this.cache={continueEnabled:!1,previousEnabled:!1,availableChoices:new Set,choiceEnabledMap:new Map,treeStateHash:e},t?(this.cache.continueEnabled=this.predictContinueInternal(t),this.cache.previousEnabled=this.predictPreviousInternal(t),this.calculateAvailableChoices()):this.calculateAvailableChoicesFromRoot()}},{key:"predictContinueInternal",value:function(e){return!!e.parent&&!!e.parent.sequencingControls.flow&&this.hasAvailableNextActivity(e)}},{key:"hasAvailableNextActivity",value:function(e){var t=e.parent;if(!t)return!1;var i=t.children,n=i.indexOf(e);if(-1===n)return!1;if(i.length-1>n)for(var r=n+1;i.length>r;r++){var o=i[r];if(o&&this.isActivityPotentiallyDeliverableForward(o))return!0}return!(!t.parent||!t.sequencingControls.flow)&&this.hasAvailableNextActivity(t)}},{key:"predictPreviousInternal",value:function(e){return!!e.parent&&!!e.parent.sequencingControls.flow&&!e.parent.sequencingControls.forwardOnly&&this.hasAvailablePreviousActivity(e)}},{key:"hasAvailablePreviousActivity",value:function(e){var t=e.parent;if(!t)return!1;var i=t.children,n=i.indexOf(e);if(-1===n)return!1;if(n>0)for(var r=n-1;r>=0;r--){var o=i[r];if(o&&this.isActivityPotentiallyDeliverableBackward(o))return!0}return!(!t.parent||!t.sequencingControls.flow||t.sequencingControls.forwardOnly)&&this.hasAvailablePreviousActivity(t)}},{key:"calculateAvailableChoicesFromRoot",value:function(){}},{key:"calculateAvailableChoices",value:function(){this.cache&&this.activityTree.root&&this.recursivelyCheckChoiceAvailability(this.activityTree.root)}},{key:"recursivelyCheckChoiceAvailability",value:function(e){if(this.cache){var t=this.sequencingProcess.validateNavigationRequest(Pt.CHOICE,e.id,this.activityTree.currentActivity).valid;if(this.cache.choiceEnabledMap.set(e.id,t),t&&this.cache.availableChoices.add(e.id),e.children){var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)this.recursivelyCheckChoiceAvailability(o.value)}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}}},{key:"isActivityPotentiallyDeliverableForward",value:function(e){if(e.isHiddenFromChoice||!e.isAvailable)return!1;if(0===e.children.length)return!!e.isVisible&&this.sequencingProcess.canActivityBeDelivered(e);var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)if(this.isActivityPotentiallyDeliverableForward(r.value))return!0}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return!1}},{key:"isActivityPotentiallyDeliverableBackward",value:function(e){if(e.isHiddenFromChoice||!e.isAvailable)return!1;if(0===e.children.length)return e.isVisible;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)if(this.isActivityPotentiallyDeliverableBackward(r.value))return!0}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return!1}},{key:"calculateTreeStateHash",value:function(){var e,t,i=this.activityTree.currentActivity,n=this.activityTree.suspendedActivity;return[null!==(e=null==i?void 0:i.id)&&void 0!==e?e:"none",null!==(t=null==n?void 0:n.id)&&void 0!==t?t:"none",this.getActivityTreeStateSignature()].join("|")}},{key:"getActivityTreeStateSignature",value:function(){if(!this.activityTree.root)return"empty";var e=[];return this.collectActivitySignatures(this.activityTree.root,e),e.join(":")}},{key:"collectActivitySignatures",value:function(e,t){if(t.push(e.id+(e.isActive?"A":"-")+(e.isSuspended?"S":"-")+e.completionStatus+e.successStatus+e.attemptCount),e.children){var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)this.collectActivitySignatures(o.value,t)}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Fr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Br=Object.defineProperty,Vr=function(e,t,i){return function(e,t,i){return t in e?Br(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Hr=function(e){return e.START="start",e.RESUME_ALL="resumeAll",e.CONTINUE="continue",e.PREVIOUS="previous",e.CHOICE="choice",e.JUMP="jump",e.EXIT="exit",e.EXIT_ALL="exitAll",e.ABANDON="abandon",e.ABANDON_ALL="abandonAll",e.SUSPEND_ALL="suspendAll",e.NOT_VALID="_none_",e}(Hr||{}),Ur=function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;Fr(this,e),Vr(this,"valid"),Vr(this,"terminationRequest"),Vr(this,"sequencingRequest"),Vr(this,"targetActivityId"),Vr(this,"exception"),this.valid=t,this.terminationRequest=i,this.sequencingRequest=n,this.targetActivityId=r,this.exception=o},Gr=function(){function e(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;Fr(this,e),Vr(this,"activityTree"),Vr(this,"sequencingProcess"),Vr(this,"adlNav"),Vr(this,"eventCallback"),Vr(this,"navigationLookAhead"),Vr(this,"getEffectiveHideLmsUiCallback",null),this.activityTree=t,this.sequencingProcess=i,this.adlNav=n,this.eventCallback=r,this.navigationLookAhead=new zr(t,i)}return t=e,i=[{key:"setGetEffectiveHideLmsUiCallback",value:function(e){this.getEffectiveHideLmsUiCallback=e}},{key:"getNavigationLookAhead",value:function(){return this.navigationLookAhead}},{key:"validateRequest",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.fireEvent("onNavigationRequestProcessing",{request:request,targetActivityId:e});var t=this.activityTree.currentActivity;switch(request){case"start":return this.validateStartRequest(t);case"resumeAll":return this.validateResumeRequest(t);case"continue":return this.validateContinueRequest(t);case"previous":return this.validatePreviousRequest(t);case"choice":return this.validateChoiceRequest(t,e);case"jump":return this.validateJumpRequest(e);case"exit":return this.validateExitRequest(t);case"exitAll":return this.validateExitAllRequest(t);case"abandon":return this.validateAbandonRequest(t);case"abandonAll":return this.validateAbandonAllRequest(t);case"suspendAll":return this.validateSuspendAllRequest(t);default:return new Ur(!1,null,null,null,"NB.2.1-18")}}},{key:"validateStartRequest",value:function(e){return null!==e?new Ur(!1,null,null,null,"NB.2.1-1"):new Ur(!0,null,Pt.START,null)}},{key:"validateResumeRequest",value:function(e){return null!==e?new Ur(!1,null,null,null,"NB.2.1-2"):null===this.activityTree.suspendedActivity?new Ur(!1,null,null,null,"NB.2.1-3"):new Ur(!0,null,Pt.RESUME_ALL,null)}},{key:"validateContinueRequest",value:function(e){return e?e.parent&&e.parent.sequencingControls.flow?new Ur(!0,e.isActive?Pt.EXIT:null,Pt.CONTINUE,null):new Ur(!1,null,null,null,"NB.2.1-5"):new Ur(!1,null,null,null,"NB.2.1-4")}},{key:"validatePreviousRequest",value:function(e){if(!e)return new Ur(!1,null,null,null,"NB.2.1-6");if(!e.parent||!e.parent.sequencingControls.flow)return new Ur(!1,null,null,null,"NB.2.1-7");var t=this.validateForwardOnlyConstraints(e);return t.valid?new Ur(!0,e.isActive?Pt.EXIT:null,Pt.PREVIOUS,null):new Ur(!1,null,null,null,t.exception)}},{key:"validateChoiceRequest",value:function(e,t){if(!t)return new Ur(!1,null,null,null,"NB.2.1-9");var i=this.activityTree.getActivity(t);if(!i)return new Ur(!1,null,null,null,"NB.2.1-10");var n=this.validateChoicePath(e,i);return n.valid?new Ur(!0,(null==e?void 0:e.isActive)?Pt.EXIT:null,Pt.CHOICE,t):new Ur(!1,null,null,null,n.exception)}},{key:"validateJumpRequest",value:function(e){return e?new Ur(!0,null,Pt.JUMP,e):new Ur(!1,null,null,null,"NB.2.1-12")}},{key:"validateExitRequest",value:function(e){return e?new Ur(!0,e===this.activityTree.root?Pt.EXIT_ALL:Pt.EXIT,null,null):new Ur(!1,null,null,null,"NB.2.1-13")}},{key:"validateExitAllRequest",value:function(e){return e?new Ur(!0,Pt.EXIT_ALL,null,null):new Ur(!1,null,null,null,"NB.2.1-14")}},{key:"validateAbandonRequest",value:function(e){return e?new Ur(!0,Pt.ABANDON,null,null):new Ur(!1,null,null,null,"NB.2.1-15")}},{key:"validateAbandonAllRequest",value:function(e){return e?new Ur(!0,Pt.ABANDON_ALL,null,null):new Ur(!1,null,null,null,"NB.2.1-16")}},{key:"validateSuspendAllRequest",value:function(e){return e?new Ur(!0,Pt.SUSPEND_ALL,null,null):new Ur(!1,null,null,null,"NB.2.1-17")}},{key:"validateChoicePath",value:function(e,t){if(t.isHiddenFromChoice)return{valid:!1,exception:"NB.2.1-11"};if(!t.isAvailable)return{valid:!1,exception:"NB.2.1-11"};if(this.isActivityDisabled(t))return{valid:!1,exception:"NB.2.1-11"};if(e){var i=this.findCommonAncestor(e,t);if(!i)return{valid:!1,exception:"NB.2.1-11"};for(var n=e;n&&n!==i;){if(!0===n.isActive&&n.sequencingControls&&!1===n.sequencingControls.choiceExit&&t!==n&&!this.activityContains(n,t))return{valid:!1,exception:"NB.2.1-11"};n=n.parent}var r=this.validateConstrainChoice(e,t,i);if(!r.valid)return r;var o=this.validateChoiceSet(e,t,i);if(!o.valid)return o}for(var a=t;a;){if(a.parent&&!a.parent.sequencingControls.choice)return{valid:!1,exception:"NB.2.1-11"};a=a.parent}return{valid:!0,exception:null}}},{key:"validateForwardOnlyConstraints",value:function(e){var t,i;if(null===(t=e.parent)||void 0===t?void 0:t.sequencingControls.forwardOnly)return{valid:!1,exception:"NB.2.1-8"};for(var n=null===(i=e.parent)||void 0===i?void 0:i.parent;n;){if(n.sequencingControls.forwardOnly)return{valid:!1,exception:"NB.2.1-8"};n=n.parent}return{valid:!0,exception:null}}},{key:"validateConstrainChoice",value:function(e,t,i){for(var n=i;n;){var r,o;if((null===(r=n.sequencingControls)||void 0===r?void 0:r.constrainChoice)||(null===(o=n.sequencingControls)||void 0===o?void 0:o.preventActivation)){var a,s,c=this.findChildContaining(n,e);if(!c)return{valid:!1,exception:"NB.2.1-11"};if(t===n)return{valid:!1,exception:"NB.2.1-11"};var l=this.findChildContaining(n,t);if(!l)return{valid:!1,exception:"NB.2.1-11"};if((null===(a=n.sequencingControls)||void 0===a?void 0:a.constrainChoice)&&l!==c)return{valid:!1,exception:"NB.2.1-11"};if((null===(s=n.sequencingControls)||void 0===s?void 0:s.preventActivation)&&l!==c&&this.requiresNewActivation(l,t))return{valid:!1,exception:"NB.2.1-11"}}n=n.parent}return this.validateAncestors(i,e,t)}},{key:"validateChoiceSet",value:function(e,t,i){if(!this.activityContains(i,t)&&t!==i)return{valid:!1,exception:"NB.2.1-11"};for(var n=t;n&&n!==i;){if(!n.isAvailable||n.isHiddenFromChoice||this.isActivityDisabled(n))return{valid:!1,exception:"NB.2.1-11"};n=n.parent}return{valid:!0,exception:null}}},{key:"isActivityDisabled",value:function(e){if(!e.isAvailable)return!0;if(e.isHiddenFromChoice)return!0;var t=this.evaluatePreConditionRulesForChoice(e);return!!t&&(t===St.DISABLED||t===St.HIDE_FROM_CHOICE||t===St.STOP_FORWARD_TRAVERSAL)}},{key:"findChildContaining",value:function(e,t){var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s===t)return s;if(this.activityContains(s,t))return s}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"activityContains",value:function(e,t){for(var i=t;i;){if(i===e)return!0;i=i.parent}return!1}},{key:"findCommonAncestor",value:function(e,t){for(var i=[],n=e;n;)i.push(n),n=n.parent;for(n=t;n;){if(i.includes(n))return n;n=n.parent}return null}},{key:"validateAncestors",value:function(e,t,i){var n=e.children;if(!n||0===n.length)return{valid:!0,exception:null};var r=this.findChildContaining(e,t),o=this.findChildContaining(e,i);if(!r||!o)return{valid:!1,exception:"NB.2.1-11"};var a=n.indexOf(r),s=n.indexOf(o);if(e.sequencingControls.forwardOnly&&a>s)return{valid:!1,exception:"NB.2.1-8"};var c=n.findIndex(function(e){return null==e?void 0:e.sequencingControls.stopForwardTraversal});if(r.sequencingControls.stopForwardTraversal&&s>a)return{valid:!1,exception:"NB.2.1-11"};if(-1!==c&&s>c)return{valid:!1,exception:"NB.2.1-11"};if(s>a&&e.sequencingControls.forwardOnly)for(var l=a+1;s>l;l++){var u=n[l];if(u){if(u.sequencingControls.stopForwardTraversal)return{valid:!1,exception:"NB.2.1-11"};if(this.isActivityMandatory(u)&&!this.isActivityCompleted(u))return{valid:!1,exception:"NB.2.1-11"}}}return{valid:!0,exception:null}}},{key:"requiresNewActivation",value:function(e,t){return!this.branchHasActiveAttempt(e)&&!t.activityAttemptActive&&!t.isActive}},{key:"branchHasActiveAttempt",value:function(e){if(e.activityAttemptActive||e.isActive)return!0;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)if(this.branchHasActiveAttempt(r.value))return!0}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return!1}},{key:"isActivityMandatory",value:function(e){if(!e.isAvailable||e.isHiddenFromChoice)return!1;var t=this.evaluatePreConditionRulesForChoice(e);return t!==St.SKIP&&t!==St.DISABLED&&t!==St.HIDE_FROM_CHOICE&&t!==St.STOP_FORWARD_TRAVERSAL&&!this.isActivityDisabled(e)&&!1!==e.mandatory}},{key:"isActivityCompleted",value:function(e){if(!e.isAvailable||e.isHiddenFromChoice)return!0;var t=this.evaluatePreConditionRulesForChoice(e);return t===St.SKIP||t===St.DISABLED||t===St.HIDE_FROM_CHOICE||t===St.STOP_FORWARD_TRAVERSAL||!!this.isActivityDisabled(e)||"completed"===e.completionStatus||"passed"===e.successStatus||"passed"===e.successStatus}},{key:"evaluatePreConditionRulesForChoice",value:function(e){return e.sequencingRules&&e.sequencingRules.evaluatePreConditionRules(e)||null}},{key:"updateNavigationValidity",value:function(){if(this.adlNav&&this.activityTree.currentActivity){this.navigationLookAhead.invalidateCache();var e=this.navigationLookAhead.predictContinueEnabled();try{this.adlNav.request_valid.continue=e?"true":"false"}catch(e){}var t=this.navigationLookAhead.predictPreviousEnabled();try{this.adlNav.request_valid.previous=t?"true":"false"}catch(e){}var i=this.activityTree.getAllActivities(),n={},r={},o=!0,a=!1,s=void 0;try{for(var c,l=i[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value,d=this.validateRequest("choice",u.id);n[u.id]=d.valid?"true":"false";var f=this.validateRequest("jump",u.id);r[u.id]=f.valid?"true":"false"}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}try{this.adlNav.request_valid.choice=n}catch(e){}try{this.adlNav.request_valid.jump=r}catch(e){}var v=this.getEffectiveHideLmsUiCallback?this.getEffectiveHideLmsUiCallback(this.activityTree.currentActivity):[];this.fireEvent("onNavigationValidityUpdate",{continue:e,previous:t,choice:n,jump:r,hideLmsUi:v})}}},{key:"getAllPredictions",value:function(){return this.navigationLookAhead.getAllPredictions()}},{key:"predictContinueEnabled",value:function(){return this.navigationLookAhead.predictContinueEnabled()}},{key:"predictPreviousEnabled",value:function(){return this.navigationLookAhead.predictPreviousEnabled()}},{key:"predictChoiceEnabled",value:function(e){return this.navigationLookAhead.predictChoiceEnabled(e)}},{key:"getAvailableChoices",value:function(){return this.navigationLookAhead.getAvailableChoices()}},{key:"invalidateCache",value:function(){this.navigationLookAhead.invalidateCache()}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Kr(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Yr(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Wr(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Jr(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Yr(e,t,i[t])})}return e}function $r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Kr(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Kr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Xr=Object.defineProperty,Qr=function(e,t,i){return function(e,t,i){return t in e?Xr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Zr=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Qr(this,"globalObjectiveMap",new Map),Qr(this,"eventCallback",null),this.eventCallback=t||null}return t=e,(i=[{key:"initialize",value:function(e){try{this.globalObjectiveMap.clear(),e&&this.collectObjectives(e),this.fireEvent("onGlobalObjectiveMapInitialized",{objectiveCount:this.globalObjectiveMap.size,timestamp:(new Date).toISOString()})}catch(e){this.fireEvent("onGlobalObjectiveMapError",{error:Wr(e,Error)?e.message:e+"",timestamp:(new Date).toISOString()})}}},{key:"collectObjectives",value:function(e){var objectives=e.getAllObjectives();if(0===objectives.length){var t="".concat(e.id,"_default_objective");this.globalObjectiveMap.has(t)||this.globalObjectiveMap.set(t,{id:t,satisfiedStatus:e.objectiveSatisfiedStatus,satisfiedStatusKnown:e.objectiveSatisfiedStatusKnown,normalizedMeasure:e.objectiveNormalizedMeasure,normalizedMeasureKnown:e.objectiveMeasureStatus,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasure:e.progressMeasure,progressMeasureKnown:e.progressMeasureStatus,completionStatus:e.completionStatus,completionStatusKnown:e.completionStatus!==Ce,readSatisfiedStatus:!0,writeSatisfiedStatus:!0,readNormalizedMeasure:!0,writeNormalizedMeasure:!0,readCompletionStatus:!0,writeCompletionStatus:!0,readProgressMeasure:!0,writeProgressMeasure:!0,readRawScore:!1,writeRawScore:!1,readMinScore:!1,writeMinScore:!1,readMaxScore:!1,writeMaxScore:!1,satisfiedByMeasure:null!==e.scaledPassingScore,minNormalizedMeasure:e.scaledPassingScore,updateAttemptData:!0})}var i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,c=s.mapInfo.length>0?s.mapInfo:[{targetObjectiveID:s.id,readSatisfiedStatus:!0,writeSatisfiedStatus:!0,readNormalizedMeasure:!0,writeNormalizedMeasure:!0,readProgressMeasure:!0,writeProgressMeasure:!0,readCompletionStatus:!0,writeCompletionStatus:!0,updateAttemptData:s.isPrimary}],l=!0,u=!1,d=void 0;try{for(var f,v=c[Symbol.iterator]();!(l=(f=v.next()).done);l=!0){var h,m,p,y,g,_,b,S,w,O,C,E,A,k,j,R=f.value,M=R.targetObjectiveID||s.id;this.globalObjectiveMap.has(M)||this.globalObjectiveMap.set(M,{id:M,satisfiedStatus:s.satisfiedStatus,satisfiedStatusKnown:s.satisfiedStatusKnown||s.progressStatus,normalizedMeasure:s.normalizedMeasure,normalizedMeasureKnown:s.measureStatus,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasure:s.progressMeasure,progressMeasureKnown:s.progressMeasureStatus,completionStatus:s.completionStatus,completionStatusKnown:s.completionStatus!==Ce,readSatisfiedStatus:null!==(h=R.readSatisfiedStatus)&&void 0!==h&&h,writeSatisfiedStatus:null!==(m=R.writeSatisfiedStatus)&&void 0!==m&&m,readNormalizedMeasure:null!==(p=R.readNormalizedMeasure)&&void 0!==p&&p,writeNormalizedMeasure:null!==(y=R.writeNormalizedMeasure)&&void 0!==y&&y,readProgressMeasure:null!==(g=R.readProgressMeasure)&&void 0!==g&&g,writeProgressMeasure:null!==(_=R.writeProgressMeasure)&&void 0!==_&&_,readCompletionStatus:null!==(b=R.readCompletionStatus)&&void 0!==b&&b,writeCompletionStatus:null!==(S=R.writeCompletionStatus)&&void 0!==S&&S,readRawScore:null!==(w=R.readRawScore)&&void 0!==w&&w,writeRawScore:null!==(O=R.writeRawScore)&&void 0!==O&&O,readMinScore:null!==(C=R.readMinScore)&&void 0!==C&&C,writeMinScore:null!==(E=R.writeMinScore)&&void 0!==E&&E,readMaxScore:null!==(A=R.readMaxScore)&&void 0!==A&&A,writeMaxScore:null!==(k=R.writeMaxScore)&&void 0!==k&&k,satisfiedByMeasure:s.satisfiedByMeasure,minNormalizedMeasure:s.minNormalizedMeasure,updateAttemptData:null!==(j=R.updateAttemptData)&&void 0!==j?j:s.isPrimary})}}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}var T=!0,x=!1,I=void 0;try{for(var P,N=e.children[Symbol.iterator]();!(T=(P=N.next()).done);T=!0)this.collectObjectives(P.value)}catch(e){x=!0,I=e}finally{try{T||null==N.return||N.return()}finally{if(x)throw I}}}},{key:"getMap",value:function(){return this.globalObjectiveMap}},{key:"getSnapshot",value:function(){return this.serialize()}},{key:"restoreSnapshot",value:function(e){this.restore(e)}},{key:"updateObjective",value:function(e,t){try{this.globalObjectiveMap.set(e,(i=Jr({},this.globalObjectiveMap.get(e),t),n=null!=(n={lastUpdated:(new Date).toISOString()})?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(n)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(n)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(n,e))}),i)),this.fireEvent("onGlobalObjectiveUpdated",{objectiveId:e,data:t,timestamp:(new Date).toISOString()})}catch(t){this.fireEvent("onGlobalObjectiveUpdateError",{objectiveId:e,error:Wr(t,Error)?t.message:t+"",timestamp:(new Date).toISOString()})}var i,n}},{key:"synchronize",value:function(e,t){e&&t.processGlobalObjectiveMapping(e,this.globalObjectiveMap)}},{key:"getObjective",value:function(e){return this.globalObjectiveMap.get(e)}},{key:"hasObjective",value:function(e){return this.globalObjectiveMap.has(e)}},{key:"getObjectiveIds",value:function(){return Array.from(this.globalObjectiveMap.keys())}},{key:"getObjectiveCount",value:function(){return this.globalObjectiveMap.size}},{key:"clear",value:function(){this.globalObjectiveMap.clear(),this.fireEvent("onGlobalObjectiveMapCleared",{timestamp:(new Date).toISOString()})}},{key:"serialize",value:function(){var e={};return this.globalObjectiveMap.forEach(function(t,id){e[id]=Jr({},t)}),e}},{key:"restore",value:function(e){if(this.globalObjectiveMap.clear(),e){var t=!0,i=!1,n=void 0;try{for(var r,o=Object.entries(e)[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=$r(r.value,2);this.globalObjectiveMap.set(a[0],Jr({},a[1]))}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}this.fireEvent("onGlobalObjectiveMapRestored",{objectiveCount:this.globalObjectiveMap.size,timestamp:(new Date).toISOString()})}}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire global objective event ".concat(e,": ").concat(t))}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var eo=Object.defineProperty,to=function(e,t,i){return function(e,t,i){return t in e?eo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},io=function(){function e(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),to(this,"activityTree"),to(this,"globalObjectiveService"),to(this,"rollupProcess"),to(this,"adlNav"),to(this,"eventCallback"),to(this,"getEffectiveHideLmsUiCallback",null),to(this,"getEffectiveAuxiliaryResourcesCallback",null),to(this,"contentDeliveredGetter",null),to(this,"contentDeliveredSetter",null),this.activityTree=t,this.globalObjectiveService=i,this.rollupProcess=n,this.adlNav=r,this.eventCallback=o}return t=e,(i=[{key:"setGetEffectiveHideLmsUiCallback",value:function(e){this.getEffectiveHideLmsUiCallback=e}},{key:"setGetEffectiveAuxiliaryResourcesCallback",value:function(e){this.getEffectiveAuxiliaryResourcesCallback=e}},{key:"setContentDeliveredAccessors",value:function(e,t){this.contentDeliveredGetter=e,this.contentDeliveredSetter=t}},{key:"getState",value:function(){var e,t;return{version:"1.0",timestamp:(new Date).toISOString(),contentDelivered:!!this.contentDeliveredGetter&&this.contentDeliveredGetter(),currentActivity:(null===(e=this.activityTree.currentActivity)||void 0===e?void 0:e.id)||null,suspendedActivity:(null===(t=this.activityTree.suspendedActivity)||void 0===t?void 0:t.id)||null,activityStates:this.serializeActivities(),navigationState:this.getNavigationState(),globalObjectiveMap:this.globalObjectiveService.getSnapshot()}}},{key:"restoreState",value:function(e){try{if(!e||"1.0"!==e.version)return console.warn("Incompatible sequencing state version"),!1;if(this.contentDeliveredSetter&&this.contentDeliveredSetter(e.contentDelivered||!1),e.globalObjectiveMap&&this.globalObjectiveService.restoreSnapshot(e.globalObjectiveMap),e.activityStates&&this.deserializeActivities(e.activityStates),e.currentActivity){var t=this.activityTree.getActivity(e.currentActivity);t&&(this.activityTree.currentActivity=t,t.isActive=!0)}if(e.suspendedActivity){var i=this.activityTree.getActivity(e.suspendedActivity);i&&(this.activityTree.suspendedActivity=i,i.isSuspended=!0)}return e.navigationState&&this.restoreNavigationState(e.navigationState),this.activityTree.root&&this.globalObjectiveService.synchronize(this.activityTree.root,this.rollupProcess),console.debug("Sequencing state restored successfully"),!0}catch(e){return console.error("Failed to restore sequencing state: ".concat(e)),!1}}},{key:"serializeActivities",value:function(){var e={},t=function(i){e[i.id]={id:i.id,title:i.title,isActive:i.isActive,isSuspended:i.isSuspended,isCompleted:i.isCompleted,completionStatus:i.completionStatus,successStatus:i.successStatus,attemptCount:i.attemptCount,attemptCompletionAmount:i.attemptCompletionAmount,attemptAbsoluteDuration:i.attemptAbsoluteDuration,attemptExperiencedDuration:i.attemptExperiencedDuration,activityAbsoluteDuration:i.activityAbsoluteDuration,activityExperiencedDuration:i.activityExperiencedDuration,objectiveSatisfiedStatus:i.objectiveSatisfiedStatus,objectiveMeasureStatus:i.objectiveMeasureStatus,objectiveNormalizedMeasure:i.objectiveNormalizedMeasure,progressMeasure:i.progressMeasure,progressMeasureStatus:i.progressMeasureStatus,isAvailable:i.isAvailable,isHiddenFromChoice:i.isHiddenFromChoice,location:i.location,attemptAbsoluteStartTime:i.attemptAbsoluteStartTime,objectives:i.getObjectiveStateSnapshot(),auxiliaryResources:i.auxiliaryResources,selectionRandomizationState:{selectionCountStatus:i.sequencingControls.selectionCountStatus,reorderChildren:i.sequencingControls.reorderChildren,childOrder:i.children.map(function(e){return e.id}),selectedChildIds:i.children.filter(function(e){return e.isAvailable}).map(function(e){return e.id}),hiddenFromChoiceChildIds:i.children.filter(function(e){return e.isHiddenFromChoice}).map(function(e){return e.id})}};var n=!0,r=!1,o=void 0;try{for(var a,s=i.children[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)t(a.value)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}};return this.activityTree.root&&t(this.activityTree.root),e}},{key:"deserializeActivities",value:function(e){var t=function(i){var n,r=e[i.id];r&&(i.isActive=r.isActive||!1,i.isSuspended=r.isSuspended||!1,i.isCompleted=r.isCompleted||!1,i.completionStatus=r.completionStatus||"unknown",i.successStatus=r.successStatus||"unknown",i.attemptCount=r.attemptCount||0,i.attemptCompletionAmount=r.attemptCompletionAmount||0,i.attemptAbsoluteDuration=r.attemptAbsoluteDuration||"PT0H0M0S",i.attemptExperiencedDuration=r.attemptExperiencedDuration||"PT0H0M0S",i.activityAbsoluteDuration=r.activityAbsoluteDuration||"PT0H0M0S",i.activityExperiencedDuration=r.activityExperiencedDuration||"PT0H0M0S",i.objectiveSatisfiedStatus=r.objectiveSatisfiedStatus||!1,i.objectiveMeasureStatus=r.objectiveMeasureStatus||!1,i.objectiveNormalizedMeasure=r.objectiveNormalizedMeasure||0,i.progressMeasure=null!==(n=r.progressMeasure)&&void 0!==n?n:0,i.progressMeasureStatus=r.progressMeasureStatus||!1,i.isAvailable=!1!==r.isAvailable,i.isHiddenFromChoice=!0===r.isHiddenFromChoice,i.location=r.location||"",i.attemptAbsoluteStartTime=r.attemptAbsoluteStartTime||"",Array.isArray(r.auxiliaryResources)&&(i.auxiliaryResources=r.auxiliaryResources),r.objectives&&i.applyObjectiveStateSnapshot(r.objectives));var o=!0,a=!1,s=void 0;try{for(var c,l=i.children[Symbol.iterator]();!(o=(c=l.next()).done);o=!0)t(c.value)}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}if(null==r?void 0:r.selectionRandomizationState){var u=r.selectionRandomizationState,d=i.sequencingControls;void 0!==u.selectionCountStatus&&(d.selectionCountStatus=u.selectionCountStatus),void 0!==u.reorderChildren&&(d.reorderChildren=u.reorderChildren),u.childOrder&&u.childOrder.length>0&&i.setChildOrder(u.childOrder);var f=Array.isArray(u.selectedChildIds)?new Set(u.selectedChildIds):null,v=Array.isArray(u.hiddenFromChoiceChildIds)?new Set(u.hiddenFromChoiceChildIds):null;if(f||v){var h=!0,m=!1,p=void 0;try{for(var y,g=i.children[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var _=y.value;if(f){var b=f.has(_.id);_.isAvailable=b,v||(_.isHiddenFromChoice=!b)}v&&(_.isHiddenFromChoice=v.has(_.id))}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}i.setProcessedChildren(i.children.filter(function(e){return e.isAvailable}))}else i.resetProcessedChildren()};this.activityTree.root&&t(this.activityTree.root)}},{key:"getNavigationState",value:function(){var e,t,i,n,r,o,a;if(!this.adlNav)return null;var s=this.getEffectiveHideLmsUiCallback?this.getEffectiveHideLmsUiCallback(this.activityTree.currentActivity):[],c=this.getEffectiveAuxiliaryResourcesCallback?this.getEffectiveAuxiliaryResourcesCallback(this.activityTree.currentActivity):[];return{request:this.adlNav.request||"_none_",requestValid:{continue:(null===(e=this.adlNav.request_valid)||void 0===e?void 0:e.continue)||"false",previous:(null===(t=this.adlNav.request_valid)||void 0===t?void 0:t.previous)||"false",choice:"unknown",jump:"unknown",exit:(null===(i=this.adlNav.request_valid)||void 0===i?void 0:i.exit)||"false",exitAll:(null===(n=this.adlNav.request_valid)||void 0===n?void 0:n.exitAll)||"false",abandon:(null===(r=this.adlNav.request_valid)||void 0===r?void 0:r.abandon)||"false",abandonAll:(null===(o=this.adlNav.request_valid)||void 0===o?void 0:o.abandonAll)||"false",suspendAll:(null===(a=this.adlNav.request_valid)||void 0===a?void 0:a.suspendAll)||"false"},hideLmsUi:s,auxiliaryResources:c}}},{key:"restoreNavigationState",value:function(e){if(this.adlNav&&e)try{if(e.requestValid){var t=e.requestValid;this.adlNav.request_valid.continue=t.continue||"false",this.adlNav.request_valid.previous=t.previous||"false",this.adlNav.request_valid.exit=t.exit||"false",this.adlNav.request_valid.exitAll=t.exitAll||"false",this.adlNav.request_valid.abandon=t.abandon||"false",this.adlNav.request_valid.abandonAll=t.abandonAll||"false",this.adlNav.request_valid.suspendAll=t.suspendAll||"false"}}catch(e){console.warn("Could not fully restore navigation state: ".concat(e))}}},{key:"getSuspensionState",value:function(){var e,t,i={activityTree:this.activityTree.root?this.activityTree.root.getSuspensionState():null,currentActivityId:(null===(e=this.activityTree.currentActivity)||void 0===e?void 0:e.id)||null,suspendedActivityId:(null===(t=this.activityTree.suspendedActivity)||void 0===t?void 0:t.id)||null,globalObjectives:this.globalObjectiveService.getSnapshot(),timestamp:(new Date).toISOString()};return this.fireEvent("onSuspensionStateCaptured",{hasActivityTree:!!i.activityTree,currentActivityId:i.currentActivityId,suspendedActivityId:i.suspendedActivityId,globalObjectiveCount:Object.keys(i.globalObjectives).length,timestamp:i.timestamp}),i}},{key:"restoreSuspensionState",value:function(e){var t,i;if(e)try{if(e.globalObjectives&&this.globalObjectiveService.restoreSnapshot(e.globalObjectives),e.activityTree&&this.activityTree.root&&this.activityTree.root.restoreSuspensionState(e.activityTree),e.currentActivityId){var n=this.activityTree.getActivity(e.currentActivityId);n&&(this.activityTree.currentActivity=n)}if(e.suspendedActivityId){var r=this.activityTree.getActivity(e.suspendedActivityId);r&&(this.activityTree.suspendedActivity=r)}this.fireEvent("onSuspensionStateRestored",{currentActivityId:e.currentActivityId,suspendedActivityId:e.suspendedActivityId,globalObjectiveCount:e.globalObjectives?Object.keys(e.globalObjectives).length:0,originalTimestamp:e.timestamp,restoreTimestamp:(new Date).toISOString()})}catch(e){throw this.fireEvent("onSuspensionStateRestoreError",{error:(t=e,i=Error,(null!=i&&"undefined"!=typeof Symbol&&i[Symbol.hasInstance]?i[Symbol.hasInstance](t):t instanceof i)?e.message:e+""),timestamp:(new Date).toISOString()}),e}else this.fireEvent("onSuspensionStateRestoreError",{error:"No suspension state provided",timestamp:(new Date).toISOString()})}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire state manager event ".concat(e,": ").concat(t))}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function no(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function ro(e){return function(e){if(Array.isArray(e))return no(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return no(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?no(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var oo=Object.defineProperty,ao=function(e,t,i){return function(e,t,i){return t in e?oo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},so=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ao(this,"activityTree"),ao(this,"eventCallback"),ao(this,"now"),ao(this,"contentDeliveredGetter",null),this.activityTree=t,this.eventCallback=i,this.now=(null==n?void 0:n.now)||function(){return new Date}}return t=e,(i=[{key:"setContentDeliveredGetter",value:function(e){this.contentDeliveredGetter=e}},{key:"validateTreeConsistency",value:function(e){if(!this.activityTree.root)return{consistent:!1,exception:"DB.1.1-4"};if(!this.isActivityPartOfTree(e,this.activityTree.root))return{consistent:!1,exception:"DB.1.1-5"};var t=this.getActiveActivities();if(t.length>1)return this.fireEvent("onStateInconsistency",{activeActivities:t.map(function(e){return e.id}),targetActivity:e.id}),{consistent:!1,exception:"DB.1.1-6"};for(var i=e;null==i?void 0:i.parent;){if(!i.parent.children.includes(i))return{consistent:!1,exception:"DB.1.1-7"};i=i.parent}return{consistent:!0,exception:null}}},{key:"validateResources",value:function(e){var t=this.getRequiredResources(e),i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(!this.isResourceAvailable(o.value))return{available:!1,exception:"DB.1.1-8"}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return this.checkSystemLimits().adequate?{available:!0,exception:null}:{available:!1,exception:"DB.1.1-9"}}},{key:"validateConcurrentDelivery",value:function(e){return this.contentDeliveredGetter&&this.contentDeliveredGetter()&&this.activityTree.currentActivity&&this.activityTree.currentActivity!==e?{allowed:!1,exception:"DB.1.1-10"}:this.hasPendingDeliveryRequests()?{allowed:!1,exception:"DB.1.1-11"}:this.isDeliveryLocked()?{allowed:!1,exception:"DB.1.1-12"}:{allowed:!0,exception:null}}},{key:"validateDependencies",value:function(e){var t=this.getPrerequisites(e),i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(!this.isPrerequisiteSatisfied(o.value,e))return{satisfied:!1,exception:"DB.1.1-13"}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}var s=this.getObjectiveDependencies(e),c=!0,l=!1,u=void 0;try{for(var d,f=s[Symbol.iterator]();!(c=(d=f.next()).done);c=!0)if(!this.isObjectiveDependencySatisfied(d.value))return{satisfied:!1,exception:"DB.1.1-14"}}catch(e){l=!0,u=e}finally{try{c||null==f.return||f.return()}finally{if(l)throw u}}return this.getSequencingRuleDependencies(e).satisfied?{satisfied:!0,exception:null}:{satisfied:!1,exception:"DB.1.1-15"}}},{key:"checkActivity",value:function(e){return!!e.isAvailable&&!!this.checkLimitConditions(e)}},{key:"checkLimitConditions",value:function(e){var result=!0,t="";if(null!==e.attemptLimit&&e.attemptLimit>0&&(e.attemptLimit>e.attemptCount||(result=!1,t="Attempt limit exceeded")),result&&e.attemptAbsoluteDurationLimit){var i=c(e.attemptAbsoluteDurationLimit,He);i>0&&(i>c(e.attemptAbsoluteDuration||"PT0H0M0S",He)||(result=!1,t="Attempt duration limit exceeded"))}if(result&&e.activityAbsoluteDurationLimit){var n=c(e.activityAbsoluteDurationLimit,He);n>0&&(n>c(e.activityAbsoluteDuration||"PT0H0M0S",He)||(result=!1,t="Activity duration limit exceeded"))}if(result&&e.beginTimeLimit){var r=this.now();new Date(e.beginTimeLimit)>r&&(result=!1,t="Not yet time to begin")}return result&&e.endTimeLimit&&this.now()>new Date(e.endTimeLimit)&&(result=!1,t="Time limit expired"),this.fireEvent("onLimitConditionCheck",{activity:e,result:result,failureReason:t,checks:{attemptLimit:e.attemptLimit,attemptCount:e.attemptCount,attemptDurationLimit:e.attemptAbsoluteDurationLimit,activityDurationLimit:e.activityAbsoluteDurationLimit,beginTimeLimit:e.beginTimeLimit,endTimeLimit:e.endTimeLimit}}),result}},{key:"isActivityPartOfTree",value:function(e,t){if(e===t)return!0;var i=!0,n=!1,r=void 0;try{for(var o,a=t.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(this.isActivityPartOfTree(e,o.value))return!0}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return!1}},{key:"getActiveActivities",value:function(){var e=[];return this.activityTree.root&&this.collectActiveActivities(this.activityTree.root,e),e}},{key:"collectActiveActivities",value:function(e,t){e.isActive&&t.push(e);var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)this.collectActiveActivities(o.value,t)}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}},{key:"getRequiredResources",value:function(e){var t=[],i=(e.title+" "+e.location).toLowerCase();return(i.includes("video")||i.includes("multimedia"))&&t.push("video-codec"),(i.includes("audio")||i.includes("sound"))&&t.push("audio-codec"),(i.includes("flash")||i.includes(".swf"))&&t.push("flash-plugin"),(i.includes("java")||i.includes("applet"))&&t.push("java-runtime"),e.children&&e.children.length>0&&t.push("high-bandwidth"),e.attemptAbsoluteDurationLimit&&this.parseDurationToMinutes(e.attemptAbsoluteDurationLimit)>60&&t.push("extended-storage"),e.attemptLimit&&e.attemptLimit>1&&t.push("persistent-storage"),t}},{key:"isResourceAvailable",value:function(e){try{switch(e){case"video-codec":return!!document.createElement("video").canPlayType;case"audio-codec":return!!document.createElement("audio").canPlayType;case"flash-plugin":return navigator.plugins&&Array.from(navigator.plugins).some(function(e){return"Shockwave Flash"===e.name});case"java-runtime":return navigator.plugins&&Array.from(navigator.plugins).some(function(e){return"Java"===e.name});case"high-bandwidth":if("connection"in navigator){var t=navigator.connection;return"4g"===t.effectiveType||t.downlink>5}return!0;case"extended-storage":default:return!0;case"persistent-storage":return"localStorage"in window&&"sessionStorage"in window}}catch(e){return!1}}},{key:"checkSystemLimits",value:function(){try{var e=!0;if("memory"in performance){var t=performance.memory;t.usedJSHeapSize/t.jsHeapSizeLimit>.8&&(e=!1)}if("deviceMemory"in navigator&&2>navigator.deviceMemory&&(e=!1),"hardwareConcurrency"in navigator&&2>navigator.hardwareConcurrency&&(e=!1),"connection"in navigator){var i=navigator.connection;(i.saveData||"slow-2g"===i.effectiveType)&&(e=!1)}return{adequate:e}}catch(e){return{adequate:!0}}}},{key:"hasPendingDeliveryRequests",value:function(){return this.activityTree&&this.activityTree.pendingRequests?this.activityTree.pendingRequests.length>0:!("undefined"==typeof window||!window.pendingScormRequests)&&window.pendingScormRequests>0}},{key:"isDeliveryLocked",value:function(){return!((!this.activityTree||!this.activityTree.navigationLocked)&&(!this.activityTree||!this.activityTree.terminationInProgress)&&this.checkSystemLimits().adequate&&("undefined"==typeof window||!window.scormMaintenanceMode))}},{key:"getPrerequisites",value:function(e){var t,i=[];if(e.sequencingRules&&e.sequencingRules.preConditionRules){var n=!0,r=!1,o=void 0;try{for(var a,s=e.sequencingRules.preConditionRules[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;if(c.conditions&&c.conditions.length>0){var l=!0,u=!1,d=void 0;try{for(var f,v=c.conditions[Symbol.iterator]();!(l=(f=v.next()).done);l=!0){var h=f.value;h.referencedObjectiveID&&h.referencedObjectiveID!==e.id&&i.push(h.referencedObjectiveID)}}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}if(e.parent&&e.sequencingControls&&!e.sequencingControls.choiceExit){var m=e.parent.children;if(m)for(var p=m.indexOf(e),y=0;p>y;y++){var g=m[y];g&&i.push(g.id)}}return e.prerequisiteActivities&&(t=i).push.apply(t,ro(e.prerequisiteActivities)),Array.from(new Set(i))}},{key:"isPrerequisiteSatisfied",value:function(e,t){var i=this.activityTree.getActivity(e);return!!i&&"completed"===i.completionStatus}},{key:"getObjectiveDependencies",value:function(e){var t=[],objectives=e.objectives;if(objectives&&objectives.length>0){var i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.globalObjectiveID&&t.push(s.globalObjectiveID),!s.satisfiedByMeasure&&s.readNormalizedMeasure&&t.push(s.id+"_measure")}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}if(e.sequencingRules){var c=ro(e.sequencingRules.preConditionRules||[]).concat(ro(e.sequencingRules.exitConditionRules||[]),ro(e.sequencingRules.postConditionRules||[])),l=!0,u=!1,d=void 0;try{for(var f,v=c[Symbol.iterator]();!(l=(f=v.next()).done);l=!0){var h=f.value;if(h.conditions&&h.conditions.length>0){var m=!0,p=!1,y=void 0;try{for(var g,_=h.conditions[Symbol.iterator]();!(m=(g=_.next()).done);m=!0){var b=g.value;b.objectiveReference&&b.objectiveReference!==e.id&&t.push(b.objectiveReference)}}catch(e){p=!0,y=e}finally{try{m||null==_.return||_.return()}finally{if(p)throw y}}}}}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}}return Array.from(new Set(t))}},{key:"isObjectiveDependencySatisfied",value:function(e){if(this.activityTree&&this.activityTree.globalObjectives){var t=this.activityTree.globalObjectives[e];if(t)return!0===t.satisfied&&!0===t.statusKnown}if(e.endsWith("_measure")){var i=e.replace("_measure","");if(this.activityTree&&this.activityTree.globalObjectives){var n=this.activityTree.globalObjectives[i];if(n)return!0===n.measureKnown&&n.normalizedMeasure>=0}}var r=this.activityTree.getActivity(e);return!!r&&r.objectiveSatisfiedStatus&&r.objectiveMeasureStatus}},{key:"getSequencingRuleDependencies",value:function(e){var t=!0;try{if(e.sequencingRules&&e.sequencingRules.preConditionRules){var i=!0,n=!1,r=void 0;try{for(var o,a=e.sequencingRules.preConditionRules[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.conditions&&s.conditions.length>0){var c=!0,l=!1,u=void 0;try{for(var d,f=s.conditions[Symbol.iterator]();!(c=(d=f.next()).done);c=!0){var v=d.value;switch(v.conditionType||v.condition){case"activityProgressKnown":e.progressMeasureStatus||(t=!1);break;case"objectiveStatusKnown":case"objectiveSatisfied":this.isObjectiveDependencySatisfied(v.referencedObjectiveID||e.id)||(t=!1);break;case"attemptLimitExceeded":null===e.attemptLimit&&(t=!1);break;case"timeLimitExceeded":e.attemptAbsoluteDurationLimit||e.activityAbsoluteDurationLimit||(t=!1);break;case"always":case"never":break;default:t=!1}}}catch(e){l=!0,u=e}finally{try{c||null==f.return||f.return()}finally{if(l)throw u}}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}if(e.sequencingRules&&e.sequencingRules.exitConditionRules){var h=!0,m=!1,p=void 0;try{for(var y,g=e.sequencingRules.exitConditionRules[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var _=y.value;if(_.conditions&&_.conditions.length>0){var b=!0,S=!1,w=void 0;try{for(var O,C=_.conditions[Symbol.iterator]();!(b=(O=C.next()).done);b=!0){var E=O.value;["objectiveStatusKnown","objectiveSatisfied"].includes(E.conditionType||E.condition)&&(this.isObjectiveDependencySatisfied(E.referencedObjectiveID||e.id)||(t=!1))}}catch(e){S=!0,w=e}finally{try{b||null==C.return||C.return()}finally{if(S)throw w}}}}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}if(e.rollupRules&&e.rollupRules.rules){var A=!0,k=!1,j=void 0;try{for(var R,M=e.rollupRules.rules[Symbol.iterator]();!(A=(R=M.next()).done);A=!0){var T=R.value;if(T.conditions&&T.conditions.length>0&&e.children&&e.children.length>0){var x=!0,I=!1,P=void 0;try{for(var N,D=e.children[Symbol.iterator]();!(x=(N=D.next()).done);x=!0)if(!N.value.isCompleted){t=!1;break}}catch(e){I=!0,P=e}finally{try{x||null==D.return||D.return()}finally{if(I)throw P}}}}}catch(e){k=!0,j=e}finally{try{A||null==M.return||M.return()}finally{if(k)throw j}}}}catch(e){t=!1}return{satisfied:t}}},{key:"parseDurationToMinutes",value:function(e){return c(e,He)/60}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire delivery validator event ".concat(e,": ").concat(t))}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var co=Object.defineProperty,lo=function(e,t,i){return function(e,t,i){return t in e?co(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},uo=function(){function e(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5?arguments[5]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),lo(this,"activityTree"),lo(this,"sequencingProcess"),lo(this,"rollupProcess"),lo(this,"adlNav"),lo(this,"eventCallback",null),lo(this,"terminationHandler"),lo(this,"deliveryHandler"),lo(this,"navigationValidityService"),lo(this,"globalObjectiveService"),lo(this,"stateManager"),lo(this,"deliveryValidator"),lo(this,"navigationLookAhead"),lo(this,"enhancedDeliveryValidation"),lo(this,"is4thEdition"),this.activityTree=t,this.sequencingProcess=i,this.rollupProcess=n,this.adlNav=r,this.eventCallback=o,this.enhancedDeliveryValidation=!0===(null==a?void 0:a.enhancedDeliveryValidation),this.is4thEdition=(null==a?void 0:a.is4thEdition)||!1,this.globalObjectiveService=new Zr(o||void 0),this.globalObjectiveService.initialize(t.root);var s={};(null==a?void 0:a.now)&&(s.now=a.now),this.deliveryValidator=new so(t,o,s);var c={};(null==a?void 0:a.getCMIData)&&(c.getCMIData=a.getCMIData),void 0!==(null==a?void 0:a.is4thEdition)&&(c.is4thEdition=a.is4thEdition),this.terminationHandler=new Ar(t,i,n,this.globalObjectiveService.getMap(),o,c);var l={};(null==a?void 0:a.now)&&(l.now=a.now),(null==a?void 0:a.defaultHideLmsUi)&&(l.defaultHideLmsUi=a.defaultHideLmsUi),(null==a?void 0:a.defaultAuxiliaryResources)&&(l.defaultAuxiliaryResources=a.defaultAuxiliaryResources),this.deliveryHandler=new Dr(t,n,this.globalObjectiveService.getMap(),r,o,l),this.navigationValidityService=new Gr(t,i,r,o),this.stateManager=new io(t,this.globalObjectiveService,n,r,o),this.navigationLookAhead=this.navigationValidityService.getNavigationLookAhead(),this.setupCallbacks()}return t=e,i=[{key:"setupCallbacks",value:function(){var e=this;this.terminationHandler.setInvalidateCacheCallback(function(){e.navigationLookAhead.invalidateCache()}),this.deliveryHandler.setCheckActivityCallback(function(t){return e.deliveryValidator.checkActivity(t)}),this.deliveryHandler.setInvalidateCacheCallback(function(){e.navigationLookAhead.invalidateCache()}),this.deliveryHandler.setUpdateNavigationValidityCallback(function(){e.navigationValidityService.updateNavigationValidity()}),this.deliveryHandler.setClearSuspendedActivityCallback(function(){e.terminationHandler.clearSuspendedActivity()}),this.deliveryValidator.setContentDeliveredGetter(function(){return e.deliveryHandler.hasContentBeenDelivered()}),this.navigationValidityService.setGetEffectiveHideLmsUiCallback(function(t){return e.deliveryHandler.getEffectiveHideLmsUi(t)}),this.stateManager.setGetEffectiveHideLmsUiCallback(function(t){return e.deliveryHandler.getEffectiveHideLmsUi(t)}),this.stateManager.setGetEffectiveAuxiliaryResourcesCallback(function(t){return e.deliveryHandler.getEffectiveAuxiliaryResources(t)}),this.stateManager.setContentDeliveredAccessors(function(){return e.deliveryHandler.hasContentBeenDelivered()},function(t){return e.deliveryHandler.setContentDelivered(t)})}},{key:"processNavigationRequest",value:function(e){var t=arguments.length>2?arguments[2]:void 0,i=this.navigationValidityService.validateRequest(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null);if(!i.valid)return new Pr(!1,null,i.exception);if(i.terminationRequest){var n=!!i.sequencingRequest,r=this.terminationHandler.processTerminationRequest(i.terminationRequest,n,t);if(!r.valid)return new Pr(!1,null,r.exception||"TB.2.3-1");if(null!==r.sequencingRequest&&(n||r.sequencingRequest!==Pt.EXIT)&&(i.sequencingRequest=r.sequencingRequest),!i.sequencingRequest)return i.terminationRequest!==Pt.EXIT_ALL&&i.terminationRequest!==Pt.ABANDON_ALL||this.fireEvent("onSequencingSessionEnd",{reason:i.terminationRequest===Pt.EXIT_ALL?"exit_all":"abandon_all",navigationRequest:e}),new Pr(!0,null)}if(i.sequencingRequest){var o=this.sequencingProcess.sequencingRequestProcess(i.sequencingRequest,i.targetActivityId);if(o.endSequencingSession)return this.fireEvent("onSequencingSessionEnd",{reason:"end_of_content",exception:o.exception,navigationRequest:e}),new Pr(!1,null,o.exception||"SESSION_ENDED");if(o.exception)return new Pr(!1,null,o.exception);if(o.deliveryRequest===Nt.DELIVER&&o.targetActivity)return this.activityTree.root&&(this.rollupProcess.validateRollupStateConsistency(this.activityTree.root)||this.fireEvent("onSequencingDebug",{message:"Rollup state inconsistency detected before delivery",activityId:this.activityTree.root.id})),this.rollupProcess.processGlobalObjectiveMapping(o.targetActivity,this.globalObjectiveService.getMap()),this.processDelivery(o.targetActivity)}return new Pr(!1,null,"OP.1-1")}},{key:"processDelivery",value:function(e){if(this.enhancedDeliveryValidation){var t=this.deliveryValidator.validateTreeConsistency(e);if(!t.consistent)return new Pr(!1,null,t.exception);var i=this.deliveryValidator.validateResources(e);if(!i.available)return new Pr(!1,null,i.exception);var n=this.deliveryValidator.validateConcurrentDelivery(e);if(!n.allowed)return new Pr(!1,null,n.exception);var r=this.deliveryValidator.validateDependencies(e);if(!r.satisfied)return new Pr(!1,null,r.exception)}var o=this.deliveryHandler.processDeliveryRequest(e);return o.valid&&(this.deliveryHandler.contentDeliveryEnvironmentProcess(o.targetActivity),this.navigationLookAhead.invalidateCache(),this.activityTree.root&&this.rollupProcess.validateRollupStateConsistency(this.activityTree.root)),o}},{key:"hasContentBeenDelivered",value:function(){return this.deliveryHandler.hasContentBeenDelivered()}},{key:"isDeliveryInProgress",value:function(){return this.deliveryHandler.isDeliveryInProgress()}},{key:"resetContentDelivered",value:function(){this.deliveryHandler.resetContentDelivered()}},{key:"setContentDelivered",value:function(e){this.deliveryHandler.setContentDelivered(e)}},{key:"updateNavigationValidity",value:function(){this.navigationValidityService.updateNavigationValidity()}},{key:"synchronizeGlobalObjectives",value:function(){this.globalObjectiveService.synchronize(this.activityTree.root,this.rollupProcess)}},{key:"getGlobalObjectiveMap",value:function(){return this.globalObjectiveService.getMap()}},{key:"getGlobalObjectiveMapSnapshot",value:function(){return this.globalObjectiveService.getSnapshot()}},{key:"restoreGlobalObjectiveMapSnapshot",value:function(e){this.globalObjectiveService.restoreSnapshot(e)}},{key:"updateGlobalObjective",value:function(e,t){this.globalObjectiveService.updateObjective(e,t)}},{key:"getSequencingState",value:function(){return this.stateManager.getState()}},{key:"restoreSequencingState",value:function(e){return this.stateManager.restoreState(e)}},{key:"getSuspensionState",value:function(){return this.stateManager.getSuspensionState()}},{key:"restoreSuspensionState",value:function(e){this.stateManager.restoreSuspensionState(e)}},{key:"getNavigationLookAhead",value:function(){return this.navigationValidityService.getAllPredictions()}},{key:"predictContinueEnabled",value:function(){return this.navigationValidityService.predictContinueEnabled()}},{key:"predictPreviousEnabled",value:function(){return this.navigationValidityService.predictPreviousEnabled()}},{key:"predictChoiceEnabled",value:function(e){return this.navigationValidityService.predictChoiceEnabled(e)}},{key:"getAvailableChoices",value:function(){return this.navigationValidityService.getAvailableChoices()}},{key:"invalidateNavigationCache",value:function(){this.navigationValidityService.invalidateCache()}},{key:"applyDeliveryControls",value:function(e){e.sequencingControls.completionSetByContent||e.completionStatus===Ce&&(e.completionStatus=we,e.wasAutoCompleted=!0),e.sequencingControls.objectiveSetByContent||e.successStatus===Se&&(e.successStatus=_e,e.wasAutoSatisfied=!0)}},{key:"getEffectiveHideLmsUi",value:function(e){return this.deliveryHandler.getEffectiveHideLmsUi(e)}},{key:"getEffectiveAuxiliaryResources",value:function(e){return this.deliveryHandler.getEffectiveAuxiliaryResources(e)}},{key:"getContentActivityData",value:function(e){return this.deliveryHandler.getContentActivityData(e)}},{key:"terminationRequestProcess",value:function(request,e,t){return this.terminationHandler.processTerminationRequest(request,e,t)}},{key:"contentDeliveryEnvironmentProcess",value:function(e){this.deliveryHandler.contentDeliveryEnvironmentProcess(e)}},{key:"endAttemptProcess",value:function(e){this.terminationHandler.endAttempt(e)}},{key:"handleExitTermination",value:function(e,t){return this.terminationHandler.handleExitTermination(e,t)}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function fo(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function vo(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ho(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){vo(e,t,i[t])})}return e}function mo(e){return function(e){if(Array.isArray(e))return fo(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return fo(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?fo(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var po=Object.defineProperty,yo=function(e,t,i){return function(e,t,i){return t in e?po(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},go=function(){function e(t,cmi,adl,i,n){var r=this,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),yo(this,"sequencing"),yo(this,"cmi"),yo(this,"adl"),yo(this,"eventService"),yo(this,"loggingService"),yo(this,"activityDeliveryService"),yo(this,"rollupProcess"),yo(this,"overallSequencingProcess",null),yo(this,"sequencingProcess",null),yo(this,"eventListeners",{}),yo(this,"configuration"),yo(this,"isInitialized",!1),yo(this,"isSequencingActive",!1),yo(this,"lastCMIValues",new Map),yo(this,"lastSequencingResult",null),this.sequencing=t,this.cmi=cmi,this.adl=adl,this.eventService=i,this.loggingService=n,this.configuration=ho({autoRollupOnCMIChange:!0,autoProgressOnCompletion:!1,validateNavigationRequests:!0,enableEventSystem:!0,logLevel:"info",now:function(){return new Date}},o),this.activityDeliveryService=new wi(i,n,{onDeliverActivity:function(e){return r.handleActivityDelivery(e)},onUnloadActivity:function(e){return r.handleActivityUnload(e)},onSequencingComplete:function(result){return r.handleSequencingComplete(result)},onSequencingError:function(e){return r.handleSequencingError(e)}}),this.rollupProcess=new pr,this.configuration.now&&Ot.setNowProvider(this.configuration.now),this.setupCMIChangeWatchers(),this.createSequencingProcesses()}return t=e,i=[{key:"createSequencingProcesses",value:function(){var e=this;try{if(this.sequencing.initialized||this.sequencing.initialize(),this.sequencing.adlNav=this.adl.nav,this.sequencing.activityTree.root){var t={};this.configuration.now&&(t.now=this.configuration.now),this.configuration.getAttemptElapsedSeconds&&(t.getAttemptElapsedSeconds=this.configuration.getAttemptElapsedSeconds),this.configuration.getActivityElapsedSeconds&&(t.getActivityElapsedSeconds=this.configuration.getActivityElapsedSeconds),this.sequencingProcess=new gi(this.sequencing.activityTree,this.sequencing.sequencingRules,this.sequencing.sequencingControls,this.adl.nav,t);var i={};this.configuration.now&&(i.now=this.configuration.now),i.defaultHideLmsUi=mo(this.sequencing.hideLmsUi),this.sequencing.auxiliaryResources.length>0&&(i.defaultAuxiliaryResources=this.sequencing.auxiliaryResources.map(function(e){return{resourceId:e.resourceId,purpose:e.purpose}})),i.getCMIData=function(){return e.getCMIDataForTransfer()},this.overallSequencingProcess=new uo(this.sequencing.activityTree,this.sequencingProcess,this.rollupProcess,this.adl.nav,function(t,i){return e.handleSequencingProcessEvent(t,i)},i),this.sequencing.overallSequencingProcess=this.overallSequencingProcess,this.isInitialized=!0,this.log("info","Sequencing processes created and ready for navigation")}}catch(e){this.log("error","Failed to create sequencing processes: ".concat(e))}}},{key:"initialize",value:function(){try{return this.log("info","Initializing sequencing service for SCO session"),this.isInitialized||this.createSequencingProcesses(),this.shouldAutoStartSequencing()&&!this.isSequencingActive&&this.startSequencing(),this.initializeCMITracking(),this.fireEvent("onSequencingStart",this.sequencing.getCurrentActivity()),this.log("info","Sequencing service initialized successfully"),z}catch(t){var e="Failed to initialize sequencing service: ".concat(t);return this.log("error",e),this.fireEvent("onSequencingError",e,"initialization"),F}}},{key:"terminate",value:function(){try{return this.log("info","Terminating sequencing service"),this.triggerFinalRollup(),this.endSequencing(),this.isInitialized=!1,this.fireEvent("onSequencingEnd"),this.log("info","Sequencing service terminated successfully"),z}catch(t){var e="Failed to terminate sequencing service: ".concat(t);return this.log("error",e),this.fireEvent("onSequencingError",e,"termination"),F}}},{key:"processNavigationRequest",value:function(request,e,t){if(!this.isInitialized||!this.overallSequencingProcess)return this.log("warn","Navigation request '".concat(request,"' ignored - sequencing not initialized")),!1;try{this.log("info","Processing navigation request: ".concat(request).concat(e?" (target: ".concat(e,")"):"").concat(t?" (exit: ".concat(t,")"):"")),this.fireEvent("onNavigationRequest",request,e);var i=this.parseNavigationRequest(request);if(null===i)return this.log("warn","Invalid navigation request: ".concat(request)),!1;var n=this.overallSequencingProcess.processNavigationRequest(i,e||null,t),r={deliveryRequest:n.valid?Nt.DELIVER:Nt.DO_NOT_DELIVER,targetActivity:n.targetActivity,exception:n.exception||null,endSequencingSession:!1};return this.lastSequencingResult=r,n.valid&&n.targetActivity?(this.activityDeliveryService.processSequencingResult(r),this.overallSequencingProcess.updateNavigationValidity(),this.log("info","Navigation request '".concat(request,"' resulted in activity delivery: ").concat(n.targetActivity.id)),!0):(n.exception?(this.log("warn","Navigation request '".concat(request,"' failed: ").concat(n.exception)),this.fireEvent("onSequencingError",n.exception,"navigation")):this.log("info","Navigation request '".concat(request,"' completed with no activity delivery")),n.valid)}catch(e){var o="Error processing navigation request '".concat(request,"': ").concat(e);return this.log("error",o),this.fireEvent("onSequencingError",o,"navigation"),!1}}},{key:"triggerRollupOnCMIChange",value:function(e,t,i){if(this.configuration.autoRollupOnCMIChange&&this.isInitialized&&["cmi.completion_status","cmi.success_status","cmi.score.scaled","cmi.score.raw","cmi.score.min","cmi.score.max","cmi.progress_measure","cmi.objectives.n.success_status","cmi.objectives.n.completion_status","cmi.objectives.n.score.scaled"].some(function(t){return e.startsWith(t)}))try{this.log("debug","Triggering rollup due to CMI change: ".concat(e," = ").concat(i," (was ").concat(t,")"));var n=this.sequencing.getCurrentActivity();if(!n)return void this.log("debug","No current activity for rollup");this.updateActivityFromCMI(n),this.rollupProcess.overallRollupProcess(n),this.overallSequencingProcess&&this.overallSequencingProcess.synchronizeGlobalObjectives(),this.overallSequencingProcess&&this.overallSequencingProcess.updateNavigationValidity(),this.fireEvent("onRollupComplete",n),this.log("debug","Rollup completed for activity: ".concat(n.id))}catch(e){var r="Error during rollup on CMI change: ".concat(e);this.log("error",r),this.fireEvent("onSequencingError",r,"rollup")}}},{key:"setEventListeners",value:function(e){this.eventListeners=ho({},this.eventListeners,e),this.log("debug","Sequencing event listeners updated")}},{key:"updateConfiguration",value:function(e){this.configuration=ho({},this.configuration,e),this.log("debug","Sequencing configuration updated")}},{key:"getSequencingState",value:function(){return{isInitialized:this.isInitialized,isActive:this.isSequencingActive,currentActivity:this.sequencing.getCurrentActivity(),rootActivity:this.sequencing.getRootActivity(),lastSequencingResult:this.lastSequencingResult}}},{key:"getOverallSequencingProcess",value:function(){return this.overallSequencingProcess}},{key:"isDeliveryInProgress",value:function(){var e,t;return null!==(e=null===(t=this.overallSequencingProcess)||void 0===t?void 0:t.isDeliveryInProgress())&&void 0!==e&&e}},{key:"setupCMIChangeWatchers",value:function(){}},{key:"initializeCMITracking",value:function(){this.lastCMIValues.set("cmi.completion_status",this.cmi.completion_status),this.lastCMIValues.set("cmi.success_status",this.cmi.success_status),this.lastCMIValues.set("cmi.progress_measure",this.cmi.progress_measure),this.cmi.score&&(this.lastCMIValues.set("cmi.score.scaled",this.cmi.score.scaled),this.lastCMIValues.set("cmi.score.raw",this.cmi.score.raw))}},{key:"shouldAutoStartSequencing",value:function(){return!(!this.sequencing.activityTree.root||this.sequencing.getCurrentActivity())}},{key:"startSequencing",value:function(){if(this.overallSequencingProcess)try{this.processNavigationRequest("start")&&(this.isSequencingActive=!0,this.log("info","Automatic sequencing started"))}catch(e){this.log("error","Failed to start automatic sequencing: ".concat(e))}}},{key:"endSequencing",value:function(){this.isSequencingActive=!1,this.activityDeliveryService.reset()}},{key:"triggerFinalRollup",value:function(){try{var e=this.sequencing.getCurrentActivity();e&&(this.updateActivityFromCMI(e),this.rollupProcess.overallRollupProcess(e),this.overallSequencingProcess&&this.overallSequencingProcess.synchronizeGlobalObjectives(),this.log("info","Final rollup completed"))}catch(e){this.log("error","Error during final rollup: ".concat(e))}}},{key:"updateActivityFromCMI",value:function(e){var t=!1;if(""!==this.cmi.progress_measure){var i=parseFloat(this.cmi.progress_measure);isNaN(i)||(t=!0,e.progressMeasure=i,e.progressMeasureStatus=!0,e.attemptCompletionAmount=i,e.attemptCompletionAmountStatus=!0)}if(t||(e.attemptCompletionAmountStatus=!1),e.completedByMeasure){var n=yr({completionThreshold:e.minProgressMeasure,progressMeasure:this.cmi.progress_measure,storedCompletionStatus:Ce});e.completionStatus=n,e.attemptProgressStatus=n!==Ce}else"unknown"!==this.cmi.completion_status&&(e.completionStatus=this.cmi.completion_status,e.attemptProgressStatus=!0);if("unknown"!==this.cmi.success_status&&(e.successStatus=this.cmi.success_status,e.objectiveSatisfiedStatus="passed"===this.cmi.success_status,e.primaryObjective&&(e.primaryObjective.progressStatus=!0)),this.cmi.score&&""!==this.cmi.score.scaled){var r=parseFloat(this.cmi.score.scaled);isNaN(r)||(e.objectiveNormalizedMeasure=r,e.objectiveMeasureStatus=!0,e.primaryObjective&&(e.primaryObjective.progressStatus=!0))}e.primaryObjective&&this.cmi.score&&(""!==this.cmi.score.raw&&(e.primaryObjective.rawScore=this.cmi.score.raw),""!==this.cmi.score.min&&(e.primaryObjective.minScore=this.cmi.score.min),""!==this.cmi.score.max&&(e.primaryObjective.maxScore=this.cmi.score.max)),e.primaryObjective&&e.primaryObjective.updateFromActivity(e)}},{key:"getCMIDataForTransfer",value:function(){var e,t,i,n,r={completion_status:this.cmi.completion_status,success_status:this.cmi.success_status,progress_measure:this.cmi.progress_measure,score:{scaled:(null===(e=this.cmi.score)||void 0===e?void 0:e.scaled)||"",raw:(null===(t=this.cmi.score)||void 0===t?void 0:t.raw)||"",min:(null===(i=this.cmi.score)||void 0===i?void 0:i.min)||"",max:(null===(n=this.cmi.score)||void 0===n?void 0:n.max)||""},objectives:[]};if(this.cmi.objectives&&this.cmi.objectives.childArray){var o=!0,a=!1,s=void 0;try{for(var c,l=this.cmi.objectives.childArray[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u,d,f,v,h=c.value;h.id&&r.objectives.push({id:h.id,success_status:h.success_status,completion_status:h.completion_status,progress_measure:h.progress_measure,score:{scaled:(null===(u=h.score)||void 0===u?void 0:u.scaled)||"",raw:(null===(d=h.score)||void 0===d?void 0:d.raw)||"",min:(null===(f=h.score)||void 0===f?void 0:f.min)||"",max:(null===(v=h.score)||void 0===v?void 0:v.max)||""}})}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}}return r}},{key:"parseNavigationRequest",value:function(request){var e=request;if(e.startsWith("_")&&"_none_"!==e&&(e=e.substring(1)),request.includes("choice"))return Hr.CHOICE;if(request.includes("jump"))return Hr.JUMP;switch(e){case"start":return Hr.START;case"resumeAll":return Hr.RESUME_ALL;case"continue":return Hr.CONTINUE;case"previous":return Hr.PREVIOUS;case"exit":return Hr.EXIT;case"exitAll":return Hr.EXIT_ALL;case"abandon":return Hr.ABANDON;case"abandonAll":return Hr.ABANDON_ALL;case"suspendAll":return Hr.SUSPEND_ALL;case"_none_":return Hr.NOT_VALID;default:return null}}},{key:"handleActivityDelivery",value:function(e){this.log("info","Activity delivered: ".concat(e.id," - ").concat(e.title)),this.fireEvent("onActivityDelivery",e)}},{key:"handleActivityUnload",value:function(e){this.log("info","Activity unloaded: ".concat(e.id," - ").concat(e.title)),this.fireEvent("onActivityUnload",e)}},{key:"handleSequencingComplete",value:function(result){this.log("debug","Sequencing completed",result)}},{key:"handleSequencingError",value:function(e){this.log("error","Sequencing error: ".concat(e)),this.fireEvent("onSequencingError",e,"sequencing")}},{key:"fireEvent",value:function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),n=1;t>n;n++)i[n-1]=arguments[n];if(this.configuration.enableEventSystem){"onSequencingDebug"!==e&&this.fireDebugEvent("".concat(e," fired"),{eventType:e,argsLength:i.length});try{var r=this.eventListeners[e];if(r&&"function"==typeof r)try{r.apply(void 0,mo(i)),this.log("debug","Internal listener for ".concat(e," executed successfully"))}catch(t){this.log("error","Internal listener for ".concat(e," failed: ").concat(t))}try{var o;(o=this.eventService).processListeners.apply(o,["Sequencing.".concat(e),i[0]].concat(mo(i.slice(1)))),this.log("debug","Event service listeners for ".concat(e," processed"))}catch(t){this.log("warn","Event service failed for ".concat(e,": ").concat(t))}try{if("undefined"!=typeof window&&window.scormSequencingEvents){var a,s=window.scormSequencingEvents;s[e]&&"function"==typeof s[e]&&((a=s)[e].apply(a,mo(i)),this.log("debug","Global listener for ".concat(e," executed")))}}catch(t){this.log("warn","Global listener for ".concat(e," failed: ").concat(t))}}catch(t){this.log("error","Critical error firing event ".concat(e,": ").concat(t))}}}},{key:"fireDebugEvent",value:function(e,t){try{var i=this.eventListeners.onSequencingDebug;i&&"function"==typeof i&&i(e,ho({timestamp:(new Date).toISOString()},t));try{this.eventService.processListeners("Sequencing.onSequencingDebug",e,ho({timestamp:(new Date).toISOString()},t))}catch(e){}}catch(e){console.debug("Debug event failed: ".concat(e))}}},{key:"fireActivityAttemptStart",value:function(e){this.fireEvent("onActivityAttemptStart",e),this.fireDebugEvent("Activity attempt started",{activityId:e.id,title:e.title,attemptCount:e.attemptCount})}},{key:"fireActivityAttemptEnd",value:function(e){this.fireEvent("onActivityAttemptEnd",e),this.fireDebugEvent("Activity attempt ended",{activityId:e.id,title:e.title,completionStatus:e.completionStatus,successStatus:e.successStatus})}},{key:"fireLimitConditionCheck",value:function(e,result){this.fireEvent("onLimitConditionCheck",e,result),this.fireDebugEvent("Limit condition check",{activityId:e.id,result:result,attemptCount:e.attemptCount,attemptLimit:e.attemptLimit})}},{key:"fireNavigationValidityUpdate",value:function(e){this.fireEvent("onNavigationValidityUpdate",e),this.fireDebugEvent("Navigation validity updated",{validity:e})}},{key:"fireSequencingStateChange",value:function(e){this.fireEvent("onSequencingStateChange",e),this.fireDebugEvent("Sequencing state changed",{stateKeys:Object.keys(e)})}},{key:"handleSequencingProcessEvent",value:function(e,t){try{switch(e){case"onActivityDelivery":this.fireEvent("onActivityDelivery",t);break;case"onLimitConditionCheck":this.fireLimitConditionCheck(t.activity,t.result);break;case"onActivityAttemptStart":this.fireActivityAttemptStart(t);break;case"onActivityAttemptEnd":this.fireActivityAttemptEnd(t);break;case"onNavigationValidityUpdate":this.fireNavigationValidityUpdate(t);break;case"onSequencingSessionEnd":this.fireEvent("onSequencingSessionEnd",t);break;default:this.fireDebugEvent("Sequencing process event: ".concat(e),t)}}catch(t){this.log("error","Error handling sequencing process event ".concat(e,": ").concat(t))}}},{key:"log",value:function(e,t,i){var n=["debug","info","warn","error"],r=this.configuration.logLevel||"info";if(n.indexOf(e)>=n.indexOf(r))switch(e){case"debug":this.loggingService.debug("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""));break;case"info":this.loggingService.info("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""));break;case"warn":this.loggingService.warn("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""));break;case"error":this.loggingService.error("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var _o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,i=[{key:"loadFromFlattenedJSON",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(r()){var a=/^(cmi\.interactions\.)(\d+)\.(.*)$/,s=/^(cmi\.objectives\.)(\d+)\.(.*)$/,interactions=[],objectives=[],c=[];for(var l in e)if({}.hasOwnProperty.call(e,l)){var u=l.match(a);if(u){interactions.push({key:l,value:e[l],index:+u[2],field:u[3]||""});continue}var d=l.match(s);if(d){objectives.push({key:l,value:e[l],index:+d[2],field:d[3]||""});continue}c.push({key:l,value:e[l]})}interactions.sort(function(e,t){return e.index!==t.index?e.index-t.index:"id"===e.field?-1:"id"===t.field?1:"type"===e.field?-1:"type"===t.field?1:e.field.localeCompare(t.field)}),objectives.sort(function(e,t){return e.index!==t.index?e.index-t.index:"id"===e.field?-1:"id"===t.field?1:e.field.localeCompare(t.field)}),c.sort(function(e,t){return e.key.localeCompare(t.key)});var f=function(e){e.forEach(function(e){var a={};a[e.key]=e.value,t.loadFromJSON(function(e){var t;if(Object(e)!==e||Array.isArray(e))return e;var result={},pattern=/\.?([^.[\]]+)|\[(\d+)]/g;return Object.keys(e).filter(function(t){return{}.hasOwnProperty.call(e,t)}).forEach(function(t){var i,n,r=result,o="",a=RegExp(pattern);Array.from({length:null!==(i=null===(n=t.match(RegExp(pattern,"g")))||void 0===n?void 0:n.length)&&void 0!==i?i:0},function(){return a.exec(t)}).forEach(function(e){var t;e&&(r=null!==(t=r[o])&&void 0!==t?t:r[o]=e[2]?[]:{},o=e[2]||e[1]||"")}),r[o]=e[t]}),null!==(t=result[""])&&void 0!==t?t:result}(a),i,n,r,o)})};f(interactions),f(objectives),f(c)}else console.error("loadFromFlattenedJSON can only be called before the call to lmsInitialize.")}},{key:"loadFromJSON",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;if(n()){for(var o in t=void 0!==t?t:"cmi",r(e),e)if({}.hasOwnProperty.call(e,o)&&e[o]){var a=(t?t+".":"")+o,s=e[o];if(s.constructor===Array){for(var c=0;s.length>c;c++)if(s[c]){var l=s[c],u="".concat(a,".").concat(c);l.constructor===Object?this.loadFromJSON(l,u,i,n,r):i(u,l)}}else s.constructor===Object?this.loadFromJSON(s,a,i,n,r):i(a,s)}}else console.error("loadFromJSON can only be called before the call to lmsInitialize.")}},{key:"renderCMIToJSONString",value:function(cmi,e){return e?JSON.stringify({cmi:cmi}):JSON.stringify({cmi:cmi},function(e,t){return void 0===t?null:t},2)}},{key:"renderCMIToJSONObject",value:function(cmi,e){return JSON.parse(this.renderCMIToJSONString(cmi,e))}},{key:"getCommitObject",value:function(e,t,i,n,r,o){var a=t||e,s=i?n(e,a):r(e,a);return[Ee.DEBUG,"1",1,"DEBUG"].includes(o)&&(console.debug("Commit (terminated: "+(e?"yes":"no")+"): "),console.debug(s)),s}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function bo(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function So(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var wo=Object.defineProperty,Oo=function(e,t,i){return function(e,t,i){return t in e?wo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Co=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Oo(this,"settings"),Oo(this,"error_codes"),this.settings=t,this.error_codes=i}return t=e,i=[{key:"processHttpRequest",value:function(e,t){var i=arguments.length>5?arguments[5]:void 0;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?this._handleImmediateRequest(e,t,i):this._performSyncXHR(e,t,i)}},{key:"_handleImmediateRequest",value:function(e,t,i){var n=void 0===i?this.settings.requestHandler(t):this.settings.requestHandler(t,i),r=this._prepareRequestBody(null!=n?n:t).body,o=navigator.sendBeacon(e,new Blob([r],{type:"text/plain;charset=UTF-8"}));return{result:o?"true":"false",errorCode:o?0:this.error_codes.GENERAL_COMMIT_FAILURE||391}}},{key:"_performSyncXHR",value:function(e,t,i){var n=void 0===i?this.settings.requestHandler(t):this.settings.requestHandler(t,i),r=this._prepareRequestBody(null!=n?n:t),o=r.body,a=r.contentType,s=new XMLHttpRequest;s.open("POST",e,!1),s.setRequestHeader("Content-Type",a),Object.entries(this.settings.xhrHeaders).forEach(function(e){var t,i,n=(i=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(t,i)||function(e,t){if(e){if("string"==typeof e)return bo(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?bo(e,t):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());s.setRequestHeader(n[0],n[1]+"")}),this.settings.xhrWithCredentials&&(s.withCredentials=!0);try{return s.send(o),this.settings.xhrResponseHandler(s)}catch(e){var c=So(e,Error)?e.message:e+"";return{result:F,errorCode:this.error_codes.GENERAL_COMMIT_FAILURE||391,errorMessage:c}}}},{key:"_prepareRequestBody",value:function(e){return{body:So(e,Array)?e.join("&"):JSON.stringify(e),contentType:So(e,Array)?"application/x-www-form-urlencoded":this.settings.commitRequestDataType}}},{key:"updateSettings",value:function(e){this.settings=e}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Eo(e,t,i,n){return sn(e,t,i,se.TYPE_MISMATCH,J,n)}function Ao(e,t,i,n){if(""===t)throw new J(e,se.VALUE_OUT_OF_RANGE);return cn(e,t,i,se.VALUE_OUT_OF_RANGE,J)}var ko=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,i=[{key:"validateScore",value:function(e,t,i,n,r,o,a){return!(7>=arguments.length||void 0===arguments[7]||!arguments[7]||""!==t)||sn(e,t,i,r,a)&&(!n||cn(e,t,n,o,a))}},{key:"validateScorm12Audio",value:function(e,t){return Eo(e,t,Te)&&Ao(e,t,"-1#100")}},{key:"validateScorm12Language",value:function(e,t){return Eo(e,t,Re)}},{key:"validateScorm12Speed",value:function(e,t){return Eo(e,t,Te)&&Ao(e,t,"-100#100")}},{key:"validateScorm12Text",value:function(e,t){return Eo(e,t,Te)&&Ao(e,t,"-1#1")}},{key:"validateReadOnly",value:function(e,t){if(t)throw new J(e,se.READ_ONLY_ELEMENT)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}(),jo=new ko;function Ro(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Mo(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function To(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function xo(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Mo(e,t,i[t])})}return e}function Io(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}),e}function Po(e){return function(e){if(Array.isArray(e))return Ro(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ro(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ro(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function No(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Do=Object.defineProperty,qo=function(e,t,i){return function(e,t,i){return t in e?Do(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":No(t))?t+"":t,i)},Lo=function(){function e(t,i,n,r,o,a,s,c,l){var u=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),qo(this,"_timeout"),qo(this,"_error_codes"),qo(this,"_settings",ke),qo(this,"_httpService"),qo(this,"_eventService"),qo(this,"_serializationService"),qo(this,"_errorHandlingService"),qo(this,"_loggingService"),qo(this,"_offlineStorageService"),qo(this,"_cmiValueAccessService"),qo(this,"_courseId",""),qo(this,"_pendingCommitCount",0),qo(this,"_commitSequence",0),qo(this,"_commitSettleWaiters",[]),qo(this,"_setCMIElements",new Set),qo(this,"startingData"),qo(this,"currentState"),(To(this,e)?this.constructor:void 0)===e)throw new TypeError("Cannot construct BaseAPI instances directly");this.currentState=0,this._error_codes=t,i&&(this.settings=xo({},ke,i)),void 0!==(null==i?void 0:i.asyncCommit)&&void 0===i.useAsynchronousCommits&&void 0===i.throttleCommits&&(console.warn("DEPRECATED: 'asyncCommit' setting is deprecated and will be removed in a future version. Use 'useAsynchronousCommits: true' and 'throttleCommits: true' instead."),i.asyncCommit&&(this.settings.useAsynchronousCommits=!0,this.settings.throttleCommits=!0)),!this.settings.useAsynchronousCommits&&this.settings.throttleCommits&&(console.warn("throttleCommits cannot be used with synchronous commits. Setting throttleCommits to false."),this.settings.throttleCommits=!1),this._loggingService=c||Vi(),this._loggingService.setLogLevel(this.settings.logLevel),this._loggingService.setLogHandler(this.settings.onLogMessage?this.settings.onLogMessage:je),n?this._httpService=n:this.settings.httpService?this._httpService=this.settings.httpService:this.settings.useAsynchronousCommits?(console.warn("WARNING: useAsynchronousCommits=true is not SCORM compliant. Commit failures will not be reported to the SCO, which may cause data loss. This setting should only be used for specific legacy compatibility cases."),this._httpService=new Ti(this.settings,this._error_codes)):this._httpService=new Co(this.settings,this._error_codes),this._eventService=r||new Ji(function(e,t,i,n){return u.apiLog(e,t,i,n)}),this._serializationService=o||new _o,this._errorHandlingService=s||new Ki(this._error_codes,function(e,t,i,n){return u.apiLog(e,t,i||Ee.ERROR,n)},function(e,t){return u.getLmsErrorMessageDetails(e,t)},void 0),this.settings.enableOfflineSupport&&(this._offlineStorageService=l||new an(this.settings,this._error_codes,function(e,t,i,n){return u.apiLog(e,t,i,n)}),this.settings.courseId&&(this._courseId=this.settings.courseId),this.settings.syncOnTerminate&&this._eventService.on("BeforeTerminate",function(){var e;(null===(e=u._offlineStorageService)||void 0===e?void 0:e.isDeviceOnline())&&u._courseId&&u._offlineStorageService.hasPendingOfflineData(u._courseId).then(function(e){var t;if(e)return u.apiLog("BeforeTerminate","Syncing pending offline data before termination",Ee.INFO),null===(t=u._offlineStorageService)||void 0===t?void 0:t.syncOfflineData()}).then(function(e){e?u.processListeners("OfflineDataSynced"):!1===e&&u.processListeners("OfflineDataSyncFailed")}).catch(function(e){u.apiLog("BeforeTerminate","Error syncing offline data: ".concat(e),Ee.ERROR),u.processListeners("OfflineDataSyncFailed")})}),this._offlineStorageService&&this._courseId&&this._offlineStorageService.getOfflineData(this._courseId).then(function(e){e&&(u.apiLog("constructor","Found offline data to restore",Ee.INFO),u.loadFromJSON(e.runtimeData))}).catch(function(e){u.apiLog("constructor","Error retrieving offline data: ".concat(e),Ee.ERROR)})),this._cmiValueAccessService=new Di({errorCodes:this._error_codes,getLastErrorCode:function(){return u.lastErrorCode},setLastErrorCode:function(e){u.lastErrorCode=e},throwSCORMError:function(e,t,i){return u.throwSCORMError(e,t,i)},isInitialized:function(){return u.isInitialized()},validateCorrectResponse:function(e,t){return u.validateCorrectResponse(e,t)},checkForDuplicateId:function(e,t){return u._checkForDuplicateId(e,t)},getChildElement:function(e,t,i){return u.getChildElement(e,t,i)},apiLog:function(e,t,i){return u.apiLog(e,t,i)},checkObjectHasProperty:function(e,t){return u._checkObjectHasProperty(e,t)},getDataModel:function(){return u}})}return t=e,i=[{key:"lastErrorCode",get:function(){var e,t;return null!==(e=null===(t=this._errorHandlingService)||void 0===t?void 0:t.lastErrorCode)&&void 0!==e?e:"0"},set:function(e){this._errorHandlingService&&(this._errorHandlingService.lastErrorCode=e)}},{key:"eventService",get:function(){return this._eventService}},{key:"loggingService",get:function(){return this._loggingService}},{key:"commonReset",value:function(e){this.apiLog("reset","Called",Ee.INFO),this.settings=xo({},this.settings,e),this.clearScheduledCommit(),this.currentState=0,this.lastErrorCode="0",this._eventService.reset(),this.startingData={},this._setCMIElements.clear(),this._offlineStorageService&&(this._offlineStorageService.updateSettings(this.settings),(null==e?void 0:e.courseId)&&(this._courseId=e.courseId))}},{key:"initialize",value:function(e,t,i){var n=this,r=F;return this.isInitialized()?this.throwSCORMError("api",this._error_codes.INITIALIZED,t):this.isTerminated()?this.throwSCORMError("api",this._error_codes.TERMINATED,i):(this.settings.selfReportSessionTime&&this.cmi.setStartTime(),this.currentState=1,this.lastErrorCode="0",r=z,this.processListeners(e),this.settings.enableOfflineSupport&&this._offlineStorageService&&this._courseId&&this.settings.syncOnInitialize&&this._offlineStorageService.isDeviceOnline()&&this._offlineStorageService.hasPendingOfflineData(this._courseId).then(function(t){var i;t&&(n.apiLog(e,"Syncing pending offline data on initialization",Ee.INFO),null===(i=n._offlineStorageService)||void 0===i||i.syncOfflineData().then(function(t){t&&(n.apiLog(e,"Successfully synced offline data",Ee.INFO),n.processListeners("OfflineDataSynced"))}))})),this.apiLog(e,"returned: "+r,Ee.INFO),this.clearSCORMError(r),r}},{key:"apiLog",value:function(e,t,i,n){t=function(e,t,i){var n=e?"".concat((e+"").padEnd(20),": "):"";return i&&(n=(n+=i).padEnd(70)),n+(null!=t?t:"")}(e,t,n),this._loggingService.log(i,t)}},{key:"settings",get:function(){return this._settings},set:function(e){var t,i,n,r=this._settings;this._settings=xo({},this._settings,e),null===(t=this._httpService)||void 0===t||t.updateSettings(this._settings),void 0!==e.logLevel&&e.logLevel!==r.logLevel&&(null===(i=this._loggingService)||void 0===i||i.setLogLevel(e.logLevel)),void 0!==e.onLogMessage&&e.onLogMessage!==r.onLogMessage&&(null===(n=this._loggingService)||void 0===n||n.setLogHandler(e.onLogMessage))}},{key:"pendingCommitCount",get:function(){return this._pendingCommitCount}},{key:"whenCommitsSettled",value:function(e){var t=this;return 0===this._pendingCommitCount?Promise.resolve():new Promise(function(i){var n={resolve:i};void 0!==(null==e?void 0:e.timeoutMs)&&(n.timeoutId=setTimeout(function(){var e=t._commitSettleWaiters.indexOf(n);-1!==e&&(t._commitSettleWaiters.splice(e,1),i())},e.timeoutMs)),t._commitSettleWaiters.push(n)})}},{key:"_flushCommitSettleWaiters",value:function(){var e=this._commitSettleWaiters.splice(0),t=!0,i=!1,n=void 0;try{for(var r,o=e[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;void 0!==a.timeoutId&&clearTimeout(a.timeoutId),a.resolve()}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"terminate",value:function(e,t){var i=z,n=!1;if(this.isNotInitialized()){var r,o=null!==(r=this._error_codes.TERMINATION_BEFORE_INIT)&&void 0!==r?r:0;this.throwSCORMError("api",o),112===o&&(i=F)}else if(t&&this.isTerminated()){var a,s=null!==(a=this._error_codes.MULTIPLE_TERMINATION)&&void 0!==a?a:0;this.throwSCORMError("api",s),113===s&&(i=F)}else{var c;n=!0,this.processListeners("BeforeTerminate");var result=this.storeData(!0,"terminate");if((null!==(c=result.errorCode)&&void 0!==c?c:0)>0){var l;result.errorMessage&&this.apiLog("terminate","Terminate failed with error: ".concat(result.errorMessage),Ee.ERROR),result.errorDetails&&this.apiLog("terminate","Error details: ".concat(JSON.stringify(result.errorDetails)),Ee.DEBUG),this.throwSCORMError("api",null!==(l=result.errorCode)&&void 0!==l?l:0),i=F}else{var u;this.currentState=2,t&&(this.lastErrorCode="0");var d=null!==(u=null==result?void 0:result.result)&&void 0!==u?u:z;i="boolean"==typeof d?d+"":d}this.processListeners(e)}return this.apiLog(e,"returned: "+i,Ee.INFO),n&&this.clearSCORMError(i),i}},{key:"getValue",value:function(e,t,i){var n,r,o="";if(this.checkState(t,null!==(n=this._error_codes.RETRIEVE_BEFORE_INIT)&&void 0!==n?n:0,null!==(r=this._error_codes.RETRIEVE_AFTER_TERM)&&void 0!==r?r:0)){try{o=this.getCMIValue(i)}catch(e){o=this.handleValueAccessException(i,e,o)}"0"===this.lastErrorCode&&this.checkUninitializedGet(i,o),this.processListeners(e,i)}return this.apiLog(e,": returned: "+o,Ee.INFO,i),void 0===o?"":("0"===this.lastErrorCode&&this.clearSCORMError(o),"number"==typeof o||"boolean"==typeof o?o+"":o)}},{key:"setValue",value:function(e,t,i,n,r){var o,a;void 0!==r&&(r+="");var s=F;if(this.checkState(i,null!==(o=this._error_codes.STORE_BEFORE_INIT)&&void 0!==o?o:0,null!==(a=this._error_codes.STORE_AFTER_TERM)&&void 0!==a?a:0)){try{s=this.setCMIValue(n,r)}catch(e){s=this.handleValueAccessException(n,e,s)}this.processListeners(e,n,r)}return void 0===s&&(s=F),this.lastErrorCode+""=="0"&&this.settings.autocommit&&this.scheduleCommit(1e3*this.settings.autocommitSeconds,t),this.apiLog(e,": "+r+": result: "+s,Ee.INFO,n),"0"===this.lastErrorCode&&this.clearSCORMError(s),s}},{key:"commit",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"manual";this.clearScheduledCommit();var r=z;if(this.isNotInitialized()){var o,a=null!==(o=this._error_codes.COMMIT_BEFORE_INIT)&&void 0!==o?o:0;this.throwSCORMError("api",a),142===a&&(r=F)}else if(i&&this.isTerminated()){var s,c=null!==(s=this._error_codes.COMMIT_AFTER_TERM)&&void 0!==s?s:0;this.throwSCORMError("api",c),143===c&&(r=F)}else{var l,u,result=this.storeData(!1,n),d=null!==(l=result.errorCode)&&void 0!==l?l:0;d>0&&(result.errorMessage&&this.apiLog("commit","Commit failed with error: ".concat(result.errorMessage),Ee.ERROR),result.errorDetails&&this.apiLog("commit","Error details: ".concat(JSON.stringify(result.errorDetails)),Ee.DEBUG),this.throwSCORMError("api",d));var f=null!==(u=null==result?void 0:result.result)&&void 0!==u?u:F;this.apiLog(e," Result: "+(r="boolean"==typeof f?f+"":f),Ee.DEBUG,"HttpRequest"),i&&0===d&&(this.lastErrorCode="0"),this.processListeners(e),this.settings.enableOfflineSupport&&this._offlineStorageService&&this._offlineStorageService.isDeviceOnline()&&this._courseId&&this._offlineStorageService.hasPendingOfflineData(this._courseId).then(function(i){var n;i&&(t.apiLog(e,"Syncing pending offline data",Ee.INFO),null===(n=t._offlineStorageService)||void 0===n||n.syncOfflineData().then(function(i){i?(t.apiLog(e,"Successfully synced offline data",Ee.INFO),t.processListeners("OfflineDataSynced")):t.apiLog(e,"Failed to sync some offline data",Ee.WARN)}))})}return this.apiLog(e,"returned: "+r,Ee.INFO),this.isNotInitialized()||i&&this.isTerminated()||this.clearSCORMError(r),r}},{key:"getLastError",value:function(e){var t=this.lastErrorCode+"";return this.processListeners(e),this.apiLog(e,"returned: "+t,Ee.INFO),t}},{key:"getErrorString",value:function(e,t){var i="";return null!==t&&""!==t&&(i=this.getLmsErrorMessageDetails(t),this.processListeners(e)),i.length>255&&(i=i.substring(0,255)),this.apiLog(e,"returned: "+i,Ee.INFO),i}},{key:"getDiagnostic",value:function(e,t){var i="",n=""===t?this.lastErrorCode+"":t;if(null!==n&&""!==n){var r=this._errorHandlingService.lastDiagnostic;i=r&&n+""==this.lastErrorCode+""?r:this.getLmsErrorMessageDetails(n,!0),this.processListeners(e)}return i.length>255&&(i=i.substring(0,255)),this.apiLog(e,"returned: "+i,Ee.INFO),i}},{key:"checkState",value:function(e,t,i){return this.isNotInitialized()?(this.throwSCORMError("api",t),!1):!e||!this.isTerminated()||(this.throwSCORMError("api",i),!1)}},{key:"_checkForDuplicateId",value:function(e,t){var i=function(e,t){if(e&&"object"===(void 0===e?"undefined":No(e))&&t in e){var i=e[t];return To(i,me)?i:void 0}},n=function(e,t,i){for(var n=0;e.childArray.length>n;n++)if(n!==t){var r=e.childArray[n];if(r&&"object"===(void 0===r?"undefined":No(r))&&"id"in r&&r.id===i)return!0}return!1},r=e.match(/^cmi\.objectives\.(\d+)\.id$/);if(r&&r[1]){var o=parseInt(r[1],10),objectives=i(this.cmi,"objectives");return!!objectives&&n(objectives,o,t)}var a=e.match(/^cmi\.interactions\.(\d+)\.id$/);if(a&&a[1]){var s=parseInt(a[1],10),interactions=i(this.cmi,"interactions");return!!interactions&&n(interactions,s,t)}var c=e.match(/^cmi\.interactions\.(\d+)\.objectives\.(\d+)\.id$/);if(c&&c[1]&&c[2]){var l=parseInt(c[1],10),u=parseInt(c[2],10),d=i(this.cmi,"interactions");if(d){var f=d.childArray[l];if(f){var v=i(f,"objectives");if(v)return n(v,u,t)}}return!1}return!1}},{key:"getLmsErrorMessageDetails",value:function(e){throw Error("The getLmsErrorMessageDetails method has not been implemented")}},{key:"getCMIValue",value:function(e){throw Error("The getCMIValue method has not been implemented")}},{key:"setCMIValue",value:function(e,t){throw Error("The setCMIValue method has not been implemented")}},{key:"_commonSetCMIValue",value:function(e,t,i,n){var result=this._cmiValueAccessService.setCMIValue(e,t,i,n);return result===z&&this._setCMIElements.add(i),result}},{key:"_commonGetCMIValue",value:function(e,t,i){return this._cmiValueAccessService.getCMIValue(e,t,i)}},{key:"checkUninitializedGet",value:function(e,t){}},{key:"isInitialized",value:function(){return 1===this.currentState}},{key:"isNotInitialized",value:function(){return 0===this.currentState}},{key:"isTerminated",value:function(){return 2===this.currentState}},{key:"on",value:function(e,t){this._eventService.on(e,t)}},{key:"off",value:function(e,t){this._eventService.off(e,t)}},{key:"clear",value:function(e){this._eventService.clear(e)}},{key:"processListeners",value:function(e,t,i,n){void 0!==n?this._eventService.processListeners(e,t,i,n):this._eventService.processListeners(e,t,i)}},{key:"throwSCORMError",value:function(e,t,i){this._errorHandlingService.throwSCORMError(e,null!=t?t:0,i)}},{key:"clearSCORMError",value:function(e){this._errorHandlingService.clearSCORMError(e)}},{key:"loadFromFlattenedJSON",value:function(e,t){var i=this;t||(t=""),this._serializationService.loadFromFlattenedJSON(e,t,function(e,t){return i.setCMIValue(e,t)},function(){return i.isNotInitialized()},function(e){i.startingData=e})}},{key:"getFlattenedCMI",value:function(){return u(this.renderCMIToJSONObject())}},{key:"loadFromJSON",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";i&&""!==i||Object.hasOwnProperty.call(e,"cmi")||Object.hasOwnProperty.call(e,"adl")||(i="cmi"),this._serializationService.loadFromJSON(e,i,function(e,i){return t.setCMIValue(e,i)},function(){return t.isNotInitialized()},function(e){t.startingData=e})}},{key:"renderCMIToJSONString",value:function(){return this._serializationService.renderCMIToJSONString(this.cmi,this.settings.sendFullCommit)}},{key:"renderCMIToJSONObject",value:function(){return this._serializationService.renderCMIToJSONObject(this.cmi,this.settings.sendFullCommit)}},{key:"processHttpRequest",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,o=++this._commitSequence;this._pendingCommitCount+=1;var a=!1,s=!1,c=function(){a||(a=!0,i._pendingCommitCount-=1,0===i._pendingCommitCount&&i._flushCommitSettleWaiters())};try{var l=null!=r?r:n?"terminate":"manual",u=t;if(n&&this.settings.terminateCommitPayloadField){var d=this.settings.terminateCommitPayloadField;Array.isArray(u)?u=Po(u).concat(["".concat(encodeURIComponent(d),"=true")]):u&&"object"===(void 0===u?"undefined":No(u))&&(u=Io(xo({},u),Mo({},d,!0)))}!0===this.settings.includeCommitSequence&&(Array.isArray(u)?u=Po(u).concat(["commitSequence=".concat(o)]):u&&"object"===(void 0===u?"undefined":No(u))&&(u=Io(xo({},u),{commitSequence:o})));var f,v=n&&this.settings.terminateCommitParam?h(e,this.settings.terminateCommitParam,"true"):e,m={isTerminateCommit:n,trigger:l,sequence:o},p={url:v,trigger:l,isTerminateCommit:n,sequence:o};if(this.settings.enableOfflineSupport&&this._offlineStorageService&&!this._offlineStorageService.isDeviceOnline()&&this._courseId)return this.apiLog("processHttpRequest","Device is offline, storing data locally",Ee.INFO),u&&"object"===(void 0===u?"undefined":No(u))&&"cmi"in u?this._offlineStorageService.storeOffline(this._courseId,u,{isTerminateCommit:n,sequence:o}):(this.apiLog("processHttpRequest","Invalid commit data format for offline storage",Ee.ERROR),{result:F,errorCode:null!==(f=this._error_codes.GENERAL)&&void 0!==f?f:101});var result=this._httpService.processHttpRequest(v,u,n,function(e,t,n,r){return i.apiLog(e,t,n,r)},function(e,t,n){"CommitSuccess"===e||"CommitError"===e?("CommitError"===e&&"number"==typeof n&&(p.errorCode=n),c(),i.processListeners(e,t,n,p)):i.processListeners(e,t,n)},m,c);return s=!0===this._httpService.reportsRequestCompletion,result}finally{s||c()}}},{key:"scheduleCommit",value:function(e,t){this._timeout||(this._timeout=new st(this,e,t),this.apiLog("scheduleCommit","scheduled",Ee.DEBUG,""))}},{key:"clearScheduledCommit",value:function(){this._timeout&&(this._timeout.cancel(),this._timeout=void 0,this.apiLog("clearScheduledCommit","cleared",Ee.DEBUG,""))}},{key:"_checkObjectHasProperty",value:function(e,t){return null!=e&&"object"===(void 0===e?"undefined":No(e))&&(Object.hasOwnProperty.call(e,t)||null!=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),t)||t in e)}},{key:"handleValueAccessException",value:function(e,t,i){return To(t,L)?(this.lastErrorCode=t.errorCode+"",""!==i&&(i=F),this.throwSCORMError(e,t.errorCode,t.errorMessage)):To(t,Error)&&t.message?this.throwSCORMError(e,this._error_codes.GENERAL,t.message):this.throwSCORMError(e,this._error_codes.GENERAL,"Unknown error"),i}},{key:"getCommitObject",value:function(e){var t=this;return this._serializationService.getCommitObject(e,this.settings.alwaysSendTotalTime,this.settings.renderCommonCommitFields,function(e,i){return t.renderCommitObject(e,i)},function(e,i){return t.renderCommitCMI(e,i)},this.settings.logLevel)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function zo(e){return zo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},zo(e)}function Fo(e,t){return Fo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Fo(e,t)}function Bo(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Vo(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Vo=function(){return!!result})()}var Ho=Object.defineProperty,Uo=function(e,t,i){return function(e,t,i){return t in e?Ho(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Bo(t))?t+"":t,i)},Go=function(e){function t(e){var i,n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=zo(t),n=e,!(r=Vo()?Reflect.construct(t,i||[],zo(e).constructor):t.apply(e,i))||"object"!==Bo(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,[e.CMIElement]),Uo(i,"__children"),Uo(i,"__score_range"),Uo(i,"__invalid_error_code"),Uo(i,"__invalid_type_code"),Uo(i,"__invalid_range_code"),Uo(i,"__decimal_regex"),Uo(i,"__error_class"),Uo(i,"__allow_empty_string"),Uo(i,"_raw",""),Uo(i,"_min",""),Uo(i,"_max"),i.__children=e.score_children||B.score_children,i.__score_range=!!e.score_range&&De,i._max=e.max||""===e.max?e.max:"100",i.__invalid_error_code=e.invalidErrorCode||se.INVALID_SET_VALUE,i.__invalid_type_code=e.invalidTypeCode||se.TYPE_MISMATCH,i.__invalid_range_code=e.invalidRangeCode||se.VALUE_OUT_OF_RANGE,i.__decimal_regex=e.decimalRegex||xe,i.__error_class=e.errorClass,i.__allow_empty_string=null!==(n=e.allowEmptyString)&&void 0!==n&&n,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Fo(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1,this._raw="",this._min=""}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new this.__error_class(this._cmi_element+"._children",this.__invalid_error_code)}},{key:"raw",get:function(){return this._raw},set:function(e){jo.validateScore(this._cmi_element+".raw",e,this.__decimal_regex,this.__score_range,this.__invalid_type_code,this.__invalid_range_code,this.__error_class,this.__allow_empty_string)&&(this._raw=e)}},{key:"min",get:function(){return this._min},set:function(e){jo.validateScore(this._cmi_element+".min",e,this.__decimal_regex,this.__score_range,this.__invalid_type_code,this.__invalid_range_code,this.__error_class,this.__allow_empty_string)&&(this._min=e)}},{key:"max",get:function(){return this._max},set:function(e){jo.validateScore(this._cmi_element+".max",e,this.__decimal_regex,this.__score_range,this.__invalid_type_code,this.__invalid_range_code,this.__error_class,this.__allow_empty_string)&&(this._max=e)}},{key:"getScoreObject",value:function(){var e={};return Number.isNaN(Number.parseFloat(this.raw))||(e.raw=Number.parseFloat(this.raw)),Number.isNaN(Number.parseFloat(this.min))||(e.min=Number.parseFloat(this.min)),Number.isNaN(Number.parseFloat(this.max))||(e.max=Number.parseFloat(this.max)),e}},{key:"toJSON",value:function(){this.jsonString=!0;var result={raw:this.raw,min:this.min,max:this.max};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function Ko(e,t,i){return Ko="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Yo(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Ko(e,t,i||e)}function Yo(e){return Yo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Yo(e)}function Wo(e,t){return Wo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Wo(e,t)}function Jo(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function $o(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return($o=function(){return!!result})()}var Xo=Object.defineProperty,Qo=function(e,t,i){return function(e,t,i){return t in e?Xo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Jo(t))?t+"":t,i)},Zo=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Yo(t),n=e,!(r=$o()?Reflect.construct(t,i||[],Yo(e).constructor):t.apply(e,i))||"object"!==Jo(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi.core"]),Qo(e,"score"),Qo(e,"__children",B.core_children),Qo(e,"_student_id",""),Qo(e,"_student_name",""),Qo(e,"_lesson_location",""),Qo(e,"_credit",""),Qo(e,"_lesson_status","not attempted"),Qo(e,"_entry",""),Qo(e,"_total_time",""),Qo(e,"_lesson_mode","normal"),Qo(e,"_exit",""),Qo(e,"_session_time","00:00:00"),Qo(e,"_suspend_data",""),e.score=new Go({CMIElement:"cmi.core.score",score_children:B.score_children,score_range:De,invalidErrorCode:se.INVALID_SET_VALUE,invalidTypeCode:se.TYPE_MISMATCH,invalidRangeCode:se.VALUE_OUT_OF_RANGE,errorClass:J,allowEmptyString:!0}),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Wo(e,t)}(t,e),i=t,(n=[{key:"initialize",value:function(){var e;Ko(Yo(t.prototype),"initialize",this).call(this),null===(e=this.score)||void 0===e||e.initialize()}},{key:"reset",value:function(){var e;this._initialized=!1,this._exit="",this._entry="",this._session_time="00:00:00",null===(e=this.score)||void 0===e||e.reset()}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new J(this._cmi_element+"._children",se.INVALID_SET_VALUE)}},{key:"student_id",get:function(){return this._student_id},set:function(student_id){if(this.initialized)throw new J(this._cmi_element+".student_id",se.READ_ONLY_ELEMENT);this._student_id=student_id}},{key:"student_name",get:function(){return this._student_name},set:function(student_name){if(this.initialized)throw new J(this._cmi_element+".student_name",se.READ_ONLY_ELEMENT);this._student_name=student_name}},{key:"lesson_location",get:function(){return this._lesson_location},set:function(lesson_location){Eo(this._cmi_element+".lesson_location",lesson_location,Re,!0)&&(this._lesson_location=lesson_location)}},{key:"credit",get:function(){return this._credit},set:function(credit){if(this.initialized)throw new J(this._cmi_element+".credit",se.READ_ONLY_ELEMENT);Eo(this._cmi_element+".credit",credit,"^(credit|no-credit)$",!0)&&(this._credit=credit)}},{key:"lesson_status",get:function(){return this._lesson_status},set:function(lesson_status){this.initialized?Eo(this._cmi_element+".lesson_status",lesson_status,"^(passed|completed|failed|incomplete|browsed)$")&&(this._lesson_status=lesson_status):Eo(this._cmi_element+".lesson_status",lesson_status,Ne)&&(this._lesson_status=lesson_status)}},{key:"entry",get:function(){return this._entry},set:function(entry){if(this.initialized)throw new J(this._cmi_element+".entry",se.READ_ONLY_ELEMENT);Eo(this._cmi_element+".entry",entry,"^(ab-initio|resume|)$",!0)&&(this._entry=entry)}},{key:"total_time",get:function(){return this._total_time},set:function(total_time){if(this.initialized)throw new J(this._cmi_element+".total_time",se.READ_ONLY_ELEMENT);if(Eo(this._cmi_element+".total_time",total_time,Me,!0))if(total_time){var e=s(total_time,Me);this._total_time=o(e)}else this._total_time=total_time}},{key:"lesson_mode",get:function(){return this._lesson_mode},set:function(lesson_mode){if(this.initialized)throw new J(this._cmi_element+".lesson_mode",se.READ_ONLY_ELEMENT);Eo(this._cmi_element+".lesson_mode",lesson_mode,"^(normal|browse|review)$")&&(this._lesson_mode=lesson_mode)}},{key:"exit",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".exit",se.WRITE_ONLY_ELEMENT);return this._exit},set:function(exit){"normal"===exit&&(console.warn("SCORM 1.2: Received non-standard value 'normal' for cmi.core.exit; normalizing to empty string."),exit=""),Eo(this._cmi_element+".exit",exit,"^(time-out|suspend|logout|)$",!0)&&(this._exit=exit)}},{key:"session_time",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".session_time",se.WRITE_ONLY_ELEMENT);return this._session_time},set:function(session_time){if(Eo(this._cmi_element+".session_time",session_time,Me)){var e=s(session_time,Me);this._session_time=o(e)}}},{key:"suspend_data",get:function(){return this._suspend_data},set:function(suspend_data){Eo(this._cmi_element+".suspend_data",suspend_data,"^[\\s\\S]{0,64000}$",!0)&&(this._suspend_data=suspend_data)}},{key:"getCurrentTotalTime",value:function(e){var t,i,n,r=this._session_time;return void 0!==e&&(r=o(((new Date).getTime()-e)/1e3)),t=this._total_time,i=r,"string"==typeof(n=RegExp(Me))&&(n=RegExp(n)),o(s(t,n)+s(i,n))}},{key:"toJSON",value:function(){this.jsonString=!0;var result={student_id:this.student_id,student_name:this.student_name,lesson_location:this.lesson_location,credit:this.credit,lesson_status:this.lesson_status,entry:this.entry,lesson_mode:this.lesson_mode,exit:this.exit,session_time:this.session_time,score:this.score};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function ea(e,t,i){return t=ia(t),n=e,!(r=aa()?Reflect.construct(t,i||[],ia(e).constructor):t.apply(e,i))||"object"!==oa(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function ta(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ia(e){return ia=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ia(e)}function na(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ra(e,t)}function ra(e,t){return ra=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ra(e,t)}function oa(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function aa(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(aa=function(){return!!result})()}var sa=Object.defineProperty,ca=function(e,t,i){return function(e,t,i){return t in e?sa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":oa(t))?t+"":t,i)},la=function(e){function t(){return ta(this,t),ea(this,t,[{CMIElement:"cmi.objectives",children:B.objectives_children,errorCode:se.INVALID_SET_VALUE,errorClass:J}])}return na(t,e),t}(me),ua=function(e){function t(){var e;return ta(this,t),e=ea(this,t,["cmi.objectives.n"]),ca(e,"score"),ca(e,"_id",""),ca(e,"_status",""),e.score=new Go({CMIElement:"cmi.objectives.n.score",score_children:B.score_children,score_range:De,invalidErrorCode:se.INVALID_SET_VALUE,invalidTypeCode:se.TYPE_MISMATCH,invalidRangeCode:se.VALUE_OUT_OF_RANGE,errorClass:J,allowEmptyString:!0}),e}return na(t,e),i=t,(n=[{key:"reset",value:function(){var e;this._initialized=!1,this._id="",this._status="",null===(e=this.score)||void 0===e||e.reset()}},{key:"id",get:function(){return this._id},set:function(id){Eo(this._cmi_element+".id",id,Ie)&&(this._id=id)}},{key:"status",get:function(){return this._status},set:function(status){Eo(this._cmi_element+".status",status,Ne)&&(this._status=status)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id,status:this.status,score:this.score};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function da(e){return da=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},da(e)}function fa(e,t){return fa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},fa(e,t)}function va(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function ha(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ha=function(){return!!result})()}var ma=Object.defineProperty,pa=function(e,t,i){return function(e,t,i){return t in e?ma(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":va(t))?t+"":t,i)},ya=function(e){function t(e){var i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=da(t),n=e,!(r=ha()?Reflect.construct(t,i||[],da(e).constructor):t.apply(e,i))||"object"!==va(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi.student_data"]),pa(i,"__children"),pa(i,"_mastery_score",""),pa(i,"_max_time_allowed",""),pa(i,"_time_limit_action",""),i.__children=e||B.student_data_children,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&fa(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new J(this._cmi_element+"._children",se.INVALID_SET_VALUE)}},{key:"mastery_score",get:function(){return this._mastery_score},set:function(mastery_score){if(jo.validateReadOnly(this._cmi_element+".mastery_score",this.initialized),null!=mastery_score){var e=mastery_score;"string"!=typeof e&&(e+=""),""!==e?Eo(this._cmi_element+".mastery_score",e,xe)&&Ao(this._cmi_element+".mastery_score",e,De)&&(this._mastery_score=e):this._mastery_score=mastery_score}}},{key:"max_time_allowed",get:function(){return this._max_time_allowed},set:function(max_time_allowed){if(jo.validateReadOnly(this._cmi_element+".max_time_allowed",this.initialized),null!=max_time_allowed){var e="string"==typeof max_time_allowed?max_time_allowed:max_time_allowed+"";this._max_time_allowed=""!==e?function(e,t){try{Eo(t,e,Me,!0);var i=s(e,Me);return o(i)}catch(e){}try{Eo(t,e,He,!0);var n=c(e,He);return o(n)}catch(e){}throw new J(t,se.TYPE_MISMATCH)}(e,this._cmi_element+".max_time_allowed"):""}}},{key:"time_limit_action",get:function(){return this._time_limit_action},set:function(time_limit_action){if(jo.validateReadOnly(this._cmi_element+".time_limit_action",this.initialized),null!=time_limit_action){var e="string"==typeof time_limit_action?time_limit_action:time_limit_action+"";Eo(this._cmi_element+".time_limit_action",e,"^(exit,message|exit,no message|continue,message|continue,no message)$",!0)&&(this._time_limit_action=e)}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={mastery_score:this.mastery_score,max_time_allowed:this.max_time_allowed,time_limit_action:this.time_limit_action};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function ga(e){return ga=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ga(e)}function _a(e,t){return _a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_a(e,t)}function ba(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Sa(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Sa=function(){return!!result})()}var wa=Object.defineProperty,Oa=function(e,t,i){return function(e,t,i){return t in e?wa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ba(t))?t+"":t,i)},Ca=function(e){function t(e){var i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=ga(t),n=e,!(r=Sa()?Reflect.construct(t,i||[],ga(e).constructor):t.apply(e,i))||"object"!==ba(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi.student_preference"]),Oa(i,"__children"),Oa(i,"_audio",""),Oa(i,"_language",""),Oa(i,"_speed",""),Oa(i,"_text",""),i.__children=e||B.student_preference_children,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_a(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new J(this._cmi_element+"._children",se.INVALID_SET_VALUE)}},{key:"audio",get:function(){return this._audio},set:function(audio){jo.validateScorm12Audio(this._cmi_element+".audio",audio)&&(this._audio=audio)}},{key:"language",get:function(){return this._language},set:function(language){jo.validateScorm12Language(this._cmi_element+".language",language)&&(this._language=language)}},{key:"speed",get:function(){return this._speed},set:function(speed){jo.validateScorm12Speed(this._cmi_element+".speed",speed)&&(this._speed=speed)}},{key:"text",get:function(){return this._text},set:function(text){jo.validateScorm12Text(this._cmi_element+".text",text)&&(this._text=text)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={audio:this.audio,language:this.language,speed:this.speed,text:this.text};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function Ea(e,t,i){return t=Ra(t),n=e,!(r=Ia()?Reflect.construct(t,i||[],Ra(e).constructor):t.apply(e,i))||"object"!==xa(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function Aa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ka(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function ja(e,t,i){return ja="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ra(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},ja(e,t,i||e)}function Ra(e){return Ra=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ra(e)}function Ma(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ta(e,t)}function Ta(e,t){return Ta=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ta(e,t)}function xa(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Ia(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ia=function(){return!!result})()}var Pa=Object.defineProperty,Na=function(e,t,i){return function(e,t,i){return t in e?Pa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":xa(t))?t+"":t,i)},Da=function(e){function t(){return Aa(this,t),Ea(this,t,[{CMIElement:"cmi.interactions",children:B.interactions_children,errorCode:se.INVALID_SET_VALUE,errorClass:J}])}return Ma(t,e),t}(me),qa=function(e){function t(){var e;return Aa(this,t),e=Ea(this,t,["cmi.interactions.n"]),Na(e,"objectives"),Na(e,"correct_responses"),Na(e,"_id",""),Na(e,"_time",""),Na(e,"_type",""),Na(e,"_weighting",""),Na(e,"_student_response",""),Na(e,"_result",""),Na(e,"_latency",""),e.objectives=new me({CMIElement:"cmi.interactions.n.objectives",errorCode:se.INVALID_SET_VALUE,errorClass:J,children:B.objectives_children}),e.correct_responses=new me({CMIElement:"cmi.interactions.correct_responses",errorCode:se.INVALID_SET_VALUE,errorClass:J,children:B.correct_responses_children}),e}return Ma(t,e),ka(t,[{key:"initialize",value:function(){var e,i;ja(Ra(t.prototype),"initialize",this).call(this),null===(e=this.objectives)||void 0===e||e.initialize(),null===(i=this.correct_responses)||void 0===i||i.initialize()}},{key:"reset",value:function(){var e,t;this._initialized=!1,this._id="",this._time="",this._type="",this._weighting="",this._student_response="",this._result="",this._latency="",null===(e=this.objectives)||void 0===e||e.reset(),null===(t=this.correct_responses)||void 0===t||t.reset()}},{key:"id",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".id",se.WRITE_ONLY_ELEMENT);return this._id},set:function(id){Eo(this._cmi_element+".id",id,Ie)&&(this._id=id)}},{key:"time",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".time",se.WRITE_ONLY_ELEMENT);return this._time},set:function(time){Eo(this._cmi_element+".time",time,"^(?:[01]\\d|2[0123]):(?:[012345]\\d):(?:[012345]\\d)(\\.\\d{1,2})?$")&&(this._time=time)}},{key:"type",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".type",se.WRITE_ONLY_ELEMENT);return this._type},set:function(type){Eo(this._cmi_element+".type",type,"^(true-false|choice|fill-in|matching|performance|sequencing|likert|numeric)$")&&(this._type=type)}},{key:"weighting",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".weighting",se.WRITE_ONLY_ELEMENT);return this._weighting},set:function(weighting){Eo(this._cmi_element+".weighting",weighting,xe)&&Ao(this._cmi_element+".weighting",weighting,"-100#100")&&(this._weighting=weighting)}},{key:"student_response",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".student_response",se.WRITE_ONLY_ELEMENT);return this._student_response},set:function(student_response){Eo(this._cmi_element+".student_response",student_response,Pe,!0)&&(this._student_response=student_response)}},{key:"result",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".result",se.WRITE_ONLY_ELEMENT);return this._result},set:function(result){var e=result;"incorrect"===result&&(e="wrong",console.warn("SCORM 1.2: Received non-standard value 'incorrect' for cmi.interactions.n.result; normalizing to 'wrong'.")),Eo(this._cmi_element+".result",e,"^(correct|wrong|unanticipated|neutral|([0-9]{0,3})?(\\.[0-9]*)?)$")&&(this._result=e)}},{key:"latency",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".latency",se.WRITE_ONLY_ELEMENT);return this._latency},set:function(latency){if(Eo(this._cmi_element+".latency",latency,Me)){var e=s(latency,Me);this._latency=o(e)}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id,time:this.time,type:this.type,weighting:this.weighting,student_response:this.student_response,result:this.result,latency:this.latency,objectives:this.objectives,correct_responses:this.correct_responses};return this.jsonString=!1,result}}]),t}(O),La=function(e){function t(){var e;return Aa(this,t),e=Ea(this,t,["cmi.interactions.n.objectives.n"]),Na(e,"_id",""),e}return Ma(t,e),ka(t,[{key:"reset",value:function(){this._initialized=!1,this._id=""}},{key:"id",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".id",se.WRITE_ONLY_ELEMENT);return this._id},set:function(id){Eo(this._cmi_element+".id",id,Ie)&&(this._id=id)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id};return this.jsonString=!1,result}}]),t}(O),za=function(e){function t(){var e;return Aa(this,t),e=Ea(this,t,["cmi.interactions.correct_responses.n"]),Na(e,"_pattern",""),e}return Ma(t,e),ka(t,[{key:"reset",value:function(){this._initialized=!1,this._pattern=""}},{key:"pattern",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".pattern",se.WRITE_ONLY_ELEMENT);return this._pattern},set:function(pattern){Eo(this._cmi_element+".pattern",pattern,Pe,!0)&&(this._pattern=pattern)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={pattern:this._pattern};return this.jsonString=!1,result}}]),t}(O);function Fa(e,t,i){return Fa="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ba(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Fa(e,t,i||e)}function Ba(e){return Ba=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ba(e)}function Va(e,t){return Va=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Va(e,t)}function Ha(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Ua(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ua=function(){return!!result})()}var Ga=Object.defineProperty,Ka=function(e,t,i){return function(e,t,i){return t in e?Ga(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Ha(t))?t+"":t,i)},Ya=function(e){function t(e,student_data,i){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,i){return t=Ba(t),n=e,!(r=Ua()?Reflect.construct(t,i||[],Ba(e).constructor):t.apply(e,i))||"object"!==Ha(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),Ka(n,"__children",""),Ka(n,"__version","3.4"),Ka(n,"_launch_data",""),Ka(n,"_comments",""),Ka(n,"_comments_from_lms",""),Ka(n,"core"),Ka(n,"objectives"),Ka(n,"student_data"),Ka(n,"student_preference"),Ka(n,"interactions"),i&&n.initialize(),n.__children=e||B.cmi_children,n.core=new Zo,n.objectives=new la,n.student_data=student_data||new ya,n.student_preference=new Ca,n.interactions=new Da,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Va(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){var e,t,i,n,r;this._initialized=!1,this._start_time=void 0,this._launch_data="",this._comments="",null===(e=this.core)||void 0===e||e.reset(),null===(t=this.objectives)||void 0===t||t.reset(!0),null===(i=this.interactions)||void 0===i||i.reset(!0),null===(n=this.student_data)||void 0===n||n.reset(),null===(r=this.student_preference)||void 0===r||r.reset()}},{key:"initialize",value:function(){var e,i,n,r,o;Fa(Ba(t.prototype),"initialize",this).call(this),null===(e=this.core)||void 0===e||e.initialize(),null===(i=this.objectives)||void 0===i||i.initialize(),null===(n=this.student_data)||void 0===n||n.initialize(),null===(r=this.student_preference)||void 0===r||r.initialize(),null===(o=this.interactions)||void 0===o||o.initialize()}},{key:"toJSON",value:function(){this.jsonString=!0;var result={suspend_data:this.suspend_data,launch_data:this.launch_data,comments:this.comments,comments_from_lms:this.comments_from_lms,core:this.core,objectives:this.objectives,student_data:this.student_data,student_preference:this.student_preference,interactions:this.interactions};return this.jsonString=!1,result}},{key:"_version",get:function(){return this.__version},set:function(_version){throw new J(this._cmi_element+"._version",se.INVALID_SET_VALUE)}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new J(this._cmi_element+"._children",se.INVALID_SET_VALUE)}},{key:"suspend_data",get:function(){var e;return null===(e=this.core)||void 0===e?void 0:e.suspend_data},set:function(suspend_data){this.core&&(this.core.suspend_data=suspend_data)}},{key:"launch_data",get:function(){return this._launch_data},set:function(launch_data){if(this.initialized)throw new J(this._cmi_element+".launch_data",se.READ_ONLY_ELEMENT);this._launch_data=launch_data}},{key:"comments",get:function(){return this._comments},set:function(comments){Eo(this._cmi_element+".comments",comments,"^[\\s\\S]{0,4096}$",!0)&&(this._comments=comments)}},{key:"comments_from_lms",get:function(){return this._comments_from_lms},set:function(comments_from_lms){if(this.initialized)throw new J(this._cmi_element+".comments_from_lms",se.READ_ONLY_ELEMENT);this._comments_from_lms=comments_from_lms}},{key:"getCurrentTotalTime",value:function(){return this.core.getCurrentTotalTime(this.start_time)}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C);function Wa(e){return Wa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Wa(e)}function Ja(e,t){return Ja=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ja(e,t)}function $a(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Xa(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Xa=function(){return!!result})()}var Qa=Object.defineProperty,Za=function(e){function t(){var e,i,n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Wa(t),n=e,!(r=Xa()?Reflect.construct(t,i||[],Wa(e).constructor):t.apply(e,i))||"object"!==$a(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi.nav"]),n="",function(e,t,i){t in e?Qa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==$a(i="_event")?i+"":i,n),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ja(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._event="",this._initialized=!1}},{key:"event",get:function(){return this._event},set:function(e){(""===e||Eo(this._cmi_element+".event",e,"^(_?(previous|continue|start|resumeAll|exit|exitAll|abandon|abandonAll|suspendAll|retry|retryAll)|choice|jump|_none_)$"))&&(this._event=e)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={event:this.event};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function es(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function ts(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function is(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ns(e){return ns=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ns(e)}function rs(e,t){return rs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},rs(e,t)}function os(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function as(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(as=function(){return!!result})()}var ss=Object.defineProperty,cs=function(e,t,i){return function(e,t,i){return t in e?ss(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":os(t))?t+"":t,i)},ls=function(e){function t(e,i){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=e?function(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){is(e,t,i[t])})}return e}({},e):void 0;return r&&void 0===r.mastery_override&&(r.mastery_override=!0),n=function(e,t,i){return t=ns(t),n=e,!(r=as()?Reflect.construct(t,i||[],ns(e).constructor):t.apply(e,i))||"object"!==os(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,[se,r,i]),cs(n,"statusSetByModule",!1),cs(n,"cmi"),cs(n,"nav"),cs(n,"LMSInitialize"),cs(n,"LMSFinish"),cs(n,"LMSGetValue"),cs(n,"LMSSetValue"),cs(n,"LMSCommit"),cs(n,"LMSGetLastError"),cs(n,"LMSGetErrorString"),cs(n,"LMSGetDiagnostic"),n.cmi=new Ya,n.nav=new Za,n.settings.globalStudentPreferences&&t._globalLearnerPrefs&&(""!==t._globalLearnerPrefs.audio&&(n.cmi.student_preference.audio=t._globalLearnerPrefs.audio),""!==t._globalLearnerPrefs.language&&(n.cmi.student_preference.language=t._globalLearnerPrefs.language),""!==t._globalLearnerPrefs.speed&&(n.cmi.student_preference.speed=t._globalLearnerPrefs.speed),""!==t._globalLearnerPrefs.text&&(n.cmi.student_preference.text=t._globalLearnerPrefs.text)),n.LMSInitialize=n.lmsInitialize,n.LMSFinish=n.lmsFinish,n.LMSGetValue=n.lmsGetValue,n.LMSSetValue=n.lmsSetValue,n.LMSCommit=n.lmsCommit,n.LMSGetLastError=n.lmsGetLastError,n.LMSGetErrorString=n.lmsGetErrorString,n.LMSGetDiagnostic=n.lmsGetDiagnostic,n}var i,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&rs(e,t)}(t,e),i=t,n=[{key:"reset",value:function(e){var t,i;this.commonReset(e),null===(t=this.cmi)||void 0===t||t.reset(),null===(i=this.nav)||void 0===i||i.reset(),this.statusSetByModule=!1}},{key:"lmsInitialize",value:function(){return""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")?(this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),F):(this.cmi.initialize(),this.cmi.core.lesson_status?this.statusSetByModule=!0:this.cmi.core.lesson_status="not attempted",this.initialize("LMSInitialize","LMS was already initialized!","LMS is already finished!"))}},{key:"lmsFinish",value:function(){if(""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))return this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),F;var result=this.terminate("LMSFinish",!0);return result===z&&(""!==this.nav.event?this.processListeners("continue"===this.nav.event?"SequenceNext":"SequencePrevious"):this.settings.autoProgress&&this.processListeners("SequenceNext")),result}},{key:"lmsGetValue",value:function(e){return this.getValue("LMSGetValue",!1,e)}},{key:"lmsSetValue",value:function(e,t){return"cmi.core.lesson_status"===e&&(this.statusSetByModule=!0),this.setValue("LMSSetValue","LMSCommit",!1,e,t)}},{key:"lmsCommit",value:function(){return""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")?(this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),F):this.settings.throttleCommits?(this.scheduleCommit(500,"LMSCommit"),z):this.commit("LMSCommit",!1)}},{key:"lmsGetLastError",value:function(){return this.getLastError("LMSGetLastError")}},{key:"lmsGetErrorString",value:function(e){return this.getErrorString("LMSGetErrorString",e)}},{key:"lmsGetDiagnostic",value:function(e){return this.getDiagnostic("LMSGetDiagnostic",e)}},{key:"setCMIValue",value:function(e,t){var result=this._commonSetCMIValue("LMSSetValue",!1,e,t);return result===z&&this.settings.globalStudentPreferences&&("cmi.student_preference.audio"===e?this._updateGlobalPreference("audio",t):"cmi.student_preference.language"===e?this._updateGlobalPreference("language",t):"cmi.student_preference.speed"===e?this._updateGlobalPreference("speed",t):"cmi.student_preference.text"===e&&this._updateGlobalPreference("text",t)),result}},{key:"_updateGlobalPreference",value:function(e,i){t._globalLearnerPrefs||(t._globalLearnerPrefs={audio:"",language:"",speed:"",text:""}),t._globalLearnerPrefs[e]=i}},{key:"getCMIValue",value:function(e){return this._commonGetCMIValue("getCMIValue",!1,e)}},{key:"getChildElement",value:function(e,t,i){return f(e,"cmi\\.objectives\\.\\d+")?new ua:i&&f(e,"cmi\\.interactions\\.\\d+\\.correct_responses\\.\\d+")?new za:i&&f(e,"cmi\\.interactions\\.\\d+\\.objectives\\.\\d+")?new La:!i&&f(e,"cmi\\.interactions\\.\\d+")?new qa:null}},{key:"validateCorrectResponse",value:function(e,t){}},{key:"getLmsErrorMessageDetails",value:function(e,t){var i,n,r="No Error",o="No Error";return B.error_descriptions[e+=""]&&(r=(null===(i=B.error_descriptions[e])||void 0===i?void 0:i.basicMessage)||r,o=(null===(n=B.error_descriptions[e])||void 0===n?void 0:n.detailMessage)||o),t?o:r}},{key:"replaceWithAnotherScormAPI",value:function(e){this.cmi=e.cmi}},{key:"renderCommitCMI",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.renderCMIToJSONObject();(e||t)&&(i.cmi.core.total_time=this.cmi.getCurrentTotalTime());var n=u(i);switch(this.settings.dataCommitFormat){case"flattened":return n;case"params":return Object.entries(n).map(function(e){var t,i,n=(i=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(t,i)||function(e,t){if(e){if("string"==typeof e)return es(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?es(e,t):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=n[1];return"".concat(n[0],"=").concat(r)});default:return i}}},{key:"renderCommitObject",value:function(e){var t,i,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=this.renderCommitCMI(e,r),a=e||r?this.cmi.getCurrentTotalTime():"",c=s(a,Me),l=this.cmi.core.lesson_status,u=Ce,d=Se;l&&(u="completed"===l||"passed"===l?we:Oe,"passed"===l?d=_e:"failed"===l&&(d=be));var f=(null===(n=this.cmi)||void 0===n||null===(i=n.core)||void 0===i||null===(t=i.score)||void 0===t?void 0:t.getScoreObject())||{},v={successStatus:d,completionStatus:u,runtimeData:o,totalTimeSeconds:c};return f&&(v.score=f),this.settings.autoPopulateCommitMetadata&&(this.settings.courseId&&(v.courseId=this.settings.courseId),this.settings.scoId&&(v.scoId=this.settings.scoId),this.cmi.core.student_id&&(v.learnerId=this.cmi.core.student_id),this.cmi.core.student_name&&(v.learnerName=this.cmi.core.student_name)),v}},{key:"storeData",value:function(e,t){if(e){var i,n,r;if("browse"===this.cmi.core.lesson_mode&&""===((null===(r=this.startingData)||void 0===r||null===(n=r.cmi)||void 0===n||null===(i=n.core)||void 0===i?void 0:i.lesson_status)||"")&&"not attempted"===this.cmi.core.lesson_status)return this.cmi.core.lesson_status="browsed",this.processCommitData(e,t);if(this.cmi.core.lesson_status&&(this.statusSetByModule||"not attempted"!==this.cmi.core.lesson_status)||(this.cmi.core.lesson_status=this.settings.autoCompleteLessonStatus?"completed":"incomplete"),"normal"===this.cmi.core.lesson_mode&&"credit"===this.cmi.core.credit&&this.settings.mastery_override&&""!==this.cmi.student_data.mastery_score&&""!==this.cmi.core.score.raw){var o=parseFloat(this.cmi.core.score.raw),a=parseFloat(this.cmi.student_data.mastery_score);isNaN(o)||isNaN(a)||(this.cmi.core.lesson_status=a>o?"failed":"passed")}if(this.settings.score_overrides_status&&this.statusSetByModule&&"normal"===this.cmi.core.lesson_mode&&"credit"===this.cmi.core.credit&&""!==this.cmi.student_data.mastery_score&&""!==this.cmi.core.score.raw){var s=parseFloat(this.cmi.core.score.raw),c=parseFloat(this.cmi.student_data.mastery_score);isNaN(s)||isNaN(c)||(this.cmi.core.lesson_status=c>s?"failed":"passed")}}return this.processCommitData(e,t)}},{key:"processCommitData",value:function(e,t){var i=this.getCommitObject(e);return"string"==typeof this.settings.lmsCommitUrl?this.processHttpRequest(this.settings.lmsCommitUrl,i,e,t):{result:z,errorCode:0}}}],r=[{key:"clearGlobalPreferences",value:function(){t._globalLearnerPrefs=null}}],n&&ts(i.prototype,n),r&&ts(i,r),t}(Lo);cs(ls,"_globalLearnerPrefs",null);var Scorm12API=ls;function us(e){return us=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},us(e)}function ds(e,t){return ds=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ds(e,t)}function fs(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function vs(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(vs=function(){return!!result})()}var hs=Object.defineProperty,ms=function(e,t,i){return function(e,t,i){return t in e?hs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":fs(t))?t+"":t,i)},ps=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=us(t),n=e,!(r=vs()?Reflect.construct(t,i||[],us(e).constructor):t.apply(e,i))||"object"!==fs(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi.learner_preference"]),ms(e,"__children",V.student_preference_children),ms(e,"_audio_level","1"),ms(e,"_language",""),ms(e,"_delivery_speed","1"),ms(e,"_audio_captioning","0"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ds(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new ie(this._cmi_element+"._children",ce.READ_ONLY_ELEMENT)}},{key:"audio_level",get:function(){return this._audio_level},set:function(audio_level){ln(this._cmi_element+".audio_level",audio_level,Ue)&&un(this._cmi_element+".audio_level",audio_level,"0#999.9999999")&&(this._audio_level=audio_level)}},{key:"language",get:function(){return this._language},set:function(language){ln(this._cmi_element+".language",language,"^([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?$|^$")&&(this._language=language)}},{key:"delivery_speed",get:function(){return this._delivery_speed},set:function(delivery_speed){if(ln(this._cmi_element+".delivery_speed",delivery_speed,Ue)&&un(this._cmi_element+".delivery_speed",delivery_speed,"0#999.9999999")){if(0===parseFloat(delivery_speed))throw new ie(this._cmi_element+".delivery_speed",ce.VALUE_OUT_OF_RANGE);this._delivery_speed=delivery_speed}}},{key:"audio_captioning",get:function(){return this._audio_captioning},set:function(audio_captioning){ln(this._cmi_element+".audio_captioning",audio_captioning,"^-?([0-9]+)$")&&un(this._cmi_element+".audio_captioning",audio_captioning,"-1#1")&&(this._audio_captioning=audio_captioning)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={audio_level:this.audio_level,language:this.language,delivery_speed:this.delivery_speed,audio_captioning:this.audio_captioning};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function ys(e){return e.replace(/[[\]]/g,"")}function gs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _s(e,t){if(!t)return[e];if(e.includes(t))return e.split(t);var i=ys(t);if(!i)return[e];var n=RegExp("(?<!\\\\)".concat(gs(i)),"g"),r=RegExp("\\\\".concat(gs(i)),"g");return e.split(n).map(function(e){return e.replace(r,i)})}function bs(e,t){var i;if(!t)return[e];if(e.includes(t)){var n=e.indexOf(t);return[e.slice(0,n),e.slice(n+t.length)]}var r=ys(t);if(!r)return[e];var o=RegExp("(?<!\\\\)".concat(gs(r))),a=RegExp("\\\\".concat(gs(r)),"g"),s=e.split(o),c=(null!==(i=s[0])&&void 0!==i?i:"").replace(a,r);return 1===s.length?[c]:[c,s.slice(1).join(r).replace(a,r)]}function Ss(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function ws(e,t,i){return t=As(t),n=e,!(r=Ts()?Reflect.construct(t,i||[],As(e).constructor):t.apply(e,i))||"object"!==Ms(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function Os(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cs(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function Es(e,t,i){return Es="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=As(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Es(e,t,i||e)}function As(e){return As=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},As(e)}function ks(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&js(e,t)}function js(e,t){return js=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},js(e,t)}function Rs(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ss(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ss(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ms(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Ts(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ts=function(){return!!result})()}var xs=Object.defineProperty,Is=function(e,t,i){return function(e,t,i){return t in e?xs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Ms(t))?t+"":t,i)},Ps=function(e){function t(){return Os(this,t),ws(this,t,[{CMIElement:"cmi.interactions",children:V.interactions_children,errorCode:ce.READ_ONLY_ELEMENT,errorClass:ie}])}return ks(t,e),t}(me),Ns=function(e){function t(){var e;return Os(this,t),e=ws(this,t,["cmi.interactions.n"]),Is(e,"_id",""),Is(e,"_idIsSet",!1),Is(e,"_type",""),Is(e,"_timestamp",""),Is(e,"_weighting",""),Is(e,"_learner_response",""),Is(e,"_result",""),Is(e,"_latency",""),Is(e,"_description",""),Is(e,"objectives"),Is(e,"correct_responses"),e.objectives=new me({CMIElement:"cmi.interactions.n.objectives",errorCode:ce.READ_ONLY_ELEMENT,errorClass:ie,children:V.objectives_children}),e.correct_responses=new me({CMIElement:"cmi.interactions.n.correct_responses",errorCode:ce.READ_ONLY_ELEMENT,errorClass:ie,children:V.correct_responses_children}),e}return ks(t,e),Cs(t,[{key:"initialize",value:function(){var e,i;Es(As(t.prototype),"initialize",this).call(this),null===(e=this.objectives)||void 0===e||e.initialize(),null===(i=this.correct_responses)||void 0===i||i.initialize()}},{key:"reset",value:function(){this._initialized=!1,this._id="",this._idIsSet=!1,this._type="",this._timestamp="",this._weighting="",this._learner_response="",this._result="",this._latency="",this._description="",this.objectives=new me({CMIElement:"cmi.interactions.n.objectives",errorCode:ce.READ_ONLY_ELEMENT,errorClass:ie,children:V.objectives_children}),this.correct_responses=new me({CMIElement:"cmi.interactions.n.correct_responses",errorCode:ce.READ_ONLY_ELEMENT,errorClass:ie,children:V.correct_responses_children})}},{key:"id",get:function(){return this._id},set:function(id){if(""===id||""===id.trim())throw new ie(this._cmi_element+".id",ce.TYPE_MISMATCH);if(this._idIsSet&&this._id!==id)throw new ie(this._cmi_element+".id",ce.GENERAL_SET_FAILURE);ln(this._cmi_element+".id",id,Ke)&&(this._id=id,this._idIsSet=!0)}},{key:"type",get:function(){return this._type},set:function(type){if(this.initialized&&""===this._id)throw new ie(this._cmi_element+".type",ce.DEPENDENCY_NOT_ESTABLISHED);ln(this._cmi_element+".type",type,"^(true-false|choice|fill-in|long-fill-in|matching|performance|sequencing|likert|numeric|other)$")&&(this._type=type)}},{key:"timestamp",get:function(){return this._timestamp},set:function(timestamp){if(this.initialized&&""===this._id)throw new ie(this._cmi_element+".timestamp",ce.DEPENDENCY_NOT_ESTABLISHED);ln(this._cmi_element+".timestamp",timestamp,Ve)&&(this._timestamp=timestamp)}},{key:"weighting",get:function(){return this._weighting},set:function(weighting){if(this.initialized&&""===this._id)throw new ie(this._cmi_element+".weighting",ce.DEPENDENCY_NOT_ESTABLISHED);ln(this._cmi_element+".weighting",weighting,Ue)&&(this._weighting=weighting)}},{key:"learner_response",get:function(){return this._learner_response},set:function(learner_response){if(this.initialized&&(""===this._type||""===this._id))throw new ie(this._cmi_element+".learner_response",ce.DEPENDENCY_NOT_ESTABLISHED);var e=[],t=et[this.type];if(!t)throw new ie(this._cmi_element+".learner_response",ce.TYPE_MISMATCH);if((null==t?void 0:t.delimiter)?e=_s(learner_response,t.delimiter):e[0]=learner_response,0>=e.length||e.length>t.max)throw new ie(this._cmi_element+".learner_response",ce.GENERAL_SET_FAILURE);for(var i=RegExp(t.format),n=0;e.length>n;n++)if(null==t?void 0:t.delimiter2){var r,o,a,s=null!==(r=e[n])&&void 0!==r?r:"",c="performance"===this.type?bs(s,t.delimiter2):_s(s,t.delimiter2);if(2!==(null==c?void 0:c.length))throw new ie(this._cmi_element+".learner_response",ce.TYPE_MISMATCH);if("performance"===this.type&&""===c[0]&&""===c[1])throw new ie(this._cmi_element+".learner_response",ce.TYPE_MISMATCH);if(!(null===(o=c[0])||void 0===o?void 0:o.match(i)))throw new ie(this._cmi_element+".learner_response",ce.TYPE_MISMATCH);if(!t.format2||!(null===(a=c[1])||void 0===a?void 0:a.match(RegExp(t.format2))))throw new ie(this._cmi_element+".learner_response",ce.TYPE_MISMATCH)}else{var l;if(!(null===(l=e[n])||void 0===l?void 0:l.match(i)))throw new ie(this._cmi_element+".learner_response",ce.TYPE_MISMATCH);if(""!==e[n]&&t.unique)for(var u=0;n>u;u++)if(e[n]===e[u])throw new ie(this._cmi_element+".learner_response",ce.TYPE_MISMATCH)}this._learner_response=learner_response}},{key:"result",get:function(){return this._result},set:function(result){ln(this._cmi_element+".result",result,"^(correct|incorrect|unanticipated|neutral|-?([0-9]{1,4})(\\.[0-9]{1,18})?)$")&&(this._result=result)}},{key:"latency",get:function(){return this._latency},set:function(latency){if(this.initialized&&""===this._id)throw new ie(this._cmi_element+".latency",ce.DEPENDENCY_NOT_ESTABLISHED);ln(this._cmi_element+".latency",latency,He)&&(this._latency=latency)}},{key:"description",get:function(){return this._description},set:function(description){if(this.initialized&&""===this._id)throw new ie(this._cmi_element+".description",ce.DEPENDENCY_NOT_ESTABLISHED);ln(this._cmi_element+".description",description,Fe,!0)&&(this._description=description)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id,type:this.type,objectives:this.objectives,timestamp:this.timestamp,weighting:this.weighting,learner_response:this.learner_response,result:this.result,latency:this.latency,description:this.description,correct_responses:this.correct_responses};return this.jsonString=!1,result}}]),t}(O),Ds=function(e){function t(){var e;return Os(this,t),e=ws(this,t,["cmi.interactions.n.objectives.n"]),Is(e,"_id",""),e}return ks(t,e),Cs(t,[{key:"reset",value:function(){this._initialized=!1,this._id=""}},{key:"id",get:function(){return this._id},set:function(id){if(""===id||""===id.trim())throw new ie(this._cmi_element+".id",ce.TYPE_MISMATCH);ln(this._cmi_element+".id",id,Ke)&&(this._id=id)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id};return this.jsonString=!1,result}}]),t}(O),qs=/^\{(?:lang|case_matters|order_matters)=[^}]+\}/;function Ls(e){for(var result=e;qs.test(result);)result=result.replace(qs,"");return result}var zs=function(e){function t(e){var i;return Os(this,t),i=ws(this,t,["cmi.interactions.n.correct_responses.n"]),Is(i,"_pattern",""),Is(i,"_interactionType"),i._interactionType=e,i}return ks(t,e),Cs(t,[{key:"reset",value:function(){this._initialized=!1,this._pattern=""}},{key:"pattern",get:function(){return this._pattern},set:function(pattern){if("fill-in"!==this._interactionType||""!==pattern){if(ln(this._cmi_element+".pattern",pattern,"^.*$")){if(this._interactionType){var e=tt[this._interactionType];e&&("matching"===this._interactionType&&/\\[.,]/.test(pattern)||function(type,pattern,e){if(pattern.trim()!==pattern)throw new ie("cmi.interactions.n.correct_responses.n.pattern",ce.TYPE_MISMATCH);var t=e.delimiter?_s(pattern,e.delimiter):[pattern],i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.trim()!==s)throw new ie("cmi.interactions.n.correct_responses.n.pattern",ce.TYPE_MISMATCH)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}if("fill-in"!==type||""!==pattern){var c=e.delimiter?_s(pattern,e.delimiter):[pattern];if(!e.delimiter&&pattern.includes(","))throw new ie("cmi.interactions.n.correct_responses.n.pattern",ce.TYPE_MISMATCH);if("numeric"!==type&&(e.unique||!1===e.duplicate)&&new Set(c).size!==c.length)throw new ie("cmi.interactions.n.correct_responses.n.pattern",ce.TYPE_MISMATCH);if(0===c.length||c.length>e.max)throw new ie("cmi.interactions.n.correct_responses.n.pattern",ce.GENERAL_SET_FAILURE);var l=RegExp(e.format),u=e.format2?RegExp(e.format2):null,d=function(e){if(!l.test(e))throw new ie("cmi.interactions.n.correct_responses.n.pattern",ce.TYPE_MISMATCH)},f=function(e,t){if(!t)throw new ie("cmi.interactions.n.correct_responses.n.pattern",ce.TYPE_MISMATCH);var i=_s(e,t);if(2!==i.length||""===i[0]||""===i[1])throw new ie("cmi.interactions.n.correct_responses.n.pattern",ce.TYPE_MISMATCH);if(void 0!==i[0]&&!l.test(i[0])||u&&void 0!==i[1]&&!u.test(i[1]))throw new ie("cmi.interactions.n.correct_responses.n.pattern",ce.TYPE_MISMATCH)},v=!0,h=!1,m=void 0;try{for(var p,y=c[Symbol.iterator]();!(v=(p=y.next()).done);v=!0){var g=p.value;switch(type){case"numeric":if(""===g){if(2>c.length||!e.delimiter||!pattern.includes(e.delimiter))throw new ie("cmi.interactions.n.correct_responses.n.pattern",ce.TYPE_MISMATCH);break}d(g);break;case"performance":var _=e.delimiter2;if(!_)throw new ie("cmi.interactions.n.correct_responses.n.pattern",ce.TYPE_MISMATCH);var b=bs(Ls(g),_);if(2!==b.length)throw new ie("cmi.interactions.n.correct_responses.n.pattern",ce.TYPE_MISMATCH);var S=Rs(b,2),w=S[0],O=S[1];if(""===w&&""===O)throw new ie("cmi.interactions.n.correct_responses.n.pattern",ce.TYPE_MISMATCH);if(void 0===w||!l.test(w))throw new ie("cmi.interactions.n.correct_responses.n.pattern",ce.TYPE_MISMATCH);if(u&&void 0!==O&&!u.test(O))throw new ie("cmi.interactions.n.correct_responses.n.pattern",ce.TYPE_MISMATCH);break;default:e.delimiter2?f(g,e.delimiter2):d(g)}}}catch(e){h=!0,m=e}finally{try{v||null==y.return||y.return()}finally{if(h)throw m}}}}(this._interactionType,pattern,e))}this._pattern=pattern}}else this._pattern=""}},{key:"toJSON",value:function(){this.jsonString=!0;var result={pattern:this.pattern};return this.jsonString=!1,result}}]),t}(O);function Fs(e,t,i){return Fs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Bs(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Fs(e,t,i||e)}function Bs(e){return Bs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Bs(e)}function Vs(e,t){return Vs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Vs(e,t)}function Hs(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Us(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Us=function(){return!!result})()}var Gs=Object.defineProperty,Ks=function(e){function t(){var e,i,n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Bs(t),n=e,!(r=Us()?Reflect.construct(t,i||[],Bs(e).constructor):t.apply(e,i))||"object"!==Hs(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,[{CMIElement:"cmi.score",score_children:V.score_children,max:"",invalidErrorCode:ce.READ_ONLY_ELEMENT,invalidTypeCode:ce.TYPE_MISMATCH,invalidRangeCode:ce.VALUE_OUT_OF_RANGE,decimalRegex:Ue,errorClass:ie}]),n="",function(e,t,i){t in e?Gs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==Hs(i="_scaled")?i+"":i,n),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Vs(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1,this._scaled="",this._raw="",this._min="",this._max=""}},{key:"scaled",get:function(){return this._scaled},set:function(e){ln(this._cmi_element+".scaled",e,Ue)&&un(this._cmi_element+".scaled",e,"-1#1")&&(this._scaled=e)}},{key:"getScoreObject",value:function(){var e=Fs(Bs(t.prototype),"getScoreObject",this).call(this);return Number.isNaN(Number.parseFloat(this.scaled))||(e.scaled=Number.parseFloat(this.scaled)),e}},{key:"toJSON",value:function(){this.jsonString=!0;var result={scaled:this.scaled,raw:this.raw,min:this.min,max:this.max};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(Go);function Ys(e,t,i){return t=Js(t),n=e,!(r=Zs()?Reflect.construct(t,i||[],Js(e).constructor):t.apply(e,i))||"object"!==Qs(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function Ws(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Js(e){return Js=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Js(e)}function $s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Xs(e,t)}function Xs(e,t){return Xs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Xs(e,t)}function Qs(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Zs(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Zs=function(){return!!result})()}var ec=Object.defineProperty,tc=function(e,t,i){return function(e,t,i){return t in e?ec(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Qs(t))?t+"":t,i)},ic=function(e){function t(){return Ws(this,t),Ys(this,t,[{CMIElement:"cmi.comments_from_lms",children:V.comments_children,errorCode:ce.READ_ONLY_ELEMENT,errorClass:ie}])}return $s(t,e),t}(me),nc=function(e){function t(){return Ws(this,t),Ys(this,t,[{CMIElement:"cmi.comments_from_learner",children:V.comments_children,errorCode:ce.READ_ONLY_ELEMENT,errorClass:ie}])}return $s(t,e),t}(me),rc=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Ws(this,t),e=Ys(this,t,["cmi.comments_from_learner.n"]),tc(e,"_comment",""),tc(e,"_location",""),tc(e,"_timestamp",""),tc(e,"_readOnlyAfterInit"),e._comment="",e._location="",e._timestamp="",e._readOnlyAfterInit=i,e}return $s(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1}},{key:"comment",get:function(){return this._comment},set:function(comment){if(this.initialized&&this._readOnlyAfterInit)throw new ie(this._cmi_element+".comment",ce.READ_ONLY_ELEMENT);ln(this._cmi_element+".comment",comment,Be,!0)&&(this._comment=comment)}},{key:"location",get:function(){return this._location},set:function(location){if(this.initialized&&this._readOnlyAfterInit)throw new ie(this._cmi_element+".location",ce.READ_ONLY_ELEMENT);ln(this._cmi_element+".location",location,"^[\\u0000-\\uFFFF]{0,250}$")&&(this._location=location)}},{key:"timestamp",get:function(){return this._timestamp},set:function(timestamp){if(this.initialized&&this._readOnlyAfterInit)throw new ie(this._cmi_element+".timestamp",ce.READ_ONLY_ELEMENT);ln(this._cmi_element+".timestamp",timestamp,Ve)&&(this._timestamp=timestamp)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={comment:this.comment,location:this.location,timestamp:this.timestamp};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function oc(e,t,i){return t=lc(t),n=e,!(r=vc()?Reflect.construct(t,i||[],lc(e).constructor):t.apply(e,i))||"object"!==fc(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function ac(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sc(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function cc(e,t,i){return cc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=lc(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},cc(e,t,i||e)}function lc(e){return lc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},lc(e)}function uc(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&dc(e,t)}function dc(e,t){return dc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},dc(e,t)}function fc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function vc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(vc=function(){return!!result})()}var hc=Object.defineProperty,mc=function(e,t,i){return function(e,t,i){return t in e?hc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":fc(t))?t+"":t,i)},pc=function(e){function t(){return ac(this,t),oc(this,t,[{CMIElement:"cmi.objectives",children:V.objectives_children,errorCode:ce.READ_ONLY_ELEMENT,errorClass:ie}])}return uc(t,e),sc(t,[{key:"findObjectiveById",value:function(id){return this.childArray.find(function(e){return e.id===id})}},{key:"findObjectiveByIndex",value:function(e){return this.childArray[e]}},{key:"setObjectiveByIndex",value:function(e,t){this.childArray[e]=t}}]),t}(me),yc=function(e){function t(){var e;return ac(this,t),e=oc(this,t,["cmi.objectives.n"]),mc(e,"_id",""),mc(e,"_idIsSet",!1),mc(e,"_success_status","unknown"),mc(e,"_completion_status","unknown"),mc(e,"_progress_measure",""),mc(e,"_description",""),mc(e,"score"),e.score=new Ks,e}return uc(t,e),sc(t,[{key:"reset",value:function(){var e;this._initialized=!1,this._id="",this._idIsSet=!1,this._success_status="unknown",this._completion_status="unknown",this._progress_measure="",this._description="",null===(e=this.score)||void 0===e||e.reset()}},{key:"initialize",value:function(){var e;cc(lc(t.prototype),"initialize",this).call(this),null===(e=this.score)||void 0===e||e.initialize()}},{key:"id",get:function(){return this._id},set:function(id){if(""===id||""===id.trim())throw new ie(this._cmi_element+".id",ce.TYPE_MISMATCH);if(this._idIsSet&&this._id!==id)throw new ie(this._cmi_element+".id",ce.GENERAL_SET_FAILURE);ln(this._cmi_element+".id",id,Ke)&&(this._id=id,this._idIsSet=!0)}},{key:"success_status",get:function(){return this._success_status},set:function(success_status){if(this.initialized&&""===this._id)throw new ie(this._cmi_element+".success_status",ce.DEPENDENCY_NOT_ESTABLISHED);ln(this._cmi_element+".success_status",success_status,We)&&(this._success_status=success_status)}},{key:"completion_status",get:function(){return this._completion_status},set:function(completion_status){if(this.initialized&&""===this._id)throw new ie(this._cmi_element+".completion_status",ce.DEPENDENCY_NOT_ESTABLISHED);ln(this._cmi_element+".completion_status",completion_status,Ye)&&(this._completion_status=completion_status)}},{key:"progress_measure",get:function(){return this._progress_measure},set:function(progress_measure){if(this.initialized&&""===this._id)throw new ie(this._cmi_element+".progress_measure",ce.DEPENDENCY_NOT_ESTABLISHED);ln(this._cmi_element+".progress_measure",progress_measure,Ue)&&un(this._cmi_element+".progress_measure",progress_measure,"0#1")&&(this._progress_measure=progress_measure)}},{key:"description",get:function(){return this._description},set:function(description){if(this.initialized&&""===this._id)throw new ie(this._cmi_element+".description",ce.DEPENDENCY_NOT_ESTABLISHED);ln(this._cmi_element+".description",description,Fe,!0)&&(this._description=description)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id,success_status:this.success_status,completion_status:this.completion_status,progress_measure:this.progress_measure,description:this.description,score:this.score};return this.jsonString=!1,result}},{key:"fromJSON",value:function(e){e&&"object"===(void 0===e?"undefined":fc(e))&&("string"==typeof e.id&&(this.id=e.id),"string"==typeof e.success_status&&(this.success_status=e.success_status),"string"==typeof e.completion_status&&(this.completion_status=e.completion_status),void 0!==e.progress_measure&&(this.progress_measure=e.progress_measure+""),"string"==typeof e.description&&(this.description=e.description),e.score&&"object"===fc(e.score)&&(void 0!==e.score.scaled&&(this.score.scaled=e.score.scaled+""),void 0!==e.score.raw&&(this.score.raw=e.score.raw+""),void 0!==e.score.min&&(this.score.min=e.score.min+""),void 0!==e.score.max&&(this.score.max=e.score.max+"")))}}]),t}(O);function gc(e){return gc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},gc(e)}function _c(e,t){return _c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_c(e,t)}function bc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Sc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Sc=function(){return!!result})()}var wc=Object.defineProperty,Oc=function(e,t,i){return function(e,t,i){return t in e?wc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":bc(t))?t+"":t,i)},Cc=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=gc(t),n=e,!(r=Sc()?Reflect.construct(t,i||[],gc(e).constructor):t.apply(e,i))||"object"!==bc(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),Oc(e,"__version","1.0"),Oc(e,"__children",V.cmi_children),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_c(e,t)}(t,e),i=t,(n=[{key:"_version",get:function(){return this.__version},set:function(_version){throw new ie(this._cmi_element+"._version",ce.READ_ONLY_ELEMENT)}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new ie(this._cmi_element+"._children",ce.READ_ONLY_ELEMENT)}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function Ec(e){return Ec=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ec(e)}function Ac(e,t){return Ac=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ac(e,t)}function kc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function jc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(jc=function(){return!!result})()}var Rc=Object.defineProperty,Mc=function(e,t,i){return function(e,t,i){return t in e?Rc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":kc(t))?t+"":t,i)},Tc=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Ec(t),n=e,!(r=jc()?Reflect.construct(t,i||[],Ec(e).constructor):t.apply(e,i))||"object"!==kc(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),Mc(e,"_learner_id",""),Mc(e,"_learner_name",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ac(e,t)}(t,e),i=t,(n=[{key:"learner_id",get:function(){return this._learner_id},set:function(learner_id){if(this.initialized)throw new ie(this._cmi_element+".learner_id",ce.READ_ONLY_ELEMENT);this._learner_id=learner_id}},{key:"learner_name",get:function(){return this._learner_name},set:function(learner_name){if(this.initialized)throw new ie(this._cmi_element+".learner_name",ce.READ_ONLY_ELEMENT);this._learner_name=learner_name}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function xc(e){return xc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},xc(e)}function Ic(e,t){return Ic=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ic(e,t)}function Pc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Nc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Nc=function(){return!!result})()}var Dc=Object.defineProperty,qc=function(e,t,i){return function(e,t,i){return t in e?Dc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Pc(t))?t+"":t,i)},Lc=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=xc(t),n=e,!(r=Nc()?Reflect.construct(t,i||[],xc(e).constructor):t.apply(e,i))||"object"!==Pc(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),qc(e,"_completion_status","unknown"),qc(e,"_success_status","unknown"),qc(e,"_progress_measure",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ic(e,t)}(t,e),i=t,(n=[{key:"completion_status",get:function(){return this._completion_status},set:function(completion_status){ln(this._cmi_element+".completion_status",completion_status,Ye)&&(this._completion_status=completion_status)}},{key:"success_status",get:function(){return this._success_status},set:function(success_status){ln(this._cmi_element+".success_status",success_status,We)&&(this._success_status=success_status)}},{key:"progress_measure",get:function(){return this._progress_measure},set:function(progress_measure){ln(this._cmi_element+".progress_measure",progress_measure,Ue)&&un(this._cmi_element+".progress_measure",progress_measure,"0#1")&&(this._progress_measure=progress_measure)}},{key:"reset",value:function(){this._initialized=!1,this._completion_status="unknown",this._success_status="unknown",this._progress_measure=""}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function zc(e){return zc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},zc(e)}function Fc(e,t){return Fc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Fc(e,t)}function Bc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Vc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Vc=function(){return!!result})()}var Hc=Object.defineProperty,Uc=function(e,t,i){return function(e,t,i){return t in e?Hc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Bc(t))?t+"":t,i)},Gc=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=zc(t),n=e,!(r=Vc()?Reflect.construct(t,i||[],zc(e).constructor):t.apply(e,i))||"object"!==Bc(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),Uc(e,"_entry",""),Uc(e,"_exit",""),Uc(e,"_session_time","PT0H0M0S"),Uc(e,"_total_time","PT0S"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Fc(e,t)}(t,e),i=t,(n=[{key:"entry",get:function(){return this._entry},set:function(entry){if(this.initialized)throw new ie(this._cmi_element+".entry",ce.READ_ONLY_ELEMENT);this._entry=entry}},{key:"exit",get:function(){if(!this.jsonString)throw new ie(this._cmi_element+".exit",ce.WRITE_ONLY_ELEMENT);return this._exit},set:function(exit){"logout"===exit&&console.warn('SCORM 2004: cmi.exit value "logout" is deprecated per 4th Edition. Consider using "normal" or "suspend" instead.'),ln(this._cmi_element+".exit",exit,"^(time-out|suspend|logout|normal)$",!0)&&(this._exit=exit)}},{key:"getExitValueInternal",value:function(){return this._exit}},{key:"session_time",get:function(){if(!this.jsonString)throw new ie(this._cmi_element+".session_time",ce.WRITE_ONLY_ELEMENT);return this._session_time},set:function(session_time){ln(this._cmi_element+".session_time",session_time,He)&&(this._session_time=session_time)}},{key:"total_time",get:function(){return this._total_time},set:function(total_time){if(this.initialized)throw new ie(this._cmi_element+".total_time",ce.READ_ONLY_ELEMENT);this._total_time=total_time}},{key:"getCurrentTotalTime",value:function(e){var t,i,n,r=this._session_time;return void 0!==e&&(r=a(((new Date).getTime()-e)/1e3)),t=this._total_time,i=r,n=RegExp(He),a(c(t,n)+c(i,n))}},{key:"reset",value:function(){this._initialized=!1,this._entry="ab-initio",this._exit="",this._session_time="PT0H0M0S"}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function Kc(e){return Kc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Kc(e)}function Yc(e,t){return Yc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Yc(e,t)}function Wc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Jc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Jc=function(){return!!result})()}var $c=Object.defineProperty,Xc=function(e,t,i){return function(e,t,i){return t in e?$c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Wc(t))?t+"":t,i)},Qc=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Kc(t),n=e,!(r=Jc()?Reflect.construct(t,i||[],Kc(e).constructor):t.apply(e,i))||"object"!==Wc(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),Xc(e,"_location",""),Xc(e,"_launch_data",""),Xc(e,"_suspend_data",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Yc(e,t)}(t,e),i=t,(n=[{key:"location",get:function(){return this._location},set:function(location){ln(this._cmi_element+".location",location,"^[\\u0000-\\uFFFF]{0,1000}$")&&(this._location=location)}},{key:"launch_data",get:function(){return this._launch_data},set:function(launch_data){if(this.initialized)throw new ie(this._cmi_element+".launch_data",ce.READ_ONLY_ELEMENT);this._launch_data=launch_data}},{key:"suspend_data",get:function(){return this._suspend_data},set:function(suspend_data){ln(this._cmi_element+".suspend_data",suspend_data,Le,!0)&&(this._suspend_data=suspend_data)}},{key:"reset",value:function(){this._initialized=!1,this._location="",this._suspend_data=""}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function Zc(e){return Zc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Zc(e)}function el(e,t){return el=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},el(e,t)}function tl(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function il(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(il=function(){return!!result})()}var nl=Object.defineProperty,rl=function(e,t,i){return function(e,t,i){return t in e?nl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":tl(t))?t+"":t,i)},ol=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Zc(t),n=e,!(r=il()?Reflect.construct(t,i||[],Zc(e).constructor):t.apply(e,i))||"object"!==tl(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),rl(e,"_credit","credit"),rl(e,"_mode","normal"),rl(e,"_time_limit_action","continue,no message"),rl(e,"_max_time_allowed",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&el(e,t)}(t,e),i=t,(n=[{key:"credit",get:function(){return this._credit},set:function(credit){if(this.initialized)throw new ie(this._cmi_element+".credit",ce.READ_ONLY_ELEMENT);if(!/^(credit|no-credit)$/.test(credit))throw new ie(this._cmi_element+".credit",ce.TYPE_MISMATCH);this._credit=credit}},{key:"mode",get:function(){return this._mode},set:function(mode){if(this.initialized)throw new ie(this._cmi_element+".mode",ce.READ_ONLY_ELEMENT);if(!/^(browse|normal|review)$/.test(mode))throw new ie(this._cmi_element+".mode",ce.TYPE_MISMATCH);this._mode=mode}},{key:"time_limit_action",get:function(){return this._time_limit_action},set:function(time_limit_action){if(this.initialized)throw new ie(this._cmi_element+".time_limit_action",ce.READ_ONLY_ELEMENT);if(!/^(exit,message|exit,no message|continue,message|continue,no message)$/.test(time_limit_action))throw new ie(this._cmi_element+".time_limit_action",ce.TYPE_MISMATCH);this._time_limit_action=time_limit_action}},{key:"max_time_allowed",get:function(){return this._max_time_allowed},set:function(max_time_allowed){if(this.initialized)throw new ie(this._cmi_element+".max_time_allowed",ce.READ_ONLY_ELEMENT);if(""!==max_time_allowed){if(!RegExp(He).test(max_time_allowed))throw new ie(this._cmi_element+".max_time_allowed",ce.TYPE_MISMATCH);this._max_time_allowed=max_time_allowed}else this._max_time_allowed=max_time_allowed}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function al(e){return al=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},al(e)}function sl(e,t){return sl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},sl(e,t)}function cl(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function ll(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ll=function(){return!!result})()}var ul=Object.defineProperty,dl=function(e,t,i){return function(e,t,i){return t in e?ul(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":cl(t))?t+"":t,i)},fl=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=al(t),n=e,!(r=ll()?Reflect.construct(t,i||[],al(e).constructor):t.apply(e,i))||"object"!==cl(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),dl(e,"_scaled_passing_score",""),dl(e,"_completion_threshold",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&sl(e,t)}(t,e),i=t,(n=[{key:"scaled_passing_score",get:function(){return this._scaled_passing_score},set:function(scaled_passing_score){var e;if(this.initialized)throw new ie(this._cmi_element+".scaled_passing_score",null!==(e=ce.READ_ONLY_ELEMENT)&&void 0!==e?e:404);if(""!==scaled_passing_score){var t;if(!RegExp(Ue).test(scaled_passing_score))throw new ie(this._cmi_element+".scaled_passing_score",null!==(t=ce.TYPE_MISMATCH)&&void 0!==t?t:406);var i,n=parseFloat(scaled_passing_score);if(-1>n||n>1)throw new ie(this._cmi_element+".scaled_passing_score",null!==(i=ce.VALUE_OUT_OF_RANGE)&&void 0!==i?i:407);this._scaled_passing_score=scaled_passing_score}else this._scaled_passing_score=scaled_passing_score}},{key:"completion_threshold",get:function(){return this._completion_threshold},set:function(e){var t;if(this.initialized)throw new ie(this._cmi_element+".completion_threshold",null!==(t=ce.READ_ONLY_ELEMENT)&&void 0!==t?t:404);if(""!==e){var i;if(!RegExp(Ue).test(e))throw new ie(this._cmi_element+".completion_threshold",null!==(i=ce.TYPE_MISMATCH)&&void 0!==i?i:406);var n,r=parseFloat(e);if(0>r||r>1)throw new ie(this._cmi_element+".completion_threshold",null!==(n=ce.VALUE_OUT_OF_RANGE)&&void 0!==n?n:407);this._completion_threshold=e}else this._completion_threshold=e}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function vl(e,t,i){return vl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=hl(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},vl(e,t,i||e)}function hl(e){return hl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},hl(e)}function ml(e,t){return ml=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ml(e,t)}function pl(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function yl(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(yl=function(){return!!result})()}var gl=Object.defineProperty,_l=function(e,t,i){return function(e,t,i){return t in e?gl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":pl(t))?t+"":t,i)},bl=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=hl(t),n=e,!(r=yl()?Reflect.construct(t,i||[],hl(e).constructor):t.apply(e,i))||"object"!==pl(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),_l(e,"metadata"),_l(e,"learner"),_l(e,"status"),_l(e,"session"),_l(e,"content"),_l(e,"settings"),_l(e,"thresholds"),_l(e,"learner_preference"),_l(e,"score"),_l(e,"comments_from_learner"),_l(e,"comments_from_lms"),_l(e,"interactions"),_l(e,"objectives"),e.metadata=new Cc,e.learner=new Tc,e.status=new Lc,e.session=new Gc,e.content=new Qc,e.settings=new ol,e.thresholds=new fl,e.learner_preference=new ps,e.score=new Ks,e.comments_from_learner=new nc,e.comments_from_lms=new ic,e.interactions=new Ps,e.objectives=new pc,i&&e.initialize(),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ml(e,t)}(t,e),i=t,(n=[{key:"initialize",value:function(){var e,i,n,r,o,a,s,c,l,u,d,f,v;vl(hl(t.prototype),"initialize",this).call(this),null===(e=this.metadata)||void 0===e||e.initialize(),null===(i=this.learner)||void 0===i||i.initialize(),null===(n=this.status)||void 0===n||n.initialize(),null===(r=this.session)||void 0===r||r.initialize(),null===(o=this.content)||void 0===o||o.initialize(),null===(a=this.settings)||void 0===a||a.initialize(),null===(s=this.thresholds)||void 0===s||s.initialize(),null===(c=this.learner_preference)||void 0===c||c.initialize(),null===(l=this.score)||void 0===l||l.initialize(),null===(u=this.comments_from_learner)||void 0===u||u.initialize(),null===(d=this.comments_from_lms)||void 0===d||d.initialize(),null===(f=this.interactions)||void 0===f||f.initialize(),null===(v=this.objectives)||void 0===v||v.initialize()}},{key:"reset",value:function(){var e,t,i,n,r,o,a,s,c,l,u,d,f;this._initialized=!1,this._start_time=void 0,null===(e=this.metadata)||void 0===e||e.reset(),null===(t=this.learner)||void 0===t||t.reset(),null===(i=this.status)||void 0===i||i.reset(),null===(n=this.session)||void 0===n||n.reset(),null===(r=this.content)||void 0===r||r.reset(),null===(o=this.settings)||void 0===o||o.reset(),null===(a=this.thresholds)||void 0===a||a.reset(),null===(s=this.objectives)||void 0===s||s.reset(!0),null===(c=this.interactions)||void 0===c||c.reset(!0),null===(l=this.score)||void 0===l||l.reset(),null===(u=this.comments_from_learner)||void 0===u||u.reset(),null===(d=this.comments_from_lms)||void 0===d||d.reset(),null===(f=this.learner_preference)||void 0===f||f.reset()}},{key:"_version",get:function(){return this.metadata._version},set:function(_version){this.metadata._version=_version}},{key:"_children",get:function(){return this.metadata._children},set:function(_children){this.metadata._children=_children}},{key:"completion_status",get:function(){return this.status.completion_status},set:function(completion_status){this.status.completion_status=completion_status}},{key:"completion_threshold",get:function(){return this.thresholds.completion_threshold},set:function(e){this.thresholds.completion_threshold=e}},{key:"credit",get:function(){return this.settings.credit},set:function(credit){this.settings.credit=credit}},{key:"entry",get:function(){return this.session.entry},set:function(entry){this.session.entry=entry}},{key:"exit",get:function(){return this.session.jsonString=this.jsonString,this.session.exit},set:function(exit){this.session.exit=exit}},{key:"getExitValueInternal",value:function(){return this.session.getExitValueInternal()}},{key:"launch_data",get:function(){return this.content.launch_data},set:function(launch_data){this.content.launch_data=launch_data}},{key:"learner_id",get:function(){return this.learner.learner_id},set:function(learner_id){this.learner.learner_id=learner_id}},{key:"learner_name",get:function(){return this.learner.learner_name},set:function(learner_name){this.learner.learner_name=learner_name}},{key:"location",get:function(){return this.content.location},set:function(location){this.content.location=location}},{key:"max_time_allowed",get:function(){return this.settings.max_time_allowed},set:function(max_time_allowed){this.settings.max_time_allowed=max_time_allowed}},{key:"mode",get:function(){return this.settings.mode},set:function(mode){this.settings.mode=mode}},{key:"progress_measure",get:function(){return this.status.progress_measure},set:function(progress_measure){this.status.progress_measure=progress_measure}},{key:"scaled_passing_score",get:function(){return this.thresholds.scaled_passing_score},set:function(scaled_passing_score){this.thresholds.scaled_passing_score=scaled_passing_score}},{key:"session_time",get:function(){return this.session.jsonString=this.jsonString,this.session.session_time},set:function(session_time){this.session.session_time=session_time}},{key:"success_status",get:function(){return this.status.success_status},set:function(success_status){this.status.success_status=success_status}},{key:"suspend_data",get:function(){return this.content.suspend_data},set:function(suspend_data){this.content.suspend_data=suspend_data}},{key:"time_limit_action",get:function(){return this.settings.time_limit_action},set:function(time_limit_action){this.settings.time_limit_action=time_limit_action}},{key:"total_time",get:function(){return this.session.total_time},set:function(total_time){this.session.total_time=total_time}},{key:"getCurrentTotalTime",value:function(){return this.session.getCurrentTotalTime(this.start_time)}},{key:"toJSON",value:function(){this.jsonString=!0,this.session.jsonString=!0;var result={comments_from_learner:this.comments_from_learner,comments_from_lms:this.comments_from_lms,completion_status:this.completion_status,completion_threshold:this.completion_threshold,credit:this.credit,entry:this.entry,exit:this.exit,interactions:this.interactions,launch_data:this.launch_data,learner_id:this.learner_id,learner_name:this.learner_name,learner_preference:this.learner_preference,location:this.location,max_time_allowed:this.max_time_allowed,mode:this.mode,objectives:this.objectives,progress_measure:this.progress_measure,scaled_passing_score:this.scaled_passing_score,score:this.score,session_time:this.session_time,success_status:this.success_status,suspend_data:this.suspend_data,time_limit_action:this.time_limit_action,total_time:this.total_time};return this.jsonString=!1,this.session.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(C);function Sl(e,t,i){return t=Al(t),n=e,!(r=Tl()?Reflect.construct(t,i||[],Al(e).constructor):t.apply(e,i))||"object"!==Ml(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function wl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ol(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function Cl(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function El(e,t,i){return El="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Al(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},El(e,t,i||e)}function Al(e){return Al=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Al(e)}function kl(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Rl(e,t)}function jl(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Cl(e,t,i[t])})}return e}function Rl(e,t){return Rl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Rl(e,t)}function Ml(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Tl(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Tl=function(){return!!result})()}var xl=Object.defineProperty,Il=function(e,t,i){return function(e,t,i){return t in e?xl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Ml(t))?t+"":t,i)},Pl=function(e){function t(){var e;return wl(this,t),e=Sl(this,t,["adl"]),Il(e,"nav"),Il(e,"data",new Dl),Il(e,"_sequencing",null),e.nav=new Nl,e.data=new Dl,e}return kl(t,e),Ol(t,[{key:"initialize",value:function(){var e;El(Al(t.prototype),"initialize",this).call(this),null===(e=this.nav)||void 0===e||e.initialize()}},{key:"reset",value:function(){var e;this._initialized=!1,null===(e=this.nav)||void 0===e||e.reset()}},{key:"sequencing",get:function(){return this._sequencing},set:function(e){this._sequencing=e,e&&(e.adlNav=this.nav,this.nav.sequencing=e)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={nav:this.nav,data:this.data};return this.jsonString=!1,result}}]),t}(O),Nl=function(e){function t(){var e;return wl(this,t),e=Sl(this,t,["adl.nav"]),Il(e,"_request","_none_"),Il(e,"_sequencing",null),Il(e,"request_valid"),e.request_valid=new Fl,e.request_valid.setParentNav(e),e}return kl(t,e),Ol(t,[{key:"sequencing",get:function(){return this._sequencing},set:function(e){this._sequencing=e}},{key:"initialize",value:function(){var e;El(Al(t.prototype),"initialize",this).call(this),null===(e=this.request_valid)||void 0===e||e.initialize()}},{key:"reset",value:function(){var e;this._initialized=!1,this._request="_none_",this._sequencing&&(this._sequencing.adlNav=null),this._sequencing=null,null===(e=this.request_valid)||void 0===e||e.reset()}},{key:"request",get:function(){return this._request},set:function(request){ln(this._cmi_element+".request",request,Je)&&(this._request=request)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={request:this.request};return this.jsonString=!1,result}}]),t}(O),Dl=function(e){function t(){return wl(this,t),Sl(this,t,[{CMIElement:"adl.data",children:V.adl_data_children,errorCode:ce.READ_ONLY_ELEMENT,errorClass:ie}])}return kl(t,e),t}(me),ql=function(e){function t(){var e;return wl(this,t),e=Sl(this,t,["adl.data.n"]),Il(e,"_id",""),Il(e,"_store",""),Il(e,"_idIsSet",!1),Il(e,"_storeIsSet",!1),e}return kl(t,e),Ol(t,[{key:"reset",value:function(){this._initialized=!1,this._idIsSet=!1,this._storeIsSet=!1}},{key:"id",get:function(){return this._id},set:function(id){if(this.initialized)throw new ie(this._cmi_element+".id",ce.READ_ONLY_ELEMENT);ln(this._cmi_element+".id",id,Ke)&&(this._id=id,this._idIsSet=!0)}},{key:"store",get:function(){if(this.initialized&&!this._storeIsSet)throw new ie(this._cmi_element+".store",ce.VALUE_NOT_INITIALIZED);return this._store},set:function(e){if(this.initialized&&!this._idIsSet)throw new ie(this._cmi_element+".store",ce.DEPENDENCY_NOT_ESTABLISHED);ln(this._cmi_element+".store",e,Le)&&(this._store=e,this._storeIsSet=!0)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this._id,store:this._store};return this.jsonString=!1,result}}]),t}(O),Ll=function(){function e(){wl(this,e),Il(this,"_parentNav",null),Il(this,"_staticValues",{})}return Ol(e,[{key:"setParentNav",value:function(nav){this._parentNav=nav}},{key:"_isTargetValid",value:function(e){var t,i;if(null===(i=this._parentNav)||void 0===i||null===(t=i.sequencing)||void 0===t?void 0:t.overallSequencingProcess){var n=this._parentNav.sequencing.overallSequencingProcess;if(n.predictChoiceEnabled)return n.predictChoiceEnabled(e)?"true":"false"}var r=this._staticValues[e];return r===ye?"true":r===ge?"false":"unknown"}},{key:"getAll",value:function(){return jl({},this._staticValues)}},{key:"setAll",value:function(e){this._staticValues=jl({},e)}}]),e}(),zl=function(){function e(){wl(this,e),Il(this,"_parentNav",null),Il(this,"_staticValues",{})}return Ol(e,[{key:"setParentNav",value:function(nav){this._parentNav=nav}},{key:"_isTargetValid",value:function(e){var t,i;if(null===(i=this._parentNav)||void 0===i||null===(t=i.sequencing)||void 0===t?void 0:t.activityTree)return this._parentNav.sequencing.activityTree.getActivity(e)?"true":"false";var n=this._staticValues[e];return n===ye?"true":n===ge?"false":"unknown"}},{key:"getAll",value:function(){return jl({},this._staticValues)}},{key:"setAll",value:function(e){this._staticValues=jl({},e)}}]),e}(),Fl=function(e){function t(){var e;return wl(this,t),e=Sl(this,t,["adl.nav.request_valid"]),Il(e,"_continue","unknown"),Il(e,"_previous","unknown"),Il(e,"_choice"),Il(e,"_jump"),Il(e,"_exit","unknown"),Il(e,"_exitAll","unknown"),Il(e,"_abandon","unknown"),Il(e,"_abandonAll","unknown"),Il(e,"_suspendAll","unknown"),Il(e,"_parentNav",null),e._choice=new Ll,e._jump=new zl,e}return kl(t,e),Ol(t,[{key:"setParentNav",value:function(nav){this._parentNav=nav,this._choice.setParentNav(nav),this._jump.setParentNav(nav)}},{key:"reset",value:function(){this._initialized=!1,this._continue="unknown",this._previous="unknown",this._choice.setAll({}),this._jump.setAll({}),this._exit="unknown",this._exitAll="unknown",this._abandon="unknown",this._abandonAll="unknown",this._suspendAll="unknown"}},{key:"continue",get:function(){var e,t;if(null===(t=this._parentNav)||void 0===t||null===(e=t.sequencing)||void 0===e?void 0:e.overallSequencingProcess){var i=this._parentNav.sequencing.overallSequencingProcess;if(i.predictContinueEnabled)return i.predictContinueEnabled()?"true":"false"}return this._continue},set:function(e){if(this.initialized)throw new ie(this._cmi_element+".continue",ce.READ_ONLY_ELEMENT);ln(this._cmi_element+".continue",e,$e)&&(this._continue=e)}},{key:"previous",get:function(){var e,t;if(null===(t=this._parentNav)||void 0===t||null===(e=t.sequencing)||void 0===e?void 0:e.overallSequencingProcess){var i=this._parentNav.sequencing.overallSequencingProcess;if(i.predictPreviousEnabled)return i.predictPreviousEnabled()?"true":"false"}return this._previous},set:function(e){if(this.initialized)throw new ie(this._cmi_element+".previous",ce.READ_ONLY_ELEMENT);ln(this._cmi_element+".previous",e,$e)&&(this._previous=e)}},{key:"choice",get:function(){return this._choice},set:function(e){if(this.initialized)throw new ie(this._cmi_element+".choice",ce.READ_ONLY_ELEMENT);if("object"!==(void 0===e?"undefined":Ml(e)))throw new ie(this._cmi_element+".choice",ce.TYPE_MISMATCH);var t={};for(var i in e)if({}.hasOwnProperty.call(e,i)&&ln(this._cmi_element+".choice."+i,e[i]||"",$e)&&ln(this._cmi_element+".choice."+i,i,Xe)){var n=e[i];"true"===n?t[i]=ye:"false"===n?t[i]=ge:"unknown"===n&&(t[i]=pe)}this._choice.setAll(t)}},{key:"jump",get:function(){return this._jump},set:function(e){if(this.initialized)throw new ie(this._cmi_element+".jump",ce.READ_ONLY_ELEMENT);if("object"!==(void 0===e?"undefined":Ml(e)))throw new ie(this._cmi_element+".jump",ce.TYPE_MISMATCH);var t={};for(var i in e)if({}.hasOwnProperty.call(e,i)&&ln(this._cmi_element+".jump."+i,e[i]||"",$e)&&ln(this._cmi_element+".jump."+i,i,Xe)){var n=e[i];"true"===n?t[i]=ye:"false"===n?t[i]=ge:"unknown"===n&&(t[i]=pe)}this._jump.setAll(t)}},{key:"exit",get:function(){return this._exit},set:function(e){if(this.initialized)throw new ie(this._cmi_element+".exit",ce.READ_ONLY_ELEMENT);ln(this._cmi_element+".exit",e,$e)&&(this._exit=e)}},{key:"exitAll",get:function(){return this._exitAll},set:function(e){if(this.initialized)throw new ie(this._cmi_element+".exitAll",ce.READ_ONLY_ELEMENT);ln(this._cmi_element+".exitAll",e,$e)&&(this._exitAll=e)}},{key:"abandon",get:function(){return this._abandon},set:function(e){if(this.initialized)throw new ie(this._cmi_element+".abandon",ce.READ_ONLY_ELEMENT);ln(this._cmi_element+".abandon",e,$e)&&(this._abandon=e)}},{key:"abandonAll",get:function(){return this._abandonAll},set:function(e){if(this.initialized)throw new ie(this._cmi_element+".abandonAll",ce.READ_ONLY_ELEMENT);ln(this._cmi_element+".abandonAll",e,$e)&&(this._abandonAll=e)}},{key:"suspendAll",get:function(){return this._suspendAll},set:function(e){if(this.initialized)throw new ie(this._cmi_element+".suspendAll",ce.READ_ONLY_ELEMENT);ln(this._cmi_element+".suspendAll",e,$e)&&(this._suspendAll=e)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={previous:this.previous,continue:this.continue,choice:this._choice.getAll(),jump:this._jump.getAll(),exit:this.exit,exitAll:this.exitAll,abandon:this.abandon,abandonAll:this.abandonAll,suspendAll:this.suspendAll};return this.jsonString=!1,result}}]),t}(O);function Bl(e,t,i){return Bl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Vl(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Bl(e,t,i||e)}function Vl(e){return Vl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Vl(e)}function Hl(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Ul(e,t){return Ul=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ul(e,t)}function Gl(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Kl(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Kl=function(){return!!result})()}var Yl=Object.defineProperty,Wl=function(e,t,i){return function(e,t,i){return t in e?Yl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Gl(t))?t+"":t,i)},Jl=function(e){function t(e){var i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=Vl(t),n=e,!(r=Kl()?Reflect.construct(t,i||[],Vl(e).constructor):t.apply(e,i))||"object"!==Gl(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["activityTree"]),Wl(i,"_root",null),Wl(i,"_currentActivity",null),Wl(i,"_suspendedActivity",null),Wl(i,"_activities",new Map),e&&(i.root=e),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ul(e,t)}(t,e),i=t,n=[{key:"initialize",value:function(){Bl(Vl(t.prototype),"initialize",this).call(this),this._root&&this._root.initialize()}},{key:"reset",value:function(){this._initialized=!1,this._currentActivity=null,this._suspendedActivity=null,this._activities.clear(),this._root&&(this._root.reset(),this._activities.set(this._root.id,this._root),this._addActivitiesToMap(this._root))}},{key:"root",get:function(){return this._root},set:function(e){if(null!==e&&!Hl(e,Vn))throw new ie(this._cmi_element+".root",ce.TYPE_MISMATCH);this._activities.clear(),this._root=e,e&&(this._activities.set(e.id,e),this._addActivitiesToMap(e))}},{key:"_addActivitiesToMap",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;this._activities.set(a.id,a),this._addActivitiesToMap(a)}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"currentActivity",get:function(){return this._currentActivity},set:function(e){if(null!==e&&!Hl(e,Vn))throw new ie(this._cmi_element+".currentActivity",ce.TYPE_MISMATCH);if(this._currentActivity){this._currentActivity.isActive=!1;for(var t=this._currentActivity.parent;t;)t.isActive=!1,t=t.parent}if(this._currentActivity=e,e){e.isActive=!0;for(var i=e.parent;i;)i.isActive=!0,i=i.parent}}},{key:"setCurrentActivityWithoutActivation",value:function(e){if(null!==e&&!Hl(e,Vn))throw new ie(this._cmi_element+".currentActivity",ce.TYPE_MISMATCH);if(this._currentActivity){var t=new Set;if(e){t.add(e);for(var i=e.parent;i;)t.add(i),i=i.parent}this._currentActivity.isActive=!1;for(var n=this._currentActivity.parent;n;)t.has(n)||(n.isActive=!1),n=n.parent}this._currentActivity=e}},{key:"suspendedActivity",get:function(){return this._suspendedActivity},set:function(e){if(null!==e&&!Hl(e,Vn))throw new ie(this._cmi_element+".suspendedActivity",ce.TYPE_MISMATCH);if(this._suspendedActivity){this._suspendedActivity.isSuspended=!1;for(var t=this._suspendedActivity.parent;t;)t.isSuspended=!1,t=t.parent}if(this._suspendedActivity=e,e){e.isSuspended=!0;for(var i=e.parent;i;)i.isSuspended=!0,i=i.parent}}},{key:"getActivity",value:function(id){return this._activities.get(id)||null}},{key:"getAllActivities",value:function(){return Array.from(this._activities.values())}},{key:"getParent",value:function(e){return e.parent}},{key:"getChildren",value:function(e){return 1>=arguments.length||void 0===arguments[1]||arguments[1]?e.getAvailableChildren():e.children}},{key:"getSiblings",value:function(e){return e.parent?e.parent.children.filter(function(t){return t!==e}):[]}},{key:"getNextSibling",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1];if(!e.parent)return null;var n=i?e.parent.getAvailableChildren():e.parent.children,r=n.indexOf(e);return-1===r&&i&&(r=(n=e.parent.children).indexOf(e)),-1===r||r===n.length-1?null:null!==(t=n[r+1])&&void 0!==t?t:null}},{key:"getPreviousSibling",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1];if(!e.parent)return null;var n=i?e.parent.getAvailableChildren():e.parent.children,r=n.indexOf(e);return-1===r&&i&&(r=(n=e.parent.children).indexOf(e)),r>0&&null!==(t=n[r-1])&&void 0!==t?t:null}},{key:"getFirstChild",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1]?e.getAvailableChildren():e.children;return 0===i.length?null:null!==(t=i[0])&&void 0!==t?t:null}},{key:"getLastChild",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1]?e.getAvailableChildren():e.children;return 0===i.length?null:null!==(t=i[i.length-1])&&void 0!==t?t:null}},{key:"getCommonAncestor",value:function(e,t){for(var i=[],n=e;n;)i.unshift(n),n=n.parent;for(n=t;n;){if(i.includes(n))return n;n=n.parent}return null}},{key:"toJSON",value:function(){this.jsonString=!0;var result={root:this._root,currentActivity:this._currentActivity?this._currentActivity.id:null,suspendedActivity:this._suspendedActivity?this._suspendedActivity.id:null};return this.jsonString=!1,result}}],n&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);function $l(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Xl(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ql(e,t,i){return Ql="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Zl(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Ql(e,t,i||e)}function Zl(e){return Zl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Zl(e)}function eu(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function tu(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Xl(e,t,i[t])})}return e}function iu(e,t){return iu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},iu(e,t)}function nu(e){return function(e){if(Array.isArray(e))return $l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return $l(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?$l(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ru(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function ou(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ou=function(){return!!result})()}var au=Object.defineProperty,su=function(e,t,i){return function(e,t,i){return t in e?au(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ru(t))?t+"":t,i)},cu=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Zl(t),n=e,!(r=ou()?Reflect.construct(t,i||[],Zl(e).constructor):t.apply(e,i))||"object"!==ru(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["sequencing"]),su(e,"_activityTree"),su(e,"_sequencingRules"),su(e,"_sequencingControls"),su(e,"_rollupRules"),su(e,"_adlNav",null),su(e,"_hideLmsUi",[]),su(e,"_auxiliaryResources",[]),su(e,"_overallSequencingProcess",null),e._activityTree=new Jl,e._sequencingRules=new Et,e._sequencingControls=new Xt,e._rollupRules=new An,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&iu(e,t)}(t,e),i=t,(n=[{key:"initialize",value:function(){Ql(Zl(t.prototype),"initialize",this).call(this),this._activityTree.initialize(),this._sequencingRules.initialize(),this._sequencingControls.initialize(),this._rollupRules.initialize()}},{key:"reset",value:function(){this._initialized=!1,this._activityTree.reset(),this._sequencingRules.reset(),this._sequencingControls.reset(),this._rollupRules.reset(),this._hideLmsUi=[],this._auxiliaryResources=[]}},{key:"activityTree",get:function(){return this._activityTree},set:function(e){if(!eu(e,Jl))throw new ie(this._cmi_element+".activityTree",ce.TYPE_MISMATCH);this._activityTree=e}},{key:"sequencingRules",get:function(){return this._sequencingRules},set:function(e){if(!eu(e,Et))throw new ie(this._cmi_element+".sequencingRules",ce.TYPE_MISMATCH);this._sequencingRules=e}},{key:"sequencingControls",get:function(){return this._sequencingControls},set:function(e){if(!eu(e,Xt))throw new ie(this._cmi_element+".sequencingControls",ce.TYPE_MISMATCH);this._sequencingControls=e}},{key:"hideLmsUi",get:function(){return nu(this._hideLmsUi)},set:function(e){this._hideLmsUi=nu(e)}},{key:"auxiliaryResources",get:function(){return this._auxiliaryResources.map(function(e){return tu({},e)})},set:function(e){this._auxiliaryResources=e.map(function(e){return tu({},e)})}},{key:"rollupRules",get:function(){return this._rollupRules},set:function(e){if(!eu(e,An))throw new ie(this._cmi_element+".rollupRules",ce.TYPE_MISMATCH);this._rollupRules=e}},{key:"adlNav",get:function(){return this._adlNav},set:function(e){this._adlNav=e}},{key:"overallSequencingProcess",get:function(){return this._overallSequencingProcess},set:function(e){this._overallSequencingProcess=e}},{key:"processRollup",value:function(){var e=this._activityTree.root;e&&this._processRollupRecursive(e)}},{key:"_processRollupRecursive",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this._processRollupRecursive(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}this._rollupRules.processRollup(e)}},{key:"getCurrentActivity",value:function(){return this._activityTree.currentActivity}},{key:"getRootActivity",value:function(){return this._activityTree.root}},{key:"toJSON",value:function(){this.jsonString=!0;var result={activityTree:this._activityTree,sequencingRules:this._sequencingRules,sequencingControls:this._sequencingControls,rollupRules:this._rollupRules,adlNav:this._adlNav};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(O);var lu=Object.defineProperty,uu=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?lu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="context")?i+"":i,n),this.context=t}return t=e,(i=[{key:"checkValidResponseType",value:function(e,t,i,n){var r=[];(null==t?void 0:t.delimiter)?r=_s(i+"",t.delimiter):r[0]=i,r.length>0&&t.max>=r.length?this.context.checkCorrectResponseValue?this.context.checkCorrectResponseValue(e,n,r,i):this.checkCorrectResponseValue(e,n,r,i):r.length>t.max&&this.context.throwSCORMError(e,ce.GENERAL_SET_FAILURE,"Data Model Element Pattern Too Long: ".concat(i))}},{key:"checkDuplicateChoiceResponse",value:function(e,t,i){var n=t.correct_responses._count;if("choice"===t.type)for(var r=0;n>r&&"0"===this.context.getLastErrorCode();r++){var o=t.correct_responses.childArray[r];(null==o?void 0:o.pattern)===i&&this.context.throwSCORMError(e,ce.GENERAL_SET_FAILURE,"".concat(i))}}},{key:"validateCorrectResponse",value:function(e,t,i){var n=+e.split(".")[4];if(t){var r=t.correct_responses._count;this.checkDuplicateChoiceResponse(e,t,i);var o=tt[t.type];o&&(void 0===o.limit||o.limit>r)?(this.checkValidResponseType(e,o,i,t.type),"0"===this.context.getLastErrorCode()&&(!o.duplicate||!this.checkDuplicatedPattern(t.correct_responses,n,i))||"0"===this.context.getLastErrorCode()&&""===i||"0"===this.context.getLastErrorCode()&&this.context.throwSCORMError(e,ce.GENERAL_SET_FAILURE,"Data Model Element Pattern Already Exists: ".concat(e," - ").concat(i))):this.context.throwSCORMError(e,ce.GENERAL_SET_FAILURE,"Data Model Element Collection Limit Reached: ".concat(e," - ").concat(i))}else this.context.throwSCORMError(e,ce.DEPENDENCY_NOT_ESTABLISHED,e)}},{key:"checkDuplicatedPattern",value:function(e,t,i){for(var n=!1,r=e._count,o=0;r>o&&!n;o++)if(o!==t){var a=e.childArray[o];(null==a?void 0:a.pattern)===i&&(n=!0)}return n}},{key:"checkCorrectResponseValue",value:function(e,t,i,n){var r=tt[t];if(r)for(var o=RegExp(r.format),a=0;i.length>a&&"0"===this.context.getLastErrorCode();a++)if(t.match("^(fill-in|long-fill-in|matching|performance|sequencing)$")&&(i[a]=this.removeCorrectResponsePrefixes(e,i[a])),null==r?void 0:r.delimiter2){var s,c,l="performance"===t?bs(i[a],r.delimiter2):_s(i[a],r.delimiter2);2===l.length?"performance"===t&&""===l[0]&&""===l[1]?this.context.throwSCORMError(e,ce.TYPE_MISMATCH,"".concat(t,": ").concat(n)):(null===(s=l[0])||void 0===s?void 0:s.match(o))&&r.format2&&(null===(c=l[1])||void 0===c?void 0:c.match(RegExp(r.format2)))||this.context.throwSCORMError(e,ce.TYPE_MISMATCH,"".concat(t,": ").concat(n)):this.context.throwSCORMError(e,ce.TYPE_MISMATCH,"".concat(t,": ").concat(n))}else{if("numeric"===t&&i.length>1&&""===i[a]&&r.delimiter&&(n+"").includes(r.delimiter))continue;var u=i[a].match(o);if(!u&&""!==n||!u&&"true-false"===t)this.context.throwSCORMError(e,ce.TYPE_MISMATCH,"".concat(t,": ").concat(n));else if("numeric"===t&&i.length>1)""!==i[0]&&""!==i[1]&&+i[0]>+i[1]&&this.context.throwSCORMError(e,ce.TYPE_MISMATCH,"".concat(t,": ").concat(n));else if(""!==i[a]&&r.unique)for(var d=0;a>d&&"0"===this.context.getLastErrorCode();d++)i[a]===i[d]&&this.context.throwSCORMError(e,ce.TYPE_MISMATCH,"".concat(t,": ").concat(n))}else this.context.throwSCORMError(e,ce.TYPE_MISMATCH,"Incorrect Response Type: ".concat(t))}},{key:"removeCorrectResponsePrefixes",value:function(e,t){for(var i,n=!1,r=!1,o=!1,a=RegExp("^({(lang|case_matters|order_matters)=([^}]+)})"),s=t.match(a);s;){var c;switch(s[2]){case"lang":if(i=t.match("^(({lang=([a-zA-Z]{1,8}|i|x)?(-[a-zA-Z0-9-]{2,8})?}))(.*?)$")){var l=i[3];void 0!==l&&l.length>0&&(nt.includes(l.toLowerCase())||this.context.throwSCORMError(e,ce.TYPE_MISMATCH,"".concat(t)))}o=!0;break;case"case_matters":o||n||r||"true"!==s[3]&&"false"!==s[3]&&this.context.throwSCORMError(e,ce.TYPE_MISMATCH,"".concat(t)),r=!0;break;case"order_matters":r||o||n||"true"!==s[3]&&"false"!==s[3]&&this.context.throwSCORMError(e,ce.TYPE_MISMATCH,"".concat(t)),n=!0}s=(t=t.substring((null===(c=s[1])||void 0===c?void 0:c.length)||0)).match(a)}return t}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var du=Object.defineProperty,fu=function(e,t,i){return function(e,t,i){return t in e?du(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},vu=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),fu(this,"context"),fu(this,"responseValidator"),this.context=t,this.responseValidator=i}return t=e,(i=[{key:"getChildElement",value:function(e,t,i){if(f(e,"cmi\\.objectives\\.\\d+"))return new yc;if(i){if(f(e,"cmi\\.interactions\\.\\d+\\.correct_responses\\.\\d+"))return this.createCorrectResponsesObject(e,t);if(f(e,"cmi\\.interactions\\.\\d+\\.objectives\\.\\d+"))return new Ds}else if(f(e,"cmi\\.interactions\\.\\d+"))return new Ns;return f(e,"cmi\\.comments_from_learner\\.\\d+")?new rc:f(e,"cmi\\.comments_from_lms\\.\\d+")?new rc(!0):f(e,"adl\\.data\\.\\d+")?new ql:null}},{key:"createCorrectResponsesObject",value:function(e,t){var i=e.split("."),n=this.context.cmi.interactions.childArray[+i[2]];if(this.context.isInitialized()){if(void 0===n||!n.type)return this.context.throwSCORMError(e,ce.DEPENDENCY_NOT_ESTABLISHED,e),null;var r=tt[n.type];if(r&&void 0!==r.limit&&n.correct_responses._count>=r.limit)return this.context.throwSCORMError(e,ce.GENERAL_SET_FAILURE,"Data Model Element Collection Limit Reached: ".concat(e)),null;if(this.responseValidator.checkDuplicateChoiceResponse(e,n,t),!r)return this.context.throwSCORMError(e,ce.GENERAL_SET_FAILURE,"Incorrect Response Type: ".concat(n.type)),null;this.responseValidator.checkValidResponseType(e,r,t,n.type)}return"0"===this.context.getLastErrorCode()?new zs(null==n?void 0:n.type):null}},{key:"evaluateCompletionStatus",value:function(){return yr({completionThreshold:this.context.cmi.completion_threshold,progressMeasure:this.context.cmi.progress_measure,storedCompletionStatus:this.context.cmi.completion_status})}},{key:"evaluateSuccessStatus",value:function(){var e=this.context.cmi.scaled_passing_score,t=this.context.cmi.score.scaled,i=this.context.cmi.success_status;if(""!==e&&null!=e){var n=parseFloat(e+"");if(!isNaN(n)){if(""!==t&&null!=t){var r=parseFloat(t+"");if(!isNaN(r))return n>r?be:_e}return Se}}return i||Se}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function hu(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function mu(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function pu(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){mu(e,t,i[t])})}return e}function yu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||_u(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gu(e){return function(e){if(Array.isArray(e))return hu(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_u(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _u(e,t){if(e){if("string"==typeof e)return hu(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?hu(e,t):void 0}}var bu=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,(i=[{key:"applySequencingControlsSettings",value:function(e,t){void 0!==t.enabled&&(e.enabled=t.enabled),void 0!==t.choice&&(e.choice=t.choice),void 0!==t.choiceExit&&(e.choiceExit=t.choiceExit),void 0!==t.flow&&(e.flow=t.flow),void 0!==t.forwardOnly&&(e.forwardOnly=t.forwardOnly),void 0!==t.useCurrentAttemptObjectiveInfo&&(e.useCurrentAttemptObjectiveInfo=t.useCurrentAttemptObjectiveInfo),void 0!==t.useCurrentAttemptProgressInfo&&(e.useCurrentAttemptProgressInfo=t.useCurrentAttemptProgressInfo),void 0!==t.preventActivation&&(e.preventActivation=t.preventActivation),void 0!==t.constrainChoice&&(e.constrainChoice=t.constrainChoice),void 0!==t.stopForwardTraversal&&(e.stopForwardTraversal=t.stopForwardTraversal),void 0!==t.rollupObjectiveSatisfied&&(e.rollupObjectiveSatisfied=t.rollupObjectiveSatisfied),void 0!==t.rollupProgressCompletion&&(e.rollupProgressCompletion=t.rollupProgressCompletion),void 0!==t.objectiveMeasureWeight&&(e.objectiveMeasureWeight=t.objectiveMeasureWeight),void 0!==t.selectionTiming&&(e.selectionTiming=t.selectionTiming),void 0!==t.selectCount&&(e.selectCount=t.selectCount),void 0!==t.randomizeChildren&&(e.randomizeChildren=t.randomizeChildren),void 0!==t.randomizationTiming&&(e.randomizationTiming=t.randomizationTiming),void 0!==t.selectionCountStatus&&(e.selectionCountStatus=t.selectionCountStatus),void 0!==t.reorderChildren&&(e.reorderChildren=t.reorderChildren),void 0!==t.completionSetByContent&&(e.completionSetByContent=t.completionSetByContent),void 0!==t.objectiveSetByContent&&(e.objectiveSetByContent=t.objectiveSetByContent),void 0!==t.tracked&&(e.tracked=t.tracked)}},{key:"applySequencingRulesSettings",value:function(e,t){if(t){if(t.preConditionRules){var i=!0,n=!1,r=void 0;try{for(var o,a=t.preConditionRules[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=this.createSequencingRule(o.value);e.addPreConditionRule(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}if(t.exitConditionRules){var c=!0,l=!1,u=void 0;try{for(var d,f=t.exitConditionRules[Symbol.iterator]();!(c=(d=f.next()).done);c=!0){var v=this.createSequencingRule(d.value);e.addExitConditionRule(v)}}catch(e){l=!0,u=e}finally{try{c||null==f.return||f.return()}finally{if(l)throw u}}}if(t.postConditionRules){var h=!0,m=!1,p=void 0;try{for(var y,g=t.postConditionRules[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var _=this.createSequencingRule(y.value);e.addPostConditionRule(_)}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}}}},{key:"createSequencingRule",value:function(e){var t=new Ct(e.action,e.conditionCombination),i=!0,n=!1,r=void 0;try{for(var o,a=e.conditions[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,c=new Ot(s.condition,s.operator,new Map(Object.entries(s.parameters||{})));s.referencedObjective&&(c.referencedObjective=s.referencedObjective),t.addCondition(c)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"applyRollupRulesSettings",value:function(e,t){if(null==t?void 0:t.rules){var i=!0,n=!1,r=void 0;try{for(var o,a=t.rules[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=this.createRollupRule(o.value);e.addRule(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}},{key:"createRollupRule",value:function(e){var t=new En(e.action,e.consideration,e.minimumCount,e.minimumPercent),i=!0,n=!1,r=void 0;try{for(var o,a=e.conditions[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,c=new Cn(s.condition,new Map(Object.entries(s.parameters||{})));t.addCondition(c)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"sanitizeSequencingCollections",value:function(e){if(!e)return{};var t={},i=!0,n=!1,r=void 0;try{for(var o,a=Object.entries(e)[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=yu(o.value,2),c=s[1],l=s[0].trim();if(l){var u,d={};if(c.sequencingControls&&(d.sequencingControls=pu({},c.sequencingControls)),c.sequencingRules){var f=function(e){var t={action:e.action,conditions:e.conditions.map(function(e){var t={condition:e.condition};return void 0!==e.operator&&(t.operator=e.operator),e.parameters&&(t.parameters=pu({},e.parameters)),void 0!==e.referencedObjective&&(t.referencedObjective=e.referencedObjective),t})};return void 0!==e.conditionCombination&&(t.conditionCombination=e.conditionCombination),t};d.sequencingRules={},c.sequencingRules.preConditionRules&&(d.sequencingRules.preConditionRules=c.sequencingRules.preConditionRules.map(f)),c.sequencingRules.exitConditionRules&&(d.sequencingRules.exitConditionRules=c.sequencingRules.exitConditionRules.map(f)),c.sequencingRules.postConditionRules&&(d.sequencingRules.postConditionRules=c.sequencingRules.postConditionRules.map(f))}c.rollupRules&&(d.rollupRules={rules:null===(u=c.rollupRules.rules)||void 0===u?void 0:u.map(function(e){var t={action:e.action,conditions:e.conditions.map(function(e){var t={condition:e.condition};return e.parameters&&(t.parameters=pu({},e.parameters)),t})};return void 0!==e.consideration&&(t.consideration=e.consideration),void 0!==e.minimumCount&&(t.minimumCount=e.minimumCount),void 0!==e.minimumPercent&&(t.minimumPercent=e.minimumPercent),t})}),c.rollupConsiderations&&(d.rollupConsiderations=pu({},c.rollupConsiderations)),c.selectionRandomizationState&&(d.selectionRandomizationState=this.cloneSelectionRandomizationState(c.selectionRandomizationState)),c.hideLmsUi&&(d.hideLmsUi=this.sanitizeHideLmsUi(c.hideLmsUi)),c.auxiliaryResources&&(d.auxiliaryResources=this.sanitizeAuxiliaryResources(c.auxiliaryResources)),t[l]=d}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"normalizeCollectionRefs",value:function(e){if(!e)return[];var t=Array.isArray(e)?e:[e],i=new Set,result=[],n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value.trim();c&&!i.has(c)&&(i.add(c),result.push(c))}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return result}},{key:"applySequencingCollection",value:function(e,t,i){if(t){if(t.sequencingControls&&this.applySequencingControlsSettings(e.sequencingControls,t.sequencingControls),t.sequencingRules&&this.applySequencingRulesSettings(e.sequencingRules,t.sequencingRules),t.rollupRules&&this.applyRollupRulesSettings(e.rollupRules,t.rollupRules),t.rollupConsiderations&&e.applyRollupConsiderations(t.rollupConsiderations),t.hideLmsUi){var n=this.mergeHideLmsUi(e.hideLmsUi,t.hideLmsUi);n.length>0&&(e.hideLmsUi=n)}if(t.auxiliaryResources){var r=this.sanitizeAuxiliaryResources(t.auxiliaryResources);r.length>0&&(e.auxiliaryResources=this.mergeAuxiliaryResources(e.auxiliaryResources,r))}t.selectionRandomizationState&&i.push(this.cloneSelectionRandomizationState(t.selectionRandomizationState))}}},{key:"sanitizeHideLmsUi",value:function(e){if(!e)return[];var t=new Set(ct),i=new Set,n=[],r=!0,o=!1,a=void 0;try{for(var s,c=e[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var l=s.value;t.has(l)&&!i.has(l)&&(i.add(l),n.push(l))}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}},{key:"mergeHideLmsUi",value:function(e,t){return t&&0!==t.length?this.sanitizeHideLmsUi(gu(e).concat(gu(t))):e}},{key:"sanitizeAuxiliaryResources",value:function(e){if(!e)return[];var t=new Set,i=[],n=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;if(c&&c.resourceId&&"string"==typeof c.resourceId&&c.purpose&&"string"==typeof c.purpose){var l=c.resourceId.trim(),u=c.purpose.trim();if(l&&u){var d="".concat(l,"::").concat(u);t.has(d)||(t.add(d),i.push({resourceId:l,purpose:u}))}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return i}},{key:"mergeAuxiliaryResources",value:function(e,t){var i=[],n=new Set,r=!0,o=!1,a=void 0;try{for(var s,c=gu(null!=e?e:[]).concat(gu(null!=t?t:[]))[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var l=s.value;if(l){var u=l.resourceId;u&&!n.has(u)&&(n.add(u),i.push({resourceId:u,purpose:l.purpose}))}}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return i}},{key:"cloneSelectionRandomizationState",value:function(e){var t={};return e.childOrder&&(t.childOrder=gu(e.childOrder)),e.selectedChildIds&&(t.selectedChildIds=gu(e.selectedChildIds)),e.hiddenFromChoiceChildIds&&(t.hiddenFromChoiceChildIds=gu(e.hiddenFromChoiceChildIds)),void 0!==e.selectionCountStatus&&(t.selectionCountStatus=e.selectionCountStatus),void 0!==e.reorderChildren&&(t.reorderChildren=e.reorderChildren),t}},{key:"applySelectionRandomizationState",value:function(e,t){var i=e.sequencingControls;void 0!==t.selectionCountStatus&&(i.selectionCountStatus=t.selectionCountStatus),void 0!==t.reorderChildren&&(i.reorderChildren=t.reorderChildren);var n=t.selectedChildIds?new Set(t.selectedChildIds):null,r=t.hiddenFromChoiceChildIds?new Set(t.hiddenFromChoiceChildIds):null;t.childOrder&&t.childOrder.length>0&&e.setChildOrder(t.childOrder);var o=!1;if(n||r){var a=!0,s=!1,c=void 0;try{for(var l,u=e.children[Symbol.iterator]();!(a=(l=u.next()).done);a=!0){var d=l.value;if(n){var f=n.has(d.id);d.isAvailable=f,r||(d.isHiddenFromChoice=!f),o=!0}r&&(d.isHiddenFromChoice=r.has(d.id),o=!0)}}catch(e){s=!0,c=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw c}}}(o||n||void 0!==t.selectionCountStatus||void 0!==t.reorderChildren||t.childOrder&&t.childOrder.length>0)&&e.setProcessedChildren(e.children.filter(function(e){return e.isAvailable}))}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Su(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function wu(e){return function(e){if(Array.isArray(e))return Su(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Su(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Su(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Ou=Object.defineProperty,Cu=function(e,t,i){return function(e,t,i){return t in e?Ou(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Eu=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Cu(this,"sequencingCollections"),Cu(this,"sequencingConfigBuilder"),this.sequencingCollections=t||{},this.sequencingConfigBuilder=i||new bu}return t=e,(i=[{key:"setSequencingCollections",value:function(e){this.sequencingCollections=e}},{key:"createActivity",value:function(e){var t=new Vn(e.id,e.title),i=[],n=this.sequencingConfigBuilder.normalizeCollectionRefs(e.sequencingCollectionRefs),r=!0,o=!1,a=void 0;try{for(var s,c=n[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var l=this.sequencingCollections[s.value];l&&this.sequencingConfigBuilder.applySequencingCollection(t,l,i)}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}if(void 0!==e.isVisible&&(t.isVisible=e.isVisible),void 0!==e.isActive&&(t.isActive=e.isActive),void 0!==e.isSuspended&&(t.isSuspended=e.isSuspended),void 0!==e.isCompleted&&(t.isCompleted=e.isCompleted),void 0!==e.isHiddenFromChoice&&(t.isHiddenFromChoice=e.isHiddenFromChoice),void 0!==e.isAvailable&&(t.isAvailable=e.isAvailable),void 0!==e.attemptLimit&&(t.attemptLimit=e.attemptLimit),void 0!==e.attemptAbsoluteDurationLimit&&(t.attemptAbsoluteDurationLimit=e.attemptAbsoluteDurationLimit),void 0!==e.activityAbsoluteDurationLimit&&(t.activityAbsoluteDurationLimit=e.activityAbsoluteDurationLimit),void 0!==e.timeLimitAction&&(t.timeLimitAction=e.timeLimitAction),void 0!==e.timeLimitDuration&&(t.timeLimitDuration=e.timeLimitDuration),void 0!==e.beginTimeLimit&&(t.beginTimeLimit=e.beginTimeLimit),void 0!==e.endTimeLimit&&(t.endTimeLimit=e.endTimeLimit),e.primaryObjective){var u=this.createActivityObjectiveFromSettings(e.primaryObjective,!0);t.primaryObjective=u,null!==u.minNormalizedMeasure&&(t.scaledPassingScore=u.minNormalizedMeasure)}if(e.objectives){var d=!0,f=!1,v=void 0;try{for(var h,m=e.objectives[Symbol.iterator]();!(d=(h=m.next()).done);d=!0){var p=h.value,y=!0===p.isPrimary,g=this.createActivityObjectiveFromSettings(p,y);y?t.primaryObjective=g:t.addObjective(g)}}catch(e){f=!0,v=e}finally{try{d||null==m.return||m.return()}finally{if(f)throw v}}}if(e.sequencingControls&&this.sequencingConfigBuilder.applySequencingControlsSettings(t.sequencingControls,e.sequencingControls),e.deliveryControls&&this.sequencingConfigBuilder.applySequencingControlsSettings(t.sequencingControls,e.deliveryControls),e.sequencingRules&&this.sequencingConfigBuilder.applySequencingRulesSettings(t.sequencingRules,e.sequencingRules),e.rollupRules&&this.sequencingConfigBuilder.applyRollupRulesSettings(t.rollupRules,e.rollupRules),e.rollupConsiderations&&t.applyRollupConsiderations(e.rollupConsiderations),e.completionThreshold){var _=e.completionThreshold;void 0!==_.completedByMeasure&&(t.completedByMeasure=_.completedByMeasure),void 0!==_.minProgressMeasure?(t.minProgressMeasure=_.minProgressMeasure,t.completionThreshold=""+_.minProgressMeasure):_.completedByMeasure&&(t.completionThreshold=""+t.minProgressMeasure),void 0!==_.progressWeight&&(t.progressWeight=_.progressWeight)}if(e.hideLmsUi){var b=this.sequencingConfigBuilder.mergeHideLmsUi(t.hideLmsUi,e.hideLmsUi);b.length>0&&(t.hideLmsUi=b)}if(e.auxiliaryResources){var S=this.sequencingConfigBuilder.sanitizeAuxiliaryResources(e.auxiliaryResources);S.length>0&&(t.auxiliaryResources=this.sequencingConfigBuilder.mergeAuxiliaryResources(t.auxiliaryResources,S))}if(e.children){var w=!0,O=!1,C=void 0;try{for(var E,A=e.children[Symbol.iterator]();!(w=(E=A.next()).done);w=!0){var k=this.createActivity(E.value);t.addChild(k)}}catch(e){O=!0,C=e}finally{try{w||null==A.return||A.return()}finally{if(O)throw C}}}e.selectionRandomizationState&&i.push(this.sequencingConfigBuilder.cloneSelectionRandomizationState(e.selectionRandomizationState));var j=!0,R=!1,M=void 0;try{for(var T,x=i[Symbol.iterator]();!(j=(T=x.next()).done);j=!0)this.sequencingConfigBuilder.applySelectionRandomizationState(t,T.value)}catch(e){R=!0,M=e}finally{try{j||null==x.return||x.return()}finally{if(R)throw M}}return t}},{key:"extractActivityIds",value:function(e){var t=[e.id],i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s;(s=t).push.apply(s,wu(this.extractActivityIds(o.value)))}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"createActivityObjectiveFromSettings",value:function(e,t){var i,n,r,o=(e.mapInfo||[]).map(function(e){var t,i,n,r,o,a,s,c,l,u,d,f,v,h,m;return{targetObjectiveID:e.targetObjectiveID,readSatisfiedStatus:null===(t=e.readSatisfiedStatus)||void 0===t||t,readNormalizedMeasure:null===(i=e.readNormalizedMeasure)||void 0===i||i,writeSatisfiedStatus:null!==(n=e.writeSatisfiedStatus)&&void 0!==n&&n,writeNormalizedMeasure:null!==(r=e.writeNormalizedMeasure)&&void 0!==r&&r,readCompletionStatus:null===(o=e.readCompletionStatus)||void 0===o||o,writeCompletionStatus:null!==(a=e.writeCompletionStatus)&&void 0!==a&&a,readProgressMeasure:null===(s=e.readProgressMeasure)||void 0===s||s,writeProgressMeasure:null!==(c=e.writeProgressMeasure)&&void 0!==c&&c,readRawScore:null===(l=e.readRawScore)||void 0===l||l,writeRawScore:null!==(u=e.writeRawScore)&&void 0!==u&&u,readMinScore:null===(d=e.readMinScore)||void 0===d||d,writeMinScore:null!==(f=e.writeMinScore)&&void 0!==f&&f,readMaxScore:null===(v=e.readMaxScore)||void 0===v||v,writeMaxScore:null!==(h=e.writeMaxScore)&&void 0!==h&&h,updateAttemptData:null!==(m=e.updateAttemptData)&&void 0!==m&&m}});return new Bn(e.objectiveID,{description:null!==(i=e.description)&&void 0!==i?i:null,satisfiedByMeasure:null!==(n=e.satisfiedByMeasure)&&void 0!==n&&n,minNormalizedMeasure:null!==(r=e.minNormalizedMeasure)&&void 0!==r?r:null,mapInfo:o,isPrimary:t})}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Au(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function ku(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ju(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){ku(e,t,i[t])})}return e}function Ru(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Au(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Au(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Mu(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Tu=Object.defineProperty,xu=function(e,t,i){return function(e,t,i){return t in e?Tu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Mu(t))?t+"":t,i)},Iu=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),xu(this,"_globalObjectives",[]),xu(this,"context"),this.context=t}return t=e,(i=[{key:"globalObjectives",get:function(){return this._globalObjectives},set:function(objectives){this._globalObjectives=objectives}},{key:"updateSequencingService",value:function(e){this.context.sequencingService=e}},{key:"syncGlobalObjectiveIdsFromSequencing",value:function(){if(this.context.sequencingService){var e=this.context.sequencingService.getOverallSequencingProcess();if(e){var t=e.getGlobalObjectiveMap();if(t&&0!==t.size){var i=Array.from(t.keys()),n=this.context.getSettings(),r=Array.from(new Set((n.globalObjectiveIds||[]).concat(i)));n.globalObjectiveIds=r}}}}},{key:"restoreGlobalObjectivesToCMI",value:function(){if(0!==this._globalObjectives.length)for(var e=0;this._globalObjectives.length>e;e++){var t=this._globalObjectives[e];if(t&&t.id&&!this.context.cmi.objectives.findObjectiveById(t.id)){var i=this.context.cmi.objectives.childArray.length;this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".id"),t.id),t.success_status&&"unknown"!==t.success_status&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".success_status"),t.success_status),t.completion_status&&"unknown"!==t.completion_status&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".completion_status"),t.completion_status),""!==t.score.scaled&&null!==t.score.scaled&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.scaled"),t.score.scaled),""!==t.score.raw&&null!==t.score.raw&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.raw"),t.score.raw),""!==t.score.min&&null!==t.score.min&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.min"),t.score.min),""!==t.score.max&&null!==t.score.max&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.max"),t.score.max),""!==t.progress_measure&&null!==t.progress_measure&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".progress_measure"),t.progress_measure),""!==t.description&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".description"),t.description)}}}},{key:"updateGlobalObjectiveFromCMI",value:function(e,t){var i,n,r,o;if(e&&this.context.sequencingService){var a=this.context.sequencingService.getOverallSequencingProcess();if(a)if(a.getGlobalObjectiveMap().has(e)){var s={};t.success_status&&t.success_status!==Se&&(s.satisfiedStatus=t.success_status===_e,s.satisfiedStatusKnown=!0);var c=this.parseObjectiveNumber(null===(i=t.score)||void 0===i?void 0:i.scaled);null!==c&&(s.normalizedMeasure=c,s.normalizedMeasureKnown=!0),void 0!==(null===(n=t.score)||void 0===n?void 0:n.raw)&&""!==t.score.raw&&(s.rawScore=t.score.raw,s.rawScoreKnown=!0),void 0!==(null===(r=t.score)||void 0===r?void 0:r.min)&&""!==t.score.min&&(s.minScore=t.score.min,s.minScoreKnown=!0),void 0!==(null===(o=t.score)||void 0===o?void 0:o.max)&&""!==t.score.max&&(s.maxScore=t.score.max,s.maxScoreKnown=!0);var l=this.parseObjectiveNumber(t.progress_measure);null!==l&&(s.progressMeasure=l,s.progressMeasureKnown=!0),t.completion_status&&t.completion_status!==Ce&&(s.completionStatus=t.completion_status,s.completionStatusKnown=!0),0!==Object.keys(s).length&&a.updateGlobalObjective(e,s)}else{var u=this.buildObjectiveMapEntryFromCMI(t);a.updateGlobalObjective(e,u)}}}},{key:"buildObjectiveMapEntryFromCMI",value:function(e){var t,i,n,r,entry={id:e.id,satisfiedStatusKnown:!1,normalizedMeasureKnown:!1,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasureKnown:!1,completionStatusKnown:!1,readSatisfiedStatus:!0,writeSatisfiedStatus:!0,readNormalizedMeasure:!0,writeNormalizedMeasure:!0,readCompletionStatus:!0,writeCompletionStatus:!0,readProgressMeasure:!0,writeProgressMeasure:!0,readRawScore:!0,writeRawScore:!0,readMinScore:!0,writeMinScore:!0,readMaxScore:!0,writeMaxScore:!0};e.success_status&&e.success_status!==Se&&(entry.satisfiedStatus=e.success_status===_e,entry.satisfiedStatusKnown=!0);var o=this.parseObjectiveNumber(null===(t=e.score)||void 0===t?void 0:t.scaled);null!==o&&(entry.normalizedMeasure=o,entry.normalizedMeasureKnown=!0),void 0!==(null===(i=e.score)||void 0===i?void 0:i.raw)&&""!==e.score.raw&&(entry.rawScore=e.score.raw,entry.rawScoreKnown=!0),void 0!==(null===(n=e.score)||void 0===n?void 0:n.min)&&""!==e.score.min&&(entry.minScore=e.score.min,entry.minScoreKnown=!0),void 0!==(null===(r=e.score)||void 0===r?void 0:r.max)&&""!==e.score.max&&(entry.maxScore=e.score.max,entry.maxScoreKnown=!0);var a=this.parseObjectiveNumber(e.progress_measure);return null!==a&&(entry.progressMeasure=a,entry.progressMeasureKnown=!0),e.completion_status&&e.completion_status!==Ce&&(entry.completionStatus=e.completion_status,entry.completionStatusKnown=!0),entry}},{key:"buildCMIObjectivesFromMap",value:function(e){var objectives=[];if(!e||"object"!==(void 0===e?"undefined":Mu(e)))return objectives;var t=!0,i=!1,n=void 0;try{for(var r,o=Object.entries(e)[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a,s=Ru(r.value,2),c=s[0],entry=s[1];if(entry&&"object"===(void 0===entry?"undefined":Mu(entry))){var l=new yc;l.id=null!==(a=entry.id)&&void 0!==a?a:c,!0===entry.satisfiedStatusKnown&&(l.success_status=entry.satisfiedStatus?_e:be);var u,d,f,v=this.parseObjectiveNumber(entry.normalizedMeasure);!0===entry.normalizedMeasureKnown&&null!==v&&(l.score.scaled=v+""),!0===entry.rawScoreKnown&&(l.score.raw=(null!==(u=entry.rawScore)&&void 0!==u?u:"")+""),!0===entry.minScoreKnown&&(l.score.min=(null!==(d=entry.minScore)&&void 0!==d?d:"")+""),!0===entry.maxScoreKnown&&(l.score.max=(null!==(f=entry.maxScore)&&void 0!==f?f:"")+"");var h=this.parseObjectiveNumber(entry.progressMeasure);!0===entry.progressMeasureKnown&&null!==h&&(l.progress_measure=h+""),!0===entry.completionStatusKnown&&"string"==typeof entry.completionStatus&&(l.completion_status=entry.completionStatus),objectives.push(l)}}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return objectives}},{key:"buildCMIObjectiveFromJSON",value:function(e){var t=new yc;if(!e||"object"!==(void 0===e?"undefined":Mu(e)))return t;"string"==typeof e.id&&(t.id=e.id),"string"==typeof e.success_status&&(t.success_status=e.success_status),"string"==typeof e.completion_status&&(t.completion_status=e.completion_status),"string"==typeof e.progress_measure&&""!==e.progress_measure&&(t.progress_measure=e.progress_measure),"string"==typeof e.description&&(t.description=e.description);var score=e.score;return score&&"object"===(void 0===score?"undefined":Mu(score))&&("string"==typeof score.scaled&&""!==score.scaled?t.score.scaled=score.scaled:"number"==typeof score.scaled&&Number.isFinite(score.scaled)&&(t.score.scaled=score.scaled+""),"string"==typeof score.raw&&""!==score.raw?t.score.raw=score.raw:"number"==typeof score.raw&&Number.isFinite(score.raw)&&(t.score.raw=score.raw+""),"string"==typeof score.min&&""!==score.min?t.score.min=score.min:"number"==typeof score.min&&Number.isFinite(score.min)&&(t.score.min=score.min+""),"string"==typeof score.max&&""!==score.max?t.score.max=score.max:"number"==typeof score.max&&Number.isFinite(score.max)&&(t.score.max=score.max+"")),t}},{key:"captureGlobalObjectiveSnapshot",value:function(e){var t,i,n={},r=null!==(t=null!=e?e:null===(i=this.context.sequencingService)||void 0===i?void 0:i.getOverallSequencingProcess())&&void 0!==t?t:null;if(r){var o=r.getGlobalObjectiveMapSnapshot(),a=!0,s=!1,c=void 0;try{for(var l,u=Object.entries(o)[Symbol.iterator]();!(a=(l=u.next()).done);a=!0){var d=Ru(l.value,2);n[d[0]]=ju({},d[1])}}catch(e){s=!0,c=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw c}}}var f=!0,v=!1,h=void 0;try{for(var m,p=this._globalObjectives[Symbol.iterator]();!(f=(m=p.next()).done);f=!0){var y=m.value;y.id&&!n[y.id]&&(n[y.id]=this.buildObjectiveMapEntryFromCMI(y))}}catch(e){v=!0,h=e}finally{try{f||null==p.return||p.return()}finally{if(v)throw h}}return n}},{key:"parseObjectiveNumber",value:function(e){if(null==e)return null;if("number"==typeof e&&Number.isFinite(e))return e;var t=parseFloat(e+"");return Number.isFinite(t)?t:null}},{key:"syncCmiToSequencingActivity",value:function(e,t,i){if(this.context.sequencing){var n=this.context.sequencing.getCurrentActivity();if(n&&n.primaryObjective){var r=n.primaryObjective;t!==Se&&(r.satisfiedStatus=t===_e,r.satisfiedStatusKnown=!0,r.measureStatus=!0,n.objectiveMeasureStatus=!0,n.objectiveSatisfiedStatus=t===_e,n.objectiveSatisfiedStatusKnown=!0),e!==Ce&&(r.completionStatus=e),void 0!==(null==i?void 0:i.scaled)&&null!==i.scaled&&(r.normalizedMeasure=i.scaled,r.measureStatus=!0),void 0!==(null==i?void 0:i.raw)&&null!==i.raw&&(r.rawScore=i.raw+""),void 0!==(null==i?void 0:i.min)&&null!==i.min&&(r.minScore=i.min+""),void 0!==(null==i?void 0:i.max)&&null!==i.max&&(r.maxScore=i.max+"")}}}},{key:"findOrCreateGlobalObjective",value:function(e){var t=this._globalObjectives.findIndex(function(t){return t.id===e});if(-1===t){t=this._globalObjectives.length;var i=new yc;i.id=e,this._globalObjectives.push(i)}return{index:t,objective:this._globalObjectives[t]}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Pu(e,t,i,n,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(n,r)}function Nu(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){Pu(o,n,r,a,s,"next",e)}function s(e){Pu(o,n,r,a,s,"throw",e)}a(void 0)})}}function Du(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function qu(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Lu(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Du(e,t,i[t])})}return e}function zu(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Fu(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:c(0)}),s(a,"throw",{value:c(1)}),s(a,"return",{value:c(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function c(s){return function(c){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}var Bu=Object.defineProperty,Vu=function(e,t,i){return function(e,t,i){return t in e?Bu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":zu(t))?t+"":t,i)},Hu=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Vu(this,"context"),Vu(this,"globalObjectiveManager"),this.context=t,this.globalObjectiveManager=i}return t=e,(i=[{key:"saveSequencingState",value:function(e){return Nu(function(){var t,i,n,r,o,a,s;return Fu(this,function(c){switch(c.label){case 0:if(!(t=this.context.getSettings()).sequencingStatePersistence)return this.context.apiLog("saveSequencingState","No persistence configuration provided",Ee.WARN),[2,!1];c.label=1;case 1:if(c.trys.push([1,3,,4]),i=this.serializeSequencingState(),n=Lu({learnerId:this.context.learnerId||"unknown",courseId:t.courseId||"unknown",attemptNumber:1,lastUpdated:(new Date).toISOString(),version:t.sequencingStatePersistence.stateVersion||"1.0"},e),o=i,!1!==(r=t.sequencingStatePersistence).compress&&(o=this.compressStateData(i)),r.maxStateSize&&o.length>r.maxStateSize)throw Error("State size ".concat(o.length," exceeds limit ").concat(r.maxStateSize));return[4,r.persistence.saveState(o,n)];case 2:return a=c.sent(),r.debugPersistence&&this.context.apiLog("saveSequencingState","State save ".concat(a?"succeeded":"failed",": size=").concat(o.length),a?Ee.INFO:Ee.WARN),[2,a];case 3:return s=c.sent(),this.context.apiLog("saveSequencingState","Error saving sequencing state: ".concat(qu(s,Error)?s.message:s+""),Ee.ERROR),[2,!1];case 4:return[2]}})}).call(this)}},{key:"loadSequencingState",value:function(e){return Nu(function(){var t,i,n,r,o,a,s;return Fu(this,function(c){switch(c.label){case 0:if(!(t=this.context.getSettings()).sequencingStatePersistence)return this.context.apiLog("loadSequencingState","No persistence configuration provided",Ee.WARN),[2,!1];c.label=1;case 1:return c.trys.push([1,3,,4]),i=Lu({learnerId:this.context.learnerId||"unknown",courseId:t.courseId||"unknown",attemptNumber:1,version:t.sequencingStatePersistence.stateVersion||"1.0"},e),[4,(n=t.sequencingStatePersistence).persistence.loadState(i)];case 2:return(r=c.sent())?(o=r,!1!==n.compress&&(o=this.decompressStateData(r)),a=this.deserializeSequencingState(o),n.debugPersistence&&this.context.apiLog("loadSequencingState","State load ".concat(a?"succeeded":"failed",": size=").concat(r.length),a?Ee.INFO:Ee.WARN),[2,a]):(n.debugPersistence&&this.context.apiLog("loadSequencingState","No sequencing state found to load",Ee.INFO),[2,!1]);case 3:return s=c.sent(),this.context.apiLog("loadSequencingState","Error loading sequencing state: ".concat(qu(s,Error)?s.message:s+""),Ee.ERROR),[2,!1];case 4:return[2]}})}).call(this)}},{key:"serializeSequencingState",value:function(){var e,t={version:(null===(e=this.context.getSettings().sequencingStatePersistence)||void 0===e?void 0:e.stateVersion)||"1.0",timestamp:(new Date).toISOString(),sequencing:null,currentActivityId:null,globalObjectives:this.globalObjectiveManager.globalObjectives.map(function(e){return e.toJSON()}),globalObjectiveMap:{},adlNavState:{request:this.context.adl.nav.request,request_valid:this.context.adl.nav.request_valid},contentDelivered:!1};if(this.context.sequencingService){var i=this.context.sequencingService.getOverallSequencingProcess();if(i){var n=i.getSequencingState();t.sequencing=n,t.contentDelivered=i.hasContentBeenDelivered(),t.globalObjectiveMap=this.globalObjectiveManager.captureGlobalObjectiveSnapshot(i)}var r=this.context.sequencing.getCurrentActivity();r&&(t.currentActivityId=r.id)}return t.globalObjectiveMap&&0!==Object.keys(t.globalObjectiveMap).length||(t.globalObjectiveMap=this.globalObjectiveManager.captureGlobalObjectiveSnapshot()),JSON.stringify(t)}},{key:"deserializeSequencingState",value:function(e){var t=this;try{var i,n=JSON.parse(e),r=(null===(i=this.context.getSettings().sequencingStatePersistence)||void 0===i?void 0:i.stateVersion)||"1.0";if(n.version!==r&&this.context.apiLog("deserializeSequencingState","State version mismatch: ".concat(n.version," vs expected ").concat(r),Ee.WARN),n.globalObjectiveMap&&n.sequencing&&!n.sequencing.globalObjectiveMap&&(n.sequencing.globalObjectiveMap=n.globalObjectiveMap),n.sequencing&&this.context.sequencingService){var o=this.context.sequencingService.getOverallSequencingProcess();o&&(o.restoreSequencingState(n.sequencing),n.contentDelivered&&o.setContentDelivered(!0))}var a=new Map;if(Array.isArray(n.globalObjectives)){var s=!0,c=!1,l=void 0;try{for(var u,d=n.globalObjectives[Symbol.iterator]();!(s=(u=d.next()).done);s=!0){var f=this.globalObjectiveManager.buildCMIObjectiveFromJSON(u.value);f.id&&a.set(f.id,f)}}catch(e){c=!0,l=e}finally{try{s||null==d.return||d.return()}finally{if(c)throw l}}}if(n.globalObjectiveMap&&"object"===zu(n.globalObjectiveMap)){var v=this.globalObjectiveManager.buildCMIObjectivesFromMap(n.globalObjectiveMap),h=!0,m=!1,p=void 0;try{for(var y,g=v[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var _=y.value;_.id&&(a.has(_.id)||a.set(_.id,_))}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}return a.size>0&&(this.globalObjectiveManager.globalObjectives=Array.from(a.values()),this.globalObjectiveManager.globalObjectives.forEach(function(e){e.id&&t.globalObjectiveManager.updateGlobalObjectiveFromCMI(e.id,e)})),n.adlNavState&&(this.context.adl.nav.request=n.adlNavState.request||"_none_",this.context.adl.nav.request_valid=n.adlNavState.request_valid||{}),!0}catch(e){return this.context.apiLog("deserializeSequencingState","Error deserializing sequencing state: ".concat(qu(e,Error)?e.message:e+""),Ee.ERROR),!1}}},{key:"compressStateData",value:function(e){return"undefined"!=typeof btoa?btoa(encodeURIComponent(e)):e}},{key:"decompressStateData",value:function(e){if("undefined"!=typeof atob)try{return decodeURIComponent(atob(e))}catch(t){return e}return e}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Uu(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}var Gu=Object.defineProperty,Ku=function(e,t,i){return function(e,t,i){return t in e?Gu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Yu=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ku(this,"context"),Ku(this,"globalObjectiveManager"),this.context=t,this.globalObjectiveManager=i||null}return t=e,i=[{key:"setGlobalObjectiveManager",value:function(e){this.globalObjectiveManager=e}},{key:"updateSequencingService",value:function(e){this.context.sequencingService=e}},{key:"renderCommitCMI",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.context.renderCMIToJSONObject();e||t?i.cmi.total_time=this.context.cmi.getCurrentTotalTime():delete i.cmi.total_time;var n=u(i);switch(this.context.getSettings().dataCommitFormat){case"flattened":return n;case"params":return Object.entries(n).map(function(e){var t,i,n=(i=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(t,i)||function(e,t){if(e){if("string"==typeof e)return Uu(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Uu(e,t):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=n[1];return"".concat(n[0],"=").concat(r)});default:return i}}},{key:"renderCommitObject",value:function(e){var t,i,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.renderCommitCMI(e,n),o=e||n?this.context.cmi.getCurrentTotalTime():"",a=c(o,He),s=Ce,l=Se;this.context.cmi.completion_status&&("completed"===this.context.cmi.completion_status?s=we:"incomplete"===this.context.cmi.completion_status&&(s=Oe)),this.context.cmi.success_status&&("passed"===this.context.cmi.success_status?l=_e:"failed"===this.context.cmi.success_status&&(l=be));var u=(null===(i=this.context.cmi)||void 0===i||null===(t=i.score)||void 0===t?void 0:t.getScoreObject())||{},d={completionStatus:s,successStatus:l,totalTimeSeconds:a,runtimeData:r};u&&(d.score=u);var f=this.context.getSettings();if(f.autoPopulateCommitMetadata){var v,h;f.courseId&&(d.courseId=f.courseId),f.scoId&&(d.scoId=f.scoId),this.context.cmi.learner_id&&(d.learnerId=this.context.cmi.learner_id),this.context.cmi.learner_name&&(d.learnerName=this.context.cmi.learner_name);var m=null===(v=this.context.sequencingService)||void 0===v?void 0:v.getSequencingState();(null==m||null===(h=m.currentActivity)||void 0===h?void 0:h.id)&&(d.activityId=m.currentActivity.id)}return this.globalObjectiveManager&&this.globalObjectiveManager.syncCmiToSequencingActivity(s,l,u),d}},{key:"determineEntryValue",value:function(e,t){var i=null==e?void 0:e.trim();return""===e||null==e||""===i?"ab-initio":"suspend"===e?"resume":"logout"===e||"normal"===e?"":"time-out"===e&&t?"resume":""}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Wu(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Ju(e,t,i,n,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(n,r)}function $u(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){Ju(o,n,r,a,s,"next",e)}function s(e){Ju(o,n,r,a,s,"throw",e)}a(void 0)})}}function Xu(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Qu(e){return Qu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Qu(e)}function Zu(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function ed(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Xu(e,t,i[t])})}return e}function td(e,t){return td=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},td(e,t)}function nd(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function rd(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(rd=function(){return!!result})()}function od(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:c(0)}),s(a,"throw",{value:c(1)}),s(a,"return",{value:c(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function c(s){return function(c){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}var ad=Object.defineProperty,sd=function(e,t,i){return function(e,t,i){return t in e?ad(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":nd(t))?t+"":t,i)},cd=new Set(["cmi.suspend_data","cmi.location","cmi.scaled_passing_score","cmi.max_time_allowed","cmi.completion_threshold","cmi.progress_measure","cmi.score.scaled","cmi.score.raw","cmi.score.min","cmi.score.max","cmi.objectives.N.score.scaled","cmi.objectives.N.score.raw","cmi.objectives.N.score.min","cmi.objectives.N.score.max","cmi.objectives.N.progress_measure","cmi.objectives.N.description","cmi.interactions.N.weighting","cmi.interactions.N.type","cmi.interactions.N.timestamp","cmi.interactions.N.result","cmi.interactions.N.latency","cmi.interactions.N.learner_response","cmi.interactions.N.description","cmi.comments_from_learner.N.timestamp"]),Scorm2004API=function(e){function Scorm2004API(e,t){var i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Scorm2004API);var n=e?ed({},e):void 0;n&&void 0===n.mastery_override&&(n.mastery_override=!1),i=function(e,t,i){return t=Qu(t),n=e,!(r=rd()?Reflect.construct(t,i||[],Qu(e).constructor):t.apply(e,i))||"object"!==nd(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,Scorm2004API,[ce,n,t]),sd(i,"_version","1.0"),sd(i,"_sequencing"),sd(i,"_sequencingService",null),sd(i,"_extractedScoItemIds",[]),sd(i,"_sequencingCollections",{}),sd(i,"_responseValidator"),sd(i,"_cmiHandler"),sd(i,"_activityTreeBuilder"),sd(i,"_sequencingConfigBuilder"),sd(i,"_globalObjectiveManager"),sd(i,"_statePersistence",null),sd(i,"_dataSerializer"),sd(i,"cmi"),sd(i,"adl"),sd(i,"Initialize"),sd(i,"Terminate"),sd(i,"GetValue"),sd(i,"SetValue"),sd(i,"Commit"),sd(i,"GetLastError"),sd(i,"GetErrorString"),sd(i,"GetDiagnostic"),i.cmi=new bl,i.adl=new Pl,i._sequencing=new cu,i.adl.sequencing=i._sequencing,i._sequencingConfigBuilder=new bu,i._activityTreeBuilder=new Eu({},i._sequencingConfigBuilder);var r={throwSCORMError:function(e,t,n){return i.throwSCORMError(e,t,n)},getLastErrorCode:function(){return i.lastErrorCode},checkCorrectResponseValue:function(e,t,n,r){return i._responseValidator.checkCorrectResponseValue(e,t,n,r)}};i._responseValidator=new uu(r);var o={cmi:i.cmi,isInitialized:function(){return i.isInitialized()},throwSCORMError:function(e,t,n){return i.throwSCORMError(e,t,n)},getLastErrorCode:function(){return i.lastErrorCode}};i._cmiHandler=new vu(o,i._responseValidator);var a={getSettings:function(){return i.settings},cmi:i.cmi,sequencing:i._sequencing,sequencingService:i._sequencingService,commonSetCMIValue:i._commonSetCMIValue.bind(i)};i._globalObjectiveManager=new Iu(a);var s={getSettings:function(){return i.settings},cmi:i.cmi,sequencingService:i._sequencingService,renderCMIToJSONObject:i.renderCMIToJSONObject.bind(i)};return i._dataSerializer=new Yu(s,i._globalObjectiveManager),(null==n?void 0:n.sequencing)&&i.configureSequencing(n.sequencing),i.initializeSequencingService(n),i.Initialize=i.lmsInitialize,i.Terminate=i.lmsFinish,i.GetValue=i.lmsGetValue,i.SetValue=i.lmsSetValue,i.Commit=i.lmsCommit,i.GetLastError=i.lmsGetLastError,i.GetErrorString=i.lmsGetErrorString,i.GetDiagnostic=i.lmsGetDiagnostic,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&td(e,t)}(Scorm2004API,e),t=Scorm2004API,i=[{key:"reset",value:function(e){var t,i;this.commonReset(e),null===(t=this.cmi)||void 0===t||t.reset(),this.applyCurrentActivityLaunchData(),null===(i=this.adl)||void 0===i||i.reset()}},{key:"applyCurrentActivityLaunchData",value:function(){var e,t=null===(e=this._sequencing)||void 0===e?void 0:e.getCurrentActivity();t&&this.applyActivityLaunchData(t)}},{key:"applyDeliveredActivityLaunchData",value:function(e){this.isNotInitialized()&&this.applyActivityLaunchData(e)}},{key:"applyActivityLaunchData",value:function(e){var t,i,n,r;if(this.cmi){var o=null===(n=this._sequencing.overallSequencingProcess)||void 0===n?void 0:n.getContentActivityData(e),a=null!==(t=null!==(i=null==o?void 0:o.completionThreshold)&&void 0!==i?i:null===(r=e.completionThreshold)||void 0===r?void 0:""+r)&&void 0!==t?t:"";this.cmi.completion_threshold=a,this.seedCurrentActivityObjectives(e)}}},{key:"applyCurrentActivityObjectiveData",value:function(){var e,t=null===(e=this._sequencing)||void 0===e?void 0:e.getCurrentActivity();this.cmi&&t&&this.seedCurrentActivityObjectives(t)}},{key:"seedCurrentActivityObjectives",value:function(e){var t,i,n=[];e.primaryObjective&&n.push(e.primaryObjective),(t=n).push.apply(t,function(e){if(Array.isArray(e))return Wu(e)}(i=e.objectives)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||function(e,t){if(e){if("string"==typeof e)return Wu(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Wu(e,t):void 0}}(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var r=new Set,o=!0,a=!1,s=void 0;try{for(var c,l=n[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value,d=this.getSeedableObjectiveId(u);if(d&&!r.has(d)){r.add(d);var f=this.findOrSeedCMIObjective(d);if(null!==f){var v=this.cmi.objectives.findObjectiveByIndex(f);v&&this.cmi.objectives.initialized&&!v.initialized&&v.initialize();var h=this.getActivityObjectiveSuccessStatus(u);h&&this._commonSetCMIValue("SeedActivityObjective",!0,"cmi.objectives.".concat(f,".success_status"),h),this.seedObjectiveReadMapValues(e,u,f)}}}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}}},{key:"seedObjectiveReadMapValues",value:function(e,t,i){var n,r=null===(n=this._sequencing.overallSequencingProcess)||void 0===n?void 0:n.getGlobalObjectiveMap();if(r&&0!==t.mapInfo.length){var o=!0,a=!1,s=void 0;try{for(var c,l=t.mapInfo[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value,d=r.get(u.targetObjectiveID||t.id);if(d){var f=lr.getGlobalObjectiveReadState(e,t,u,d);this.applyObjectiveReadStateToCMI(i,f)}}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}}}},{key:"applyObjectiveReadStateToCMI",value:function(e,t){void 0!==t.satisfiedStatus&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".success_status"),t.satisfiedStatus?_e:be),void 0!==t.normalizedMeasure&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.scaled"),t.normalizedMeasure+""),void 0!==t.completionStatus&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".completion_status"),t.completionStatus),void 0!==t.progressMeasure&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".progress_measure"),t.progressMeasure+""),void 0!==t.rawScore&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.raw"),t.rawScore),void 0!==t.minScore&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.min"),t.minScore),void 0!==t.maxScore&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.max"),t.maxScore)}},{key:"getSeedableObjectiveId",value:function(e){var t=e.id;return"string"!=typeof t||""===t.trim()?null:t}},{key:"findOrSeedCMIObjective",value:function(e){var t=this.cmi.objectives.childArray.findIndex(function(t){return t.id===e});if(t>=0)return t;var i=this.cmi.objectives.childArray.length;return this._commonSetCMIValue("SeedActivityObjective",!0,"cmi.objectives.".concat(i,".id"),e)===z?i:null}},{key:"getActivityObjectiveSuccessStatus",value:function(e){return e.progressStatus||e.satisfiedStatusKnown?e.satisfiedStatus?_e:be:null}},{key:"version",get:function(){return this._version}},{key:"globalObjectives",get:function(){return this._globalObjectiveManager.globalObjectives}},{key:"_globalObjectives",get:function(){return this._globalObjectiveManager.globalObjectives},set:function(objectives){this._globalObjectiveManager.globalObjectives=objectives}},{key:"compressStateData",value:function(e){return this._statePersistence?this._statePersistence.compressStateData(e):"undefined"!=typeof btoa?btoa(encodeURIComponent(e)):e}},{key:"decompressStateData",value:function(e){if(this._statePersistence)return this._statePersistence.decompressStateData(e);if("undefined"!=typeof atob)try{return decodeURIComponent(atob(e))}catch(t){return e}return e}},{key:"lmsInitialize",value:function(){var e=this;if(""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))return this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),F;this.cmi.initialize();var result=this.initialize("Initialize","LMS was already initialized!","LMS is already finished!");return result===z&&this._sequencingService&&(this._sequencingService.initialize(),this.applyCurrentActivityObjectiveData()),result===z&&this._globalObjectiveManager.restoreGlobalObjectivesToCMI(),result===z&&this.settings.sequencingStatePersistence&&this.loadSequencingState().catch(function(){e.apiLog("lmsInitialize","Failed to auto-load sequencing state",Ee.WARN)}),result}},{key:"lmsFinish",value:function(){var e,t,i,n,r;if(""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))return this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),F;var o=(null===(i=this.adl)||void 0===i||null===(t=i.nav)||void 0===t?void 0:t.request)||"_none_",a=(null===(n=this.cmi)||void 0===n?void 0:n.getExitValueInternal())||"",s=this.isTerminated(),c=null!==(e=null===(r=this._sequencingService)||void 0===r?void 0:r.isDeliveryInProgress())&&void 0!==e&&e,result=this.terminate("Terminate",!0);if(result===z&&!s&&!c){var l=!1,u=null,d=o,f="",v=RegExp(Je);if("_none_"!==o){var h,m,p,y=o.match(v);if(y)if(null===(h=y.groups)||void 0===h?void 0:h.choice_target)f=null===(p=y.groups)||void 0===p?void 0:p.choice_target,d="choice";else if(null===(m=y.groups)||void 0===m?void 0:m.jump_target){var g;f=null===(g=y.groups)||void 0===g?void 0:g.jump_target,d="jump"}}if(this._sequencingService)try{var _,b=null;"_none_"!==d?(b=d,_=f||void 0):this._sequencing.getCurrentActivity()&&(b="exit"),b&&(l=this._sequencingService.processNavigationRequest(b,_,a),u=b)}catch(e){this.apiLog("lmsFinish","Sequencing navigation failed, falling back to event-based navigation: ".concat(e),Ee.WARN),l=!1}if(!l)if("_none_"!==o){var S={continue:"SequenceNext",previous:"SequencePrevious",choice:"SequenceChoice",jump:"SequenceJump",exit:"SequenceExit",exitAll:"SequenceExitAll",abandon:"SequenceAbandon",abandonAll:"SequenceAbandonAll"}[d];S&&this.processListeners(S,"adl.nav.request",f)}else this.settings.autoProgress&&this.processListeners("SequenceNext",void 0,"next");this._sequencingService&&u&&["exitAll","abandonAll","suspendAll"].includes(u)&&this._sequencingService.terminate(),this.adl.nav.request="_none_"}return result}},{key:"lmsGetValue",value:function(e){if(this.isTerminated())return this.lastErrorCode=ce.RETRIEVE_AFTER_TERM+"","";if(!this.isInitialized())return this.lastErrorCode=ce.RETRIEVE_BEFORE_INIT+"","";if("adl.nav.request"===e)return this.throwSCORMError(e,ce.WRITE_ONLY_ELEMENT,"adl.nav.request is write-only"),"";var t="^adl\\.nav\\.request_valid\\.(choice|jump)\\.{target=([a-zA-Z0-9-_]+)}$";if(f(e,t)){var i=e.match(t);if(i){var n,request=i[1],r=(null===(n=i[2])||void 0===n?void 0:n.replace(/{target=/g,"").replace(/}/g,""))||"";if("choice"===request||"jump"===request){var o,a,s,c=null===(o=this._sequencing)||void 0===o?void 0:o.overallSequencingProcess;return this.settings.scoItemIdValidator?this.settings.scoItemIdValidator(r)+"":(null==c?void 0:c.predictChoiceEnabled)&&"choice"===request?c.predictChoiceEnabled(r)?"true":"false":(null==c?void 0:c.predictJumpEnabled)&&"jump"===request?c.predictJumpEnabled(r)?"true":"false":this._extractedScoItemIds.length>0?this._extractedScoItemIds.includes(r)+"":(null===(s=this.settings)||void 0===s||null===(a=s.scoItemIds)||void 0===a?void 0:a.includes(r))+""}}}return"cmi.completion_status"===e?this._cmiHandler.evaluateCompletionStatus():"cmi.success_status"===e?this._cmiHandler.evaluateSuccessStatus():this.getValue("GetValue",!0,e)}},{key:"lmsSetValue",value:function(e,t){var i,n=this,r=this._peekCMIValue(e),result=this.setValue("SetValue","Commit",!0,e,t);if(result===z&&this._sequencingService)try{this._sequencingService.triggerRollupOnCMIChange(e,r,t)}catch(t){console.warn("Sequencing rollup failed for ".concat(e,": ").concat(t))}return result===z&&"setValue"===(null===(i=this.settings.sequencingStatePersistence)||void 0===i?void 0:i.autoSaveOn)&&["cmi.completion_status","cmi.success_status","cmi.score.scaled","cmi.objectives","adl.nav.request"].some(function(t){return e.startsWith(t)})&&this.saveSequencingState().catch(function(){n.apiLog("lmsSetValue","Failed to auto-save sequencing state",Ee.WARN)}),result}},{key:"lmsCommit",value:function(){var e=this;if(""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))return this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),F;if(this.settings.throttleCommits)return this.scheduleCommit(500,"Commit"),z;var t,result=this.commit("Commit",!0);return result===z&&"commit"===(null===(t=this.settings.sequencingStatePersistence)||void 0===t?void 0:t.autoSaveOn)&&this.saveSequencingState().catch(function(){e.apiLog("lmsCommit","Failed to auto-save sequencing state",Ee.WARN)}),result}},{key:"lmsGetLastError",value:function(){return this.getLastError("GetLastError")}},{key:"lmsGetErrorString",value:function(e){return this.getErrorString("GetErrorString",e)}},{key:"lmsGetDiagnostic",value:function(e){return this.getDiagnostic("GetDiagnostic",e)}},{key:"setCMIValue",value:function(e,t){if(f(e,"cmi\\.objectives\\.\\d+")){var i,n,r=+e.split(".")[2],o="cmi.objectives.".concat(r);if(f(e,"cmi\\.objectives\\.\\d+\\.id"))n=t;else{var a=this.cmi.objectives.findObjectiveByIndex(r);n=a?a.id:void 0}if(n&&(null===(i=this.settings.globalObjectiveIds)||void 0===i?void 0:i.includes(n))&&this.currentActivityAllowsGlobalObjectiveWrites()){var s=this._globalObjectiveManager.findOrCreateGlobalObjective(n).index,c=e.replace(o,"_globalObjectives.".concat(s));this._commonSetCMIValue("SetGlobalObjectiveValue",!0,c,t);var l=this._globalObjectiveManager.globalObjectives[s];n&&l&&this._globalObjectiveManager.updateGlobalObjectiveFromCMI(n,l)}}return this._commonSetCMIValue("SetValue",!0,e,t)}},{key:"currentActivityAllowsGlobalObjectiveWrites",value:function(){var e,t;return!1!==(null===(t=this._sequencing)||void 0===t||null===(e=t.getCurrentActivity())||void 0===e?void 0:e.sequencingControls.tracked)}},{key:"getChildElement",value:function(e,t,i){return this._cmiHandler.getChildElement(e,t,i)}},{key:"validateCorrectResponse",value:function(e,t){var i=e.split("."),n=this.cmi.interactions.childArray[+i[2]];n?this._responseValidator.validateCorrectResponse(e,n,t):this.throwSCORMError(e,ce.DEPENDENCY_NOT_ESTABLISHED,e)}},{key:"_peekCMIValue",value:function(e){if(!e||"string"!=typeof e)return null;for(var t=e.split("."),i=this,n=0;t.length>n;n++){var r=t[n];if(null==i)return null;try{i=i[r]}catch(e){return null}if(Zu(i,me)){var o=n+1;if(o>=t.length)return i;var a=+t[o];if(!Number.isNaN(a)&&Number.isInteger(a)&&a>=0){if(a>=i.childArray.length)return null;i=i.childArray[a],n++}}}return null!=i?i:null}},{key:"getCMIValue",value:function(e){return this._commonGetCMIValue("GetValue",!0,e)}},{key:"checkUninitializedGet",value:function(e,t){var i;""===t&&(this._setCMIElements.has(e)||cd.has(function(e){return e.replace(/\.\d+(?=\.|$)/g,".N")}(e))&&this.throwSCORMError(e,null!==(i=this._error_codes.VALUE_NOT_INITIALIZED)&&void 0!==i?i:403,"The data model element passed to GetValue (".concat(e,") has not been initialized.")))}},{key:"getLmsErrorMessageDetails",value:function(e,t){var i="",n="",r=V.error_descriptions[e+=""];return r&&(i=r.basicMessage,n=r.detailMessage),t?n:i}},{key:"replaceWithAnotherScormAPI",value:function(e){this.cmi=e.cmi,this.adl=e.adl}},{key:"renderCommitCMI",value:function(e){return this._dataSerializer.renderCommitCMI(e,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"renderCommitObject",value:function(e){return this._dataSerializer.renderCommitObject(e,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"storeData",value:function(e,t){var i,n,r,o,a;e&&"normal"===this.cmi.mode&&"credit"===this.cmi.credit&&(this.cmi.completion_threshold&&this.cmi.progress_measure&&(this.cmi.completion_status=parseFloat(this.cmi.completion_threshold)>parseFloat(this.cmi.progress_measure)?"incomplete":"completed"),this.cmi.scaled_passing_score&&this.cmi.score.scaled&&(this.cmi.success_status=parseFloat(this.cmi.scaled_passing_score)>parseFloat(this.cmi.score.scaled)?"failed":"passed"));var s=!1;this.adl.nav.request!==(null===(r=this.startingData)||void 0===r||null===(n=r.adl)||void 0===n||null===(i=n.nav)||void 0===i?void 0:i.request)&&"_none_"!==this.adl.nav.request&&(s=!0);var c=this.getCommitObject(e),l=(null===(a=this.cmi)||void 0===a||null===(o=a.score)||void 0===o?void 0:o.getScoreObject())||{},u=Ce;"completed"===this.cmi.completion_status?u=we:"incomplete"===this.cmi.completion_status&&(u=Oe);var d=Se;if("passed"===this.cmi.success_status?d=_e:"failed"===this.cmi.success_status&&(d=be),this._globalObjectiveManager.syncCmiToSequencingActivity(u,d,l),"string"==typeof this.settings.lmsCommitUrl){var result=this.processHttpRequest(this.settings.lmsCommitUrl,c,e,t);if(s&&void 0!==result.navRequest&&""!==result.navRequest&&"string"==typeof result.navRequest){var f=function(e){var t=new Set(["start","resumeAll","continue","previous","choice","jump","exit","exitAll","abandon","abandonAll","suspendAll","_none_"]),i=e.trim();if(!i)return{command:"_none_",targetActivityId:null,valid:!1,error:"Empty navigation request"};if(t.has(i))return{command:i,targetActivityId:null,valid:!0};var n=i.indexOf(".");if(n>0){var r=i.substring(0,n),o=i.substring(n+1);if(("choice"===r||"jump"===r)&&o)return/^[a-zA-Z0-9._-]+$/.test(o)?{command:r,targetActivityId:o,valid:!0}:{command:"_none_",targetActivityId:null,valid:!1,error:"Invalid target activity ID: contains disallowed characters"}}return{command:"_none_",targetActivityId:null,valid:!1,error:'Unrecognized navigation command: "'.concat(i,'"')}}(result.navRequest);if(f.valid){var v={start:"SequenceStart",resumeAll:"SequenceResumeAll",continue:"SequenceNext",previous:"SequencePrevious",choice:"SequenceChoice",jump:"SequenceJump",exit:"SequenceExit",exitAll:"SequenceExitAll",abandon:"SequenceAbandon",abandonAll:"SequenceAbandonAll",suspendAll:"SequenceSuspendAll"}[f.command];v&&this.processListeners(v,"adl.nav.request",f.targetActivityId)}else this.apiLog("storeData","Invalid navigation request from LMS: ".concat(f.error),Ee.WARN)}else(null==result?void 0:result.navRequest)&&!s&&"object"===nd(result.navRequest)&&Object.hasOwnProperty.call(result.navRequest,"name")&&result.navRequest.name&&this.processListeners(result.navRequest.name,result.navRequest.data);return result}return{result:z,errorCode:0}}},{key:"configureSequencing",value:function(e){this._sequencingCollections=this._sequencingConfigBuilder.sanitizeSequencingCollections(e.collections),this._activityTreeBuilder.setSequencingCollections(this._sequencingCollections),e.activityTree&&this.configureActivityTree(e.activityTree),e.sequencingRules&&this.configureSequencingRules(e.sequencingRules),e.sequencingControls&&this.configureSequencingControls(e.sequencingControls),e.rollupRules&&this.configureRollupRules(e.rollupRules),this._sequencing.hideLmsUi=e.hideLmsUi?this._sequencingConfigBuilder.sanitizeHideLmsUi(e.hideLmsUi):[],this._sequencing.auxiliaryResources=e.auxiliaryResources?this._sequencingConfigBuilder.sanitizeAuxiliaryResources(e.auxiliaryResources):[]}},{key:"configureActivityTree",value:function(e){var t=this._activityTreeBuilder.createActivity(e);this._sequencing.activityTree.root=t,this._extractedScoItemIds=this._activityTreeBuilder.extractActivityIds(t)}},{key:"configureSequencingRules",value:function(e){this._sequencingConfigBuilder.applySequencingRulesSettings(this._sequencing.sequencingRules,e)}},{key:"configureSequencingControls",value:function(e){this._sequencingConfigBuilder.applySequencingControlsSettings(this._sequencing.sequencingControls,e)}},{key:"configureRollupRules",value:function(e){this._sequencingConfigBuilder.applyRollupRulesSettings(this._sequencing.rollupRules,e)}},{key:"initializeSequencingService",value:function(e){var t=this;try{var i,n,r,o,a,s,c,l,u,d,f,v={autoRollupOnCMIChange:null===(i=null==e||null===(s=e.sequencing)||void 0===s?void 0:s.autoRollupOnCMIChange)||void 0===i||i,autoProgressOnCompletion:null!==(n=null==e||null===(c=e.sequencing)||void 0===c?void 0:c.autoProgressOnCompletion)&&void 0!==n&&n,validateNavigationRequests:null===(r=null==e||null===(l=e.sequencing)||void 0===l?void 0:l.validateNavigationRequests)||void 0===r||r,enableEventSystem:null===(o=null==e||null===(u=e.sequencing)||void 0===u?void 0:u.enableEventSystem)||void 0===o||o,logLevel:null!==(a=null==e||null===(d=e.sequencing)||void 0===d?void 0:d.logLevel)&&void 0!==a?a:"info"};if(this._sequencingService=new go(this._sequencing,this.cmi,this.adl,this.eventService||this,this.loggingService,v),this._sequencingService.setEventListeners(this.buildSequencingEventListeners(null==e||null===(f=e.sequencing)||void 0===f?void 0:f.eventListeners)),this._globalObjectiveManager.updateSequencingService(this._sequencingService),this._dataSerializer.updateSequencingService(this._sequencingService),null==e?void 0:e.sequencingStatePersistence){var h={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id};this._statePersistence=new Hu(h,this._globalObjectiveManager)}this._globalObjectiveManager.syncGlobalObjectiveIdsFromSequencing()}catch(e){console.warn("Failed to initialize sequencing service:",e),this._sequencingService=null}}},{key:"buildSequencingEventListeners",value:function(e){var t,i,n=this;return t=ed({},e),i=null!=(i={onActivityDelivery:function(t){var i;n.applyDeliveredActivityLaunchData(t),null==e||null===(i=e.onActivityDelivery)||void 0===i||i.call(e,t)}})?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}),t}},{key:"getSequencingService",value:function(){return this._sequencingService}},{key:"setSequencingEventListeners",value:function(e){this._sequencingService&&this._sequencingService.setEventListeners(this.buildSequencingEventListeners(e))}},{key:"updateSequencingConfiguration",value:function(e){this._sequencingService&&this._sequencingService.updateConfiguration(e)}},{key:"getSequencingState",value:function(){return this._sequencingService?this._sequencingService.getSequencingState():{isInitialized:!1,isActive:!1,currentActivity:null,rootActivity:this._sequencing.getRootActivity(),lastSequencingResult:null}}},{key:"processNavigationRequest",value:function(request,e){return!!this._sequencingService&&this._sequencingService.processNavigationRequest(request,e)}},{key:"resetSequencingState",value:function(){var e,t;null===(e=this._sequencing)||void 0===e||e.reset(),null===(t=this._sequencingService)||void 0===t||t.setEventListeners({})}},{key:"getActivityTrackingData",value:function(e){var t,i;if(!(null===(i=this._sequencing)||void 0===i?void 0:i.activityTree))return null;var n=this._sequencing.activityTree.getActivity(e);return n?{completionStatus:n.completionStatus||"unknown",successStatus:n.successStatus||"unknown",progressMeasure:null!==(t=n.progressMeasure)&&void 0!==t?t:null,score:n.objectiveMeasureStatus?n.objectiveNormalizedMeasure:null}:null}},{key:"saveSequencingState",value:function(e){return $u(function(){var t,i;return od(this,function(n){return t=this,this._statePersistence?[2,this._statePersistence.saveSequencingState(e)]:this.settings.sequencingStatePersistence?(i={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id},[2,new Hu(i,this._globalObjectiveManager).saveSequencingState(e)]):(this.apiLog("saveSequencingState","No persistence configuration provided",Ee.WARN),[2,!1])})}).call(this)}},{key:"loadSequencingState",value:function(e){return $u(function(){var t,i;return od(this,function(n){return t=this,this._statePersistence?[2,this._statePersistence.loadSequencingState(e)]:this.settings.sequencingStatePersistence?(i={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id},[2,new Hu(i,this._globalObjectiveManager).loadSequencingState(e)]):(this.apiLog("loadSequencingState","No persistence configuration provided",Ee.WARN),[2,!1])})}).call(this)}},{key:"serializeSequencingState",value:function(){var e=this;if(this._statePersistence)return this._statePersistence.serializeSequencingState();var t={getSettings:function(){return e.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id};return new Hu(t,this._globalObjectiveManager).serializeSequencingState()}},{key:"deserializeSequencingState",value:function(e){var t=this;if(this._statePersistence)return this._statePersistence.deserializeSequencingState(e);var i={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id};return new Hu(i,this._globalObjectiveManager).deserializeSequencingState(e)}},{key:"determineEntryValue",value:function(e,t){return this._dataSerializer.determineEntryValue(e,t)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),Scorm2004API;var t,i}(Lo);"undefined"!=typeof window&&(window.Scorm12API=Scorm12API,window.Scorm2004API=Scorm2004API)}();
|
|
1
|
+
!function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||n(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||n(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,i){if(t){if("string"==typeof t)return e(t,i);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,i):void 0}}var r=["text/plain","application/x-www-form-urlencoded","multipart/form-data"];function o(e){var t,i=(null!==(t=(e||"").split(";")[0])&&void 0!==t?t:"").trim().toLowerCase();return r.includes(i)}function a(e){if("undefined"==typeof location||!location||!location.origin)return!1;try{return new URL(e,location.href).origin!==location.origin}catch(e){return!1}}var s={D:86400,H:3600,M:60,S:1},c=function(e){if(!e||0>=e)return"00:00:00";var t=Math.floor(e/3600),i=new Date(1e3*e),n=i.getUTCMinutes(),r=i.getSeconds(),o=e%1,a="";return h(o)>0&&(a="."+(a=h(o)>2?o.toFixed(2):o+"").split(".")[1]),(t+":"+n+":"+r).replace(/\b\d\b/g,"0$&")+a},l=function(e){if(!e||0>=e)return"PT0S";var i="P",n=e;return Object.entries(s).forEach(function(e){var r=t(e,2),o=r[0],a=r[1],s=Math.floor(n/a);h(n%=a)>2&&(n=+(+n).toFixed(2)),"S"===o&&n>0&&(s+=n),s&&((i.indexOf("D")>0||["H","M","S"].includes(o))&&-1===i.indexOf("T")&&(i+="T"),i+="".concat(s).concat(o))}),i},u=p(function(e,t){if("number"!=typeof e&&"boolean"!=typeof e||(e+=""),"string"==typeof t&&(t=RegExp(t)),!e)return 0;if(!e.match(t))return/^\d+(?:\.\d+)?$/.test(e)?+e:0;var i=e.split(":");return 3600*+i[0]+60*+i[1]+ +i[2]},function(e,t){var i,n="string"==typeof t?t:null!==(i=null==t?void 0:""+t)&&void 0!==i?i:"";return"".concat("string"==typeof e?e:(null!=e?e:"")+"",":").concat(n)}),d=p(function(e,i){var n,r,o,a;if("string"==typeof i&&(i=RegExp(i)),!e||!(null==e||null===(r=e.match)||void 0===r?void 0:r.call(e,i)))return 0;var s=t(null!==(n=null===(o=(a=RegExp(i)).exec)||void 0===o?void 0:o.call(a,e))&&void 0!==n?n:[],8),result=0;return result+=+s[7]||0,result+=60*+s[6]||0,result+=3600*+s[5]||0,result+=86400*+s[4]||0,result+=604800*+s[3]||0,(result+=2592e3*+s[2]||0)+(31536e3*+s[1]||0)},function(e,t){var i,n="string"==typeof t?t:null!==(i=null==t?void 0:""+t)&&void 0!==i?i:"";return"".concat(null!=e?e:"",":").concat(n)}),f=p(function(e,t){var i;return"string"==typeof t&&(t=RegExp(t)),!(!e||!(null==e||null===(i=e.match)||void 0===i?void 0:i.call(e,t)))});function v(e){var result={};return function e(t,i){if(Object(t)!==t)result[i]=t;else if(Array.isArray(t))t.forEach(function(t,n){e(t,"".concat(i,"[").concat(n,"]"))}),0===t.length&&(result[i]=[]);else{var n=Object.keys(t).filter(function(e){return{}.hasOwnProperty.call(t,e)}),r=0===n.length;n.forEach(function(n){e(t[n],i?"".concat(i,".").concat(n):n)}),r&&i&&(result[i]={})}}(e,""),result}function h(e){var t,i,n,r;if(Math.floor(e)===e||0>(null===(n=e+"")||void 0===n||null===(i=n.indexOf)||void 0===i?void 0:i.call(n,".")))return 0;var o=null===(r=(""+e).split("."))||void 0===r?void 0:r[1];return null!==(t=null==o?void 0:o.length)&&void 0!==t?t:0}function m(e,t){return"string"==typeof e&&RegExp(t).test(e)}function p(e,t,n){var r=new Map;return function(){for(var o=arguments.length,a=Array(o),s=0;o>s;s++)a[s]=arguments[s];var result,c=t?t.apply(void 0,i(a)):JSON.stringify(a);return void 0!==(null==n?void 0:n.maxKeyLength)&&c.length>n.maxKeyLength?e.apply(void 0,i(a)):r.has(c)?r.get(c):(result=e.apply(void 0,i(a)),void 0===(null==n?void 0:n.maxEntries)||n.maxEntries>r.size||r.delete(r.keys().next().value),r.set(c,result),result)}}var y=function(e,t,i){var n=e.indexOf("#"),r=-1===n?e:e.slice(0,n),o=-1===n?"":e.slice(n),a=r.includes("?")?r.endsWith("?")||r.endsWith("&")?"":"&":"?",s="".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(i+""));return"".concat(r).concat(a).concat(s).concat(o)};function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}function S(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(S=function(){return!!result})()}function w(e,t){return w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},w(e,t)}function O(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var C=Object.defineProperty,E=function(e,t,i){return function(e,t,i){return t in e?C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":O(t))?t+"":t,i)},A=function(){function e(t){g(this,e),E(this,"jsonString",!1),E(this,"_cmi_element"),E(this,"_initialized",!1),this._cmi_element=t}return _(e,[{key:"initialized",get:function(){return this._initialized}},{key:"initialize",value:function(){this._initialized=!0}}]),e}(),k=function(e){function t(){var e;return g(this,t),e=function(e,t,i){return t=b(t),n=e,!(r=S()?Reflect.construct(t,i||[],b(e).constructor):t.apply(e,i))||"object"!==O(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,arguments),E(e,"_start_time"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&w(e,t)}(t,e),_(t,[{key:"start_time",get:function(){return this._start_time}},{key:"setStartTime",value:function(){if(void 0!==this._start_time)throw Error("Start time has already been set.");this._start_time=(new Date).getTime()}}]),t}(A);function j(e,t,i){return t=x(t),n=e,!(r=P()?Reflect.construct(t,i||[],x(e).constructor):t.apply(e,i))||"object"!==D(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function R(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M(e,t,i){return M=P()?Reflect.construct:function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&N(r,i.prototype),r},M.apply(null,arguments)}function T(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}function I(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&N(e,t)}function P(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(P=function(){return!!result})()}function N(e,t){return N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},N(e,t)}function D(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function q(e){var t="function"==typeof Map?new Map:void 0;return q=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return M(e,arguments,x(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),N(i,e)},q(e)}var L=Object.defineProperty,z=function(e,t,i){return function(e,t,i){return t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":D(t))?t+"":t,i)},F=function(e){function t(e,i){var n;return R(this,t),n=j(this,t,["".concat(e," : ").concat(""+i)]),z(n,"_errorCode"),n._errorCode=i,Object.setPrototypeOf(n,t.prototype),n}return I(t,e),T(t,[{key:"errorCode",get:function(){return this._errorCode}}]),t}(q(Error)),B=function(e){function t(e,i,n,r){var o;return R(this,t),o=j(this,t,[e,i]),z(o,"_errorMessage"),z(o,"_detailedMessage",""),o.message="".concat(e," : ").concat(n),o._errorMessage=n,r&&(o._detailedMessage=r),Object.setPrototypeOf(o,t.prototype),o}return I(t,e),T(t,[{key:"errorMessage",get:function(){return this._errorMessage}},{key:"detailedMessage",get:function(){return this._detailedMessage}}]),t}(F),V="true",H="false",U={cmi_children:"core,suspend_data,launch_data,comments,objectives,student_data,student_preference,interactions",core_children:"student_id,student_name,lesson_location,credit,lesson_status,entry,score,total_time,lesson_mode,exit,session_time",score_children:"raw,min,max",objectives_children:"id,score,status",correct_responses_children:"pattern",student_data_children:"mastery_score,max_time_allowed,time_limit_action",student_preference_children:"audio,language,speed,text",interactions_children:"id,objectives,time,type,correct_responses,weighting,student_response,result,latency",error_descriptions:{0:{basicMessage:"No Error",detailMessage:"No error occurred, the previous API call was successful."},101:{basicMessage:"General Exception",detailMessage:"No specific error code exists to describe the error."},201:{basicMessage:"Invalid argument error",detailMessage:"Indicates that an argument represents an invalid data model element or is otherwise incorrect."},202:{basicMessage:"Element cannot have children",detailMessage:'Indicates that LMSGetValue was called with a data model element name that ends in "_children" for a data model element that does not support the "_children" suffix.'},203:{basicMessage:"Element not an array - cannot have count",detailMessage:'Indicates that LMSGetValue was called with a data model element name that ends in "_count" for a data model element that does not support the "_count" suffix.'},301:{basicMessage:"Not initialized",detailMessage:"Indicates that an API call was made before the call to lmsInitialize."},401:{basicMessage:"Not implemented error",detailMessage:"The data model element indicated in a call to LMSGetValue or LMSSetValue is valid, but was not implemented by this LMS. SCORM 1.2 defines a set of data model elements as being optional for an LMS to implement."},402:{basicMessage:"Invalid set value, element is a keyword",detailMessage:'Indicates that LMSSetValue was called on a data model element that represents a keyword (elements that end in "_children" and "_count").'},403:{basicMessage:"Element is read only",detailMessage:"LMSSetValue was called with a data model element that can only be read."},404:{basicMessage:"Element is write only",detailMessage:"LMSGetValue was called on a data model element that can only be written to."},405:{basicMessage:"Incorrect Data Type",detailMessage:"LMSSetValue was called with a value that is not consistent with the data format of the supplied data model element."},407:{basicMessage:"Element Value Out Of Range",detailMessage:"The numeric value supplied to a LMSSetValue call is outside of the numeric range allowed for the supplied data model element."},408:{basicMessage:"Data Model Dependency Not Established",detailMessage:"Some data model elements cannot be set until another data model element was set. This error condition indicates that the prerequisite element was not set before the dependent element."}}},G={cmi_children:"_version,comments_from_learner,comments_from_lms,completion_status,completion_threshold,credit,entry,exit,interactions,launch_data,learner_id,learner_name,learner_preference,location,max_time_allowed,mode,objectives,progress_measure,scaled_passing_score,score,session_time,success_status,suspend_data,time_limit_action,total_time",comments_children:"comment,timestamp,location",score_children:"max,raw,scaled,min",objectives_children:"progress_measure,completion_status,success_status,description,score,id",correct_responses_children:"pattern",student_preference_children:"audio_level,audio_captioning,delivery_speed,language",interactions_children:"id,type,objectives,timestamp,correct_responses,weighting,learner_response,result,latency,description",adl_data_children:"id,store",error_descriptions:{0:{basicMessage:"No Error",detailMessage:"No error occurred, the previous API call was successful."},101:{basicMessage:"General Exception",detailMessage:"No specific error code exists to describe the error."},102:{basicMessage:"General Initialization Failure",detailMessage:"Call to Initialize failed for an unknown reason."},103:{basicMessage:"Already Initialized",detailMessage:"Call to Initialize failed because Initialize was already called."},104:{basicMessage:"Content Instance Terminated",detailMessage:"Call to Initialize failed because Terminate was already called."},111:{basicMessage:"General Termination Failure",detailMessage:"Call to Terminate failed for an unknown reason."},112:{basicMessage:"Termination Before Initialization",detailMessage:"Call to Terminate failed because it was made before the call to Initialize."},113:{basicMessage:"Termination After Termination",detailMessage:"Call to Terminate failed because Terminate was already called."},122:{basicMessage:"Retrieve Data Before Initialization",detailMessage:"Call to GetValue failed because it was made before the call to Initialize."},123:{basicMessage:"Retrieve Data After Termination",detailMessage:"Call to GetValue failed because it was made after the call to Terminate."},132:{basicMessage:"Store Data Before Initialization",detailMessage:"Call to SetValue failed because it was made before the call to Initialize."},133:{basicMessage:"Store Data After Termination",detailMessage:"Call to SetValue failed because it was made after the call to Terminate."},142:{basicMessage:"Commit Before Initialization",detailMessage:"Call to Commit failed because it was made before the call to Initialize."},143:{basicMessage:"Commit After Termination",detailMessage:"Call to Commit failed because it was made after the call to Terminate."},201:{basicMessage:"General Argument Error",detailMessage:"An invalid argument was passed to an API method (usually indicates that Initialize, Commit or Terminate did not receive the expected empty string argument."},301:{basicMessage:"General Get Failure",detailMessage:"Indicates a failed GetValue call where no other specific error code is applicable. Use GetDiagnostic for more information."},351:{basicMessage:"General Set Failure",detailMessage:"Indicates a failed SetValue call where no other specific error code is applicable. Use GetDiagnostic for more information."},391:{basicMessage:"General Commit Failure",detailMessage:"Indicates a failed Commit call where no other specific error code is applicable. Use GetDiagnostic for more information."},401:{basicMessage:"Undefined Data Model Element",detailMessage:"The data model element name passed to GetValue or SetValue is not a valid SCORM data model element."},402:{basicMessage:"Unimplemented Data Model Element",detailMessage:"The data model element indicated in a call to GetValue or SetValue is valid, but was not implemented by this LMS. In SCORM 2004, this error would indicate an LMS that is not fully SCORM conformant."},403:{basicMessage:"Data Model Element Value Not Initialized",detailMessage:"Attempt to read a data model element that has not been initialized by the LMS or through a SetValue call. This error condition is often reached during normal execution of a SCO."},404:{basicMessage:"Data Model Element Is Read Only",detailMessage:"SetValue was called with a data model element that can only be read."},405:{basicMessage:"Data Model Element Is Write Only",detailMessage:"GetValue was called on a data model element that can only be written to."},406:{basicMessage:"Data Model Element Type Mismatch",detailMessage:"SetValue was called with a value that is not consistent with the data format of the supplied data model element."},407:{basicMessage:"Data Model Element Value Out Of Range",detailMessage:"The numeric value supplied to a SetValue call is outside of the numeric range allowed for the supplied data model element."},408:{basicMessage:"Data Model Dependency Not Established",detailMessage:"Some data model elements cannot be set until another data model element was set. This error condition indicates that the prerequisite element was not set before the dependent element."}}};function K(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Y(e,t,i){return t=W(t),r=e,!(o=J()?Reflect.construct(t,i||[],W(e).constructor):t.apply(e,i))||"object"!=((n=o)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)&&"function"!=typeof o?K(r):o;var n,r,o}function W(e){return W=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},W(e)}function J(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(J=function(){return!!result})()}function $(e,t){return $=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},$(e,t)}var X=U.error_descriptions,Q=function(e){function t(e,i){var n,r,o,a,s,c;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n={}.hasOwnProperty.call(X,i+"")?Y(this,t,[e,i,(null===(r=X[i+""])||void 0===r?void 0:r.basicMessage)||"Unknown error",null===(o=X[i+""])||void 0===o?void 0:o.detailMessage]):Y(this,t,[e,101,null!==(a=null===(s=X[101])||void 0===s?void 0:s.basicMessage)&&void 0!==a?a:"General error",null===(c=X[101])||void 0===c?void 0:c.detailMessage]),Object.setPrototypeOf(K(n),t.prototype),K(n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$(e,t)}(t,e),t}(B);function Z(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ee(e,t,i){return t=te(t),r=e,!(o=ie()?Reflect.construct(t,i||[],te(e).constructor):t.apply(e,i))||"object"!=((n=o)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)&&"function"!=typeof o?Z(r):o;var n,r,o}function te(e){return te=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},te(e)}function ie(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ie=function(){return!!result})()}function ne(e,t){return ne=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ne(e,t)}var re=G.error_descriptions,oe=function(e){function t(e,i){var n,r,o,a,s;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n={}.hasOwnProperty.call(re,i+"")?ee(this,t,[e,i,(null===(r=re[i+""])||void 0===r?void 0:r.basicMessage)||"Unknown error",null===(o=re[i+""])||void 0===o?void 0:o.detailMessage]):ee(this,t,[e,101,(null===(a=re[101])||void 0===a?void 0:a.basicMessage)||"General error",null===(s=re[101])||void 0===s?void 0:s.detailMessage]),Object.setPrototypeOf(Z(n),t.prototype),Z(n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ne(e,t)}(t,e),t}(B);function ae(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function se(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){ae(e,t,i[t])})}return e}function ce(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}),e}var le={GENERAL:101,INITIALIZATION_FAILED:101,INITIALIZED:101,TERMINATED:101,TERMINATION_FAILURE:101,TERMINATION_BEFORE_INIT:101,MULTIPLE_TERMINATION:101,RETRIEVE_BEFORE_INIT:101,RETRIEVE_AFTER_TERM:101,STORE_BEFORE_INIT:101,STORE_AFTER_TERM:101,COMMIT_BEFORE_INIT:101,COMMIT_AFTER_TERM:101,ARGUMENT_ERROR:101,CHILDREN_ERROR:101,COUNT_ERROR:101,GENERAL_GET_FAILURE:101,GENERAL_SET_FAILURE:101,GENERAL_COMMIT_FAILURE:101,UNDEFINED_DATA_MODEL:101,UNIMPLEMENTED_ELEMENT:101,VALUE_NOT_INITIALIZED:101,INVALID_SET_VALUE:101,READ_ONLY_ELEMENT:101,WRITE_ONLY_ELEMENT:101,TYPE_MISMATCH:101,VALUE_OUT_OF_RANGE:101,DEPENDENCY_NOT_ESTABLISHED:101},ue=ce(se({},le),{RETRIEVE_BEFORE_INIT:301,STORE_BEFORE_INIT:301,COMMIT_BEFORE_INIT:301,ARGUMENT_ERROR:201,CHILDREN_ERROR:202,COUNT_ERROR:203,UNDEFINED_DATA_MODEL:401,UNIMPLEMENTED_ELEMENT:401,VALUE_NOT_INITIALIZED:301,INVALID_SET_VALUE:402,READ_ONLY_ELEMENT:403,WRITE_ONLY_ELEMENT:404,TYPE_MISMATCH:405,VALUE_OUT_OF_RANGE:405,DEPENDENCY_NOT_ESTABLISHED:408}),de=ce(se({},le),{INITIALIZATION_FAILED:102,INITIALIZED:103,TERMINATED:104,TERMINATION_FAILURE:111,TERMINATION_BEFORE_INIT:112,MULTIPLE_TERMINATION:113,MULTIPLE_TERMINATIONS:113,RETRIEVE_BEFORE_INIT:122,RETRIEVE_AFTER_TERM:123,STORE_BEFORE_INIT:132,STORE_AFTER_TERM:133,COMMIT_BEFORE_INIT:142,COMMIT_AFTER_TERM:143,ARGUMENT_ERROR:201,GENERAL_GET_FAILURE:301,GENERAL_SET_FAILURE:351,GENERAL_COMMIT_FAILURE:391,UNDEFINED_DATA_MODEL:401,UNIMPLEMENTED_ELEMENT:402,VALUE_NOT_INITIALIZED:403,READ_ONLY_ELEMENT:404,WRITE_ONLY_ELEMENT:405,TYPE_MISMATCH:406,VALUE_OUT_OF_RANGE:407,DEPENDENCY_NOT_ESTABLISHED:408});function fe(e){return fe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},fe(e)}function ve(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ve=function(){return!!result})()}function he(e,t){return he=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},he(e,t)}function me(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var pe=Object.defineProperty,ye=function(e,t,i){return function(e,t,i){return t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":me(t))?t+"":t,i)},ge=function(e){function t(e){var i,n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=fe(t),n=e,!(r=ve()?Reflect.construct(t,i||[],fe(e).constructor):t.apply(e,i))||"object"!==me(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,[e.CMIElement]),ye(i,"_errorCode"),ye(i,"_errorClass"),ye(i,"__children"),ye(i,"childArray"),i.__children=e.children,i._errorCode=null!==(n=e.errorCode)&&void 0!==n?n:ue.GENERAL,i._errorClass=e.errorClass||F,i.childArray=[],i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&he(e,t)}(t,e),i=t,n=[{key:"reset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._initialized=!1,e)this.childArray=[];else for(var t=0;this.childArray.length>t;t++){var i;null===(i=this.childArray[t])||void 0===i||i.reset()}}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new this._errorClass(this._cmi_element+"._children",this._errorCode)}},{key:"_count",get:function(){return this.childArray.length},set:function(_count){throw new this._errorClass(this._cmi_element+"._count",this._errorCode)}},{key:"toJSON",value:function(){this.jsonString=!0;for(var result={},e=0;this.childArray.length>e;e++)result[e+""]=this.childArray[e];return this.jsonString=!1,result}}],n&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A),_e="unknown",be="true",Se="false",we="passed",Oe="failed",Ce="unknown",Ee="completed",Ae="incomplete",ke="unknown",je={_:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5};function Re(e,t,i,n,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(n,r)}var Me={autocommit:!1,autocommitSeconds:10,throttleCommits:!1,useAsynchronousCommits:!1,sendFullCommit:!0,lmsCommitUrl:!1,dataCommitFormat:"json",commitRequestDataType:"application/json;charset=UTF-8",terminationCommitContentType:"text/plain;charset=UTF-8",autoProgress:!1,logLevel:je.ERROR,uninitializedGetLogLevel:je.WARN,selfReportSessionTime:!1,alwaysSendTotalTime:!1,renderCommonCommitFields:!1,autoCompleteLessonStatus:!1,strict_errors:!0,xhrHeaders:{},xhrWithCredentials:!1,fetchMode:"cors",asyncModeBeaconBehavior:"never",includeCommitSequence:!1,responseHandler:function(e){return(t=function(){var t,i;return function(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:c(0)}),s(a,"throw",{value:c(1)}),s(a,"return",{value:c(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function c(s){return function(c){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(n){switch(n.label){case 0:if(void 0===e)return[3,8];t=null,n.label=1;case 1:return n.trys.push([1,6,,7]),"function"!=typeof e.json?[3,3]:[4,e.json()];case 2:return t=n.sent(),[3,5];case 3:return"function"!=typeof e.text?[3,5]:[4,e.text()];case 4:(i=n.sent())&&(t=JSON.parse(i)),n.label=5;case 5:return[3,7];case 6:return n.sent(),[3,7];case 7:return null!==t&&{}.hasOwnProperty.call(t,"result")?[2,{result:t.result,errorCode:"number"==typeof t.errorCode?t.errorCode:!0===t.result||t.result===V?0:101}]:200===e.status?[2,{result:V,errorCode:0}]:[2,{result:H,errorCode:101}];case 8:return[2,{result:H,errorCode:101}]}})},function(){var e=this,i=arguments;return new Promise(function(n,r){var o=t.apply(e,i);function a(e){Re(o,n,r,a,s,"next",e)}function s(e){Re(o,n,r,a,s,"throw",e)}a(void 0)})})();var t},xhrResponseHandler:function(e){if(void 0!==e){var t=null;if(200>e.status||e.status>299)return{result:H,errorCode:101};try{t=JSON.parse(e.responseText)}catch(e){}return null!==t&&{}.hasOwnProperty.call(t,"result")?{result:t.result,errorCode:"number"==typeof t.errorCode?t.errorCode:!0===t.result||t.result===V?0:101}:{result:V,errorCode:0}}return{result:H,errorCode:101}},requestHandler:function(e){return e},onLogMessage:Te,mastery_override:!1,score_overrides_status:!1,completion_status_on_failed:"completed",scoItemIds:[],scoItemIdValidator:!1,globalObjectiveIds:[],enableOfflineSupport:!1,courseId:"",syncOnInitialize:!0,syncOnTerminate:!0,maxSyncAttempts:5,scoId:"",autoPopulateCommitMetadata:!1,httpService:null,globalStudentPreferences:!1};function Te(e,t){switch(e){case"4":case 4:case"ERROR":case je.ERROR:console.error(t);break;case"3":case 3:case"WARN":case je.WARN:console.warn(t);break;case"2":case 2:case"INFO":case je.INFO:console.info(t);break;case"1":case 1:case"DEBUG":case je.DEBUG:console.debug?console.debug(t):console.log(t)}}var xe="^[\\s\\S]{0,255}$",Ie="^([0-9]+):([0-9]{2}):([0-9]{2})(\\.\\d{1,2})?$",Pe="^-?([0-9]+)$",Ne="^-?([0-9]{0,10})(\\.[0-9]*)?$",De="^[\\u0021-\\u007E\\s]{0,255}$",qe="^.*$",Le="^(passed|completed|failed|incomplete|browsed|not attempted)$",ze="0#100",Fe="^[\\u0000-\\uFFFF]{0,4000}$",Be="^[\\u0000-\\uFFFF]{0,64000}$",Ve="^({lang=([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,250}$)?$",He="^({lang=([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).*$)?$",Ue="^({lang=([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,4000}$)?$",Ge="^(19[7-9][0-9]|[2-9][0-9]{3})((-(0[1-9]|1[0-2]))((-(0[1-9]|[1-2][0-9]|3[0-1]))(T([0-1][0-9]|2[0-3])((:[0-5][0-9])((:[0-5][0-9])((\\.[0-9]{1,6})((Z|([+|-]([0-1][0-9]|2[0-3])))(:[0-5][0-9])?)?)?)?)?)?)?)?$",Ke="^P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?(?:T?(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:(\\d+(?:\\.\\d{1,2})?)S)?)?$",Ye="^-?([0-9]{1,10})(\\.[0-9]{1,18})?$",We="^(?=.*\\w)[\\w\\-\\(\\)\\+\\.\\:\\=\\@\\;\\$\\_\\!\\*\\'\\%\\/\\#]{1,250}$",Je="^(?:(?!urn:)\\S{1,4000}|urn:[A-Za-z0-9-]{1,31}:\\S{1,4000}|.{1,4000})$",$e="^(completed|incomplete|not attempted|unknown)$",Xe="^(passed|failed|unknown)$",Qe="^(_?(start|resumeAll|previous|continue|exit|exitAll|abandon|abandonAll|suspendAll|retry|retryAll)|_none_|(\\{target=(?<choice_target>\\S{0,}[a-zA-Z0-9-_]+)})?choice|(\\{target=(?<jump_target>\\S{0,}[a-zA-Z0-9-_]+)})?jump)$",Ze="^(unknown|true|false)$",et="^{target=\\S{0,}[a-zA-Z0-9-_]+}$",tt="^$|"+We,it="(?![\\s\\S]*(?:\\[,\\]|\\[\\.\\]|\\[:\\]))[\\s\\S]{1,250}",nt={"true-false":{format:"^true$|^false$",max:1,delimiter:"",unique:!1},choice:{format:Je,max:36,delimiter:"[,]",unique:!0},"fill-in":{format:Ve,max:10,delimiter:"[,]",unique:!1},"long-fill-in":{format:Ue,max:1,delimiter:"",unique:!1},matching:{format:We,format2:We,max:36,delimiter:"[,]",delimiter2:"[.]",unique:!1},performance:{format:tt,format2:"^(?:|"+it+")$",max:250,delimiter:"[,]",delimiter2:"[.]",unique:!1},sequencing:{format:We,max:36,delimiter:"[,]",unique:!1},likert:{format:We,max:1,delimiter:"",unique:!1},numeric:{format:Ye,max:1,delimiter:"",unique:!1},other:{format:Fe,max:1,delimiter:"",unique:!1}},rt={"true-false":{max:1,delimiter:"",unique:!1,duplicate:!1,format:"^true$|^false$",limit:1},choice:{max:36,delimiter:"[,]",unique:!0,duplicate:!1,format:Je},"fill-in":{max:10,delimiter:"[,]",unique:!1,duplicate:!1,format:"^(({lang=([a-zA-Z]{1,8}|i|x)?(-[a-zA-Z0-9-]{2,8})?})?(.{0,250})?)?$"},"long-fill-in":{max:1,delimiter:"",unique:!1,duplicate:!0,format:Ue},matching:{max:36,delimiter:"[,]",delimiter2:"[.]",unique:!1,duplicate:!1,format:We,format2:We},performance:{max:250,delimiter:"[,]",delimiter2:"[.]",unique:!1,duplicate:!1,format:tt,format2:"^(?:|(?:-?\\d+(?:\\.\\d+)?)?\\[:\\](?:-?\\d+(?:\\.\\d+)?)?|"+it+")$"},sequencing:{max:36,delimiter:"[,]",unique:!1,duplicate:!1,format:We},likert:{max:1,delimiter:"",unique:!1,duplicate:!1,format:We,limit:1},numeric:{max:2,delimiter:"[:]",unique:!1,duplicate:!1,format:Ye,limit:1},other:{max:1,delimiter:"",unique:!1,duplicate:!1,format:Fe,limit:1}};function ot(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}!function(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){ot(e,t,i[t])})}}({},{"NB.2.1-1":"Sequencing session already started","NB.2.1-2":"Current activity not defined / sequencing not begun","NB.2.1-3":"No suspended activity to resume","NB.2.1-4":"Flow not enabled / current activity is root","NB.2.1-5":"Violates control mode (forward only or flow disabled)","NB.2.1-6":"Cannot move backward from root","NB.2.1-7":"Forward/Backward navigation not supported","NB.2.1-8":"Forward-only constraint violation","NB.2.1-9":"Activity path empty","NB.2.1-10":"Choice control disabled on parent","NB.2.1-11":"Target activity does not exist","NB.2.1-12":"Activity already terminated","NB.2.1-13":"Undefined navigation request","NB.2.1-14":"No current activity for EXIT_ALL","NB.2.1-15":"No current activity for ABANDON","NB.2.1-16":"No current activity for ABANDON_ALL","NB.2.1-17":"No current activity for SUSPEND_ALL","NB.2.1-18":"Invalid navigation request type"},{"TB.2.3-1":"No current activity to terminate","TB.2.3-2":"Current activity already terminated","TB.2.3-3":"Nothing to suspend (root activity)","TB.2.3-4":"Cannot EXIT_PARENT from root activity","TB.2.3-5":"Activity path is empty during suspend","TB.2.3-6":"Nothing to abandon","TB.2.3-7":"Undefined termination request"},{"SB.2.1-2":"No available children to deliver","SB.2.1-3":"Reached beginning of course","SB.2.1-4":"Forward only violation - cannot traverse backward"},{"SB.2.2-1":"Flow control disabled on parent","SB.2.2-2":"Activity not available"},{"SB.2.7-1":"Sequencing session not begun (current activity not terminated)","SB.2.7-2":"Cannot continue - flow disabled or no activity available"},{"SB.2.8-1":"Current activity not terminated","SB.2.8-2":"Cannot go previous - at beginning or forwardOnly enabled"},{"SB.2.9-1":"Target activity does not exist","SB.2.9-2":"Target activity not in tree","SB.2.9-3":"Cannot choose root activity","SB.2.9-4":"Activity hidden from choice","SB.2.9-5":"Choice control is not allowed","SB.2.9-6":"Current activity not terminated","SB.2.9-7":"No activity available from target","SB.2.9-8":"choiceExit prevents navigation outside ancestor subtree"},{"SB.2.4-1":"Stop forward traversal rule evaluates to true","SB.2.4-2":"Constrained choice requires forward traversal from leaf","SB.2.4-3":"Cannot walk backward from root of activity tree"},{"SB.2.10-1":"Current activity not defined","SB.2.10-2":"Activity is still active or suspended","SB.2.10-3":"Flow subprocess returned false (nothing to deliver)"},{"SB.2.11-1":"Exit not allowed - no parent","SB.2.11-2":"Exit not allowed by sequencing controls"},{"SB.2.12-1":"No current activity","SB.2.12-5":"No target activity specified","SB.2.12-6":"Undefined sequencing request"},{"SB.2.13-1":"Target activity does not exist","SB.2.13-2":"Target activity not in tree","SB.2.13-3":"Target not available"},{"SB.2.5-1":"No activity tree","SB.2.5-2":"Sequencing session already begun","SB.2.5-3":"No activity available"},{"SB.2.6-1":"No suspended activity","SB.2.6-2":"Current activity already defined"},{"SB.2.15-1":"Cannot suspend root"});var at=["aa","ab","ae","af","ak","am","an","ar","as","av","ay","az","ba","be","bg","bh","bi","bm","bn","bo","br","bs","ca","ce","ch","co","cr","cs","cu","cv","cy","da","de","dv","dz","ee","el","en","eo","es","et","eu","fa","ff","fi","fj","fo","fr","fy","ga","gd","gl","gn","gu","gv","ha","he","hi","ho","hr","ht","hu","hy","hz","ia","id","ie","ig","ii","ik","io","is","it","iu","ja","jv","ka","kg","ki","kj","kk","kl","km","kn","ko","kr","ks","ku","kv","kw","ky","la","lb","lg","li","ln","lo","lt","lu","lv","mg","mh","mi","mk","ml","mn","mo","mr","ms","mt","my","na","nb","nd","ne","ng","nl","nn","no","nr","nv","ny","oc","oj","om","or","os","pa","pi","pl","ps","pt","qu","rm","rn","ro","ru","rw","sa","sc","sd","se","sg","sh","si","sk","sl","sm","sn","so","sq","sr","ss","st","su","sv","sw","ta","te","tg","th","ti","tk","tl","tn","to","tr","ts","tt","tw","ty","ug","uk","ur","uz","ve","vi","vo","wa","wo","xh","yi","yo","za","zh","zu","aar","abk","ave","afr","aka","amh","arg","ara","asm","ava","aym","aze","bak","bel","bul","bih","bis","bam","ben","tib","bod","bre","bos","cat","che","cha","cos","cre","cze","ces","chu","chv","wel","cym","dan","ger","deu","div","dzo","ewe","gre","ell","eng","epo","spa","est","baq","eus","per","fas","ful","fin","fij","fao","fre","fra","fry","gle","gla","glg","grn","guj","glv","hau","heb","hin","hmo","hrv","hat","hun","arm","hye","her","ina","ind","ile","ibo","iii","ipk","ido","ice","isl","ita","iku","jpn","jav","geo","kat","kon","kik","kua","kaz","kal","khm","kan","kor","kau","kas","kur","kom","cor","kir","lat","ltz","lug","lim","lin","lao","lit","lub","lav","mlg","mah","mao","mri","mac","mkd","mal","mon","mol","mar","may","msa","mlt","bur","mya","nau","nob","nde","nep","ndo","dut","nld","nno","nor","nbl","nav","nya","oci","oji","orm","ori","oss","pan","pli","pol","pus","por","que","roh","run","rum","ron","rus","kin","san","srd","snd","sme","sag","slo","sin","slk","slv","smo","sna","som","alb","sqi","srp","ssw","sot","sun","swe","swa","tam","tel","tgk","tha","tir","tuk","tgl","tsn","ton","tur","tso","tat","twi","tah","uig","ukr","urd","uzb","ven","vie","vol","wln","wol","xho","yid","yor","zha","chi","zho","zul"];function st(e,t,i,n,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(n,r)}var ct=Object.defineProperty,lt=function(e,t,i){return function(e,t,i){return t in e?ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ut=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),lt(this,"_API"),lt(this,"_cancelled",!1),lt(this,"_timeout"),lt(this,"_callback"),this._API=t,this._timeout=setTimeout(this.wrapper.bind(this),i),this._callback=n}return t=e,i=[{key:"cancel",value:function(){this._cancelled=!0,this._timeout&&clearTimeout(this._timeout)}},{key:"wrapper",value:function(){var e;this._cancelled||this._API.isInitialized()&&(e=function(){return function(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:c(0)}),s(a,"throw",{value:c(1)}),s(a,"return",{value:c(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function c(s){return function(c){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(e){switch(e.label){case 0:return[4,this._API.commit(this._callback,!1,"autocommit")];case 1:return[2,e.sent()]}})},function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){st(o,n,r,a,s,"next",e)}function s(e){st(o,n,r,a,s,"throw",e)}a(void 0)})}).call(this)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}(),dt=["continue","previous","exit","exitAll","abandon","abandonAll","suspendAll"];function ft(e,t,i){return t=pt(t),n=e,!(r=_t()?Reflect.construct(t,i||[],pt(e).constructor):t.apply(e,i))||"object"!==St(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function vt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ht(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function mt(e,t,i){return t&&ht(e.prototype,t),i&&ht(e,i),e}function pt(e){return pt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},pt(e)}function yt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&bt(e,t)}function gt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _t(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_t=function(){return!!result})()}function bt(e,t){return bt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},bt(e,t)}function St(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var wt=Object.defineProperty,Ot=function(e,t,i){return function(e,t,i){return t in e?wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":St(t))?t+"":t,i)},Ct=function(e){return e.SKIP="skip",e.DISABLED="disabled",e.HIDE_FROM_CHOICE="hiddenFromChoice",e.STOP_FORWARD_TRAVERSAL="stopForwardTraversal",e.EXIT_PARENT="exitParent",e.EXIT_ALL="exitAll",e.RETRY="retry",e.RETRY_ALL="retryAll",e.CONTINUE="continue",e.PREVIOUS="previous",e.EXIT="exit",e}(Ct||{});var Et=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"always",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Map;return vt(this,t),e=ft(this,t,["ruleCondition"]),Ot(e,"_condition","always"),Ot(e,"_operator",null),Ot(e,"_parameters",new Map),Ot(e,"_referencedObjective",null),e._condition=i,e._operator=n,e._parameters=r,e}return yt(t,e),mt(t,[{key:"reset",value:function(){this._initialized=!1,this._condition="always",this._operator=null,this._parameters=new Map}},{key:"condition",get:function(){return this._condition},set:function(e){this._condition=e}},{key:"operator",get:function(){return this._operator},set:function(e){this._operator=e}},{key:"parameters",get:function(){return this._parameters},set:function(e){this._parameters=e}},{key:"referencedObjective",get:function(){return this._referencedObjective},set:function(e){this._referencedObjective=e}},{key:"resolveReferencedObjective",value:function(e){var t,i=this;return this._referencedObjective?(null===(t=e.primaryObjective)||void 0===t?void 0:t.id)===this._referencedObjective?e.primaryObjective:(e.objectives||[]).find(function(e){return e.id===i._referencedObjective})||null:null}},{key:"evaluate",value:function(e){var result,t,i=null!==this._referencedObjective,n=this.resolveReferencedObjective(e);switch(this._condition){case"satisfied":case"objectiveSatisfied":result=!(i&&!n)&&(n?n.satisfiedStatusKnown||n.progressStatus?!0===n.satisfiedStatus:"unknown":e.objectiveSatisfiedStatusKnown?!0===e.objectiveSatisfiedStatus:e.successStatus!==Ce?e.successStatus===we:"unknown");break;case"objectiveStatusKnown":result=!(i&&!n||(n?!n.satisfiedStatusKnown:!e.objectiveSatisfiedStatusKnown));break;case"objectiveMeasureKnown":result=!(i&&!n||(n?!n.measureStatus:!e.objectiveMeasureStatus));break;case"objectiveMeasureGreaterThan":if(i&&!n){result=!1;break}var r=this._parameters.get("threshold")||0;result=(n?n.measureStatus:e.objectiveMeasureStatus)?(n?n.normalizedMeasure:e.objectiveNormalizedMeasure)>r:"unknown";break;case"objectiveMeasureLessThan":if(i&&!n){result=!1;break}var o=this._parameters.get("threshold")||0;result=(n?n.measureStatus:e.objectiveMeasureStatus)?o>(n?n.normalizedMeasure:e.objectiveNormalizedMeasure):"unknown";break;case"completed":case"activityCompleted":result=!(i&&!n)&&(n?n.completionStatus===ke?"unknown":n.completionStatus===Ee:e.completionStatus===ke?"unknown":e.completionStatus===Ee);break;case"progressKnown":case"activityProgressKnown":result=!(i&&!n)&&(n?n.completionStatus!==ke:"unknown"!==e.completionStatus);break;case"attempted":result=e.attemptCount>0;break;case"attemptLimitExceeded":result=e.hasAttemptLimitExceeded();break;case"timeLimitExceeded":result=this.evaluateTimeLimitExceeded(e);break;case"outsideAvailableTimeRange":result=this.evaluateOutsideAvailableTimeRange(e);break;case"always":result=!0;break;default:result=!1}return"not"===this._operator&&(result="unknown"===(t=result)?"unknown":!t),result}},{key:"evaluateTimeLimitExceeded",value:function(e){var i=e.timeLimitDuration;if(!i&&e.attemptAbsoluteDurationLimit&&(i=e.attemptAbsoluteDurationLimit),!i)return!1;var n=d(i,Ke);if(0>=n)return!1;var r=0;if(t._getElapsedSecondsHook)try{var o=t._getElapsedSecondsHook(e);"number"!=typeof o||Number.isNaN(o)||0>o||(r=o)}catch(e){r=0}if(0===r&&e.attemptExperiencedDuration){var a=d(e.attemptExperiencedDuration,Ke);a>0&&(r=a)}if(0===r&&e.attemptAbsoluteStartTime)try{var s=new Date(e.attemptAbsoluteStartTime).getTime(),c=t._now().getTime();Number.isNaN(s)||Number.isNaN(c)||s>c||(r=(c-s)/1e3)}catch(e){r=0}return r>n}},{key:"evaluateOutsideAvailableTimeRange",value:function(e){var i=e.beginTimeLimit,n=e.endTimeLimit;if(!i&&!n)return!1;var r=t._now();return!(!i||r>=new Date(i))||!(!n||new Date(n)>=r)}},{key:"parseISO8601Duration",value:function(e){return 1e3*d(e,Ke)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={condition:this._condition,operator:this._operator,parameters:Object.fromEntries(this._parameters)};return this.jsonString=!1,result}}],[{key:"setNowProvider",value:function(e){"function"==typeof e&&(t._now=e)}},{key:"setElapsedSecondsHook",value:function(e){t._getElapsedSecondsHook=e}}]),t}(A);Ot(Et,"_now",function(){return new Date}),Ot(Et,"_getElapsedSecondsHook");var At=Et,kt=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"skip",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"and";return vt(this,t),e=ft(this,t,["sequencingRule"]),Ot(e,"_conditions",[]),Ot(e,"_action","skip"),Ot(e,"_conditionCombination","and"),e._action=i,e._conditionCombination=n,e}return yt(t,e),mt(t,[{key:"reset",value:function(){this._initialized=!1,this._conditions=[],this._action="skip",this._conditionCombination="and"}},{key:"conditions",get:function(){return this._conditions}},{key:"addCondition",value:function(e){if(!gt(e,At))throw new oe(this._cmi_element+".conditions",de.TYPE_MISMATCH);this._conditions.includes(e)||this._conditions.push(e)}},{key:"removeCondition",value:function(e){if(!gt(e,At))throw new oe(this._cmi_element+".conditions",de.TYPE_MISMATCH);var t=this._conditions.indexOf(e);return-1!==t&&(this._conditions.splice(t,1),!0)}},{key:"action",get:function(){return this._action},set:function(e){this._action=e}},{key:"conditionCombination",get:function(){return this._conditionCombination},set:function(e){this._conditionCombination=e}},{key:"evaluate",value:function(e){return!0===(t=this._conditions.map(function(t){return t.evaluate(e)}),i=this._conditionCombination,0!==t.length&&("all"===i||"and"===i?function(e){var t=!1,i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(!1===s)return!1;"unknown"===s&&(t=!0)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return!t||"unknown"}(t):("any"===i||"or"===i)&&function(e){var t=!1,i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(!0===s)return!0;"unknown"===s&&(t=!0)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return!!t&&"unknown"}(t)));var t,i}},{key:"toJSON",value:function(){this.jsonString=!0;var result={conditions:this._conditions,action:this._action,conditionCombination:this._conditionCombination};return this.jsonString=!1,result}}]),t}(A),jt=function(e){function t(){var e;return vt(this,t),e=ft(this,t,["sequencingRules"]),Ot(e,"_preConditionRules",[]),Ot(e,"_exitConditionRules",[]),Ot(e,"_postConditionRules",[]),e}return yt(t,e),mt(t,[{key:"reset",value:function(){this._initialized=!1,this._preConditionRules=[],this._exitConditionRules=[],this._postConditionRules=[]}},{key:"preConditionRules",get:function(){return this._preConditionRules}},{key:"addPreConditionRule",value:function(e){if(!gt(e,kt))throw new oe(this._cmi_element+".preConditionRules",de.TYPE_MISMATCH);this._preConditionRules.push(e)}},{key:"exitConditionRules",get:function(){return this._exitConditionRules}},{key:"addExitConditionRule",value:function(e){if(!gt(e,kt))throw new oe(this._cmi_element+".exitConditionRules",de.TYPE_MISMATCH);this._exitConditionRules.push(e)}},{key:"postConditionRules",get:function(){return this._postConditionRules}},{key:"addPostConditionRule",value:function(e){if(!gt(e,kt))throw new oe(this._cmi_element+".postConditionRules",de.TYPE_MISMATCH);this._postConditionRules.push(e)}},{key:"evaluatePreConditionRules",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=this._preConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.evaluate(e))return a.action}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"evaluateExitConditionRules",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=this._exitConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.evaluate(e))return a.action}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"evaluatePostConditionRules",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=this._postConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.evaluate(e))return a.action}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"toJSON",value:function(){this.jsonString=!0;var result={preConditionRules:this._preConditionRules,exitConditionRules:this._exitConditionRules,postConditionRules:this._postConditionRules};return this.jsonString=!1,result}}]),t}(A);var Rt=Object.defineProperty,Mt=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),n=t,function(e,t,i){t in e?Rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="activityTree")?i+"":i,n)}return t=e,(i=[{key:"isInTree",value:function(e){return this.activityTree.getAllActivities().includes(e)}},{key:"isAncestorOf",value:function(e,t){for(var i=t;i;){if(i===e)return!0;i=i.parent}return!1}},{key:"findCommonAncestor",value:function(e,t){if(!e||!t)return null;for(var i=[],n=e;n;)i.push(n),n=n.parent;for(n=t;n;){if(i.includes(n))return n;n=n.parent}return null}},{key:"findChildInPath",value:function(e,t){for(var i=t;i&&i.parent;){if(i.parent===e)return i;i=i.parent}return null}},{key:"isLastInTree",value:function(e){if(e.children.length>0)return!1;for(var t=e;t;){if(this.activityTree.getNextSibling(t))return!1;t=t.parent}return!0}},{key:"getCurrentInParent",value:function(e){if(e.children){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if(a.isActive)return a}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}return null}},{key:"isMandatory",value:function(e){if(e.sequencingRules&&e.sequencingRules.preConditionRules){var t=!0,i=!1,n=void 0;try{for(var r,o=e.sequencingRules.preConditionRules[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;if("skip"===a.action&&a.conditions&&0===a.conditions.length)return!1}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}return!0===e.mandatory}},{key:"isCompleted",value:function(e){return"completed"===e.completionStatus||"passed"===e.completionStatus||"passed"===e.successStatus}},{key:"isAvailableForChoice",value:function(e){return e.isVisible&&!e.isHiddenFromChoice&&e.isAvailable&&(!e.sequencingControls||e.sequencingControls.choice)}},{key:"getAncestors",value:function(e){for(var t=[],i=e.parent;i;)t.push(i),i=i.parent;return t}},{key:"getPathToRoot",value:function(e){for(var t=[e],i=e.parent;i;)t.push(i),i=i.parent;return t}},{key:"isLeaf",value:function(e){return 0===e.children.length}},{key:"isCluster",value:function(e){return e.children.length>0}},{key:"getDepth",value:function(e){for(var t=0,i=e.parent;i;)t++,i=i.parent;return t}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Tt=Object.defineProperty,xt=function(e,t,i){return function(e,t,i){return t in e?Tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},It=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),xt(this,"activityTree",t),xt(this,"treeQueries",i)}return t=e,i=[{key:"validateChoice",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!this.treeQueries.isInTree(t))return{valid:!1,exception:"SB.2.9-2"};if(t===this.activityTree.root)return{valid:!1,exception:"SB.2.9-3"};var n=this.validatePathToRoot(t);if(!n.valid)return n;if(i.checkAvailability&&!t.isAvailable)return{valid:!1,exception:"SB.2.9-7"};if(!e)return{valid:!0,exception:null};var r=this.validateChoiceExit(e,t);if(!r.valid)return r;var o=this.validateAncestorConstraints(e,t);return o.valid?{valid:!0,exception:null}:o}},{key:"validatePathToRoot",value:function(e){for(var t=e;t;){if(t.isHiddenFromChoice)return{valid:!1,exception:"SB.2.9-4"};if(t.parent&&!t.parent.sequencingControls.choice)return{valid:!1,exception:"SB.2.9-5"};if(t.parent&&t.parent.sequencingControls.preventActivation&&0===e.attemptCount&&!e.isActive)return{valid:!1,exception:"SB.2.9-6"};t=t.parent}return{valid:!0,exception:null}}},{key:"validateChoiceExit",value:function(e,t){for(var i=e.parent;i;){if(i.isActive&&!i.sequencingControls.choiceExit){if(!this.treeQueries.isAncestorOf(i,t))return{valid:!1,exception:"SB.2.9-8"};break}i=i.parent}return{valid:!0,exception:null}}},{key:"validateAncestorConstraints",value:function(e,t){for(var i=t.parent;i;){var n=this.validateConstraintsAtLevel(i,e,t);if(!n.valid)return n;i=i.parent}return{valid:!0,exception:null}}},{key:"validateConstraintsAtLevel",value:function(e,t,i){var n=this.treeQueries.findChildInPath(e,i),r=this.treeQueries.findChildInPath(e,t);if(!n||!r)return{valid:!0,exception:null};var o=e.children,a=o.indexOf(n),s=o.indexOf(r);if(-1===a||-1===s)return{valid:!0,exception:null};if(e.sequencingControls.forwardOnly&&s>a)return{valid:!1,exception:"SB.2.9-5"};if(a>s)for(var c=s+1;a>c;c++){var l=o[c];if(l&&this.treeQueries.isMandatory(l)&&!this.treeQueries.isCompleted(l))return{valid:!1,exception:"SB.2.9-6"}}if(e.sequencingControls.constrainChoice){if(a>s+1)return{valid:!1,exception:"SB.2.9-7"};if(s>a&&"completed"!==i.completionStatus&&"passed"!==i.completionStatus)return{valid:!1,exception:"SB.2.9-7"}}return e.sequencingControls.preventActivation&&0===i.attemptCount&&!i.isActive?{valid:!1,exception:"SB.2.9-6"}:{valid:!0,exception:null}}},{key:"checkForwardOnlyViolation",value:function(e){for(var t=e.parent;t;){if(t.sequencingControls.forwardOnly)return{valid:!1,exception:"SB.2.9-5"};t=t.parent}return{valid:!0,exception:null}}},{key:"isAvailableForChoice",value:function(e){return this.treeQueries.isAvailableForChoice(e)}},{key:"validateFlowConstraints",value:function(e,t){var i=[],n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;this.meetsFlowConstraints(c,e)&&i.push(c)}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return{valid:i.length>0,validChildren:i}}},{key:"meetsFlowConstraints",value:function(e,t){return!(!e.isAvailable||e.isHiddenFromChoice)&&(!t.sequencingControls.constrainChoice||this.validateConstrainChoiceForFlow(e,t))}},{key:"validateConstrainChoiceForFlow",value:function(e,t){if(!t.sequencingControls||!t.sequencingControls.constrainChoice)return!0;var i=t.children;if(!i||0===i.length)return!0;var n=i.indexOf(e);if(-1===n)return!1;var r=this.treeQueries.getCurrentInParent(t);if(!r)return this.isAvailableForChoice(e);var o=i.indexOf(r);return-1===o||(t.sequencingControls.flow?t.sequencingControls.forwardOnly&&o>n?"completed"===e.completionStatus||"passed"===e.completionStatus:o>n?o>n&&("completed"===e.completionStatus||"passed"===e.completionStatus)&&this.isAvailableForChoice(e):(n===o||n===o+1)&&this.isAvailableForChoice(e):this.isAvailableForChoice(e)&&("completed"===e.completionStatus||"unknown"===e.completionStatus||"incomplete"===e.completionStatus))}},{key:"validateTraversalConstraints",value:function(e){var t,i,n=!0,r=!0;return(null===(t=e.parent)||void 0===t?void 0:t.sequencingControls.constrainChoice)&&(n=this.evaluateConstrainChoiceForTraversal(e)),e.sequencingControls&&e.sequencingControls.stopForwardTraversal&&(r=!1),(null===(i=e.parent)||void 0===i?void 0:i.sequencingControls.forwardOnly)&&(r=this.evaluateForwardOnlyForChoice(e)),{canTraverse:n,canTraverseInto:r}}},{key:"evaluateConstrainChoiceForTraversal",value:function(e){if(!e.parent)return!0;for(var t=e.parent;t;){if(t.sequencingControls&&t.sequencingControls.constrainChoice){var i=t.children,n=this.treeQueries.findChildInPath(t,e);if(n){var r=i.indexOf(n),o=this.treeQueries.getCurrentInParent(t);if(o){var a=i.indexOf(o);if(-1!==a&&-1!==r){if(r>a)for(var s=a+1;r>s;s++){var c=i[s];if(c&&this.treeQueries.isMandatory(c)&&!this.treeQueries.isCompleted(c))return!1}if(t.sequencingControls.forwardOnly&&a>r&&!this.treeQueries.isCompleted(e))return!1}}}}t=t.parent}return this.isAvailableForChoice(e)}},{key:"evaluateForwardOnlyForChoice",value:function(e){if(!e.parent)return!0;var t=e.parent;if(!t.sequencingControls||!t.sequencingControls.forwardOnly)return!0;var i=t.children;if(!i||0===i.length)return!0;var n=i.indexOf(e);if(-1===n)return!1;var r=this.treeQueries.getCurrentInParent(t);if(!r)return this.isAvailableForChoice(e);var o=i.indexOf(r);return-1===o||(o>n?!("completed"!==e.completionStatus&&"passed"!==e.completionStatus||!e.sequencingControls||!e.sequencingControls.choice):this.isAvailableForChoice(e))}},{key:"hasTimeBoundaryViolation",value:function(e,t){if(e.beginTimeLimit)try{if(new Date(e.beginTimeLimit)>t)return!0}catch(e){}if(e.endTimeLimit)try{if(t>new Date(e.endTimeLimit))return!0}catch(e){}return!1}},{key:"hasAttemptLimitViolation",value:function(e){return!(!e.attemptLimit||e.attemptLimit>e.attemptCount)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Pt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Nt=Object.defineProperty,Dt=function(e,t,i){return function(e,t,i){return t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},qt=function(e){return e.START="start",e.RESUME_ALL="resumeAll",e.CONTINUE="continue",e.PREVIOUS="previous",e.CHOICE="choice",e.JUMP="jump",e.EXIT="exit",e.EXIT_PARENT="exitParent",e.EXIT_ALL="exitAll",e.ABANDON="abandon",e.ABANDON_ALL="abandonAll",e.SUSPEND_ALL="suspendAll",e.RETRY="retry",e.RETRY_ALL="retryAll",e}(qt||{}),Lt=function(e){return e.DELIVER="deliver",e.DO_NOT_DELIVER="doNotDeliver",e}(Lt||{}),zt=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"doNotDeliver",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Pt(this,e),Dt(this,"deliveryRequest"),Dt(this,"targetActivity"),Dt(this,"exception"),Dt(this,"endSequencingSession"),this.deliveryRequest=t,this.targetActivity=i,this.exception=n,this.endSequencingSession=r},Ft=function e(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Pt(this,e),Dt(this,"identifiedActivity"),Dt(this,"deliverable"),Dt(this,"exception"),Dt(this,"endSequencingSession"),this.identifiedActivity=t,this.deliverable=i,this.exception=n,this.endSequencingSession=r},Bt=function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Pt(this,e),Dt(this,"activity"),Dt(this,"exception"),this.activity=t,this.exception=i},Vt=function(e){return e.FORWARD="forward",e.BACKWARD="backward",e}(Vt||{});var Ht=Object.defineProperty,Ut=function(e,t,i){return function(e,t,i){return t in e?Ht(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Gt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ut(this,"now"),Ut(this,"getAttemptElapsedSecondsHook"),this.now=t.now||function(){return new Date},this.getAttemptElapsedSecondsHook=t.getAttemptElapsedSecondsHook||null}return t=e,(i=[{key:"checkSequencingRules",value:function(e,t){var i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(this.checkRuleSubprocess(e,s))return s.action}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"checkRuleSubprocess",value:function(e,t){return t.evaluate(e)}},{key:"evaluateExitRules",value:function(e){var t=this.checkSequencingRules(e,e.sequencingRules.exitConditionRules);return t===Ct.EXIT||t===Ct.EXIT_PARENT||t===Ct.EXIT_ALL?t:null}},{key:"evaluatePostConditionAction",value:function(e){var t=this.checkSequencingRules(e,e.sequencingRules.postConditionRules);return t&&[Ct.EXIT_PARENT,Ct.EXIT_ALL,Ct.RETRY,Ct.RETRY_ALL,Ct.CONTINUE,Ct.PREVIOUS,Ct.STOP_FORWARD_TRAVERSAL].includes(t)?t:null}},{key:"evaluatePostConditions",value:function(e){var t=this.evaluatePostConditionAction(e);if(!t)return{sequencingRequest:null,terminationRequest:null};switch(t){case Ct.EXIT_PARENT:return{sequencingRequest:null,terminationRequest:qt.EXIT_PARENT};case Ct.EXIT_ALL:return{sequencingRequest:null,terminationRequest:qt.EXIT_ALL};case Ct.RETRY:return{sequencingRequest:qt.RETRY,terminationRequest:null};case Ct.RETRY_ALL:return{sequencingRequest:qt.RETRY,terminationRequest:qt.EXIT_ALL};case Ct.CONTINUE:return{sequencingRequest:qt.CONTINUE,terminationRequest:null};case Ct.PREVIOUS:return{sequencingRequest:qt.PREVIOUS,terminationRequest:null};case Ct.STOP_FORWARD_TRAVERSAL:return e.sequencingControls.stopForwardTraversal=!0,{sequencingRequest:null,terminationRequest:null};default:return{sequencingRequest:null,terminationRequest:null}}}},{key:"checkLimitConditions",value:function(e){if(null!==e.attemptLimit&&e.attemptCount>=e.attemptLimit)return!0;if(null!==e.attemptAbsoluteDurationLimit){var t=this.parseDuration(e.attemptAbsoluteDurationLimit);if(t>0&&this.parseDuration(e.attemptExperiencedDuration)>=t)return!0}if(null!==e.activityAbsoluteDurationLimit){var i=this.parseDuration(e.activityAbsoluteDurationLimit);if(i>0&&this.parseDuration(e.activityExperiencedDuration)>=i)return!0}return!1}},{key:"parseDuration",value:function(e){if(!e||"string"!=typeof e)return 0;var t=e.match(/^P(?:(\d+(?:\.\d+)?)Y)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)W)?(?:(\d+(?:\.\d+)?)D)?(?:T(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?)?$/);if(!t||"P"===e||e.endsWith("T"))return 0;var i=0;return i+=315576e5*parseFloat(t[1]||"0"),i+=30.44*24*parseFloat(t[2]||"0")*36e5,i+=6048e5*parseFloat(t[3]||"0"),i+=864e5*parseFloat(t[4]||"0"),i+=36e5*parseFloat(t[5]||"0"),(i+=6e4*parseFloat(t[6]||"0"))+1e3*parseFloat(t[7]||"0")}},{key:"getElapsedSeconds",value:function(e){if(this.getAttemptElapsedSecondsHook)try{return this.getAttemptElapsedSecondsHook(e)||0}catch(e){return 0}if(e.attemptAbsoluteStartTime){var t=new Date(e.attemptAbsoluteStartTime).getTime(),i=this.now().getTime();if(!Number.isNaN(t)&&i>t)return Math.max(0,(i-t)/1e3)}return 0}},{key:"isTimeLimitExceeded",value:function(e){var t=e.timeLimitDuration;if(!t&&e.attemptAbsoluteDurationLimit&&(t=e.attemptAbsoluteDurationLimit),!t)return!1;var i=d(t,Ke);return i>0&&this.getElapsedSeconds(e)>i}},{key:"isOutsideAvailableTimeRange",value:function(e){var t=this.now();if(e.beginTimeLimit)try{var i=new Date(e.beginTimeLimit);if(!Number.isNaN(i.getTime())&&i>t)return!0}catch(e){}if(e.endTimeLimit)try{var n=new Date(e.endTimeLimit);if(!Number.isNaN(n.getTime())&&t>n)return!0}catch(e){}return!1}},{key:"canDeliverActivity",value:function(e){if(this.checkLimitConditions(e))return{canDeliver:!1,wasSkipped:!1};var t=this.checkSequencingRules(e,e.sequencingRules.preConditionRules);return{canDeliver:t!==Ct.SKIP&&t!==Ct.DISABLED,wasSkipped:t===Ct.SKIP}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Kt(e){return Kt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Kt(e)}function Yt(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Yt=function(){return!!result})()}function Wt(e,t){return Wt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Wt(e,t)}function Jt(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var $t=Object.defineProperty,Xt=function(e,t,i){return function(e,t,i){return t in e?$t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Jt(t))?t+"":t,i)},Qt=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(Qt||{}),Zt=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(Zt||{}),ei=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Kt(t),n=e,!(r=Yt()?Reflect.construct(t,i||[],Kt(e).constructor):t.apply(e,i))||"object"!==Jt(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["sequencingControls"]),Xt(e,"_enabled",!0),Xt(e,"_choice",!0),Xt(e,"_choiceExit",!0),Xt(e,"_flow",!0),Xt(e,"_forwardOnly",!1),Xt(e,"_useCurrentAttemptObjectiveInfo",!0),Xt(e,"_useCurrentAttemptProgressInfo",!0),Xt(e,"_preventActivation",!1),Xt(e,"_constrainChoice",!1),Xt(e,"_stopForwardTraversal",!1),Xt(e,"_rollupObjectiveSatisfied",!0),Xt(e,"_rollupProgressCompletion",!0),Xt(e,"_objectiveMeasureWeight",1),Xt(e,"_selectionTiming","never"),Xt(e,"_selectCount",null),Xt(e,"_selectionCountStatus",!1),Xt(e,"_randomizeChildren",!1),Xt(e,"_randomizationTiming","never"),Xt(e,"_reorderChildren",!1),Xt(e,"_completionSetByContent",!1),Xt(e,"_objectiveSetByContent",!1),Xt(e,"_tracked",!0),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Wt(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1,this._enabled=!0,this._choice=!0,this._choiceExit=!0,this._flow=!0,this._forwardOnly=!1,this._useCurrentAttemptObjectiveInfo=!0,this._useCurrentAttemptProgressInfo=!0,this._preventActivation=!1,this._constrainChoice=!1,this._stopForwardTraversal=!1,this._rollupObjectiveSatisfied=!0,this._rollupProgressCompletion=!0,this._objectiveMeasureWeight=1,this._selectionTiming="never",this._selectCount=null,this._selectionCountStatus=!1,this._randomizeChildren=!1,this._randomizationTiming="never",this._reorderChildren=!1,this._completionSetByContent=!1,this._objectiveSetByContent=!1,this._tracked=!0}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}},{key:"choice",get:function(){return this._choice},set:function(e){this._choice=e}},{key:"choiceExit",get:function(){return this._choiceExit},set:function(e){this._choiceExit=e}},{key:"flow",get:function(){return this._flow},set:function(e){this._flow=e}},{key:"forwardOnly",get:function(){return this._forwardOnly},set:function(e){this._forwardOnly=e}},{key:"useCurrentAttemptObjectiveInfo",get:function(){return this._useCurrentAttemptObjectiveInfo},set:function(e){this._useCurrentAttemptObjectiveInfo=e}},{key:"useCurrentAttemptProgressInfo",get:function(){return this._useCurrentAttemptProgressInfo},set:function(e){this._useCurrentAttemptProgressInfo=e}},{key:"preventActivation",get:function(){return this._preventActivation},set:function(e){this._preventActivation=e}},{key:"constrainChoice",get:function(){return this._constrainChoice},set:function(e){this._constrainChoice=e}},{key:"stopForwardTraversal",get:function(){return this._stopForwardTraversal},set:function(e){this._stopForwardTraversal=e}},{key:"rollupObjectiveSatisfied",get:function(){return this._rollupObjectiveSatisfied},set:function(e){this._rollupObjectiveSatisfied=e}},{key:"rollupProgressCompletion",get:function(){return this._rollupProgressCompletion},set:function(e){this._rollupProgressCompletion=e}},{key:"objectiveMeasureWeight",get:function(){return this._objectiveMeasureWeight},set:function(e){0>e||(this._objectiveMeasureWeight=e)}},{key:"isChoiceNavigationAllowed",value:function(){return this._enabled&&!this._constrainChoice}},{key:"isFlowNavigationAllowed",value:function(){return this._enabled&&this._flow}},{key:"isForwardNavigationAllowed",value:function(){return this._enabled&&this._flow}},{key:"isBackwardNavigationAllowed",value:function(){return this._enabled&&this._flow&&!this._forwardOnly}},{key:"selectionTiming",get:function(){return this._selectionTiming},set:function(e){this._selectionTiming=e}},{key:"selectCount",get:function(){return this._selectCount},set:function(e){(null===e||e>0)&&(this._selectCount=e)}},{key:"selectionCountStatus",get:function(){return this._selectionCountStatus},set:function(e){this._selectionCountStatus=e}},{key:"randomizeChildren",get:function(){return this._randomizeChildren},set:function(e){this._randomizeChildren=e}},{key:"randomizationTiming",get:function(){return this._randomizationTiming},set:function(e){this._randomizationTiming=e}},{key:"reorderChildren",get:function(){return this._reorderChildren},set:function(e){this._reorderChildren=e}},{key:"completionSetByContent",get:function(){return this._completionSetByContent},set:function(e){this._completionSetByContent=e}},{key:"objectiveSetByContent",get:function(){return this._objectiveSetByContent},set:function(e){this._objectiveSetByContent=e}},{key:"tracked",get:function(){return this._tracked},set:function(e){this._tracked=e}},{key:"toJSON",value:function(){this.jsonString=!0;var result={enabled:this._enabled,choice:this._choice,choiceExit:this._choiceExit,flow:this._flow,forwardOnly:this._forwardOnly,useCurrentAttemptObjectiveInfo:this._useCurrentAttemptObjectiveInfo,useCurrentAttemptProgressInfo:this._useCurrentAttemptProgressInfo,preventActivation:this._preventActivation,constrainChoice:this._constrainChoice,stopForwardTraversal:this._stopForwardTraversal,rollupObjectiveSatisfied:this._rollupObjectiveSatisfied,rollupProgressCompletion:this._rollupProgressCompletion,objectiveMeasureWeight:this._objectiveMeasureWeight,selectionTiming:this._selectionTiming,selectCount:this._selectCount,selectionCountStatus:this._selectionCountStatus,randomizeChildren:this._randomizeChildren,randomizationTiming:this._randomizationTiming,reorderChildren:this._reorderChildren,completionSetByContent:this._completionSetByContent,objectiveSetByContent:this._objectiveSetByContent,tracked:this._tracked};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function ti(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function ii(e){return function(e){if(Array.isArray(e))return ti(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return ti(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ti(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ni=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,i=[{key:"selectChildrenProcess",value:function(e){var t=e.sequencingControls,i=ii(e.children);if(t.selectionTiming===Qt.NEVER)return i;if(t.selectionTiming===Qt.ONCE&&t.selectionCountStatus)return i;if(t.selectionTiming!==Qt.ONCE&&!t.selectionCountStatus)return i;var n=t.selectCount;if(null===n||n>=i.length)return t.selectionTiming===Qt.ONCE&&(t.selectionCountStatus=!0),i;for(var r=[],o=i.map(function(e,t){return t}),a=0;n>a&&0!==o.length;a++){var s=Math.floor(Math.random()*o.length),c=o[s];void 0!==c&&i[c]&&r.push(i[c]),o.splice(s,1)}t.selectionTiming===Qt.ONCE&&(t.selectionCountStatus=!0);var l=!0,u=!1,d=void 0;try{for(var f,v=i[Symbol.iterator]();!(l=(f=v.next()).done);l=!0){var h=f.value;r.includes(h)||(h.isHiddenFromChoice=!0,h.isAvailable=!1)}}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}return r}},{key:"randomizeChildrenProcess",value:function(e){var t,i=e.sequencingControls,n=ii(e.children);if(i.randomizationTiming===Zt.NEVER)return n;if(i.randomizationTiming===Zt.ONCE&&i.reorderChildren)return n;if(!i.randomizeChildren)return n;for(var r=ii(n),o=r.length-1;o>0;o--){var a=Math.floor(Math.random()*(o+1)),s=r[o],c=r[a];s&&c&&(r[o]=c,r[a]=s)}return i.randomizationTiming===Zt.ONCE&&(i.reorderChildren=!0),e.children.length=0,(t=e.children).push.apply(t,ii(r)),r}},{key:"applySelectionAndRandomization",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=e.sequencingControls;if(!t&&(e.isActive||e.isSuspended))return e.children;var n=!1,r=!1;i.selectionTiming===Qt.ON_EACH_NEW_ATTEMPT?(n=t,t&&(i.selectionCountStatus=!0)):i.selectionTiming===Qt.ONCE&&(n=!i.selectionCountStatus),i.randomizationTiming===Zt.ON_EACH_NEW_ATTEMPT?(r=t,t&&(i.reorderChildren=!1)):i.randomizationTiming===Zt.ONCE&&(r=!i.reorderChildren),n&&this.selectChildrenProcess(e),r&&this.randomizeChildrenProcess(e);var o=e.children.filter(function(e){return e.isAvailable});return e.setProcessedChildren(o),o}},{key:"isSelectionNeeded",value:function(e){var t=e.sequencingControls;return t.selectionTiming!==Qt.NEVER&&(t.selectionTiming!==Qt.ONCE||!t.selectionCountStatus)&&null!==t.selectCount&&e.children.length>t.selectCount}},{key:"isRandomizationNeeded",value:function(e){var t=e.sequencingControls;return t.randomizationTiming!==Zt.NEVER&&(t.randomizationTiming!==Zt.ONCE||!t.reorderChildren)&&t.randomizeChildren}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t,i),e;var t,i}();var ri=Object.defineProperty,oi=function(e,t,i){return function(e,t,i){return t in e?ri(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ai=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),oi(this,"activityTree",t),oi(this,"ruleEngine",i)}return t=e,i=[{key:"flowSubprocess",value:function(e,t){for(var i=e,n=!0,r=!1,o=t,a=null;i;){var s=this.flowTreeTraversalSubprocess(i,o,n,a);if(!s.activity){var c=null;return s.exception?c=s.exception:t===Vt.BACKWARD?c="SB.2.1-3":r&&(c="SB.2.1-2"),new Ft(i,!1,c,s.endSequencingSession)}var l=s.direction||o;s.forwardOnlyCluster&&(a=s.forwardOnlyCluster),r=s.activity.children.length>0&&0===s.activity.getAvailableChildren().length;var u=this.flowActivityTraversalSubprocess(s.activity,l===Vt.FORWARD,!0,l);if(u)return new Ft(u,!0,null,!1);i=s.activity,o=l,n=!1}return new Ft(null,!1,null,!1)}},{key:"flowTreeTraversalSubprocess",value:function(e,t){return t===Vt.FORWARD?this.traverseForward(e,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]?arguments[3]:null):this.traverseBackward(e)}},{key:"traverseForward",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(i&&!this.isDescendantOfOrSelf(e,i))return{activity:null,endSequencingSession:!1};if(!i&&t&&this.isActivityLastOverall(e))return this.activityTree.root&&this.terminateDescendentAttempts(this.activityTree.root),{activity:null,endSequencingSession:!0};if(!t){this.ensureSelectionAndRandomization(e);var n=e.getAvailableChildren();if(n.length>0)return{activity:n[0]||null,endSequencingSession:!1}}for(var r=e;r;){var o=this.activityTree.getNextSibling(r);if(o)return{activity:o,endSequencingSession:!1};if(i&&(r===i||r.parent===i))return{activity:null,endSequencingSession:!1};r=r.parent}return this.activityTree.root&&this.terminateDescendentAttempts(this.activityTree.root),{activity:null,endSequencingSession:!0}}},{key:"traverseBackward",value:function(e){if(e.parent&&e.parent.sequencingControls.forwardOnly)return{activity:null,endSequencingSession:!1,exception:"SB.2.1-4"};var t=this.activityTree.getPreviousSibling(e);if(t)return this.getBackwardTraversalEntry(t);for(var i=e,n=0;i&&i.parent;){if(++n>1e4)throw Error("Infinite loop detected in backward traversal");var r=this.activityTree.getPreviousSibling(i.parent);if(r)return this.getBackwardTraversalEntry(r);i=i.parent}return{activity:null,endSequencingSession:!1}}},{key:"getBackwardTraversalEntry",value:function(e){for(var t=e,i=0;;){if(++i>1e4)throw Error("Infinite loop detected while getting backward traversal entry");this.ensureSelectionAndRandomization(t);var n=t.getAvailableChildren();if(0===n.length)break;if(t.sequencingControls.forwardOnly)return{activity:n[0]||null,endSequencingSession:!1,direction:Vt.FORWARD,forwardOnlyCluster:t};var r=n[n.length-1];if(!r)break;t=r}return{activity:t,endSequencingSession:!1}}},{key:"isDescendantOfOrSelf",value:function(e,t){for(var i=e;i;){if(i===t)return!0;i=i.parent}return!1}},{key:"flowActivityTraversalSubprocess",value:function(e,t,i,mode){var n=e.parent;if(n&&!n.sequencingControls.flow)return null;if(!e.isAvailable)return null;if(mode===Vt.FORWARD&&e.sequencingControls.stopForwardTraversal)return null;if(i){this.ensureSelectionAndRandomization(e);var r=e.getAvailableChildren(),o=!0,a=!1,s=void 0;try{for(var c,l=r[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=this.flowActivityTraversalSubprocess(c.value,mode===Vt.FORWARD,!0,mode);if(u)return u}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}}return 0===e.children.length&&this.checkActivityProcess(e)?e:null}},{key:"checkActivityProcess",value:function(e){if(!e.isAvailable)return!1;if(0===e.children.length&&!e.isVisible)return!1;if(this.ruleEngine.checkLimitConditions(e))return!1;var t=this.ruleEngine.canDeliverActivity(e);return e.wasSkipped=t.wasSkipped,t.canDeliver}},{key:"ensureSelectionAndRandomization",value:function(e){e.getAvailableChildren()===e.children&&(ni.isSelectionNeeded(e)||ni.isRandomizationNeeded(e))&&ni.applySelectionAndRandomization(e,e.isNewAttempt)}},{key:"isActivityLastOverall",value:function(e){if(e.children.length>0)return!1;for(var t=e;t;){if(this.activityTree.getNextSibling(t))return!1;t=t.parent}return!0}},{key:"terminateDescendentAttempts",value:function(e){e.isActive=!1;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateDescendentAttempts(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"findFirstDeliverableActivity",value:function(e){if(0===e.children.length)return this.checkActivityProcess(e)?e:null;this.ensureSelectionAndRandomization(e);var t=e.getAvailableChildren(),i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=this.flowActivityTraversalSubprocess(o.value,!0,!0,Vt.FORWARD);if(s)return s}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"canDeliver",value:function(e){return this.checkActivityProcess(e)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var si=Object.defineProperty,ci=function(e,t,i){return function(e,t,i){return t in e?si(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},li=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ci(this,"activityTree",t),ci(this,"traversalService",i)}return t=e,(i=[{key:"handleStart",value:function(){var result=new zt;if(!this.activityTree.root)return result.exception="SB.2.5-1",result;if(this.activityTree.currentActivity)return result.exception="SB.2.5-2",result;var e=this.traversalService.findFirstDeliverableActivity(this.activityTree.root);return e?(result.deliveryRequest=Lt.DELIVER,result.targetActivity=e,result):(result.exception="SB.2.5-3",result)}},{key:"handleResumeAll",value:function(){var result=new zt;return this.activityTree.suspendedActivity?this.activityTree.currentActivity?(result.exception="SB.2.6-2",result):(result.deliveryRequest=Lt.DELIVER,result.targetActivity=this.activityTree.suspendedActivity,result):(result.exception="SB.2.6-1",result)}},{key:"handleContinue",value:function(e){var result=new zt;if(e.isActive)return result.exception="SB.2.7-1",result;if(e.parent&&!e.parent.sequencingControls.flow)return result.exception="SB.2.7-2",result;var t=this.traversalService.flowSubprocess(e,Vt.FORWARD);return result.endSequencingSession=t.endSequencingSession,t.deliverable&&t.identifiedActivity?(result.deliveryRequest=Lt.DELIVER,result.targetActivity=t.identifiedActivity,result):(result.exception=t.exception||"SB.2.7-2",result)}},{key:"handlePrevious",value:function(e){var result=new zt;if(e.isActive)return result.exception="SB.2.8-1",result;if(e.parent&&!e.parent.sequencingControls.flow)return result.exception="SB.2.8-2",result;var t=this.checkForwardOnlyViolation(e);if(t)return result.exception=t,result;var i=this.traversalService.flowSubprocess(e,Vt.BACKWARD);return i.deliverable&&i.identifiedActivity?(result.deliveryRequest=Lt.DELIVER,result.targetActivity=i.identifiedActivity,result):(result.exception=i.exception||"SB.2.8-3",result)}},{key:"checkForwardOnlyViolation",value:function(e){for(var t=e.parent;t;){if(t.sequencingControls.forwardOnly)return"SB.2.9-5";t=t.parent}return null}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var ui=Object.defineProperty,di=function(e,t,i){return function(e,t,i){return t in e?ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},fi=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),di(this,"activityTree",t),di(this,"constraintValidator",i),di(this,"traversalService",n),di(this,"treeQueries",r)}return t=e,i=[{key:"handleChoice",value:function(e,t){var result=new zt,i=this.activityTree.getActivity(e);if(!i)return result.exception="SB.2.9-1",result;if(t&&t.isActive)return result.exception="SB.2.9-6",result;var n=this.constraintValidator.validateChoice(t,i,{checkAvailability:!0});if(!n.valid)return result.exception=n.exception,result;var r=this.treeQueries.findCommonAncestor(t,i);t&&this.terminateDescendentAttemptsProcess(r||this.activityTree.root);var o=this.buildActivityPath(i,r),a=!0,s=!1,c=void 0;try{for(var l,u=o[Symbol.iterator]();!(a=(l=u.next()).done);a=!0)if(!this.traversalService.checkActivityProcess(l.value))return result}catch(e){s=!0,c=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw c}}var d=i;if(i.children.length>0){var f=this.choiceFlowSubprocess(i);if(!f)return result.exception="SB.2.9-7",result;d=f}return result.deliveryRequest=Lt.DELIVER,result.targetActivity=d,result}},{key:"handleJump",value:function(e){var result=new zt,t=this.activityTree.getActivity(e);return t?this.treeQueries.isInTree(t)?t.isAvailable?(result.deliveryRequest=Lt.DELIVER,result.targetActivity=t,result):(result.exception="SB.2.13-3",result):(result.exception="SB.2.13-2",result):(result.exception="SB.2.13-1",result)}},{key:"getAvailableChoices",value:function(){var e=this.activityTree.getAllActivities(),t=this.activityTree.currentActivity,i=[],n=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;c!==this.activityTree.root&&!c.isHiddenFromChoice&&c.isAvailable&&c.isVisible&&(c.parent&&!c.parent.sequencingControls.choice||this.constraintValidator.validateChoice(t,c).valid&&i.push(c))}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return i}},{key:"buildActivityPath",value:function(e,t){for(var i=[],n=e;n&&n!==t;)i.unshift(n),n=n.parent;return i}},{key:"choiceFlowSubprocess",value:function(e){return 0===e.children.length?e:this.choiceFlowTreeTraversal(e)}},{key:"choiceFlowTreeTraversal",value:function(e){this.traversalService.ensureSelectionAndRandomization(e);var t=e.getAvailableChildren(),i=this.constraintValidator.validateFlowConstraints(e,t);if(!i.valid)return null;var n=!0,r=!1,o=void 0;try{for(var a,s=i.validChildren[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=this.enhancedChoiceTraversal(a.value);if(c.activity)return c.activity}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return null}},{key:"enhancedChoiceTraversal",value:function(e){var t;if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&e===this.activityTree.root)return new Bt(null,"SB.2.4-3");if(!e.isAvailable)return new Bt(null,null);if(e.isHiddenFromChoice)return new Bt(null,null);if(e.sequencingControls&&e.sequencingControls.stopForwardTraversal)return new Bt(null,"SB.2.4-1");var i=this.constraintValidator.validateTraversalConstraints(e);if(!i.canTraverse)return new Bt(null,null);if(0===e.children.length)return this.traversalService.checkActivityProcess(e)?new Bt(e,null):new Bt(null,null);if((null===(t=e.parent)||void 0===t?void 0:t.sequencingControls.constrainChoice)&&!i.canTraverseInto)return new Bt(null,"SB.2.4-2");if(i.canTraverseInto){var n=this.choiceFlowTreeTraversal(e);return new Bt(n,null)}return new Bt(null,null)}},{key:"terminateDescendentAttemptsProcess",value:function(e){e.isActive=!1;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateDescendentAttemptsProcess(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var vi=Object.defineProperty,hi=function(e,t,i){return function(e,t,i){return t in e?vi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},mi=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),hi(this,"activityTree",t),hi(this,"ruleEngine",i)}return t=e,i=[{key:"handleExit",value:function(e){var result=new zt;return e.parent?e.parent.sequencingControls.choiceExit?(this.terminateDescendentAttempts(e),result):(result.exception="SB.2.11-2",result):(result.exception="SB.2.11-1",result)}},{key:"handleExitAll",value:function(){var result=new zt;return this.activityTree.root&&this.terminateDescendentAttempts(this.activityTree.root),result}},{key:"handleAbandon",value:function(e){var result=new zt;return e.isActive=!1,this.activityTree.currentActivity=e.parent,result}},{key:"handleAbandonAll",value:function(){var result=new zt;return this.activityTree.currentActivity=null,result}},{key:"handleSuspendAll",value:function(e){var result=new zt;return e===this.activityTree.root?(result.exception="SB.2.15-1",result):(e.isSuspended=!0,this.activityTree.suspendedActivity=e,this.activityTree.currentActivity=null,result)}},{key:"terminateDescendentAttempts",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;t||(i=this.ruleEngine.evaluateExitRules(e)),e.isActive=!1;var n=!0,r=!1,o=void 0;try{for(var a,s=e.children[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)this.terminateDescendentAttempts(a.value,t)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}i&&!t&&this.processDeferredExitAction(i,e)}},{key:"processDeferredExitAction",value:function(e,t){switch(e){case Ct.EXIT:break;case Ct.EXIT_PARENT:t.parent&&t.parent.isActive&&this.terminateDescendentAttempts(t.parent,!0);break;case Ct.EXIT_ALL:this.activityTree.root&&this.activityTree.root!==t&&this.activityTree.getAllActivities().some(function(e){return e.isActive})&&this.terminateDescendentAttempts(this.activityTree.root,!0)}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var pi=Object.defineProperty,yi=function(e,t,i){return function(e,t,i){return t in e?pi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},gi=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),yi(this,"activityTree",t),yi(this,"traversalService",i)}return t=e,(i=[{key:"handleRetry",value:function(e){var result=new zt;if(e.isActive||e.isSuspended)return result.exception="SB.2.10-2",result;if(e.children.length>0){this.traversalService.ensureSelectionAndRandomization(e);var t=e.getAvailableChildren(),i=null,n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&!(i=this.traversalService.flowActivityTraversalSubprocess(a.value,!0,!0,Vt.FORWARD));n=!0);}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return i?(result.deliveryRequest=Lt.DELIVER,result.targetActivity=i,result):(result.exception="SB.2.10-3",result)}return this.terminateDescendentAttempts(e),result.deliveryRequest=Lt.DELIVER,result.targetActivity=e,result}},{key:"handleRetryAll",value:function(){if(this.activityTree.currentActivity=null,!this.activityTree.root){var e=new zt;return e.exception="SB.2.10-1",e}var t=this.traversalService.findFirstDeliverableActivity(this.activityTree.root),result=new zt;return t?(result.deliveryRequest=Lt.DELIVER,result.targetActivity=t,result):(result.exception="SB.2.10-3",result)}},{key:"terminateDescendentAttempts",value:function(e){e.isActive=!1;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateDescendentAttempts(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var _i=Object.defineProperty,bi=function(e,t,i){return function(e,t,i){return t in e?_i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Si=function(){function e(t,i,n){var r=arguments.length>4?arguments[4]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),bi(this,"activityTree"),bi(this,"treeQueries"),bi(this,"constraintValidator"),bi(this,"ruleEngine"),bi(this,"traversalService"),bi(this,"flowHandler"),bi(this,"choiceHandler"),bi(this,"exitHandler"),bi(this,"retryHandler"),bi(this,"_now"),bi(this,"_getAttemptElapsedSecondsHook"),this.activityTree=t,this._now=(null==r?void 0:r.now)||function(){return new Date},this._getAttemptElapsedSecondsHook=null==r?void 0:r.getAttemptElapsedSeconds,this.treeQueries=new Mt(t),this.ruleEngine=new Gt({now:this._now,getAttemptElapsedSecondsHook:this._getAttemptElapsedSecondsHook}),this.constraintValidator=new It(t,this.treeQueries),this.traversalService=new ai(t,this.ruleEngine),this.flowHandler=new li(t,this.traversalService),this.choiceHandler=new fi(t,this.constraintValidator,this.traversalService,this.treeQueries),this.exitHandler=new mi(t,this.ruleEngine),this.retryHandler=new gi(t,this.traversalService)}return t=e,i=[{key:"now",get:function(){return this._now},set:function(e){this._now=e,At.setNowProvider(e),this.ruleEngine=new Gt({now:e,getAttemptElapsedSecondsHook:this._getAttemptElapsedSecondsHook}),this.traversalService=new ai(this.activityTree,this.ruleEngine),this.flowHandler=new li(this.activityTree,this.traversalService),this.choiceHandler=new fi(this.activityTree,this.constraintValidator,this.traversalService,this.treeQueries),this.retryHandler=new gi(this.activityTree,this.traversalService)}},{key:"getAttemptElapsedSecondsHook",get:function(){return this._getAttemptElapsedSecondsHook},set:function(e){this._getAttemptElapsedSecondsHook=e,At.setElapsedSecondsHook(e),this.ruleEngine=new Gt({now:this._now,getAttemptElapsedSecondsHook:e}),this.traversalService=new ai(this.activityTree,this.ruleEngine),this.flowHandler=new li(this.activityTree,this.traversalService),this.choiceHandler=new fi(this.activityTree,this.constraintValidator,this.traversalService,this.treeQueries),this.retryHandler=new gi(this.activityTree,this.traversalService)}},{key:"sequencingRequestProcess",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=this.activityTree.currentActivity;switch(request){case qt.START:return this.flowHandler.handleStart();case qt.RESUME_ALL:return this.flowHandler.handleResumeAll();case qt.CONTINUE:return t?this.flowHandler.handleContinue(t):new zt(Lt.DO_NOT_DELIVER,null,"SB.2.12-1");case qt.PREVIOUS:return t?this.flowHandler.handlePrevious(t):new zt(Lt.DO_NOT_DELIVER,null,"SB.2.12-1");case qt.CHOICE:return e?this.choiceHandler.handleChoice(e,t):new zt(Lt.DO_NOT_DELIVER,null,"SB.2.12-5");case qt.JUMP:return e?this.choiceHandler.handleJump(e):new zt(Lt.DO_NOT_DELIVER,null,"SB.2.12-5");case qt.EXIT:return t?this.exitHandler.handleExit(t):new zt(Lt.DO_NOT_DELIVER,null,"SB.2.12-1");case qt.EXIT_ALL:return t?this.exitHandler.handleExitAll():new zt(Lt.DO_NOT_DELIVER,null,"SB.2.12-1");case qt.ABANDON:return t?this.exitHandler.handleAbandon(t):new zt(Lt.DO_NOT_DELIVER,null,"SB.2.12-1");case qt.ABANDON_ALL:return t?this.exitHandler.handleAbandonAll():new zt(Lt.DO_NOT_DELIVER,null,"SB.2.12-1");case qt.SUSPEND_ALL:return t?this.exitHandler.handleSuspendAll(t):new zt(Lt.DO_NOT_DELIVER,null,"SB.2.12-1");case qt.RETRY:return t?this.retryHandler.handleRetry(t):new zt(Lt.DO_NOT_DELIVER,null,"SB.2.12-1");case qt.RETRY_ALL:return this.retryHandler.handleRetryAll();default:return new zt(Lt.DO_NOT_DELIVER,null,"SB.2.12-6")}}},{key:"evaluatePostConditionRules",value:function(e){return this.ruleEngine.evaluatePostConditions(e)}},{key:"canActivityBeDelivered",value:function(e){return this.traversalService.canDeliver(e)}},{key:"validateNavigationRequest",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!Object.values(qt).includes(request))return{valid:!1,exception:"SB.2.12-6"};switch(request){case qt.CONTINUE:case qt.PREVIOUS:if(!t)return{valid:!1,exception:"SB.2.12-1"};if(t.isActive)return{valid:!1,exception:request===qt.CONTINUE?"SB.2.7-1":"SB.2.8-1"};if(t.parent&&!t.parent.sequencingControls.flow)return{valid:!1,exception:request===qt.CONTINUE?"SB.2.7-2":"SB.2.8-2"};if(request===qt.PREVIOUS){var i=this.constraintValidator.checkForwardOnlyViolation(t);if(!i.valid)return i}break;case qt.CHOICE:if(!e)return{valid:!1,exception:"SB.2.12-5"};var n=this.activityTree.getActivity(e);if(!n)return{valid:!1,exception:"SB.2.9-1"};var r=this.constraintValidator.validateChoice(t,n,{checkAvailability:!0});if(!r.valid)return r;if(!this.traversalService.canDeliver(n))return{valid:!1,exception:"SB.2.9-6"};if(this.ruleEngine.checkSequencingRules(n,n.sequencingRules.preConditionRules)===Ct.HIDE_FROM_CHOICE)return{valid:!1,exception:"SB.2.9-4"};break;case qt.JUMP:if(!e)return{valid:!1,exception:"SB.2.12-5"};if(!this.activityTree.getActivity(e))return{valid:!1,exception:"SB.2.13-1"}}return{valid:!0,exception:null}}},{key:"getAvailableChoices",value:function(){return this.choiceHandler.getAvailableChoices()}},{key:"getTreeQueries",value:function(){return this.treeQueries}},{key:"getConstraintValidator",value:function(){return this.constraintValidator}},{key:"getRuleEngine",value:function(){return this.ruleEngine}},{key:"getTraversalService",value:function(){return this.traversalService}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function wi(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Oi=Object.defineProperty,Ci=function(e,t,i){return function(e,t,i){return t in e?Oi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Ei=function(){function e(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ci(this,"eventService"),Ci(this,"loggingService"),Ci(this,"callbacks"),Ci(this,"currentDeliveredActivity",null),Ci(this,"pendingDelivery",null),this.eventService=t,this.loggingService=i,this.callbacks=n}return t=e,i=[{key:"processSequencingResult",value:function(result){var e,t,i,n;if(result.exception)return this.loggingService.error("Sequencing error: ".concat(result.exception)),void(null===(i=(n=this.callbacks).onSequencingError)||void 0===i||i.call(n,result.exception));result.deliveryRequest===Lt.DELIVER&&result.targetActivity?this.deliverActivity(result.targetActivity):this.loggingService.info("Sequencing completed with no delivery request"),null===(e=(t=this.callbacks).onSequencingComplete)||void 0===e||e.call(t,result)}},{key:"deliverActivity",value:function(e){var t,i;this.currentDeliveredActivity!==e?(this.currentDeliveredActivity&&this.unloadActivity(this.currentDeliveredActivity),this.pendingDelivery=e,this.loggingService.info("Delivering activity: ".concat(e.id," - ").concat(e.title)),this.eventService.processListeners("ActivityDelivery",e.id,e),null===(t=(i=this.callbacks).onDeliverActivity)||void 0===t||t.call(i,e),this.currentDeliveredActivity=e,this.pendingDelivery=null,e.isActive=!0):this.loggingService.info("Skipping delivery - activity already delivered: ".concat(e.id))}},{key:"unloadActivity",value:function(e){var t,i;this.loggingService.info("Unloading activity: ".concat(e.id," - ").concat(e.title)),this.eventService.processListeners("ActivityUnload",e.id,e),null===(t=(i=this.callbacks).onUnloadActivity)||void 0===t||t.call(i,e),e.isActive=!1}},{key:"getCurrentDeliveredActivity",value:function(){return this.currentDeliveredActivity}},{key:"getPendingDelivery",value:function(){return this.pendingDelivery}},{key:"updateCallbacks",value:function(e){this.callbacks=function(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){wi(e,t,i[t])})}return e}({},this.callbacks,e)}},{key:"reset",value:function(){this.currentDeliveredActivity&&this.unloadActivity(this.currentDeliveredActivity),this.currentDeliveredActivity=null,this.pendingDelivery=null}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Ai(e,t,i,n,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(n,r)}function ki(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){Ai(o,n,r,a,s,"next",e)}function s(e){Ai(o,n,r,a,s,"throw",e)}a(void 0)})}}function ji(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ri(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Mi(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){ji(e,t,i[t])})}return e}function Ti(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:c(0)}),s(a,"throw",{value:c(1)}),s(a,"return",{value:c(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function c(s){return function(c){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}var xi=Object.defineProperty,Ii=function(e,t,i){return function(e,t,i){return t in e?xi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Pi=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ii(this,"reportsRequestCompletion",!0),Ii(this,"settings"),Ii(this,"error_codes"),this.settings=t,this.error_codes=i}return t=e,i=[{key:"processHttpRequest",value:function(e,t){return this._performAsyncRequest(e,t,arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3?arguments[3]:void 0,arguments.length>4?arguments[4]:void 0,arguments.length>5?arguments[5]:void 0,arguments.length>6?arguments[6]:void 0),{result:V,errorCode:0}}},{key:"_performAsyncRequest",value:function(e,t,i,n,r,o,a){return ki(function(){var s,c,l,result,u,d;return Ti(this,function(f){switch(f.label){case 0:return f.trys.push([0,6,7,8]),s=void 0===o?this.settings.requestHandler(t):this.settings.requestHandler(t,o),c=s,i&&"never"!==this.settings.asyncModeBeaconBehavior?[4,this.performBeacon(e,c)]:[3,2];case 1:return l=f.sent(),[3,4];case 2:return[4,this.performFetch(e,c)];case 3:l=f.sent(),f.label=4;case 4:return[4,this.transformResponse(l,r)];case 5:return result=f.sent(),this._isSuccessResponse(l,result)?r("CommitSuccess"):r("CommitError",void 0,result.errorCode),[3,8];case 6:return u=f.sent(),d=Ri(u,Error)?u.message:u+"",n("processHttpRequest","Async request failed: ".concat(d),je.ERROR),r("CommitError",void 0,this.error_codes.GENERAL_COMMIT_FAILURE||391),[3,8];case 7:return null==a||a(),[7];case 8:return[2]}})}).call(this)}},{key:"_prepareRequestBody",value:function(e){return{body:Ri(e,Array)?e.join("&"):JSON.stringify(e),contentType:Ri(e,Array)?"application/x-www-form-urlencoded":this.settings.commitRequestDataType}}},{key:"performFetch",value:function(e,t){return ki(function(){var i,n,r;return Ti(this,function(o){return"always"===this.settings.asyncModeBeaconBehavior?[2,this.performBeacon(e,t)]:(i=this._prepareRequestBody(t),n=i.contentType,r={method:"POST",mode:this.settings.fetchMode,body:i.body,headers:(a=Mi({},this.settings.xhrHeaders),s={"Content-Type":n},s=null!=s?s:{},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(s)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(s)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(s,e))}),a),keepalive:!0},this.settings.xhrWithCredentials&&(r.credentials="include"),[2,fetch(e,r)]);var a,s})}).call(this)}},{key:"performBeacon",value:function(e,t){return ki(function(){var i,n,r,o,a,s;return Ti(this,function(c){return i=this,n=this._prepareRequestBody(t),r=n.body,o=n.contentType,this._warnIfBeaconContentTypeUnsafe(e,a=Array.isArray(t)?o:this.settings.terminationCommitContentType),s=navigator.sendBeacon(e,new Blob([r],{type:a})),[2,Promise.resolve({status:s?200:0,ok:s,json:function(){return ki(function(){return Ti(this,function(e){return[2,{result:s?"true":"false",errorCode:s?0:this.error_codes.GENERAL_COMMIT_FAILURE||391}]})}).call(i)},text:function(){return ki(function(){return Ti(this,function(e){return[2,JSON.stringify({result:s?"true":"false",errorCode:s?0:this.error_codes.GENERAL_COMMIT_FAILURE||391})]})}).call(i)}})]})}).call(this)}},{key:"_warnIfBeaconContentTypeUnsafe",value:function(e,t){var i,n;a(e)&&!o(t)&&(null===(i=(n=this.settings).onLogMessage)||void 0===i||i.call(n,je.WARN,'sendBeacon to cross-origin URL with non-CORS-safelisted Content-Type "'.concat(t,'" may be silently dropped by the browser (Beacon cannot preflight). Use fetch (useAsynchronousCommits + asyncModeBeaconBehavior:"never") for cross-origin JSON/auth on terminate.')))}},{key:"transformResponse",value:function(e,t){return ki(function(){var result,t,i,n;return Ti(this,function(r){switch(r.label){case 0:return r.trys.push([0,5,,7]),"function"!=typeof this.settings.responseHandler?[3,2]:[4,this.settings.responseHandler(e)];case 1:return t=r.sent(),[3,4];case 2:return[4,e.json()];case 3:t=r.sent(),r.label=4;case 4:return result=t,[3,7];case 5:return i=r.sent(),[4,e.text().catch(function(){return"Unable to read response text"})];case 6:return n=r.sent(),[2,{result:H,errorCode:this.error_codes.GENERAL_COMMIT_FAILURE||391,errorMessage:"Failed to parse LMS response: ".concat(Ri(i,Error)?i.message:i+""),errorDetails:JSON.stringify({status:e.status,statusText:e.statusText,url:e.url,responseText:n.substring(0,500),parseError:Ri(i,Error)?i.message:i+""})}];case 7:return Object.hasOwnProperty.call(result,"errorCode")||(result.errorCode=this._isSuccessResponse(e,result)?0:this.error_codes.GENERAL_COMMIT_FAILURE||391),this._isSuccessResponse(e,result)||(result.errorDetails=Mi({status:e.status,statusText:e.statusText,url:e.url},result.errorDetails)),[2,result]}})}).call(this)}},{key:"_isSuccessResponse",value:function(e,result){var t=result.result;return!(200>e.status||e.status>299||!0!==t&&"true"!==t&&t!==V)}},{key:"updateSettings",value:function(e){this.settings=e}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Ni(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var Di=Object.defineProperty,qi="{target=";function Li(e,t){var i,n=e[t];return void 0===n?(void 0!==console&&console.warn&&console.warn("CMIValueAccessService: Unknown error code key: ".concat(t)),null!==(i=e.GENERAL)&&void 0!==i?i:0):n}var zi=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?Di(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="context")?i+"":i,n),this.context=t}return t=e,(i=[{key:"getUndefinedDataModelErrorCode",value:function(){return Li(this.context.errorCodes,"UNDEFINED_DATA_MODEL")}},{key:"setCMIValue",value:function(e,t,i,n){if(!i||""===i)return t&&this.context.throwSCORMError(i,Li(this.context.errorCodes,"GENERAL_SET_FAILURE"),"The data model element was not specified"),H;this.context.setLastErrorCode("0");for(var r=i.split("."),o=this.context.getDataModel(),a=H,s=!1,c="The data model element passed to ".concat(e," (").concat(i,") is not a valid SCORM data model element."),l=this.getUndefinedDataModelErrorCode(),u=0;r.length>u;u++){if(u===r.length-1){a=this.setFinalAttribute(o,r[u],n,i,t,l,c);break}var d=this.traverseToNextLevel(o,r,u,n,i,t,s,l,c);if(d.error)break;o=d.refObject,u=d.idx,s=d.foundFirstIndex}return a===H&&this.context.apiLog(e,"There was an error setting the value for: ".concat(i,", value of: ").concat(n),je.WARN),a}},{key:"getCMIValue",value:function(e,t,i){if(!i||""===i)return t&&this.context.throwSCORMError(i,Li(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element was not specified"),"";if(t&&i.endsWith("._version")&&"cmi._version"!==i)return this.context.throwSCORMError(i,Li(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The _version keyword was used incorrectly"),"";this.context.setLastErrorCode("0");for(var n=i.split("."),r=this.context.getDataModel(),o=null,a="The data model element passed to ".concat(e," (").concat(i,") has not been initialized."),s="The data model element passed to ".concat(e," (").concat(i,") is not a valid SCORM data model element."),c=this.getUndefinedDataModelErrorCode(),l=0;n.length>l;l++){var u=this.validateGetAttribute(r,o=n[l],i,t,c,s,l===n.length-1);if(void 0!==u.returnValue)return u.returnValue;if(u.error)return"";if(null==o){this.context.throwSCORMError(i,c,s);break}if(void 0===(r=r[o])){this.context.throwSCORMError(i,c,s);break}if(Ni(r,ge)){var d=this.handleGetArrayAccess(r,n,l,i,a);if(d.error)return"";r=d.refObject,l=d.idx}}return null==r?(t||("_children"===o?this.context.throwSCORMError(i,Li(this.context.errorCodes,"CHILDREN_ERROR"),void 0):"_count"===o&&this.context.throwSCORMError(i,Li(this.context.errorCodes,"COUNT_ERROR"),void 0)),""):r}},{key:"setFinalAttribute",value:function(e,t,i,n,r,o,a){return r&&(null==t?void 0:t.startsWith(qi))?this.context.isInitialized()?(this.context.throwSCORMError(n,Li(this.context.errorCodes,"READ_ONLY_ELEMENT")),H):V:void 0!==t&&this.context.checkObjectHasProperty(e,t)?m(n,"\\.correct_responses\\.\\d+$")&&this.context.isInitialized()&&"pattern"!==t&&(this.context.validateCorrectResponse(n,i),"0"!==this.context.getLastErrorCode())?(this.context.throwSCORMError(n,Li(this.context.errorCodes,"TYPE_MISMATCH")),H):r&&"0"!==this.context.getLastErrorCode()?H:void 0===t||"__proto__"===t||"constructor"===t?(this.context.throwSCORMError(n,o,a),H):r&&"id"===t&&this.context.isInitialized()&&this.context.checkForDuplicateId(n,i)?(this.context.throwSCORMError(n,Li(this.context.errorCodes,"GENERAL_SET_FAILURE")),H):(e[t]=i,V):(this.context.throwSCORMError(n,o,a),H)}},{key:"traverseToNextLevel",value:function(e,t,i,n,r,o,a,s,c){var l=t[i];if(void 0===l||!this.context.checkObjectHasProperty(e,l))return this.context.throwSCORMError(r,s,c),{refObject:e,idx:i,foundFirstIndex:a,error:!0};if(!(e=e[l]))return this.context.throwSCORMError(r,s,c),{refObject:e,idx:i,foundFirstIndex:a,error:!0};if(Ni(e,ge)){var u=this.handleSetArrayAccess(e,t,i,n,r,o,a,s,c);return u.error?{refObject:e,idx:i,foundFirstIndex:a,error:!0}:u}return{refObject:e,idx:i,foundFirstIndex:a,error:!1}}},{key:"handleSetArrayAccess",value:function(e,t,i,n,r,o,a,s,c){var l=parseInt(t[i+1]||"0",10);if(!isNaN(l)){var u=e.childArray[l];if(u)return{refObject:u,idx:i+1,foundFirstIndex:!0,error:!1};if(l>e.childArray.length){var d=o?Li(this.context.errorCodes,"GENERAL_SET_FAILURE"):Li(this.context.errorCodes,"INVALID_SET_VALUE")||Li(this.context.errorCodes,"GENERAL_SET_FAILURE");return this.context.throwSCORMError(r,d,"Cannot set array element at index ".concat(l,". Array indices must be sequential. Current array length is ").concat(e.childArray.length,", expected index ").concat(e.childArray.length,".")),{refObject:e,idx:i,foundFirstIndex:a,error:!0}}var f=this.context.getChildElement(r,n,a);return f?(e.initialized&&f.initialize(),e.childArray[l]=f,{refObject:f,idx:i+1,foundFirstIndex:!0,error:!1}):("0"===this.context.getLastErrorCode()&&this.context.throwSCORMError(r,s,c),{refObject:e,idx:i,foundFirstIndex:a,error:!0})}return{refObject:e,idx:i,foundFirstIndex:a,error:!1}}},{key:"validateGetAttribute",value:function(e,t,i,n,r,o,a){if(n){var s=t+"";if(s.startsWith(qi)&&"function"==typeof e._isTargetValid){var c=s.substring(8,s.length-1);return{error:!1,returnValue:e._isTargetValid(c)}}if(void 0===t||!this.context.checkObjectHasProperty(e,t))return"_children"===t?(this.context.throwSCORMError(i,Li(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element does not have children"),{error:!0}):"_count"===t?(this.context.throwSCORMError(i,Li(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element is not a collection and therefore does not have a count"),{error:!0}):(this.context.throwSCORMError(i,r,o),{error:!0})}else if(a&&(void 0===t||!this.context.checkObjectHasProperty(e,t)))return"_children"===t?this.context.throwSCORMError(i,Li(this.context.errorCodes,"CHILDREN_ERROR")):"_count"===t?this.context.throwSCORMError(i,Li(this.context.errorCodes,"COUNT_ERROR")):this.context.throwSCORMError(i,r,o),{error:!0};return{error:!1}}},{key:"handleGetArrayAccess",value:function(e,t,i,n,r){var o=parseInt(t[i+1]||"",10);if(!isNaN(o)){var a=e.childArray[o];return a?{refObject:a,idx:i+1,error:!1}:(this.context.throwSCORMError(n,Li(this.context.errorCodes,"VALUE_NOT_INITIALIZED"),r),{refObject:e,idx:i,error:!0})}return{refObject:e,idx:i,error:!1}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Fi(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var Bi=Object.defineProperty,Vi=function(e,t,i){return function(e,t,i){return t in e?Bi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Hi=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Vi(this,"_logLevel",je.ERROR),Vi(this,"_logHandler"),this._logHandler=Te}var t,i,n;return t=e,n=[{key:"getInstance",value:function(){return e._instance||(e._instance=new e),e._instance}}],(i=[{key:"setLogLevel",value:function(e){this._logLevel=e}},{key:"getLogLevel",value:function(){return this._logLevel}},{key:"setLogHandler",value:function(e){this._logHandler=e}},{key:"log",value:function(e,t){this.shouldLog(e)&&this._logHandler(e,t)}},{key:"error",value:function(e){this.log(je.ERROR,e)}},{key:"warn",value:function(e){this.log(je.WARN,e)}},{key:"info",value:function(e){this.log(je.INFO,e)}},{key:"debug",value:function(e){this.log(je.DEBUG,e)}},{key:"shouldLog",value:function(e){return this.getNumericLevel(e)>=this.getNumericLevel(this._logLevel)}},{key:"getNumericLevel",value:function(e){if(void 0===e)return je.NONE;if("number"==typeof e)return e;switch("string"==typeof e?e.toUpperCase():e){case"1":case"DEBUG":return je.DEBUG;case"2":case"INFO":return je.INFO;case"3":case"WARN":return je.WARN;case"4":case"ERROR":default:return je.ERROR;case"5":case"NONE":return je.NONE}}}])&&Fi(t.prototype,i),n&&Fi(t,n),e}();Vi(Hi,"_instance");var Ui=Hi;function Gi(){return Ui.getInstance()}function Ki(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var Yi=Object.defineProperty,Wi=function(e,t,i){return function(e,t,i){return t in e?Yi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Ji=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Wi(this,"_lastErrorCode","0"),Wi(this,"_lastDiagnostic",""),Wi(this,"_errorCodes"),Wi(this,"_apiLog"),Wi(this,"_getLmsErrorMessageDetails"),Wi(this,"_loggingService"),this._errorCodes=t,this._apiLog=i,this._getLmsErrorMessageDetails=n,this._loggingService=r||Gi()}return t=e,i=[{key:"lastErrorCode",get:function(){return this._lastErrorCode},set:function(e){this._lastErrorCode=e}},{key:"lastDiagnostic",get:function(){return this._lastDiagnostic}},{key:"throwSCORMError",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:je.ERROR;this._lastDiagnostic=i||"",i||(i=this._getLmsErrorMessageDetails(t,!0));var r="SCORM Error ".concat(t,": ").concat(i).concat(e?" [Element: ".concat(e,"]"):"");this._apiLog("throwSCORMError",t+": "+i,n,e),this._loggingService.log(n,r),this._lastErrorCode=t+""}},{key:"clearSCORMError",value:function(e){void 0!==e&&e!==H&&(this._lastErrorCode="0")}},{key:"handleValueAccessException",value:function(e,t,i){if(Ki(t,B)){var n=t;this._lastErrorCode=n.errorCode+"",this._lastDiagnostic="";var r="Validation Error ".concat(n.errorCode,": ").concat(n.message," [Element: ").concat(e,"]");this._loggingService.warn(r),i=H}else if(Ki(t,Error)){var o=t.constructor.name,a="".concat(o,": ").concat(t.message," [Element: ").concat(e,"]"),s=t.stack||"";this._loggingService.error("".concat(a,"\n").concat(s)),this.throwSCORMError(e,this._errorCodes.GENERAL,"".concat(o,": ").concat(t.message)),i=H}else{this._loggingService.error("Unknown error occurred while accessing [Element: ".concat(e,"]"));try{var c=JSON.stringify(t);this._loggingService.error("Error details: ".concat(c))}catch(e){this._loggingService.error("Could not stringify error object for details")}this.throwSCORMError(e,this._errorCodes.GENERAL,"Unknown error"),i=H}return i}},{key:"errorCodes",get:function(){return this._errorCodes}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var $i=Object.defineProperty,Xi=function(e,t,i){return function(e,t,i){return t in e?$i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Qi=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Xi(this,"listenerMap",new Map),Xi(this,"listenerCount",0),Xi(this,"apiLog"),this.apiLog=t}return t=e,(i=[{key:"parseListenerName",value:function(e){if(!e)return null;var t=e.split("."),i=t[0],n=null;return t.length>1&&(n=e.replace("".concat(i,"."),"")),{functionName:null!=i?i:e,CMIElement:n}}},{key:"on",value:function(e,t){if(t){var i=e.split(" "),n=!0,r=!1,o=void 0;try{for(var a,s=i[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c,l=this.parseListenerName(a.value);if(l){var u=l.functionName,d=l.CMIElement,f=null!==(c=this.listenerMap.get(u))&&void 0!==c?c:[];f.push({functionName:u,CMIElement:d,callback:t}),this.listenerMap.set(u,f),this.listenerCount++,this.apiLog("on","Added event listener: ".concat(this.listenerCount),je.INFO,u)}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}}},{key:"off",value:function(e,t){if(t){var i=e.split(" "),n=!0,r=!1,o=void 0;try{for(var a,s,c=function(){var e=a.parseListenerName(s.value);if(!e)return"continue";var i=e.functionName,n=e.CMIElement,r=a.listenerMap.get(i);if(!r)return"continue";var o=r.findIndex(function(e){return e.CMIElement===n&&e.callback===t});-1!==o&&(r.splice(o,1),a.listenerCount--,0===r.length&&a.listenerMap.delete(i),a.apiLog("off","Removed event listener: ".concat(a.listenerCount),je.INFO,i))},l=i[Symbol.iterator]();!(n=(s=l.next()).done);n=!0)a=this,c()}catch(e){r=!0,o=e}finally{try{n||null==l.return||l.return()}finally{if(r)throw o}}}}},{key:"clear",value:function(e){var t=e.split(" "),i=!0,n=!1,r=void 0;try{for(var o,a,s=function(){var e=o.parseListenerName(a.value);if(!e)return"continue";var t=e.functionName,i=e.CMIElement;if(o.listenerMap.has(t)){var n=o.listenerMap.get(t),r=null===i?[]:n.filter(function(e){return e.CMIElement!==i});o.listenerCount-=n.length-r.length,0===r.length?o.listenerMap.delete(t):o.listenerMap.set(t,r)}},c=t[Symbol.iterator]();!(i=(a=c.next()).done);i=!0)o=this,s()}catch(e){n=!0,r=e}finally{try{i||null==c.return||c.return()}finally{if(n)throw r}}}},{key:"processListeners",value:function(e,t,i,n){this.apiLog(e,i,je.INFO,t);var r=this.listenerMap.get(e);if(r){var o=!0,a=!1,s=void 0;try{for(var c,l=r[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value,d=!!u.CMIElement,f=!1;if(t&&u.CMIElement)if(u.CMIElement.endsWith("*")){var v=u.CMIElement.slice(0,-1);f=t.startsWith(v)}else f=u.CMIElement===t;d&&!f||(this.apiLog("processListeners","Processing listener: ".concat(u.functionName),je.DEBUG,t),e.startsWith("Sequence")?u.callback(i):"CommitError"===e?void 0!==n?u.callback(i,n):u.callback(i):"CommitSuccess"===e?void 0!==n?u.callback(n):u.callback():u.callback(t,i))}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}}}},{key:"reset",value:function(){this.listenerMap.clear(),this.listenerCount=0}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Zi(e,t,i,n,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(n,r)}function en(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){Zi(o,n,r,a,s,"next",e)}function s(e){Zi(o,n,r,a,s,"throw",e)}a(void 0)})}}function tn(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function nn(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function rn(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){tn(e,t,i[t])})}return e}function an(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:c(0)}),s(a,"throw",{value:c(1)}),s(a,"return",{value:c(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function c(s){return function(c){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}var sn=Object.defineProperty,cn=function(e,t,i){return function(e,t,i){return t in e?sn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ln=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),cn(this,"apiLog",n),cn(this,"settings"),cn(this,"error_codes"),cn(this,"storeName","scorm_again_offline_data"),cn(this,"syncQueue","scorm_again_sync_queue"),cn(this,"isOnline",navigator.onLine),cn(this,"syncInProgress",!1),cn(this,"boundOnlineStatusChangeHandler"),cn(this,"boundCustomNetworkStatusHandler"),this.settings=t,this.error_codes=i,this.boundOnlineStatusChangeHandler=this.handleOnlineStatusChange.bind(this),this.boundCustomNetworkStatusHandler=this.handleCustomNetworkStatus.bind(this),window.addEventListener("online",this.boundOnlineStatusChangeHandler),window.addEventListener("offline",this.boundOnlineStatusChangeHandler),window.addEventListener("scorm-again:network-status",this.boundCustomNetworkStatusHandler)}return t=e,(i=[{key:"handleOnlineStatusChange",value:function(){var e=this,t=this.isOnline;this.isOnline=navigator.onLine,!t&&this.isOnline?(this.apiLog("OfflineStorageService","Device is back online, attempting to sync...",je.INFO),this.syncOfflineData().then(function(t){t?e.apiLog("OfflineStorageService","Sync completed successfully",je.INFO):e.apiLog("OfflineStorageService","Sync failed",je.ERROR)},function(t){e.apiLog("OfflineStorageService","Error during sync: ".concat(t),je.ERROR)})):t&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",je.INFO)}},{key:"handleCustomNetworkStatus",value:function(e){var t=this;if(nn(e,CustomEvent)){var i=e.detail.online;if("boolean"==typeof i){var n=this.isOnline;this.isOnline=i,this.apiLog("OfflineStorageService","Network status updated via custom event: ".concat(i?"online":"offline"),je.INFO),!n&&this.isOnline?(this.apiLog("OfflineStorageService","Device is back online, attempting to sync...",je.INFO),this.syncOfflineData().then(function(e){e?t.apiLog("OfflineStorageService","Sync completed successfully",je.INFO):t.apiLog("OfflineStorageService","Sync failed",je.ERROR)},function(e){t.apiLog("OfflineStorageService","Error during sync: ".concat(e),je.ERROR)})):n&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",je.INFO)}else this.apiLog("OfflineStorageService","Invalid online status value in custom event",je.WARN)}else this.apiLog("OfflineStorageService","Invalid network status event received",je.WARN)}},{key:"storeOffline",value:function(e,t,i){try{var n=rn({id:"".concat(e,"_").concat(Date.now(),"_").concat(Math.random().toString(36).substring(2,9)),courseId:e,timestamp:Date.now(),data:t,syncAttempts:0},void 0!==(null==i?void 0:i.isTerminateCommit)?{isTerminateCommit:i.isTerminateCommit}:{},void 0!==(null==i?void 0:i.sequence)?{sequence:i.sequence}:{}),r=this.getFromStorage(this.syncQueue)||[];return r.push(n),this.saveToStorage(this.syncQueue,r),this.saveToStorage("".concat(this.storeName,"_").concat(e),t),this.apiLog("OfflineStorageService","Stored data offline for course ".concat(e),je.INFO),{result:V,errorCode:0}}catch(t){var o,a=(nn(t,Error)?t.message:t+"").includes("storage quota");return this.apiLog("OfflineStorageService",a?"storage quota exceeded - cannot store offline data for course ".concat(e):"Error storing offline data: ".concat(t),je.ERROR),{result:H,errorCode:null!==(o=this.error_codes.GENERAL)&&void 0!==o?o:0}}}},{key:"getOfflineData",value:function(e){return en(function(){return an(this,function(t){try{return[2,this.getFromStorage("".concat(this.storeName,"_").concat(e))||null]}catch(e){return this.apiLog("OfflineStorageService","Error retrieving offline data: ".concat(e),je.ERROR),[2,null]}return[2]})}).call(this)}},{key:"syncOfflineData",value:function(){return en(function(){var e,t,i,n,r,o,a,s,c,l,u,d,f,v;return an(this,function(h){switch(h.label){case 0:if(this.syncInProgress||!this.isOnline)return[2,!1];this.syncInProgress=!0,h.label=1;case 1:if(h.trys.push([1,12,,13]),0===(e=this.getFromStorage(this.syncQueue)||[]).length)return this.syncInProgress=!1,[2,!0];this.apiLog("OfflineStorageService","Found ".concat(e.length," items to sync"),je.INFO),t=[],i=!0,n=!1,r=void 0,h.label=2;case 2:h.trys.push([2,9,10,11]),o=e[Symbol.iterator](),h.label=3;case 3:if(i=(a=o.next()).done)return[3,8];if(l=null!==(c=this.settings.maxSyncAttempts)&&void 0!==c?c:5,(s=a.value).syncAttempts>=l)return this.apiLog("OfflineStorageService","Removing abandoned item ".concat(s.id," after ").concat(l," failed sync attempts"),je.WARN),[3,7];h.label=4;case 4:return h.trys.push([4,6,,7]),[4,this.sendDataToLMS(s.data,rn({},void 0!==s.isTerminateCommit?{isTerminateCommit:s.isTerminateCommit}:{},void 0!==s.sequence?{sequence:s.sequence}:{}))];case 5:return!0===(u=h.sent()).result||u.result===V?this.apiLog("OfflineStorageService","Successfully synced item ".concat(s.id),je.INFO):(s.syncAttempts++,t.push(s),this.apiLog("OfflineStorageService","Failed to sync item ".concat(s.id,", attempt #").concat(s.syncAttempts),je.WARN)),[3,7];case 6:return d=h.sent(),s.syncAttempts++,t.push(s),this.apiLog("OfflineStorageService","Error syncing item ".concat(s.id,": ").concat(d),je.ERROR),[3,7];case 7:return i=!0,[3,3];case 8:return[3,11];case 9:return f=h.sent(),n=!0,r=f,[3,11];case 10:try{i||null==o.return||o.return()}finally{if(n)throw r}return[7];case 11:return this.saveToStorage(this.syncQueue,t),this.apiLog("OfflineStorageService","Sync completed. ".concat(e.length-t.length," items synced, ").concat(t.length," items remaining"),je.INFO),this.syncInProgress=!1,[2,!0];case 12:return v=h.sent(),this.apiLog("OfflineStorageService","Error during sync process: ".concat(v),je.ERROR),this.syncInProgress=!1,[2,!1];case 13:return[2]}})}).call(this)}},{key:"sendDataToLMS",value:function(e,t){return en(function(){var i,n,r,o,a,s,c,result,l,u;return an(this,function(d){switch(d.label){case 0:if(!(i=this.settings.lmsCommitUrl))return[2,{result:H,errorCode:this.error_codes.GENERAL||101}];d.label=1;case 1:return d.trys.push([1,7,,8]),r=i+"",o=this.settings.requestHandler(e,rn({isTerminateCommit:null!==(n=null==t?void 0:t.isTerminateCommit)&&void 0!==n&&n,trigger:"offline-replay"},void 0!==(null==t?void 0:t.sequence)?{sequence:t.sequence}:{})),a=(null==t?void 0:t.isTerminateCommit)&&this.settings.terminateCommitParam?y(r,this.settings.terminateCommitParam,"true"):r,s={method:"POST",mode:this.settings.fetchMode,body:JSON.stringify(o),headers:(f=rn({},this.settings.xhrHeaders),v={"Content-Type":this.settings.commitRequestDataType},v=null!=v?v:{},Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(v)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(v)).forEach(function(e){Object.defineProperty(f,e,Object.getOwnPropertyDescriptor(v,e))}),f)},this.settings.xhrWithCredentials&&(s.credentials="include"),[4,fetch(a,s)];case 2:return c=d.sent(),"function"!=typeof this.settings.responseHandler?[3,4]:[4,this.settings.responseHandler(c)];case 3:return l=d.sent(),[3,6];case 4:return[4,c.json()];case 5:l=d.sent(),d.label=6;case 6:return result=l,200>c.status||c.status>299||!0!==result.result&&result.result!==V?(Object.hasOwnProperty.call(result,"errorCode")||(result.errorCode=this.error_codes.GENERAL),[2,result]):(Object.hasOwnProperty.call(result,"errorCode")||(result.errorCode=0),[2,result]);case 7:return u=d.sent(),this.apiLog("OfflineStorageService","Error sending data to LMS: ".concat(u),je.ERROR),[2,{result:H,errorCode:this.error_codes.GENERAL||101}];case 8:return[2]}var f,v})}).call(this)}},{key:"isDeviceOnline",value:function(){return this.isOnline}},{key:"getFromStorage",value:function(e){var t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){return null}return null}},{key:"saveToStorage",value:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){if(nn(e,DOMException)&&"QuotaExceededError"===e.name)throw Error("storage quota exceeded - localStorage is full",{cause:e});throw e}}},{key:"hasPendingOfflineData",value:function(e){return en(function(){return an(this,function(t){return[2,(this.getFromStorage(this.syncQueue)||[]).some(function(t){return t.courseId===e})]})}).call(this)}},{key:"updateSettings",value:function(e){this.settings=e}},{key:"destroy",value:function(){window.removeEventListener("online",this.boundOnlineStatusChangeHandler),window.removeEventListener("offline",this.boundOnlineStatusChangeHandler),window.removeEventListener("scorm-again:network-status",this.boundCustomNetworkStatusHandler)}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}(),un=p(function(e,t,i,n,r,o){if("string"!=typeof t)return!1;var a=RegExp(i),s=t.match(a);if(o&&""===t)return!0;if(!s||""===s[0])throw new r(e,n);return!0},function(e,t,i,n,r,o){var a,s="string"==typeof t?t:"[".concat(void 0===t?"undefined":(a=t)&&"undefined"!=typeof Symbol&&a.constructor===Symbol?"symbol":typeof a,"]");return"".concat(e,":").concat(s,":").concat(i,":").concat(n,":").concat(o||!1)},{maxEntries:1e3,maxKeyLength:2e3}),dn=p(function(e,t,i,n,r){var o=i.split("#");if(isNaN(t=+t))throw new r(e,n);var a=o[0],s=o[1],c=void 0!==s&&""!==s&&"*"!==s;if(void 0!==a&&""!==a&&+a>t)throw new r(e,n);if(c&&t>+s)throw new r(e,n);return!0},function(e,t,i,n,r){return"".concat(e,":").concat(t,":").concat(i,":").concat(n)},{maxEntries:1e3});function fn(e,t,i,n){return un(e,t,i,de.TYPE_MISMATCH,oe,n)}function vn(e,t,i){return dn(e,t,i,de.VALUE_OUT_OF_RANGE,oe)}function hn(e,t,i){return t=yn(t),n=e,!(r=bn()?Reflect.construct(t,i||[],yn(e).constructor):t.apply(e,i))||"object"!==wn(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function mn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pn(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function yn(e){return yn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},yn(e)}function gn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Sn(e,t)}function _n(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function bn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(bn=function(){return!!result})()}function Sn(e,t){return Sn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Sn(e,t)}function wn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var On=Object.defineProperty,Cn=function(e,t,i){return function(e,t,i){return t in e?On(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":wn(t))?t+"":t,i)},En=function(e){return e.SATISFIED="satisfied",e.NOT_SATISFIED="notSatisfied",e.COMPLETED="completed",e.INCOMPLETE="incomplete",e}(En||{}),An=function(e){return e.ALL="all",e.ANY="any",e.NONE="none",e.AT_LEAST_COUNT="atLeastCount",e.AT_LEAST_PERCENT="atLeastPercent",e}(An||{}),kn=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"always",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Map;return mn(this,t),e=hn(this,t,["rollupCondition"]),Cn(e,"_condition","always"),Cn(e,"_parameters",new Map),e._condition=i,e._parameters=n,e}return gn(t,e),pn(t,[{key:"reset",value:function(){this._initialized=!1}},{key:"condition",get:function(){return this._condition},set:function(e){this._condition=e}},{key:"parameters",get:function(){return this._parameters},set:function(e){this._parameters=e}},{key:"evaluate",value:function(e){switch(this._condition){case"satisfied":return!0===e.objectiveSatisfiedStatus||e.successStatus===we;case"objectiveStatusKnown":return e.objectiveSatisfiedStatusKnown;case"objectiveMeasureKnown":return e.objectiveMeasureStatus;case"objectiveMeasureGreaterThan":var t=this._parameters.get("threshold")||0;return e.objectiveMeasureStatus&&e.objectiveNormalizedMeasure>t;case"objectiveMeasureLessThan":var i=this._parameters.get("threshold")||0;return e.objectiveMeasureStatus&&i>e.objectiveNormalizedMeasure;case"completed":return e.isCompleted;case"progressKnown":return e.completionStatus!==ke;case"attempted":return e.attemptCount>0;case"notAttempted":return 0===e.attemptCount;case"always":return!0;default:return!1}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={condition:this._condition,parameters:Object.fromEntries(this._parameters)};return this.jsonString=!1,result}}]),t}(A),jn=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"satisfied",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return mn(this,t),e=hn(this,t,["rollupRule"]),Cn(e,"_conditions",[]),Cn(e,"_action","satisfied"),Cn(e,"_consideration","all"),Cn(e,"_minimumCount",0),Cn(e,"_minimumPercent",0),e._action=i,e._consideration=n,e._minimumCount=r,e._minimumPercent=o,e}return gn(t,e),pn(t,[{key:"reset",value:function(){this._initialized=!1,this._conditions=[]}},{key:"conditions",get:function(){return this._conditions}},{key:"addCondition",value:function(e){if(!_n(e,kn))throw new oe(this._cmi_element+".conditions",de.TYPE_MISMATCH);this._conditions.push(e)}},{key:"removeCondition",value:function(e){var t=this._conditions.indexOf(e);return-1!==t&&(this._conditions.splice(t,1),!0)}},{key:"action",get:function(){return this._action},set:function(e){this._action=e}},{key:"consideration",get:function(){return this._consideration},set:function(e){this._consideration=e}},{key:"minimumCount",get:function(){return this._minimumCount},set:function(e){0>e||(this._minimumCount=e)}},{key:"minimumPercent",get:function(){return this._minimumPercent},set:function(e){0>e||e>100||(this._minimumPercent=e)}},{key:"evaluate",value:function(e){var t=this;if(0===e.length)return!1;var i=e.filter(function(e){return t._conditions.every(function(t){return t.evaluate(e)})});switch(this._consideration){case"all":return i.length===e.length;case"any":return i.length>0;case"none":return 0===i.length;case"atLeastCount":return i.length>=this._minimumCount;case"atLeastPercent":return i.length/e.length*100>=this._minimumPercent;default:return!1}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={conditions:this._conditions,action:this._action,consideration:this._consideration,minimumCount:this._minimumCount,minimumPercent:this._minimumPercent};return this.jsonString=!1,result}}]),t}(A),Rn=function(e){function t(){var e;return mn(this,t),e=hn(this,t,["rollupRules"]),Cn(e,"_rules",[]),e}return gn(t,e),pn(t,[{key:"reset",value:function(){this._initialized=!1,this._rules=[]}},{key:"rules",get:function(){return this._rules}},{key:"addRule",value:function(e){if(!_n(e,jn))throw new oe(this._cmi_element+".rules",de.TYPE_MISMATCH);this._rules.push(e)}},{key:"removeRule",value:function(e){var t=this._rules.indexOf(e);return-1!==t&&(this._rules.splice(t,1),!0)}},{key:"processRollup",value:function(e){if(e&&0!==e.children.length){var t=e.getAvailableChildren(),i=!1,n=!1;if(e.sequencingControls.rollupObjectiveSatisfied&&null!==this._objectiveRollupUsingMeasure(e,t)&&(n=!0),!n){var r=!0,o=!1,a=void 0;try{for(var s,c=this._rules[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var l=s.value;if(l.evaluate(t))switch(l.action){case"satisfied":e.successStatus=we,n=!0;break;case"notSatisfied":e.successStatus=Oe,n=!0;break;case"completed":e.completionStatus=Ee,e.isCompleted=!0,i=!0;break;case"incomplete":e.completionStatus=Ae,e.isCompleted=!1,i=!0}}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}}i||this._defaultCompletionRollup(e,t),n||this._defaultSuccessRollup(e,t)}}},{key:"_defaultCompletionRollup",value:function(e,t){t.every(function(e){return e.isCompleted})?(e.completionStatus=Ee,e.isCompleted=!0):t.some(function(e){return e.completionStatus===Ae})&&(e.completionStatus=Ae,e.isCompleted=!1)}},{key:"_objectiveRollupUsingMeasure",value:function(e,t){if(0>=e.sequencingControls.objectiveMeasureWeight)return null;var i=0,n=0,r=!1,o=!0,a=!1,s=void 0;try{for(var c,l=t[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value;if(u.sequencingControls.rollupObjectiveSatisfied&&u.objectiveMeasureStatus&&!0===u.objectiveMeasureStatus){var d=u.sequencingControls.objectiveMeasureWeight;d>0&&(n+=u.objectiveNormalizedMeasure*d,i+=d,r=!0)}}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}if(!r||0===i)return null;var f=n/i;return e.objectiveNormalizedMeasure=f,e.objectiveMeasureStatus=!0,e.scaledPassingScore>f?(e.successStatus=Oe,e.objectiveSatisfiedStatus=!1,!1):(e.successStatus=we,e.objectiveSatisfiedStatus=!0,!0)}},{key:"_defaultSuccessRollup",value:function(e,t){t.every(function(e){return e.successStatus===we})?e.successStatus=we:t.some(function(e){return e.successStatus===Oe})&&(e.successStatus=Oe)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={rules:this._rules};return this.jsonString=!1,result}}]),t}(A);function Mn(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Tn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xn(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function In(e,t,i){return t&&xn(e.prototype,t),i&&xn(e,i),e}function Pn(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Nn(e,t,i){return Nn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Dn(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Nn(e,t,i||e)}function Dn(e){return Dn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Dn(e)}function qn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(qn=function(){return!!result})()}function Ln(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Pn(e,t,i[t])})}return e}function zn(e,t){return zn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},zn(e,t)}function Fn(e){return function(e){if(Array.isArray(e))return Mn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Mn(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Mn(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Bn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Vn=Object.defineProperty,Hn=function(e,t,i){return function(e,t,i){return t in e?Vn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Bn(t))?t+"":t,i)},Un=function(){function e(id){var t,i,n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Tn(this,e),Hn(this,"_id"),Hn(this,"_description"),Hn(this,"_satisfiedByMeasure"),Hn(this,"_minNormalizedMeasure"),Hn(this,"_mapInfo"),Hn(this,"_isPrimary"),Hn(this,"_satisfiedStatus",!1),Hn(this,"_satisfiedStatusKnown",!1),Hn(this,"_measureStatus",!1),Hn(this,"_normalizedMeasure",0),Hn(this,"_rawScore",""),Hn(this,"_rawScoreKnown",!1),Hn(this,"_minScore",""),Hn(this,"_minScoreKnown",!1),Hn(this,"_maxScore",""),Hn(this,"_maxScoreKnown",!1),Hn(this,"_progressMeasure",0),Hn(this,"_progressMeasureStatus",!1),Hn(this,"_completionStatus",ke),Hn(this,"_progressStatus",!1),Hn(this,"_satisfiedStatusDirty",!1),Hn(this,"_normalizedMeasureDirty",!1),Hn(this,"_completionStatusDirty",!1),Hn(this,"_progressMeasureDirty",!1),Hn(this,"_rawScoreDirty",!1),Hn(this,"_minScoreDirty",!1),Hn(this,"_maxScoreDirty",!1),this._id=id,this._description=null!==(t=o.description)&&void 0!==t?t:null,this._satisfiedByMeasure=null!==(i=o.satisfiedByMeasure)&&void 0!==i&&i,this._minNormalizedMeasure=null!==(n=o.minNormalizedMeasure)&&void 0!==n?n:null,this._mapInfo=o.mapInfo?Fn(o.mapInfo):[],this._isPrimary=null!==(r=o.isPrimary)&&void 0!==r&&r}return In(e,[{key:"id",get:function(){return this._id}},{key:"description",get:function(){return this._description}},{key:"satisfiedByMeasure",get:function(){return this._satisfiedByMeasure},set:function(e){this._satisfiedByMeasure=e}},{key:"minNormalizedMeasure",get:function(){return this._minNormalizedMeasure},set:function(e){this._minNormalizedMeasure=e}},{key:"mapInfo",get:function(){return this._mapInfo},set:function(e){this._mapInfo=Fn(e)}},{key:"isPrimary",get:function(){return this._isPrimary},set:function(e){this._isPrimary=e}},{key:"satisfiedStatus",get:function(){return this._satisfiedStatus},set:function(e){this._satisfiedStatus!==e&&(this._satisfiedStatus=e,this._satisfiedStatusDirty=!0,this._satisfiedStatusKnown=!0,this._progressStatus=!0)}},{key:"satisfiedStatusKnown",get:function(){return this._satisfiedStatusKnown},set:function(e){this._satisfiedStatusKnown=e}},{key:"measureStatus",get:function(){return this._measureStatus},set:function(e){this._measureStatus=e}},{key:"normalizedMeasure",get:function(){return this._normalizedMeasure},set:function(e){this._normalizedMeasure!==e&&(this._normalizedMeasure=e,this._normalizedMeasureDirty=!0)}},{key:"rawScore",get:function(){return this._rawScore},set:function(e){this._rawScore!==e&&(this._rawScore=e,this._rawScoreDirty=!0),this._rawScoreKnown=""!==e}},{key:"rawScoreKnown",get:function(){return this._rawScoreKnown},set:function(e){this._rawScoreKnown=e}},{key:"minScore",get:function(){return this._minScore},set:function(e){this._minScore!==e&&(this._minScore=e,this._minScoreDirty=!0),this._minScoreKnown=""!==e}},{key:"minScoreKnown",get:function(){return this._minScoreKnown},set:function(e){this._minScoreKnown=e}},{key:"maxScore",get:function(){return this._maxScore},set:function(e){this._maxScore!==e&&(this._maxScore=e,this._maxScoreDirty=!0),this._maxScoreKnown=""!==e}},{key:"maxScoreKnown",get:function(){return this._maxScoreKnown},set:function(e){this._maxScoreKnown=e}},{key:"progressMeasure",get:function(){return this._progressMeasure},set:function(e){this._progressMeasure!==e&&(this._progressMeasure=e,this._progressMeasureDirty=!0)}},{key:"progressMeasureStatus",get:function(){return this._progressMeasureStatus},set:function(e){this._progressMeasureStatus=e}},{key:"completionStatus",get:function(){return this._completionStatus},set:function(e){this._completionStatus!==e&&(this._completionStatus=e,this._completionStatusDirty=!0)}},{key:"progressStatus",get:function(){return this._progressStatus},set:function(e){this._progressStatus=e}},{key:"isDirty",value:function(e){switch(e){case"satisfiedStatus":return this._satisfiedStatusDirty;case"normalizedMeasure":return this._normalizedMeasureDirty;case"completionStatus":return this._completionStatusDirty;case"progressMeasure":return this._progressMeasureDirty;case"rawScore":return this._rawScoreDirty;case"minScore":return this._minScoreDirty;case"maxScore":return this._maxScoreDirty}}},{key:"clearDirty",value:function(e){switch(e){case"satisfiedStatus":this._satisfiedStatusDirty=!1;break;case"normalizedMeasure":this._normalizedMeasureDirty=!1;break;case"completionStatus":this._completionStatusDirty=!1;break;case"progressMeasure":this._progressMeasureDirty=!1;break;case"rawScore":this._rawScoreDirty=!1;break;case"minScore":this._minScoreDirty=!1;break;case"maxScore":this._maxScoreDirty=!1}}},{key:"clearAllDirty",value:function(){this._satisfiedStatusDirty=!1,this._normalizedMeasureDirty=!1,this._completionStatusDirty=!1,this._progressMeasureDirty=!1,this._rawScoreDirty=!1,this._minScoreDirty=!1,this._maxScoreDirty=!1}},{key:"initializeFromCMI",value:function(e,t,i){this._satisfiedStatus=e,this._satisfiedStatusDirty=!0,this._normalizedMeasure=t,this._normalizedMeasureDirty=!0,this._measureStatus=i}},{key:"initializeScoreFromCMI",value:function(score){void 0!==score.rawScore&&""!==score.rawScore&&(this._rawScore=score.rawScore,this._rawScoreKnown=!0,this._rawScoreDirty=!0),void 0!==score.minScore&&""!==score.minScore&&(this._minScore=score.minScore,this._minScoreKnown=!0,this._minScoreDirty=!0),void 0!==score.maxScore&&""!==score.maxScore&&(this._maxScore=score.maxScore,this._maxScoreKnown=!0,this._maxScoreDirty=!0)}},{key:"applyReadMappedState",value:function(e){void 0!==e.satisfiedStatus&&(this._satisfiedStatus=e.satisfiedStatus,this._satisfiedStatusKnown=!0,this._progressStatus=!0),void 0!==e.normalizedMeasure&&(this._normalizedMeasure=e.normalizedMeasure,this._measureStatus=!0),void 0!==e.completionStatus&&(this._completionStatus=e.completionStatus),void 0!==e.progressMeasure&&(this._progressMeasure=e.progressMeasure,this._progressMeasureStatus=!0),void 0!==e.rawScore&&(this._rawScore=e.rawScore,this._rawScoreKnown=!0),void 0!==e.minScore&&(this._minScore=e.minScore,this._minScoreKnown=!0),void 0!==e.maxScore&&(this._maxScore=e.maxScore,this._maxScoreKnown=!0)}},{key:"resetState",value:function(){this._satisfiedStatus=!1,this._satisfiedStatusKnown=!1,this._measureStatus=!1,this._normalizedMeasure=0,this._rawScore="",this._rawScoreKnown=!1,this._minScore="",this._minScoreKnown=!1,this._maxScore="",this._maxScoreKnown=!1,this._progressMeasure=0,this._progressMeasureStatus=!1,this._completionStatus=ke,this._progressStatus=!1,this.clearAllDirty()}},{key:"updateFromActivity",value:function(e){this._satisfiedStatus!==e.objectiveSatisfiedStatus&&(this._satisfiedStatus=e.objectiveSatisfiedStatus,this._satisfiedStatusDirty=!0),this._satisfiedStatusKnown=e.objectiveSatisfiedStatusKnown,this._measureStatus=e.objectiveMeasureStatus,this._normalizedMeasure!==e.objectiveNormalizedMeasure&&(this._normalizedMeasure=e.objectiveNormalizedMeasure,this._normalizedMeasureDirty=!0),this._progressMeasure!==e.progressMeasure&&(this._progressMeasure=e.progressMeasure,this._progressMeasureDirty=!0),this._progressMeasureStatus=e.progressMeasureStatus,this._completionStatus!==e.completionStatus&&(this._completionStatus=e.completionStatus,this._completionStatusDirty=!0)}},{key:"applyToActivity",value:function(e){this._isPrimary&&e.setPrimaryObjectiveState(this._satisfiedStatus,this._measureStatus,this._normalizedMeasure,this._progressMeasure,this._progressMeasureStatus,this._completionStatus,this._progressStatus||this._satisfiedStatusKnown)}}]),e}(),Gn=function(e){function t(){var e,id=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return Tn(this,t),e=function(e,t,i){return t=Dn(t),n=e,!(r=qn()?Reflect.construct(t,i||[],Dn(e).constructor):t.apply(e,i))||"object"!==Bn(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["activity"]),Hn(e,"_id",""),Hn(e,"_title",""),Hn(e,"_children",[]),Hn(e,"_parent",null),Hn(e,"_isVisible",!0),Hn(e,"_isActive",!1),Hn(e,"_isSuspended",!1),Hn(e,"_isCompleted",!1),Hn(e,"_completionStatus",ke),Hn(e,"_successStatus",Ce),Hn(e,"_attemptCount",0),Hn(e,"_attemptCompletionAmount",0),Hn(e,"_attemptAbsoluteDuration","PT0H0M0S"),Hn(e,"_attemptExperiencedDuration","PT0H0M0S"),Hn(e,"_activityAbsoluteDuration","PT0H0M0S"),Hn(e,"_activityExperiencedDuration","PT0H0M0S"),Hn(e,"_attemptAbsoluteDurationValue","PT0H0M0S"),Hn(e,"_attemptExperiencedDurationValue","PT0H0M0S"),Hn(e,"_activityAbsoluteDurationValue","PT0H0M0S"),Hn(e,"_activityExperiencedDurationValue","PT0H0M0S"),Hn(e,"_activityStartTimestampUtc",null),Hn(e,"_attemptStartTimestampUtc",null),Hn(e,"_activityEndedDate",null),Hn(e,"_objectiveSatisfiedStatus",!1),Hn(e,"_objectiveSatisfiedStatusKnown",!1),Hn(e,"_objectiveMeasureStatus",!1),Hn(e,"_objectiveNormalizedMeasure",0),Hn(e,"_scaledPassingScore",.7),Hn(e,"_objectiveSatisfiedStatusDirty",!1),Hn(e,"_objectiveNormalizedMeasureDirty",!1),Hn(e,"_objectiveMeasureStatusDirty",!1),Hn(e,"_progressMeasure",0),Hn(e,"_progressMeasureStatus",!1),Hn(e,"_location",""),Hn(e,"_attemptAbsoluteStartTime",""),Hn(e,"_learnerPrefs",null),Hn(e,"_activityAttemptActive",!1),Hn(e,"_isHiddenFromChoice",!1),Hn(e,"_isAvailable",!0),Hn(e,"_hideLmsUi",[]),Hn(e,"_auxiliaryResources",[]),Hn(e,"_attemptLimit",null),Hn(e,"_attemptAbsoluteDurationLimit",null),Hn(e,"_activityAbsoluteDurationLimit",null),Hn(e,"_timeLimitAction",null),Hn(e,"_timeLimitDuration",null),Hn(e,"_beginTimeLimit",null),Hn(e,"_endTimeLimit",null),Hn(e,"_launchData",""),Hn(e,"_credit","credit"),Hn(e,"_maxTimeAllowed",""),Hn(e,"_completionThreshold",""),Hn(e,"_sequencingControls"),Hn(e,"_sequencingRules"),Hn(e,"_rollupRules"),Hn(e,"_processedChildren",null),Hn(e,"_isNewAttempt",!1),Hn(e,"_primaryObjective",null),Hn(e,"_objectives",[]),Hn(e,"_rollupConsiderations",{requiredForSatisfied:"always",requiredForNotSatisfied:"always",requiredForCompleted:"always",requiredForIncomplete:"always",measureSatisfactionIfActive:!0}),Hn(e,"_requiredForSatisfied","always"),Hn(e,"_requiredForNotSatisfied","always"),Hn(e,"_requiredForCompleted","always"),Hn(e,"_requiredForIncomplete","always"),Hn(e,"_wasSkipped",!1),Hn(e,"_attemptProgressStatus",!1),Hn(e,"_wasAutoCompleted",!1),Hn(e,"_wasAutoSatisfied",!1),Hn(e,"_completedByMeasure",!1),Hn(e,"_minProgressMeasure",1),Hn(e,"_progressWeight",1),Hn(e,"_attemptCompletionAmountStatus",!1),e._id=id,e._title=i,e._sequencingControls=new ei,e._sequencingRules=new jt,e._rollupRules=new Rn,e._primaryObjective=null,e._objectives=[],e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&zn(e,t)}(t,e),In(t,[{key:"initialize",value:function(){Nn(Dn(t.prototype),"initialize",this).call(this);var e=!0,i=!1,n=void 0;try{for(var r,o=this._children[Symbol.iterator]();!(e=(r=o.next()).done);e=!0)r.value.initialize()}catch(e){i=!0,n=e}finally{try{e||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"reset",value:function(){this._initialized=!1,this._isActive=!1,this._isSuspended=!1,this._isCompleted=!1,this._completionStatus=ke,this._successStatus=Ce,this._attemptCount=0,this._attemptCompletionAmount=0,this._attemptAbsoluteDuration="PT0H0M0S",this._attemptExperiencedDuration="PT0H0M0S",this._activityAbsoluteDuration="PT0H0M0S",this._activityExperiencedDuration="PT0H0M0S",this._attemptAbsoluteDurationValue="PT0H0M0S",this._attemptExperiencedDurationValue="PT0H0M0S",this._activityAbsoluteDurationValue="PT0H0M0S",this._activityExperiencedDurationValue="PT0H0M0S",this._activityStartTimestampUtc=null,this._attemptStartTimestampUtc=null,this._activityEndedDate=null,this._objectiveSatisfiedStatus=!1,this._objectiveSatisfiedStatusKnown=!1,this._objectiveMeasureStatus=!1,this._objectiveNormalizedMeasure=0,this._progressMeasure=0,this._progressMeasureStatus=!1,this._location="",this._attemptAbsoluteStartTime="",this._learnerPrefs=null,this._activityAttemptActive=!1,this._primaryObjective&&(this._primaryObjective.resetState(),this._primaryObjective.updateFromActivity(this));var e=!0,t=!1,i=void 0;try{for(var n,r=this._objectives[Symbol.iterator]();!(e=(n=r.next()).done);e=!0)n.value.resetState()}catch(e){t=!0,i=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw i}}var o=!0,a=!1,s=void 0;try{for(var c,l=this._children[Symbol.iterator]();!(o=(c=l.next()).done);o=!0)c.value.reset()}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}this._wasSkipped=!1,this._attemptProgressStatus=!1,this._wasAutoCompleted=!1,this._wasAutoSatisfied=!1,this._completedByMeasure=!1,this._minProgressMeasure=1,this._progressWeight=1,this._attemptCompletionAmountStatus=!1,this.clearAllObjectiveDirty()}},{key:"id",get:function(){return this._id},set:function(id){fn(this._cmi_element+".id",id,Je)&&(this._id=id)}},{key:"title",get:function(){return this._title},set:function(e){fn(this._cmi_element+".title",e,Ve)&&(this._title=e)}},{key:"children",get:function(){return this._children}},{key:"addChild",value:function(e){if(i=e,!(null!=(n=t)&&"undefined"!=typeof Symbol&&n[Symbol.hasInstance]?n[Symbol.hasInstance](i):i instanceof n))throw new oe(this._cmi_element+".children",de.TYPE_MISMATCH);var i,n;e._parent=this,this._children.push(e)}},{key:"setChildOrder",value:function(e){if(0!==e.length){var t,i=new Map(this._children.map(function(e){return[e.id,e]})),n=[],r=!0,o=!1,a=void 0;try{for(var s,c=e[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var id=s.value,l=i.get(id);l&&(n.push(l),i.delete(id))}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}if(i.size>0){var u=!0,d=!1,f=void 0;try{for(var v,h=this._children[Symbol.iterator]();!(u=(v=h.next()).done);u=!0){var m=v.value;i.has(m.id)&&(n.push(m),i.delete(m.id))}}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}}n.length===this._children.length&&(t=this._children).splice.apply(t,[0,this._children.length].concat(Fn(n)))}}},{key:"removeChild",value:function(e){var t=this._children.indexOf(e);return-1!==t&&(this._children.splice(t,1),e._parent=null,!0)}},{key:"parent",get:function(){return this._parent}},{key:"isVisible",get:function(){return this._isVisible},set:function(e){this._isVisible=e}},{key:"isActive",get:function(){return this._isActive},set:function(e){this._isActive=e}},{key:"isSuspended",get:function(){return this._isSuspended},set:function(e){this._isSuspended=e}},{key:"isCompleted",get:function(){return this._isCompleted},set:function(e){this._isCompleted=e,this._completionStatus=e?Ee:Ae}},{key:"completionStatus",get:function(){return this._completionStatus},set:function(e){this._completionStatus=e,this._isCompleted=e===Ee,this.updatePrimaryObjectiveFromActivity()}},{key:"successStatus",get:function(){return this._successStatus},set:function(e){this._successStatus=e}},{key:"attemptCount",get:function(){return this._attemptCount},set:function(e){this._attemptCount=e}},{key:"attemptCompletionAmount",get:function(){return this._attemptCompletionAmount},set:function(e){this._attemptCompletionAmount=e}},{key:"incrementAttemptCount",value:function(){this._attemptCount++,this._isNewAttempt=!0;var e=this._sequencingControls;"onEachNewAttempt"!==e.selectionTiming&&"onEachNewAttempt"!==e.randomizationTiming||(this._processedChildren=null)}},{key:"objectiveSatisfiedStatus",get:function(){return this._objectiveSatisfiedStatus},set:function(e){this._objectiveSatisfiedStatus!==e&&(this._objectiveSatisfiedStatus=e,this._objectiveSatisfiedStatusDirty=!0),this._objectiveSatisfiedStatusKnown=!0,this._successStatus=e?we:Oe,this.updatePrimaryObjectiveFromActivity()}},{key:"objectiveSatisfiedStatusKnown",get:function(){return this._objectiveSatisfiedStatusKnown},set:function(e){this._objectiveSatisfiedStatusKnown=e}},{key:"objectiveMeasureStatus",get:function(){return this._objectiveMeasureStatus},set:function(e){this._objectiveMeasureStatus!==e&&(this._objectiveMeasureStatus=e,this._objectiveMeasureStatusDirty=!0),this.updatePrimaryObjectiveFromActivity()}},{key:"objectiveNormalizedMeasure",get:function(){return this._objectiveNormalizedMeasure},set:function(e){this._objectiveNormalizedMeasure!==e&&(this._objectiveNormalizedMeasure=e,this._objectiveNormalizedMeasureDirty=!0),this.updatePrimaryObjectiveFromActivity()}},{key:"scaledPassingScore",get:function(){return this._scaledPassingScore},set:function(e){-1>e||e>1||(this._scaledPassingScore=e)}},{key:"progressMeasure",get:function(){return this._progressMeasure},set:function(e){this._progressMeasure=e,this.updatePrimaryObjectiveFromActivity()}},{key:"progressMeasureStatus",get:function(){return this._progressMeasureStatus},set:function(e){this._progressMeasureStatus=e,this.updatePrimaryObjectiveFromActivity()}},{key:"location",get:function(){return this._location},set:function(location){this._location=location}},{key:"attemptAbsoluteStartTime",get:function(){return this._attemptAbsoluteStartTime},set:function(e){this._attemptAbsoluteStartTime=e}},{key:"learnerPrefs",get:function(){return this._learnerPrefs},set:function(e){this._learnerPrefs=e}},{key:"activityAttemptActive",get:function(){return this._activityAttemptActive},set:function(e){this._activityAttemptActive=e}},{key:"isHiddenFromChoice",get:function(){return this._isHiddenFromChoice},set:function(e){this._isHiddenFromChoice=e}},{key:"isAvailable",get:function(){return this._isAvailable},set:function(e){this._isAvailable=e}},{key:"attemptLimit",get:function(){return this._attemptLimit},set:function(e){this._attemptLimit=e}},{key:"hasAttemptLimitExceeded",value:function(){return null!==this._attemptLimit&&this._attemptCount>=this._attemptLimit}},{key:"timeLimitDuration",get:function(){return this._timeLimitDuration},set:function(e){this._timeLimitDuration=e}},{key:"timeLimitAction",get:function(){return this._timeLimitAction},set:function(e){this._timeLimitAction=e}},{key:"beginTimeLimit",get:function(){return this._beginTimeLimit},set:function(e){this._beginTimeLimit=e}},{key:"endTimeLimit",get:function(){return this._endTimeLimit},set:function(e){this._endTimeLimit=e}},{key:"attemptAbsoluteDurationLimit",get:function(){return this._attemptAbsoluteDurationLimit},set:function(e){if(null!==e&&!f(e,Ke))throw new oe(this._cmi_element+".attemptAbsoluteDurationLimit",de.TYPE_MISMATCH);this._attemptAbsoluteDurationLimit=e}},{key:"attemptExperiencedDuration",get:function(){return this._attemptExperiencedDuration},set:function(e){if(!f(e,Ke))throw new oe(this._cmi_element+".attemptExperiencedDuration",de.TYPE_MISMATCH);this._attemptExperiencedDuration=e}},{key:"activityAbsoluteDurationLimit",get:function(){return this._activityAbsoluteDurationLimit},set:function(e){if(null!==e&&!f(e,Ke))throw new oe(this._cmi_element+".activityAbsoluteDurationLimit",de.TYPE_MISMATCH);this._activityAbsoluteDurationLimit=e}},{key:"activityExperiencedDuration",get:function(){return this._activityExperiencedDuration},set:function(e){if(!f(e,Ke))throw new oe(this._cmi_element+".activityExperiencedDuration",de.TYPE_MISMATCH);this._activityExperiencedDuration=e}},{key:"attemptAbsoluteDuration",get:function(){return this._attemptAbsoluteDurationLimit||"PT0H0M0S"},set:function(e){this._attemptAbsoluteDurationLimit=e}},{key:"activityAbsoluteDuration",get:function(){return this._activityAbsoluteDurationLimit||"PT0H0M0S"},set:function(e){this._activityAbsoluteDurationLimit=e}},{key:"attemptAbsoluteDurationValue",get:function(){return this._attemptAbsoluteDurationValue},set:function(e){if(!f(e,Ke))throw new oe(this._cmi_element+".attemptAbsoluteDurationValue",de.TYPE_MISMATCH);this._attemptAbsoluteDurationValue=e}},{key:"attemptExperiencedDurationValue",get:function(){return this._attemptExperiencedDurationValue},set:function(e){if(!f(e,Ke))throw new oe(this._cmi_element+".attemptExperiencedDurationValue",de.TYPE_MISMATCH);this._attemptExperiencedDurationValue=e}},{key:"activityAbsoluteDurationValue",get:function(){return this._activityAbsoluteDurationValue},set:function(e){if(!f(e,Ke))throw new oe(this._cmi_element+".activityAbsoluteDurationValue",de.TYPE_MISMATCH);this._activityAbsoluteDurationValue=e}},{key:"activityExperiencedDurationValue",get:function(){return this._activityExperiencedDurationValue},set:function(e){if(!f(e,Ke))throw new oe(this._cmi_element+".activityExperiencedDurationValue",de.TYPE_MISMATCH);this._activityExperiencedDurationValue=e}},{key:"activityStartTimestampUtc",get:function(){return this._activityStartTimestampUtc},set:function(timestamp){this._activityStartTimestampUtc=timestamp}},{key:"attemptStartTimestampUtc",get:function(){return this._attemptStartTimestampUtc},set:function(timestamp){this._attemptStartTimestampUtc=timestamp}},{key:"activityEndedDate",get:function(){return this._activityEndedDate},set:function(e){this._activityEndedDate=e}},{key:"sequencingControls",get:function(){return this._sequencingControls},set:function(e){this._sequencingControls=e}},{key:"sequencingRules",get:function(){return this._sequencingRules},set:function(e){this._sequencingRules=e}},{key:"rollupRules",get:function(){return this._rollupRules},set:function(e){this._rollupRules=e}},{key:"rollupConsiderations",get:function(){return Ln({},this._rollupConsiderations)},set:function(e){this._rollupConsiderations=Ln({},e)}},{key:"applyRollupConsiderations",value:function(e){this._rollupConsiderations=Ln({},this._rollupConsiderations,e)}},{key:"requiredForSatisfied",get:function(){return this._requiredForSatisfied},set:function(e){this._requiredForSatisfied=e}},{key:"requiredForNotSatisfied",get:function(){return this._requiredForNotSatisfied},set:function(e){this._requiredForNotSatisfied=e}},{key:"requiredForCompleted",get:function(){return this._requiredForCompleted},set:function(e){this._requiredForCompleted=e}},{key:"requiredForIncomplete",get:function(){return this._requiredForIncomplete},set:function(e){this._requiredForIncomplete=e}},{key:"wasSkipped",get:function(){return this._wasSkipped},set:function(e){this._wasSkipped=e}},{key:"attemptProgressStatus",get:function(){return this._attemptProgressStatus},set:function(e){this._attemptProgressStatus=e}},{key:"wasAutoCompleted",get:function(){return this._wasAutoCompleted},set:function(e){this._wasAutoCompleted=e}},{key:"wasAutoSatisfied",get:function(){return this._wasAutoSatisfied},set:function(e){this._wasAutoSatisfied=e}},{key:"completedByMeasure",get:function(){return this._completedByMeasure},set:function(e){this._completedByMeasure=e}},{key:"minProgressMeasure",get:function(){return this._minProgressMeasure},set:function(e){if(0>e||e>1)throw new oe(this._cmi_element+".minProgressMeasure",de.TYPE_MISMATCH);this._minProgressMeasure=e}},{key:"progressWeight",get:function(){return this._progressWeight},set:function(e){if(0>e)throw new oe(this._cmi_element+".progressWeight",de.TYPE_MISMATCH);this._progressWeight=e}},{key:"attemptCompletionAmountStatus",get:function(){return this._attemptCompletionAmountStatus},set:function(e){this._attemptCompletionAmountStatus=e}},{key:"primaryObjective",get:function(){return this._primaryObjective},set:function(e){var t;(this._primaryObjective=e,this._primaryObjective)&&(this._primaryObjective.isPrimary=!0,null!==this._primaryObjective.minNormalizedMeasure&&(this._scaledPassingScore=null!==(t=this._primaryObjective.minNormalizedMeasure)&&void 0!==t?t:this._scaledPassingScore),this._primaryObjective.updateFromActivity(this));this.syncPrimaryObjectiveCollection()}},{key:"objectives",get:function(){var e=this;return this._objectives.filter(function(t){var i;return t.id!==(null===(i=e._primaryObjective)||void 0===i?void 0:i.id)})},set:function(objectives){this._objectives=Fn(objectives),this.syncPrimaryObjectiveCollection()}},{key:"addObjective",value:function(e){this._objectives.find(function(t){return t.id===e.id})||this._objectives.push(e)}},{key:"syncPrimaryObjectiveCollection",value:function(){var e=this;if(this._primaryObjective){var t=this._objectives.findIndex(function(t){var i;return t.id===(null===(i=e._primaryObjective)||void 0===i?void 0:i.id)});0>t?this._objectives=[this._primaryObjective].concat(Fn(this._objectives)):this._objectives[t]=this._primaryObjective}else this._objectives=this._objectives.filter(function(e){return!e.isPrimary})}},{key:"getObjectiveById",value:function(e){var t;if((null===(t=this._primaryObjective)||void 0===t?void 0:t.id)===e)return{objective:this._primaryObjective,isPrimary:!0};var i=this._objectives.find(function(t){return t.id===e});return i?{objective:i,isPrimary:!1}:null}},{key:"getAllObjectives",value:function(){var e=this,objectives=[];this._primaryObjective&&objectives.push(this._primaryObjective);var t=this._objectives.filter(function(t){var i;return t!==e._primaryObjective&&t.id!==(null===(i=e._primaryObjective)||void 0===i?void 0:i.id)});return objectives.concat(t)}},{key:"updatePrimaryObjectiveFromActivity",value:function(){this._primaryObjective&&this._primaryObjective.updateFromActivity(this)}},{key:"isObjectiveDirty",value:function(e){switch(e){case"satisfiedStatus":return this._objectiveSatisfiedStatusDirty;case"normalizedMeasure":return this._objectiveNormalizedMeasureDirty;case"measureStatus":return this._objectiveMeasureStatusDirty}}},{key:"clearObjectiveDirty",value:function(e){switch(e){case"satisfiedStatus":this._objectiveSatisfiedStatusDirty=!1;break;case"normalizedMeasure":this._objectiveNormalizedMeasureDirty=!1;break;case"measureStatus":this._objectiveMeasureStatusDirty=!1}}},{key:"clearAllObjectiveDirty",value:function(){this._objectiveSatisfiedStatusDirty=!1,this._objectiveNormalizedMeasureDirty=!1,this._objectiveMeasureStatusDirty=!1}},{key:"setPrimaryObjectiveState",value:function(e,t,i,n,r,o){var a=6>=arguments.length||void 0===arguments[6]||arguments[6];this._objectiveSatisfiedStatus!==e&&(this._objectiveSatisfiedStatus=e,this._objectiveSatisfiedStatusDirty=!0),this._objectiveSatisfiedStatusKnown=a,this._objectiveMeasureStatus!==t&&(this._objectiveMeasureStatus=t,this._objectiveMeasureStatusDirty=!0),this._objectiveNormalizedMeasure!==i&&(this._objectiveNormalizedMeasure=i,this._objectiveNormalizedMeasureDirty=!0),this._progressMeasure=n,this._progressMeasureStatus=r,this._completionStatus=o,this._primaryObjective&&(this._primaryObjective.satisfiedStatus=e,this._primaryObjective.measureStatus=t,this._primaryObjective.normalizedMeasure=i,this._primaryObjective.progressMeasure=n,this._primaryObjective.progressMeasureStatus=r,this._primaryObjective.completionStatus=o,this._primaryObjective.satisfiedStatusKnown=a,this._primaryObjective.progressStatus=a)}},{key:"getObjectiveStateSnapshot",value:function(){var e;return{primary:this._primaryObjective?{id:this._primaryObjective.id,satisfiedStatus:this.objectiveSatisfiedStatus,measureStatus:this.objectiveMeasureStatus,normalizedMeasure:this.objectiveNormalizedMeasure,rawScore:this._primaryObjective.rawScore,rawScoreKnown:this._primaryObjective.rawScoreKnown,minScore:this._primaryObjective.minScore,minScoreKnown:this._primaryObjective.minScoreKnown,maxScore:this._primaryObjective.maxScore,maxScoreKnown:this._primaryObjective.maxScoreKnown,progressMeasure:null!==(e=this.progressMeasure)&&void 0!==e?e:0,progressMeasureStatus:this.progressMeasureStatus,progressStatus:this._primaryObjective.progressStatus,completionStatus:this.completionStatus,satisfiedByMeasure:this._primaryObjective.satisfiedByMeasure,minNormalizedMeasure:this._primaryObjective.minNormalizedMeasure}:null,objectives:this._objectives.map(function(e){return{id:e.id,satisfiedStatus:e.satisfiedStatus,measureStatus:e.measureStatus,normalizedMeasure:e.normalizedMeasure,rawScore:e.rawScore,rawScoreKnown:e.rawScoreKnown,minScore:e.minScore,minScoreKnown:e.minScoreKnown,maxScore:e.maxScore,maxScoreKnown:e.maxScoreKnown,progressMeasure:e.progressMeasure,progressMeasureStatus:e.progressMeasureStatus,progressStatus:e.progressStatus,completionStatus:e.completionStatus,satisfiedByMeasure:e.satisfiedByMeasure,minNormalizedMeasure:e.minNormalizedMeasure}})}}},{key:"applyObjectiveStateSnapshot",value:function(e){if(e.primary){var t=this.getObjectiveById(e.primary.id);if(t&&t.isPrimary){var i,n=e.primary;t.objective.satisfiedByMeasure=null!==(i=n.satisfiedByMeasure)&&void 0!==i?i:t.objective.satisfiedByMeasure,t.objective.minNormalizedMeasure=void 0!==n.minNormalizedMeasure?n.minNormalizedMeasure:t.objective.minNormalizedMeasure,this.setPrimaryObjectiveState(n.satisfiedStatus,n.measureStatus,n.normalizedMeasure,n.progressMeasure,n.progressMeasureStatus,n.completionStatus,n.progressStatus),this.applyObjectiveScoreSnapshot(t.objective,n)}}var r=!0,o=!1,a=void 0;try{for(var s,c=e.objectives[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var l=s.value,u=this.getObjectiveById(l.id);if(u&&!u.isPrimary){var d,f=u.objective;f.satisfiedStatus=l.satisfiedStatus,f.measureStatus=l.measureStatus,f.normalizedMeasure=l.normalizedMeasure,f.progressMeasure=l.progressMeasure,f.progressMeasureStatus=l.progressMeasureStatus,f.completionStatus=l.completionStatus,this.applyObjectiveScoreSnapshot(f,l),f.satisfiedByMeasure=null!==(d=l.satisfiedByMeasure)&&void 0!==d?d:f.satisfiedByMeasure,f.minNormalizedMeasure=void 0!==l.minNormalizedMeasure?l.minNormalizedMeasure:f.minNormalizedMeasure}}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}}},{key:"applyObjectiveScoreSnapshot",value:function(e,t){var i={};t.rawScoreKnown&&(i.rawScore=t.rawScore),t.minScoreKnown&&(i.minScore=t.minScore),t.maxScoreKnown&&(i.maxScore=t.maxScore),e.applyReadMappedState(i)}},{key:"getAvailableChildren",value:function(){return 0===this._children.length?[]:null!==this._processedChildren?this._processedChildren:this._children}},{key:"setProcessedChildren",value:function(e){this._processedChildren=e}},{key:"resetProcessedChildren",value:function(){this._processedChildren=null}},{key:"isNewAttempt",get:function(){return this._isNewAttempt},set:function(e){this._isNewAttempt=e}},{key:"launchData",get:function(){return this._launchData},set:function(e){this._launchData=e}},{key:"credit",get:function(){return this._credit},set:function(credit){this._credit=credit}},{key:"maxTimeAllowed",get:function(){return this._maxTimeAllowed},set:function(e){this._maxTimeAllowed=e}},{key:"completionThreshold",get:function(){return this._completionThreshold},set:function(e){this._completionThreshold=e}},{key:"getSuspensionState",value:function(){return{id:this._id,title:this._title,isVisible:this._isVisible,isActive:this._isActive,isSuspended:this._isSuspended,isCompleted:this._isCompleted,completionStatus:this._completionStatus,successStatus:this._successStatus,attemptCount:this._attemptCount,attemptCompletionAmount:this._attemptCompletionAmount,attemptAbsoluteDuration:this._attemptAbsoluteDuration,attemptExperiencedDuration:this._attemptExperiencedDuration,activityAbsoluteDuration:this._activityAbsoluteDuration,activityExperiencedDuration:this._activityExperiencedDuration,attemptAbsoluteDurationValue:this._attemptAbsoluteDurationValue,attemptExperiencedDurationValue:this._attemptExperiencedDurationValue,activityAbsoluteDurationValue:this._activityAbsoluteDurationValue,activityExperiencedDurationValue:this._activityExperiencedDurationValue,activityStartTimestampUtc:this._activityStartTimestampUtc,attemptStartTimestampUtc:this._attemptStartTimestampUtc,objectiveSatisfiedStatus:this._objectiveSatisfiedStatus,objectiveSatisfiedStatusKnown:this._objectiveSatisfiedStatusKnown,objectiveMeasureStatus:this._objectiveMeasureStatus,objectiveNormalizedMeasure:this._objectiveNormalizedMeasure,scaledPassingScore:this._scaledPassingScore,progressMeasure:this._progressMeasure,progressMeasureStatus:this._progressMeasureStatus,location:this._location,attemptAbsoluteStartTime:this._attemptAbsoluteStartTime,activityAttemptActive:this._activityAttemptActive,isHiddenFromChoice:this._isHiddenFromChoice,isAvailable:this._isAvailable,rollupConsiderations:Ln({},this._rollupConsiderations),wasSkipped:this._wasSkipped,attemptProgressStatus:this._attemptProgressStatus,wasAutoCompleted:this._wasAutoCompleted,wasAutoSatisfied:this._wasAutoSatisfied,completedByMeasure:this._completedByMeasure,minProgressMeasure:this._minProgressMeasure,progressWeight:this._progressWeight,attemptCompletionAmountStatus:this._attemptCompletionAmountStatus,processedChildren:this._processedChildren?this._processedChildren.map(function(e){return e.id}):null,isNewAttempt:this._isNewAttempt,selectionCountStatus:this._sequencingControls.selectionCountStatus,reorderChildren:this._sequencingControls.reorderChildren,primaryObjective:this._primaryObjective?{id:this._primaryObjective.id,satisfiedStatus:this._primaryObjective.satisfiedStatus,measureStatus:this._primaryObjective.measureStatus,normalizedMeasure:this._primaryObjective.normalizedMeasure,progressMeasure:this._primaryObjective.progressMeasure,progressMeasureStatus:this._primaryObjective.progressMeasureStatus,completionStatus:this._primaryObjective.completionStatus,satisfiedByMeasure:this._primaryObjective.satisfiedByMeasure,minNormalizedMeasure:this._primaryObjective.minNormalizedMeasure,progressStatus:this._primaryObjective.progressStatus,mapInfo:this._primaryObjective.mapInfo}:null,objectives:this._objectives.map(function(e){return{id:e.id,satisfiedStatus:e.satisfiedStatus,measureStatus:e.measureStatus,normalizedMeasure:e.normalizedMeasure,progressMeasure:e.progressMeasure,progressMeasureStatus:e.progressMeasureStatus,completionStatus:e.completionStatus,satisfiedByMeasure:e.satisfiedByMeasure,minNormalizedMeasure:e.minNormalizedMeasure,progressStatus:e.progressStatus,mapInfo:e.mapInfo}}),children:this._children.map(function(e){return e.getSuspensionState()})}}},{key:"restoreSuspensionState",value:function(e){var t,i,n,r,o,a,s,c,l,u,d,f,v,h,m,p,y,g,_,b,S,w,O,C,E,A,k,j,R,M,T,x,I,P,N,D,q,L,z;if(e){if(this._isVisible=null!==(t=e.isVisible)&&void 0!==t?t:this._isVisible,this._isActive=null!==(i=e.isActive)&&void 0!==i?i:this._isActive,this._isSuspended=null!==(n=e.isSuspended)&&void 0!==n?n:this._isSuspended,this._isCompleted=null!==(r=e.isCompleted)&&void 0!==r?r:this._isCompleted,this._completionStatus=null!==(o=e.completionStatus)&&void 0!==o?o:this._completionStatus,this._successStatus=null!==(a=e.successStatus)&&void 0!==a?a:this._successStatus,this._attemptCount=null!==(s=e.attemptCount)&&void 0!==s?s:this._attemptCount,this._attemptCompletionAmount=null!==(c=e.attemptCompletionAmount)&&void 0!==c?c:this._attemptCompletionAmount,this._attemptAbsoluteDuration=null!==(l=e.attemptAbsoluteDuration)&&void 0!==l?l:this._attemptAbsoluteDuration,this._attemptExperiencedDuration=null!==(u=e.attemptExperiencedDuration)&&void 0!==u?u:this._attemptExperiencedDuration,this._activityAbsoluteDuration=null!==(d=e.activityAbsoluteDuration)&&void 0!==d?d:this._activityAbsoluteDuration,this._activityExperiencedDuration=null!==(f=e.activityExperiencedDuration)&&void 0!==f?f:this._activityExperiencedDuration,this._attemptAbsoluteDurationValue=null!==(v=e.attemptAbsoluteDurationValue)&&void 0!==v?v:this._attemptAbsoluteDurationValue,this._attemptExperiencedDurationValue=null!==(h=e.attemptExperiencedDurationValue)&&void 0!==h?h:this._attemptExperiencedDurationValue,this._activityAbsoluteDurationValue=null!==(m=e.activityAbsoluteDurationValue)&&void 0!==m?m:this._activityAbsoluteDurationValue,this._activityExperiencedDurationValue=null!==(p=e.activityExperiencedDurationValue)&&void 0!==p?p:this._activityExperiencedDurationValue,this._activityStartTimestampUtc=null!==(y=e.activityStartTimestampUtc)&&void 0!==y?y:this._activityStartTimestampUtc,this._attemptStartTimestampUtc=null!==(g=e.attemptStartTimestampUtc)&&void 0!==g?g:this._attemptStartTimestampUtc,this._objectiveSatisfiedStatus=null!==(_=e.objectiveSatisfiedStatus)&&void 0!==_?_:this._objectiveSatisfiedStatus,this._objectiveSatisfiedStatusKnown=null!==(b=e.objectiveSatisfiedStatusKnown)&&void 0!==b?b:this._objectiveSatisfiedStatusKnown,this._objectiveMeasureStatus=null!==(S=e.objectiveMeasureStatus)&&void 0!==S?S:this._objectiveMeasureStatus,this._objectiveNormalizedMeasure=null!==(w=e.objectiveNormalizedMeasure)&&void 0!==w?w:this._objectiveNormalizedMeasure,this._scaledPassingScore=null!==(O=e.scaledPassingScore)&&void 0!==O?O:this._scaledPassingScore,this._progressMeasure=null!==(C=e.progressMeasure)&&void 0!==C?C:this._progressMeasure,this._progressMeasureStatus=null!==(E=e.progressMeasureStatus)&&void 0!==E?E:this._progressMeasureStatus,this._location=null!==(A=e.location)&&void 0!==A?A:this._location,this._attemptAbsoluteStartTime=null!==(k=e.attemptAbsoluteStartTime)&&void 0!==k?k:this._attemptAbsoluteStartTime,this._activityAttemptActive=null!==(j=e.activityAttemptActive)&&void 0!==j?j:this._activityAttemptActive,this._isHiddenFromChoice=null!==(R=e.isHiddenFromChoice)&&void 0!==R?R:this._isHiddenFromChoice,this._isAvailable=null!==(M=e.isAvailable)&&void 0!==M?M:this._isAvailable,e.rollupConsiderations&&(this._rollupConsiderations=Ln({},e.rollupConsiderations)),this._wasSkipped=null!==(T=e.wasSkipped)&&void 0!==T?T:this._wasSkipped,this._attemptProgressStatus=null!==(x=e.attemptProgressStatus)&&void 0!==x?x:this._attemptProgressStatus,this._wasAutoCompleted=null!==(I=e.wasAutoCompleted)&&void 0!==I?I:this._wasAutoCompleted,this._wasAutoSatisfied=null!==(P=e.wasAutoSatisfied)&&void 0!==P?P:this._wasAutoSatisfied,this._completedByMeasure=null!==(N=e.completedByMeasure)&&void 0!==N?N:this._completedByMeasure,this._minProgressMeasure=null!==(D=e.minProgressMeasure)&&void 0!==D?D:this._minProgressMeasure,this._progressWeight=null!==(q=e.progressWeight)&&void 0!==q?q:this._progressWeight,this._attemptCompletionAmountStatus=null!==(L=e.attemptCompletionAmountStatus)&&void 0!==L?L:this._attemptCompletionAmountStatus,this._isNewAttempt=null!==(z=e.isNewAttempt)&&void 0!==z?z:this._isNewAttempt,void 0!==e.selectionCountStatus&&(this._sequencingControls.selectionCountStatus=e.selectionCountStatus),void 0!==e.reorderChildren&&(this._sequencingControls.reorderChildren=e.reorderChildren),e.processedChildren){var F=new Map(this._children.map(function(e){return[e.id,e]}));this._processedChildren=e.processedChildren.map(function(id){return F.get(id)}).filter(function(e){return void 0!==e})}else this._processedChildren=null;var B,V,H,U,G,K,Y;if(e.primaryObjective&&this._primaryObjective&&(this._primaryObjective.satisfiedStatus=null!==(B=e.primaryObjective.satisfiedStatus)&&void 0!==B?B:this._primaryObjective.satisfiedStatus,this._primaryObjective.measureStatus=null!==(V=e.primaryObjective.measureStatus)&&void 0!==V?V:this._primaryObjective.measureStatus,this._primaryObjective.normalizedMeasure=null!==(H=e.primaryObjective.normalizedMeasure)&&void 0!==H?H:this._primaryObjective.normalizedMeasure,this._primaryObjective.progressMeasure=null!==(U=e.primaryObjective.progressMeasure)&&void 0!==U?U:this._primaryObjective.progressMeasure,this._primaryObjective.progressMeasureStatus=null!==(G=e.primaryObjective.progressMeasureStatus)&&void 0!==G?G:this._primaryObjective.progressMeasureStatus,this._primaryObjective.completionStatus=null!==(K=e.primaryObjective.completionStatus)&&void 0!==K?K:this._primaryObjective.completionStatus,this._primaryObjective.progressStatus=null!==(Y=e.primaryObjective.progressStatus)&&void 0!==Y?Y:this._primaryObjective.progressStatus),e.objectives){var W=!0,J=!1,$=void 0;try{for(var X,Q,Z=function(){var e,t,i,n,r,o,a,s=Q.value,c=X._objectives.find(function(e){return e.id===s.id});c&&(c.satisfiedStatus=null!==(e=s.satisfiedStatus)&&void 0!==e?e:c.satisfiedStatus,c.measureStatus=null!==(t=s.measureStatus)&&void 0!==t?t:c.measureStatus,c.normalizedMeasure=null!==(i=s.normalizedMeasure)&&void 0!==i?i:c.normalizedMeasure,c.progressMeasure=null!==(n=s.progressMeasure)&&void 0!==n?n:c.progressMeasure,c.progressMeasureStatus=null!==(r=s.progressMeasureStatus)&&void 0!==r?r:c.progressMeasureStatus,c.completionStatus=null!==(o=s.completionStatus)&&void 0!==o?o:c.completionStatus,c.progressStatus=null!==(a=s.progressStatus)&&void 0!==a?a:c.progressStatus)},ee=e.objectives[Symbol.iterator]();!(W=(Q=ee.next()).done);W=!0)X=this,Z()}catch(e){J=!0,$=e}finally{try{W||null==ee.return||ee.return()}finally{if(J)throw $}}}if(e.children&&Array.isArray(e.children))for(var te,ie=function(t){var i=e.children[t],n=te._children.find(function(e){return e.id===i.id});n&&n.restoreSuspensionState(i)},ne=0;e.children.length>ne&&this._children.length>ne;ne++)te=this,ie(ne)}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this._id,title:this._title,isVisible:this._isVisible,isActive:this._isActive,isSuspended:this._isSuspended,isCompleted:this._isCompleted,completionStatus:this._completionStatus,successStatus:this._successStatus,attemptCount:this._attemptCount,attemptCompletionAmount:this._attemptCompletionAmount,attemptAbsoluteDuration:this._attemptAbsoluteDuration,attemptExperiencedDuration:this._attemptExperiencedDuration,activityAbsoluteDuration:this._activityAbsoluteDuration,activityExperiencedDuration:this._activityExperiencedDuration,objectiveSatisfiedStatus:this._objectiveSatisfiedStatus,objectiveSatisfiedStatusKnown:this._objectiveSatisfiedStatusKnown,objectiveMeasureStatus:this._objectiveMeasureStatus,objectiveNormalizedMeasure:this._objectiveNormalizedMeasure,rollupConsiderations:Ln({},this._rollupConsiderations),wasSkipped:this._wasSkipped,completedByMeasure:this._completedByMeasure,minProgressMeasure:this._minProgressMeasure,progressWeight:this._progressWeight,attemptCompletionAmountStatus:this._attemptCompletionAmountStatus,hideLmsUi:Fn(this._hideLmsUi),auxiliaryResources:this._auxiliaryResources.map(function(e){return Ln({},e)}),children:this._children.map(function(e){return e.toJSON()})};return this.jsonString=!1,result}},{key:"auxiliaryResources",get:function(){return this._auxiliaryResources.map(function(e){return Ln({},e)})},set:function(e){var t=[],i=new Set,n=!0,r=!1,o=void 0;try{for(var a,s=(e||[])[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;if(c){var l="string"==typeof c.resourceId?c.resourceId.trim():"",u="string"==typeof c.purpose?c.purpose.trim():"";l&&!i.has(l)&&(i.add(l),t.push({resourceId:l,purpose:u}))}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}this._auxiliaryResources=t}},{key:"addAuxiliaryResource",value:function(e){this.auxiliaryResources=Fn(this._auxiliaryResources).concat([e])}},{key:"captureRollupStatus",value:function(){return{measureStatus:this._objectiveMeasureStatus,normalizedMeasure:this._objectiveNormalizedMeasure,objectiveProgressStatus:null!=this._objectiveSatisfiedStatus,objectiveSatisfiedStatus:this._objectiveSatisfiedStatus,attemptProgressStatus:this._completionStatus!==ke,attemptCompletionStatus:this._completionStatus===Ee}}},{key:"hideLmsUi",get:function(){return Fn(this._hideLmsUi)},set:function(e){var t=new Set(dt),i=new Set,n=[],r=!0,o=!1,a=void 0;try{for(var s,c=e[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var l=s.value;t.has(l)&&!i.has(l)&&(i.add(l),n.push(l))}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}this._hideLmsUi=n}}],[{key:"compareRollupStatus",value:function(e,t){return e.measureStatus===t.measureStatus&&1e-4>Math.abs(e.normalizedMeasure-t.normalizedMeasure)&&e.objectiveProgressStatus===t.objectiveProgressStatus&&e.objectiveSatisfiedStatus===t.objectiveSatisfiedStatus&&e.attemptProgressStatus===t.attemptProgressStatus&&e.attemptCompletionStatus===t.attemptCompletionStatus}}]),t}(A);var Kn=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,(i=[{key:"checkChildForRollupSubprocess",value:function(e,t,i){if(!1===e.sequencingControls.tracked)return!1;var n=!1;if("measure"===t||"objective"===t){if(!e.sequencingControls.rollupObjectiveSatisfied)return!1;n=!0;var r=e.requiredForSatisfied,o=e.requiredForNotSatisfied;"satisfied"===i&&"ifNotSuspended"===r||"notSatisfied"===i&&"ifNotSuspended"===o?(!e.attemptProgressStatus||e.attemptCount>0&&e.isSuspended)&&(n=!1):"satisfied"===i&&"ifAttempted"===r||"notSatisfied"===i&&"ifAttempted"===o?e.attemptProgressStatus&&0!==e.attemptCount||(n=!1):("satisfied"===i&&"ifNotSkipped"===r||"notSatisfied"===i&&"ifNotSkipped"===o)&&e.wasSkipped&&(n=!1)}if("progress"===t){if(!e.sequencingControls.rollupProgressCompletion)return!1;n=!0;var a=e.requiredForCompleted,s=e.requiredForIncomplete;"completed"===i&&"ifNotSuspended"===a||"incomplete"===i&&"ifNotSuspended"===s?(!e.attemptProgressStatus||e.attemptCount>0&&e.isSuspended)&&(n=!1):"completed"===i&&"ifAttempted"===a||"incomplete"===i&&"ifAttempted"===s?e.attemptProgressStatus&&0!==e.attemptCount||(n=!1):("completed"===i&&"ifNotSkipped"===a||"incomplete"===i&&"ifNotSkipped"===s)&&e.wasSkipped&&(n=!1)}return!(n&&!e.isAvailable)&&n}},{key:"filterChildrenForRequirement",value:function(e,t,mode,i){var n=this;return e.filter(function(e){return n.shouldIncludeChildForRollup(e,t,mode,i)})}},{key:"shouldIncludeChildForRollup",value:function(e,t,mode,i){return!(!this.checkChildForRollupSubprocess(e,t,mode)||"objective"===t&&!i.measureSatisfactionIfActive&&(e.activityAttemptActive||e.isActive))}},{key:"isChildSatisfiedForRollup",value:function(e){return!0===e.objectiveSatisfiedStatus||!1!==e.objectiveSatisfiedStatus&&e.successStatus===we}},{key:"isChildCompletedForRollup",value:function(e){return!("completed"!==e.completionStatus&&!e.isCompleted)}},{key:"getTrackableChildren",value:function(e){return e.children.filter(function(e){return!1!==e.sequencingControls.tracked})}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Yn=Object.defineProperty,Wn=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?Yn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="childFilter")?i+"":i,n),this.childFilter=t}return t=e,(i=[{key:"evaluateRollupRule",value:function(e,t){var i=e.getAvailableChildren(),n=0,r=0,o=!0,a=!1,s=void 0;try{for(var c,l=i[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value,d=!1;switch(t.action){case En.SATISFIED:d=this.childFilter.checkChildForRollupSubprocess(u,"objective","satisfied");break;case En.NOT_SATISFIED:d=this.childFilter.checkChildForRollupSubprocess(u,"objective","notSatisfied");break;case En.COMPLETED:d=this.childFilter.checkChildForRollupSubprocess(u,"progress","completed");break;case En.INCOMPLETE:d=this.childFilter.checkChildForRollupSubprocess(u,"progress","incomplete")}d&&(n++,this.evaluateRollupConditionsSubprocess(u,t)&&r++)}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}return t.consideration===An.ALL?n>0&&r===n:null!==t.minimumCount?r>=t.minimumCount:null!==t.minimumPercent?(n>0?r/n:0)>=t.minimumPercent:n>0&&r===n}},{key:"evaluateRollupConditionsSubprocess",value:function(e,t){if(0===t.conditions.length)return!0;switch(t.consideration){case An.ALL:return t.conditions.every(function(t){return t.evaluate(e)});case An.ANY:return t.conditions.some(function(t){return t.evaluate(e)});case An.NONE:return!t.conditions.some(function(t){return t.evaluate(e)});case An.AT_LEAST_COUNT:case An.AT_LEAST_PERCENT:return t.conditions.every(function(t){return t.evaluate(e)});default:return!1}}},{key:"evaluateRulesForAction",value:function(e,t,i){var n=t.filter(function(e){return e.action===i});if(0===n.length)return null;var r=!0,o=!1,a=void 0;try{for(var s,c=n[Symbol.iterator]();!(r=(s=c.next()).done);r=!0)if(this.evaluateRollupRule(e,s.value))return!0}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Jn=Object.defineProperty,$n=function(e,t,i){return function(e,t,i){return t in e?Jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Xn=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),$n(this,"childFilter"),$n(this,"eventCallback"),this.childFilter=t,this.eventCallback=i||null}return t=e,i=[{key:"measureRollupProcess",value:function(e){var t=this;if(!e.sequencingControls.rollupObjectiveSatisfied)return[];var i=e.getAvailableChildren();if(0===i.length)return[];var n=e.rollupConsiderations,r=i.filter(function(e){return!(!t.childFilter.checkChildForRollupSubprocess(e,"measure")||!e.objectiveMeasureStatus||null===e.objectiveNormalizedMeasure||!n.measureSatisfactionIfActive&&(e.activityAttemptActive||e.isActive))});if(0===r.length)return e.objectiveMeasureStatus=!1,[];var o=this.calculateComplexWeightedMeasure(e,r,{enableThresholdBias:!1});return e.objectiveNormalizedMeasure=o,e.objectiveMeasureStatus=!0,this.identifyActivityClusters(r)}},{key:"completionMeasureRollupProcess",value:function(e){var t=e.getAvailableChildren();if(0!==t.length){var i=t.filter(function(e){return e.attemptCompletionAmountStatus});if(0!==i.length){var n=0,r=0,o=!0,a=!1,s=void 0;try{for(var c,l=i[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value;n+=u.attemptCompletionAmount*u.progressWeight,r+=u.progressWeight}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}r>0&&(e.attemptCompletionAmount=n/r,e.attemptCompletionAmountStatus=!0)}else e.attemptCompletionAmountStatus=!1}}},{key:"calculateComplexWeightedMeasure",value:function(e,t,i){var n,r,o=0,a=0,s=[],c=null===(n=null==i?void 0:i.enableThresholdBias)||void 0===n||n,l=!0,u=!1,d=void 0;try{for(var f,v=t[Symbol.iterator]();!(l=(f=v.next()).done);l=!0){var h=f.value;if(this.childFilter.checkChildForRollupSubprocess(h,"measure")&&h.objectiveMeasureStatus&&null!==h.objectiveNormalizedMeasure){var m=this.calculateAdjustedWeight(h,h.sequencingControls.objectiveMeasureWeight,c);o+=h.objectiveNormalizedMeasure*m,a+=m,s.push({childId:h.id,measure:h.objectiveNormalizedMeasure,weight:m})}}}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}return null===(r=this.eventCallback)||void 0===r||r.call(this,"complex_weighting_calculated",{activityId:e.id,weightingDetails:s,totalWeight:a,totalWeightedMeasure:o,result:a>0?o/a:0}),a>0?o/a:0}},{key:"calculateAdjustedWeight",value:function(e,t){var i,n=2>=arguments.length||void 0===arguments[2]||arguments[2],r=t;return"completed"!==e.completionStatus&&(r*=.8),e.attemptCount>1&&(r*=Math.max(.5,1-.1*(e.attemptCount-1))),e.hasAttemptLimitExceeded()&&(r*=.6),n&&e.objectiveMeasureStatus&&(r*=(null!==(i=e.scaledPassingScore)&&void 0!==i?i:.7)>e.objectiveNormalizedMeasure?.95:1.05),Math.max(0,r)}},{key:"identifyActivityClusters",value:function(e){var t=[],i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.children.length>0&&s.sequencingControls.flow&&t.push(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var Qn=Object.defineProperty,Zn=function(e,t,i){return function(e,t,i){return t in e?Qn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},er=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Zn(this,"childFilter"),Zn(this,"ruleEvaluator"),Zn(this,"eventCallback"),this.childFilter=t,this.ruleEvaluator=i,this.eventCallback=n||null}return t=e,(i=[{key:"objectiveRollupProcess",value:function(e){var t=this.objectiveRollupUsingRules(e,e.rollupRules.rules);if(null!==t)return e.objectiveSatisfiedStatus=t,void this.syncPrimaryObjectiveFromActivity(e);var i=this.objectiveRollupUsingMeasure(e);if(null!==i)return e.objectiveSatisfiedStatus=i,void this.syncPrimaryObjectiveFromActivity(e);e.objectiveSatisfiedStatus=this.objectiveRollupUsingDefault(e),this.syncPrimaryObjectiveFromActivity(e)}},{key:"objectiveRollupUsingRules",value:function(e,t){var i=t.filter(function(e){return e.action===En.SATISFIED}),n=t.filter(function(e){return e.action===En.NOT_SATISFIED}),r=!0,o=!1,a=void 0;try{for(var s,c=i[Symbol.iterator]();!(r=(s=c.next()).done);r=!0)if(this.ruleEvaluator.evaluateRollupRule(e,s.value))return!0}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}var l=!0,u=!1,d=void 0;try{for(var f,v=n[Symbol.iterator]();!(l=(f=v.next()).done);l=!0)if(this.ruleEvaluator.evaluateRollupRule(e,f.value))return!1}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}return null}},{key:"objectiveRollupUsingMeasure",value:function(e){return e.objectiveMeasureStatus&&null!==e.scaledPassingScore?e.objectiveNormalizedMeasure>=e.scaledPassingScore:null}},{key:"objectiveRollupUsingDefault",value:function(e){var t=this,i=e.getAvailableChildren();if(0===i.length)return!1;var n=e.rollupConsiderations,r=i.filter(function(e){return!(!t.childFilter.checkChildForRollupSubprocess(e,"objective","satisfied")||!t.childFilter.checkChildForRollupSubprocess(e,"objective","notSatisfied")||!n.measureSatisfactionIfActive&&(e.activityAttemptActive||e.isActive))});return 0!==r.length&&!r.some(function(e){return!t.childFilter.isChildSatisfiedForRollup(e)})&&r.every(function(e){return t.childFilter.isChildSatisfiedForRollup(e)})}},{key:"syncPrimaryObjectiveFromActivity",value:function(e){e.primaryObjective&&(e.primaryObjective.satisfiedStatus=e.objectiveSatisfiedStatus,e.primaryObjective.satisfiedStatusKnown=e.objectiveSatisfiedStatusKnown,e.primaryObjective.measureStatus=e.objectiveMeasureStatus,e.primaryObjective.normalizedMeasure=e.objectiveNormalizedMeasure,e.primaryObjective.progressMeasure=e.progressMeasure,e.primaryObjective.progressMeasureStatus=e.progressMeasureStatus,e.primaryObjective.completionStatus=e.completionStatus)}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var tr=Object.defineProperty,ir=function(e,t,i){return function(e,t,i){return t in e?tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},nr=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ir(this,"childFilter"),ir(this,"ruleEvaluator"),ir(this,"objectiveProcessor"),ir(this,"eventCallback"),this.childFilter=t,this.ruleEvaluator=i,this.objectiveProcessor=n,this.eventCallback=r||null}return t=e,(i=[{key:"activityProgressRollupProcess",value:function(e){var t=this;if(!this.activityProgressRollupUsingMeasure(e)){var i=e.rollupRules,n=i.rules.filter(function(e){return e.action===En.COMPLETED}),r=i.rules.filter(function(e){return e.action===En.INCOMPLETE}),o=!0,a=!1,s=void 0;try{for(var c,l=n[Symbol.iterator]();!(o=(c=l.next()).done);o=!0)if(this.ruleEvaluator.evaluateRollupRule(e,c.value))return e.completionStatus=Ee,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e)}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}var u=!0,d=!1,f=void 0;try{for(var v,h=r[Symbol.iterator]();!(u=(v=h.next()).done);u=!0)if(this.ruleEvaluator.evaluateRollupRule(e,v.value))return e.completionStatus=Ae,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e)}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}var m=e.getAvailableChildren().filter(function(e){return t.childFilter.checkChildForRollupSubprocess(e,"progress","completed")&&t.childFilter.checkChildForRollupSubprocess(e,"progress","incomplete")});if(0===m.length)return e.completionStatus=Ae,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e);if(m.some(function(e){return!t.childFilter.isChildCompletedForRollup(e)}))return e.completionStatus=Ae,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e);e.completionStatus=Ee,this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e)}}},{key:"activityProgressRollupUsingMeasure",value:function(e){return!!e.completedByMeasure&&(e.attemptCompletionAmountStatus?(e.completionStatus=e.minProgressMeasure>e.attemptCompletionAmount?Ae:Ee,this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e),!0):(e.completionStatus=ke,this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e),!0))}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var rr=Object.defineProperty,or=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?rr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="eventCallback")?i+"":i,n),this.eventCallback=t||null}return t=e,(i=[{key:"durationRollupProcess",value:function(e){if(0!==e.children.length){var t=e.getAvailableChildren();if(0!==t.length){var i=null,n=null,r=null,o=null,a=0,s=0,c=!0,u=!1,f=void 0;try{for(var v,h=t[Symbol.iterator]();!(c=(v=h.next()).done);c=!0){var m=v.value;m.activityStartTimestampUtc&&(i&&m.activityStartTimestampUtc>=i||(i=m.activityStartTimestampUtc)),m.activityEndedDate&&(r&&r>=m.activityEndedDate||(r=m.activityEndedDate));var p="PT0H0M0S"!==m.activityExperiencedDurationValue?m.activityExperiencedDurationValue:m.activityExperiencedDuration;if(p&&"PT0H0M0S"!==p&&(a+=d(p,Ke)),!e.attemptStartTimestampUtc||m.attemptStartTimestampUtc&&m.attemptStartTimestampUtc>=e.attemptStartTimestampUtc){m.attemptStartTimestampUtc&&(n&&m.attemptStartTimestampUtc>=n||(n=m.attemptStartTimestampUtc)),m.activityEndedDate&&(o&&o>=m.activityEndedDate||(o=m.activityEndedDate));var y="PT0H0M0S"!==m.attemptExperiencedDurationValue?m.attemptExperiencedDurationValue:m.attemptExperiencedDuration;y&&"PT0H0M0S"!==y&&(s+=d(y,Ke))}}}catch(e){u=!0,f=e}finally{try{c||null==h.return||h.return()}finally{if(u)throw f}}if(null!==i){var g;if(e.activityStartTimestampUtc=i,!e.attemptStartTimestampUtc&&n&&(e.attemptStartTimestampUtc=n),e.activityEndedDate=r,r&&e.activityStartTimestampUtc){var _=new Date(e.activityStartTimestampUtc),b=r.getTime()-_.getTime();e.activityAbsoluteDurationValue=l(Math.max(0,b/1e3))}if(o&&e.attemptStartTimestampUtc){var S=new Date(e.attemptStartTimestampUtc),w=o.getTime()-S.getTime();e.attemptAbsoluteDurationValue=l(Math.max(0,w/1e3))}e.activityExperiencedDurationValue=l(a),e.attemptExperiencedDurationValue=l(s),null===(g=this.eventCallback)||void 0===g||g.call(this,"duration_rollup_completed",{activityId:e.id,activityAbsoluteDuration:e.activityAbsoluteDurationValue,attemptAbsoluteDuration:e.attemptAbsoluteDurationValue,activityExperiencedDuration:e.activityExperiencedDurationValue,attemptExperiencedDuration:e.attemptExperiencedDurationValue,childCount:t.length})}}}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var ar=Object.defineProperty,sr=function(e,t,i){return function(e,t,i){return t in e?ar(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},cr=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),sr(this,"measureProcessor"),sr(this,"objectiveProcessor"),sr(this,"progressProcessor"),sr(this,"eventCallback"),sr(this,"processingClusters",new Set),this.measureProcessor=t,this.objectiveProcessor=i,this.progressProcessor=n,this.eventCallback=r||null}return t=e,i=[{key:"processCrossClusterDependencies",value:function(e,t){var i,n,r,o,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(10>a)if(this.processingClusters.has(e.id))null===(i=this.eventCallback)||void 0===i||i.call(this,"cross_cluster_skip_reentrant",{activityId:e.id});else try{var s,c;this.processingClusters.add(e.id),null===(s=this.eventCallback)||void 0===s||s.call(this,"cross_cluster_processing_started",{activityId:e.id,clusterCount:t.length,depth:a});var l=new Map,u=!0,d=!1,f=void 0;try{for(var v,h=t[Symbol.iterator]();!(u=(v=h.next()).done);u=!0)this.analyzeCrossClusterDependencies(v.value,l)}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}var m=this.resolveDependencyOrder(l),p=!0,y=!1,g=void 0;try{for(var _,b,S=function(){var e=b.value,i=t.find(function(t){return t.id===e});i&&_.processClusterRollup(i,a)},w=m[Symbol.iterator]();!(p=(b=w.next()).done);p=!0)_=this,S()}catch(e){y=!0,g=e}finally{try{p||null==w.return||w.return()}finally{if(y)throw g}}null===(c=this.eventCallback)||void 0===c||c.call(this,"cross_cluster_processing_completed",{activityId:e.id,processedClusters:m.length,dependencyMap:Array.from(l.entries())})}catch(t){var O;null===(O=this.eventCallback)||void 0===O||O.call(this,"cross_cluster_processing_error",{activityId:e.id,error:(n=t,r=Error,(null!=r&&"undefined"!=typeof Symbol&&r[Symbol.hasInstance]?r[Symbol.hasInstance](n):n instanceof r)?t.message:t+"")})}finally{this.processingClusters.delete(e.id)}else null===(o=this.eventCallback)||void 0===o||o.call(this,"cross_cluster_max_depth_reached",{activityId:e.id,depth:a,maxDepth:10})}},{key:"identifyActivityClusters",value:function(e){var t=[],i=!0,n=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.children.length>0&&s.sequencingControls.flow&&t.push(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"analyzeCrossClusterDependencies",value:function(e,t){t.set(e.id,[])}},{key:"resolveDependencyOrder",value:function(e){var t=this,i=[],n=new Set,r=function(id){if(!i.includes(id))if(n.has(id)){var o,a;null===(o=(a=t).eventCallback)||void 0===o||o.call(a,"circular_dependency_detected",{activityId:id})}else{n.add(id);var s=e.get(id)||[],c=!0,l=!1,u=void 0;try{for(var d,f=s[Symbol.iterator]();!(c=(d=f.next()).done);c=!0)r(d.value)}catch(e){l=!0,u=e}finally{try{c||null==f.return||f.return()}finally{if(l)throw u}}n.delete(id),i.push(id)}},o=!0,a=!1,s=void 0;try{for(var c,l=Array.from(e.keys())[Symbol.iterator]();!(o=(c=l.next()).done);o=!0)r(c.value)}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}return i}},{key:"processClusterRollup",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.measureProcessor.measureRollupProcess(e);e.sequencingControls.rollupObjectiveSatisfied&&this.objectiveProcessor.objectiveRollupProcess(e),e.sequencingControls.rollupProgressCompletion&&this.progressProcessor.activityProgressRollupProcess(e),i.length>1&&this.processCrossClusterDependencies(e,i,t+1)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function lr(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ur(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var dr=Object.defineProperty,fr=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?dr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="eventCallback")?i+"":i,n),this.eventCallback=t||null}var t,i,n;return t=e,n=[{key:"getGlobalObjectiveReadState",value:function(e,t,i,n){var r={};if(i.readSatisfiedStatus&&n.satisfiedStatusKnown&&(r.satisfiedStatus=n.satisfiedStatus),i.readNormalizedMeasure&&n.normalizedMeasureKnown&&(r.normalizedMeasure=n.normalizedMeasure,t.satisfiedByMeasure)){var o,a,s=null!==(o=null!==(a=t.minNormalizedMeasure)&&void 0!==a?a:e.scaledPassingScore)&&void 0!==o?o:.7;r.satisfiedStatus=n.normalizedMeasure>=s}return i.readCompletionStatus&&n.completionStatusKnown&&(r.completionStatus=n.completionStatus),i.readProgressMeasure&&n.progressMeasureKnown&&(r.progressMeasure=n.progressMeasure),i.readRawScore&&n.rawScoreKnown&&(r.rawScore=n.rawScore),i.readMinScore&&n.minScoreKnown&&(r.minScore=n.minScore),i.readMaxScore&&n.maxScoreKnown&&(r.maxScore=n.maxScore),r}}],(i=[{key:"processGlobalObjectiveMapping",value:function(e,t){try{var i,n;null===(i=this.eventCallback)||void 0===i||i.call(this,"global_objective_processing_started",{activityId:e.id,globalObjectiveCount:t.size});var r=[];this.collectActivitiesRecursive(e,r);var o=!0,a=!1,s=void 0;try{for(var c,l=r[Symbol.iterator]();!(o=(c=l.next()).done);o=!0)this.syncGlobalObjectivesWritePhase(c.value,t)}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}var u=!0,d=!1,f=void 0;try{for(var v,h=r[Symbol.iterator]();!(u=(v=h.next()).done);u=!0)this.syncGlobalObjectivesReadPhase(v.value,t)}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}null===(n=this.eventCallback)||void 0===n||n.call(this,"global_objective_processing_completed",{activityId:e.id,processedObjectives:t.size})}catch(t){var m;null===(m=this.eventCallback)||void 0===m||m.call(this,"global_objective_processing_error",{activityId:e.id,error:ur(t,Error)?t.message:t+""})}}},{key:"collectActivitiesRecursive",value:function(e,result){result.push(e);var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.collectActivitiesRecursive(r.value,result)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"syncGlobalObjectivesWritePhase",value:function(e,t){if(this.canWriteGlobalObjectives(e)){var objectives=e.getAllObjectives(),i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,c=s.mapInfo.length>0?s.mapInfo:[this.createDefaultMapInfo(s)],l=new Set,u=!0,d=!1,f=void 0;try{for(var v,h=c[Symbol.iterator]();!(u=(v=h.next()).done);u=!0){var m=v.value,p=this.ensureGlobalObjectiveEntry(t,m.targetObjectiveID||s.id,s);if(m.writeSatisfiedStatus&&this.hasKnownSatisfiedStatus(s)&&s.isDirty("satisfiedStatus")&&(p.satisfiedStatus=s.satisfiedStatus,p.satisfiedStatusKnown=!0,l.add("satisfiedStatus")),m.writeNormalizedMeasure&&s.measureStatus&&s.isDirty("normalizedMeasure")&&(p.normalizedMeasure=s.normalizedMeasure,p.normalizedMeasureKnown=!0,l.add("normalizedMeasure"),m.writeSatisfiedStatus&&s.satisfiedByMeasure)){var y,g,_=null!==(y=null!==(g=s.minNormalizedMeasure)&&void 0!==g?g:e.scaledPassingScore)&&void 0!==y?y:.7;p.satisfiedStatus=s.normalizedMeasure>=_,p.satisfiedStatusKnown=!0,l.add("satisfiedStatus")}m.writeCompletionStatus&&s.completionStatus!==ke&&s.isDirty("completionStatus")&&(p.completionStatus=s.completionStatus,p.completionStatusKnown=!0,l.add("completionStatus")),m.writeRawScore&&s.rawScoreKnown&&s.isDirty("rawScore")&&(p.rawScore=s.rawScore,p.rawScoreKnown=!0,l.add("rawScore")),m.writeMinScore&&s.minScoreKnown&&s.isDirty("minScore")&&(p.minScore=s.minScore,p.minScoreKnown=!0,l.add("minScore")),m.writeMaxScore&&s.maxScoreKnown&&s.isDirty("maxScore")&&(p.maxScore=s.maxScore,p.maxScoreKnown=!0,l.add("maxScore")),m.writeProgressMeasure&&s.progressMeasureStatus&&s.isDirty("progressMeasure")&&(p.progressMeasure=s.progressMeasure,p.progressMeasureKnown=!0,l.add("progressMeasure")),m.updateAttemptData&&this.updateActivityAttemptData(e,p,s)}}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}var b=!0,S=!1,w=void 0;try{for(var O,C=l[Symbol.iterator]();!(b=(O=C.next()).done);b=!0)s.clearDirty(O.value)}catch(e){S=!0,w=e}finally{try{b||null==C.return||C.return()}finally{if(S)throw w}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}},{key:"syncGlobalObjectivesReadPhase",value:function(t,i){var objectives=t.getAllObjectives(),n=!0,r=!1,o=void 0;try{for(var a,s=objectives[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value,l=c.mapInfo.length>0?c.mapInfo:[this.createDefaultMapInfo(c)],u=!0,d=!1,f=void 0;try{for(var v,h=l[Symbol.iterator]();!(u=(v=h.next()).done);u=!0){var m,p=v.value,y=i.get(p.targetObjectiveID||c.id);if(y){var g=c.isPrimary,_=e.getGlobalObjectiveReadState(t,c,p,y);this.applyGlobalObjectiveReadState(c,_),g&&c.applyToActivity(t),null===(m=this.eventCallback)||void 0===m||m.call(this,"objective_synchronized",{activityId:t.id,objectiveId:c.id,globalState:y,synchronizationTime:(new Date).toISOString()})}}}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}},{key:"synchronizeGlobalObjectives",value:function(e,t){var objectives=e.getAllObjectives(),i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,c=s.mapInfo.length>0?s.mapInfo:[this.createDefaultMapInfo(s)],l=!0,u=!1,d=void 0;try{for(var f,v=c[Symbol.iterator]();!(l=(f=v.next()).done);l=!0){var h=f.value,m=this.ensureGlobalObjectiveEntry(t,h.targetObjectiveID||s.id,s);this.syncObjectiveState(e,s,h,m)}}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}},{key:"syncObjectiveState",value:function(t,i,n,r){try{var o,a=this.getLocalObjectiveState(t,i,i.isPrimary),s=e.getGlobalObjectiveReadState(t,i,n,r);if(this.applyGlobalObjectiveReadState(i,s),i.isPrimary&&i.applyToActivity(t),this.canWriteGlobalObjectives(t)){if(n.writeSatisfiedStatus&&this.hasKnownSatisfiedStatus(i)&&(r.satisfiedStatus=i.satisfiedStatus,r.satisfiedStatusKnown=!0),n.writeNormalizedMeasure&&i.measureStatus&&(r.normalizedMeasure=i.normalizedMeasure,r.normalizedMeasureKnown=!0,n.writeSatisfiedStatus&&i.satisfiedByMeasure)){var c,l,u=null!==(c=null!==(l=i.minNormalizedMeasure)&&void 0!==l?l:t.scaledPassingScore)&&void 0!==c?c:.7;r.satisfiedStatus=i.normalizedMeasure>=u,r.satisfiedStatusKnown=!0}n.writeCompletionStatus&&i.completionStatus!==ke&&(r.completionStatus=i.completionStatus,r.completionStatusKnown=!0),n.writeRawScore&&i.rawScoreKnown&&(r.rawScore=i.rawScore,r.rawScoreKnown=!0),n.writeMinScore&&i.minScoreKnown&&(r.minScore=i.minScore,r.minScoreKnown=!0),n.writeMaxScore&&i.maxScoreKnown&&(r.maxScore=i.maxScore,r.maxScoreKnown=!0),n.writeProgressMeasure&&i.progressMeasureStatus&&(r.progressMeasure=i.progressMeasure,r.progressMeasureKnown=!0),n.updateAttemptData&&this.updateActivityAttemptData(t,r,i)}null===(o=this.eventCallback)||void 0===o||o.call(this,"objective_synchronized",{activityId:t.id,objectiveId:i.id,localState:a,globalState:r,synchronizationTime:(new Date).toISOString()})}catch(e){var d;null===(d=this.eventCallback)||void 0===d||d.call(this,"objective_sync_error",{activityId:t.id,objectiveId:i.id,error:ur(e,Error)?e.message:e+"",timestamp:(new Date).toISOString()})}}},{key:"applyGlobalObjectiveReadState",value:function(e,t){e.applyReadMappedState(t)}},{key:"ensureGlobalObjectiveEntry",value:function(e,t,i){return e.has(t)||e.set(t,{id:t,satisfiedStatus:!1,satisfiedStatusKnown:!1,normalizedMeasure:0,normalizedMeasureKnown:!1,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasure:0,progressMeasureKnown:!1,completionStatus:ke,completionStatusKnown:!1,satisfiedByMeasure:i.satisfiedByMeasure,minNormalizedMeasure:i.minNormalizedMeasure}),e.get(t)}},{key:"createDefaultMapInfo",value:function(e){return{targetObjectiveID:e.id,readSatisfiedStatus:!1,writeSatisfiedStatus:!0,readNormalizedMeasure:!1,writeNormalizedMeasure:!0,readCompletionStatus:!1,writeCompletionStatus:!0,readProgressMeasure:!1,writeProgressMeasure:!0,readRawScore:!1,writeRawScore:!1,readMinScore:!1,writeMinScore:!1,readMaxScore:!1,writeMaxScore:!1,updateAttemptData:e.isPrimary}}},{key:"hasKnownSatisfiedStatus",value:function(e){return e.progressStatus||e.satisfiedStatusKnown}},{key:"canWriteGlobalObjectives",value:function(e){return!1!==e.sequencingControls.tracked}},{key:"getLocalObjectiveState",value:function(e,t,i){return i?{id:t.id,satisfiedStatus:e.objectiveSatisfiedStatus,measureStatus:e.objectiveMeasureStatus,normalizedMeasure:e.objectiveNormalizedMeasure,rawScore:t.rawScore,rawScoreKnown:t.rawScoreKnown,minScore:t.minScore,minScoreKnown:t.minScoreKnown,maxScore:t.maxScore,maxScoreKnown:t.maxScoreKnown,progressMeasure:e.progressMeasure,progressMeasureStatus:e.progressMeasureStatus,completionStatus:e.completionStatus,scaledPassingScore:e.scaledPassingScore}:{id:t.id,satisfiedStatus:t.satisfiedStatus,measureStatus:t.measureStatus,normalizedMeasure:t.normalizedMeasure,rawScore:t.rawScore,rawScoreKnown:t.rawScoreKnown,minScore:t.minScore,minScoreKnown:t.minScoreKnown,maxScore:t.maxScore,maxScoreKnown:t.maxScoreKnown,progressMeasure:t.progressMeasure,progressMeasureStatus:t.progressMeasureStatus,completionStatus:t.completionStatus,scaledPassingScore:t.minNormalizedMeasure}}},{key:"updateActivityAttemptData",value:function(e,t,i){try{if(!i.isPrimary&&!t.updateAttemptData)return;var n=e.rollupRules.rules.some(function(e){return"completed"===e.action||"incomplete"===e.action});t.satisfiedStatusKnown&&t.satisfiedStatus&&(n||e.sequencingControls.completionSetByContent||e.attemptProgressStatus||e.completionStatus!==ke&&e.completionStatus!==Ae||(e.completionStatus=Ee),"unknown"===e.successStatus&&(e.successStatus="passed")),t.attemptCount&&t.attemptCount>e.attemptCount&&(e.attemptCount=t.attemptCount),t.progressMeasureKnown&&void 0!==t.progressMeasure&&(e.attemptCompletionAmount=t.progressMeasure),t.attemptAbsoluteDuration&&(e.attemptAbsoluteDuration=t.attemptAbsoluteDuration),t.attemptExperiencedDuration&&(e.attemptExperiencedDuration=t.attemptExperiencedDuration),t.activityAbsoluteDuration&&(e.activityAbsoluteDuration=t.activityAbsoluteDuration),t.activityExperiencedDuration&&(e.activityExperiencedDuration=t.activityExperiencedDuration),void 0!==t.location&&(e.location=t.location),void 0!==t.suspendData&&(e.isSuspended=t.suspendData.length>0)}catch(t){var r;null===(r=this.eventCallback)||void 0===r||r.call(this,"attempt_data_update_error",{activityId:e.id,error:ur(t,Error)?t.message:t+"",timestamp:(new Date).toISOString()})}}}])&&lr(t.prototype,i),n&&lr(t,n),e}();function vr(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}var hr=Object.defineProperty,mr=function(e,t,i){return function(e,t,i){return t in e?hr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},pr=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),mr(this,"rollupStateLog",[]),mr(this,"childFilter"),mr(this,"eventCallback"),this.childFilter=t,this.eventCallback=i||null}return t=e,(i=[{key:"validateRollupStateConsistency",value:function(e){try{var t,i;null===(t=this.eventCallback)||void 0===t||t.call(this,"rollup_validation_started",{activityId:e.id,timestamp:(new Date).toISOString()});var n,r=[];return this.validateActivityRollupState(e,r),r.length>0?(null===(n=this.eventCallback)||void 0===n||n.call(this,"rollup_state_inconsistencies",{activityId:e.id,inconsistencies:r,count:r.length}),!1):(null===(i=this.eventCallback)||void 0===i||i.call(this,"rollup_validation_completed",{activityId:e.id,result:"consistent"}),!0)}catch(t){var o;return null===(o=this.eventCallback)||void 0===o||o.call(this,"rollup_validation_error",{activityId:e.id,error:(a=t,s=Error,(null!=s&&"undefined"!=typeof Symbol&&s[Symbol.hasInstance]?s[Symbol.hasInstance](a):a instanceof s)?t.message:t+"")}),!1}var a,s}},{key:"validateActivityRollupState",value:function(e,t){var i=this,n=e.id;e.objectiveMeasureStatus&&null===e.objectiveNormalizedMeasure&&t.push("Activity ".concat(n,": measure status true but normalized measure is null")),e.objectiveMeasureStatus&&null!==e.scaledPassingScore&&"unknown"!==e.successStatus&&e.objectiveSatisfiedStatus!==e.objectiveNormalizedMeasure>=e.scaledPassingScore&&t.push("Activity ".concat(n,": satisfaction status inconsistent with measure"));var r=e.sequencingControls,o=e.getAvailableChildren();if(o.length>0&&r.rollupObjectiveSatisfied){var a=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"objective","satisfied")&&i.childFilter.isChildSatisfiedForRollup(e)}),s=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"objective","notSatisfied")&&!i.childFilter.isChildSatisfiedForRollup(e)});a.length>0&&0===s.length&&!1===e.objectiveSatisfiedStatus&&0===e.rollupRules.rules.length&&t.push("Activity ".concat(n,": all children satisfied but parent is not satisfied (no rollup rules to override)"))}if(o.length>0&&r.rollupProgressCompletion){var c=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"progress","completed")&&i.childFilter.isChildCompletedForRollup(e)}),l=o.filter(function(e){return i.childFilter.checkChildForRollupSubprocess(e,"progress","incomplete")&&!i.childFilter.isChildCompletedForRollup(e)});c.length>0&&0===l.length&&"completed"!==e.completionStatus&&0===e.rollupRules.rules.length&&t.push("Activity ".concat(n,": all children completed but parent is incomplete (no rollup rules to override)"))}var u=!0,d=!1,f=void 0;try{for(var v,h=o[Symbol.iterator]();!(u=(v=h.next()).done);u=!0)this.validateActivityRollupState(v.value,t)}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}this.rollupStateLog.push({activity:n,timestamp:(new Date).toISOString(),state:{measureStatus:e.objectiveMeasureStatus,measure:e.objectiveNormalizedMeasure,satisfiedStatus:e.objectiveSatisfiedStatus,completionStatus:e.completionStatus}})}},{key:"getRollupStateLog",value:function(){return function(e){if(Array.isArray(e))return vr(e)}(e=this.rollupStateLog)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return vr(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?vr(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();var e}},{key:"clearRollupStateLog",value:function(){this.rollupStateLog=[]}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var yr=Object.defineProperty,gr=function(e,t,i){return function(e,t,i){return t in e?yr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},_r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),gr(this,"childFilter"),gr(this,"ruleEvaluator"),gr(this,"measureProcessor"),gr(this,"objectiveProcessor"),gr(this,"progressProcessor"),gr(this,"durationProcessor"),gr(this,"globalObjectiveSynchronizer"),gr(this,"stateValidator"),gr(this,"crossClusterProcessor"),gr(this,"eventCallback"),this.eventCallback=t||null,this.childFilter=new Kn,this.ruleEvaluator=new Wn(this.childFilter),this.measureProcessor=new Xn(this.childFilter,t),this.objectiveProcessor=new er(this.childFilter,this.ruleEvaluator,t),this.progressProcessor=new nr(this.childFilter,this.ruleEvaluator,this.objectiveProcessor,t),this.durationProcessor=new or(t),this.globalObjectiveSynchronizer=new fr(t),this.stateValidator=new pr(this.childFilter,t),this.crossClusterProcessor=new cr(this.measureProcessor,this.objectiveProcessor,this.progressProcessor,t)}return t=e,(i=[{key:"overallRollupProcess",value:function(e){for(var t=[],i=e.parent,n=!1,r=!0;i;){if(i.children.length>0&&this.durationProcessor.durationRollupProcess(i),!n){var o=i.captureRollupStatus();if(i.sequencingControls.rollupObjectiveSatisfied||i.sequencingControls.rollupProgressCompletion){if(i.children.length>0){var a=this.measureProcessor.measureRollupProcess(i);this.measureProcessor.completionMeasureRollupProcess(i),a.length>1&&this.crossClusterProcessor.processCrossClusterDependencies(i,a)}i.sequencingControls.rollupObjectiveSatisfied&&this.objectiveProcessor.objectiveRollupProcess(i),i.sequencingControls.rollupProgressCompletion&&this.progressProcessor.activityProgressRollupProcess(i)}var s,c=i.captureRollupStatus();r||Gn.compareRollupStatus(o,c)&&(null===(s=this.eventCallback)||void 0===s||s.call(this,"rollup_optimization_activated",{activityId:i.id,depth:t.length}),n=!0),!r&&Gn.compareRollupStatus(o,c)||t.push(i)}i=i.parent,r=!1}return t}},{key:"validateRollupStateConsistency",value:function(e){return this.stateValidator.validateRollupStateConsistency(e)}},{key:"processGlobalObjectiveMapping",value:function(e,t){this.globalObjectiveSynchronizer.processGlobalObjectiveMapping(e,t)}},{key:"calculateComplexWeightedMeasure",value:function(e,t,i){return this.measureProcessor.calculateComplexWeightedMeasure(e,t,i)}},{key:"processCrossClusterDependencies",value:function(e,t){this.crossClusterProcessor.processCrossClusterDependencies(e,t)}},{key:"getChildFilter",value:function(){return this.childFilter}},{key:"getRuleEvaluator",value:function(){return this.ruleEvaluator}},{key:"getMeasureProcessor",value:function(){return this.measureProcessor}},{key:"getObjectiveProcessor",value:function(){return this.objectiveProcessor}},{key:"getProgressProcessor",value:function(){return this.progressProcessor}},{key:"getDurationProcessor",value:function(){return this.durationProcessor}},{key:"getGlobalObjectiveSynchronizer",value:function(){return this.globalObjectiveSynchronizer}},{key:"getStateValidator",value:function(){return this.stateValidator}},{key:"getCrossClusterProcessor",value:function(){return this.crossClusterProcessor}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function br(e){var t=e.completionThreshold,i=e.progressMeasure,n=e.storedCompletionStatus;if(""!==t&&null!=t){var r=parseFloat(t+"");if(!isNaN(r)){if(""!==i&&null!=i){var o=parseFloat(i+"");if(!isNaN(o))return r>o?Ae:Ee}return ke}}return n||ke}var Sr=Object.defineProperty,wr=[Ee,Ae,ke],Or=[we,Oe,Ce];function Cr(e){return e&&wr.includes(e)?e:null}function Er(e){return e&&Or.includes(e)?e:null}var Ar=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?Sr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="context")?i+"":i,n),this.context=t}return t=e,(i=[{key:"transferRteData",value:function(e){if(this.context.getCMIData){var t=this.context.getCMIData();t&&(this.transferPrimaryObjective(e,t),this.transferNonPrimaryObjectives(e,t),this.context.fireEvent("onRteDataTransfer",{activityId:e.id,timestamp:(new Date).toISOString()}))}}},{key:"transferPrimaryObjective",value:function(e,t){var i=!1;if(t.progress_measure&&""!==t.progress_measure){var n=parseFloat(t.progress_measure);isNaN(n)||(i=!0,e.progressMeasure=n,e.progressMeasureStatus=!0,e.attemptCompletionAmount=n,e.attemptCompletionAmountStatus=!0,e.primaryObjective&&(e.primaryObjective.progressMeasure=n,e.primaryObjective.progressMeasureStatus=!0))}if(i||(e.attemptCompletionAmountStatus=!1),e.completedByMeasure){var r=br({completionThreshold:e.minProgressMeasure,progressMeasure:t.progress_measure,storedCompletionStatus:ke});e.completionStatus=r,e.attemptProgressStatus=r!==ke}else{var o=Cr(t.completion_status);o&&o!==ke&&(e.completionStatus=o,e.attemptProgressStatus=!0)}var a=!1,s=!1,c=!1,l=0,u=Er(t.success_status);if(u&&u!==Ce&&(a=!0,e.objectiveSatisfiedStatus=s=u===we,e.objectiveSatisfiedStatusKnown=!0,e.successStatus=u),t.score){var d;null===(d=e.primaryObjective)||void 0===d||d.initializeScoreFromCMI(this.getObjectiveScoreState(t.score));var f=this.normalizeScore(t.score);null!==f&&(c=!0,e.objectiveNormalizedMeasure=l=f,e.objectiveMeasureStatus=!0)}e.primaryObjective&&(a||c)&&(e.primaryObjective.initializeFromCMI(a?s:e.primaryObjective.satisfiedStatus,c?l:e.primaryObjective.normalizedMeasure,c),a&&(e.primaryObjective.satisfiedStatusKnown=!0,e.primaryObjective.progressStatus=!0))}},{key:"transferNonPrimaryObjectives",value:function(e,t){if(t.objectives&&0!==t.objectives.length){var i=!0,n=!1,r=void 0;try{for(var o,a=t.objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.id){var c=e.getObjectiveById(s.id);if(c){var l=c.objective,u=c.isPrimary,d=!1,f=!1,v=!1,h=0,m=!1,p=!1,y=Er(s.success_status);y&&y!==Ce&&(f=y===we,d=!0,l.progressStatus=!0);var g=Cr(s.completion_status);if(g&&g!==ke&&(l.completionStatus=g,m=!0),s.score){l.initializeScoreFromCMI(this.getObjectiveScoreState(s.score));var _=this.normalizeScore(s.score);null!==_&&(h=_,v=!0)}if((d||v)&&(l.initializeFromCMI(d?f:l.satisfiedStatus,v?h:l.normalizedMeasure,v),d&&(l.satisfiedStatusKnown=!0)),s.progress_measure&&""!==s.progress_measure){var b=parseFloat(s.progress_measure);isNaN(b)||(l.progressMeasure=b,l.progressMeasureStatus=!0,p=!0)}u&&(d||v||m||p)&&(l.applyToActivity(e),y&&y!==Ce&&(e.successStatus=y),m&&(e.attemptProgressStatus=!0),p&&(e.attemptCompletionAmount=l.progressMeasure,e.attemptCompletionAmountStatus=!0))}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}},{key:"normalizeScore",value:function(score){if(score.scaled&&""!==score.scaled){var e=parseFloat(score.scaled);if(!isNaN(e))return e}if(score.raw&&""!==score.raw&&score.min&&""!==score.min&&score.max&&""!==score.max){var t=parseFloat(score.raw),i=parseFloat(score.min),n=parseFloat(score.max);if(!isNaN(t)&&!isNaN(i)&&!isNaN(n)&&n>i)return Math.max(-1,Math.min(1,(t-i)/(n-i)))}return null}},{key:"getObjectiveScoreState",value:function(score){var e={};return void 0!==score.raw&&(e.rawScore=score.raw),void 0!==score.min&&(e.minScore=score.min),void 0!==score.max&&(e.maxScore=score.max),e}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var kr=Object.defineProperty,jr=function(e,t,i){return function(e,t,i){return t in e?kr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Rr=function(){function e(t,i,n,r){var o=this,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5?arguments[5]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),jr(this,"activityTree"),jr(this,"sequencingProcess"),jr(this,"rollupProcess"),jr(this,"globalObjectiveMap"),jr(this,"eventCallback"),jr(this,"getCMIData"),jr(this,"is4thEdition"),jr(this,"invalidateCacheCallback",null),jr(this,"_rteDataTransferService"),this.activityTree=t,this.sequencingProcess=i,this.rollupProcess=n,this.globalObjectiveMap=r,this.eventCallback=a,this.getCMIData=(null==s?void 0:s.getCMIData)||null,this.is4thEdition=(null==s?void 0:s.is4thEdition)||!1,this._rteDataTransferService=new Ar({getCMIData:this.getCMIData,fireEvent:function(e,t){return o.fireEvent(e,t)}})}return t=e,i=[{key:"setInvalidateCacheCallback",value:function(e){this.invalidateCacheCallback=e}},{key:"processTerminationRequest",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=arguments.length>2?arguments[2]:void 0,i=this.activityTree.currentActivity;if(!i)return{terminationRequest:request,sequencingRequest:null,exception:"TB.2.3-1",valid:!1};if((request===qt.EXIT||request===qt.ABANDON)&&!i.isActive)return{terminationRequest:request,sequencingRequest:null,exception:"TB.2.3-2",valid:!1};if(this.fireEvent("onTerminationRequestProcessing",{request:request,hasSequencingRequest:e,currentActivity:i.id,exitType:t}),"logout"===t)return this.fireEvent("onSequencingDebug",{message:"cmi.exit='logout' detected, treating as EXIT_ALL",activityId:i.id}),this.handleExitAll(i);switch(request){case qt.EXIT:return this.handleExit(i,e);case qt.EXIT_ALL:return this.handleExitAll(i);case qt.ABANDON:return this.handleAbandon(i,e);case qt.ABANDON_ALL:return this.handleAbandonAll(i);case qt.SUSPEND_ALL:return this.handleSuspendAll(i);default:return{terminationRequest:request,sequencingRequest:null,exception:"TB.2.3-7",valid:!1}}}},{key:"handleExitTermination",value:function(e,t){return this.handleExit(e,t)}},{key:"handleExit",value:function(e,t){e.children.length>0&&this.terminateDescendants(e),this.endAttempt(e);var i=this.evaluateExitRules(e);if("EXIT_ALL"===i.action)return this.handleExitAll(e);"EXIT_PARENT"===i.action&&e.parent&&(this.activityTree.currentActivity=e.parent,this.endAttempt(this.activityTree.currentActivity));var n,r,o=this.applyAncestorExitActionRules(e);if("EXIT_ALL"===o.action)return this.handleExitAll(o.activity||e);if(o.exception)return{terminationRequest:qt.EXIT,sequencingRequest:null,exception:o.exception,valid:!1};do{if(n=!1,(r=this.evaluatePostConditions(this.activityTree.currentActivity||e)).terminationRequest===qt.EXIT_ALL)return this.fireEvent("onPostConditionExitAll",{activity:(this.activityTree.currentActivity||e).id}),this.handleExitAll(this.activityTree.root);if(r.terminationRequest===qt.EXIT_PARENT){var a=this.activityTree.currentActivity||e;if(!a.parent)return{terminationRequest:qt.EXIT_PARENT,sequencingRequest:null,exception:"TB.2.3-4",valid:!1};this.activityTree.currentActivity=a.parent,this.endAttempt(this.activityTree.currentActivity),n=!0,this.fireEvent("onPostConditionExitParent",{fromActivity:a.id,toActivity:this.activityTree.currentActivity.id})}if(!n&&(this.activityTree.currentActivity||e)===this.activityTree.root&&r.sequencingRequest!==qt.RETRY)return{terminationRequest:qt.EXIT,sequencingRequest:qt.EXIT,exception:null,valid:!0}}while(n);return{terminationRequest:qt.EXIT,sequencingRequest:r.sequencingRequest,exception:null,valid:!0}}},{key:"handleExitAll",value:function(e){return this.activityTree.root&&this.handleMultiLevelExit(this.activityTree.root),this.activityTree.root&&this.endAttempt(this.activityTree.root),this.activityTree.currentActivity=null,this.cleanupSuspendedActivity(),{terminationRequest:qt.EXIT_ALL,sequencingRequest:qt.EXIT,exception:null,valid:!0}}},{key:"handleAbandon",value:function(e,t){return e.isActive=!1,t||(this.activityTree.currentActivity=e.parent),{terminationRequest:qt.ABANDON,sequencingRequest:null,exception:null,valid:!0}}},{key:"handleAbandonAll",value:function(e){for(var t=[],i=e;null!==i;)t.push(i),i=i.parent;if(0===t.length)return{terminationRequest:qt.ABANDON_ALL,sequencingRequest:null,exception:"TB.2.3-6",valid:!1};var n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)a.value.isActive=!1}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return this.activityTree.currentActivity=null,this.cleanupSuspendedActivity(),{terminationRequest:qt.ABANDON_ALL,sequencingRequest:null,exception:null,valid:!0}}},{key:"handleSuspendAll",value:function(e){var t=this.processSuspendAllRequest(e);return t.valid?{terminationRequest:qt.SUSPEND_ALL,sequencingRequest:qt.EXIT,exception:null,valid:!0}:t}},{key:"processSuspendAllRequest",value:function(e){var t=this.activityTree.root;if(!e||!t)return this.fireEvent("onSuspendError",{exception:"TB.2.3-1",message:"No current activity to suspend",activity:null==e?void 0:e.id}),{terminationRequest:qt.SUSPEND_ALL,sequencingRequest:null,exception:"TB.2.3-1",valid:!1};if(e===t&&!e.isActive&&!e.isSuspended)return this.fireEvent("onSuspendError",{exception:"TB.2.3-3",message:"Nothing to suspend (root activity)",activity:e.id}),{terminationRequest:qt.SUSPEND_ALL,sequencingRequest:null,exception:"TB.2.3-3",valid:!1};this.activityTree.suspendedActivity=e;for(var i=e,n=[],r=i;null!==r;)n.push(r),r=r.parent;if(0===n.length)return this.fireEvent("onSuspendError",{exception:"TB.2.3-5",message:"Activity path is empty",activity:null==i?void 0:i.id}),{terminationRequest:qt.SUSPEND_ALL,sequencingRequest:null,exception:"TB.2.3-5",valid:!1};var o=!0,a=!1,s=void 0;try{for(var c,l=n[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value;u.isActive=!1,u.isSuspended=!0}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}return this.activityTree.currentActivity=t,t.isActive=!1,this.fireEvent("onActivitySuspended",{activity:null==i?void 0:i.id,suspendedPath:n.map(function(e){return e.id}),pathLength:n.length,timestamp:(new Date).toISOString()}),{terminationRequest:qt.SUSPEND_ALL,sequencingRequest:null,exception:null,valid:!0}}},{key:"evaluateExitRules",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t++;var i=e.sequencingRules.exitConditionRules,n=!0,r=!1,o=void 0;try{for(var a,s=i[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;if(c.evaluate(e)){if(c.action===Ct.EXIT)return{action:"EXIT",recursionDepth:t};if(c.action===Ct.EXIT_PARENT)return{action:"EXIT_PARENT",recursionDepth:t};if(c.action===Ct.EXIT_ALL)return{action:"EXIT_ALL",recursionDepth:t}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return{action:null,recursionDepth:t}}},{key:"evaluatePostConditions",value:function(e){var t=this.sequencingProcess.evaluatePostConditionRules(e);return(t.sequencingRequest||t.terminationRequest)&&this.fireEvent("onPostConditionEvaluated",{activity:e.id,sequencingRequest:t.sequencingRequest,terminationRequest:t.terminationRequest,timestamp:(new Date).toISOString()}),t}},{key:"handleMultiLevelExit",value:function(e){this.processExitAtLevel(e,0),this.terminateAll(e)}},{key:"applyAncestorExitActionRules",value:function(e){for(var t=[],i=e.parent;i;)t.unshift(i),i=i.parent;var n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value,l=this.exitActionRulesSubprocess(c);if("EXIT_ALL"===l)return this.fireEvent("onAncestorExitAction",{activity:c.id,action:l}),{action:"EXIT_ALL",activity:c};if("EXIT_PARENT"===l)return c.parent?(this.terminateDescendants(c.parent),this.activityTree.currentActivity=c.parent,this.endAttempt(c.parent),this.fireEvent("onAncestorExitAction",{activity:c.id,action:l,currentActivity:c.parent.id}),{action:"EXIT_PARENT",activity:c.parent}):{action:"EXIT_PARENT",activity:c,exception:"TB.2.3-4"};if("EXIT"===l)return this.terminateDescendants(c),this.activityTree.currentActivity=c,this.endAttempt(c),this.fireEvent("onAncestorExitAction",{activity:c.id,action:l}),{action:"EXIT",activity:c}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return{action:null}}},{key:"processExitAtLevel",value:function(e,t){var i=this.evaluateExitRules(e,0);i.action&&this.fireEvent("onMultiLevelExitAction",{activity:e.id,level:t,action:i.action});var n=!0,r=!1,o=void 0;try{for(var a,s=e.children[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)this.processExitAtLevel(a.value,t+1)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}},{key:"cleanupSuspendedActivity",value:function(){var e=this.activityTree.suspendedActivity;if(e){for(var t=e,i=[];t;)t.isSuspended&&(t.isSuspended=!1,i.push(t.id)),t=t.parent;this.activityTree.suspendedActivity=null,this.fireEvent("onSuspendedActivityCleanup",{cleanedActivities:i,originalSuspendedActivity:e.id})}}},{key:"terminateAll",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this.terminateAll(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}e.isActive&&this.endAttempt(e)}},{key:"terminateDescendants",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;a.children.length>0&&this.terminateDescendants(a);var s=this.exitActionRulesSubprocess(a);a.isActive&&("EXIT_ALL"===s&&this.terminateDescendants(a),this.endAttempt(a))}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"exitActionRulesSubprocess",value:function(e){var t=e.sequencingRules.exitConditionRules,i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.evaluate(e)){if(s.action===Ct.EXIT)return"EXIT";if(s.action===Ct.EXIT_PARENT)return"EXIT_PARENT";if(s.action===Ct.EXIT_ALL)return"EXIT_ALL"}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"clearSuspendedActivity",value:function(){if(this.activityTree.suspendedActivity){for(var e=this.activityTree.suspendedActivity;e;)e.isSuspended=!1,e=e.parent;this.activityTree.suspendedActivity=null}}},{key:"endAttempt",value:function(e){if(e.isActive){if(this._rteDataTransferService.transferRteData(e),e.isActive=!1,e.activityAttemptActive=!1,0===e.children.length){if(!e.isSuspended&&(e.sequencingControls.completionSetByContent||e.attemptProgressStatus||(e.attemptProgressStatus=!0,e.completionStatus="completed",e.wasAutoCompleted=!0,this.fireEvent("onAutoCompletion",{activityId:e.id,timestamp:(new Date).toISOString()})),!e.sequencingControls.objectiveSetByContent)){var t=e.primaryObjective;t&&(t.progressStatus||(t.progressStatus=!0,t.satisfiedStatus=!0,e.objectiveSatisfiedStatus=!0,e.successStatus="passed",e.wasAutoSatisfied=!0,this.fireEvent("onAutoSatisfaction",{activityId:e.id,timestamp:(new Date).toISOString()})))}}else{var i=e.children.some(function(e){return e.isSuspended});e.isSuspended=i}"unknown"===e.completionStatus&&(e.completionStatus="incomplete"),"unknown"===e.successStatus&&e.objectiveSatisfiedStatus&&(e.successStatus=e.objectiveSatisfiedStatus?"passed":"failed"),this.rollupProcess.processGlobalObjectiveMapping(this.activityTree.root||e,this.globalObjectiveMap),this.rollupProcess.overallRollupProcess(e),this.invalidateCacheCallback&&this.invalidateCacheCallback(),this.activityTree.root&&this.rollupProcess.validateRollupStateConsistency(this.activityTree.root),ni.applySelectionAndRandomization(e,!1)}}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Mr(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Tr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xr(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ir(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){xr(e,t,i[t])})}return e}function Pr(e){return function(e){if(Array.isArray(e))return Mr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Mr(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Mr(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Nr=Object.defineProperty,Dr=function(e,t,i){return function(e,t,i){return t in e?Nr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},qr=function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;Tr(this,e),Dr(this,"valid"),Dr(this,"targetActivity"),Dr(this,"exception"),this.valid=t,this.targetActivity=i,this.exception=n},Lr=function(){function e(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5?arguments[5]:void 0;Tr(this,e),Dr(this,"activityTree"),Dr(this,"rollupProcess"),Dr(this,"globalObjectiveMap"),Dr(this,"adlNav"),Dr(this,"eventCallback"),Dr(this,"now"),Dr(this,"defaultHideLmsUi"),Dr(this,"defaultAuxiliaryResources"),Dr(this,"_deliveryInProgress",!1),Dr(this,"contentDelivered",!1),Dr(this,"checkActivityCallback",null),Dr(this,"invalidateCacheCallback",null),Dr(this,"updateNavigationValidityCallback",null),Dr(this,"clearSuspendedActivityCallback",null),this.activityTree=t,this.rollupProcess=i,this.globalObjectiveMap=n,this.adlNav=r,this.eventCallback=o,this.now=(null==a?void 0:a.now)||function(){return new Date},this.defaultHideLmsUi=(null==a?void 0:a.defaultHideLmsUi)?Pr(a.defaultHideLmsUi):[],this.defaultAuxiliaryResources=(null==a?void 0:a.defaultAuxiliaryResources)?a.defaultAuxiliaryResources.map(function(e){return Ir({},e)}):[]}return t=e,i=[{key:"setCheckActivityCallback",value:function(e){this.checkActivityCallback=e}},{key:"setInvalidateCacheCallback",value:function(e){this.invalidateCacheCallback=e}},{key:"setUpdateNavigationValidityCallback",value:function(e){this.updateNavigationValidityCallback=e}},{key:"setClearSuspendedActivityCallback",value:function(e){this.clearSuspendedActivityCallback=e}},{key:"isDeliveryInProgress",value:function(){return this._deliveryInProgress}},{key:"hasContentBeenDelivered",value:function(){return this.contentDelivered}},{key:"resetContentDelivered",value:function(){this.contentDelivered=!1}},{key:"setContentDelivered",value:function(e){this.contentDelivered=e}},{key:"processDeliveryRequest",value:function(e){if(this.fireEvent("onDeliveryRequestProcessing",{activity:e.id,timestamp:(new Date).toISOString()}),e.children.length>0)return new qr(!1,null,"DB.1.1-1");var t=this.getActivityPath(e,!0);if(0===t.length)return new qr(!1,null,"DB.1.1-2");var i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(this.checkActivityCallback&&!this.checkActivityCallback(o.value))return new qr(!1,null,"DB.1.1-3")}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return new qr(!0,e)}},{key:"contentDeliveryEnvironmentProcess",value:function(e){this._deliveryInProgress=!0;try{var t=e.isSuspended;this.activityTree.suspendedActivity&&this.clearSuspendedActivityCallback&&this.clearSuspendedActivityCallback();var i=this.getActivityPath(e,!0),n=!0,r=!1,o=void 0;try{for(var a,s=i[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;c.isActive||(t||c.isSuspended?c.isSuspended=!1:c.incrementAttemptCount(),c.isActive=!0,ni.applySelectionAndRandomization(c,1>=c.attemptCount))}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}this.activityTree.currentActivity=e,this.initializeForDelivery(e),this.setupAttemptTracking(e),this.contentDelivered=!0,this.adlNav&&this.updateNavigationValidityCallback&&this.updateNavigationValidityCallback(),this.fireDeliveryEvent(e)}finally{this._deliveryInProgress=!1}}},{key:"initializeForDelivery",value:function(e){"unknown"===e.completionStatus&&0===e.children.length&&(e.completionStatus="not attempted"),null===e.objectiveSatisfiedStatus&&(e.objectiveSatisfiedStatus=!1),null===e.progressMeasure&&(e.progressMeasure=0,e.progressMeasureStatus=!1),null===e.objectiveNormalizedMeasure&&(e.objectiveNormalizedMeasure=0,e.objectiveMeasureStatus=!1),e.attemptAbsoluteDuration="PT0H0M0S",e.attemptExperiencedDuration="PT0H0M0S",e.isAvailable=!0}},{key:"setupAttemptTracking",value:function(e){e.wasSkipped=!1,e.attemptAbsoluteStartTime=this.now().toISOString(),e.location||(e.location=""),e.activityAttemptActive=!0,e.learnerPrefs||(e.learnerPrefs={audioCaptioning:"0",audioLevel:"1",deliverySpeed:"1",language:""})}},{key:"fireDeliveryEvent",value:function(e){try{this.eventCallback&&this.eventCallback("onActivityDelivery",e),console.debug("Activity delivered: ".concat(e.id," - ").concat(e.title))}catch(e){console.warn("Failed to fire activity delivery event: ".concat(e))}}},{key:"getEffectiveHideLmsUi",value:function(t){var i=new Set,n=!0,r=!1,o=void 0;try{for(var a,s=this.defaultHideLmsUi[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)i.add(a.value)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}for(var c=t;c;){var l=!0,u=!1,d=void 0;try{for(var f,v=c.hideLmsUi[Symbol.iterator]();!(l=(f=v.next()).done);l=!0)i.add(f.value)}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}c=c.parent}return e.HIDE_LMS_UI_ORDER.filter(function(e){return i.has(e)})}},{key:"getEffectiveAuxiliaryResources",value:function(e){var t=new Map,i=!0,n=!1,r=void 0;try{for(var o,a=this.defaultAuxiliaryResources[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.resourceId&&t.set(s.resourceId,Ir({},s))}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}for(var c=[],l=e;l;)c.push(l),l=l.parent;var u=!0,d=!1,f=void 0;try{for(var v,h=c.reverse()[Symbol.iterator]();!(u=(v=h.next()).done);u=!0){var m=v.value,p=!0,y=!1,g=void 0;try{for(var _,b=m.auxiliaryResources[Symbol.iterator]();!(p=(_=b.next()).done);p=!0){var S=_.value;S.resourceId&&t.set(S.resourceId,Ir({},S))}}catch(e){y=!0,g=e}finally{try{p||null==b.return||b.return()}finally{if(y)throw g}}}}catch(e){d=!0,f=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw f}}return Array.from(t.values())}},{key:"getContentActivityData",value:function(e){var t;return{hideLmsUi:this.getEffectiveHideLmsUi(e),auxiliaryResources:this.getEffectiveAuxiliaryResources(e),location:e.location||"",credit:e.credit||"credit",launchData:e.launchData||"",maxTimeAllowed:e.attemptAbsoluteDurationLimit||"",completionThreshold:(null===(t=e.completionThreshold)||void 0===t?void 0:""+t)||"",timeLimitAction:e.timeLimitAction||"continue,no message"}}},{key:"getActivityPath",value:function(e){for(var t=1>=arguments.length||void 0===arguments[1]||arguments[1],i=[],n=e;null!==n;)i.unshift(n),n=n.parent;return!t&&i.length>0&&i.pop(),i}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();Dr(Lr,"HIDE_LMS_UI_ORDER",Pr(dt));var zr=Lr;var Fr=Object.defineProperty,Br=function(e,t,i){return function(e,t,i){return t in e?Fr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Vr=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Br(this,"activityTree"),Br(this,"sequencingProcess"),Br(this,"cache",null),Br(this,"isDirty",!0),this.activityTree=t,this.sequencingProcess=i}return t=e,(i=[{key:"predictContinueEnabled",value:function(){var e,t;return this.ensureCacheValid(),null!==(e=null===(t=this.cache)||void 0===t?void 0:t.continueEnabled)&&void 0!==e&&e}},{key:"predictPreviousEnabled",value:function(){var e,t;return this.ensureCacheValid(),null!==(e=null===(t=this.cache)||void 0===t?void 0:t.previousEnabled)&&void 0!==e&&e}},{key:"predictChoiceEnabled",value:function(e){var t,i;return this.ensureCacheValid(),null!==(t=null===(i=this.cache)||void 0===i?void 0:i.choiceEnabledMap.get(e))&&void 0!==t&&t}},{key:"getAvailableChoices",value:function(){var e,t;return this.ensureCacheValid(),Array.from(null!==(e=null===(t=this.cache)||void 0===t?void 0:t.availableChoices)&&void 0!==e?e:[])}},{key:"getAllPredictions",value:function(){var e,t,i,n,r,o;return this.ensureCacheValid(),{continueEnabled:null!==(e=null===(n=this.cache)||void 0===n?void 0:n.continueEnabled)&&void 0!==e&&e,previousEnabled:null!==(t=null===(r=this.cache)||void 0===r?void 0:r.previousEnabled)&&void 0!==t&&t,availableChoices:Array.from(null!==(i=null===(o=this.cache)||void 0===o?void 0:o.availableChoices)&&void 0!==i?i:[])}}},{key:"invalidateCache",value:function(){this.isDirty=!0}},{key:"updateCache",value:function(){this.isDirty=!0,this.ensureCacheValid()}},{key:"ensureCacheValid",value:function(){var e=this.calculateTreeStateHash();!this.isDirty&&this.cache&&this.cache.treeStateHash===e||(this.recalculateCache(e),this.isDirty=!1)}},{key:"recalculateCache",value:function(e){var t=this.activityTree.currentActivity;this.cache={continueEnabled:!1,previousEnabled:!1,availableChoices:new Set,choiceEnabledMap:new Map,treeStateHash:e},t?(this.cache.continueEnabled=this.predictContinueInternal(t),this.cache.previousEnabled=this.predictPreviousInternal(t),this.calculateAvailableChoices()):this.calculateAvailableChoicesFromRoot()}},{key:"predictContinueInternal",value:function(e){return!!e.parent&&!!e.parent.sequencingControls.flow&&this.hasAvailableNextActivity(e)}},{key:"hasAvailableNextActivity",value:function(e){var t=e.parent;if(!t)return!1;var i=t.children,n=i.indexOf(e);if(-1===n)return!1;if(i.length-1>n)for(var r=n+1;i.length>r;r++){var o=i[r];if(o&&this.isActivityPotentiallyDeliverableForward(o))return!0}return!(!t.parent||!t.sequencingControls.flow)&&this.hasAvailableNextActivity(t)}},{key:"predictPreviousInternal",value:function(e){return!!e.parent&&!!e.parent.sequencingControls.flow&&!e.parent.sequencingControls.forwardOnly&&this.hasAvailablePreviousActivity(e)}},{key:"hasAvailablePreviousActivity",value:function(e){var t=e.parent;if(!t)return!1;var i=t.children,n=i.indexOf(e);if(-1===n)return!1;if(n>0)for(var r=n-1;r>=0;r--){var o=i[r];if(o&&this.isActivityPotentiallyDeliverableBackward(o))return!0}return!(!t.parent||!t.sequencingControls.flow||t.sequencingControls.forwardOnly)&&this.hasAvailablePreviousActivity(t)}},{key:"calculateAvailableChoicesFromRoot",value:function(){}},{key:"calculateAvailableChoices",value:function(){this.cache&&this.activityTree.root&&this.recursivelyCheckChoiceAvailability(this.activityTree.root)}},{key:"recursivelyCheckChoiceAvailability",value:function(e){if(this.cache){var t=this.sequencingProcess.validateNavigationRequest(qt.CHOICE,e.id,this.activityTree.currentActivity).valid;if(this.cache.choiceEnabledMap.set(e.id,t),t&&this.cache.availableChoices.add(e.id),e.children){var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)this.recursivelyCheckChoiceAvailability(o.value)}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}}},{key:"isActivityPotentiallyDeliverableForward",value:function(e){if(e.isHiddenFromChoice||!e.isAvailable)return!1;if(0===e.children.length)return!!e.isVisible&&this.sequencingProcess.canActivityBeDelivered(e);var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)if(this.isActivityPotentiallyDeliverableForward(r.value))return!0}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return!1}},{key:"isActivityPotentiallyDeliverableBackward",value:function(e){if(e.isHiddenFromChoice||!e.isAvailable)return!1;if(0===e.children.length)return e.isVisible;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)if(this.isActivityPotentiallyDeliverableBackward(r.value))return!0}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return!1}},{key:"calculateTreeStateHash",value:function(){var e,t,i=this.activityTree.currentActivity,n=this.activityTree.suspendedActivity;return[null!==(e=null==i?void 0:i.id)&&void 0!==e?e:"none",null!==(t=null==n?void 0:n.id)&&void 0!==t?t:"none",this.getActivityTreeStateSignature()].join("|")}},{key:"getActivityTreeStateSignature",value:function(){if(!this.activityTree.root)return"empty";var e=[];return this.collectActivitySignatures(this.activityTree.root,e),e.join(":")}},{key:"collectActivitySignatures",value:function(e,t){if(t.push(e.id+(e.isActive?"A":"-")+(e.isSuspended?"S":"-")+e.completionStatus+e.successStatus+e.attemptCount),e.children){var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)this.collectActivitySignatures(o.value,t)}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Hr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Ur=Object.defineProperty,Gr=function(e,t,i){return function(e,t,i){return t in e?Ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},Kr=function(e){return e.START="start",e.RESUME_ALL="resumeAll",e.CONTINUE="continue",e.PREVIOUS="previous",e.CHOICE="choice",e.JUMP="jump",e.EXIT="exit",e.EXIT_ALL="exitAll",e.ABANDON="abandon",e.ABANDON_ALL="abandonAll",e.SUSPEND_ALL="suspendAll",e.NOT_VALID="_none_",e}(Kr||{}),Yr=function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;Hr(this,e),Gr(this,"valid"),Gr(this,"terminationRequest"),Gr(this,"sequencingRequest"),Gr(this,"targetActivityId"),Gr(this,"exception"),this.valid=t,this.terminationRequest=i,this.sequencingRequest=n,this.targetActivityId=r,this.exception=o},Wr=function(){function e(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;Hr(this,e),Gr(this,"activityTree"),Gr(this,"sequencingProcess"),Gr(this,"adlNav"),Gr(this,"eventCallback"),Gr(this,"navigationLookAhead"),Gr(this,"getEffectiveHideLmsUiCallback",null),this.activityTree=t,this.sequencingProcess=i,this.adlNav=n,this.eventCallback=r,this.navigationLookAhead=new Vr(t,i)}return t=e,i=[{key:"setGetEffectiveHideLmsUiCallback",value:function(e){this.getEffectiveHideLmsUiCallback=e}},{key:"getNavigationLookAhead",value:function(){return this.navigationLookAhead}},{key:"validateRequest",value:function(request){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.fireEvent("onNavigationRequestProcessing",{request:request,targetActivityId:e});var t=this.activityTree.currentActivity;switch(request){case"start":return this.validateStartRequest(t);case"resumeAll":return this.validateResumeRequest(t);case"continue":return this.validateContinueRequest(t);case"previous":return this.validatePreviousRequest(t);case"choice":return this.validateChoiceRequest(t,e);case"jump":return this.validateJumpRequest(e);case"exit":return this.validateExitRequest(t);case"exitAll":return this.validateExitAllRequest(t);case"abandon":return this.validateAbandonRequest(t);case"abandonAll":return this.validateAbandonAllRequest(t);case"suspendAll":return this.validateSuspendAllRequest(t);default:return new Yr(!1,null,null,null,"NB.2.1-18")}}},{key:"validateStartRequest",value:function(e){return null!==e?new Yr(!1,null,null,null,"NB.2.1-1"):new Yr(!0,null,qt.START,null)}},{key:"validateResumeRequest",value:function(e){return null!==e?new Yr(!1,null,null,null,"NB.2.1-2"):null===this.activityTree.suspendedActivity?new Yr(!1,null,null,null,"NB.2.1-3"):new Yr(!0,null,qt.RESUME_ALL,null)}},{key:"validateContinueRequest",value:function(e){return e?e.parent&&e.parent.sequencingControls.flow?new Yr(!0,e.isActive?qt.EXIT:null,qt.CONTINUE,null):new Yr(!1,null,null,null,"NB.2.1-5"):new Yr(!1,null,null,null,"NB.2.1-4")}},{key:"validatePreviousRequest",value:function(e){if(!e)return new Yr(!1,null,null,null,"NB.2.1-6");if(!e.parent||!e.parent.sequencingControls.flow)return new Yr(!1,null,null,null,"NB.2.1-7");var t=this.validateForwardOnlyConstraints(e);return t.valid?new Yr(!0,e.isActive?qt.EXIT:null,qt.PREVIOUS,null):new Yr(!1,null,null,null,t.exception)}},{key:"validateChoiceRequest",value:function(e,t){if(!t)return new Yr(!1,null,null,null,"NB.2.1-9");var i=this.activityTree.getActivity(t);if(!i)return new Yr(!1,null,null,null,"NB.2.1-10");var n=this.validateChoicePath(e,i);return n.valid?new Yr(!0,(null==e?void 0:e.isActive)?qt.EXIT:null,qt.CHOICE,t):new Yr(!1,null,null,null,n.exception)}},{key:"validateJumpRequest",value:function(e){return e?new Yr(!0,null,qt.JUMP,e):new Yr(!1,null,null,null,"NB.2.1-12")}},{key:"validateExitRequest",value:function(e){return e?new Yr(!0,e===this.activityTree.root?qt.EXIT_ALL:qt.EXIT,null,null):new Yr(!1,null,null,null,"NB.2.1-13")}},{key:"validateExitAllRequest",value:function(e){return e?new Yr(!0,qt.EXIT_ALL,null,null):new Yr(!1,null,null,null,"NB.2.1-14")}},{key:"validateAbandonRequest",value:function(e){return e?new Yr(!0,qt.ABANDON,null,null):new Yr(!1,null,null,null,"NB.2.1-15")}},{key:"validateAbandonAllRequest",value:function(e){return e?new Yr(!0,qt.ABANDON_ALL,null,null):new Yr(!1,null,null,null,"NB.2.1-16")}},{key:"validateSuspendAllRequest",value:function(e){return e?new Yr(!0,qt.SUSPEND_ALL,null,null):new Yr(!1,null,null,null,"NB.2.1-17")}},{key:"validateChoicePath",value:function(e,t){if(t.isHiddenFromChoice)return{valid:!1,exception:"NB.2.1-11"};if(!t.isAvailable)return{valid:!1,exception:"NB.2.1-11"};if(this.isActivityDisabled(t))return{valid:!1,exception:"NB.2.1-11"};if(e){var i=this.findCommonAncestor(e,t);if(!i)return{valid:!1,exception:"NB.2.1-11"};for(var n=e;n&&n!==i;){if(!0===n.isActive&&n.sequencingControls&&!1===n.sequencingControls.choiceExit&&t!==n&&!this.activityContains(n,t))return{valid:!1,exception:"NB.2.1-11"};n=n.parent}var r=this.validateConstrainChoice(e,t,i);if(!r.valid)return r;var o=this.validateChoiceSet(e,t,i);if(!o.valid)return o}for(var a=t;a;){if(a.parent&&!a.parent.sequencingControls.choice)return{valid:!1,exception:"NB.2.1-11"};a=a.parent}return{valid:!0,exception:null}}},{key:"validateForwardOnlyConstraints",value:function(e){var t,i;if(null===(t=e.parent)||void 0===t?void 0:t.sequencingControls.forwardOnly)return{valid:!1,exception:"NB.2.1-8"};for(var n=null===(i=e.parent)||void 0===i?void 0:i.parent;n;){if(n.sequencingControls.forwardOnly)return{valid:!1,exception:"NB.2.1-8"};n=n.parent}return{valid:!0,exception:null}}},{key:"validateConstrainChoice",value:function(e,t,i){for(var n=i;n;){var r,o;if((null===(r=n.sequencingControls)||void 0===r?void 0:r.constrainChoice)||(null===(o=n.sequencingControls)||void 0===o?void 0:o.preventActivation)){var a,s,c=this.findChildContaining(n,e);if(!c)return{valid:!1,exception:"NB.2.1-11"};if(t===n)return{valid:!1,exception:"NB.2.1-11"};var l=this.findChildContaining(n,t);if(!l)return{valid:!1,exception:"NB.2.1-11"};if((null===(a=n.sequencingControls)||void 0===a?void 0:a.constrainChoice)&&l!==c)return{valid:!1,exception:"NB.2.1-11"};if((null===(s=n.sequencingControls)||void 0===s?void 0:s.preventActivation)&&l!==c&&this.requiresNewActivation(l,t))return{valid:!1,exception:"NB.2.1-11"}}n=n.parent}return this.validateAncestors(i,e,t)}},{key:"validateChoiceSet",value:function(e,t,i){if(!this.activityContains(i,t)&&t!==i)return{valid:!1,exception:"NB.2.1-11"};for(var n=t;n&&n!==i;){if(!n.isAvailable||n.isHiddenFromChoice||this.isActivityDisabled(n))return{valid:!1,exception:"NB.2.1-11"};n=n.parent}return{valid:!0,exception:null}}},{key:"isActivityDisabled",value:function(e){if(!e.isAvailable)return!0;if(e.isHiddenFromChoice)return!0;var t=this.evaluatePreConditionRulesForChoice(e);return!!t&&(t===Ct.DISABLED||t===Ct.HIDE_FROM_CHOICE||t===Ct.STOP_FORWARD_TRAVERSAL)}},{key:"findChildContaining",value:function(e,t){var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s===t)return s;if(this.activityContains(s,t))return s}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return null}},{key:"activityContains",value:function(e,t){for(var i=t;i;){if(i===e)return!0;i=i.parent}return!1}},{key:"findCommonAncestor",value:function(e,t){for(var i=[],n=e;n;)i.push(n),n=n.parent;for(n=t;n;){if(i.includes(n))return n;n=n.parent}return null}},{key:"validateAncestors",value:function(e,t,i){var n=e.children;if(!n||0===n.length)return{valid:!0,exception:null};var r=this.findChildContaining(e,t),o=this.findChildContaining(e,i);if(!r||!o)return{valid:!1,exception:"NB.2.1-11"};var a=n.indexOf(r),s=n.indexOf(o);if(e.sequencingControls.forwardOnly&&a>s)return{valid:!1,exception:"NB.2.1-8"};var c=n.findIndex(function(e){return null==e?void 0:e.sequencingControls.stopForwardTraversal});if(r.sequencingControls.stopForwardTraversal&&s>a)return{valid:!1,exception:"NB.2.1-11"};if(-1!==c&&s>c)return{valid:!1,exception:"NB.2.1-11"};if(s>a&&e.sequencingControls.forwardOnly)for(var l=a+1;s>l;l++){var u=n[l];if(u){if(u.sequencingControls.stopForwardTraversal)return{valid:!1,exception:"NB.2.1-11"};if(this.isActivityMandatory(u)&&!this.isActivityCompleted(u))return{valid:!1,exception:"NB.2.1-11"}}}return{valid:!0,exception:null}}},{key:"requiresNewActivation",value:function(e,t){return!this.branchHasActiveAttempt(e)&&!t.activityAttemptActive&&!t.isActive}},{key:"branchHasActiveAttempt",value:function(e){if(e.activityAttemptActive||e.isActive)return!0;var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)if(this.branchHasActiveAttempt(r.value))return!0}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return!1}},{key:"isActivityMandatory",value:function(e){if(!e.isAvailable||e.isHiddenFromChoice)return!1;var t=this.evaluatePreConditionRulesForChoice(e);return t!==Ct.SKIP&&t!==Ct.DISABLED&&t!==Ct.HIDE_FROM_CHOICE&&t!==Ct.STOP_FORWARD_TRAVERSAL&&!this.isActivityDisabled(e)&&!1!==e.mandatory}},{key:"isActivityCompleted",value:function(e){if(!e.isAvailable||e.isHiddenFromChoice)return!0;var t=this.evaluatePreConditionRulesForChoice(e);return t===Ct.SKIP||t===Ct.DISABLED||t===Ct.HIDE_FROM_CHOICE||t===Ct.STOP_FORWARD_TRAVERSAL||!!this.isActivityDisabled(e)||"completed"===e.completionStatus||"passed"===e.successStatus||"passed"===e.successStatus}},{key:"evaluatePreConditionRulesForChoice",value:function(e){return e.sequencingRules&&e.sequencingRules.evaluatePreConditionRules(e)||null}},{key:"updateNavigationValidity",value:function(){if(this.adlNav&&this.activityTree.currentActivity){this.navigationLookAhead.invalidateCache();var e=this.navigationLookAhead.predictContinueEnabled();try{this.adlNav.request_valid.continue=e?"true":"false"}catch(e){}var t=this.navigationLookAhead.predictPreviousEnabled();try{this.adlNav.request_valid.previous=t?"true":"false"}catch(e){}var i=this.activityTree.getAllActivities(),n={},r={},o=!0,a=!1,s=void 0;try{for(var c,l=i[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value,d=this.validateRequest("choice",u.id);n[u.id]=d.valid?"true":"false";var f=this.validateRequest("jump",u.id);r[u.id]=f.valid?"true":"false"}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}try{this.adlNav.request_valid.choice=n}catch(e){}try{this.adlNav.request_valid.jump=r}catch(e){}var v=this.getEffectiveHideLmsUiCallback?this.getEffectiveHideLmsUiCallback(this.activityTree.currentActivity):[];this.fireEvent("onNavigationValidityUpdate",{continue:e,previous:t,choice:n,jump:r,hideLmsUi:v})}}},{key:"getAllPredictions",value:function(){return this.navigationLookAhead.getAllPredictions()}},{key:"predictContinueEnabled",value:function(){return this.navigationLookAhead.predictContinueEnabled()}},{key:"predictPreviousEnabled",value:function(){return this.navigationLookAhead.predictPreviousEnabled()}},{key:"predictChoiceEnabled",value:function(e){return this.navigationLookAhead.predictChoiceEnabled(e)}},{key:"getAvailableChoices",value:function(){return this.navigationLookAhead.getAvailableChoices()}},{key:"invalidateCache",value:function(){this.navigationLookAhead.invalidateCache()}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Jr(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function $r(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Xr(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Qr(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){$r(e,t,i[t])})}return e}function Zr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Jr(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Jr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var eo=Object.defineProperty,to=function(e,t,i){return function(e,t,i){return t in e?eo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},io=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),to(this,"globalObjectiveMap",new Map),to(this,"eventCallback",null),this.eventCallback=t||null}return t=e,(i=[{key:"initialize",value:function(e){try{this.globalObjectiveMap.clear(),e&&this.collectObjectives(e),this.fireEvent("onGlobalObjectiveMapInitialized",{objectiveCount:this.globalObjectiveMap.size,timestamp:(new Date).toISOString()})}catch(e){this.fireEvent("onGlobalObjectiveMapError",{error:Xr(e,Error)?e.message:e+"",timestamp:(new Date).toISOString()})}}},{key:"collectObjectives",value:function(e){var objectives=e.getAllObjectives();if(0===objectives.length){var t="".concat(e.id,"_default_objective");this.globalObjectiveMap.has(t)||this.globalObjectiveMap.set(t,{id:t,satisfiedStatus:e.objectiveSatisfiedStatus,satisfiedStatusKnown:e.objectiveSatisfiedStatusKnown,normalizedMeasure:e.objectiveNormalizedMeasure,normalizedMeasureKnown:e.objectiveMeasureStatus,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasure:e.progressMeasure,progressMeasureKnown:e.progressMeasureStatus,completionStatus:e.completionStatus,completionStatusKnown:e.completionStatus!==ke,readSatisfiedStatus:!0,writeSatisfiedStatus:!0,readNormalizedMeasure:!0,writeNormalizedMeasure:!0,readCompletionStatus:!0,writeCompletionStatus:!0,readProgressMeasure:!0,writeProgressMeasure:!0,readRawScore:!1,writeRawScore:!1,readMinScore:!1,writeMinScore:!1,readMaxScore:!1,writeMaxScore:!1,satisfiedByMeasure:null!==e.scaledPassingScore,minNormalizedMeasure:e.scaledPassingScore,updateAttemptData:!0})}var i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,c=s.mapInfo.length>0?s.mapInfo:[{targetObjectiveID:s.id,readSatisfiedStatus:!0,writeSatisfiedStatus:!0,readNormalizedMeasure:!0,writeNormalizedMeasure:!0,readProgressMeasure:!0,writeProgressMeasure:!0,readCompletionStatus:!0,writeCompletionStatus:!0,updateAttemptData:s.isPrimary}],l=!0,u=!1,d=void 0;try{for(var f,v=c[Symbol.iterator]();!(l=(f=v.next()).done);l=!0){var h,m,p,y,g,_,b,S,w,O,C,E,A,k,j,R=f.value,M=R.targetObjectiveID||s.id;this.globalObjectiveMap.has(M)||this.globalObjectiveMap.set(M,{id:M,satisfiedStatus:s.satisfiedStatus,satisfiedStatusKnown:s.satisfiedStatusKnown||s.progressStatus,normalizedMeasure:s.normalizedMeasure,normalizedMeasureKnown:s.measureStatus,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasure:s.progressMeasure,progressMeasureKnown:s.progressMeasureStatus,completionStatus:s.completionStatus,completionStatusKnown:s.completionStatus!==ke,readSatisfiedStatus:null!==(h=R.readSatisfiedStatus)&&void 0!==h&&h,writeSatisfiedStatus:null!==(m=R.writeSatisfiedStatus)&&void 0!==m&&m,readNormalizedMeasure:null!==(p=R.readNormalizedMeasure)&&void 0!==p&&p,writeNormalizedMeasure:null!==(y=R.writeNormalizedMeasure)&&void 0!==y&&y,readProgressMeasure:null!==(g=R.readProgressMeasure)&&void 0!==g&&g,writeProgressMeasure:null!==(_=R.writeProgressMeasure)&&void 0!==_&&_,readCompletionStatus:null!==(b=R.readCompletionStatus)&&void 0!==b&&b,writeCompletionStatus:null!==(S=R.writeCompletionStatus)&&void 0!==S&&S,readRawScore:null!==(w=R.readRawScore)&&void 0!==w&&w,writeRawScore:null!==(O=R.writeRawScore)&&void 0!==O&&O,readMinScore:null!==(C=R.readMinScore)&&void 0!==C&&C,writeMinScore:null!==(E=R.writeMinScore)&&void 0!==E&&E,readMaxScore:null!==(A=R.readMaxScore)&&void 0!==A&&A,writeMaxScore:null!==(k=R.writeMaxScore)&&void 0!==k&&k,satisfiedByMeasure:s.satisfiedByMeasure,minNormalizedMeasure:s.minNormalizedMeasure,updateAttemptData:null!==(j=R.updateAttemptData)&&void 0!==j?j:s.isPrimary})}}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}var T=!0,x=!1,I=void 0;try{for(var P,N=e.children[Symbol.iterator]();!(T=(P=N.next()).done);T=!0)this.collectObjectives(P.value)}catch(e){x=!0,I=e}finally{try{T||null==N.return||N.return()}finally{if(x)throw I}}}},{key:"getMap",value:function(){return this.globalObjectiveMap}},{key:"getSnapshot",value:function(){return this.serialize()}},{key:"restoreSnapshot",value:function(e){this.restore(e)}},{key:"updateObjective",value:function(e,t){try{this.globalObjectiveMap.set(e,(i=Qr({},this.globalObjectiveMap.get(e),t),n=null!=(n={lastUpdated:(new Date).toISOString()})?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(n)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(n)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(n,e))}),i)),this.fireEvent("onGlobalObjectiveUpdated",{objectiveId:e,data:t,timestamp:(new Date).toISOString()})}catch(t){this.fireEvent("onGlobalObjectiveUpdateError",{objectiveId:e,error:Xr(t,Error)?t.message:t+"",timestamp:(new Date).toISOString()})}var i,n}},{key:"synchronize",value:function(e,t){e&&t.processGlobalObjectiveMapping(e,this.globalObjectiveMap)}},{key:"getObjective",value:function(e){return this.globalObjectiveMap.get(e)}},{key:"hasObjective",value:function(e){return this.globalObjectiveMap.has(e)}},{key:"getObjectiveIds",value:function(){return Array.from(this.globalObjectiveMap.keys())}},{key:"getObjectiveCount",value:function(){return this.globalObjectiveMap.size}},{key:"clear",value:function(){this.globalObjectiveMap.clear(),this.fireEvent("onGlobalObjectiveMapCleared",{timestamp:(new Date).toISOString()})}},{key:"serialize",value:function(){var e={};return this.globalObjectiveMap.forEach(function(t,id){e[id]=Qr({},t)}),e}},{key:"restore",value:function(e){if(this.globalObjectiveMap.clear(),e){var t=!0,i=!1,n=void 0;try{for(var r,o=Object.entries(e)[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=Zr(r.value,2);this.globalObjectiveMap.set(a[0],Qr({},a[1]))}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}this.fireEvent("onGlobalObjectiveMapRestored",{objectiveCount:this.globalObjectiveMap.size,timestamp:(new Date).toISOString()})}}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire global objective event ".concat(e,": ").concat(t))}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var no=Object.defineProperty,ro=function(e,t,i){return function(e,t,i){return t in e?no(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},oo=function(){function e(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ro(this,"activityTree"),ro(this,"globalObjectiveService"),ro(this,"rollupProcess"),ro(this,"adlNav"),ro(this,"eventCallback"),ro(this,"getEffectiveHideLmsUiCallback",null),ro(this,"getEffectiveAuxiliaryResourcesCallback",null),ro(this,"contentDeliveredGetter",null),ro(this,"contentDeliveredSetter",null),this.activityTree=t,this.globalObjectiveService=i,this.rollupProcess=n,this.adlNav=r,this.eventCallback=o}return t=e,(i=[{key:"setGetEffectiveHideLmsUiCallback",value:function(e){this.getEffectiveHideLmsUiCallback=e}},{key:"setGetEffectiveAuxiliaryResourcesCallback",value:function(e){this.getEffectiveAuxiliaryResourcesCallback=e}},{key:"setContentDeliveredAccessors",value:function(e,t){this.contentDeliveredGetter=e,this.contentDeliveredSetter=t}},{key:"getState",value:function(){var e,t;return{version:"1.0",timestamp:(new Date).toISOString(),contentDelivered:!!this.contentDeliveredGetter&&this.contentDeliveredGetter(),currentActivity:(null===(e=this.activityTree.currentActivity)||void 0===e?void 0:e.id)||null,suspendedActivity:(null===(t=this.activityTree.suspendedActivity)||void 0===t?void 0:t.id)||null,activityStates:this.serializeActivities(),navigationState:this.getNavigationState(),globalObjectiveMap:this.globalObjectiveService.getSnapshot()}}},{key:"restoreState",value:function(e){try{if(!e||"1.0"!==e.version)return console.warn("Incompatible sequencing state version"),!1;if(this.contentDeliveredSetter&&this.contentDeliveredSetter(e.contentDelivered||!1),e.globalObjectiveMap&&this.globalObjectiveService.restoreSnapshot(e.globalObjectiveMap),e.activityStates&&this.deserializeActivities(e.activityStates),e.currentActivity){var t=this.activityTree.getActivity(e.currentActivity);t&&(this.activityTree.currentActivity=t,t.isActive=!0)}if(e.suspendedActivity){var i=this.activityTree.getActivity(e.suspendedActivity);i&&(this.activityTree.suspendedActivity=i,i.isSuspended=!0)}return e.navigationState&&this.restoreNavigationState(e.navigationState),this.activityTree.root&&this.globalObjectiveService.synchronize(this.activityTree.root,this.rollupProcess),console.debug("Sequencing state restored successfully"),!0}catch(e){return console.error("Failed to restore sequencing state: ".concat(e)),!1}}},{key:"serializeActivities",value:function(){var e={},t=function(i){e[i.id]={id:i.id,title:i.title,isActive:i.isActive,isSuspended:i.isSuspended,isCompleted:i.isCompleted,completionStatus:i.completionStatus,successStatus:i.successStatus,attemptCount:i.attemptCount,attemptCompletionAmount:i.attemptCompletionAmount,attemptAbsoluteDuration:i.attemptAbsoluteDuration,attemptExperiencedDuration:i.attemptExperiencedDuration,activityAbsoluteDuration:i.activityAbsoluteDuration,activityExperiencedDuration:i.activityExperiencedDuration,objectiveSatisfiedStatus:i.objectiveSatisfiedStatus,objectiveMeasureStatus:i.objectiveMeasureStatus,objectiveNormalizedMeasure:i.objectiveNormalizedMeasure,progressMeasure:i.progressMeasure,progressMeasureStatus:i.progressMeasureStatus,isAvailable:i.isAvailable,isHiddenFromChoice:i.isHiddenFromChoice,location:i.location,attemptAbsoluteStartTime:i.attemptAbsoluteStartTime,objectives:i.getObjectiveStateSnapshot(),auxiliaryResources:i.auxiliaryResources,selectionRandomizationState:{selectionCountStatus:i.sequencingControls.selectionCountStatus,reorderChildren:i.sequencingControls.reorderChildren,childOrder:i.children.map(function(e){return e.id}),selectedChildIds:i.children.filter(function(e){return e.isAvailable}).map(function(e){return e.id}),hiddenFromChoiceChildIds:i.children.filter(function(e){return e.isHiddenFromChoice}).map(function(e){return e.id})}};var n=!0,r=!1,o=void 0;try{for(var a,s=i.children[Symbol.iterator]();!(n=(a=s.next()).done);n=!0)t(a.value)}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}};return this.activityTree.root&&t(this.activityTree.root),e}},{key:"deserializeActivities",value:function(e){var t=function(i){var n,r=e[i.id];r&&(i.isActive=r.isActive||!1,i.isSuspended=r.isSuspended||!1,i.isCompleted=r.isCompleted||!1,i.completionStatus=r.completionStatus||"unknown",i.successStatus=r.successStatus||"unknown",i.attemptCount=r.attemptCount||0,i.attemptCompletionAmount=r.attemptCompletionAmount||0,i.attemptAbsoluteDuration=r.attemptAbsoluteDuration||"PT0H0M0S",i.attemptExperiencedDuration=r.attemptExperiencedDuration||"PT0H0M0S",i.activityAbsoluteDuration=r.activityAbsoluteDuration||"PT0H0M0S",i.activityExperiencedDuration=r.activityExperiencedDuration||"PT0H0M0S",i.objectiveSatisfiedStatus=r.objectiveSatisfiedStatus||!1,i.objectiveMeasureStatus=r.objectiveMeasureStatus||!1,i.objectiveNormalizedMeasure=r.objectiveNormalizedMeasure||0,i.progressMeasure=null!==(n=r.progressMeasure)&&void 0!==n?n:0,i.progressMeasureStatus=r.progressMeasureStatus||!1,i.isAvailable=!1!==r.isAvailable,i.isHiddenFromChoice=!0===r.isHiddenFromChoice,i.location=r.location||"",i.attemptAbsoluteStartTime=r.attemptAbsoluteStartTime||"",Array.isArray(r.auxiliaryResources)&&(i.auxiliaryResources=r.auxiliaryResources),r.objectives&&i.applyObjectiveStateSnapshot(r.objectives));var o=!0,a=!1,s=void 0;try{for(var c,l=i.children[Symbol.iterator]();!(o=(c=l.next()).done);o=!0)t(c.value)}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}if(null==r?void 0:r.selectionRandomizationState){var u=r.selectionRandomizationState,d=i.sequencingControls;void 0!==u.selectionCountStatus&&(d.selectionCountStatus=u.selectionCountStatus),void 0!==u.reorderChildren&&(d.reorderChildren=u.reorderChildren),u.childOrder&&u.childOrder.length>0&&i.setChildOrder(u.childOrder);var f=Array.isArray(u.selectedChildIds)?new Set(u.selectedChildIds):null,v=Array.isArray(u.hiddenFromChoiceChildIds)?new Set(u.hiddenFromChoiceChildIds):null;if(f||v){var h=!0,m=!1,p=void 0;try{for(var y,g=i.children[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var _=y.value;if(f){var b=f.has(_.id);_.isAvailable=b,v||(_.isHiddenFromChoice=!b)}v&&(_.isHiddenFromChoice=v.has(_.id))}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}i.setProcessedChildren(i.children.filter(function(e){return e.isAvailable}))}else i.resetProcessedChildren()};this.activityTree.root&&t(this.activityTree.root)}},{key:"getNavigationState",value:function(){var e,t,i,n,r,o,a;if(!this.adlNav)return null;var s=this.getEffectiveHideLmsUiCallback?this.getEffectiveHideLmsUiCallback(this.activityTree.currentActivity):[],c=this.getEffectiveAuxiliaryResourcesCallback?this.getEffectiveAuxiliaryResourcesCallback(this.activityTree.currentActivity):[];return{request:this.adlNav.request||"_none_",requestValid:{continue:(null===(e=this.adlNav.request_valid)||void 0===e?void 0:e.continue)||"false",previous:(null===(t=this.adlNav.request_valid)||void 0===t?void 0:t.previous)||"false",choice:"unknown",jump:"unknown",exit:(null===(i=this.adlNav.request_valid)||void 0===i?void 0:i.exit)||"false",exitAll:(null===(n=this.adlNav.request_valid)||void 0===n?void 0:n.exitAll)||"false",abandon:(null===(r=this.adlNav.request_valid)||void 0===r?void 0:r.abandon)||"false",abandonAll:(null===(o=this.adlNav.request_valid)||void 0===o?void 0:o.abandonAll)||"false",suspendAll:(null===(a=this.adlNav.request_valid)||void 0===a?void 0:a.suspendAll)||"false"},hideLmsUi:s,auxiliaryResources:c}}},{key:"restoreNavigationState",value:function(e){if(this.adlNav&&e)try{if(e.requestValid){var t=e.requestValid;this.adlNav.request_valid.continue=t.continue||"false",this.adlNav.request_valid.previous=t.previous||"false",this.adlNav.request_valid.exit=t.exit||"false",this.adlNav.request_valid.exitAll=t.exitAll||"false",this.adlNav.request_valid.abandon=t.abandon||"false",this.adlNav.request_valid.abandonAll=t.abandonAll||"false",this.adlNav.request_valid.suspendAll=t.suspendAll||"false"}}catch(e){console.warn("Could not fully restore navigation state: ".concat(e))}}},{key:"getSuspensionState",value:function(){var e,t,i={activityTree:this.activityTree.root?this.activityTree.root.getSuspensionState():null,currentActivityId:(null===(e=this.activityTree.currentActivity)||void 0===e?void 0:e.id)||null,suspendedActivityId:(null===(t=this.activityTree.suspendedActivity)||void 0===t?void 0:t.id)||null,globalObjectives:this.globalObjectiveService.getSnapshot(),timestamp:(new Date).toISOString()};return this.fireEvent("onSuspensionStateCaptured",{hasActivityTree:!!i.activityTree,currentActivityId:i.currentActivityId,suspendedActivityId:i.suspendedActivityId,globalObjectiveCount:Object.keys(i.globalObjectives).length,timestamp:i.timestamp}),i}},{key:"restoreSuspensionState",value:function(e){var t,i;if(e)try{if(e.globalObjectives&&this.globalObjectiveService.restoreSnapshot(e.globalObjectives),e.activityTree&&this.activityTree.root&&this.activityTree.root.restoreSuspensionState(e.activityTree),e.currentActivityId){var n=this.activityTree.getActivity(e.currentActivityId);n&&(this.activityTree.currentActivity=n)}if(e.suspendedActivityId){var r=this.activityTree.getActivity(e.suspendedActivityId);r&&(this.activityTree.suspendedActivity=r)}this.fireEvent("onSuspensionStateRestored",{currentActivityId:e.currentActivityId,suspendedActivityId:e.suspendedActivityId,globalObjectiveCount:e.globalObjectives?Object.keys(e.globalObjectives).length:0,originalTimestamp:e.timestamp,restoreTimestamp:(new Date).toISOString()})}catch(e){throw this.fireEvent("onSuspensionStateRestoreError",{error:(t=e,i=Error,(null!=i&&"undefined"!=typeof Symbol&&i[Symbol.hasInstance]?i[Symbol.hasInstance](t):t instanceof i)?e.message:e+""),timestamp:(new Date).toISOString()}),e}else this.fireEvent("onSuspensionStateRestoreError",{error:"No suspension state provided",timestamp:(new Date).toISOString()})}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire state manager event ".concat(e,": ").concat(t))}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function ao(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function so(e){return function(e){if(Array.isArray(e))return ao(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return ao(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ao(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var co=Object.defineProperty,lo=function(e,t,i){return function(e,t,i){return t in e?co(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},uo=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),lo(this,"activityTree"),lo(this,"eventCallback"),lo(this,"now"),lo(this,"contentDeliveredGetter",null),this.activityTree=t,this.eventCallback=i,this.now=(null==n?void 0:n.now)||function(){return new Date}}return t=e,(i=[{key:"setContentDeliveredGetter",value:function(e){this.contentDeliveredGetter=e}},{key:"validateTreeConsistency",value:function(e){if(!this.activityTree.root)return{consistent:!1,exception:"DB.1.1-4"};if(!this.isActivityPartOfTree(e,this.activityTree.root))return{consistent:!1,exception:"DB.1.1-5"};var t=this.getActiveActivities();if(t.length>1)return this.fireEvent("onStateInconsistency",{activeActivities:t.map(function(e){return e.id}),targetActivity:e.id}),{consistent:!1,exception:"DB.1.1-6"};for(var i=e;null==i?void 0:i.parent;){if(!i.parent.children.includes(i))return{consistent:!1,exception:"DB.1.1-7"};i=i.parent}return{consistent:!0,exception:null}}},{key:"validateResources",value:function(e){var t=this.getRequiredResources(e),i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(!this.isResourceAvailable(o.value))return{available:!1,exception:"DB.1.1-8"}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return this.checkSystemLimits().adequate?{available:!0,exception:null}:{available:!1,exception:"DB.1.1-9"}}},{key:"validateConcurrentDelivery",value:function(e){return this.contentDeliveredGetter&&this.contentDeliveredGetter()&&this.activityTree.currentActivity&&this.activityTree.currentActivity!==e?{allowed:!1,exception:"DB.1.1-10"}:this.hasPendingDeliveryRequests()?{allowed:!1,exception:"DB.1.1-11"}:this.isDeliveryLocked()?{allowed:!1,exception:"DB.1.1-12"}:{allowed:!0,exception:null}}},{key:"validateDependencies",value:function(e){var t=this.getPrerequisites(e),i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(!this.isPrerequisiteSatisfied(o.value,e))return{satisfied:!1,exception:"DB.1.1-13"}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}var s=this.getObjectiveDependencies(e),c=!0,l=!1,u=void 0;try{for(var d,f=s[Symbol.iterator]();!(c=(d=f.next()).done);c=!0)if(!this.isObjectiveDependencySatisfied(d.value))return{satisfied:!1,exception:"DB.1.1-14"}}catch(e){l=!0,u=e}finally{try{c||null==f.return||f.return()}finally{if(l)throw u}}return this.getSequencingRuleDependencies(e).satisfied?{satisfied:!0,exception:null}:{satisfied:!1,exception:"DB.1.1-15"}}},{key:"checkActivity",value:function(e){return!!e.isAvailable&&!!this.checkLimitConditions(e)}},{key:"checkLimitConditions",value:function(e){var result=!0,t="";if(null!==e.attemptLimit&&e.attemptLimit>0&&(e.attemptLimit>e.attemptCount||(result=!1,t="Attempt limit exceeded")),result&&e.attemptAbsoluteDurationLimit){var i=d(e.attemptAbsoluteDurationLimit,Ke);i>0&&(i>d(e.attemptAbsoluteDuration||"PT0H0M0S",Ke)||(result=!1,t="Attempt duration limit exceeded"))}if(result&&e.activityAbsoluteDurationLimit){var n=d(e.activityAbsoluteDurationLimit,Ke);n>0&&(n>d(e.activityAbsoluteDuration||"PT0H0M0S",Ke)||(result=!1,t="Activity duration limit exceeded"))}if(result&&e.beginTimeLimit){var r=this.now();new Date(e.beginTimeLimit)>r&&(result=!1,t="Not yet time to begin")}return result&&e.endTimeLimit&&this.now()>new Date(e.endTimeLimit)&&(result=!1,t="Time limit expired"),this.fireEvent("onLimitConditionCheck",{activity:e,result:result,failureReason:t,checks:{attemptLimit:e.attemptLimit,attemptCount:e.attemptCount,attemptDurationLimit:e.attemptAbsoluteDurationLimit,activityDurationLimit:e.activityAbsoluteDurationLimit,beginTimeLimit:e.beginTimeLimit,endTimeLimit:e.endTimeLimit}}),result}},{key:"isActivityPartOfTree",value:function(e,t){if(e===t)return!0;var i=!0,n=!1,r=void 0;try{for(var o,a=t.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(this.isActivityPartOfTree(e,o.value))return!0}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return!1}},{key:"getActiveActivities",value:function(){var e=[];return this.activityTree.root&&this.collectActiveActivities(this.activityTree.root,e),e}},{key:"collectActiveActivities",value:function(e,t){e.isActive&&t.push(e);var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)this.collectActiveActivities(o.value,t)}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}},{key:"getRequiredResources",value:function(e){var t=[],i=(e.title+" "+e.location).toLowerCase();return(i.includes("video")||i.includes("multimedia"))&&t.push("video-codec"),(i.includes("audio")||i.includes("sound"))&&t.push("audio-codec"),(i.includes("flash")||i.includes(".swf"))&&t.push("flash-plugin"),(i.includes("java")||i.includes("applet"))&&t.push("java-runtime"),e.children&&e.children.length>0&&t.push("high-bandwidth"),e.attemptAbsoluteDurationLimit&&this.parseDurationToMinutes(e.attemptAbsoluteDurationLimit)>60&&t.push("extended-storage"),e.attemptLimit&&e.attemptLimit>1&&t.push("persistent-storage"),t}},{key:"isResourceAvailable",value:function(e){try{switch(e){case"video-codec":return!!document.createElement("video").canPlayType;case"audio-codec":return!!document.createElement("audio").canPlayType;case"flash-plugin":return navigator.plugins&&Array.from(navigator.plugins).some(function(e){return"Shockwave Flash"===e.name});case"java-runtime":return navigator.plugins&&Array.from(navigator.plugins).some(function(e){return"Java"===e.name});case"high-bandwidth":if("connection"in navigator){var t=navigator.connection;return"4g"===t.effectiveType||t.downlink>5}return!0;case"extended-storage":default:return!0;case"persistent-storage":return"localStorage"in window&&"sessionStorage"in window}}catch(e){return!1}}},{key:"checkSystemLimits",value:function(){try{var e=!0;if("memory"in performance){var t=performance.memory;t.usedJSHeapSize/t.jsHeapSizeLimit>.8&&(e=!1)}if("deviceMemory"in navigator&&2>navigator.deviceMemory&&(e=!1),"hardwareConcurrency"in navigator&&2>navigator.hardwareConcurrency&&(e=!1),"connection"in navigator){var i=navigator.connection;(i.saveData||"slow-2g"===i.effectiveType)&&(e=!1)}return{adequate:e}}catch(e){return{adequate:!0}}}},{key:"hasPendingDeliveryRequests",value:function(){return this.activityTree&&this.activityTree.pendingRequests?this.activityTree.pendingRequests.length>0:!("undefined"==typeof window||!window.pendingScormRequests)&&window.pendingScormRequests>0}},{key:"isDeliveryLocked",value:function(){return!((!this.activityTree||!this.activityTree.navigationLocked)&&(!this.activityTree||!this.activityTree.terminationInProgress)&&this.checkSystemLimits().adequate&&("undefined"==typeof window||!window.scormMaintenanceMode))}},{key:"getPrerequisites",value:function(e){var t,i=[];if(e.sequencingRules&&e.sequencingRules.preConditionRules){var n=!0,r=!1,o=void 0;try{for(var a,s=e.sequencingRules.preConditionRules[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;if(c.conditions&&c.conditions.length>0){var l=!0,u=!1,d=void 0;try{for(var f,v=c.conditions[Symbol.iterator]();!(l=(f=v.next()).done);l=!0){var h=f.value;h.referencedObjectiveID&&h.referencedObjectiveID!==e.id&&i.push(h.referencedObjectiveID)}}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}if(e.parent&&e.sequencingControls&&!e.sequencingControls.choiceExit){var m=e.parent.children;if(m)for(var p=m.indexOf(e),y=0;p>y;y++){var g=m[y];g&&i.push(g.id)}}return e.prerequisiteActivities&&(t=i).push.apply(t,so(e.prerequisiteActivities)),Array.from(new Set(i))}},{key:"isPrerequisiteSatisfied",value:function(e,t){var i=this.activityTree.getActivity(e);return!!i&&"completed"===i.completionStatus}},{key:"getObjectiveDependencies",value:function(e){var t=[],objectives=e.objectives;if(objectives&&objectives.length>0){var i=!0,n=!1,r=void 0;try{for(var o,a=objectives[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;s.globalObjectiveID&&t.push(s.globalObjectiveID),!s.satisfiedByMeasure&&s.readNormalizedMeasure&&t.push(s.id+"_measure")}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}if(e.sequencingRules){var c=so(e.sequencingRules.preConditionRules||[]).concat(so(e.sequencingRules.exitConditionRules||[]),so(e.sequencingRules.postConditionRules||[])),l=!0,u=!1,d=void 0;try{for(var f,v=c[Symbol.iterator]();!(l=(f=v.next()).done);l=!0){var h=f.value;if(h.conditions&&h.conditions.length>0){var m=!0,p=!1,y=void 0;try{for(var g,_=h.conditions[Symbol.iterator]();!(m=(g=_.next()).done);m=!0){var b=g.value;b.objectiveReference&&b.objectiveReference!==e.id&&t.push(b.objectiveReference)}}catch(e){p=!0,y=e}finally{try{m||null==_.return||_.return()}finally{if(p)throw y}}}}}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}}return Array.from(new Set(t))}},{key:"isObjectiveDependencySatisfied",value:function(e){if(this.activityTree&&this.activityTree.globalObjectives){var t=this.activityTree.globalObjectives[e];if(t)return!0===t.satisfied&&!0===t.statusKnown}if(e.endsWith("_measure")){var i=e.replace("_measure","");if(this.activityTree&&this.activityTree.globalObjectives){var n=this.activityTree.globalObjectives[i];if(n)return!0===n.measureKnown&&n.normalizedMeasure>=0}}var r=this.activityTree.getActivity(e);return!!r&&r.objectiveSatisfiedStatus&&r.objectiveMeasureStatus}},{key:"getSequencingRuleDependencies",value:function(e){var t=!0;try{if(e.sequencingRules&&e.sequencingRules.preConditionRules){var i=!0,n=!1,r=void 0;try{for(var o,a=e.sequencingRules.preConditionRules[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.conditions&&s.conditions.length>0){var c=!0,l=!1,u=void 0;try{for(var d,f=s.conditions[Symbol.iterator]();!(c=(d=f.next()).done);c=!0){var v=d.value;switch(v.conditionType||v.condition){case"activityProgressKnown":e.progressMeasureStatus||(t=!1);break;case"objectiveStatusKnown":case"objectiveSatisfied":this.isObjectiveDependencySatisfied(v.referencedObjectiveID||e.id)||(t=!1);break;case"attemptLimitExceeded":null===e.attemptLimit&&(t=!1);break;case"timeLimitExceeded":e.attemptAbsoluteDurationLimit||e.activityAbsoluteDurationLimit||(t=!1);break;case"always":case"never":break;default:t=!1}}}catch(e){l=!0,u=e}finally{try{c||null==f.return||f.return()}finally{if(l)throw u}}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}if(e.sequencingRules&&e.sequencingRules.exitConditionRules){var h=!0,m=!1,p=void 0;try{for(var y,g=e.sequencingRules.exitConditionRules[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var _=y.value;if(_.conditions&&_.conditions.length>0){var b=!0,S=!1,w=void 0;try{for(var O,C=_.conditions[Symbol.iterator]();!(b=(O=C.next()).done);b=!0){var E=O.value;["objectiveStatusKnown","objectiveSatisfied"].includes(E.conditionType||E.condition)&&(this.isObjectiveDependencySatisfied(E.referencedObjectiveID||e.id)||(t=!1))}}catch(e){S=!0,w=e}finally{try{b||null==C.return||C.return()}finally{if(S)throw w}}}}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}if(e.rollupRules&&e.rollupRules.rules){var A=!0,k=!1,j=void 0;try{for(var R,M=e.rollupRules.rules[Symbol.iterator]();!(A=(R=M.next()).done);A=!0){var T=R.value;if(T.conditions&&T.conditions.length>0&&e.children&&e.children.length>0){var x=!0,I=!1,P=void 0;try{for(var N,D=e.children[Symbol.iterator]();!(x=(N=D.next()).done);x=!0)if(!N.value.isCompleted){t=!1;break}}catch(e){I=!0,P=e}finally{try{x||null==D.return||D.return()}finally{if(I)throw P}}}}}catch(e){k=!0,j=e}finally{try{A||null==M.return||M.return()}finally{if(k)throw j}}}}catch(e){t=!1}return{satisfied:t}}},{key:"parseDurationToMinutes",value:function(e){return d(e,Ke)/60}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire delivery validator event ".concat(e,": ").concat(t))}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var fo=Object.defineProperty,vo=function(e,t,i){return function(e,t,i){return t in e?fo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ho=function(){function e(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5?arguments[5]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),vo(this,"activityTree"),vo(this,"sequencingProcess"),vo(this,"rollupProcess"),vo(this,"adlNav"),vo(this,"eventCallback",null),vo(this,"terminationHandler"),vo(this,"deliveryHandler"),vo(this,"navigationValidityService"),vo(this,"globalObjectiveService"),vo(this,"stateManager"),vo(this,"deliveryValidator"),vo(this,"navigationLookAhead"),vo(this,"enhancedDeliveryValidation"),vo(this,"is4thEdition"),this.activityTree=t,this.sequencingProcess=i,this.rollupProcess=n,this.adlNav=r,this.eventCallback=o,this.enhancedDeliveryValidation=!0===(null==a?void 0:a.enhancedDeliveryValidation),this.is4thEdition=(null==a?void 0:a.is4thEdition)||!1,this.globalObjectiveService=new io(o||void 0),this.globalObjectiveService.initialize(t.root);var s={};(null==a?void 0:a.now)&&(s.now=a.now),this.deliveryValidator=new uo(t,o,s);var c={};(null==a?void 0:a.getCMIData)&&(c.getCMIData=a.getCMIData),void 0!==(null==a?void 0:a.is4thEdition)&&(c.is4thEdition=a.is4thEdition),this.terminationHandler=new Rr(t,i,n,this.globalObjectiveService.getMap(),o,c);var l={};(null==a?void 0:a.now)&&(l.now=a.now),(null==a?void 0:a.defaultHideLmsUi)&&(l.defaultHideLmsUi=a.defaultHideLmsUi),(null==a?void 0:a.defaultAuxiliaryResources)&&(l.defaultAuxiliaryResources=a.defaultAuxiliaryResources),this.deliveryHandler=new zr(t,n,this.globalObjectiveService.getMap(),r,o,l),this.navigationValidityService=new Wr(t,i,r,o),this.stateManager=new oo(t,this.globalObjectiveService,n,r,o),this.navigationLookAhead=this.navigationValidityService.getNavigationLookAhead(),this.setupCallbacks()}return t=e,i=[{key:"setupCallbacks",value:function(){var e=this;this.terminationHandler.setInvalidateCacheCallback(function(){e.navigationLookAhead.invalidateCache()}),this.deliveryHandler.setCheckActivityCallback(function(t){return e.deliveryValidator.checkActivity(t)}),this.deliveryHandler.setInvalidateCacheCallback(function(){e.navigationLookAhead.invalidateCache()}),this.deliveryHandler.setUpdateNavigationValidityCallback(function(){e.navigationValidityService.updateNavigationValidity()}),this.deliveryHandler.setClearSuspendedActivityCallback(function(){e.terminationHandler.clearSuspendedActivity()}),this.deliveryValidator.setContentDeliveredGetter(function(){return e.deliveryHandler.hasContentBeenDelivered()}),this.navigationValidityService.setGetEffectiveHideLmsUiCallback(function(t){return e.deliveryHandler.getEffectiveHideLmsUi(t)}),this.stateManager.setGetEffectiveHideLmsUiCallback(function(t){return e.deliveryHandler.getEffectiveHideLmsUi(t)}),this.stateManager.setGetEffectiveAuxiliaryResourcesCallback(function(t){return e.deliveryHandler.getEffectiveAuxiliaryResources(t)}),this.stateManager.setContentDeliveredAccessors(function(){return e.deliveryHandler.hasContentBeenDelivered()},function(t){return e.deliveryHandler.setContentDelivered(t)})}},{key:"processNavigationRequest",value:function(e){var t=arguments.length>2?arguments[2]:void 0,i=this.navigationValidityService.validateRequest(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null);if(!i.valid)return new qr(!1,null,i.exception);if(i.terminationRequest){var n=!!i.sequencingRequest,r=this.terminationHandler.processTerminationRequest(i.terminationRequest,n,t);if(!r.valid)return new qr(!1,null,r.exception||"TB.2.3-1");if(null!==r.sequencingRequest&&(n||r.sequencingRequest!==qt.EXIT)&&(i.sequencingRequest=r.sequencingRequest),!i.sequencingRequest)return i.terminationRequest!==qt.EXIT_ALL&&i.terminationRequest!==qt.ABANDON_ALL||this.fireEvent("onSequencingSessionEnd",{reason:i.terminationRequest===qt.EXIT_ALL?"exit_all":"abandon_all",navigationRequest:e}),new qr(!0,null)}if(i.sequencingRequest){var o=this.sequencingProcess.sequencingRequestProcess(i.sequencingRequest,i.targetActivityId);if(o.endSequencingSession)return this.fireEvent("onSequencingSessionEnd",{reason:"end_of_content",exception:o.exception,navigationRequest:e}),new qr(!1,null,o.exception||"SESSION_ENDED");if(o.exception)return new qr(!1,null,o.exception);if(o.deliveryRequest===Lt.DELIVER&&o.targetActivity)return this.activityTree.root&&(this.rollupProcess.validateRollupStateConsistency(this.activityTree.root)||this.fireEvent("onSequencingDebug",{message:"Rollup state inconsistency detected before delivery",activityId:this.activityTree.root.id})),this.rollupProcess.processGlobalObjectiveMapping(o.targetActivity,this.globalObjectiveService.getMap()),this.processDelivery(o.targetActivity)}return new qr(!1,null,"OP.1-1")}},{key:"processDelivery",value:function(e){if(this.enhancedDeliveryValidation){var t=this.deliveryValidator.validateTreeConsistency(e);if(!t.consistent)return new qr(!1,null,t.exception);var i=this.deliveryValidator.validateResources(e);if(!i.available)return new qr(!1,null,i.exception);var n=this.deliveryValidator.validateConcurrentDelivery(e);if(!n.allowed)return new qr(!1,null,n.exception);var r=this.deliveryValidator.validateDependencies(e);if(!r.satisfied)return new qr(!1,null,r.exception)}var o=this.deliveryHandler.processDeliveryRequest(e);return o.valid&&(this.deliveryHandler.contentDeliveryEnvironmentProcess(o.targetActivity),this.navigationLookAhead.invalidateCache(),this.activityTree.root&&this.rollupProcess.validateRollupStateConsistency(this.activityTree.root)),o}},{key:"hasContentBeenDelivered",value:function(){return this.deliveryHandler.hasContentBeenDelivered()}},{key:"isDeliveryInProgress",value:function(){return this.deliveryHandler.isDeliveryInProgress()}},{key:"resetContentDelivered",value:function(){this.deliveryHandler.resetContentDelivered()}},{key:"setContentDelivered",value:function(e){this.deliveryHandler.setContentDelivered(e)}},{key:"updateNavigationValidity",value:function(){this.navigationValidityService.updateNavigationValidity()}},{key:"synchronizeGlobalObjectives",value:function(){this.globalObjectiveService.synchronize(this.activityTree.root,this.rollupProcess)}},{key:"getGlobalObjectiveMap",value:function(){return this.globalObjectiveService.getMap()}},{key:"getGlobalObjectiveMapSnapshot",value:function(){return this.globalObjectiveService.getSnapshot()}},{key:"restoreGlobalObjectiveMapSnapshot",value:function(e){this.globalObjectiveService.restoreSnapshot(e)}},{key:"updateGlobalObjective",value:function(e,t){this.globalObjectiveService.updateObjective(e,t)}},{key:"getSequencingState",value:function(){return this.stateManager.getState()}},{key:"restoreSequencingState",value:function(e){return this.stateManager.restoreState(e)}},{key:"getSuspensionState",value:function(){return this.stateManager.getSuspensionState()}},{key:"restoreSuspensionState",value:function(e){this.stateManager.restoreSuspensionState(e)}},{key:"getNavigationLookAhead",value:function(){return this.navigationValidityService.getAllPredictions()}},{key:"predictContinueEnabled",value:function(){return this.navigationValidityService.predictContinueEnabled()}},{key:"predictPreviousEnabled",value:function(){return this.navigationValidityService.predictPreviousEnabled()}},{key:"predictChoiceEnabled",value:function(e){return this.navigationValidityService.predictChoiceEnabled(e)}},{key:"getAvailableChoices",value:function(){return this.navigationValidityService.getAvailableChoices()}},{key:"invalidateNavigationCache",value:function(){this.navigationValidityService.invalidateCache()}},{key:"applyDeliveryControls",value:function(e){e.sequencingControls.completionSetByContent||e.completionStatus===ke&&(e.completionStatus=Ee,e.wasAutoCompleted=!0),e.sequencingControls.objectiveSetByContent||e.successStatus===Ce&&(e.successStatus=we,e.wasAutoSatisfied=!0)}},{key:"getEffectiveHideLmsUi",value:function(e){return this.deliveryHandler.getEffectiveHideLmsUi(e)}},{key:"getEffectiveAuxiliaryResources",value:function(e){return this.deliveryHandler.getEffectiveAuxiliaryResources(e)}},{key:"getContentActivityData",value:function(e){return this.deliveryHandler.getContentActivityData(e)}},{key:"terminationRequestProcess",value:function(request,e,t){return this.terminationHandler.processTerminationRequest(request,e,t)}},{key:"contentDeliveryEnvironmentProcess",value:function(e){this.deliveryHandler.contentDeliveryEnvironmentProcess(e)}},{key:"endAttemptProcess",value:function(e){this.terminationHandler.endAttempt(e)}},{key:"handleExitTermination",value:function(e,t){return this.terminationHandler.handleExitTermination(e,t)}},{key:"fireEvent",value:function(e,t){try{this.eventCallback&&this.eventCallback(e,t)}catch(t){console.warn("Failed to fire sequencing event ".concat(e,": ").concat(t))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function mo(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function po(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function yo(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){po(e,t,i[t])})}return e}function go(e){return function(e){if(Array.isArray(e))return mo(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return mo(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?mo(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var _o=Object.defineProperty,bo=function(e,t,i){return function(e,t,i){return t in e?_o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},So=function(){function e(t,cmi,adl,i,n){var r=this,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),bo(this,"sequencing"),bo(this,"cmi"),bo(this,"adl"),bo(this,"eventService"),bo(this,"loggingService"),bo(this,"activityDeliveryService"),bo(this,"rollupProcess"),bo(this,"overallSequencingProcess",null),bo(this,"sequencingProcess",null),bo(this,"eventListeners",{}),bo(this,"configuration"),bo(this,"isInitialized",!1),bo(this,"isSequencingActive",!1),bo(this,"lastCMIValues",new Map),bo(this,"lastSequencingResult",null),this.sequencing=t,this.cmi=cmi,this.adl=adl,this.eventService=i,this.loggingService=n,this.configuration=yo({autoRollupOnCMIChange:!0,autoProgressOnCompletion:!1,validateNavigationRequests:!0,enableEventSystem:!0,logLevel:"info",now:function(){return new Date}},o),this.activityDeliveryService=new Ei(i,n,{onDeliverActivity:function(e){return r.handleActivityDelivery(e)},onUnloadActivity:function(e){return r.handleActivityUnload(e)},onSequencingComplete:function(result){return r.handleSequencingComplete(result)},onSequencingError:function(e){return r.handleSequencingError(e)}}),this.rollupProcess=new _r,this.configuration.now&&At.setNowProvider(this.configuration.now),this.setupCMIChangeWatchers(),this.createSequencingProcesses()}return t=e,i=[{key:"createSequencingProcesses",value:function(){var e=this;try{if(this.sequencing.initialized||this.sequencing.initialize(),this.sequencing.adlNav=this.adl.nav,this.sequencing.activityTree.root){var t={};this.configuration.now&&(t.now=this.configuration.now),this.configuration.getAttemptElapsedSeconds&&(t.getAttemptElapsedSeconds=this.configuration.getAttemptElapsedSeconds),this.configuration.getActivityElapsedSeconds&&(t.getActivityElapsedSeconds=this.configuration.getActivityElapsedSeconds),this.sequencingProcess=new Si(this.sequencing.activityTree,this.sequencing.sequencingRules,this.sequencing.sequencingControls,this.adl.nav,t);var i={};this.configuration.now&&(i.now=this.configuration.now),i.defaultHideLmsUi=go(this.sequencing.hideLmsUi),this.sequencing.auxiliaryResources.length>0&&(i.defaultAuxiliaryResources=this.sequencing.auxiliaryResources.map(function(e){return{resourceId:e.resourceId,purpose:e.purpose}})),i.getCMIData=function(){return e.getCMIDataForTransfer()},this.overallSequencingProcess=new ho(this.sequencing.activityTree,this.sequencingProcess,this.rollupProcess,this.adl.nav,function(t,i){return e.handleSequencingProcessEvent(t,i)},i),this.sequencing.overallSequencingProcess=this.overallSequencingProcess,this.isInitialized=!0,this.log("info","Sequencing processes created and ready for navigation")}}catch(e){this.log("error","Failed to create sequencing processes: ".concat(e))}}},{key:"initialize",value:function(){try{return this.log("info","Initializing sequencing service for SCO session"),this.isInitialized||this.createSequencingProcesses(),this.shouldAutoStartSequencing()&&!this.isSequencingActive&&this.startSequencing(),this.initializeCMITracking(),this.fireEvent("onSequencingStart",this.sequencing.getCurrentActivity()),this.log("info","Sequencing service initialized successfully"),V}catch(t){var e="Failed to initialize sequencing service: ".concat(t);return this.log("error",e),this.fireEvent("onSequencingError",e,"initialization"),H}}},{key:"terminate",value:function(){try{return this.log("info","Terminating sequencing service"),this.triggerFinalRollup(),this.endSequencing(),this.isInitialized=!1,this.fireEvent("onSequencingEnd"),this.log("info","Sequencing service terminated successfully"),V}catch(t){var e="Failed to terminate sequencing service: ".concat(t);return this.log("error",e),this.fireEvent("onSequencingError",e,"termination"),H}}},{key:"processNavigationRequest",value:function(request,e,t){if(!this.isInitialized||!this.overallSequencingProcess)return this.log("warn","Navigation request '".concat(request,"' ignored - sequencing not initialized")),!1;try{this.log("info","Processing navigation request: ".concat(request).concat(e?" (target: ".concat(e,")"):"").concat(t?" (exit: ".concat(t,")"):"")),this.fireEvent("onNavigationRequest",request,e);var i=this.parseNavigationRequest(request);if(null===i)return this.log("warn","Invalid navigation request: ".concat(request)),!1;var n=this.overallSequencingProcess.processNavigationRequest(i,e||null,t),r={deliveryRequest:n.valid?Lt.DELIVER:Lt.DO_NOT_DELIVER,targetActivity:n.targetActivity,exception:n.exception||null,endSequencingSession:!1};return this.lastSequencingResult=r,n.valid&&n.targetActivity?(this.activityDeliveryService.processSequencingResult(r),this.overallSequencingProcess.updateNavigationValidity(),this.log("info","Navigation request '".concat(request,"' resulted in activity delivery: ").concat(n.targetActivity.id)),!0):(n.exception?(this.log("warn","Navigation request '".concat(request,"' failed: ").concat(n.exception)),this.fireEvent("onSequencingError",n.exception,"navigation")):this.log("info","Navigation request '".concat(request,"' completed with no activity delivery")),n.valid)}catch(e){var o="Error processing navigation request '".concat(request,"': ").concat(e);return this.log("error",o),this.fireEvent("onSequencingError",o,"navigation"),!1}}},{key:"triggerRollupOnCMIChange",value:function(e,t,i){if(this.configuration.autoRollupOnCMIChange&&this.isInitialized&&["cmi.completion_status","cmi.success_status","cmi.score.scaled","cmi.score.raw","cmi.score.min","cmi.score.max","cmi.progress_measure","cmi.objectives.n.success_status","cmi.objectives.n.completion_status","cmi.objectives.n.score.scaled"].some(function(t){return e.startsWith(t)}))try{this.log("debug","Triggering rollup due to CMI change: ".concat(e," = ").concat(i," (was ").concat(t,")"));var n=this.sequencing.getCurrentActivity();if(!n)return void this.log("debug","No current activity for rollup");this.updateActivityFromCMI(n),this.rollupProcess.overallRollupProcess(n),this.overallSequencingProcess&&this.overallSequencingProcess.synchronizeGlobalObjectives(),this.overallSequencingProcess&&this.overallSequencingProcess.updateNavigationValidity(),this.fireEvent("onRollupComplete",n),this.log("debug","Rollup completed for activity: ".concat(n.id))}catch(e){var r="Error during rollup on CMI change: ".concat(e);this.log("error",r),this.fireEvent("onSequencingError",r,"rollup")}}},{key:"setEventListeners",value:function(e){this.eventListeners=yo({},this.eventListeners,e),this.log("debug","Sequencing event listeners updated")}},{key:"updateConfiguration",value:function(e){this.configuration=yo({},this.configuration,e),this.log("debug","Sequencing configuration updated")}},{key:"getSequencingState",value:function(){return{isInitialized:this.isInitialized,isActive:this.isSequencingActive,currentActivity:this.sequencing.getCurrentActivity(),rootActivity:this.sequencing.getRootActivity(),lastSequencingResult:this.lastSequencingResult}}},{key:"getOverallSequencingProcess",value:function(){return this.overallSequencingProcess}},{key:"isDeliveryInProgress",value:function(){var e,t;return null!==(e=null===(t=this.overallSequencingProcess)||void 0===t?void 0:t.isDeliveryInProgress())&&void 0!==e&&e}},{key:"setupCMIChangeWatchers",value:function(){}},{key:"initializeCMITracking",value:function(){this.lastCMIValues.set("cmi.completion_status",this.cmi.completion_status),this.lastCMIValues.set("cmi.success_status",this.cmi.success_status),this.lastCMIValues.set("cmi.progress_measure",this.cmi.progress_measure),this.cmi.score&&(this.lastCMIValues.set("cmi.score.scaled",this.cmi.score.scaled),this.lastCMIValues.set("cmi.score.raw",this.cmi.score.raw))}},{key:"shouldAutoStartSequencing",value:function(){return!(!this.sequencing.activityTree.root||this.sequencing.getCurrentActivity())}},{key:"startSequencing",value:function(){if(this.overallSequencingProcess)try{this.processNavigationRequest("start")&&(this.isSequencingActive=!0,this.log("info","Automatic sequencing started"))}catch(e){this.log("error","Failed to start automatic sequencing: ".concat(e))}}},{key:"endSequencing",value:function(){this.isSequencingActive=!1,this.activityDeliveryService.reset()}},{key:"triggerFinalRollup",value:function(){try{var e=this.sequencing.getCurrentActivity();e&&(this.updateActivityFromCMI(e),this.rollupProcess.overallRollupProcess(e),this.overallSequencingProcess&&this.overallSequencingProcess.synchronizeGlobalObjectives(),this.log("info","Final rollup completed"))}catch(e){this.log("error","Error during final rollup: ".concat(e))}}},{key:"updateActivityFromCMI",value:function(e){var t=!1;if(""!==this.cmi.progress_measure){var i=parseFloat(this.cmi.progress_measure);isNaN(i)||(t=!0,e.progressMeasure=i,e.progressMeasureStatus=!0,e.attemptCompletionAmount=i,e.attemptCompletionAmountStatus=!0)}if(t||(e.attemptCompletionAmountStatus=!1),e.completedByMeasure){var n=br({completionThreshold:e.minProgressMeasure,progressMeasure:this.cmi.progress_measure,storedCompletionStatus:ke});e.completionStatus=n,e.attemptProgressStatus=n!==ke}else"unknown"!==this.cmi.completion_status&&(e.completionStatus=this.cmi.completion_status,e.attemptProgressStatus=!0);if("unknown"!==this.cmi.success_status&&(e.successStatus=this.cmi.success_status,e.objectiveSatisfiedStatus="passed"===this.cmi.success_status,e.primaryObjective&&(e.primaryObjective.progressStatus=!0)),this.cmi.score&&""!==this.cmi.score.scaled){var r=parseFloat(this.cmi.score.scaled);isNaN(r)||(e.objectiveNormalizedMeasure=r,e.objectiveMeasureStatus=!0,e.primaryObjective&&(e.primaryObjective.progressStatus=!0))}e.primaryObjective&&this.cmi.score&&(""!==this.cmi.score.raw&&(e.primaryObjective.rawScore=this.cmi.score.raw),""!==this.cmi.score.min&&(e.primaryObjective.minScore=this.cmi.score.min),""!==this.cmi.score.max&&(e.primaryObjective.maxScore=this.cmi.score.max)),e.primaryObjective&&e.primaryObjective.updateFromActivity(e)}},{key:"getCMIDataForTransfer",value:function(){var e,t,i,n,r={completion_status:this.cmi.completion_status,success_status:this.cmi.success_status,progress_measure:this.cmi.progress_measure,score:{scaled:(null===(e=this.cmi.score)||void 0===e?void 0:e.scaled)||"",raw:(null===(t=this.cmi.score)||void 0===t?void 0:t.raw)||"",min:(null===(i=this.cmi.score)||void 0===i?void 0:i.min)||"",max:(null===(n=this.cmi.score)||void 0===n?void 0:n.max)||""},objectives:[]};if(this.cmi.objectives&&this.cmi.objectives.childArray){var o=!0,a=!1,s=void 0;try{for(var c,l=this.cmi.objectives.childArray[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u,d,f,v,h=c.value;h.id&&r.objectives.push({id:h.id,success_status:h.success_status,completion_status:h.completion_status,progress_measure:h.progress_measure,score:{scaled:(null===(u=h.score)||void 0===u?void 0:u.scaled)||"",raw:(null===(d=h.score)||void 0===d?void 0:d.raw)||"",min:(null===(f=h.score)||void 0===f?void 0:f.min)||"",max:(null===(v=h.score)||void 0===v?void 0:v.max)||""}})}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}}return r}},{key:"parseNavigationRequest",value:function(request){var e=request;if(e.startsWith("_")&&"_none_"!==e&&(e=e.substring(1)),request.includes("choice"))return Kr.CHOICE;if(request.includes("jump"))return Kr.JUMP;switch(e){case"start":return Kr.START;case"resumeAll":return Kr.RESUME_ALL;case"continue":return Kr.CONTINUE;case"previous":return Kr.PREVIOUS;case"exit":return Kr.EXIT;case"exitAll":return Kr.EXIT_ALL;case"abandon":return Kr.ABANDON;case"abandonAll":return Kr.ABANDON_ALL;case"suspendAll":return Kr.SUSPEND_ALL;case"_none_":return Kr.NOT_VALID;default:return null}}},{key:"handleActivityDelivery",value:function(e){this.log("info","Activity delivered: ".concat(e.id," - ").concat(e.title)),this.fireEvent("onActivityDelivery",e)}},{key:"handleActivityUnload",value:function(e){this.log("info","Activity unloaded: ".concat(e.id," - ").concat(e.title)),this.fireEvent("onActivityUnload",e)}},{key:"handleSequencingComplete",value:function(result){this.log("debug","Sequencing completed",result)}},{key:"handleSequencingError",value:function(e){this.log("error","Sequencing error: ".concat(e)),this.fireEvent("onSequencingError",e,"sequencing")}},{key:"fireEvent",value:function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),n=1;t>n;n++)i[n-1]=arguments[n];if(this.configuration.enableEventSystem){"onSequencingDebug"!==e&&this.fireDebugEvent("".concat(e," fired"),{eventType:e,argsLength:i.length});try{var r=this.eventListeners[e];if(r&&"function"==typeof r)try{r.apply(void 0,go(i)),this.log("debug","Internal listener for ".concat(e," executed successfully"))}catch(t){this.log("error","Internal listener for ".concat(e," failed: ").concat(t))}try{var o;(o=this.eventService).processListeners.apply(o,["Sequencing.".concat(e),i[0]].concat(go(i.slice(1)))),this.log("debug","Event service listeners for ".concat(e," processed"))}catch(t){this.log("warn","Event service failed for ".concat(e,": ").concat(t))}try{if("undefined"!=typeof window&&window.scormSequencingEvents){var a,s=window.scormSequencingEvents;s[e]&&"function"==typeof s[e]&&((a=s)[e].apply(a,go(i)),this.log("debug","Global listener for ".concat(e," executed")))}}catch(t){this.log("warn","Global listener for ".concat(e," failed: ").concat(t))}}catch(t){this.log("error","Critical error firing event ".concat(e,": ").concat(t))}}}},{key:"fireDebugEvent",value:function(e,t){try{var i=this.eventListeners.onSequencingDebug;i&&"function"==typeof i&&i(e,yo({timestamp:(new Date).toISOString()},t));try{this.eventService.processListeners("Sequencing.onSequencingDebug",e,yo({timestamp:(new Date).toISOString()},t))}catch(e){}}catch(e){console.debug("Debug event failed: ".concat(e))}}},{key:"fireActivityAttemptStart",value:function(e){this.fireEvent("onActivityAttemptStart",e),this.fireDebugEvent("Activity attempt started",{activityId:e.id,title:e.title,attemptCount:e.attemptCount})}},{key:"fireActivityAttemptEnd",value:function(e){this.fireEvent("onActivityAttemptEnd",e),this.fireDebugEvent("Activity attempt ended",{activityId:e.id,title:e.title,completionStatus:e.completionStatus,successStatus:e.successStatus})}},{key:"fireLimitConditionCheck",value:function(e,result){this.fireEvent("onLimitConditionCheck",e,result),this.fireDebugEvent("Limit condition check",{activityId:e.id,result:result,attemptCount:e.attemptCount,attemptLimit:e.attemptLimit})}},{key:"fireNavigationValidityUpdate",value:function(e){this.fireEvent("onNavigationValidityUpdate",e),this.fireDebugEvent("Navigation validity updated",{validity:e})}},{key:"fireSequencingStateChange",value:function(e){this.fireEvent("onSequencingStateChange",e),this.fireDebugEvent("Sequencing state changed",{stateKeys:Object.keys(e)})}},{key:"handleSequencingProcessEvent",value:function(e,t){try{switch(e){case"onActivityDelivery":this.fireEvent("onActivityDelivery",t);break;case"onLimitConditionCheck":this.fireLimitConditionCheck(t.activity,t.result);break;case"onActivityAttemptStart":this.fireActivityAttemptStart(t);break;case"onActivityAttemptEnd":this.fireActivityAttemptEnd(t);break;case"onNavigationValidityUpdate":this.fireNavigationValidityUpdate(t);break;case"onSequencingSessionEnd":this.fireEvent("onSequencingSessionEnd",t);break;default:this.fireDebugEvent("Sequencing process event: ".concat(e),t)}}catch(t){this.log("error","Error handling sequencing process event ".concat(e,": ").concat(t))}}},{key:"log",value:function(e,t,i){var n=["debug","info","warn","error"],r=this.configuration.logLevel||"info";if(n.indexOf(e)>=n.indexOf(r))switch(e){case"debug":this.loggingService.debug("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""));break;case"info":this.loggingService.info("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""));break;case"warn":this.loggingService.warn("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""));break;case"error":this.loggingService.error("[Sequencing] ".concat(t).concat(i?" - ".concat(JSON.stringify(i)):""))}}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var wo=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,i=[{key:"loadFromFlattenedJSON",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(r()){var a=/^(cmi\.interactions\.)(\d+)\.(.*)$/,s=/^(cmi\.objectives\.)(\d+)\.(.*)$/,interactions=[],objectives=[],c=[];for(var l in e)if({}.hasOwnProperty.call(e,l)){var u=l.match(a);if(u){interactions.push({key:l,value:e[l],index:+u[2],field:u[3]||""});continue}var d=l.match(s);if(d){objectives.push({key:l,value:e[l],index:+d[2],field:d[3]||""});continue}c.push({key:l,value:e[l]})}interactions.sort(function(e,t){return e.index!==t.index?e.index-t.index:"id"===e.field?-1:"id"===t.field?1:"type"===e.field?-1:"type"===t.field?1:e.field.localeCompare(t.field)}),objectives.sort(function(e,t){return e.index!==t.index?e.index-t.index:"id"===e.field?-1:"id"===t.field?1:e.field.localeCompare(t.field)}),c.sort(function(e,t){return e.key.localeCompare(t.key)});var f=function(e){e.forEach(function(e){var a={};a[e.key]=e.value,t.loadFromJSON(function(e){var t;if(Object(e)!==e||Array.isArray(e))return e;var result={},pattern=/\.?([^.[\]]+)|\[(\d+)]/g;return Object.keys(e).filter(function(t){return{}.hasOwnProperty.call(e,t)}).forEach(function(t){var i,n,r=result,o="",a=RegExp(pattern);Array.from({length:null!==(i=null===(n=t.match(RegExp(pattern,"g")))||void 0===n?void 0:n.length)&&void 0!==i?i:0},function(){return a.exec(t)}).forEach(function(e){var t;e&&(r=null!==(t=r[o])&&void 0!==t?t:r[o]=e[2]?[]:{},o=e[2]||e[1]||"")}),r[o]=e[t]}),null!==(t=result[""])&&void 0!==t?t:result}(a),i,n,r,o)})};f(interactions),f(objectives),f(c)}else console.error("loadFromFlattenedJSON can only be called before the call to lmsInitialize.")}},{key:"loadFromJSON",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;if(n()){for(var o in t=void 0!==t?t:"cmi",r(e),e)if({}.hasOwnProperty.call(e,o)&&e[o]){var a=(t?t+".":"")+o,s=e[o];if(s.constructor===Array){for(var c=0;s.length>c;c++)if(s[c]){var l=s[c],u="".concat(a,".").concat(c);l.constructor===Object?this.loadFromJSON(l,u,i,n,r):i(u,l)}}else s.constructor===Object?this.loadFromJSON(s,a,i,n,r):i(a,s)}}else console.error("loadFromJSON can only be called before the call to lmsInitialize.")}},{key:"renderCMIToJSONString",value:function(cmi,e){return e?JSON.stringify({cmi:cmi}):JSON.stringify({cmi:cmi},function(e,t){return void 0===t?null:t},2)}},{key:"renderCMIToJSONObject",value:function(cmi,e){return JSON.parse(this.renderCMIToJSONString(cmi,e))}},{key:"getCommitObject",value:function(e,t,i,n,r,o){var a=t||e,s=i?n(e,a):r(e,a);return[je.DEBUG,"1",1,"DEBUG"].includes(o)&&(console.debug("Commit (terminated: "+(e?"yes":"no")+"): "),console.debug(s)),s}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Oo(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Co(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var Eo=Object.defineProperty,Ao=function(e,t,i){return function(e,t,i){return t in e?Eo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ko=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ao(this,"settings"),Ao(this,"error_codes"),this.settings=t,this.error_codes=i}return t=e,i=[{key:"processHttpRequest",value:function(e,t){var i=arguments.length>5?arguments[5]:void 0;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?this._handleImmediateRequest(e,t,i):this._performSyncXHR(e,t,i)}},{key:"_handleImmediateRequest",value:function(e,t,i){var n=void 0===i?this.settings.requestHandler(t):this.settings.requestHandler(t,i),r=this._prepareRequestBody(null!=n?n:t).body,o=this.settings.terminationCommitContentType;this._warnIfBeaconContentTypeUnsafe(e,o);var a=navigator.sendBeacon(e,new Blob([r],{type:o}));return{result:a?"true":"false",errorCode:a?0:this.error_codes.GENERAL_COMMIT_FAILURE||391}}},{key:"_warnIfBeaconContentTypeUnsafe",value:function(e,t){var i,n;a(e)&&!o(t)&&(null===(i=(n=this.settings).onLogMessage)||void 0===i||i.call(n,je.WARN,'sendBeacon to cross-origin URL with non-CORS-safelisted Content-Type "'.concat(t,'" may be silently dropped by the browser (Beacon cannot preflight). Use fetch (useAsynchronousCommits + asyncModeBeaconBehavior:"never") for cross-origin JSON/auth on terminate.')))}},{key:"_performSyncXHR",value:function(e,t,i){var n=void 0===i?this.settings.requestHandler(t):this.settings.requestHandler(t,i),r=this._prepareRequestBody(null!=n?n:t),o=r.body,a=r.contentType,s=new XMLHttpRequest;s.open("POST",e,!1),s.setRequestHeader("Content-Type",a),Object.entries(this.settings.xhrHeaders).forEach(function(e){var t,i,n=(i=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(t,i)||function(e,t){if(e){if("string"==typeof e)return Oo(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Oo(e,t):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());s.setRequestHeader(n[0],n[1]+"")}),this.settings.xhrWithCredentials&&(s.withCredentials=!0);try{return s.send(o),this.settings.xhrResponseHandler(s)}catch(e){var c=Co(e,Error)?e.message:e+"";return{result:H,errorCode:this.error_codes.GENERAL_COMMIT_FAILURE||391,errorMessage:c}}}},{key:"_prepareRequestBody",value:function(e){return{body:Co(e,Array)?e.join("&"):JSON.stringify(e),contentType:Co(e,Array)?"application/x-www-form-urlencoded":this.settings.commitRequestDataType}}},{key:"updateSettings",value:function(e){this.settings=e}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function jo(e,t,i,n){return un(e,t,i,ue.TYPE_MISMATCH,Q,n)}function Ro(e,t,i,n){if(""===t)throw new Q(e,ue.VALUE_OUT_OF_RANGE);return dn(e,t,i,ue.VALUE_OUT_OF_RANGE,Q)}var Mo=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,i=[{key:"validateScore",value:function(e,t,i,n,r,o,a){return!(7>=arguments.length||void 0===arguments[7]||!arguments[7]||""!==t)||un(e,t,i,r,a)&&(!n||dn(e,t,n,o,a))}},{key:"validateScorm12Audio",value:function(e,t){return jo(e,t,Pe)&&Ro(e,t,"-1#100")}},{key:"validateScorm12Language",value:function(e,t){return jo(e,t,xe)}},{key:"validateScorm12Speed",value:function(e,t){return jo(e,t,Pe)&&Ro(e,t,"-100#100")}},{key:"validateScorm12Text",value:function(e,t){return jo(e,t,Pe)&&Ro(e,t,"-1#1")}},{key:"validateReadOnly",value:function(e,t){if(t)throw new Q(e,ue.READ_ONLY_ELEMENT)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}(),To=new Mo;function xo(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Io(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Po(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function No(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Io(e,t,i[t])})}return e}function Do(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}),e}function qo(e){return function(e){if(Array.isArray(e))return xo(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return xo(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?xo(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lo(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var zo=Object.defineProperty,Fo=function(e,t,i){return function(e,t,i){return t in e?zo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Lo(t))?t+"":t,i)},Bo=function(){function e(t,i,n,r,o,a,s,c,l){var u=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Fo(this,"_timeout"),Fo(this,"_error_codes"),Fo(this,"_settings",Me),Fo(this,"_httpService"),Fo(this,"_eventService"),Fo(this,"_serializationService"),Fo(this,"_errorHandlingService"),Fo(this,"_loggingService"),Fo(this,"_offlineStorageService"),Fo(this,"_cmiValueAccessService"),Fo(this,"_courseId",""),Fo(this,"_pendingCommitCount",0),Fo(this,"_commitSequence",0),Fo(this,"_commitSettleWaiters",[]),Fo(this,"_setCMIElements",new Set),Fo(this,"startingData"),Fo(this,"currentState"),(Po(this,e)?this.constructor:void 0)===e)throw new TypeError("Cannot construct BaseAPI instances directly");this.currentState=0,this._error_codes=t,i&&(this.settings=No({},Me,i)),void 0!==(null==i?void 0:i.asyncCommit)&&void 0===i.useAsynchronousCommits&&void 0===i.throttleCommits&&(console.warn("DEPRECATED: 'asyncCommit' setting is deprecated and will be removed in a future version. Use 'useAsynchronousCommits: true' and 'throttleCommits: true' instead."),i.asyncCommit&&(this.settings.useAsynchronousCommits=!0,this.settings.throttleCommits=!0)),!this.settings.useAsynchronousCommits&&this.settings.throttleCommits&&(console.warn("throttleCommits cannot be used with synchronous commits. Setting throttleCommits to false."),this.settings.throttleCommits=!1),this._loggingService=c||Gi(),this._loggingService.setLogLevel(this.settings.logLevel),this._loggingService.setLogHandler(this.settings.onLogMessage?this.settings.onLogMessage:Te),n?this._httpService=n:this.settings.httpService?this._httpService=this.settings.httpService:this.settings.useAsynchronousCommits?(console.warn("WARNING: useAsynchronousCommits=true is not SCORM compliant. Commit failures will not be reported to the SCO, which may cause data loss. This setting should only be used for specific legacy compatibility cases."),this._httpService=new Pi(this.settings,this._error_codes)):this._httpService=new ko(this.settings,this._error_codes),this._eventService=r||new Qi(function(e,t,i,n){return u.apiLog(e,t,i,n)}),this._serializationService=o||new wo,this._errorHandlingService=s||new Ji(this._error_codes,function(e,t,i,n){return u.apiLog(e,t,i||je.ERROR,n)},function(e,t){return u.getLmsErrorMessageDetails(e,t)},void 0),this.settings.enableOfflineSupport&&(this._offlineStorageService=l||new ln(this.settings,this._error_codes,function(e,t,i,n){return u.apiLog(e,t,i,n)}),this.settings.courseId&&(this._courseId=this.settings.courseId),this.settings.syncOnTerminate&&this._eventService.on("BeforeTerminate",function(){var e;(null===(e=u._offlineStorageService)||void 0===e?void 0:e.isDeviceOnline())&&u._courseId&&u._offlineStorageService.hasPendingOfflineData(u._courseId).then(function(e){var t;if(e)return u.apiLog("BeforeTerminate","Syncing pending offline data before termination",je.INFO),null===(t=u._offlineStorageService)||void 0===t?void 0:t.syncOfflineData()}).then(function(e){e?u.processListeners("OfflineDataSynced"):!1===e&&u.processListeners("OfflineDataSyncFailed")}).catch(function(e){u.apiLog("BeforeTerminate","Error syncing offline data: ".concat(e),je.ERROR),u.processListeners("OfflineDataSyncFailed")})}),this._offlineStorageService&&this._courseId&&this._offlineStorageService.getOfflineData(this._courseId).then(function(e){e&&(u.apiLog("constructor","Found offline data to restore",je.INFO),u.loadFromJSON(e.runtimeData))}).catch(function(e){u.apiLog("constructor","Error retrieving offline data: ".concat(e),je.ERROR)})),this._cmiValueAccessService=new zi({errorCodes:this._error_codes,getLastErrorCode:function(){return u.lastErrorCode},setLastErrorCode:function(e){u.lastErrorCode=e},throwSCORMError:function(e,t,i){return u.throwSCORMError(e,t,i)},isInitialized:function(){return u.isInitialized()},validateCorrectResponse:function(e,t){return u.validateCorrectResponse(e,t)},checkForDuplicateId:function(e,t){return u._checkForDuplicateId(e,t)},getChildElement:function(e,t,i){return u.getChildElement(e,t,i)},apiLog:function(e,t,i){return u.apiLog(e,t,i)},checkObjectHasProperty:function(e,t){return u._checkObjectHasProperty(e,t)},getDataModel:function(){return u}})}return t=e,i=[{key:"lastErrorCode",get:function(){var e,t;return null!==(e=null===(t=this._errorHandlingService)||void 0===t?void 0:t.lastErrorCode)&&void 0!==e?e:"0"},set:function(e){this._errorHandlingService&&(this._errorHandlingService.lastErrorCode=e)}},{key:"eventService",get:function(){return this._eventService}},{key:"loggingService",get:function(){return this._loggingService}},{key:"commonReset",value:function(e){this.apiLog("reset","Called",je.INFO),this.settings=No({},this.settings,e),this.clearScheduledCommit(),this.currentState=0,this.lastErrorCode="0",this._eventService.reset(),this.startingData={},this._setCMIElements.clear(),this._offlineStorageService&&(this._offlineStorageService.updateSettings(this.settings),(null==e?void 0:e.courseId)&&(this._courseId=e.courseId))}},{key:"initialize",value:function(e,t,i){var n=this,r=H;return this.isInitialized()?this.throwSCORMError("api",this._error_codes.INITIALIZED,t):this.isTerminated()?this.throwSCORMError("api",this._error_codes.TERMINATED,i):(this.settings.selfReportSessionTime&&this.cmi.setStartTime(),this.currentState=1,this.lastErrorCode="0",r=V,this.processListeners(e),this.settings.enableOfflineSupport&&this._offlineStorageService&&this._courseId&&this.settings.syncOnInitialize&&this._offlineStorageService.isDeviceOnline()&&this._offlineStorageService.hasPendingOfflineData(this._courseId).then(function(t){var i;t&&(n.apiLog(e,"Syncing pending offline data on initialization",je.INFO),null===(i=n._offlineStorageService)||void 0===i||i.syncOfflineData().then(function(t){t&&(n.apiLog(e,"Successfully synced offline data",je.INFO),n.processListeners("OfflineDataSynced"))}))})),this.apiLog(e,"returned: "+r,je.INFO),this.clearSCORMError(r),r}},{key:"apiLog",value:function(e,t,i,n){t=function(e,t,i){var n=e?"".concat((e+"").padEnd(20),": "):"";return i&&(n=(n+=i).padEnd(70)),n+(null!=t?t:"")}(e,t,n),this._loggingService.log(i,t)}},{key:"settings",get:function(){return this._settings},set:function(e){var t,i,n,r=this._settings;this._settings=No({},this._settings,e),null===(t=this._httpService)||void 0===t||t.updateSettings(this._settings),void 0!==e.logLevel&&e.logLevel!==r.logLevel&&(null===(i=this._loggingService)||void 0===i||i.setLogLevel(e.logLevel)),void 0!==e.onLogMessage&&e.onLogMessage!==r.onLogMessage&&(null===(n=this._loggingService)||void 0===n||n.setLogHandler(e.onLogMessage))}},{key:"pendingCommitCount",get:function(){return this._pendingCommitCount}},{key:"whenCommitsSettled",value:function(e){var t=this;return 0===this._pendingCommitCount?Promise.resolve():new Promise(function(i){var n={resolve:i};void 0!==(null==e?void 0:e.timeoutMs)&&(n.timeoutId=setTimeout(function(){var e=t._commitSettleWaiters.indexOf(n);-1!==e&&(t._commitSettleWaiters.splice(e,1),i())},e.timeoutMs)),t._commitSettleWaiters.push(n)})}},{key:"_flushCommitSettleWaiters",value:function(){var e=this._commitSettleWaiters.splice(0),t=!0,i=!1,n=void 0;try{for(var r,o=e[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;void 0!==a.timeoutId&&clearTimeout(a.timeoutId),a.resolve()}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"terminate",value:function(e,t){var i=V,n=!1;if(this.isNotInitialized()){var r,o=null!==(r=this._error_codes.TERMINATION_BEFORE_INIT)&&void 0!==r?r:0;this.throwSCORMError("api",o),112===o&&(i=H)}else if(t&&this.isTerminated()){var a,s=null!==(a=this._error_codes.MULTIPLE_TERMINATION)&&void 0!==a?a:0;this.throwSCORMError("api",s),113===s&&(i=H)}else{var c;n=!0,this.processListeners("BeforeTerminate");var result=this.storeData(!0,"terminate");if((null!==(c=result.errorCode)&&void 0!==c?c:0)>0){var l;result.errorMessage&&this.apiLog("terminate","Terminate failed with error: ".concat(result.errorMessage),je.ERROR),result.errorDetails&&this.apiLog("terminate","Error details: ".concat(JSON.stringify(result.errorDetails)),je.DEBUG),this.throwSCORMError("api",null!==(l=result.errorCode)&&void 0!==l?l:0),i=H}else{var u;this.currentState=2,t&&(this.lastErrorCode="0");var d=null!==(u=null==result?void 0:result.result)&&void 0!==u?u:V;i="boolean"==typeof d?d+"":d}this.processListeners(e)}return this.apiLog(e,"returned: "+i,je.INFO),n&&this.clearSCORMError(i),i}},{key:"getValue",value:function(e,t,i){var n,r,o="";if(this.checkState(t,null!==(n=this._error_codes.RETRIEVE_BEFORE_INIT)&&void 0!==n?n:0,null!==(r=this._error_codes.RETRIEVE_AFTER_TERM)&&void 0!==r?r:0)){try{o=this.getCMIValue(i)}catch(e){o=this.handleValueAccessException(i,e,o)}"0"===this.lastErrorCode&&this.checkUninitializedGet(i,o),this.processListeners(e,i)}return this.apiLog(e,": returned: "+o,je.INFO,i),void 0===o?"":("0"===this.lastErrorCode&&this.clearSCORMError(o),"number"==typeof o||"boolean"==typeof o?o+"":o)}},{key:"setValue",value:function(e,t,i,n,r){var o,a;void 0!==r&&(r+="");var s=H;if(this.checkState(i,null!==(o=this._error_codes.STORE_BEFORE_INIT)&&void 0!==o?o:0,null!==(a=this._error_codes.STORE_AFTER_TERM)&&void 0!==a?a:0)){try{s=this.setCMIValue(n,r)}catch(e){s=this.handleValueAccessException(n,e,s)}this.processListeners(e,n,r)}return void 0===s&&(s=H),this.lastErrorCode+""=="0"&&this.settings.autocommit&&this.scheduleCommit(1e3*this.settings.autocommitSeconds,t),this.apiLog(e,": "+r+": result: "+s,je.INFO,n),"0"===this.lastErrorCode&&this.clearSCORMError(s),s}},{key:"commit",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"manual";this.clearScheduledCommit();var r=V;if(this.isNotInitialized()){var o,a=null!==(o=this._error_codes.COMMIT_BEFORE_INIT)&&void 0!==o?o:0;this.throwSCORMError("api",a),142===a&&(r=H)}else if(i&&this.isTerminated()){var s,c=null!==(s=this._error_codes.COMMIT_AFTER_TERM)&&void 0!==s?s:0;this.throwSCORMError("api",c),143===c&&(r=H)}else{var l,u,result=this.storeData(!1,n),d=null!==(l=result.errorCode)&&void 0!==l?l:0;d>0&&(result.errorMessage&&this.apiLog("commit","Commit failed with error: ".concat(result.errorMessage),je.ERROR),result.errorDetails&&this.apiLog("commit","Error details: ".concat(JSON.stringify(result.errorDetails)),je.DEBUG),this.throwSCORMError("api",d));var f=null!==(u=null==result?void 0:result.result)&&void 0!==u?u:H;this.apiLog(e," Result: "+(r="boolean"==typeof f?f+"":f),je.DEBUG,"HttpRequest"),i&&0===d&&(this.lastErrorCode="0"),this.processListeners(e),this.settings.enableOfflineSupport&&this._offlineStorageService&&this._offlineStorageService.isDeviceOnline()&&this._courseId&&this._offlineStorageService.hasPendingOfflineData(this._courseId).then(function(i){var n;i&&(t.apiLog(e,"Syncing pending offline data",je.INFO),null===(n=t._offlineStorageService)||void 0===n||n.syncOfflineData().then(function(i){i?(t.apiLog(e,"Successfully synced offline data",je.INFO),t.processListeners("OfflineDataSynced")):t.apiLog(e,"Failed to sync some offline data",je.WARN)}))})}return this.apiLog(e,"returned: "+r,je.INFO),this.isNotInitialized()||i&&this.isTerminated()||this.clearSCORMError(r),r}},{key:"getLastError",value:function(e){var t=this.lastErrorCode+"";return this.processListeners(e),this.apiLog(e,"returned: "+t,je.INFO),t}},{key:"getErrorString",value:function(e,t){var i="";return null!==t&&""!==t&&(i=this.getLmsErrorMessageDetails(t),this.processListeners(e)),i.length>255&&(i=i.substring(0,255)),this.apiLog(e,"returned: "+i,je.INFO),i}},{key:"getDiagnostic",value:function(e,t){var i="",n=""===t?this.lastErrorCode+"":t;if(null!==n&&""!==n){var r=this._errorHandlingService.lastDiagnostic;i=r&&n+""==this.lastErrorCode+""?r:this.getLmsErrorMessageDetails(n,!0),this.processListeners(e)}return i.length>255&&(i=i.substring(0,255)),this.apiLog(e,"returned: "+i,je.INFO),i}},{key:"checkState",value:function(e,t,i){return this.isNotInitialized()?(this.throwSCORMError("api",t),!1):!e||!this.isTerminated()||(this.throwSCORMError("api",i),!1)}},{key:"_checkForDuplicateId",value:function(e,t){var i=function(e,t){if(e&&"object"===(void 0===e?"undefined":Lo(e))&&t in e){var i=e[t];return Po(i,ge)?i:void 0}},n=function(e,t,i){for(var n=0;e.childArray.length>n;n++)if(n!==t){var r=e.childArray[n];if(r&&"object"===(void 0===r?"undefined":Lo(r))&&"id"in r&&r.id===i)return!0}return!1},r=e.match(/^cmi\.objectives\.(\d+)\.id$/);if(r&&r[1]){var o=parseInt(r[1],10),objectives=i(this.cmi,"objectives");return!!objectives&&n(objectives,o,t)}var a=e.match(/^cmi\.interactions\.(\d+)\.id$/);if(a&&a[1]){var s=parseInt(a[1],10),interactions=i(this.cmi,"interactions");return!!interactions&&n(interactions,s,t)}var c=e.match(/^cmi\.interactions\.(\d+)\.objectives\.(\d+)\.id$/);if(c&&c[1]&&c[2]){var l=parseInt(c[1],10),u=parseInt(c[2],10),d=i(this.cmi,"interactions");if(d){var f=d.childArray[l];if(f){var v=i(f,"objectives");if(v)return n(v,u,t)}}return!1}return!1}},{key:"getLmsErrorMessageDetails",value:function(e){throw Error("The getLmsErrorMessageDetails method has not been implemented")}},{key:"getCMIValue",value:function(e){throw Error("The getCMIValue method has not been implemented")}},{key:"setCMIValue",value:function(e,t){throw Error("The setCMIValue method has not been implemented")}},{key:"_commonSetCMIValue",value:function(e,t,i,n){var result=this._cmiValueAccessService.setCMIValue(e,t,i,n);return result===V&&this._setCMIElements.add(i),result}},{key:"_commonGetCMIValue",value:function(e,t,i){return this._cmiValueAccessService.getCMIValue(e,t,i)}},{key:"checkUninitializedGet",value:function(e,t){}},{key:"isInitialized",value:function(){return 1===this.currentState}},{key:"isNotInitialized",value:function(){return 0===this.currentState}},{key:"isTerminated",value:function(){return 2===this.currentState}},{key:"on",value:function(e,t){this._eventService.on(e,t)}},{key:"off",value:function(e,t){this._eventService.off(e,t)}},{key:"clear",value:function(e){this._eventService.clear(e)}},{key:"processListeners",value:function(e,t,i,n){void 0!==n?this._eventService.processListeners(e,t,i,n):this._eventService.processListeners(e,t,i)}},{key:"throwSCORMError",value:function(e,t,i,n){this._errorHandlingService.throwSCORMError(e,null!=t?t:0,i,n)}},{key:"clearSCORMError",value:function(e){this._errorHandlingService.clearSCORMError(e)}},{key:"loadFromFlattenedJSON",value:function(e,t){var i=this;t||(t=""),this._serializationService.loadFromFlattenedJSON(e,t,function(e,t){return i.setCMIValue(e,t)},function(){return i.isNotInitialized()},function(e){i.startingData=e})}},{key:"getFlattenedCMI",value:function(){return v(this.renderCMIToJSONObject())}},{key:"loadFromJSON",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";i&&""!==i||Object.hasOwnProperty.call(e,"cmi")||Object.hasOwnProperty.call(e,"adl")||(i="cmi"),this._serializationService.loadFromJSON(e,i,function(e,i){return t.setCMIValue(e,i)},function(){return t.isNotInitialized()},function(e){t.startingData=e})}},{key:"renderCMIToJSONString",value:function(){return this._serializationService.renderCMIToJSONString(this.cmi,this.settings.sendFullCommit)}},{key:"renderCMIToJSONObject",value:function(){return this._serializationService.renderCMIToJSONObject(this.cmi,this.settings.sendFullCommit)}},{key:"processHttpRequest",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,o=++this._commitSequence;this._pendingCommitCount+=1;var a=!1,s=!1,c=function(){a||(a=!0,i._pendingCommitCount-=1,0===i._pendingCommitCount&&i._flushCommitSettleWaiters())};try{var l=null!=r?r:n?"terminate":"manual",u=t;if(n&&this.settings.terminateCommitPayloadField){var d=this.settings.terminateCommitPayloadField;Array.isArray(u)?u=qo(u).concat(["".concat(encodeURIComponent(d),"=true")]):u&&"object"===(void 0===u?"undefined":Lo(u))&&(u=Do(No({},u),Io({},d,!0)))}!0===this.settings.includeCommitSequence&&(Array.isArray(u)?u=qo(u).concat(["commitSequence=".concat(o)]):u&&"object"===(void 0===u?"undefined":Lo(u))&&(u=Do(No({},u),{commitSequence:o})));var f,v=n&&this.settings.terminateCommitParam?y(e,this.settings.terminateCommitParam,"true"):e,h={isTerminateCommit:n,trigger:l,sequence:o},m={url:v,trigger:l,isTerminateCommit:n,sequence:o};if(this.settings.enableOfflineSupport&&this._offlineStorageService&&!this._offlineStorageService.isDeviceOnline()&&this._courseId)return this.apiLog("processHttpRequest","Device is offline, storing data locally",je.INFO),u&&"object"===(void 0===u?"undefined":Lo(u))&&"cmi"in u?this._offlineStorageService.storeOffline(this._courseId,u,{isTerminateCommit:n,sequence:o}):(this.apiLog("processHttpRequest","Invalid commit data format for offline storage",je.ERROR),{result:H,errorCode:null!==(f=this._error_codes.GENERAL)&&void 0!==f?f:101});var result=this._httpService.processHttpRequest(v,u,n,function(e,t,n,r){return i.apiLog(e,t,n,r)},function(e,t,n){"CommitSuccess"===e||"CommitError"===e?("CommitError"===e&&"number"==typeof n&&(m.errorCode=n),c(),i.processListeners(e,t,n,m)):i.processListeners(e,t,n)},h,c);return s=!0===this._httpService.reportsRequestCompletion,result}finally{s||c()}}},{key:"scheduleCommit",value:function(e,t){this._timeout||(this._timeout=new ut(this,e,t),this.apiLog("scheduleCommit","scheduled",je.DEBUG,""))}},{key:"clearScheduledCommit",value:function(){this._timeout&&(this._timeout.cancel(),this._timeout=void 0,this.apiLog("clearScheduledCommit","cleared",je.DEBUG,""))}},{key:"_checkObjectHasProperty",value:function(e,t){return null!=e&&"object"===(void 0===e?"undefined":Lo(e))&&(Object.hasOwnProperty.call(e,t)||null!=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),t)||t in e)}},{key:"handleValueAccessException",value:function(e,t,i){return Po(t,B)?(this.lastErrorCode=t.errorCode+"",""!==i&&(i=H),this.throwSCORMError(e,t.errorCode,t.errorMessage)):Po(t,Error)&&t.message?this.throwSCORMError(e,this._error_codes.GENERAL,t.message):this.throwSCORMError(e,this._error_codes.GENERAL,"Unknown error"),i}},{key:"getCommitObject",value:function(e){var t=this;return this._serializationService.getCommitObject(e,this.settings.alwaysSendTotalTime,this.settings.renderCommonCommitFields,function(e,i){return t.renderCommitObject(e,i)},function(e,i){return t.renderCommitCMI(e,i)},this.settings.logLevel)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Vo(e){return Vo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Vo(e)}function Ho(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ho=function(){return!!result})()}function Uo(e,t){return Uo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Uo(e,t)}function Go(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ko=Object.defineProperty,Yo=function(e,t,i){return function(e,t,i){return t in e?Ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Go(t))?t+"":t,i)},Wo=function(e){function t(e){var i,n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=Vo(t),n=e,!(r=Ho()?Reflect.construct(t,i||[],Vo(e).constructor):t.apply(e,i))||"object"!==Go(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,[e.CMIElement]),Yo(i,"__children"),Yo(i,"__score_range"),Yo(i,"__invalid_error_code"),Yo(i,"__invalid_type_code"),Yo(i,"__invalid_range_code"),Yo(i,"__decimal_regex"),Yo(i,"__error_class"),Yo(i,"__allow_empty_string"),Yo(i,"_raw",""),Yo(i,"_min",""),Yo(i,"_max"),i.__children=e.score_children||U.score_children,i.__score_range=!!e.score_range&&ze,i._max=e.max||""===e.max?e.max:"100",i.__invalid_error_code=e.invalidErrorCode||ue.INVALID_SET_VALUE,i.__invalid_type_code=e.invalidTypeCode||ue.TYPE_MISMATCH,i.__invalid_range_code=e.invalidRangeCode||ue.VALUE_OUT_OF_RANGE,i.__decimal_regex=e.decimalRegex||Ne,i.__error_class=e.errorClass,i.__allow_empty_string=null!==(n=e.allowEmptyString)&&void 0!==n&&n,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Uo(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1,this._raw="",this._min=""}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new this.__error_class(this._cmi_element+"._children",this.__invalid_error_code)}},{key:"raw",get:function(){return this._raw},set:function(e){To.validateScore(this._cmi_element+".raw",e,this.__decimal_regex,this.__score_range,this.__invalid_type_code,this.__invalid_range_code,this.__error_class,this.__allow_empty_string)&&(this._raw=e)}},{key:"min",get:function(){return this._min},set:function(e){To.validateScore(this._cmi_element+".min",e,this.__decimal_regex,this.__score_range,this.__invalid_type_code,this.__invalid_range_code,this.__error_class,this.__allow_empty_string)&&(this._min=e)}},{key:"max",get:function(){return this._max},set:function(e){To.validateScore(this._cmi_element+".max",e,this.__decimal_regex,this.__score_range,this.__invalid_type_code,this.__invalid_range_code,this.__error_class,this.__allow_empty_string)&&(this._max=e)}},{key:"getScoreObject",value:function(){var e={};return Number.isNaN(Number.parseFloat(this.raw))||(e.raw=Number.parseFloat(this.raw)),Number.isNaN(Number.parseFloat(this.min))||(e.min=Number.parseFloat(this.min)),Number.isNaN(Number.parseFloat(this.max))||(e.max=Number.parseFloat(this.max)),e}},{key:"toJSON",value:function(){this.jsonString=!0;var result={raw:this.raw,min:this.min,max:this.max};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function Jo(e,t,i){return Jo="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=$o(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Jo(e,t,i||e)}function $o(e){return $o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},$o(e)}function Xo(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Xo=function(){return!!result})()}function Qo(e,t){return Qo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Qo(e,t)}function Zo(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var ea=Object.defineProperty,ta=function(e,t,i){return function(e,t,i){return t in e?ea(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Zo(t))?t+"":t,i)},ia=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=$o(t),n=e,!(r=Xo()?Reflect.construct(t,i||[],$o(e).constructor):t.apply(e,i))||"object"!==Zo(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi.core"]),ta(e,"score"),ta(e,"__children",U.core_children),ta(e,"_student_id",""),ta(e,"_student_name",""),ta(e,"_lesson_location",""),ta(e,"_credit",""),ta(e,"_lesson_status","not attempted"),ta(e,"_entry",""),ta(e,"_total_time",""),ta(e,"_lesson_mode","normal"),ta(e,"_exit",""),ta(e,"_session_time","00:00:00"),ta(e,"_suspend_data",""),e.score=new Wo({CMIElement:"cmi.core.score",score_children:U.score_children,score_range:ze,invalidErrorCode:ue.INVALID_SET_VALUE,invalidTypeCode:ue.TYPE_MISMATCH,invalidRangeCode:ue.VALUE_OUT_OF_RANGE,errorClass:Q,allowEmptyString:!0}),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qo(e,t)}(t,e),i=t,(n=[{key:"initialize",value:function(){var e;Jo($o(t.prototype),"initialize",this).call(this),null===(e=this.score)||void 0===e||e.initialize()}},{key:"reset",value:function(){var e;this._initialized=!1,this._exit="",this._entry="",this._session_time="00:00:00",null===(e=this.score)||void 0===e||e.reset()}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new Q(this._cmi_element+"._children",ue.INVALID_SET_VALUE)}},{key:"student_id",get:function(){return this._student_id},set:function(student_id){if(this.initialized)throw new Q(this._cmi_element+".student_id",ue.READ_ONLY_ELEMENT);this._student_id=student_id}},{key:"student_name",get:function(){return this._student_name},set:function(student_name){if(this.initialized)throw new Q(this._cmi_element+".student_name",ue.READ_ONLY_ELEMENT);this._student_name=student_name}},{key:"lesson_location",get:function(){return this._lesson_location},set:function(lesson_location){jo(this._cmi_element+".lesson_location",lesson_location,xe,!0)&&(this._lesson_location=lesson_location)}},{key:"credit",get:function(){return this._credit},set:function(credit){if(this.initialized)throw new Q(this._cmi_element+".credit",ue.READ_ONLY_ELEMENT);jo(this._cmi_element+".credit",credit,"^(credit|no-credit)$",!0)&&(this._credit=credit)}},{key:"lesson_status",get:function(){return this._lesson_status},set:function(lesson_status){this.initialized?jo(this._cmi_element+".lesson_status",lesson_status,"^(passed|completed|failed|incomplete|browsed)$")&&(this._lesson_status=lesson_status):jo(this._cmi_element+".lesson_status",lesson_status,Le)&&(this._lesson_status=lesson_status)}},{key:"entry",get:function(){return this._entry},set:function(entry){if(this.initialized)throw new Q(this._cmi_element+".entry",ue.READ_ONLY_ELEMENT);jo(this._cmi_element+".entry",entry,"^(ab-initio|resume|)$",!0)&&(this._entry=entry)}},{key:"total_time",get:function(){return this._total_time},set:function(total_time){if(this.initialized)throw new Q(this._cmi_element+".total_time",ue.READ_ONLY_ELEMENT);if(jo(this._cmi_element+".total_time",total_time,Ie,!0))if(total_time){var e=u(total_time,Ie);this._total_time=c(e)}else this._total_time=total_time}},{key:"lesson_mode",get:function(){return this._lesson_mode},set:function(lesson_mode){if(this.initialized)throw new Q(this._cmi_element+".lesson_mode",ue.READ_ONLY_ELEMENT);jo(this._cmi_element+".lesson_mode",lesson_mode,"^(normal|browse|review)$")&&(this._lesson_mode=lesson_mode)}},{key:"exit",get:function(){if(!this.jsonString)throw new Q(this._cmi_element+".exit",ue.WRITE_ONLY_ELEMENT);return this._exit},set:function(exit){"normal"===exit&&(console.warn("SCORM 1.2: Received non-standard value 'normal' for cmi.core.exit; normalizing to empty string."),exit=""),jo(this._cmi_element+".exit",exit,"^(time-out|suspend|logout|)$",!0)&&(this._exit=exit)}},{key:"session_time",get:function(){if(!this.jsonString)throw new Q(this._cmi_element+".session_time",ue.WRITE_ONLY_ELEMENT);return this._session_time},set:function(session_time){if(jo(this._cmi_element+".session_time",session_time,Ie)){var e=u(session_time,Ie);this._session_time=c(e)}}},{key:"suspend_data",get:function(){return this._suspend_data},set:function(suspend_data){jo(this._cmi_element+".suspend_data",suspend_data,"^[\\s\\S]{0,64000}$",!0)&&(this._suspend_data=suspend_data)}},{key:"getCurrentTotalTime",value:function(e){var t,i,n,r=this._session_time;if(void 0!==e){var o=(new Date).getTime()-e;r=c(o/1e3)}return t=this._total_time,i=r,"string"==typeof(n=RegExp(Ie))&&(n=RegExp(n)),c(u(t,n)+u(i,n))}},{key:"toJSON",value:function(){this.jsonString=!0;var result={student_id:this.student_id,student_name:this.student_name,lesson_location:this.lesson_location,credit:this.credit,lesson_status:this.lesson_status,entry:this.entry,lesson_mode:this.lesson_mode,exit:this.exit,session_time:this.session_time,score:this.score};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function na(e,t,i){return t=oa(t),n=e,!(r=sa()?Reflect.construct(t,i||[],oa(e).constructor):t.apply(e,i))||"object"!==la(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function ra(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oa(e){return oa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},oa(e)}function aa(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ca(e,t)}function sa(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(sa=function(){return!!result})()}function ca(e,t){return ca=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ca(e,t)}function la(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var ua=Object.defineProperty,da=function(e,t,i){return function(e,t,i){return t in e?ua(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":la(t))?t+"":t,i)},fa=function(e){function t(){return ra(this,t),na(this,t,[{CMIElement:"cmi.objectives",children:U.objectives_children,errorCode:ue.INVALID_SET_VALUE,errorClass:Q}])}return aa(t,e),t}(ge),va=function(e){function t(){var e;return ra(this,t),e=na(this,t,["cmi.objectives.n"]),da(e,"score"),da(e,"_id",""),da(e,"_status",""),e.score=new Wo({CMIElement:"cmi.objectives.n.score",score_children:U.score_children,score_range:ze,invalidErrorCode:ue.INVALID_SET_VALUE,invalidTypeCode:ue.TYPE_MISMATCH,invalidRangeCode:ue.VALUE_OUT_OF_RANGE,errorClass:Q,allowEmptyString:!0}),e}return aa(t,e),i=t,(n=[{key:"reset",value:function(){var e;this._initialized=!1,this._id="",this._status="",null===(e=this.score)||void 0===e||e.reset()}},{key:"id",get:function(){return this._id},set:function(id){jo(this._cmi_element+".id",id,De)&&(this._id=id)}},{key:"status",get:function(){return this._status},set:function(status){jo(this._cmi_element+".status",status,Le)&&(this._status=status)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id,status:this.status,score:this.score};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function ha(e){return ha=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ha(e)}function ma(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ma=function(){return!!result})()}function pa(e,t){return pa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},pa(e,t)}function ya(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var ga=Object.defineProperty,_a=function(e,t,i){return function(e,t,i){return t in e?ga(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ya(t))?t+"":t,i)},ba=function(e){function t(e){var i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=ha(t),n=e,!(r=ma()?Reflect.construct(t,i||[],ha(e).constructor):t.apply(e,i))||"object"!==ya(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi.student_data"]),_a(i,"__children"),_a(i,"_mastery_score",""),_a(i,"_max_time_allowed",""),_a(i,"_time_limit_action",""),i.__children=e||U.student_data_children,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pa(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new Q(this._cmi_element+"._children",ue.INVALID_SET_VALUE)}},{key:"mastery_score",get:function(){return this._mastery_score},set:function(mastery_score){if(To.validateReadOnly(this._cmi_element+".mastery_score",this.initialized),null!=mastery_score){var e=mastery_score;"string"!=typeof e&&(e+=""),""!==e?jo(this._cmi_element+".mastery_score",e,Ne)&&Ro(this._cmi_element+".mastery_score",e,ze)&&(this._mastery_score=e):this._mastery_score=mastery_score}}},{key:"max_time_allowed",get:function(){return this._max_time_allowed},set:function(max_time_allowed){if(To.validateReadOnly(this._cmi_element+".max_time_allowed",this.initialized),null!=max_time_allowed){var e="string"==typeof max_time_allowed?max_time_allowed:max_time_allowed+"";this._max_time_allowed=""!==e?function(e,t){try{jo(t,e,Ie,!0);var i=u(e,Ie);return c(i)}catch(e){}try{jo(t,e,Ke,!0);var n=d(e,Ke);return c(n)}catch(e){}throw new Q(t,ue.TYPE_MISMATCH)}(e,this._cmi_element+".max_time_allowed"):""}}},{key:"time_limit_action",get:function(){return this._time_limit_action},set:function(time_limit_action){if(To.validateReadOnly(this._cmi_element+".time_limit_action",this.initialized),null!=time_limit_action){var e="string"==typeof time_limit_action?time_limit_action:time_limit_action+"";jo(this._cmi_element+".time_limit_action",e,"^(exit,message|exit,no message|continue,message|continue,no message)$",!0)&&(this._time_limit_action=e)}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={mastery_score:this.mastery_score,max_time_allowed:this.max_time_allowed,time_limit_action:this.time_limit_action};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function Sa(e){return Sa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Sa(e)}function wa(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(wa=function(){return!!result})()}function Oa(e,t){return Oa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Oa(e,t)}function Ca(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ea=Object.defineProperty,Aa=function(e,t,i){return function(e,t,i){return t in e?Ea(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Ca(t))?t+"":t,i)},ka=function(e){function t(e){var i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=Sa(t),n=e,!(r=wa()?Reflect.construct(t,i||[],Sa(e).constructor):t.apply(e,i))||"object"!==Ca(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi.student_preference"]),Aa(i,"__children"),Aa(i,"_audio",""),Aa(i,"_language",""),Aa(i,"_speed",""),Aa(i,"_text",""),i.__children=e||U.student_preference_children,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Oa(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new Q(this._cmi_element+"._children",ue.INVALID_SET_VALUE)}},{key:"audio",get:function(){return this._audio},set:function(audio){To.validateScorm12Audio(this._cmi_element+".audio",audio)&&(this._audio=audio)}},{key:"language",get:function(){return this._language},set:function(language){To.validateScorm12Language(this._cmi_element+".language",language)&&(this._language=language)}},{key:"speed",get:function(){return this._speed},set:function(speed){To.validateScorm12Speed(this._cmi_element+".speed",speed)&&(this._speed=speed)}},{key:"text",get:function(){return this._text},set:function(text){To.validateScorm12Text(this._cmi_element+".text",text)&&(this._text=text)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={audio:this.audio,language:this.language,speed:this.speed,text:this.text};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function ja(e,t,i){return t=xa(t),n=e,!(r=Pa()?Reflect.construct(t,i||[],xa(e).constructor):t.apply(e,i))||"object"!==Da(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function Ra(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ma(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function Ta(e,t,i){return Ta="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=xa(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Ta(e,t,i||e)}function xa(e){return xa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},xa(e)}function Ia(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Na(e,t)}function Pa(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Pa=function(){return!!result})()}function Na(e,t){return Na=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Na(e,t)}function Da(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var qa=Object.defineProperty,La=function(e,t,i){return function(e,t,i){return t in e?qa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Da(t))?t+"":t,i)},za=function(e){function t(){return Ra(this,t),ja(this,t,[{CMIElement:"cmi.interactions",children:U.interactions_children,errorCode:ue.INVALID_SET_VALUE,errorClass:Q}])}return Ia(t,e),t}(ge),Fa=function(e){function t(){var e;return Ra(this,t),e=ja(this,t,["cmi.interactions.n"]),La(e,"objectives"),La(e,"correct_responses"),La(e,"_id",""),La(e,"_time",""),La(e,"_type",""),La(e,"_weighting",""),La(e,"_student_response",""),La(e,"_result",""),La(e,"_latency",""),e.objectives=new ge({CMIElement:"cmi.interactions.n.objectives",errorCode:ue.INVALID_SET_VALUE,errorClass:Q,children:U.objectives_children}),e.correct_responses=new ge({CMIElement:"cmi.interactions.correct_responses",errorCode:ue.INVALID_SET_VALUE,errorClass:Q,children:U.correct_responses_children}),e}return Ia(t,e),Ma(t,[{key:"initialize",value:function(){var e,i;Ta(xa(t.prototype),"initialize",this).call(this),null===(e=this.objectives)||void 0===e||e.initialize(),null===(i=this.correct_responses)||void 0===i||i.initialize()}},{key:"reset",value:function(){var e,t;this._initialized=!1,this._id="",this._time="",this._type="",this._weighting="",this._student_response="",this._result="",this._latency="",null===(e=this.objectives)||void 0===e||e.reset(),null===(t=this.correct_responses)||void 0===t||t.reset()}},{key:"id",get:function(){if(!this.jsonString)throw new Q(this._cmi_element+".id",ue.WRITE_ONLY_ELEMENT);return this._id},set:function(id){jo(this._cmi_element+".id",id,De)&&(this._id=id)}},{key:"time",get:function(){if(!this.jsonString)throw new Q(this._cmi_element+".time",ue.WRITE_ONLY_ELEMENT);return this._time},set:function(time){jo(this._cmi_element+".time",time,"^(?:[01]\\d|2[0123]):(?:[012345]\\d):(?:[012345]\\d)(\\.\\d{1,2})?$")&&(this._time=time)}},{key:"type",get:function(){if(!this.jsonString)throw new Q(this._cmi_element+".type",ue.WRITE_ONLY_ELEMENT);return this._type},set:function(type){jo(this._cmi_element+".type",type,"^(true-false|choice|fill-in|matching|performance|sequencing|likert|numeric)$")&&(this._type=type)}},{key:"weighting",get:function(){if(!this.jsonString)throw new Q(this._cmi_element+".weighting",ue.WRITE_ONLY_ELEMENT);return this._weighting},set:function(weighting){jo(this._cmi_element+".weighting",weighting,Ne)&&Ro(this._cmi_element+".weighting",weighting,"-100#100")&&(this._weighting=weighting)}},{key:"student_response",get:function(){if(!this.jsonString)throw new Q(this._cmi_element+".student_response",ue.WRITE_ONLY_ELEMENT);return this._student_response},set:function(student_response){jo(this._cmi_element+".student_response",student_response,qe,!0)&&(this._student_response=student_response)}},{key:"result",get:function(){if(!this.jsonString)throw new Q(this._cmi_element+".result",ue.WRITE_ONLY_ELEMENT);return this._result},set:function(result){var e=result;"incorrect"===result&&(e="wrong",console.warn("SCORM 1.2: Received non-standard value 'incorrect' for cmi.interactions.n.result; normalizing to 'wrong'.")),jo(this._cmi_element+".result",e,"^(correct|wrong|unanticipated|neutral|([0-9]{0,3})?(\\.[0-9]*)?)$")&&(this._result=e)}},{key:"latency",get:function(){if(!this.jsonString)throw new Q(this._cmi_element+".latency",ue.WRITE_ONLY_ELEMENT);return this._latency},set:function(latency){if(jo(this._cmi_element+".latency",latency,Ie)){var e=u(latency,Ie);this._latency=c(e)}}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id,time:this.time,type:this.type,weighting:this.weighting,student_response:this.student_response,result:this.result,latency:this.latency,objectives:this.objectives,correct_responses:this.correct_responses};return this.jsonString=!1,result}}]),t}(A),Ba=function(e){function t(){var e;return Ra(this,t),e=ja(this,t,["cmi.interactions.n.objectives.n"]),La(e,"_id",""),e}return Ia(t,e),Ma(t,[{key:"reset",value:function(){this._initialized=!1,this._id=""}},{key:"id",get:function(){if(!this.jsonString)throw new Q(this._cmi_element+".id",ue.WRITE_ONLY_ELEMENT);return this._id},set:function(id){jo(this._cmi_element+".id",id,De)&&(this._id=id)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id};return this.jsonString=!1,result}}]),t}(A),Va=function(e){function t(){var e;return Ra(this,t),e=ja(this,t,["cmi.interactions.correct_responses.n"]),La(e,"_pattern",""),e}return Ia(t,e),Ma(t,[{key:"reset",value:function(){this._initialized=!1,this._pattern=""}},{key:"pattern",get:function(){if(!this.jsonString)throw new Q(this._cmi_element+".pattern",ue.WRITE_ONLY_ELEMENT);return this._pattern},set:function(pattern){jo(this._cmi_element+".pattern",pattern,qe,!0)&&(this._pattern=pattern)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={pattern:this._pattern};return this.jsonString=!1,result}}]),t}(A);function Ha(e,t,i){return Ha="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ua(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Ha(e,t,i||e)}function Ua(e){return Ua=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ua(e)}function Ga(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ga=function(){return!!result})()}function Ka(e,t){return Ka=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ka(e,t)}function Ya(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Wa=Object.defineProperty,Ja=function(e,t,i){return function(e,t,i){return t in e?Wa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Ya(t))?t+"":t,i)},$a=function(e){function t(e,student_data,i){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,i){return t=Ua(t),n=e,!(r=Ga()?Reflect.construct(t,i||[],Ua(e).constructor):t.apply(e,i))||"object"!==Ya(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),Ja(n,"__children",""),Ja(n,"__version","3.4"),Ja(n,"_launch_data",""),Ja(n,"_comments",""),Ja(n,"_comments_from_lms",""),Ja(n,"core"),Ja(n,"objectives"),Ja(n,"student_data"),Ja(n,"student_preference"),Ja(n,"interactions"),i&&n.initialize(),n.__children=e||U.cmi_children,n.core=new ia,n.objectives=new fa,n.student_data=student_data||new ba,n.student_preference=new ka,n.interactions=new za,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ka(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){var e,t,i,n,r;this._initialized=!1,this._start_time=void 0,this._launch_data="",this._comments="",null===(e=this.core)||void 0===e||e.reset(),null===(t=this.objectives)||void 0===t||t.reset(!0),null===(i=this.interactions)||void 0===i||i.reset(!0),null===(n=this.student_data)||void 0===n||n.reset(),null===(r=this.student_preference)||void 0===r||r.reset()}},{key:"initialize",value:function(){var e,i,n,r,o;Ha(Ua(t.prototype),"initialize",this).call(this),null===(e=this.core)||void 0===e||e.initialize(),null===(i=this.objectives)||void 0===i||i.initialize(),null===(n=this.student_data)||void 0===n||n.initialize(),null===(r=this.student_preference)||void 0===r||r.initialize(),null===(o=this.interactions)||void 0===o||o.initialize()}},{key:"toJSON",value:function(){this.jsonString=!0;var result={suspend_data:this.suspend_data,launch_data:this.launch_data,comments:this.comments,comments_from_lms:this.comments_from_lms,core:this.core,objectives:this.objectives,student_data:this.student_data,student_preference:this.student_preference,interactions:this.interactions};return this.jsonString=!1,result}},{key:"_version",get:function(){return this.__version},set:function(_version){throw new Q(this._cmi_element+"._version",ue.INVALID_SET_VALUE)}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new Q(this._cmi_element+"._children",ue.INVALID_SET_VALUE)}},{key:"suspend_data",get:function(){var e;return null===(e=this.core)||void 0===e?void 0:e.suspend_data},set:function(suspend_data){this.core&&(this.core.suspend_data=suspend_data)}},{key:"launch_data",get:function(){return this._launch_data},set:function(launch_data){if(this.initialized)throw new Q(this._cmi_element+".launch_data",ue.READ_ONLY_ELEMENT);this._launch_data=launch_data}},{key:"comments",get:function(){return this._comments},set:function(comments){jo(this._cmi_element+".comments",comments,"^[\\s\\S]{0,4096}$",!0)&&(this._comments=comments)}},{key:"comments_from_lms",get:function(){return this._comments_from_lms},set:function(comments_from_lms){if(this.initialized)throw new Q(this._cmi_element+".comments_from_lms",ue.READ_ONLY_ELEMENT);this._comments_from_lms=comments_from_lms}},{key:"getCurrentTotalTime",value:function(){return this.core.getCurrentTotalTime(this.start_time)}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(k);function Xa(e){return Xa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Xa(e)}function Qa(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Qa=function(){return!!result})()}function Za(e,t){return Za=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Za(e,t)}function es(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var ts=Object.defineProperty,is=function(e){function t(){var e,i,n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Xa(t),n=e,!(r=Qa()?Reflect.construct(t,i||[],Xa(e).constructor):t.apply(e,i))||"object"!==es(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi.nav"]),n="",function(e,t,i){t in e?ts(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==es(i="_event")?i+"":i,n),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Za(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._event="",this._initialized=!1}},{key:"event",get:function(){return this._event},set:function(e){(""===e||jo(this._cmi_element+".event",e,"^(_?(previous|continue|start|resumeAll|exit|exitAll|abandon|abandonAll|suspendAll|retry|retryAll)|choice|jump|_none_)$"))&&(this._event=e)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={event:this.event};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function ns(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function rs(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function os(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function as(e){return as=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},as(e)}function ss(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ss=function(){return!!result})()}function cs(e,t){return cs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},cs(e,t)}function ls(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var us=Object.defineProperty,ds=function(e,t,i){return function(e,t,i){return t in e?us(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ls(t))?t+"":t,i)},fs=function(e){function t(e,i){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=e?function(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){os(e,t,i[t])})}return e}({},e):void 0;return r&&void 0===r.mastery_override&&(r.mastery_override=!0),n=function(e,t,i){return t=as(t),n=e,!(r=ss()?Reflect.construct(t,i||[],as(e).constructor):t.apply(e,i))||"object"!==ls(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,[ue,r,i]),ds(n,"statusSetByModule",!1),ds(n,"cmi"),ds(n,"nav"),ds(n,"LMSInitialize"),ds(n,"LMSFinish"),ds(n,"LMSGetValue"),ds(n,"LMSSetValue"),ds(n,"LMSCommit"),ds(n,"LMSGetLastError"),ds(n,"LMSGetErrorString"),ds(n,"LMSGetDiagnostic"),n.cmi=new $a,n.nav=new is,n.settings.globalStudentPreferences&&t._globalLearnerPrefs&&(""!==t._globalLearnerPrefs.audio&&(n.cmi.student_preference.audio=t._globalLearnerPrefs.audio),""!==t._globalLearnerPrefs.language&&(n.cmi.student_preference.language=t._globalLearnerPrefs.language),""!==t._globalLearnerPrefs.speed&&(n.cmi.student_preference.speed=t._globalLearnerPrefs.speed),""!==t._globalLearnerPrefs.text&&(n.cmi.student_preference.text=t._globalLearnerPrefs.text)),n.LMSInitialize=n.lmsInitialize,n.LMSFinish=n.lmsFinish,n.LMSGetValue=n.lmsGetValue,n.LMSSetValue=n.lmsSetValue,n.LMSCommit=n.lmsCommit,n.LMSGetLastError=n.lmsGetLastError,n.LMSGetErrorString=n.lmsGetErrorString,n.LMSGetDiagnostic=n.lmsGetDiagnostic,n}var i,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&cs(e,t)}(t,e),i=t,n=[{key:"reset",value:function(e){var t,i;this.commonReset(e),null===(t=this.cmi)||void 0===t||t.reset(),null===(i=this.nav)||void 0===i||i.reset(),this.statusSetByModule=!1}},{key:"lmsInitialize",value:function(){return""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")?(this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),H):(this.cmi.initialize(),this.cmi.core.lesson_status?this.statusSetByModule=!0:this.cmi.core.lesson_status="not attempted",this.initialize("LMSInitialize","LMS was already initialized!","LMS is already finished!"))}},{key:"lmsFinish",value:function(){if(""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))return this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),H;var result=this.terminate("LMSFinish",!0);return result===V&&(""!==this.nav.event?this.processListeners("continue"===this.nav.event?"SequenceNext":"SequencePrevious"):this.settings.autoProgress&&this.processListeners("SequenceNext")),result}},{key:"lmsGetValue",value:function(e){return this.getValue("LMSGetValue",!1,e)}},{key:"lmsSetValue",value:function(e,t){return"cmi.core.lesson_status"===e&&(this.statusSetByModule=!0),this.setValue("LMSSetValue","LMSCommit",!1,e,t)}},{key:"lmsCommit",value:function(){return""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")?(this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),H):this.settings.throttleCommits?(this.scheduleCommit(500,"LMSCommit"),V):this.commit("LMSCommit",!1)}},{key:"lmsGetLastError",value:function(){return this.getLastError("LMSGetLastError")}},{key:"lmsGetErrorString",value:function(e){return this.getErrorString("LMSGetErrorString",e)}},{key:"lmsGetDiagnostic",value:function(e){return this.getDiagnostic("LMSGetDiagnostic",e)}},{key:"setCMIValue",value:function(e,t){var result=this._commonSetCMIValue("LMSSetValue",!1,e,t);return result===V&&this.settings.globalStudentPreferences&&("cmi.student_preference.audio"===e?this._updateGlobalPreference("audio",t):"cmi.student_preference.language"===e?this._updateGlobalPreference("language",t):"cmi.student_preference.speed"===e?this._updateGlobalPreference("speed",t):"cmi.student_preference.text"===e&&this._updateGlobalPreference("text",t)),result}},{key:"_updateGlobalPreference",value:function(e,i){t._globalLearnerPrefs||(t._globalLearnerPrefs={audio:"",language:"",speed:"",text:""}),t._globalLearnerPrefs[e]=i}},{key:"getCMIValue",value:function(e){return this._commonGetCMIValue("getCMIValue",!1,e)}},{key:"getChildElement",value:function(e,t,i){return m(e,"cmi\\.objectives\\.\\d+")?new va:i&&m(e,"cmi\\.interactions\\.\\d+\\.correct_responses\\.\\d+")?new Va:i&&m(e,"cmi\\.interactions\\.\\d+\\.objectives\\.\\d+")?new Ba:!i&&m(e,"cmi\\.interactions\\.\\d+")?new Fa:null}},{key:"validateCorrectResponse",value:function(e,t){}},{key:"getLmsErrorMessageDetails",value:function(e,t){var i,n,r="No Error",o="No Error";return U.error_descriptions[e+=""]&&(r=(null===(i=U.error_descriptions[e])||void 0===i?void 0:i.basicMessage)||r,o=(null===(n=U.error_descriptions[e])||void 0===n?void 0:n.detailMessage)||o),t?o:r}},{key:"replaceWithAnotherScormAPI",value:function(e){this.cmi=e.cmi}},{key:"renderCommitCMI",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.renderCMIToJSONObject();(e||t)&&(i.cmi.core.total_time=this.cmi.getCurrentTotalTime());var n=v(i);switch(this.settings.dataCommitFormat){case"flattened":return n;case"params":return Object.entries(n).map(function(e){var t,i,n=(i=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(t,i)||function(e,t){if(e){if("string"==typeof e)return ns(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ns(e,t):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=n[1];return"".concat(n[0],"=").concat(r)});default:return i}}},{key:"renderCommitObject",value:function(e){var t,i,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=this.renderCommitCMI(e,r),a=e||r?this.cmi.getCurrentTotalTime():"",s=u(a,Ie),c=this.cmi.core.lesson_status,l=ke,d=Ce;c&&(l="completed"===c||"passed"===c?Ee:Ae,"passed"===c?d=we:"failed"===c&&(d=Oe));var f=(null===(n=this.cmi)||void 0===n||null===(i=n.core)||void 0===i||null===(t=i.score)||void 0===t?void 0:t.getScoreObject())||{},v={successStatus:d,completionStatus:l,runtimeData:o,totalTimeSeconds:s};return f&&(v.score=f),this.settings.autoPopulateCommitMetadata&&(this.settings.courseId&&(v.courseId=this.settings.courseId),this.settings.scoId&&(v.scoId=this.settings.scoId),this.cmi.core.student_id&&(v.learnerId=this.cmi.core.student_id),this.cmi.core.student_name&&(v.learnerName=this.cmi.core.student_name)),v}},{key:"storeData",value:function(e,t){if(e){var i,n,r;if("browse"===this.cmi.core.lesson_mode&&""===((null===(r=this.startingData)||void 0===r||null===(n=r.cmi)||void 0===n||null===(i=n.core)||void 0===i?void 0:i.lesson_status)||"")&&"not attempted"===this.cmi.core.lesson_status)return this.cmi.core.lesson_status="browsed",this.processCommitData(e,t);if(this.cmi.core.lesson_status&&(this.statusSetByModule||"not attempted"!==this.cmi.core.lesson_status)||(this.cmi.core.lesson_status=this.settings.autoCompleteLessonStatus?"completed":"incomplete"),"normal"===this.cmi.core.lesson_mode&&"credit"===this.cmi.core.credit&&this.settings.mastery_override&&""!==this.cmi.student_data.mastery_score&&""!==this.cmi.core.score.raw){var o=parseFloat(this.cmi.core.score.raw),a=parseFloat(this.cmi.student_data.mastery_score);isNaN(o)||isNaN(a)||(this.cmi.core.lesson_status=a>o?"failed":"passed")}if(this.settings.score_overrides_status&&this.statusSetByModule&&"normal"===this.cmi.core.lesson_mode&&"credit"===this.cmi.core.credit&&""!==this.cmi.student_data.mastery_score&&""!==this.cmi.core.score.raw){var s=parseFloat(this.cmi.core.score.raw),c=parseFloat(this.cmi.student_data.mastery_score);isNaN(s)||isNaN(c)||(this.cmi.core.lesson_status=c>s?"failed":"passed")}}return this.processCommitData(e,t)}},{key:"processCommitData",value:function(e,t){var i=this.getCommitObject(e);return"string"==typeof this.settings.lmsCommitUrl?this.processHttpRequest(this.settings.lmsCommitUrl,i,e,t):{result:V,errorCode:0}}}],r=[{key:"clearGlobalPreferences",value:function(){t._globalLearnerPrefs=null}}],n&&rs(i.prototype,n),r&&rs(i,r),t}(Bo);ds(fs,"_globalLearnerPrefs",null);var Scorm12API=fs;function vs(e){return vs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},vs(e)}function hs(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(hs=function(){return!!result})()}function ms(e,t){return ms=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ms(e,t)}function ps(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var ys=Object.defineProperty,gs=function(e,t,i){return function(e,t,i){return t in e?ys(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ps(t))?t+"":t,i)},_s=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=vs(t),n=e,!(r=hs()?Reflect.construct(t,i||[],vs(e).constructor):t.apply(e,i))||"object"!==ps(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi.learner_preference"]),gs(e,"__children",G.student_preference_children),gs(e,"_audio_level","1"),gs(e,"_language",""),gs(e,"_delivery_speed","1"),gs(e,"_audio_captioning","0"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ms(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new oe(this._cmi_element+"._children",de.READ_ONLY_ELEMENT)}},{key:"audio_level",get:function(){return this._audio_level},set:function(audio_level){fn(this._cmi_element+".audio_level",audio_level,Ye)&&vn(this._cmi_element+".audio_level",audio_level,"0#999.9999999")&&(this._audio_level=audio_level)}},{key:"language",get:function(){return this._language},set:function(language){fn(this._cmi_element+".language",language,"^([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?$|^$")&&(this._language=language)}},{key:"delivery_speed",get:function(){return this._delivery_speed},set:function(delivery_speed){if(fn(this._cmi_element+".delivery_speed",delivery_speed,Ye)&&vn(this._cmi_element+".delivery_speed",delivery_speed,"0#999.9999999")){if(0===parseFloat(delivery_speed))throw new oe(this._cmi_element+".delivery_speed",de.VALUE_OUT_OF_RANGE);this._delivery_speed=delivery_speed}}},{key:"audio_captioning",get:function(){return this._audio_captioning},set:function(audio_captioning){fn(this._cmi_element+".audio_captioning",audio_captioning,"^-?([0-9]+)$")&&vn(this._cmi_element+".audio_captioning",audio_captioning,"-1#1")&&(this._audio_captioning=audio_captioning)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={audio_level:this.audio_level,language:this.language,delivery_speed:this.delivery_speed,audio_captioning:this.audio_captioning};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function bs(e){return e.replace(/[[\]]/g,"")}function Ss(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ws(e,t){if(!t)return[e];if(e.includes(t))return e.split(t);var i=bs(t);if(!i)return[e];var n=RegExp("(?<!\\\\)".concat(Ss(i)),"g"),r=RegExp("\\\\".concat(Ss(i)),"g");return e.split(n).map(function(e){return e.replace(r,i)})}function Os(e,t){var i;if(!t)return[e];if(e.includes(t)){var n=e.indexOf(t);return[e.slice(0,n),e.slice(n+t.length)]}var r=bs(t);if(!r)return[e];var o=RegExp("(?<!\\\\)".concat(Ss(r))),a=RegExp("\\\\".concat(Ss(r)),"g"),s=e.split(o),c=(null!==(i=s[0])&&void 0!==i?i:"").replace(a,r);return 1===s.length?[c]:[c,s.slice(1).join(r).replace(a,r)]}function Cs(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Es(e,t,i){return t=Rs(t),n=e,!(r=Ts()?Reflect.construct(t,i||[],Rs(e).constructor):t.apply(e,i))||"object"!==Ps(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function As(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ks(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function js(e,t,i){return js="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Rs(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},js(e,t,i||e)}function Rs(e){return Rs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Rs(e)}function Ms(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&xs(e,t)}function Ts(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ts=function(){return!!result})()}function xs(e,t){return xs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},xs(e,t)}function Is(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Cs(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Cs(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ps(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ns=Object.defineProperty,Ds=function(e,t,i){return function(e,t,i){return t in e?Ns(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Ps(t))?t+"":t,i)},qs=function(e){function t(){return As(this,t),Es(this,t,[{CMIElement:"cmi.interactions",children:G.interactions_children,errorCode:de.READ_ONLY_ELEMENT,errorClass:oe}])}return Ms(t,e),t}(ge),Ls=function(e){function t(){var e;return As(this,t),e=Es(this,t,["cmi.interactions.n"]),Ds(e,"_id",""),Ds(e,"_idIsSet",!1),Ds(e,"_type",""),Ds(e,"_timestamp",""),Ds(e,"_weighting",""),Ds(e,"_learner_response",""),Ds(e,"_result",""),Ds(e,"_latency",""),Ds(e,"_description",""),Ds(e,"objectives"),Ds(e,"correct_responses"),e.objectives=new ge({CMIElement:"cmi.interactions.n.objectives",errorCode:de.READ_ONLY_ELEMENT,errorClass:oe,children:G.objectives_children}),e.correct_responses=new ge({CMIElement:"cmi.interactions.n.correct_responses",errorCode:de.READ_ONLY_ELEMENT,errorClass:oe,children:G.correct_responses_children}),e}return Ms(t,e),ks(t,[{key:"initialize",value:function(){var e,i;js(Rs(t.prototype),"initialize",this).call(this),null===(e=this.objectives)||void 0===e||e.initialize(),null===(i=this.correct_responses)||void 0===i||i.initialize()}},{key:"reset",value:function(){this._initialized=!1,this._id="",this._idIsSet=!1,this._type="",this._timestamp="",this._weighting="",this._learner_response="",this._result="",this._latency="",this._description="",this.objectives=new ge({CMIElement:"cmi.interactions.n.objectives",errorCode:de.READ_ONLY_ELEMENT,errorClass:oe,children:G.objectives_children}),this.correct_responses=new ge({CMIElement:"cmi.interactions.n.correct_responses",errorCode:de.READ_ONLY_ELEMENT,errorClass:oe,children:G.correct_responses_children})}},{key:"id",get:function(){return this._id},set:function(id){if(""===id||""===id.trim())throw new oe(this._cmi_element+".id",de.TYPE_MISMATCH);if(this._idIsSet&&this._id!==id)throw new oe(this._cmi_element+".id",de.GENERAL_SET_FAILURE);fn(this._cmi_element+".id",id,Je)&&(this._id=id,this._idIsSet=!0)}},{key:"type",get:function(){return this._type},set:function(type){if(this.initialized&&""===this._id)throw new oe(this._cmi_element+".type",de.DEPENDENCY_NOT_ESTABLISHED);fn(this._cmi_element+".type",type,"^(true-false|choice|fill-in|long-fill-in|matching|performance|sequencing|likert|numeric|other)$")&&(this._type=type)}},{key:"timestamp",get:function(){return this._timestamp},set:function(timestamp){if(this.initialized&&""===this._id)throw new oe(this._cmi_element+".timestamp",de.DEPENDENCY_NOT_ESTABLISHED);fn(this._cmi_element+".timestamp",timestamp,Ge)&&(this._timestamp=timestamp)}},{key:"weighting",get:function(){return this._weighting},set:function(weighting){if(this.initialized&&""===this._id)throw new oe(this._cmi_element+".weighting",de.DEPENDENCY_NOT_ESTABLISHED);fn(this._cmi_element+".weighting",weighting,Ye)&&(this._weighting=weighting)}},{key:"learner_response",get:function(){return this._learner_response},set:function(learner_response){if(this.initialized&&(""===this._type||""===this._id))throw new oe(this._cmi_element+".learner_response",de.DEPENDENCY_NOT_ESTABLISHED);var e=[],t=nt[this.type];if(!t)throw new oe(this._cmi_element+".learner_response",de.TYPE_MISMATCH);if((null==t?void 0:t.delimiter)?e=ws(learner_response,t.delimiter):e[0]=learner_response,0>=e.length||e.length>t.max)throw new oe(this._cmi_element+".learner_response",de.GENERAL_SET_FAILURE);for(var i=RegExp(t.format),n=0;e.length>n;n++)if(null==t?void 0:t.delimiter2){var r,o,a,s=null!==(r=e[n])&&void 0!==r?r:"",c="performance"===this.type?Os(s,t.delimiter2):ws(s,t.delimiter2);if(2!==(null==c?void 0:c.length))throw new oe(this._cmi_element+".learner_response",de.TYPE_MISMATCH);if("performance"===this.type&&""===c[0]&&""===c[1])throw new oe(this._cmi_element+".learner_response",de.TYPE_MISMATCH);if(!(null===(o=c[0])||void 0===o?void 0:o.match(i)))throw new oe(this._cmi_element+".learner_response",de.TYPE_MISMATCH);if(!t.format2||!(null===(a=c[1])||void 0===a?void 0:a.match(RegExp(t.format2))))throw new oe(this._cmi_element+".learner_response",de.TYPE_MISMATCH)}else{var l;if(!(null===(l=e[n])||void 0===l?void 0:l.match(i)))throw new oe(this._cmi_element+".learner_response",de.TYPE_MISMATCH);if(""!==e[n]&&t.unique)for(var u=0;n>u;u++)if(e[n]===e[u])throw new oe(this._cmi_element+".learner_response",de.TYPE_MISMATCH)}this._learner_response=learner_response}},{key:"result",get:function(){return this._result},set:function(result){fn(this._cmi_element+".result",result,"^(correct|incorrect|unanticipated|neutral|-?([0-9]{1,4})(\\.[0-9]{1,18})?)$")&&(this._result=result)}},{key:"latency",get:function(){return this._latency},set:function(latency){if(this.initialized&&""===this._id)throw new oe(this._cmi_element+".latency",de.DEPENDENCY_NOT_ESTABLISHED);fn(this._cmi_element+".latency",latency,Ke)&&(this._latency=latency)}},{key:"description",get:function(){return this._description},set:function(description){if(this.initialized&&""===this._id)throw new oe(this._cmi_element+".description",de.DEPENDENCY_NOT_ESTABLISHED);fn(this._cmi_element+".description",description,He,!0)&&(this._description=description)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id,type:this.type,objectives:this.objectives,timestamp:this.timestamp,weighting:this.weighting,learner_response:this.learner_response,result:this.result,latency:this.latency,description:this.description,correct_responses:this.correct_responses};return this.jsonString=!1,result}}]),t}(A),zs=function(e){function t(){var e;return As(this,t),e=Es(this,t,["cmi.interactions.n.objectives.n"]),Ds(e,"_id",""),e}return Ms(t,e),ks(t,[{key:"reset",value:function(){this._initialized=!1,this._id=""}},{key:"id",get:function(){return this._id},set:function(id){if(""===id||""===id.trim())throw new oe(this._cmi_element+".id",de.TYPE_MISMATCH);fn(this._cmi_element+".id",id,Je)&&(this._id=id)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id};return this.jsonString=!1,result}}]),t}(A),Fs=/^\{(?:lang|case_matters|order_matters)=[^}]+\}/;function Bs(e){for(var result=e;Fs.test(result);)result=result.replace(Fs,"");return result}var Vs=function(e){function t(e){var i;return As(this,t),i=Es(this,t,["cmi.interactions.n.correct_responses.n"]),Ds(i,"_pattern",""),Ds(i,"_interactionType"),i._interactionType=e,i}return Ms(t,e),ks(t,[{key:"reset",value:function(){this._initialized=!1,this._pattern=""}},{key:"pattern",get:function(){return this._pattern},set:function(pattern){if("fill-in"!==this._interactionType||""!==pattern){if(fn(this._cmi_element+".pattern",pattern,"^.*$")){if(this._interactionType){var e=rt[this._interactionType];e&&("matching"===this._interactionType&&/\\[.,]/.test(pattern)||function(type,pattern,e){if(pattern.trim()!==pattern)throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH);var t=e.delimiter?ws(pattern,e.delimiter):[pattern],i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if(s.trim()!==s)throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}if("fill-in"!==type||""!==pattern){var c=e.delimiter?ws(pattern,e.delimiter):[pattern];if(!e.delimiter&&pattern.includes(","))throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH);if("numeric"!==type&&(e.unique||!1===e.duplicate)&&new Set(c).size!==c.length)throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH);if(0===c.length||c.length>e.max)throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.GENERAL_SET_FAILURE);var l=RegExp(e.format),u=e.format2?RegExp(e.format2):null,d=function(e){if(!l.test(e))throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH)},f=function(e,t){if(!t)throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH);var i=ws(e,t);if(2!==i.length||""===i[0]||""===i[1])throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH);if(void 0!==i[0]&&!l.test(i[0])||u&&void 0!==i[1]&&!u.test(i[1]))throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH)},v=!0,h=!1,m=void 0;try{for(var p,y=c[Symbol.iterator]();!(v=(p=y.next()).done);v=!0){var g=p.value;switch(type){case"numeric":if(""===g){if(2>c.length||!e.delimiter||!pattern.includes(e.delimiter))throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH);break}d(g);break;case"performance":var _=e.delimiter2;if(!_)throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH);var b=Os(Bs(g),_);if(2!==b.length)throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH);var S=Is(b,2),w=S[0],O=S[1];if(""===w&&""===O)throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH);if(void 0===w||!l.test(w))throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH);if(u&&void 0!==O&&!u.test(O))throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH);break;default:e.delimiter2?f(g,e.delimiter2):d(g)}}}catch(e){h=!0,m=e}finally{try{v||null==y.return||y.return()}finally{if(h)throw m}}}}(this._interactionType,pattern,e))}this._pattern=pattern}}else this._pattern=""}},{key:"toJSON",value:function(){this.jsonString=!0;var result={pattern:this.pattern};return this.jsonString=!1,result}}]),t}(A);function Hs(e,t,i){return Hs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Us(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Hs(e,t,i||e)}function Us(e){return Us=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Us(e)}function Gs(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Gs=function(){return!!result})()}function Ks(e,t){return Ks=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ks(e,t)}function Ys(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ws=Object.defineProperty,Js=function(e){function t(){var e,i,n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Us(t),n=e,!(r=Gs()?Reflect.construct(t,i||[],Us(e).constructor):t.apply(e,i))||"object"!==Ys(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,[{CMIElement:"cmi.score",score_children:G.score_children,max:"",invalidErrorCode:de.READ_ONLY_ELEMENT,invalidTypeCode:de.TYPE_MISMATCH,invalidRangeCode:de.VALUE_OUT_OF_RANGE,decimalRegex:Ye,errorClass:oe}]),n="",function(e,t,i){t in e?Ws(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==Ys(i="_scaled")?i+"":i,n),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ks(e,t)}(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1,this._scaled="",this._raw="",this._min="",this._max=""}},{key:"scaled",get:function(){return this._scaled},set:function(e){fn(this._cmi_element+".scaled",e,Ye)&&vn(this._cmi_element+".scaled",e,"-1#1")&&(this._scaled=e)}},{key:"getScoreObject",value:function(){var e=Hs(Us(t.prototype),"getScoreObject",this).call(this);return Number.isNaN(Number.parseFloat(this.scaled))||(e.scaled=Number.parseFloat(this.scaled)),e}},{key:"toJSON",value:function(){this.jsonString=!0;var result={scaled:this.scaled,raw:this.raw,min:this.min,max:this.max};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(Wo);function $s(e,t,i){return t=Qs(t),n=e,!(r=ec()?Reflect.construct(t,i||[],Qs(e).constructor):t.apply(e,i))||"object"!==ic(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function Xs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qs(e){return Qs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Qs(e)}function Zs(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&tc(e,t)}function ec(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ec=function(){return!!result})()}function tc(e,t){return tc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},tc(e,t)}function ic(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var nc=Object.defineProperty,rc=function(e,t,i){return function(e,t,i){return t in e?nc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ic(t))?t+"":t,i)},oc=function(e){function t(){return Xs(this,t),$s(this,t,[{CMIElement:"cmi.comments_from_lms",children:G.comments_children,errorCode:de.READ_ONLY_ELEMENT,errorClass:oe}])}return Zs(t,e),t}(ge),ac=function(e){function t(){return Xs(this,t),$s(this,t,[{CMIElement:"cmi.comments_from_learner",children:G.comments_children,errorCode:de.READ_ONLY_ELEMENT,errorClass:oe}])}return Zs(t,e),t}(ge),sc=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Xs(this,t),e=$s(this,t,["cmi.comments_from_learner.n"]),rc(e,"_comment",""),rc(e,"_location",""),rc(e,"_timestamp",""),rc(e,"_readOnlyAfterInit"),e._comment="",e._location="",e._timestamp="",e._readOnlyAfterInit=i,e}return Zs(t,e),i=t,(n=[{key:"reset",value:function(){this._initialized=!1}},{key:"comment",get:function(){return this._comment},set:function(comment){if(this.initialized&&this._readOnlyAfterInit)throw new oe(this._cmi_element+".comment",de.READ_ONLY_ELEMENT);fn(this._cmi_element+".comment",comment,Ue,!0)&&(this._comment=comment)}},{key:"location",get:function(){return this._location},set:function(location){if(this.initialized&&this._readOnlyAfterInit)throw new oe(this._cmi_element+".location",de.READ_ONLY_ELEMENT);fn(this._cmi_element+".location",location,"^[\\u0000-\\uFFFF]{0,250}$")&&(this._location=location)}},{key:"timestamp",get:function(){return this._timestamp},set:function(timestamp){if(this.initialized&&this._readOnlyAfterInit)throw new oe(this._cmi_element+".timestamp",de.READ_ONLY_ELEMENT);fn(this._cmi_element+".timestamp",timestamp,Ge)&&(this._timestamp=timestamp)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={comment:this.comment,location:this.location,timestamp:this.timestamp};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function cc(e,t,i){return t=fc(t),n=e,!(r=hc()?Reflect.construct(t,i||[],fc(e).constructor):t.apply(e,i))||"object"!==pc(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function lc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function uc(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function dc(e,t,i){return dc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=fc(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},dc(e,t,i||e)}function fc(e){return fc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},fc(e)}function vc(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&mc(e,t)}function hc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(hc=function(){return!!result})()}function mc(e,t){return mc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},mc(e,t)}function pc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var yc=Object.defineProperty,gc=function(e,t,i){return function(e,t,i){return t in e?yc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":pc(t))?t+"":t,i)},_c=function(e){function t(){return lc(this,t),cc(this,t,[{CMIElement:"cmi.objectives",children:G.objectives_children,errorCode:de.READ_ONLY_ELEMENT,errorClass:oe}])}return vc(t,e),uc(t,[{key:"findObjectiveById",value:function(id){return this.childArray.find(function(e){return e.id===id})}},{key:"findObjectiveByIndex",value:function(e){return this.childArray[e]}},{key:"setObjectiveByIndex",value:function(e,t){this.childArray[e]=t}}]),t}(ge),bc=function(e){function t(){var e;return lc(this,t),e=cc(this,t,["cmi.objectives.n"]),gc(e,"_id",""),gc(e,"_idIsSet",!1),gc(e,"_success_status","unknown"),gc(e,"_completion_status","unknown"),gc(e,"_progress_measure",""),gc(e,"_description",""),gc(e,"score"),e.score=new Js,e}return vc(t,e),uc(t,[{key:"reset",value:function(){var e;this._initialized=!1,this._id="",this._idIsSet=!1,this._success_status="unknown",this._completion_status="unknown",this._progress_measure="",this._description="",null===(e=this.score)||void 0===e||e.reset()}},{key:"initialize",value:function(){var e;dc(fc(t.prototype),"initialize",this).call(this),null===(e=this.score)||void 0===e||e.initialize()}},{key:"id",get:function(){return this._id},set:function(id){if(""===id||""===id.trim())throw new oe(this._cmi_element+".id",de.TYPE_MISMATCH);if(this._idIsSet&&this._id!==id)throw new oe(this._cmi_element+".id",de.GENERAL_SET_FAILURE);fn(this._cmi_element+".id",id,Je)&&(this._id=id,this._idIsSet=!0)}},{key:"success_status",get:function(){return this._success_status},set:function(success_status){if(this.initialized&&""===this._id)throw new oe(this._cmi_element+".success_status",de.DEPENDENCY_NOT_ESTABLISHED);fn(this._cmi_element+".success_status",success_status,Xe)&&(this._success_status=success_status)}},{key:"completion_status",get:function(){return this._completion_status},set:function(completion_status){if(this.initialized&&""===this._id)throw new oe(this._cmi_element+".completion_status",de.DEPENDENCY_NOT_ESTABLISHED);fn(this._cmi_element+".completion_status",completion_status,$e)&&(this._completion_status=completion_status)}},{key:"progress_measure",get:function(){return this._progress_measure},set:function(progress_measure){if(this.initialized&&""===this._id)throw new oe(this._cmi_element+".progress_measure",de.DEPENDENCY_NOT_ESTABLISHED);fn(this._cmi_element+".progress_measure",progress_measure,Ye)&&vn(this._cmi_element+".progress_measure",progress_measure,"0#1")&&(this._progress_measure=progress_measure)}},{key:"description",get:function(){return this._description},set:function(description){if(this.initialized&&""===this._id)throw new oe(this._cmi_element+".description",de.DEPENDENCY_NOT_ESTABLISHED);fn(this._cmi_element+".description",description,He,!0)&&(this._description=description)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id,success_status:this.success_status,completion_status:this.completion_status,progress_measure:this.progress_measure,description:this.description,score:this.score};return this.jsonString=!1,result}},{key:"fromJSON",value:function(e){e&&"object"===(void 0===e?"undefined":pc(e))&&("string"==typeof e.id&&(this.id=e.id),"string"==typeof e.success_status&&(this.success_status=e.success_status),"string"==typeof e.completion_status&&(this.completion_status=e.completion_status),void 0!==e.progress_measure&&(this.progress_measure=e.progress_measure+""),"string"==typeof e.description&&(this.description=e.description),e.score&&"object"===pc(e.score)&&(void 0!==e.score.scaled&&(this.score.scaled=e.score.scaled+""),void 0!==e.score.raw&&(this.score.raw=e.score.raw+""),void 0!==e.score.min&&(this.score.min=e.score.min+""),void 0!==e.score.max&&(this.score.max=e.score.max+"")))}}]),t}(A);function Sc(e){return Sc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Sc(e)}function wc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(wc=function(){return!!result})()}function Oc(e,t){return Oc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Oc(e,t)}function Cc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ec=Object.defineProperty,Ac=function(e,t,i){return function(e,t,i){return t in e?Ec(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Cc(t))?t+"":t,i)},kc=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Sc(t),n=e,!(r=wc()?Reflect.construct(t,i||[],Sc(e).constructor):t.apply(e,i))||"object"!==Cc(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),Ac(e,"__version","1.0"),Ac(e,"__children",G.cmi_children),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Oc(e,t)}(t,e),i=t,(n=[{key:"_version",get:function(){return this.__version},set:function(_version){throw new oe(this._cmi_element+"._version",de.READ_ONLY_ELEMENT)}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new oe(this._cmi_element+"._children",de.READ_ONLY_ELEMENT)}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function jc(e){return jc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},jc(e)}function Rc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Rc=function(){return!!result})()}function Mc(e,t){return Mc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Mc(e,t)}function Tc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var xc=Object.defineProperty,Ic=function(e,t,i){return function(e,t,i){return t in e?xc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Tc(t))?t+"":t,i)},Pc=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=jc(t),n=e,!(r=Rc()?Reflect.construct(t,i||[],jc(e).constructor):t.apply(e,i))||"object"!==Tc(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),Ic(e,"_learner_id",""),Ic(e,"_learner_name",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Mc(e,t)}(t,e),i=t,(n=[{key:"learner_id",get:function(){return this._learner_id},set:function(learner_id){if(this.initialized)throw new oe(this._cmi_element+".learner_id",de.READ_ONLY_ELEMENT);this._learner_id=learner_id}},{key:"learner_name",get:function(){return this._learner_name},set:function(learner_name){if(this.initialized)throw new oe(this._cmi_element+".learner_name",de.READ_ONLY_ELEMENT);this._learner_name=learner_name}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function Nc(e){return Nc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Nc(e)}function Dc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Dc=function(){return!!result})()}function qc(e,t){return qc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},qc(e,t)}function Lc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var zc=Object.defineProperty,Fc=function(e,t,i){return function(e,t,i){return t in e?zc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Lc(t))?t+"":t,i)},Bc=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Nc(t),n=e,!(r=Dc()?Reflect.construct(t,i||[],Nc(e).constructor):t.apply(e,i))||"object"!==Lc(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),Fc(e,"_completion_status","unknown"),Fc(e,"_success_status","unknown"),Fc(e,"_progress_measure",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&qc(e,t)}(t,e),i=t,(n=[{key:"completion_status",get:function(){return this._completion_status},set:function(completion_status){fn(this._cmi_element+".completion_status",completion_status,$e)&&(this._completion_status=completion_status)}},{key:"success_status",get:function(){return this._success_status},set:function(success_status){fn(this._cmi_element+".success_status",success_status,Xe)&&(this._success_status=success_status)}},{key:"progress_measure",get:function(){return this._progress_measure},set:function(progress_measure){fn(this._cmi_element+".progress_measure",progress_measure,Ye)&&vn(this._cmi_element+".progress_measure",progress_measure,"0#1")&&(this._progress_measure=progress_measure)}},{key:"reset",value:function(){this._initialized=!1,this._completion_status="unknown",this._success_status="unknown",this._progress_measure=""}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function Vc(e){return Vc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Vc(e)}function Hc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Hc=function(){return!!result})()}function Uc(e,t){return Uc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Uc(e,t)}function Gc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Kc=Object.defineProperty,Yc=function(e,t,i){return function(e,t,i){return t in e?Kc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Gc(t))?t+"":t,i)},Wc=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Vc(t),n=e,!(r=Hc()?Reflect.construct(t,i||[],Vc(e).constructor):t.apply(e,i))||"object"!==Gc(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),Yc(e,"_entry",""),Yc(e,"_exit",""),Yc(e,"_session_time","PT0H0M0S"),Yc(e,"_total_time","PT0S"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Uc(e,t)}(t,e),i=t,(n=[{key:"entry",get:function(){return this._entry},set:function(entry){if(this.initialized)throw new oe(this._cmi_element+".entry",de.READ_ONLY_ELEMENT);this._entry=entry}},{key:"exit",get:function(){if(!this.jsonString)throw new oe(this._cmi_element+".exit",de.WRITE_ONLY_ELEMENT);return this._exit},set:function(exit){"logout"===exit&&console.warn('SCORM 2004: cmi.exit value "logout" is deprecated per 4th Edition. Consider using "normal" or "suspend" instead.'),fn(this._cmi_element+".exit",exit,"^(time-out|suspend|logout|normal)$",!0)&&(this._exit=exit)}},{key:"getExitValueInternal",value:function(){return this._exit}},{key:"session_time",get:function(){if(!this.jsonString)throw new oe(this._cmi_element+".session_time",de.WRITE_ONLY_ELEMENT);return this._session_time},set:function(session_time){fn(this._cmi_element+".session_time",session_time,Ke)&&(this._session_time=session_time)}},{key:"total_time",get:function(){return this._total_time},set:function(total_time){if(this.initialized)throw new oe(this._cmi_element+".total_time",de.READ_ONLY_ELEMENT);this._total_time=total_time}},{key:"getCurrentTotalTime",value:function(e){var t,i,n,r=this._session_time;if(void 0!==e){var o=(new Date).getTime()-e;r=l(o/1e3)}return t=this._total_time,i=r,n=RegExp(Ke),l(d(t,n)+d(i,n))}},{key:"reset",value:function(){this._initialized=!1,this._entry="ab-initio",this._exit="",this._session_time="PT0H0M0S"}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function Jc(e){return Jc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Jc(e)}function $c(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return($c=function(){return!!result})()}function Xc(e,t){return Xc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Xc(e,t)}function Qc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Zc=Object.defineProperty,el=function(e,t,i){return function(e,t,i){return t in e?Zc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Qc(t))?t+"":t,i)},tl=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=Jc(t),n=e,!(r=$c()?Reflect.construct(t,i||[],Jc(e).constructor):t.apply(e,i))||"object"!==Qc(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),el(e,"_location",""),el(e,"_launch_data",""),el(e,"_suspend_data",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Xc(e,t)}(t,e),i=t,(n=[{key:"location",get:function(){return this._location},set:function(location){fn(this._cmi_element+".location",location,"^[\\u0000-\\uFFFF]{0,1000}$")&&(this._location=location)}},{key:"launch_data",get:function(){return this._launch_data},set:function(launch_data){if(this.initialized)throw new oe(this._cmi_element+".launch_data",de.READ_ONLY_ELEMENT);this._launch_data=launch_data}},{key:"suspend_data",get:function(){return this._suspend_data},set:function(suspend_data){fn(this._cmi_element+".suspend_data",suspend_data,Be,!0)&&(this._suspend_data=suspend_data)}},{key:"reset",value:function(){this._initialized=!1,this._location="",this._suspend_data=""}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function il(e){return il=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},il(e)}function nl(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(nl=function(){return!!result})()}function rl(e,t){return rl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},rl(e,t)}function ol(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var al=Object.defineProperty,sl=function(e,t,i){return function(e,t,i){return t in e?al(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ol(t))?t+"":t,i)},cl=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=il(t),n=e,!(r=nl()?Reflect.construct(t,i||[],il(e).constructor):t.apply(e,i))||"object"!==ol(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),sl(e,"_credit","credit"),sl(e,"_mode","normal"),sl(e,"_time_limit_action","continue,no message"),sl(e,"_max_time_allowed",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&rl(e,t)}(t,e),i=t,(n=[{key:"credit",get:function(){return this._credit},set:function(credit){if(this.initialized)throw new oe(this._cmi_element+".credit",de.READ_ONLY_ELEMENT);if(!/^(credit|no-credit)$/.test(credit))throw new oe(this._cmi_element+".credit",de.TYPE_MISMATCH);this._credit=credit}},{key:"mode",get:function(){return this._mode},set:function(mode){if(this.initialized)throw new oe(this._cmi_element+".mode",de.READ_ONLY_ELEMENT);if(!/^(browse|normal|review)$/.test(mode))throw new oe(this._cmi_element+".mode",de.TYPE_MISMATCH);this._mode=mode}},{key:"time_limit_action",get:function(){return this._time_limit_action},set:function(time_limit_action){if(this.initialized)throw new oe(this._cmi_element+".time_limit_action",de.READ_ONLY_ELEMENT);if(!/^(exit,message|exit,no message|continue,message|continue,no message)$/.test(time_limit_action))throw new oe(this._cmi_element+".time_limit_action",de.TYPE_MISMATCH);this._time_limit_action=time_limit_action}},{key:"max_time_allowed",get:function(){return this._max_time_allowed},set:function(max_time_allowed){if(this.initialized)throw new oe(this._cmi_element+".max_time_allowed",de.READ_ONLY_ELEMENT);if(""!==max_time_allowed){if(!RegExp(Ke).test(max_time_allowed))throw new oe(this._cmi_element+".max_time_allowed",de.TYPE_MISMATCH);this._max_time_allowed=max_time_allowed}else this._max_time_allowed=max_time_allowed}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function ll(e){return ll=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ll(e)}function ul(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ul=function(){return!!result})()}function dl(e,t){return dl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},dl(e,t)}function fl(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var vl=Object.defineProperty,hl=function(e,t,i){return function(e,t,i){return t in e?vl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":fl(t))?t+"":t,i)},ml=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=ll(t),n=e,!(r=ul()?Reflect.construct(t,i||[],ll(e).constructor):t.apply(e,i))||"object"!==fl(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),hl(e,"_scaled_passing_score",""),hl(e,"_completion_threshold",""),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&dl(e,t)}(t,e),i=t,(n=[{key:"scaled_passing_score",get:function(){return this._scaled_passing_score},set:function(scaled_passing_score){var e;if(this.initialized)throw new oe(this._cmi_element+".scaled_passing_score",null!==(e=de.READ_ONLY_ELEMENT)&&void 0!==e?e:404);if(""!==scaled_passing_score){var t;if(!RegExp(Ye).test(scaled_passing_score))throw new oe(this._cmi_element+".scaled_passing_score",null!==(t=de.TYPE_MISMATCH)&&void 0!==t?t:406);var i,n=parseFloat(scaled_passing_score);if(-1>n||n>1)throw new oe(this._cmi_element+".scaled_passing_score",null!==(i=de.VALUE_OUT_OF_RANGE)&&void 0!==i?i:407);this._scaled_passing_score=scaled_passing_score}else this._scaled_passing_score=scaled_passing_score}},{key:"completion_threshold",get:function(){return this._completion_threshold},set:function(e){var t;if(this.initialized)throw new oe(this._cmi_element+".completion_threshold",null!==(t=de.READ_ONLY_ELEMENT)&&void 0!==t?t:404);if(""!==e){var i;if(!RegExp(Ye).test(e))throw new oe(this._cmi_element+".completion_threshold",null!==(i=de.TYPE_MISMATCH)&&void 0!==i?i:406);var n,r=parseFloat(e);if(0>r||r>1)throw new oe(this._cmi_element+".completion_threshold",null!==(n=de.VALUE_OUT_OF_RANGE)&&void 0!==n?n:407);this._completion_threshold=e}else this._completion_threshold=e}},{key:"reset",value:function(){this._initialized=!1}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function pl(e,t,i){return pl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=yl(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},pl(e,t,i||e)}function yl(e){return yl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},yl(e)}function gl(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(gl=function(){return!!result})()}function _l(e,t){return _l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_l(e,t)}function bl(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Sl=Object.defineProperty,wl=function(e,t,i){return function(e,t,i){return t in e?Sl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":bl(t))?t+"":t,i)},Ol=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=yl(t),n=e,!(r=gl()?Reflect.construct(t,i||[],yl(e).constructor):t.apply(e,i))||"object"!==bl(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["cmi"]),wl(e,"metadata"),wl(e,"learner"),wl(e,"status"),wl(e,"session"),wl(e,"content"),wl(e,"settings"),wl(e,"thresholds"),wl(e,"learner_preference"),wl(e,"score"),wl(e,"comments_from_learner"),wl(e,"comments_from_lms"),wl(e,"interactions"),wl(e,"objectives"),e.metadata=new kc,e.learner=new Pc,e.status=new Bc,e.session=new Wc,e.content=new tl,e.settings=new cl,e.thresholds=new ml,e.learner_preference=new _s,e.score=new Js,e.comments_from_learner=new ac,e.comments_from_lms=new oc,e.interactions=new qs,e.objectives=new _c,i&&e.initialize(),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_l(e,t)}(t,e),i=t,(n=[{key:"initialize",value:function(){var e,i,n,r,o,a,s,c,l,u,d,f,v;pl(yl(t.prototype),"initialize",this).call(this),null===(e=this.metadata)||void 0===e||e.initialize(),null===(i=this.learner)||void 0===i||i.initialize(),null===(n=this.status)||void 0===n||n.initialize(),null===(r=this.session)||void 0===r||r.initialize(),null===(o=this.content)||void 0===o||o.initialize(),null===(a=this.settings)||void 0===a||a.initialize(),null===(s=this.thresholds)||void 0===s||s.initialize(),null===(c=this.learner_preference)||void 0===c||c.initialize(),null===(l=this.score)||void 0===l||l.initialize(),null===(u=this.comments_from_learner)||void 0===u||u.initialize(),null===(d=this.comments_from_lms)||void 0===d||d.initialize(),null===(f=this.interactions)||void 0===f||f.initialize(),null===(v=this.objectives)||void 0===v||v.initialize()}},{key:"reset",value:function(){var e,t,i,n,r,o,a,s,c,l,u,d,f;this._initialized=!1,this._start_time=void 0,null===(e=this.metadata)||void 0===e||e.reset(),null===(t=this.learner)||void 0===t||t.reset(),null===(i=this.status)||void 0===i||i.reset(),null===(n=this.session)||void 0===n||n.reset(),null===(r=this.content)||void 0===r||r.reset(),null===(o=this.settings)||void 0===o||o.reset(),null===(a=this.thresholds)||void 0===a||a.reset(),null===(s=this.objectives)||void 0===s||s.reset(!0),null===(c=this.interactions)||void 0===c||c.reset(!0),null===(l=this.score)||void 0===l||l.reset(),null===(u=this.comments_from_learner)||void 0===u||u.reset(),null===(d=this.comments_from_lms)||void 0===d||d.reset(),null===(f=this.learner_preference)||void 0===f||f.reset()}},{key:"_version",get:function(){return this.metadata._version},set:function(_version){this.metadata._version=_version}},{key:"_children",get:function(){return this.metadata._children},set:function(_children){this.metadata._children=_children}},{key:"completion_status",get:function(){return this.status.completion_status},set:function(completion_status){this.status.completion_status=completion_status}},{key:"completion_threshold",get:function(){return this.thresholds.completion_threshold},set:function(e){this.thresholds.completion_threshold=e}},{key:"credit",get:function(){return this.settings.credit},set:function(credit){this.settings.credit=credit}},{key:"entry",get:function(){return this.session.entry},set:function(entry){this.session.entry=entry}},{key:"exit",get:function(){return this.session.jsonString=this.jsonString,this.session.exit},set:function(exit){this.session.exit=exit}},{key:"getExitValueInternal",value:function(){return this.session.getExitValueInternal()}},{key:"launch_data",get:function(){return this.content.launch_data},set:function(launch_data){this.content.launch_data=launch_data}},{key:"learner_id",get:function(){return this.learner.learner_id},set:function(learner_id){this.learner.learner_id=learner_id}},{key:"learner_name",get:function(){return this.learner.learner_name},set:function(learner_name){this.learner.learner_name=learner_name}},{key:"location",get:function(){return this.content.location},set:function(location){this.content.location=location}},{key:"max_time_allowed",get:function(){return this.settings.max_time_allowed},set:function(max_time_allowed){this.settings.max_time_allowed=max_time_allowed}},{key:"mode",get:function(){return this.settings.mode},set:function(mode){this.settings.mode=mode}},{key:"progress_measure",get:function(){return this.status.progress_measure},set:function(progress_measure){this.status.progress_measure=progress_measure}},{key:"scaled_passing_score",get:function(){return this.thresholds.scaled_passing_score},set:function(scaled_passing_score){this.thresholds.scaled_passing_score=scaled_passing_score}},{key:"session_time",get:function(){return this.session.jsonString=this.jsonString,this.session.session_time},set:function(session_time){this.session.session_time=session_time}},{key:"success_status",get:function(){return this.status.success_status},set:function(success_status){this.status.success_status=success_status}},{key:"suspend_data",get:function(){return this.content.suspend_data},set:function(suspend_data){this.content.suspend_data=suspend_data}},{key:"time_limit_action",get:function(){return this.settings.time_limit_action},set:function(time_limit_action){this.settings.time_limit_action=time_limit_action}},{key:"total_time",get:function(){return this.session.total_time},set:function(total_time){this.session.total_time=total_time}},{key:"getCurrentTotalTime",value:function(){return this.session.getCurrentTotalTime(this.start_time)}},{key:"toJSON",value:function(){this.jsonString=!0,this.session.jsonString=!0;var result={comments_from_learner:this.comments_from_learner,comments_from_lms:this.comments_from_lms,completion_status:this.completion_status,completion_threshold:this.completion_threshold,credit:this.credit,entry:this.entry,exit:this.exit,interactions:this.interactions,launch_data:this.launch_data,learner_id:this.learner_id,learner_name:this.learner_name,learner_preference:this.learner_preference,location:this.location,max_time_allowed:this.max_time_allowed,mode:this.mode,objectives:this.objectives,progress_measure:this.progress_measure,scaled_passing_score:this.scaled_passing_score,score:this.score,session_time:this.session_time,success_status:this.success_status,suspend_data:this.suspend_data,time_limit_action:this.time_limit_action,total_time:this.total_time};return this.jsonString=!1,this.session.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(k);function Cl(e,t,i){return t=Rl(t),n=e,!(r=Tl()?Reflect.construct(t,i||[],Rl(e).constructor):t.apply(e,i))||"object"!==Pl(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}function El(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Al(e,t,i){return t&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function kl(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function jl(e,t,i){return jl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Rl(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},jl(e,t,i||e)}function Rl(e){return Rl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Rl(e)}function Ml(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Il(e,t)}function Tl(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Tl=function(){return!!result})()}function xl(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){kl(e,t,i[t])})}return e}function Il(e,t){return Il=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Il(e,t)}function Pl(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Nl=Object.defineProperty,Dl=function(e,t,i){return function(e,t,i){return t in e?Nl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Pl(t))?t+"":t,i)},ql=function(e){function t(){var e;return El(this,t),e=Cl(this,t,["adl"]),Dl(e,"nav"),Dl(e,"data",new zl),Dl(e,"_sequencing",null),e.nav=new Ll,e.data=new zl,e}return Ml(t,e),Al(t,[{key:"initialize",value:function(){var e;jl(Rl(t.prototype),"initialize",this).call(this),null===(e=this.nav)||void 0===e||e.initialize()}},{key:"reset",value:function(){var e;this._initialized=!1,null===(e=this.nav)||void 0===e||e.reset()}},{key:"sequencing",get:function(){return this._sequencing},set:function(e){this._sequencing=e,e&&(e.adlNav=this.nav,this.nav.sequencing=e)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={nav:this.nav,data:this.data};return this.jsonString=!1,result}}]),t}(A),Ll=function(e){function t(){var e;return El(this,t),e=Cl(this,t,["adl.nav"]),Dl(e,"_request","_none_"),Dl(e,"_sequencing",null),Dl(e,"request_valid"),e.request_valid=new Hl,e.request_valid.setParentNav(e),e}return Ml(t,e),Al(t,[{key:"sequencing",get:function(){return this._sequencing},set:function(e){this._sequencing=e}},{key:"initialize",value:function(){var e;jl(Rl(t.prototype),"initialize",this).call(this),null===(e=this.request_valid)||void 0===e||e.initialize()}},{key:"reset",value:function(){var e;this._initialized=!1,this._request="_none_",this._sequencing&&(this._sequencing.adlNav=null),this._sequencing=null,null===(e=this.request_valid)||void 0===e||e.reset()}},{key:"request",get:function(){return this._request},set:function(request){fn(this._cmi_element+".request",request,Qe)&&(this._request=request)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={request:this.request};return this.jsonString=!1,result}}]),t}(A),zl=function(e){function t(){return El(this,t),Cl(this,t,[{CMIElement:"adl.data",children:G.adl_data_children,errorCode:de.READ_ONLY_ELEMENT,errorClass:oe}])}return Ml(t,e),t}(ge),Fl=function(e){function t(){var e;return El(this,t),e=Cl(this,t,["adl.data.n"]),Dl(e,"_id",""),Dl(e,"_store",""),Dl(e,"_idIsSet",!1),Dl(e,"_storeIsSet",!1),e}return Ml(t,e),Al(t,[{key:"reset",value:function(){this._initialized=!1,this._idIsSet=!1,this._storeIsSet=!1}},{key:"id",get:function(){return this._id},set:function(id){if(this.initialized)throw new oe(this._cmi_element+".id",de.READ_ONLY_ELEMENT);fn(this._cmi_element+".id",id,Je)&&(this._id=id,this._idIsSet=!0)}},{key:"store",get:function(){if(this.initialized&&!this._storeIsSet)throw new oe(this._cmi_element+".store",de.VALUE_NOT_INITIALIZED);return this._store},set:function(e){if(this.initialized&&!this._idIsSet)throw new oe(this._cmi_element+".store",de.DEPENDENCY_NOT_ESTABLISHED);fn(this._cmi_element+".store",e,Be)&&(this._store=e,this._storeIsSet=!0)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this._id,store:this._store};return this.jsonString=!1,result}}]),t}(A),Bl=function(){function e(){El(this,e),Dl(this,"_parentNav",null),Dl(this,"_staticValues",{})}return Al(e,[{key:"setParentNav",value:function(nav){this._parentNav=nav}},{key:"_isTargetValid",value:function(e){var t,i;if(null===(i=this._parentNav)||void 0===i||null===(t=i.sequencing)||void 0===t?void 0:t.overallSequencingProcess){var n=this._parentNav.sequencing.overallSequencingProcess;if(n.predictChoiceEnabled)return n.predictChoiceEnabled(e)?"true":"false"}var r=this._staticValues[e];return r===be?"true":r===Se?"false":"unknown"}},{key:"getAll",value:function(){return xl({},this._staticValues)}},{key:"setAll",value:function(e){this._staticValues=xl({},e)}}]),e}(),Vl=function(){function e(){El(this,e),Dl(this,"_parentNav",null),Dl(this,"_staticValues",{})}return Al(e,[{key:"setParentNav",value:function(nav){this._parentNav=nav}},{key:"_isTargetValid",value:function(e){var t,i;if(null===(i=this._parentNav)||void 0===i||null===(t=i.sequencing)||void 0===t?void 0:t.activityTree)return this._parentNav.sequencing.activityTree.getActivity(e)?"true":"false";var n=this._staticValues[e];return n===be?"true":n===Se?"false":"unknown"}},{key:"getAll",value:function(){return xl({},this._staticValues)}},{key:"setAll",value:function(e){this._staticValues=xl({},e)}}]),e}(),Hl=function(e){function t(){var e;return El(this,t),e=Cl(this,t,["adl.nav.request_valid"]),Dl(e,"_continue","unknown"),Dl(e,"_previous","unknown"),Dl(e,"_choice"),Dl(e,"_jump"),Dl(e,"_exit","unknown"),Dl(e,"_exitAll","unknown"),Dl(e,"_abandon","unknown"),Dl(e,"_abandonAll","unknown"),Dl(e,"_suspendAll","unknown"),Dl(e,"_parentNav",null),e._choice=new Bl,e._jump=new Vl,e}return Ml(t,e),Al(t,[{key:"setParentNav",value:function(nav){this._parentNav=nav,this._choice.setParentNav(nav),this._jump.setParentNav(nav)}},{key:"reset",value:function(){this._initialized=!1,this._continue="unknown",this._previous="unknown",this._choice.setAll({}),this._jump.setAll({}),this._exit="unknown",this._exitAll="unknown",this._abandon="unknown",this._abandonAll="unknown",this._suspendAll="unknown"}},{key:"continue",get:function(){var e,t;if(null===(t=this._parentNav)||void 0===t||null===(e=t.sequencing)||void 0===e?void 0:e.overallSequencingProcess){var i=this._parentNav.sequencing.overallSequencingProcess;if(i.predictContinueEnabled)return i.predictContinueEnabled()?"true":"false"}return this._continue},set:function(e){if(this.initialized)throw new oe(this._cmi_element+".continue",de.READ_ONLY_ELEMENT);fn(this._cmi_element+".continue",e,Ze)&&(this._continue=e)}},{key:"previous",get:function(){var e,t;if(null===(t=this._parentNav)||void 0===t||null===(e=t.sequencing)||void 0===e?void 0:e.overallSequencingProcess){var i=this._parentNav.sequencing.overallSequencingProcess;if(i.predictPreviousEnabled)return i.predictPreviousEnabled()?"true":"false"}return this._previous},set:function(e){if(this.initialized)throw new oe(this._cmi_element+".previous",de.READ_ONLY_ELEMENT);fn(this._cmi_element+".previous",e,Ze)&&(this._previous=e)}},{key:"choice",get:function(){return this._choice},set:function(e){if(this.initialized)throw new oe(this._cmi_element+".choice",de.READ_ONLY_ELEMENT);if("object"!==(void 0===e?"undefined":Pl(e)))throw new oe(this._cmi_element+".choice",de.TYPE_MISMATCH);var t={};for(var i in e)if({}.hasOwnProperty.call(e,i)&&fn(this._cmi_element+".choice."+i,e[i]||"",Ze)&&fn(this._cmi_element+".choice."+i,i,et)){var n=e[i];"true"===n?t[i]=be:"false"===n?t[i]=Se:"unknown"===n&&(t[i]=_e)}this._choice.setAll(t)}},{key:"jump",get:function(){return this._jump},set:function(e){if(this.initialized)throw new oe(this._cmi_element+".jump",de.READ_ONLY_ELEMENT);if("object"!==(void 0===e?"undefined":Pl(e)))throw new oe(this._cmi_element+".jump",de.TYPE_MISMATCH);var t={};for(var i in e)if({}.hasOwnProperty.call(e,i)&&fn(this._cmi_element+".jump."+i,e[i]||"",Ze)&&fn(this._cmi_element+".jump."+i,i,et)){var n=e[i];"true"===n?t[i]=be:"false"===n?t[i]=Se:"unknown"===n&&(t[i]=_e)}this._jump.setAll(t)}},{key:"exit",get:function(){return this._exit},set:function(e){if(this.initialized)throw new oe(this._cmi_element+".exit",de.READ_ONLY_ELEMENT);fn(this._cmi_element+".exit",e,Ze)&&(this._exit=e)}},{key:"exitAll",get:function(){return this._exitAll},set:function(e){if(this.initialized)throw new oe(this._cmi_element+".exitAll",de.READ_ONLY_ELEMENT);fn(this._cmi_element+".exitAll",e,Ze)&&(this._exitAll=e)}},{key:"abandon",get:function(){return this._abandon},set:function(e){if(this.initialized)throw new oe(this._cmi_element+".abandon",de.READ_ONLY_ELEMENT);fn(this._cmi_element+".abandon",e,Ze)&&(this._abandon=e)}},{key:"abandonAll",get:function(){return this._abandonAll},set:function(e){if(this.initialized)throw new oe(this._cmi_element+".abandonAll",de.READ_ONLY_ELEMENT);fn(this._cmi_element+".abandonAll",e,Ze)&&(this._abandonAll=e)}},{key:"suspendAll",get:function(){return this._suspendAll},set:function(e){if(this.initialized)throw new oe(this._cmi_element+".suspendAll",de.READ_ONLY_ELEMENT);fn(this._cmi_element+".suspendAll",e,Ze)&&(this._suspendAll=e)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={previous:this.previous,continue:this.continue,choice:this._choice.getAll(),jump:this._jump.getAll(),exit:this.exit,exitAll:this.exitAll,abandon:this.abandon,abandonAll:this.abandonAll,suspendAll:this.suspendAll};return this.jsonString=!1,result}}]),t}(A);function Ul(e,t,i){return Ul="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Gl(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Ul(e,t,i||e)}function Gl(e){return Gl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Gl(e)}function Kl(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Yl(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Yl=function(){return!!result})()}function Wl(e,t){return Wl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Wl(e,t)}function Jl(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var $l=Object.defineProperty,Xl=function(e,t,i){return function(e,t,i){return t in e?$l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Jl(t))?t+"":t,i)},Ql=function(e){function t(e){var i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=function(e,t,i){return t=Gl(t),n=e,!(r=Yl()?Reflect.construct(t,i||[],Gl(e).constructor):t.apply(e,i))||"object"!==Jl(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["activityTree"]),Xl(i,"_root",null),Xl(i,"_currentActivity",null),Xl(i,"_suspendedActivity",null),Xl(i,"_activities",new Map),e&&(i.root=e),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Wl(e,t)}(t,e),i=t,n=[{key:"initialize",value:function(){Ul(Gl(t.prototype),"initialize",this).call(this),this._root&&this._root.initialize()}},{key:"reset",value:function(){this._initialized=!1,this._currentActivity=null,this._suspendedActivity=null,this._activities.clear(),this._root&&(this._root.reset(),this._activities.set(this._root.id,this._root),this._addActivitiesToMap(this._root))}},{key:"root",get:function(){return this._root},set:function(e){if(null!==e&&!Kl(e,Gn))throw new oe(this._cmi_element+".root",de.TYPE_MISMATCH);this._activities.clear(),this._root=e,e&&(this._activities.set(e.id,e),this._addActivitiesToMap(e))}},{key:"_addActivitiesToMap",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;this._activities.set(a.id,a),this._addActivitiesToMap(a)}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"currentActivity",get:function(){return this._currentActivity},set:function(e){if(null!==e&&!Kl(e,Gn))throw new oe(this._cmi_element+".currentActivity",de.TYPE_MISMATCH);if(this._currentActivity){this._currentActivity.isActive=!1;for(var t=this._currentActivity.parent;t;)t.isActive=!1,t=t.parent}if(this._currentActivity=e,e){e.isActive=!0;for(var i=e.parent;i;)i.isActive=!0,i=i.parent}}},{key:"setCurrentActivityWithoutActivation",value:function(e){if(null!==e&&!Kl(e,Gn))throw new oe(this._cmi_element+".currentActivity",de.TYPE_MISMATCH);if(this._currentActivity){var t=new Set;if(e){t.add(e);for(var i=e.parent;i;)t.add(i),i=i.parent}this._currentActivity.isActive=!1;for(var n=this._currentActivity.parent;n;)t.has(n)||(n.isActive=!1),n=n.parent}this._currentActivity=e}},{key:"suspendedActivity",get:function(){return this._suspendedActivity},set:function(e){if(null!==e&&!Kl(e,Gn))throw new oe(this._cmi_element+".suspendedActivity",de.TYPE_MISMATCH);if(this._suspendedActivity){this._suspendedActivity.isSuspended=!1;for(var t=this._suspendedActivity.parent;t;)t.isSuspended=!1,t=t.parent}if(this._suspendedActivity=e,e){e.isSuspended=!0;for(var i=e.parent;i;)i.isSuspended=!0,i=i.parent}}},{key:"getActivity",value:function(id){return this._activities.get(id)||null}},{key:"getAllActivities",value:function(){return Array.from(this._activities.values())}},{key:"getParent",value:function(e){return e.parent}},{key:"getChildren",value:function(e){return 1>=arguments.length||void 0===arguments[1]||arguments[1]?e.getAvailableChildren():e.children}},{key:"getSiblings",value:function(e){return e.parent?e.parent.children.filter(function(t){return t!==e}):[]}},{key:"getNextSibling",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1];if(!e.parent)return null;var n=i?e.parent.getAvailableChildren():e.parent.children,r=n.indexOf(e);return-1===r&&i&&(r=(n=e.parent.children).indexOf(e)),-1===r||r===n.length-1?null:null!==(t=n[r+1])&&void 0!==t?t:null}},{key:"getPreviousSibling",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1];if(!e.parent)return null;var n=i?e.parent.getAvailableChildren():e.parent.children,r=n.indexOf(e);return-1===r&&i&&(r=(n=e.parent.children).indexOf(e)),r>0&&null!==(t=n[r-1])&&void 0!==t?t:null}},{key:"getFirstChild",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1]?e.getAvailableChildren():e.children;return 0===i.length?null:null!==(t=i[0])&&void 0!==t?t:null}},{key:"getLastChild",value:function(e){var t,i=1>=arguments.length||void 0===arguments[1]||arguments[1]?e.getAvailableChildren():e.children;return 0===i.length?null:null!==(t=i[i.length-1])&&void 0!==t?t:null}},{key:"getCommonAncestor",value:function(e,t){for(var i=[],n=e;n;)i.unshift(n),n=n.parent;for(n=t;n;){if(i.includes(n))return n;n=n.parent}return null}},{key:"toJSON",value:function(){this.jsonString=!0;var result={root:this._root,currentActivity:this._currentActivity?this._currentActivity.id:null,suspendedActivity:this._suspendedActivity?this._suspendedActivity.id:null};return this.jsonString=!1,result}}],n&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);function Zl(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function eu(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function tu(e,t,i){return tu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=iu(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},tu(e,t,i||e)}function iu(e){return iu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},iu(e)}function nu(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function ru(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ru=function(){return!!result})()}function ou(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){eu(e,t,i[t])})}return e}function au(e,t){return au=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},au(e,t)}function su(e){return function(e){if(Array.isArray(e))return Zl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Zl(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Zl(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function cu(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var lu=Object.defineProperty,uu=function(e,t,i){return function(e,t,i){return t in e?lu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":cu(t))?t+"":t,i)},du=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,i){return t=iu(t),n=e,!(r=ru()?Reflect.construct(t,i||[],iu(e).constructor):t.apply(e,i))||"object"!==cu(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,t,["sequencing"]),uu(e,"_activityTree"),uu(e,"_sequencingRules"),uu(e,"_sequencingControls"),uu(e,"_rollupRules"),uu(e,"_adlNav",null),uu(e,"_hideLmsUi",[]),uu(e,"_auxiliaryResources",[]),uu(e,"_overallSequencingProcess",null),e._activityTree=new Ql,e._sequencingRules=new jt,e._sequencingControls=new ei,e._rollupRules=new Rn,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&au(e,t)}(t,e),i=t,(n=[{key:"initialize",value:function(){tu(iu(t.prototype),"initialize",this).call(this),this._activityTree.initialize(),this._sequencingRules.initialize(),this._sequencingControls.initialize(),this._rollupRules.initialize()}},{key:"reset",value:function(){this._initialized=!1,this._activityTree.reset(),this._sequencingRules.reset(),this._sequencingControls.reset(),this._rollupRules.reset(),this._hideLmsUi=[],this._auxiliaryResources=[]}},{key:"activityTree",get:function(){return this._activityTree},set:function(e){if(!nu(e,Ql))throw new oe(this._cmi_element+".activityTree",de.TYPE_MISMATCH);this._activityTree=e}},{key:"sequencingRules",get:function(){return this._sequencingRules},set:function(e){if(!nu(e,jt))throw new oe(this._cmi_element+".sequencingRules",de.TYPE_MISMATCH);this._sequencingRules=e}},{key:"sequencingControls",get:function(){return this._sequencingControls},set:function(e){if(!nu(e,ei))throw new oe(this._cmi_element+".sequencingControls",de.TYPE_MISMATCH);this._sequencingControls=e}},{key:"hideLmsUi",get:function(){return su(this._hideLmsUi)},set:function(e){this._hideLmsUi=su(e)}},{key:"auxiliaryResources",get:function(){return this._auxiliaryResources.map(function(e){return ou({},e)})},set:function(e){this._auxiliaryResources=e.map(function(e){return ou({},e)})}},{key:"rollupRules",get:function(){return this._rollupRules},set:function(e){if(!nu(e,Rn))throw new oe(this._cmi_element+".rollupRules",de.TYPE_MISMATCH);this._rollupRules=e}},{key:"adlNav",get:function(){return this._adlNav},set:function(e){this._adlNav=e}},{key:"overallSequencingProcess",get:function(){return this._overallSequencingProcess},set:function(e){this._overallSequencingProcess=e}},{key:"processRollup",value:function(){var e=this._activityTree.root;e&&this._processRollupRecursive(e)}},{key:"_processRollupRecursive",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e.children[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)this._processRollupRecursive(r.value)}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}this._rollupRules.processRollup(e)}},{key:"getCurrentActivity",value:function(){return this._activityTree.currentActivity}},{key:"getRootActivity",value:function(){return this._activityTree.root}},{key:"toJSON",value:function(){this.jsonString=!0;var result={activityTree:this._activityTree,sequencingRules:this._sequencingRules,sequencingControls:this._sequencingControls,rollupRules:this._rollupRules,adlNav:this._adlNav};return this.jsonString=!1,result}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(i.prototype,n),t;var i,n}(A);var fu=Object.defineProperty,vu=function(){function e(t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,i){t in e?fu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(i="context")?i+"":i,n),this.context=t}return t=e,(i=[{key:"checkValidResponseType",value:function(e,t,i,n){var r=[];(null==t?void 0:t.delimiter)?r=ws(i+"",t.delimiter):r[0]=i,r.length>0&&t.max>=r.length?this.context.checkCorrectResponseValue?this.context.checkCorrectResponseValue(e,n,r,i):this.checkCorrectResponseValue(e,n,r,i):r.length>t.max&&this.context.throwSCORMError(e,de.GENERAL_SET_FAILURE,"Data Model Element Pattern Too Long: ".concat(i))}},{key:"checkDuplicateChoiceResponse",value:function(e,t,i){var n=t.correct_responses._count;if("choice"===t.type)for(var r=0;n>r&&"0"===this.context.getLastErrorCode();r++){var o=t.correct_responses.childArray[r];(null==o?void 0:o.pattern)===i&&this.context.throwSCORMError(e,de.GENERAL_SET_FAILURE,"".concat(i))}}},{key:"validateCorrectResponse",value:function(e,t,i){var n=+e.split(".")[4];if(t){var r=t.correct_responses._count;this.checkDuplicateChoiceResponse(e,t,i);var o=rt[t.type];o&&(void 0===o.limit||o.limit>r)?(this.checkValidResponseType(e,o,i,t.type),"0"===this.context.getLastErrorCode()&&(!o.duplicate||!this.checkDuplicatedPattern(t.correct_responses,n,i))||"0"===this.context.getLastErrorCode()&&""===i||"0"===this.context.getLastErrorCode()&&this.context.throwSCORMError(e,de.GENERAL_SET_FAILURE,"Data Model Element Pattern Already Exists: ".concat(e," - ").concat(i))):this.context.throwSCORMError(e,de.GENERAL_SET_FAILURE,"Data Model Element Collection Limit Reached: ".concat(e," - ").concat(i))}else this.context.throwSCORMError(e,de.DEPENDENCY_NOT_ESTABLISHED,e)}},{key:"checkDuplicatedPattern",value:function(e,t,i){for(var n=!1,r=e._count,o=0;r>o&&!n;o++)if(o!==t){var a=e.childArray[o];(null==a?void 0:a.pattern)===i&&(n=!0)}return n}},{key:"checkCorrectResponseValue",value:function(e,t,i,n){var r=rt[t];if(r)for(var o=RegExp(r.format),a=0;i.length>a&&"0"===this.context.getLastErrorCode();a++)if(t.match("^(fill-in|long-fill-in|matching|performance|sequencing)$")&&(i[a]=this.removeCorrectResponsePrefixes(e,i[a])),null==r?void 0:r.delimiter2){var s,c,l="performance"===t?Os(i[a],r.delimiter2):ws(i[a],r.delimiter2);2===l.length?"performance"===t&&""===l[0]&&""===l[1]?this.context.throwSCORMError(e,de.TYPE_MISMATCH,"".concat(t,": ").concat(n)):(null===(s=l[0])||void 0===s?void 0:s.match(o))&&r.format2&&(null===(c=l[1])||void 0===c?void 0:c.match(RegExp(r.format2)))||this.context.throwSCORMError(e,de.TYPE_MISMATCH,"".concat(t,": ").concat(n)):this.context.throwSCORMError(e,de.TYPE_MISMATCH,"".concat(t,": ").concat(n))}else{if("numeric"===t&&i.length>1&&""===i[a]&&r.delimiter&&(n+"").includes(r.delimiter))continue;var u=i[a].match(o);if(!u&&""!==n||!u&&"true-false"===t)this.context.throwSCORMError(e,de.TYPE_MISMATCH,"".concat(t,": ").concat(n));else if("numeric"===t&&i.length>1)""!==i[0]&&""!==i[1]&&+i[0]>+i[1]&&this.context.throwSCORMError(e,de.TYPE_MISMATCH,"".concat(t,": ").concat(n));else if(""!==i[a]&&r.unique)for(var d=0;a>d&&"0"===this.context.getLastErrorCode();d++)i[a]===i[d]&&this.context.throwSCORMError(e,de.TYPE_MISMATCH,"".concat(t,": ").concat(n))}else this.context.throwSCORMError(e,de.TYPE_MISMATCH,"Incorrect Response Type: ".concat(t))}},{key:"removeCorrectResponsePrefixes",value:function(e,t){for(var i,n=!1,r=!1,o=!1,a=RegExp("^({(lang|case_matters|order_matters)=([^}]+)})"),s=t.match(a);s;){var c;switch(s[2]){case"lang":if(i=t.match("^(({lang=([a-zA-Z]{1,8}|i|x)?(-[a-zA-Z0-9-]{2,8})?}))(.*?)$")){var l=i[3];void 0!==l&&l.length>0&&(at.includes(l.toLowerCase())||this.context.throwSCORMError(e,de.TYPE_MISMATCH,"".concat(t)))}o=!0;break;case"case_matters":o||n||r||"true"!==s[3]&&"false"!==s[3]&&this.context.throwSCORMError(e,de.TYPE_MISMATCH,"".concat(t)),r=!0;break;case"order_matters":r||o||n||"true"!==s[3]&&"false"!==s[3]&&this.context.throwSCORMError(e,de.TYPE_MISMATCH,"".concat(t)),n=!0}s=(t=t.substring((null===(c=s[1])||void 0===c?void 0:c.length)||0)).match(a)}return t}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();var hu=Object.defineProperty,mu=function(e,t,i){return function(e,t,i){return t in e?hu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},pu=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),mu(this,"context"),mu(this,"responseValidator"),this.context=t,this.responseValidator=i}return t=e,(i=[{key:"getChildElement",value:function(e,t,i){if(m(e,"cmi\\.objectives\\.\\d+"))return new bc;if(i){if(m(e,"cmi\\.interactions\\.\\d+\\.correct_responses\\.\\d+"))return this.createCorrectResponsesObject(e,t);if(m(e,"cmi\\.interactions\\.\\d+\\.objectives\\.\\d+"))return new zs}else if(m(e,"cmi\\.interactions\\.\\d+"))return new Ls;return m(e,"cmi\\.comments_from_learner\\.\\d+")?new sc:m(e,"cmi\\.comments_from_lms\\.\\d+")?new sc(!0):m(e,"adl\\.data\\.\\d+")?new Fl:null}},{key:"createCorrectResponsesObject",value:function(e,t){var i=e.split("."),n=this.context.cmi.interactions.childArray[+i[2]];if(this.context.isInitialized()){if(void 0===n||!n.type)return this.context.throwSCORMError(e,de.DEPENDENCY_NOT_ESTABLISHED,e),null;var r=rt[n.type];if(r&&void 0!==r.limit&&n.correct_responses._count>=r.limit)return this.context.throwSCORMError(e,de.GENERAL_SET_FAILURE,"Data Model Element Collection Limit Reached: ".concat(e)),null;if(this.responseValidator.checkDuplicateChoiceResponse(e,n,t),!r)return this.context.throwSCORMError(e,de.GENERAL_SET_FAILURE,"Incorrect Response Type: ".concat(n.type)),null;this.responseValidator.checkValidResponseType(e,r,t,n.type)}return"0"===this.context.getLastErrorCode()?new Vs(null==n?void 0:n.type):null}},{key:"evaluateCompletionStatus",value:function(){return br({completionThreshold:this.context.cmi.completion_threshold,progressMeasure:this.context.cmi.progress_measure,storedCompletionStatus:this.context.cmi.completion_status})}},{key:"evaluateSuccessStatus",value:function(){var e=this.context.cmi.scaled_passing_score,t=this.context.cmi.score.scaled,i=this.context.cmi.success_status;if(""!==e&&null!=e){var n=parseFloat(e+"");if(!isNaN(n)){if(""!==t&&null!=t){var r=parseFloat(t+"");if(!isNaN(r))return n>r?Oe:we}return Ce}}return i||Ce}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function yu(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function gu(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _u(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){gu(e,t,i[t])})}return e}function bu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||wu(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Su(e){return function(e){if(Array.isArray(e))return yu(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||wu(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function wu(e,t){if(e){if("string"==typeof e)return yu(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?yu(e,t):void 0}}var Ou=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,(i=[{key:"applySequencingControlsSettings",value:function(e,t){void 0!==t.enabled&&(e.enabled=t.enabled),void 0!==t.choice&&(e.choice=t.choice),void 0!==t.choiceExit&&(e.choiceExit=t.choiceExit),void 0!==t.flow&&(e.flow=t.flow),void 0!==t.forwardOnly&&(e.forwardOnly=t.forwardOnly),void 0!==t.useCurrentAttemptObjectiveInfo&&(e.useCurrentAttemptObjectiveInfo=t.useCurrentAttemptObjectiveInfo),void 0!==t.useCurrentAttemptProgressInfo&&(e.useCurrentAttemptProgressInfo=t.useCurrentAttemptProgressInfo),void 0!==t.preventActivation&&(e.preventActivation=t.preventActivation),void 0!==t.constrainChoice&&(e.constrainChoice=t.constrainChoice),void 0!==t.stopForwardTraversal&&(e.stopForwardTraversal=t.stopForwardTraversal),void 0!==t.rollupObjectiveSatisfied&&(e.rollupObjectiveSatisfied=t.rollupObjectiveSatisfied),void 0!==t.rollupProgressCompletion&&(e.rollupProgressCompletion=t.rollupProgressCompletion),void 0!==t.objectiveMeasureWeight&&(e.objectiveMeasureWeight=t.objectiveMeasureWeight),void 0!==t.selectionTiming&&(e.selectionTiming=t.selectionTiming),void 0!==t.selectCount&&(e.selectCount=t.selectCount),void 0!==t.randomizeChildren&&(e.randomizeChildren=t.randomizeChildren),void 0!==t.randomizationTiming&&(e.randomizationTiming=t.randomizationTiming),void 0!==t.selectionCountStatus&&(e.selectionCountStatus=t.selectionCountStatus),void 0!==t.reorderChildren&&(e.reorderChildren=t.reorderChildren),void 0!==t.completionSetByContent&&(e.completionSetByContent=t.completionSetByContent),void 0!==t.objectiveSetByContent&&(e.objectiveSetByContent=t.objectiveSetByContent),void 0!==t.tracked&&(e.tracked=t.tracked)}},{key:"applySequencingRulesSettings",value:function(e,t){if(t){if(t.preConditionRules){var i=!0,n=!1,r=void 0;try{for(var o,a=t.preConditionRules[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=this.createSequencingRule(o.value);e.addPreConditionRule(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}if(t.exitConditionRules){var c=!0,l=!1,u=void 0;try{for(var d,f=t.exitConditionRules[Symbol.iterator]();!(c=(d=f.next()).done);c=!0){var v=this.createSequencingRule(d.value);e.addExitConditionRule(v)}}catch(e){l=!0,u=e}finally{try{c||null==f.return||f.return()}finally{if(l)throw u}}}if(t.postConditionRules){var h=!0,m=!1,p=void 0;try{for(var y,g=t.postConditionRules[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var _=this.createSequencingRule(y.value);e.addPostConditionRule(_)}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}}}},{key:"createSequencingRule",value:function(e){var t=new kt(e.action,e.conditionCombination),i=!0,n=!1,r=void 0;try{for(var o,a=e.conditions[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,c=new At(s.condition,s.operator,new Map(Object.entries(s.parameters||{})));s.referencedObjective&&(c.referencedObjective=s.referencedObjective),t.addCondition(c)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"applyRollupRulesSettings",value:function(e,t){if(null==t?void 0:t.rules){var i=!0,n=!1,r=void 0;try{for(var o,a=t.rules[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=this.createRollupRule(o.value);e.addRule(s)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}},{key:"createRollupRule",value:function(e){var t=new jn(e.action,e.consideration,e.minimumCount,e.minimumPercent),i=!0,n=!1,r=void 0;try{for(var o,a=e.conditions[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value,c=new kn(s.condition,new Map(Object.entries(s.parameters||{})));t.addCondition(c)}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"sanitizeSequencingCollections",value:function(e){if(!e)return{};var t={},i=!0,n=!1,r=void 0;try{for(var o,a=Object.entries(e)[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=bu(o.value,2),c=s[1],l=s[0].trim();if(l){var u,d={};if(c.sequencingControls&&(d.sequencingControls=_u({},c.sequencingControls)),c.sequencingRules){var f=function(e){var t={action:e.action,conditions:e.conditions.map(function(e){var t={condition:e.condition};return void 0!==e.operator&&(t.operator=e.operator),e.parameters&&(t.parameters=_u({},e.parameters)),void 0!==e.referencedObjective&&(t.referencedObjective=e.referencedObjective),t})};return void 0!==e.conditionCombination&&(t.conditionCombination=e.conditionCombination),t};d.sequencingRules={},c.sequencingRules.preConditionRules&&(d.sequencingRules.preConditionRules=c.sequencingRules.preConditionRules.map(f)),c.sequencingRules.exitConditionRules&&(d.sequencingRules.exitConditionRules=c.sequencingRules.exitConditionRules.map(f)),c.sequencingRules.postConditionRules&&(d.sequencingRules.postConditionRules=c.sequencingRules.postConditionRules.map(f))}c.rollupRules&&(d.rollupRules={rules:null===(u=c.rollupRules.rules)||void 0===u?void 0:u.map(function(e){var t={action:e.action,conditions:e.conditions.map(function(e){var t={condition:e.condition};return e.parameters&&(t.parameters=_u({},e.parameters)),t})};return void 0!==e.consideration&&(t.consideration=e.consideration),void 0!==e.minimumCount&&(t.minimumCount=e.minimumCount),void 0!==e.minimumPercent&&(t.minimumPercent=e.minimumPercent),t})}),c.rollupConsiderations&&(d.rollupConsiderations=_u({},c.rollupConsiderations)),c.selectionRandomizationState&&(d.selectionRandomizationState=this.cloneSelectionRandomizationState(c.selectionRandomizationState)),c.hideLmsUi&&(d.hideLmsUi=this.sanitizeHideLmsUi(c.hideLmsUi)),c.auxiliaryResources&&(d.auxiliaryResources=this.sanitizeAuxiliaryResources(c.auxiliaryResources)),t[l]=d}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"normalizeCollectionRefs",value:function(e){if(!e)return[];var t=Array.isArray(e)?e:[e],i=new Set,result=[],n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value.trim();c&&!i.has(c)&&(i.add(c),result.push(c))}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return result}},{key:"applySequencingCollection",value:function(e,t,i){if(t){if(t.sequencingControls&&this.applySequencingControlsSettings(e.sequencingControls,t.sequencingControls),t.sequencingRules&&this.applySequencingRulesSettings(e.sequencingRules,t.sequencingRules),t.rollupRules&&this.applyRollupRulesSettings(e.rollupRules,t.rollupRules),t.rollupConsiderations&&e.applyRollupConsiderations(t.rollupConsiderations),t.hideLmsUi){var n=this.mergeHideLmsUi(e.hideLmsUi,t.hideLmsUi);n.length>0&&(e.hideLmsUi=n)}if(t.auxiliaryResources){var r=this.sanitizeAuxiliaryResources(t.auxiliaryResources);r.length>0&&(e.auxiliaryResources=this.mergeAuxiliaryResources(e.auxiliaryResources,r))}t.selectionRandomizationState&&i.push(this.cloneSelectionRandomizationState(t.selectionRandomizationState))}}},{key:"sanitizeHideLmsUi",value:function(e){if(!e)return[];var t=new Set(dt),i=new Set,n=[],r=!0,o=!1,a=void 0;try{for(var s,c=e[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var l=s.value;t.has(l)&&!i.has(l)&&(i.add(l),n.push(l))}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}},{key:"mergeHideLmsUi",value:function(e,t){return t&&0!==t.length?this.sanitizeHideLmsUi(Su(e).concat(Su(t))):e}},{key:"sanitizeAuxiliaryResources",value:function(e){if(!e)return[];var t=new Set,i=[],n=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;if(c&&c.resourceId&&"string"==typeof c.resourceId&&c.purpose&&"string"==typeof c.purpose){var l=c.resourceId.trim(),u=c.purpose.trim();if(l&&u){var d="".concat(l,"::").concat(u);t.has(d)||(t.add(d),i.push({resourceId:l,purpose:u}))}}}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return i}},{key:"mergeAuxiliaryResources",value:function(e,t){var i=[],n=new Set,r=!0,o=!1,a=void 0;try{for(var s,c=Su(null!=e?e:[]).concat(Su(null!=t?t:[]))[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var l=s.value;if(l){var u=l.resourceId;u&&!n.has(u)&&(n.add(u),i.push({resourceId:u,purpose:l.purpose}))}}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return i}},{key:"cloneSelectionRandomizationState",value:function(e){var t={};return e.childOrder&&(t.childOrder=Su(e.childOrder)),e.selectedChildIds&&(t.selectedChildIds=Su(e.selectedChildIds)),e.hiddenFromChoiceChildIds&&(t.hiddenFromChoiceChildIds=Su(e.hiddenFromChoiceChildIds)),void 0!==e.selectionCountStatus&&(t.selectionCountStatus=e.selectionCountStatus),void 0!==e.reorderChildren&&(t.reorderChildren=e.reorderChildren),t}},{key:"applySelectionRandomizationState",value:function(e,t){var i=e.sequencingControls;void 0!==t.selectionCountStatus&&(i.selectionCountStatus=t.selectionCountStatus),void 0!==t.reorderChildren&&(i.reorderChildren=t.reorderChildren);var n=t.selectedChildIds?new Set(t.selectedChildIds):null,r=t.hiddenFromChoiceChildIds?new Set(t.hiddenFromChoiceChildIds):null;t.childOrder&&t.childOrder.length>0&&e.setChildOrder(t.childOrder);var o=!1;if(n||r){var a=!0,s=!1,c=void 0;try{for(var l,u=e.children[Symbol.iterator]();!(a=(l=u.next()).done);a=!0){var d=l.value;if(n){var f=n.has(d.id);d.isAvailable=f,r||(d.isHiddenFromChoice=!f),o=!0}r&&(d.isHiddenFromChoice=r.has(d.id),o=!0)}}catch(e){s=!0,c=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw c}}}(o||n||void 0!==t.selectionCountStatus||void 0!==t.reorderChildren||t.childOrder&&t.childOrder.length>0)&&e.setProcessedChildren(e.children.filter(function(e){return e.isAvailable}))}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Cu(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Eu(e){return function(e){if(Array.isArray(e))return Cu(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Cu(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Cu(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Au=Object.defineProperty,ku=function(e,t,i){return function(e,t,i){return t in e?Au(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ju=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ku(this,"sequencingCollections"),ku(this,"sequencingConfigBuilder"),this.sequencingCollections=t||{},this.sequencingConfigBuilder=i||new Ou}return t=e,(i=[{key:"setSequencingCollections",value:function(e){this.sequencingCollections=e}},{key:"createActivity",value:function(e){var t=new Gn(e.id,e.title),i=[],n=this.sequencingConfigBuilder.normalizeCollectionRefs(e.sequencingCollectionRefs),r=!0,o=!1,a=void 0;try{for(var s,c=n[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var l=this.sequencingCollections[s.value];l&&this.sequencingConfigBuilder.applySequencingCollection(t,l,i)}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}if(void 0!==e.isVisible&&(t.isVisible=e.isVisible),void 0!==e.isActive&&(t.isActive=e.isActive),void 0!==e.isSuspended&&(t.isSuspended=e.isSuspended),void 0!==e.isCompleted&&(t.isCompleted=e.isCompleted),void 0!==e.isHiddenFromChoice&&(t.isHiddenFromChoice=e.isHiddenFromChoice),void 0!==e.isAvailable&&(t.isAvailable=e.isAvailable),void 0!==e.attemptLimit&&(t.attemptLimit=e.attemptLimit),void 0!==e.attemptAbsoluteDurationLimit&&(t.attemptAbsoluteDurationLimit=e.attemptAbsoluteDurationLimit),void 0!==e.activityAbsoluteDurationLimit&&(t.activityAbsoluteDurationLimit=e.activityAbsoluteDurationLimit),void 0!==e.timeLimitAction&&(t.timeLimitAction=e.timeLimitAction),void 0!==e.timeLimitDuration&&(t.timeLimitDuration=e.timeLimitDuration),void 0!==e.beginTimeLimit&&(t.beginTimeLimit=e.beginTimeLimit),void 0!==e.endTimeLimit&&(t.endTimeLimit=e.endTimeLimit),e.primaryObjective){var u=this.createActivityObjectiveFromSettings(e.primaryObjective,!0);t.primaryObjective=u,null!==u.minNormalizedMeasure&&(t.scaledPassingScore=u.minNormalizedMeasure)}if(e.objectives){var d=!0,f=!1,v=void 0;try{for(var h,m=e.objectives[Symbol.iterator]();!(d=(h=m.next()).done);d=!0){var p=h.value,y=!0===p.isPrimary,g=this.createActivityObjectiveFromSettings(p,y);y?t.primaryObjective=g:t.addObjective(g)}}catch(e){f=!0,v=e}finally{try{d||null==m.return||m.return()}finally{if(f)throw v}}}if(e.sequencingControls&&this.sequencingConfigBuilder.applySequencingControlsSettings(t.sequencingControls,e.sequencingControls),e.deliveryControls&&this.sequencingConfigBuilder.applySequencingControlsSettings(t.sequencingControls,e.deliveryControls),e.sequencingRules&&this.sequencingConfigBuilder.applySequencingRulesSettings(t.sequencingRules,e.sequencingRules),e.rollupRules&&this.sequencingConfigBuilder.applyRollupRulesSettings(t.rollupRules,e.rollupRules),e.rollupConsiderations&&t.applyRollupConsiderations(e.rollupConsiderations),e.completionThreshold){var _=e.completionThreshold;void 0!==_.completedByMeasure&&(t.completedByMeasure=_.completedByMeasure),void 0!==_.minProgressMeasure?(t.minProgressMeasure=_.minProgressMeasure,t.completionThreshold=""+_.minProgressMeasure):_.completedByMeasure&&(t.completionThreshold=""+t.minProgressMeasure),void 0!==_.progressWeight&&(t.progressWeight=_.progressWeight)}if(e.hideLmsUi){var b=this.sequencingConfigBuilder.mergeHideLmsUi(t.hideLmsUi,e.hideLmsUi);b.length>0&&(t.hideLmsUi=b)}if(e.auxiliaryResources){var S=this.sequencingConfigBuilder.sanitizeAuxiliaryResources(e.auxiliaryResources);S.length>0&&(t.auxiliaryResources=this.sequencingConfigBuilder.mergeAuxiliaryResources(t.auxiliaryResources,S))}if(e.children){var w=!0,O=!1,C=void 0;try{for(var E,A=e.children[Symbol.iterator]();!(w=(E=A.next()).done);w=!0){var k=this.createActivity(E.value);t.addChild(k)}}catch(e){O=!0,C=e}finally{try{w||null==A.return||A.return()}finally{if(O)throw C}}}e.selectionRandomizationState&&i.push(this.sequencingConfigBuilder.cloneSelectionRandomizationState(e.selectionRandomizationState));var j=!0,R=!1,M=void 0;try{for(var T,x=i[Symbol.iterator]();!(j=(T=x.next()).done);j=!0)this.sequencingConfigBuilder.applySelectionRandomizationState(t,T.value)}catch(e){R=!0,M=e}finally{try{j||null==x.return||x.return()}finally{if(R)throw M}}return t}},{key:"extractActivityIds",value:function(e){var t=[e.id],i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s;(s=t).push.apply(s,Eu(this.extractActivityIds(o.value)))}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}return t}},{key:"createActivityObjectiveFromSettings",value:function(e,t){var i,n,r,o=(e.mapInfo||[]).map(function(e){var t,i,n,r,o,a,s,c,l,u,d,f,v,h,m;return{targetObjectiveID:e.targetObjectiveID,readSatisfiedStatus:null===(t=e.readSatisfiedStatus)||void 0===t||t,readNormalizedMeasure:null===(i=e.readNormalizedMeasure)||void 0===i||i,writeSatisfiedStatus:null!==(n=e.writeSatisfiedStatus)&&void 0!==n&&n,writeNormalizedMeasure:null!==(r=e.writeNormalizedMeasure)&&void 0!==r&&r,readCompletionStatus:null===(o=e.readCompletionStatus)||void 0===o||o,writeCompletionStatus:null!==(a=e.writeCompletionStatus)&&void 0!==a&&a,readProgressMeasure:null===(s=e.readProgressMeasure)||void 0===s||s,writeProgressMeasure:null!==(c=e.writeProgressMeasure)&&void 0!==c&&c,readRawScore:null===(l=e.readRawScore)||void 0===l||l,writeRawScore:null!==(u=e.writeRawScore)&&void 0!==u&&u,readMinScore:null===(d=e.readMinScore)||void 0===d||d,writeMinScore:null!==(f=e.writeMinScore)&&void 0!==f&&f,readMaxScore:null===(v=e.readMaxScore)||void 0===v||v,writeMaxScore:null!==(h=e.writeMaxScore)&&void 0!==h&&h,updateAttemptData:null!==(m=e.updateAttemptData)&&void 0!==m&&m}});return new Un(e.objectiveID,{description:null!==(i=e.description)&&void 0!==i?i:null,satisfiedByMeasure:null!==(n=e.satisfiedByMeasure)&&void 0!==n&&n,minNormalizedMeasure:null!==(r=e.minNormalizedMeasure)&&void 0!==r?r:null,mapInfo:o,isPrimary:t})}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Ru(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Mu(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Tu(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){Mu(e,t,i[t])})}return e}function xu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ru(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ru(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Iu(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Pu=Object.defineProperty,Nu=function(e,t,i){return function(e,t,i){return t in e?Pu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Iu(t))?t+"":t,i)},Du=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Nu(this,"_globalObjectives",[]),Nu(this,"context"),this.context=t}return t=e,(i=[{key:"globalObjectives",get:function(){return this._globalObjectives},set:function(objectives){this._globalObjectives=objectives}},{key:"updateSequencingService",value:function(e){this.context.sequencingService=e}},{key:"syncGlobalObjectiveIdsFromSequencing",value:function(){if(this.context.sequencingService){var e=this.context.sequencingService.getOverallSequencingProcess();if(e){var t=e.getGlobalObjectiveMap();if(t&&0!==t.size){var i=Array.from(t.keys()),n=this.context.getSettings(),r=Array.from(new Set((n.globalObjectiveIds||[]).concat(i)));n.globalObjectiveIds=r}}}}},{key:"restoreGlobalObjectivesToCMI",value:function(){if(0!==this._globalObjectives.length)for(var e=0;this._globalObjectives.length>e;e++){var t=this._globalObjectives[e];if(t&&t.id&&!this.context.cmi.objectives.findObjectiveById(t.id)){var i=this.context.cmi.objectives.childArray.length;this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".id"),t.id),t.success_status&&"unknown"!==t.success_status&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".success_status"),t.success_status),t.completion_status&&"unknown"!==t.completion_status&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".completion_status"),t.completion_status),""!==t.score.scaled&&null!==t.score.scaled&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.scaled"),t.score.scaled),""!==t.score.raw&&null!==t.score.raw&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.raw"),t.score.raw),""!==t.score.min&&null!==t.score.min&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.min"),t.score.min),""!==t.score.max&&null!==t.score.max&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".score.max"),t.score.max),""!==t.progress_measure&&null!==t.progress_measure&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".progress_measure"),t.progress_measure),""!==t.description&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(i,".description"),t.description)}}}},{key:"updateGlobalObjectiveFromCMI",value:function(e,t){var i,n,r,o;if(e&&this.context.sequencingService){var a=this.context.sequencingService.getOverallSequencingProcess();if(a)if(a.getGlobalObjectiveMap().has(e)){var s={};t.success_status&&t.success_status!==Ce&&(s.satisfiedStatus=t.success_status===we,s.satisfiedStatusKnown=!0);var c=this.parseObjectiveNumber(null===(i=t.score)||void 0===i?void 0:i.scaled);null!==c&&(s.normalizedMeasure=c,s.normalizedMeasureKnown=!0),void 0!==(null===(n=t.score)||void 0===n?void 0:n.raw)&&""!==t.score.raw&&(s.rawScore=t.score.raw,s.rawScoreKnown=!0),void 0!==(null===(r=t.score)||void 0===r?void 0:r.min)&&""!==t.score.min&&(s.minScore=t.score.min,s.minScoreKnown=!0),void 0!==(null===(o=t.score)||void 0===o?void 0:o.max)&&""!==t.score.max&&(s.maxScore=t.score.max,s.maxScoreKnown=!0);var l=this.parseObjectiveNumber(t.progress_measure);null!==l&&(s.progressMeasure=l,s.progressMeasureKnown=!0),t.completion_status&&t.completion_status!==ke&&(s.completionStatus=t.completion_status,s.completionStatusKnown=!0),0!==Object.keys(s).length&&a.updateGlobalObjective(e,s)}else{var u=this.buildObjectiveMapEntryFromCMI(t);a.updateGlobalObjective(e,u)}}}},{key:"buildObjectiveMapEntryFromCMI",value:function(e){var t,i,n,r,entry={id:e.id,satisfiedStatusKnown:!1,normalizedMeasureKnown:!1,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasureKnown:!1,completionStatusKnown:!1,readSatisfiedStatus:!0,writeSatisfiedStatus:!0,readNormalizedMeasure:!0,writeNormalizedMeasure:!0,readCompletionStatus:!0,writeCompletionStatus:!0,readProgressMeasure:!0,writeProgressMeasure:!0,readRawScore:!0,writeRawScore:!0,readMinScore:!0,writeMinScore:!0,readMaxScore:!0,writeMaxScore:!0};e.success_status&&e.success_status!==Ce&&(entry.satisfiedStatus=e.success_status===we,entry.satisfiedStatusKnown=!0);var o=this.parseObjectiveNumber(null===(t=e.score)||void 0===t?void 0:t.scaled);null!==o&&(entry.normalizedMeasure=o,entry.normalizedMeasureKnown=!0),void 0!==(null===(i=e.score)||void 0===i?void 0:i.raw)&&""!==e.score.raw&&(entry.rawScore=e.score.raw,entry.rawScoreKnown=!0),void 0!==(null===(n=e.score)||void 0===n?void 0:n.min)&&""!==e.score.min&&(entry.minScore=e.score.min,entry.minScoreKnown=!0),void 0!==(null===(r=e.score)||void 0===r?void 0:r.max)&&""!==e.score.max&&(entry.maxScore=e.score.max,entry.maxScoreKnown=!0);var a=this.parseObjectiveNumber(e.progress_measure);return null!==a&&(entry.progressMeasure=a,entry.progressMeasureKnown=!0),e.completion_status&&e.completion_status!==ke&&(entry.completionStatus=e.completion_status,entry.completionStatusKnown=!0),entry}},{key:"buildCMIObjectivesFromMap",value:function(e){var objectives=[];if(!e||"object"!==(void 0===e?"undefined":Iu(e)))return objectives;var t=!0,i=!1,n=void 0;try{for(var r,o=Object.entries(e)[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a,s=xu(r.value,2),c=s[0],entry=s[1];if(entry&&"object"===(void 0===entry?"undefined":Iu(entry))){var l=new bc;l.id=null!==(a=entry.id)&&void 0!==a?a:c,!0===entry.satisfiedStatusKnown&&(l.success_status=entry.satisfiedStatus?we:Oe);var u,d,f,v=this.parseObjectiveNumber(entry.normalizedMeasure);!0===entry.normalizedMeasureKnown&&null!==v&&(l.score.scaled=v+""),!0===entry.rawScoreKnown&&(l.score.raw=(null!==(u=entry.rawScore)&&void 0!==u?u:"")+""),!0===entry.minScoreKnown&&(l.score.min=(null!==(d=entry.minScore)&&void 0!==d?d:"")+""),!0===entry.maxScoreKnown&&(l.score.max=(null!==(f=entry.maxScore)&&void 0!==f?f:"")+"");var h=this.parseObjectiveNumber(entry.progressMeasure);!0===entry.progressMeasureKnown&&null!==h&&(l.progress_measure=h+""),!0===entry.completionStatusKnown&&"string"==typeof entry.completionStatus&&(l.completion_status=entry.completionStatus),objectives.push(l)}}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return objectives}},{key:"buildCMIObjectiveFromJSON",value:function(e){var t=new bc;if(!e||"object"!==(void 0===e?"undefined":Iu(e)))return t;"string"==typeof e.id&&(t.id=e.id),"string"==typeof e.success_status&&(t.success_status=e.success_status),"string"==typeof e.completion_status&&(t.completion_status=e.completion_status),"string"==typeof e.progress_measure&&""!==e.progress_measure&&(t.progress_measure=e.progress_measure),"string"==typeof e.description&&(t.description=e.description);var score=e.score;return score&&"object"===(void 0===score?"undefined":Iu(score))&&("string"==typeof score.scaled&&""!==score.scaled?t.score.scaled=score.scaled:"number"==typeof score.scaled&&Number.isFinite(score.scaled)&&(t.score.scaled=score.scaled+""),"string"==typeof score.raw&&""!==score.raw?t.score.raw=score.raw:"number"==typeof score.raw&&Number.isFinite(score.raw)&&(t.score.raw=score.raw+""),"string"==typeof score.min&&""!==score.min?t.score.min=score.min:"number"==typeof score.min&&Number.isFinite(score.min)&&(t.score.min=score.min+""),"string"==typeof score.max&&""!==score.max?t.score.max=score.max:"number"==typeof score.max&&Number.isFinite(score.max)&&(t.score.max=score.max+"")),t}},{key:"captureGlobalObjectiveSnapshot",value:function(e){var t,i,n={},r=null!==(t=null!=e?e:null===(i=this.context.sequencingService)||void 0===i?void 0:i.getOverallSequencingProcess())&&void 0!==t?t:null;if(r){var o=r.getGlobalObjectiveMapSnapshot(),a=!0,s=!1,c=void 0;try{for(var l,u=Object.entries(o)[Symbol.iterator]();!(a=(l=u.next()).done);a=!0){var d=xu(l.value,2);n[d[0]]=Tu({},d[1])}}catch(e){s=!0,c=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw c}}}var f=!0,v=!1,h=void 0;try{for(var m,p=this._globalObjectives[Symbol.iterator]();!(f=(m=p.next()).done);f=!0){var y=m.value;y.id&&!n[y.id]&&(n[y.id]=this.buildObjectiveMapEntryFromCMI(y))}}catch(e){v=!0,h=e}finally{try{f||null==p.return||p.return()}finally{if(v)throw h}}return n}},{key:"parseObjectiveNumber",value:function(e){if(null==e)return null;if("number"==typeof e&&Number.isFinite(e))return e;var t=parseFloat(e+"");return Number.isFinite(t)?t:null}},{key:"syncCmiToSequencingActivity",value:function(e,t,i){if(this.context.sequencing){var n=this.context.sequencing.getCurrentActivity();if(n&&n.primaryObjective){var r=n.primaryObjective;t!==Ce&&(r.satisfiedStatus=t===we,r.satisfiedStatusKnown=!0,r.measureStatus=!0,n.objectiveMeasureStatus=!0,n.objectiveSatisfiedStatus=t===we,n.objectiveSatisfiedStatusKnown=!0),e!==ke&&(r.completionStatus=e),void 0!==(null==i?void 0:i.scaled)&&null!==i.scaled&&(r.normalizedMeasure=i.scaled,r.measureStatus=!0),void 0!==(null==i?void 0:i.raw)&&null!==i.raw&&(r.rawScore=i.raw+""),void 0!==(null==i?void 0:i.min)&&null!==i.min&&(r.minScore=i.min+""),void 0!==(null==i?void 0:i.max)&&null!==i.max&&(r.maxScore=i.max+"")}}}},{key:"findOrCreateGlobalObjective",value:function(e){var t=this._globalObjectives.findIndex(function(t){return t.id===e});if(-1===t){t=this._globalObjectives.length;var i=new bc;i.id=e,this._globalObjectives.push(i)}return{index:t,objective:this._globalObjectives[t]}}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function qu(e,t,i,n,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(n,r)}function Lu(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){qu(o,n,r,a,s,"next",e)}function s(e){qu(o,n,r,a,s,"throw",e)}a(void 0)})}}function zu(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Fu(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Bu(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){zu(e,t,i[t])})}return e}function Vu(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:c(0)}),s(a,"throw",{value:c(1)}),s(a,"return",{value:c(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function c(s){return function(c){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function Hu(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Uu=Object.defineProperty,Gu=function(e,t,i){return function(e,t,i){return t in e?Uu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Hu(t))?t+"":t,i)},Ku=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Gu(this,"context"),Gu(this,"globalObjectiveManager"),this.context=t,this.globalObjectiveManager=i}return t=e,(i=[{key:"saveSequencingState",value:function(e){return Lu(function(){var t,i,n,r,o,a,s;return Vu(this,function(c){switch(c.label){case 0:if(!(t=this.context.getSettings()).sequencingStatePersistence)return this.context.apiLog("saveSequencingState","No persistence configuration provided",je.WARN),[2,!1];c.label=1;case 1:if(c.trys.push([1,3,,4]),i=this.serializeSequencingState(),n=Bu({learnerId:this.context.learnerId||"unknown",courseId:t.courseId||"unknown",attemptNumber:1,lastUpdated:(new Date).toISOString(),version:t.sequencingStatePersistence.stateVersion||"1.0"},e),o=i,!1!==(r=t.sequencingStatePersistence).compress&&(o=this.compressStateData(i)),r.maxStateSize&&o.length>r.maxStateSize)throw Error("State size ".concat(o.length," exceeds limit ").concat(r.maxStateSize));return[4,r.persistence.saveState(o,n)];case 2:return a=c.sent(),r.debugPersistence&&this.context.apiLog("saveSequencingState","State save ".concat(a?"succeeded":"failed",": size=").concat(o.length),a?je.INFO:je.WARN),[2,a];case 3:return s=c.sent(),this.context.apiLog("saveSequencingState","Error saving sequencing state: ".concat(Fu(s,Error)?s.message:s+""),je.ERROR),[2,!1];case 4:return[2]}})}).call(this)}},{key:"loadSequencingState",value:function(e){return Lu(function(){var t,i,n,r,o,a,s;return Vu(this,function(c){switch(c.label){case 0:if(!(t=this.context.getSettings()).sequencingStatePersistence)return this.context.apiLog("loadSequencingState","No persistence configuration provided",je.WARN),[2,!1];c.label=1;case 1:return c.trys.push([1,3,,4]),i=Bu({learnerId:this.context.learnerId||"unknown",courseId:t.courseId||"unknown",attemptNumber:1,version:t.sequencingStatePersistence.stateVersion||"1.0"},e),[4,(n=t.sequencingStatePersistence).persistence.loadState(i)];case 2:return(r=c.sent())?(o=r,!1!==n.compress&&(o=this.decompressStateData(r)),a=this.deserializeSequencingState(o),n.debugPersistence&&this.context.apiLog("loadSequencingState","State load ".concat(a?"succeeded":"failed",": size=").concat(r.length),a?je.INFO:je.WARN),[2,a]):(n.debugPersistence&&this.context.apiLog("loadSequencingState","No sequencing state found to load",je.INFO),[2,!1]);case 3:return s=c.sent(),this.context.apiLog("loadSequencingState","Error loading sequencing state: ".concat(Fu(s,Error)?s.message:s+""),je.ERROR),[2,!1];case 4:return[2]}})}).call(this)}},{key:"serializeSequencingState",value:function(){var e,t={version:(null===(e=this.context.getSettings().sequencingStatePersistence)||void 0===e?void 0:e.stateVersion)||"1.0",timestamp:(new Date).toISOString(),sequencing:null,currentActivityId:null,globalObjectives:this.globalObjectiveManager.globalObjectives.map(function(e){return e.toJSON()}),globalObjectiveMap:{},adlNavState:{request:this.context.adl.nav.request,request_valid:this.context.adl.nav.request_valid},contentDelivered:!1};if(this.context.sequencingService){var i=this.context.sequencingService.getOverallSequencingProcess();if(i){var n=i.getSequencingState();t.sequencing=n,t.contentDelivered=i.hasContentBeenDelivered(),t.globalObjectiveMap=this.globalObjectiveManager.captureGlobalObjectiveSnapshot(i)}var r=this.context.sequencing.getCurrentActivity();r&&(t.currentActivityId=r.id)}return t.globalObjectiveMap&&0!==Object.keys(t.globalObjectiveMap).length||(t.globalObjectiveMap=this.globalObjectiveManager.captureGlobalObjectiveSnapshot()),JSON.stringify(t)}},{key:"deserializeSequencingState",value:function(e){var t=this;try{var i,n=JSON.parse(e),r=(null===(i=this.context.getSettings().sequencingStatePersistence)||void 0===i?void 0:i.stateVersion)||"1.0";if(n.version!==r&&this.context.apiLog("deserializeSequencingState","State version mismatch: ".concat(n.version," vs expected ").concat(r),je.WARN),n.globalObjectiveMap&&n.sequencing&&!n.sequencing.globalObjectiveMap&&(n.sequencing.globalObjectiveMap=n.globalObjectiveMap),n.sequencing&&this.context.sequencingService){var o=this.context.sequencingService.getOverallSequencingProcess();o&&(o.restoreSequencingState(n.sequencing),n.contentDelivered&&o.setContentDelivered(!0))}var a=new Map;if(Array.isArray(n.globalObjectives)){var s=!0,c=!1,l=void 0;try{for(var u,d=n.globalObjectives[Symbol.iterator]();!(s=(u=d.next()).done);s=!0){var f=this.globalObjectiveManager.buildCMIObjectiveFromJSON(u.value);f.id&&a.set(f.id,f)}}catch(e){c=!0,l=e}finally{try{s||null==d.return||d.return()}finally{if(c)throw l}}}if(n.globalObjectiveMap&&"object"===Hu(n.globalObjectiveMap)){var v=this.globalObjectiveManager.buildCMIObjectivesFromMap(n.globalObjectiveMap),h=!0,m=!1,p=void 0;try{for(var y,g=v[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var _=y.value;_.id&&(a.has(_.id)||a.set(_.id,_))}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}return a.size>0&&(this.globalObjectiveManager.globalObjectives=Array.from(a.values()),this.globalObjectiveManager.globalObjectives.forEach(function(e){e.id&&t.globalObjectiveManager.updateGlobalObjectiveFromCMI(e.id,e)})),n.adlNavState&&(this.context.adl.nav.request=n.adlNavState.request||"_none_",this.context.adl.nav.request_valid=n.adlNavState.request_valid||{}),!0}catch(e){return this.context.apiLog("deserializeSequencingState","Error deserializing sequencing state: ".concat(Fu(e,Error)?e.message:e+""),je.ERROR),!1}}},{key:"compressStateData",value:function(e){return"undefined"!=typeof btoa?btoa(encodeURIComponent(e)):e}},{key:"decompressStateData",value:function(e){if("undefined"!=typeof atob)try{return decodeURIComponent(atob(e))}catch(t){return e}return e}}])&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Yu(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}var Wu=Object.defineProperty,Ju=function(e,t,i){return function(e,t,i){return t in e?Wu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},$u=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ju(this,"context"),Ju(this,"globalObjectiveManager"),this.context=t,this.globalObjectiveManager=i||null}return t=e,i=[{key:"setGlobalObjectiveManager",value:function(e){this.globalObjectiveManager=e}},{key:"updateSequencingService",value:function(e){this.context.sequencingService=e}},{key:"renderCommitCMI",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.context.renderCMIToJSONObject();e||t?i.cmi.total_time=this.context.cmi.getCurrentTotalTime():delete i.cmi.total_time;var n=v(i);switch(this.context.getSettings().dataCommitFormat){case"flattened":return n;case"params":return Object.entries(n).map(function(e){var t,i,n=(i=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}}(t,i)||function(e,t){if(e){if("string"==typeof e)return Yu(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Yu(e,t):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=n[1];return"".concat(n[0],"=").concat(r)});default:return i}}},{key:"renderCommitObject",value:function(e){var t,i,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.renderCommitCMI(e,n),o=e||n?this.context.cmi.getCurrentTotalTime():"",a=d(o,Ke),s=ke,c=Ce;this.context.cmi.completion_status&&("completed"===this.context.cmi.completion_status?s=Ee:"incomplete"===this.context.cmi.completion_status&&(s=Ae)),this.context.cmi.success_status&&("passed"===this.context.cmi.success_status?c=we:"failed"===this.context.cmi.success_status&&(c=Oe));var l=(null===(i=this.context.cmi)||void 0===i||null===(t=i.score)||void 0===t?void 0:t.getScoreObject())||{},u={completionStatus:s,successStatus:c,totalTimeSeconds:a,runtimeData:r};l&&(u.score=l);var f=this.context.getSettings();if(f.autoPopulateCommitMetadata){var v,h;f.courseId&&(u.courseId=f.courseId),f.scoId&&(u.scoId=f.scoId),this.context.cmi.learner_id&&(u.learnerId=this.context.cmi.learner_id),this.context.cmi.learner_name&&(u.learnerName=this.context.cmi.learner_name);var m=null===(v=this.context.sequencingService)||void 0===v?void 0:v.getSequencingState();(null==m||null===(h=m.currentActivity)||void 0===h?void 0:h.id)&&(u.activityId=m.currentActivity.id)}return this.globalObjectiveManager&&this.globalObjectiveManager.syncCmiToSequencingActivity(s,c,l),u}},{key:"determineEntryValue",value:function(e,t){var i=null==e?void 0:e.trim();return""===e||null==e||""===i?"ab-initio":"suspend"===e?"resume":"logout"===e||"normal"===e?"":"time-out"===e&&t?"resume":""}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),e;var t,i}();function Xu(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function Qu(e,t,i,n,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(n,r)}function Zu(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){Qu(o,n,r,a,s,"next",e)}function s(e){Qu(o,n,r,a,s,"throw",e)}a(void 0)})}}function ed(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function td(e){return td=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},td(e)}function nd(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function rd(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(rd=function(){return!!result})()}function od(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){ed(e,t,i[t])})}return e}function ad(e,t){return ad=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ad(e,t)}function sd(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:c(0)}),s(a,"throw",{value:c(1)}),s(a,"return",{value:c(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function c(s){return function(c){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&r[3]>s[1])){o.label=s[1];break}if(6===s[0]&&r[1]>o.label){o.label=r[1],r=s;break}if(r&&r[2]>o.label){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function cd(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var ld=Object.defineProperty,ud=function(e,t,i){return function(e,t,i){return t in e?ld(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":cd(t))?t+"":t,i)},dd=new Set(["cmi.suspend_data","cmi.location","cmi.scaled_passing_score","cmi.max_time_allowed","cmi.completion_threshold","cmi.progress_measure","cmi.score.scaled","cmi.score.raw","cmi.score.min","cmi.score.max","cmi.objectives.N.score.scaled","cmi.objectives.N.score.raw","cmi.objectives.N.score.min","cmi.objectives.N.score.max","cmi.objectives.N.progress_measure","cmi.objectives.N.description","cmi.interactions.N.weighting","cmi.interactions.N.type","cmi.interactions.N.timestamp","cmi.interactions.N.result","cmi.interactions.N.latency","cmi.interactions.N.learner_response","cmi.interactions.N.description","cmi.comments_from_learner.N.timestamp"]),Scorm2004API=function(e){function Scorm2004API(e,t){var i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Scorm2004API);var n=e?od({},e):void 0;n&&void 0===n.mastery_override&&(n.mastery_override=!1),i=function(e,t,i){return t=td(t),n=e,!(r=rd()?Reflect.construct(t,i||[],td(e).constructor):t.apply(e,i))||"object"!==cd(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n):r;var n,r}(this,Scorm2004API,[de,n,t]),ud(i,"_version","1.0"),ud(i,"_sequencing"),ud(i,"_sequencingService",null),ud(i,"_extractedScoItemIds",[]),ud(i,"_sequencingCollections",{}),ud(i,"_responseValidator"),ud(i,"_cmiHandler"),ud(i,"_activityTreeBuilder"),ud(i,"_sequencingConfigBuilder"),ud(i,"_globalObjectiveManager"),ud(i,"_statePersistence",null),ud(i,"_dataSerializer"),ud(i,"cmi"),ud(i,"adl"),ud(i,"Initialize"),ud(i,"Terminate"),ud(i,"GetValue"),ud(i,"SetValue"),ud(i,"Commit"),ud(i,"GetLastError"),ud(i,"GetErrorString"),ud(i,"GetDiagnostic"),i.cmi=new Ol,i.adl=new ql,i._sequencing=new du,i.adl.sequencing=i._sequencing,i._sequencingConfigBuilder=new Ou,i._activityTreeBuilder=new ju({},i._sequencingConfigBuilder);var r={throwSCORMError:function(e,t,n){return i.throwSCORMError(e,t,n)},getLastErrorCode:function(){return i.lastErrorCode},checkCorrectResponseValue:function(e,t,n,r){return i._responseValidator.checkCorrectResponseValue(e,t,n,r)}};i._responseValidator=new vu(r);var o={cmi:i.cmi,isInitialized:function(){return i.isInitialized()},throwSCORMError:function(e,t,n){return i.throwSCORMError(e,t,n)},getLastErrorCode:function(){return i.lastErrorCode}};i._cmiHandler=new pu(o,i._responseValidator);var a={getSettings:function(){return i.settings},cmi:i.cmi,sequencing:i._sequencing,sequencingService:i._sequencingService,commonSetCMIValue:i._commonSetCMIValue.bind(i)};i._globalObjectiveManager=new Du(a);var s={getSettings:function(){return i.settings},cmi:i.cmi,sequencingService:i._sequencingService,renderCMIToJSONObject:i.renderCMIToJSONObject.bind(i)};return i._dataSerializer=new $u(s,i._globalObjectiveManager),(null==n?void 0:n.sequencing)&&i.configureSequencing(n.sequencing),i.initializeSequencingService(n),i.Initialize=i.lmsInitialize,i.Terminate=i.lmsFinish,i.GetValue=i.lmsGetValue,i.SetValue=i.lmsSetValue,i.Commit=i.lmsCommit,i.GetLastError=i.lmsGetLastError,i.GetErrorString=i.lmsGetErrorString,i.GetDiagnostic=i.lmsGetDiagnostic,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ad(e,t)}(Scorm2004API,e),t=Scorm2004API,i=[{key:"reset",value:function(e){var t,i;this.commonReset(e),null===(t=this.cmi)||void 0===t||t.reset(),this.applyCurrentActivityLaunchData(),null===(i=this.adl)||void 0===i||i.reset()}},{key:"applyCurrentActivityLaunchData",value:function(){var e,t=null===(e=this._sequencing)||void 0===e?void 0:e.getCurrentActivity();t&&this.applyActivityLaunchData(t)}},{key:"applyDeliveredActivityLaunchData",value:function(e){this.isNotInitialized()&&this.applyActivityLaunchData(e)}},{key:"applyActivityLaunchData",value:function(e){var t,i,n,r;if(this.cmi){var o=null===(n=this._sequencing.overallSequencingProcess)||void 0===n?void 0:n.getContentActivityData(e),a=null!==(t=null!==(i=null==o?void 0:o.completionThreshold)&&void 0!==i?i:null===(r=e.completionThreshold)||void 0===r?void 0:""+r)&&void 0!==t?t:"";this.cmi.completion_threshold=a,this.seedCurrentActivityObjectives(e)}}},{key:"applyCurrentActivityObjectiveData",value:function(){var e,t=null===(e=this._sequencing)||void 0===e?void 0:e.getCurrentActivity();this.cmi&&t&&this.seedCurrentActivityObjectives(t)}},{key:"seedCurrentActivityObjectives",value:function(e){var t,i,n=[];e.primaryObjective&&n.push(e.primaryObjective),(t=n).push.apply(t,function(e){if(Array.isArray(e))return Xu(e)}(i=e.objectives)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||function(e,t){if(e){if("string"==typeof e)return Xu(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Xu(e,t):void 0}}(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var r=new Set,o=!0,a=!1,s=void 0;try{for(var c,l=n[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value,d=this.getSeedableObjectiveId(u);if(d&&!r.has(d)){r.add(d);var f=this.findOrSeedCMIObjective(d);if(null!==f){var v=this.cmi.objectives.findObjectiveByIndex(f);v&&this.cmi.objectives.initialized&&!v.initialized&&v.initialize();var h=this.getActivityObjectiveSuccessStatus(u);h&&this._commonSetCMIValue("SeedActivityObjective",!0,"cmi.objectives.".concat(f,".success_status"),h),this.seedObjectiveReadMapValues(e,u,f)}}}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}}},{key:"seedObjectiveReadMapValues",value:function(e,t,i){var n,r=null===(n=this._sequencing.overallSequencingProcess)||void 0===n?void 0:n.getGlobalObjectiveMap();if(r&&0!==t.mapInfo.length){var o=!0,a=!1,s=void 0;try{for(var c,l=t.mapInfo[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value,d=r.get(u.targetObjectiveID||t.id);if(d){var f=fr.getGlobalObjectiveReadState(e,t,u,d);this.applyObjectiveReadStateToCMI(i,f)}}}catch(e){a=!0,s=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw s}}}}},{key:"applyObjectiveReadStateToCMI",value:function(e,t){void 0!==t.satisfiedStatus&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".success_status"),t.satisfiedStatus?we:Oe),void 0!==t.normalizedMeasure&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.scaled"),t.normalizedMeasure+""),void 0!==t.completionStatus&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".completion_status"),t.completionStatus),void 0!==t.progressMeasure&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".progress_measure"),t.progressMeasure+""),void 0!==t.rawScore&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.raw"),t.rawScore),void 0!==t.minScore&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.min"),t.minScore),void 0!==t.maxScore&&this._commonSetCMIValue("SeedActivityObjectiveReadMap",!0,"cmi.objectives.".concat(e,".score.max"),t.maxScore)}},{key:"getSeedableObjectiveId",value:function(e){var t=e.id;return"string"!=typeof t||""===t.trim()?null:t}},{key:"findOrSeedCMIObjective",value:function(e){var t=this.cmi.objectives.childArray.findIndex(function(t){return t.id===e});if(t>=0)return t;var i=this.cmi.objectives.childArray.length;return this._commonSetCMIValue("SeedActivityObjective",!0,"cmi.objectives.".concat(i,".id"),e)===V?i:null}},{key:"getActivityObjectiveSuccessStatus",value:function(e){return e.progressStatus||e.satisfiedStatusKnown?e.satisfiedStatus?we:Oe:null}},{key:"version",get:function(){return this._version}},{key:"globalObjectives",get:function(){return this._globalObjectiveManager.globalObjectives}},{key:"_globalObjectives",get:function(){return this._globalObjectiveManager.globalObjectives},set:function(objectives){this._globalObjectiveManager.globalObjectives=objectives}},{key:"compressStateData",value:function(e){return this._statePersistence?this._statePersistence.compressStateData(e):"undefined"!=typeof btoa?btoa(encodeURIComponent(e)):e}},{key:"decompressStateData",value:function(e){if(this._statePersistence)return this._statePersistence.decompressStateData(e);if("undefined"!=typeof atob)try{return decodeURIComponent(atob(e))}catch(t){return e}return e}},{key:"lmsInitialize",value:function(){var e=this;if(""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))return this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),H;this.cmi.initialize();var result=this.initialize("Initialize","LMS was already initialized!","LMS is already finished!");return result===V&&this._sequencingService&&(this._sequencingService.initialize(),this.applyCurrentActivityObjectiveData()),result===V&&this._globalObjectiveManager.restoreGlobalObjectivesToCMI(),result===V&&this.settings.sequencingStatePersistence&&this.loadSequencingState().catch(function(){e.apiLog("lmsInitialize","Failed to auto-load sequencing state",je.WARN)}),result}},{key:"lmsFinish",value:function(){var e,t,i,n,r;if(""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))return this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),H;var o=(null===(i=this.adl)||void 0===i||null===(t=i.nav)||void 0===t?void 0:t.request)||"_none_",a=(null===(n=this.cmi)||void 0===n?void 0:n.getExitValueInternal())||"",s=this.isTerminated(),c=null!==(e=null===(r=this._sequencingService)||void 0===r?void 0:r.isDeliveryInProgress())&&void 0!==e&&e,result=this.terminate("Terminate",!0);if(result===V&&!s&&!c){var l=!1,u=null,d=o,f="",v=RegExp(Qe);if("_none_"!==o){var h,m,p,y=o.match(v);if(y)if(null===(h=y.groups)||void 0===h?void 0:h.choice_target)f=null===(p=y.groups)||void 0===p?void 0:p.choice_target,d="choice";else if(null===(m=y.groups)||void 0===m?void 0:m.jump_target){var g;f=null===(g=y.groups)||void 0===g?void 0:g.jump_target,d="jump"}}if(this._sequencingService)try{var _,b=null;"_none_"!==d?(b=d,_=f||void 0):this._sequencing.getCurrentActivity()&&(b="exit"),b&&(l=this._sequencingService.processNavigationRequest(b,_,a),u=b)}catch(e){this.apiLog("lmsFinish","Sequencing navigation failed, falling back to event-based navigation: ".concat(e),je.WARN),l=!1}if(!l)if("_none_"!==o){var S={continue:"SequenceNext",previous:"SequencePrevious",choice:"SequenceChoice",jump:"SequenceJump",exit:"SequenceExit",exitAll:"SequenceExitAll",abandon:"SequenceAbandon",abandonAll:"SequenceAbandonAll"}[d];S&&this.processListeners(S,"adl.nav.request",f)}else this.settings.autoProgress&&this.processListeners("SequenceNext",void 0,"next");this._sequencingService&&u&&["exitAll","abandonAll","suspendAll"].includes(u)&&this._sequencingService.terminate(),this.adl.nav.request="_none_"}return result}},{key:"lmsGetValue",value:function(e){if(this.isTerminated())return this.lastErrorCode=de.RETRIEVE_AFTER_TERM+"","";if(!this.isInitialized())return this.lastErrorCode=de.RETRIEVE_BEFORE_INIT+"","";if("adl.nav.request"===e)return this.throwSCORMError(e,de.WRITE_ONLY_ELEMENT,"adl.nav.request is write-only"),"";var t="^adl\\.nav\\.request_valid\\.(choice|jump)\\.{target=([a-zA-Z0-9-_]+)}$";if(m(e,t)){var i=e.match(t);if(i){var n,request=i[1],r=(null===(n=i[2])||void 0===n?void 0:n.replace(/{target=/g,"").replace(/}/g,""))||"";if("choice"===request||"jump"===request){var o,a,s,c=null===(o=this._sequencing)||void 0===o?void 0:o.overallSequencingProcess;return this.settings.scoItemIdValidator?this.settings.scoItemIdValidator(r)+"":(null==c?void 0:c.predictChoiceEnabled)&&"choice"===request?c.predictChoiceEnabled(r)?"true":"false":(null==c?void 0:c.predictJumpEnabled)&&"jump"===request?c.predictJumpEnabled(r)?"true":"false":this._extractedScoItemIds.length>0?this._extractedScoItemIds.includes(r)+"":(null===(s=this.settings)||void 0===s||null===(a=s.scoItemIds)||void 0===a?void 0:a.includes(r))+""}}}return"cmi.completion_status"===e?this._cmiHandler.evaluateCompletionStatus():"cmi.success_status"===e?this._cmiHandler.evaluateSuccessStatus():this.getValue("GetValue",!0,e)}},{key:"lmsSetValue",value:function(e,t){var i,n=this,r=this._peekCMIValue(e),result=this.setValue("SetValue","Commit",!0,e,t);if(result===V&&this._sequencingService)try{this._sequencingService.triggerRollupOnCMIChange(e,r,t)}catch(t){console.warn("Sequencing rollup failed for ".concat(e,": ").concat(t))}return result===V&&"setValue"===(null===(i=this.settings.sequencingStatePersistence)||void 0===i?void 0:i.autoSaveOn)&&["cmi.completion_status","cmi.success_status","cmi.score.scaled","cmi.objectives","adl.nav.request"].some(function(t){return e.startsWith(t)})&&this.saveSequencingState().catch(function(){n.apiLog("lmsSetValue","Failed to auto-save sequencing state",je.WARN)}),result}},{key:"lmsCommit",value:function(){var e=this;if(""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))return this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),H;if(this.settings.throttleCommits)return this.scheduleCommit(500,"Commit"),V;var t,result=this.commit("Commit",!0);return result===V&&"commit"===(null===(t=this.settings.sequencingStatePersistence)||void 0===t?void 0:t.autoSaveOn)&&this.saveSequencingState().catch(function(){e.apiLog("lmsCommit","Failed to auto-save sequencing state",je.WARN)}),result}},{key:"lmsGetLastError",value:function(){return this.getLastError("GetLastError")}},{key:"lmsGetErrorString",value:function(e){return this.getErrorString("GetErrorString",e)}},{key:"lmsGetDiagnostic",value:function(e){return this.getDiagnostic("GetDiagnostic",e)}},{key:"setCMIValue",value:function(e,t){if(m(e,"cmi\\.objectives\\.\\d+")){var i,n,r=+e.split(".")[2],o="cmi.objectives.".concat(r);if(m(e,"cmi\\.objectives\\.\\d+\\.id"))n=t;else{var a=this.cmi.objectives.findObjectiveByIndex(r);n=a?a.id:void 0}if(n&&(null===(i=this.settings.globalObjectiveIds)||void 0===i?void 0:i.includes(n))&&this.currentActivityAllowsGlobalObjectiveWrites()){var s=this._globalObjectiveManager.findOrCreateGlobalObjective(n).index,c=e.replace(o,"_globalObjectives.".concat(s));this._commonSetCMIValue("SetGlobalObjectiveValue",!0,c,t);var l=this._globalObjectiveManager.globalObjectives[s];n&&l&&this._globalObjectiveManager.updateGlobalObjectiveFromCMI(n,l)}}return this._commonSetCMIValue("SetValue",!0,e,t)}},{key:"currentActivityAllowsGlobalObjectiveWrites",value:function(){var e,t;return!1!==(null===(t=this._sequencing)||void 0===t||null===(e=t.getCurrentActivity())||void 0===e?void 0:e.sequencingControls.tracked)}},{key:"getChildElement",value:function(e,t,i){return this._cmiHandler.getChildElement(e,t,i)}},{key:"validateCorrectResponse",value:function(e,t){var i=e.split("."),n=this.cmi.interactions.childArray[+i[2]];n?this._responseValidator.validateCorrectResponse(e,n,t):this.throwSCORMError(e,de.DEPENDENCY_NOT_ESTABLISHED,e)}},{key:"_peekCMIValue",value:function(e){if(!e||"string"!=typeof e)return null;for(var t=e.split("."),i=this,n=0;t.length>n;n++){var r=t[n];if(null==i)return null;try{i=i[r]}catch(e){return null}if(nd(i,ge)){var o=n+1;if(o>=t.length)return i;var a=+t[o];if(!Number.isNaN(a)&&Number.isInteger(a)&&a>=0){if(a>=i.childArray.length)return null;i=i.childArray[a],n++}}}return null!=i?i:null}},{key:"getCMIValue",value:function(e){return this._commonGetCMIValue("GetValue",!0,e)}},{key:"checkUninitializedGet",value:function(e,t){var i;""===t&&(this._setCMIElements.has(e)||dd.has(function(e){return e.replace(/\.\d+(?=\.|$)/g,".N")}(e))&&this.throwSCORMError(e,null!==(i=this._error_codes.VALUE_NOT_INITIALIZED)&&void 0!==i?i:403,"The data model element passed to GetValue (".concat(e,") has not been initialized."),this.settings.uninitializedGetLogLevel))}},{key:"getLmsErrorMessageDetails",value:function(e,t){var i="",n="",r=G.error_descriptions[e+=""];return r&&(i=r.basicMessage,n=r.detailMessage),t?n:i}},{key:"replaceWithAnotherScormAPI",value:function(e){this.cmi=e.cmi,this.adl=e.adl}},{key:"renderCommitCMI",value:function(e){return this._dataSerializer.renderCommitCMI(e,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"renderCommitObject",value:function(e){return this._dataSerializer.renderCommitObject(e,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"storeData",value:function(e,t){var i,n,r,o,a;e&&"normal"===this.cmi.mode&&"credit"===this.cmi.credit&&(this.cmi.completion_threshold&&this.cmi.progress_measure&&(this.cmi.completion_status=parseFloat(this.cmi.completion_threshold)>parseFloat(this.cmi.progress_measure)?"incomplete":"completed"),this.cmi.scaled_passing_score&&this.cmi.score.scaled&&(this.cmi.success_status=parseFloat(this.cmi.scaled_passing_score)>parseFloat(this.cmi.score.scaled)?"failed":"passed"));var s=!1;this.adl.nav.request!==(null===(r=this.startingData)||void 0===r||null===(n=r.adl)||void 0===n||null===(i=n.nav)||void 0===i?void 0:i.request)&&"_none_"!==this.adl.nav.request&&(s=!0);var c=this.getCommitObject(e),l=(null===(a=this.cmi)||void 0===a||null===(o=a.score)||void 0===o?void 0:o.getScoreObject())||{},u=ke;"completed"===this.cmi.completion_status?u=Ee:"incomplete"===this.cmi.completion_status&&(u=Ae);var d=Ce;if("passed"===this.cmi.success_status?d=we:"failed"===this.cmi.success_status&&(d=Oe),this._globalObjectiveManager.syncCmiToSequencingActivity(u,d,l),"string"==typeof this.settings.lmsCommitUrl){var result=this.processHttpRequest(this.settings.lmsCommitUrl,c,e,t);if(s&&void 0!==result.navRequest&&""!==result.navRequest&&"string"==typeof result.navRequest){var f=function(e){var t=new Set(["start","resumeAll","continue","previous","choice","jump","exit","exitAll","abandon","abandonAll","suspendAll","_none_"]),i=e.trim();if(!i)return{command:"_none_",targetActivityId:null,valid:!1,error:"Empty navigation request"};if(t.has(i))return{command:i,targetActivityId:null,valid:!0};var n=i.indexOf(".");if(n>0){var r=i.substring(0,n),o=i.substring(n+1);if(("choice"===r||"jump"===r)&&o)return/^[a-zA-Z0-9._-]+$/.test(o)?{command:r,targetActivityId:o,valid:!0}:{command:"_none_",targetActivityId:null,valid:!1,error:"Invalid target activity ID: contains disallowed characters"}}return{command:"_none_",targetActivityId:null,valid:!1,error:'Unrecognized navigation command: "'.concat(i,'"')}}(result.navRequest);if(f.valid){var v={start:"SequenceStart",resumeAll:"SequenceResumeAll",continue:"SequenceNext",previous:"SequencePrevious",choice:"SequenceChoice",jump:"SequenceJump",exit:"SequenceExit",exitAll:"SequenceExitAll",abandon:"SequenceAbandon",abandonAll:"SequenceAbandonAll",suspendAll:"SequenceSuspendAll"}[f.command];v&&this.processListeners(v,"adl.nav.request",f.targetActivityId)}else this.apiLog("storeData","Invalid navigation request from LMS: ".concat(f.error),je.WARN)}else(null==result?void 0:result.navRequest)&&!s&&"object"===cd(result.navRequest)&&Object.hasOwnProperty.call(result.navRequest,"name")&&result.navRequest.name&&this.processListeners(result.navRequest.name,result.navRequest.data);return result}return{result:V,errorCode:0}}},{key:"configureSequencing",value:function(e){this._sequencingCollections=this._sequencingConfigBuilder.sanitizeSequencingCollections(e.collections),this._activityTreeBuilder.setSequencingCollections(this._sequencingCollections),e.activityTree&&this.configureActivityTree(e.activityTree),e.sequencingRules&&this.configureSequencingRules(e.sequencingRules),e.sequencingControls&&this.configureSequencingControls(e.sequencingControls),e.rollupRules&&this.configureRollupRules(e.rollupRules),this._sequencing.hideLmsUi=e.hideLmsUi?this._sequencingConfigBuilder.sanitizeHideLmsUi(e.hideLmsUi):[],this._sequencing.auxiliaryResources=e.auxiliaryResources?this._sequencingConfigBuilder.sanitizeAuxiliaryResources(e.auxiliaryResources):[]}},{key:"configureActivityTree",value:function(e){var t=this._activityTreeBuilder.createActivity(e);this._sequencing.activityTree.root=t,this._extractedScoItemIds=this._activityTreeBuilder.extractActivityIds(t)}},{key:"configureSequencingRules",value:function(e){this._sequencingConfigBuilder.applySequencingRulesSettings(this._sequencing.sequencingRules,e)}},{key:"configureSequencingControls",value:function(e){this._sequencingConfigBuilder.applySequencingControlsSettings(this._sequencing.sequencingControls,e)}},{key:"configureRollupRules",value:function(e){this._sequencingConfigBuilder.applyRollupRulesSettings(this._sequencing.rollupRules,e)}},{key:"initializeSequencingService",value:function(e){var t=this;try{var i,n,r,o,a,s,c,l,u,d,f,v={autoRollupOnCMIChange:null===(i=null==e||null===(s=e.sequencing)||void 0===s?void 0:s.autoRollupOnCMIChange)||void 0===i||i,autoProgressOnCompletion:null!==(n=null==e||null===(c=e.sequencing)||void 0===c?void 0:c.autoProgressOnCompletion)&&void 0!==n&&n,validateNavigationRequests:null===(r=null==e||null===(l=e.sequencing)||void 0===l?void 0:l.validateNavigationRequests)||void 0===r||r,enableEventSystem:null===(o=null==e||null===(u=e.sequencing)||void 0===u?void 0:u.enableEventSystem)||void 0===o||o,logLevel:null!==(a=null==e||null===(d=e.sequencing)||void 0===d?void 0:d.logLevel)&&void 0!==a?a:"info"};if(this._sequencingService=new So(this._sequencing,this.cmi,this.adl,this.eventService||this,this.loggingService,v),this._sequencingService.setEventListeners(this.buildSequencingEventListeners(null==e||null===(f=e.sequencing)||void 0===f?void 0:f.eventListeners)),this._globalObjectiveManager.updateSequencingService(this._sequencingService),this._dataSerializer.updateSequencingService(this._sequencingService),null==e?void 0:e.sequencingStatePersistence){var h={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id};this._statePersistence=new Ku(h,this._globalObjectiveManager)}this._globalObjectiveManager.syncGlobalObjectiveIdsFromSequencing()}catch(e){console.warn("Failed to initialize sequencing service:",e),this._sequencingService=null}}},{key:"buildSequencingEventListeners",value:function(e){var t,i,n=this;return t=od({},e),i=null!=(i={onActivityDelivery:function(t){var i;n.applyDeliveredActivityLaunchData(t),null==e||null===(i=e.onActivityDelivery)||void 0===i||i.call(e,t)}})?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}),t}},{key:"getSequencingService",value:function(){return this._sequencingService}},{key:"setSequencingEventListeners",value:function(e){this._sequencingService&&this._sequencingService.setEventListeners(this.buildSequencingEventListeners(e))}},{key:"updateSequencingConfiguration",value:function(e){this._sequencingService&&this._sequencingService.updateConfiguration(e)}},{key:"getSequencingState",value:function(){return this._sequencingService?this._sequencingService.getSequencingState():{isInitialized:!1,isActive:!1,currentActivity:null,rootActivity:this._sequencing.getRootActivity(),lastSequencingResult:null}}},{key:"processNavigationRequest",value:function(request,e){return!!this._sequencingService&&this._sequencingService.processNavigationRequest(request,e)}},{key:"resetSequencingState",value:function(){var e,t;null===(e=this._sequencing)||void 0===e||e.reset(),null===(t=this._sequencingService)||void 0===t||t.setEventListeners({})}},{key:"getActivityTrackingData",value:function(e){var t,i;if(!(null===(i=this._sequencing)||void 0===i?void 0:i.activityTree))return null;var n=this._sequencing.activityTree.getActivity(e);return n?{completionStatus:n.completionStatus||"unknown",successStatus:n.successStatus||"unknown",progressMeasure:null!==(t=n.progressMeasure)&&void 0!==t?t:null,score:n.objectiveMeasureStatus?n.objectiveNormalizedMeasure:null}:null}},{key:"saveSequencingState",value:function(e){return Zu(function(){var t,i;return sd(this,function(n){return t=this,this._statePersistence?[2,this._statePersistence.saveSequencingState(e)]:this.settings.sequencingStatePersistence?(i={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id},[2,new Ku(i,this._globalObjectiveManager).saveSequencingState(e)]):(this.apiLog("saveSequencingState","No persistence configuration provided",je.WARN),[2,!1])})}).call(this)}},{key:"loadSequencingState",value:function(e){return Zu(function(){var t,i;return sd(this,function(n){return t=this,this._statePersistence?[2,this._statePersistence.loadSequencingState(e)]:this.settings.sequencingStatePersistence?(i={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id},[2,new Ku(i,this._globalObjectiveManager).loadSequencingState(e)]):(this.apiLog("loadSequencingState","No persistence configuration provided",je.WARN),[2,!1])})}).call(this)}},{key:"serializeSequencingState",value:function(){var e=this;if(this._statePersistence)return this._statePersistence.serializeSequencingState();var t={getSettings:function(){return e.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id};return new Ku(t,this._globalObjectiveManager).serializeSequencingState()}},{key:"deserializeSequencingState",value:function(e){var t=this;if(this._statePersistence)return this._statePersistence.deserializeSequencingState(e);var i={getSettings:function(){return t.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,learnerId:this.cmi.learner_id};return new Ku(i,this._globalObjectiveManager).deserializeSequencingState(e)}},{key:"determineEntryValue",value:function(e,t){return this._dataSerializer.determineEntryValue(e,t)}}],i&&function(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),Scorm2004API;var t,i}(Bo);"undefined"!=typeof window&&(window.Scorm12API=Scorm12API,window.Scorm2004API=Scorm2004API)}();
|
|
2
2
|
//# sourceMappingURL=scorm-again.min.js.map
|