!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},l=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},c=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=+(s+n).toFixed(2)),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)}),v=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 f(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,l=t?t.apply(void 0,i(a)):JSON.stringify(a);return void 0!==(null==n?void 0:n.maxKeyLength)&&l.length>n.maxKeyLength?e.apply(void 0,i(a)):r.has(l)?r.get(l):(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(l,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 b(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 _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_(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,A=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)},E=function(){function e(t){g(this,e),A(this,"jsonString",!1),A(this,"_cmi_element"),A(this,"_initialized",!1),this._cmi_element=t}return b(e,[{key:"initialized",get:function(){return this._initialized}},{key:"initialize",value:function(){this._initialized=!0}}]),e}(),j=function(e){function t(){var e;return g(this,t),e=function(e,t,i){return t=_(t),n=e,!(r=S()?Reflect.construct(t,i||[],_(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),A(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),b(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}(E);function k(e,t,i){return t=I(t),n=e,!(r=x()?Reflect.construct(t,i||[],I(e).constructor):t.apply(e,i))||"object"!==N(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=x()?Reflect.construct:function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&D(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 I(e){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},I(e)}function P(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&&D(e,t)}function x(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(x=function(){return!!result})()}function D(e,t){return D=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},D(e,t)}function N(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,I(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),D(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":N(t))?t+"":t,i)},F=function(e){function t(e,i){var n;return R(this,t),n=k(this,t,["".concat(e," : ").concat(""+i)]),z(n,"_errorCode"),n._errorCode=i,Object.setPrototypeOf(n,t.prototype),n}return P(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=k(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 P(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,l;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===(l=X[101])||void 0===l?void 0:l.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 le(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 ce={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=le(se({},ce),{TERMINATION_BEFORE_INIT:301,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=le(se({},ce),{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 ve(e){return ve=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ve(e)}function fe(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(fe=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=ve(t),n=e,!(r=fe()?Reflect.construct(t,i||[],ve(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}(E),be="unknown",_e="true",Se="false",we="passed",Oe="failed",Ce="unknown",Ae="completed",Ee="incomplete",je="unknown",ke={_: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),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).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:ke.ERROR,uninitializedGetLogLevel:ke.WARN,selfReportSessionTime:!1,alwaysSendTotalTime:!1,accumulateSessionTimeOnTerminate:!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:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){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,l])}}}(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 ke.ERROR:console.error(t);break;case"3":case 3:case"WARN":case ke.WARN:console.warn(t);break;case"2":case 2:case"INFO":case ke.INFO:console.info(t);break;case"1":case 1:case"DEBUG":case ke.DEBUG:console.debug?console.debug(t):console.log(t)}}var Ie="^[\\s\\S]{0,255}$",Pe="^([0-9]+):([0-9]{2}):([0-9]{2})(\\.\\d{1,2})?$",xe="^-?([0-9]+)$",De="^-?([0-9]{0,10})(\\.[0-9]*)?$",Ne="^[\\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-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"];var st=Object.defineProperty,lt=function(e,t,i){return function(e,t,i){return t in e?st(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)},ct=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(){this._cancelled||this._API.isInitialized()&&this._API.commit(this._callback,!1,"autocommit")}}])&&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}(),ut=["continue","previous","exit","exitAll","abandon","abandonAll","suspendAll"],dt=new WeakMap;function vt(e){var t;return null!==(t=dt.get(e))&&void 0!==t?t:0}function ft(e,t,i){return t=yt(t),n=e,!(r=_t()?Reflect.construct(t,i||[],yt(e).constructor):t.apply(e,i))||"object"!==wt(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 ht(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mt(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 pt(e,t,i){return t&&mt(e.prototype,t),i&&mt(e,i),e}function yt(e){return yt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},yt(e)}function gt(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&&St(e,t)}function bt(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 St(e,t){return St=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},St(e,t)}function wt(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ot=Object.defineProperty,Ct=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":wt(t))?t+"":t,i)},At=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}(At||{}),Et=new Set(["satisfied","objectiveSatisfied","objectiveStatusKnown","objectiveMeasureKnown","objectiveMeasureGreaterThan","objectiveMeasureLessThan"]);var jt=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 ht(this,t),e=ft(this,t,["ruleCondition"]),Ct(e,"_condition","always"),Ct(e,"_operator",null),Ct(e,"_parameters",new Map),Ct(e,"_referencedObjective",null),e._condition=i,e._operator=n,e._parameters=r,e}return gt(t,e),pt(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 t,result,i,n=null!==this._referencedObjective,r=this.resolveReferencedObjective(e);if(!1===(null===(t=e.sequencingControls)||void 0===t?void 0:t.tracked)&&Et.has(this._condition))result="unknown";else switch(this._condition){case"satisfied":case"objectiveSatisfied":result=!(n&&!r)&&(r?r.satisfiedStatusKnown||r.progressStatus?!0===r.satisfiedStatus:"unknown":e.objectiveSatisfiedStatusKnown?!0===e.objectiveSatisfiedStatus:e.primaryObjective||e.successStatus===Ce?"unknown":e.successStatus===we);break;case"objectiveStatusKnown":result=!(n&&!r||(r?!r.satisfiedStatusKnown:!e.objectiveSatisfiedStatusKnown));break;case"objectiveMeasureKnown":result=!(n&&!r||(r?!r.measureStatus:!e.objectiveMeasureStatus));break;case"objectiveMeasureGreaterThan":if(n&&!r){result=!1;break}var o=this._parameters.get("threshold")||0;result=(r?r.measureStatus:e.objectiveMeasureStatus)?(r?r.normalizedMeasure:e.objectiveNormalizedMeasure)>o:"unknown";break;case"objectiveMeasureLessThan":if(n&&!r){result=!1;break}var a=this._parameters.get("threshold")||0;result=(r?r.measureStatus:e.objectiveMeasureStatus)?a>(r?r.normalizedMeasure:e.objectiveNormalizedMeasure):"unknown";break;case"completed":case"activityCompleted":result=!(n&&!r)&&(r?r.completionStatus===je?"unknown":r.completionStatus===Ae:e.completionStatus===je?"unknown":e.completionStatus===Ae);break;case"progressKnown":case"activityProgressKnown":result=!(n&&!r)&&(r?r.completionStatus!==je:"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"===(i=result)?"unknown":!i),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(),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*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}(E);Ct(jt,"_now",function(){return new Date}),Ct(jt,"_getElapsedSecondsHook");var kt=jt,Rt=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 ht(this,t),e=ft(this,t,["sequencingRule"]),Ct(e,"_conditions",[]),Ct(e,"_action","skip"),Ct(e,"_conditionCombination","and"),e._action=i,e._conditionCombination=n,e}return gt(t,e),pt(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(!bt(e,kt))throw new oe(this._cmi_element+".conditions",de.TYPE_MISMATCH);this._conditions.includes(e)||this._conditions.push(e)}},{key:"removeCondition",value:function(e){if(!bt(e,kt))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}(E),Mt=function(e){function t(){var e;return ht(this,t),e=ft(this,t,["sequencingRules"]),Ct(e,"_preConditionRules",[]),Ct(e,"_exitConditionRules",[]),Ct(e,"_postConditionRules",[]),e}return gt(t,e),pt(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(!bt(e,Rt))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(!bt(e,Rt))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(!bt(e,Rt))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}(E);var Tt=Object.defineProperty,It=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?Tt(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 Pt=Object.defineProperty,xt=function(e,t,i){return function(e,t,i){return t in e?Pt(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)},Dt=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"};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){if(e.parent&&!e.parent.sequencingControls.choice)return{valid:!1,exception:"SB.2.9-5"};for(var t=e;t;){if(t.isHiddenFromChoice)return{valid:!1,exception:"SB.2.9-4"};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 l=s+1;a>l;l++){var c=o[l];if(c&&this.treeQueries.isMandatory(c)&&!this.treeQueries.isCompleted(c))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 l=a.value;this.meetsFlowConstraints(l,e)&&i.push(l)}}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 l=i[s];if(l&&this.treeQueries.isMandatory(l)&&!this.treeQueries.isCompleted(l))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 Nt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var qt=Object.defineProperty,Lt=function(e,t,i){return function(e,t,i){return t in e?qt(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)},zt=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}(zt||{}),Ft=function(e){return e.DELIVER="deliver",e.DO_NOT_DELIVER="doNotDeliver",e}(Ft||{}),Bt=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];Nt(this,e),Lt(this,"deliveryRequest"),Lt(this,"targetActivity"),Lt(this,"exception"),Lt(this,"endSequencingSession"),this.deliveryRequest=t,this.targetActivity=i,this.exception=n,this.endSequencingSession=r},Vt=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];Nt(this,e),Lt(this,"identifiedActivity"),Lt(this,"deliverable"),Lt(this,"exception"),Lt(this,"endSequencingSession"),this.identifiedActivity=t,this.deliverable=i,this.exception=n,this.endSequencingSession=r},Ht=function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Nt(this,e),Lt(this,"activity"),Lt(this,"exception"),this.activity=t,this.exception=i},Ut=function(e){return e.FORWARD="forward",e.BACKWARD="backward",e}(Ut||{});var Gt=Object.defineProperty,Kt=function(e,t,i){return function(e,t,i){return t in e?Gt(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)},Yt=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),Kt(this,"now"),Kt(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===At.EXIT||t===At.EXIT_PARENT||t===At.EXIT_ALL?t:null}},{key:"evaluatePostConditionAction",value:function(e){var t=this.checkSequencingRules(e,e.sequencingRules.postConditionRules);return t&&[At.EXIT_PARENT,At.EXIT_ALL,At.RETRY,At.RETRY_ALL,At.CONTINUE,At.PREVIOUS,At.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 At.EXIT_PARENT:return{sequencingRequest:null,terminationRequest:zt.EXIT_PARENT};case At.EXIT_ALL:return{sequencingRequest:null,terminationRequest:zt.EXIT_ALL};case At.RETRY:return{sequencingRequest:zt.RETRY,terminationRequest:null};case At.RETRY_ALL:return{sequencingRequest:zt.RETRY,terminationRequest:zt.EXIT_ALL};case At.CONTINUE:return{sequencingRequest:zt.CONTINUE,terminationRequest:null};case At.PREVIOUS:return{sequencingRequest:zt.PREVIOUS,terminationRequest:null};case At.STOP_FORWARD_TRAVERSAL:return e.sequencingControls.stopForwardTraversal=!0,{sequencingRequest:null,terminationRequest:null};default:return{sequencingRequest:null,terminationRequest:null}}}},{key:"checkLimitConditions",value:function(e){if(e.isSuspended)return!1;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!==At.SKIP&&t!==At.DISABLED,wasSkipped:t===At.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 Wt(e){return Wt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Wt(e)}function Jt(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Jt=function(){return!!result})()}function $t(e,t){return $t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},$t(e,t)}function Xt(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Qt=Object.defineProperty,Zt=function(e,t,i){return function(e,t,i){return t in e?Qt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Xt(t))?t+"":t,i)},ei=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(ei||{}),ti=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(ti||{}),ii=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=Wt(t),n=e,!(r=Jt()?Reflect.construct(t,i||[],Wt(e).constructor):t.apply(e,i))||"object"!==Xt(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"]),Zt(e,"_enabled",!0),Zt(e,"_choice",!0),Zt(e,"_choiceExit",!0),Zt(e,"_flow",!0),Zt(e,"_forwardOnly",!1),Zt(e,"_useCurrentAttemptObjectiveInfo",!0),Zt(e,"_useCurrentAttemptProgressInfo",!0),Zt(e,"_preventActivation",!1),Zt(e,"_constrainChoice",!1),Zt(e,"_stopForwardTraversal",!1),Zt(e,"_rollupObjectiveSatisfied",!0),Zt(e,"_rollupProgressCompletion",!0),Zt(e,"_objectiveMeasureWeight",1),Zt(e,"_selectionTiming","never"),Zt(e,"_selectCount",null),Zt(e,"_selectionCountStatus",!1),Zt(e,"_randomizeChildren",!1),Zt(e,"_randomizationTiming","never"),Zt(e,"_reorderChildren",!1),Zt(e,"_completionSetByContent",!1),Zt(e,"_objectiveSetByContent",!1),Zt(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&&$t(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}(E);function ni(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 ri(e){return function(e){if(Array.isArray(e))return ni(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 ni(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)?ni(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 oi=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=ri(e.children);if(t.selectionTiming===ei.NEVER)return i;if(t.selectionTiming===ei.ONCE&&t.selectionCountStatus)return i;if(t.selectionTiming!==ei.ONCE&&!t.selectionCountStatus)return i;var n=t.selectCount;if(null===n||n>=i.length)return t.selectionTiming===ei.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),l=o[s];void 0!==l&&i[l]&&r.push(i[l]),o.splice(s,1)}t.selectionTiming===ei.ONCE&&(t.selectionCountStatus=!0);var c=!0,u=!1,d=void 0;try{for(var v,f=i[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value;r.includes(h)||(h.isHiddenFromChoice=!0,h.isAvailable=!1)}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}return r}},{key:"randomizeChildrenProcess",value:function(e){var t,i=e.sequencingControls,n=ri(e.children);if(i.randomizationTiming===ti.NEVER)return n;if(i.randomizationTiming===ti.ONCE&&i.reorderChildren)return n;if(!i.randomizeChildren)return n;for(var r=ri(n),o=r.length-1;o>0;o--){var a=Math.floor(Math.random()*(o+1)),s=r[o],l=r[a];s&&l&&(r[o]=l,r[a]=s)}return i.randomizationTiming===ti.ONCE&&(i.reorderChildren=!0),e.children.length=0,(t=e.children).push.apply(t,ri(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)){if(i.selectionTiming===ei.NEVER){var n=e.getAvailableChildren(),r=new Set(e.children.map(function(e){return e.id})),o=new Set(n.map(function(e){return e.id}));(n.length!==e.children.length||o.size!==r.size||ri(r).some(function(id){return!o.has(id)}))&&e.setProcessedChildren(ri(e.children))}return e.getAvailableChildren()}var a,s=!1,l=!1;return i.selectionTiming===ei.ON_EACH_NEW_ATTEMPT?(s=t,t&&(i.selectionCountStatus=!0)):i.selectionTiming===ei.ONCE&&(s=!i.selectionCountStatus),i.randomizationTiming===ti.ON_EACH_NEW_ATTEMPT?(l=t,t&&(i.reorderChildren=!1)):i.randomizationTiming===ti.ONCE&&(l=!i.reorderChildren),s&&this.selectChildrenProcess(e),l&&this.randomizeChildrenProcess(e),a=i.selectionTiming===ei.NEVER?t||l?ri(e.children):e.getAvailableChildren():e.children.filter(function(e){return e.isAvailable}),e.setProcessedChildren(a),a}},{key:"isSelectionNeeded",value:function(e){var t=e.sequencingControls;return t.selectionTiming!==ei.NEVER&&(t.selectionTiming!==ei.ONCE||!t.selectionCountStatus)&&null!==t.selectCount&&e.children.length>t.selectCount}},{key:"isRandomizationNeeded",value:function(e){var t=e.sequencingControls;return t.randomizationTiming!==ti.NEVER&&(t.randomizationTiming!==ti.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 ai=Object.defineProperty,si=function(e,t,i){return function(e,t,i){return t in e?ai(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),si(this,"activityTree",t),si(this,"ruleEngine",i),si(this,"activityEvaluationCallback",null)}return t=e,i=[{key:"setActivityEvaluationCallback",value:function(e){this.activityEvaluationCallback=e}},{key:"getActivityForEvaluation",value:function(e){var t,i;return null!==(t=null===(i=this.activityEvaluationCallback)||void 0===i?void 0:i.call(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:e))&&void 0!==t?t:e}},{key:"flowSubprocess",value:function(e,t){return this.continueFlowActivityTraversal(e,t,!0,null)}},{key:"flowTreeTraversalSubprocess",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t===Ut.FORWARD?this.traverseForward(e,i,arguments.length>3&&void 0!==arguments[3]?arguments[3]:null):this.traverseBackward(e,i)}},{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,t){if(e.parent&&e.parent.sequencingControls.forwardOnly)return{activity:null,endSequencingSession:!1,exception:"SB.2.1-4"};if(!t){this.ensureSelectionAndRandomization(e);var i=e.getAvailableChildren();if(i.length>0)return e.sequencingControls.forwardOnly?{activity:i[0]||null,endSequencingSession:!1,direction:Ut.FORWARD,forwardOnlyCluster:e}:{activity:i[i.length-1]||null,endSequencingSession:!1}}var n=this.activityTree.getPreviousSibling(e);if(n)return this.getBackwardTraversalEntry(n);for(var r=e,o=0;r&&r.parent;){if(++o>1e4)throw Error("Infinite loop detected in backward traversal");var a=this.activityTree.getPreviousSibling(r.parent);if(a)return this.getBackwardTraversalEntry(a);r=r.parent}return{activity:null,endSequencingSession:!1}}},{key:"getBackwardTraversalEntry",value:function(e){this.ensureSelectionAndRandomization(e);var t=e.getAvailableChildren();return t.length>0&&e.sequencingControls.forwardOnly?{activity:t[0]||null,endSequencingSession:!1,direction:Ut.FORWARD,forwardOnlyCluster:e}:{activity:e,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 result=this.evaluateFlowActivity(e,i,mode,arguments.length>4&&void 0!==arguments[4]?arguments[4]:null);return result.deliverable?result.identifiedActivity:null}},{key:"evaluateFlowActivity",value:function(e,t,mode,i){var n=e.parent;return n&&!n.sequencingControls.flow?new Vt(e,!1,"SB.2.2-1"):this.checkSkippedRuleSet(e)?this.continueFlowActivityTraversal(e,mode,!0,i):mode===Ut.FORWARD&&e.sequencingControls.stopForwardTraversal?new Vt(e,!1,"SB.2.2-2"):this.checkActivityProcess(e)?0===e.children.length?new Vt(e,!0):t?this.continueFlowActivityTraversal(e,mode,!1,i):new Vt(e,!1):new Vt(e,!1,"SB.2.2-2")}},{key:"continueFlowActivityTraversal",value:function(e,mode,t,i){var n=this.flowTreeTraversalSubprocess(e,mode,t,i);if(!n.activity){var r=n.exception||(mode===Ut.BACKWARD?"SB.2.1-3":e.children.length>0&&0===e.getAvailableChildren().length?"SB.2.1-2":null);return new Vt(e,!1,r,n.endSequencingSession)}return this.evaluateFlowActivity(n.activity,!0,n.direction||mode,n.forwardOnlyCluster||i)}},{key:"checkSkippedRuleSet",value:function(e){var t=e.sequencingRules.preConditionRules.filter(function(e){return e.action===At.SKIP}),i=this.ruleEngine.checkSequencingRules(this.getActivityForEvaluation(e),t)===At.SKIP;return e.wasSkipped=i,i}},{key:"checkActivityProcess",value:function(e){if(!e.isAvailable)return!1;if(this.ruleEngine.checkLimitConditions(e))return!1;var t=this.ruleEngine.canDeliverActivity(this.getActivityForEvaluation(e));return e.wasSkipped=t.wasSkipped,t.canDeliver}},{key:"ensureSelectionAndRandomization",value:function(e){e.getAvailableChildren()===e.children&&(oi.isSelectionNeeded(e)||oi.isRandomizationNeeded(e))&&oi.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){var result=this.findFirstDeliverableActivityResult(e);return result.deliverable?result.identifiedActivity:null}},{key:"findFirstDeliverableActivityResult",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(0===e.children.length){var i=this.checkActivityProcess(e);return new Vt(e,i,i?null:"SB.2.2-2")}return this.continueFlowActivityTraversal(e,Ut.FORWARD,!1,t)}},{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 ci=Object.defineProperty,ui=function(e,t,i){return function(e,t,i){return t in e?ci(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)},di=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ui(this,"activityTree",t),ui(this,"traversalService",i)}return t=e,(i=[{key:"handleStart",value:function(){var result=new Bt;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.findFirstDeliverableActivityResult(this.activityTree.root);return e.deliverable&&e.identifiedActivity?(result.deliveryRequest=Ft.DELIVER,result.targetActivity=e.identifiedActivity,result):(result.exception=e.exception||"SB.2.5-3",result)}},{key:"handleResumeAll",value:function(){var result=new Bt;return this.activityTree.suspendedActivity?this.activityTree.currentActivity?(result.exception="SB.2.6-2",result):(result.deliveryRequest=Ft.DELIVER,result.targetActivity=this.activityTree.suspendedActivity,result):(result.exception="SB.2.6-1",result)}},{key:"handleContinue",value:function(e){var result=new Bt;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,Ut.FORWARD);return result.endSequencingSession=t.endSequencingSession,t.deliverable&&t.identifiedActivity?(result.deliveryRequest=Ft.DELIVER,result.targetActivity=t.identifiedActivity,result):(result.exception=t.exception||"SB.2.7-2",result)}},{key:"handlePrevious",value:function(e){var result=new Bt;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,Ut.BACKWARD);return i.deliverable&&i.identifiedActivity?(result.deliveryRequest=Ft.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}();function vi(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var fi=Object.defineProperty,hi=function(e,t,i){return function(e,t,i){return t in e?fi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":vi(t))?t+"":t,i)},mi=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),hi(this,"activityTree",t),hi(this,"constraintValidator",i),hi(this,"traversalService",n),hi(this,"treeQueries",r)}return t=e,i=[{key:"handleChoice",value:function(e,t){var result=new Bt,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=!0,o=!1,a=void 0;try{for(var s,l,c=function(){var e=l.value,t=s.traversalService.getActivityForEvaluation(e,i);if(e.sequencingRules.preConditionRules.some(function(e){return e.action===At.HIDE_FROM_CHOICE&&!0===e.evaluate(t)}))return result.exception="SB.2.9-4",{v:result}},u=this.treeQueries.getPathToRoot(i)[Symbol.iterator]();!(r=(l=u.next()).done);r=!0){var d=(s=this,c());if("object"===vi(d))return d.v}}catch(e){o=!0,a=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw a}}if(!this.traversalService.checkActivityProcess(i))return result.exception="SB.2.9-5",result;var v=i;if(i.children.length>0){var f=this.choiceFlowSubprocess(i);if(!f)return result.exception="SB.2.9-7",result;v=f}return result.deliveryRequest=Ft.DELIVER,result.targetActivity=v,result}},{key:"handleJump",value:function(e){var result=new Bt,t=this.activityTree.getActivity(e);return t?this.treeQueries.isInTree(t)?t.isAvailable?(result.deliveryRequest=Ft.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 l=a.value;!l.isHiddenFromChoice&&l.isAvailable&&l.isVisible&&(l.parent&&!l.parent.sequencingControls.choice||this.constraintValidator.validateChoice(t,l).valid&&i.push(l))}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}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 l=this.enhancedChoiceTraversal(a.value);if(l.activity)return l.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 Ht(null,"SB.2.4-3");if(!e.isAvailable)return new Ht(null,null);if(e.isHiddenFromChoice)return new Ht(null,null);if(e.sequencingControls&&e.sequencingControls.stopForwardTraversal)return new Ht(null,"SB.2.4-1");var i=this.constraintValidator.validateTraversalConstraints(e);if(!i.canTraverse)return new Ht(null,null);if(0===e.children.length)return this.traversalService.checkActivityProcess(e)?new Ht(e,null):new Ht(null,null);if((null===(t=e.parent)||void 0===t?void 0:t.sequencingControls.constrainChoice)&&!i.canTraverseInto)return new Ht(null,"SB.2.4-2");if(i.canTraverseInto){var n=this.choiceFlowTreeTraversal(e);return new Ht(n,null)}return new Ht(null,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}();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,"ruleEngine",i)}return t=e,i=[{key:"handleExit",value:function(e){var result=new Bt;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 Bt;return this.activityTree.root&&this.terminateDescendentAttempts(this.activityTree.root),result}},{key:"handleAbandon",value:function(e){var result=new Bt;return e.isActive=!1,this.activityTree.currentActivity=e.parent,result}},{key:"handleAbandonAll",value:function(){var result=new Bt;return this.activityTree.currentActivity=null,result}},{key:"handleSuspendAll",value:function(e){var result=new Bt;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 At.EXIT:break;case At.EXIT_PARENT:t.parent&&t.parent.isActive&&this.terminateDescendentAttempts(t.parent,!0);break;case At.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 bi=Object.defineProperty,_i=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)},Si=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),_i(this,"activityTree",t),_i(this,"traversalService",i)}return t=e,(i=[{key:"handleRetry",value:function(e){var result=new Bt;if(e.isActive||e.isSuspended)return result.exception="SB.2.10-2",result;if(e.children.length>0){var t=this.traversalService.findFirstDeliverableActivityResult(e,e);return t.deliverable&&t.identifiedActivity?(result.deliveryRequest=Ft.DELIVER,result.targetActivity=t.identifiedActivity,result):(result.exception=t.exception||"SB.2.10-3",result)}return this.terminateDescendentAttempts(e),result.deliveryRequest=Ft.DELIVER,result.targetActivity=e,result}},{key:"handleRetryAll",value:function(){if(this.activityTree.currentActivity=null,!this.activityTree.root){var e=new Bt;return e.exception="SB.2.10-1",e}var t=this.traversalService.findFirstDeliverableActivityResult(this.activityTree.root),result=new Bt;return t.deliverable&&t.identifiedActivity?(result.deliveryRequest=Ft.DELIVER,result.targetActivity=t.identifiedActivity,result):(result.exception=t.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 wi=Object.defineProperty,Oi=function(e,t,i){return function(e,t,i){return t in e?wi(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)},Ci=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),Oi(this,"activityTree"),Oi(this,"treeQueries"),Oi(this,"constraintValidator"),Oi(this,"ruleEngine"),Oi(this,"traversalService"),Oi(this,"activityEvaluationCallback",null),Oi(this,"flowHandler"),Oi(this,"choiceHandler"),Oi(this,"exitHandler"),Oi(this,"retryHandler"),Oi(this,"_now"),Oi(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 It(t),this.ruleEngine=new Yt({now:this._now,getAttemptElapsedSecondsHook:this._getAttemptElapsedSecondsHook}),this.constraintValidator=new Dt(t,this.treeQueries),this.traversalService=new li(t,this.ruleEngine),this.flowHandler=new di(t,this.traversalService),this.choiceHandler=new mi(t,this.constraintValidator,this.traversalService,this.treeQueries),this.exitHandler=new gi(t,this.ruleEngine),this.retryHandler=new Si(t,this.traversalService)}return t=e,i=[{key:"now",get:function(){return this._now},set:function(e){this._now=e,kt.setNowProvider(e),this.ruleEngine=new Yt({now:e,getAttemptElapsedSecondsHook:this._getAttemptElapsedSecondsHook}),this.traversalService=new li(this.activityTree,this.ruleEngine),this.applyTraversalCallbacks(),this.flowHandler=new di(this.activityTree,this.traversalService),this.choiceHandler=new mi(this.activityTree,this.constraintValidator,this.traversalService,this.treeQueries),this.retryHandler=new Si(this.activityTree,this.traversalService)}},{key:"getAttemptElapsedSecondsHook",get:function(){return this._getAttemptElapsedSecondsHook},set:function(e){this._getAttemptElapsedSecondsHook=e,kt.setElapsedSecondsHook(e),this.ruleEngine=new Yt({now:this._now,getAttemptElapsedSecondsHook:e}),this.traversalService=new li(this.activityTree,this.ruleEngine),this.applyTraversalCallbacks(),this.flowHandler=new di(this.activityTree,this.traversalService),this.choiceHandler=new mi(this.activityTree,this.constraintValidator,this.traversalService,this.treeQueries),this.retryHandler=new Si(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 zt.START:return this.flowHandler.handleStart();case zt.RESUME_ALL:return this.flowHandler.handleResumeAll();case zt.CONTINUE:return t?this.flowHandler.handleContinue(t):new Bt(Ft.DO_NOT_DELIVER,null,"SB.2.12-1");case zt.PREVIOUS:return t?this.flowHandler.handlePrevious(t):new Bt(Ft.DO_NOT_DELIVER,null,"SB.2.12-1");case zt.CHOICE:return e?this.choiceHandler.handleChoice(e,t):new Bt(Ft.DO_NOT_DELIVER,null,"SB.2.12-5");case zt.JUMP:return e?this.choiceHandler.handleJump(e):new Bt(Ft.DO_NOT_DELIVER,null,"SB.2.12-5");case zt.EXIT:return t?this.exitHandler.handleExit(t):new Bt(Ft.DO_NOT_DELIVER,null,"SB.2.12-1");case zt.EXIT_ALL:return t?this.exitHandler.handleExitAll():new Bt(Ft.DO_NOT_DELIVER,null,"SB.2.12-1");case zt.ABANDON:return t?this.exitHandler.handleAbandon(t):new Bt(Ft.DO_NOT_DELIVER,null,"SB.2.12-1");case zt.ABANDON_ALL:return t?this.exitHandler.handleAbandonAll():new Bt(Ft.DO_NOT_DELIVER,null,"SB.2.12-1");case zt.SUSPEND_ALL:return t?this.exitHandler.handleSuspendAll(t):new Bt(Ft.DO_NOT_DELIVER,null,"SB.2.12-1");case zt.RETRY:return t?this.retryHandler.handleRetry(t):new Bt(Ft.DO_NOT_DELIVER,null,"SB.2.12-1");case zt.RETRY_ALL:return this.retryHandler.handleRetryAll();default:return new Bt(Ft.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(zt).includes(request))return{valid:!1,exception:"SB.2.12-6"};switch(request){case zt.CONTINUE:case zt.PREVIOUS:if(!t)return{valid:!1,exception:"SB.2.12-1"};if(t.isActive)return{valid:!1,exception:request===zt.CONTINUE?"SB.2.7-1":"SB.2.8-1"};if(t.parent&&!t.parent.sequencingControls.flow)return{valid:!1,exception:request===zt.CONTINUE?"SB.2.7-2":"SB.2.8-2"};if(request===zt.PREVIOUS){var i=this.constraintValidator.checkForwardOnlyViolation(t);if(!i.valid)return i}break;case zt.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)===At.HIDE_FROM_CHOICE)return{valid:!1,exception:"SB.2.9-4"};break;case zt.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}},{key:"setActivityEvaluationCallback",value:function(e){this.activityEvaluationCallback=e,this.applyTraversalCallbacks()}},{key:"applyTraversalCallbacks",value:function(){this.activityEvaluationCallback&&this.traversalService.setActivityEvaluationCallback(this.activityEvaluationCallback)}}],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){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Ei=Object.defineProperty,ji=function(e,t,i){return function(e,t,i){return t in e?Ei(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){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),ji(this,"eventService"),ji(this,"loggingService"),ji(this,"callbacks"),ji(this,"currentDeliveredActivity",null),ji(this,"currentDeliveredAttemptCount",null),ji(this,"currentDeliveredGeneration",null),ji(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===Ft.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,n=vt(e);this.currentDeliveredActivity!==e||this.currentDeliveredAttemptCount!==e.attemptCount||this.currentDeliveredGeneration!==n?(this.currentDeliveredActivity&&this.unloadActivity(this.currentDeliveredActivity),this.pendingDelivery=e,this.loggingService.info("Delivering activity: ".concat(e.id," - ").concat(e.title)),this.currentDeliveredActivity=e,this.currentDeliveredAttemptCount=e.attemptCount,this.currentDeliveredGeneration=n,this.pendingDelivery=null,e.isActive=!0,null===(t=(i=this.callbacks).onDeliverActivity)||void 0===t||t.call(i,e),this.eventService.processListeners("ActivityDelivery",e.id,e)):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){Ai(e,t,i[t])})}return e}({},this.callbacks,e)}},{key:"reset",value:function(){this.currentDeliveredActivity&&this.unloadActivity(this.currentDeliveredActivity),this.currentDeliveredActivity=null,this.currentDeliveredAttemptCount=null,this.currentDeliveredGeneration=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 Ri(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}function Mi(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){Ri(o,n,r,a,s,"next",e)}function s(e){Ri(o,n,r,a,s,"throw",e)}a(void 0)})}}function Ti(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ii(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Pi(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){Ti(e,t,i[t])})}return e}function xi(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:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){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,l])}}}var Di=Object.defineProperty,Ni=function(e,t,i){return function(e,t,i){return t in e?Di(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,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ni(this,"reportsRequestCompletion",!0),Ni(this,"settings"),Ni(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 Mi(function(){var s,l,c,result,u,d;return xi(this,function(v){switch(v.label){case 0:return v.trys.push([0,6,7,8]),s=void 0===o?this.settings.requestHandler(t):this.settings.requestHandler(t,o),l=s,i&&"never"!==this.settings.asyncModeBeaconBehavior?[4,this.performBeacon(e,l)]:[3,2];case 1:return c=v.sent(),[3,4];case 2:return[4,this.performFetch(e,l)];case 3:c=v.sent(),v.label=4;case 4:return[4,this.transformResponse(c,r)];case 5:return result=v.sent(),this._isSuccessResponse(c,result)?r("CommitSuccess"):r("CommitError",void 0,result.errorCode),[3,8];case 6:return u=v.sent(),d=Ii(u,Error)?u.message:u+"",n("processHttpRequest","Async request failed: ".concat(d),ke.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:Ii(e,Array)?e.join("&"):JSON.stringify(e),contentType:Ii(e,Array)?"application/x-www-form-urlencoded":this.settings.commitRequestDataType}}},{key:"performFetch",value:function(e,t){return Mi(function(){var i,n,r;return xi(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=Pi({},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 Mi(function(){var i,n,r,o,a,s;return xi(this,function(l){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 Mi(function(){return xi(this,function(e){return[2,{result:s?"true":"false",errorCode:s?0:this.error_codes.GENERAL_COMMIT_FAILURE||391}]})}).call(i)},text:function(){return Mi(function(){return xi(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,ke.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 Mi(function(){var result,t,i,n;return xi(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(Ii(i,Error)?i.message:i+""),errorDetails:JSON.stringify({status:e.status,statusText:e.statusText,url:e.url,responseText:n.substring(0,500),parseError:Ii(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=Pi({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 Li(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var zi=Object.defineProperty,Fi="{target=";function Bi(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 Vi=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?zi(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 Bi(this.context.errorCodes,"UNDEFINED_DATA_MODEL")}},{key:"setCMIValue",value:function(e,t,i,n){if(!i||""===i)return t&&this.context.throwSCORMError(i,Bi(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,l="The data model element passed to ".concat(e," (").concat(i,") is not a valid SCORM data model element."),c=this.getUndefinedDataModelErrorCode(),u=0;r.length>u;u++){if(u===r.length-1){a=this.setFinalAttribute(o,r[u],n,i,t,c,l);break}var d=this.traverseToNextLevel(o,r,u,n,i,t,s,c,l);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),ke.WARN),a}},{key:"getCMIValue",value:function(e,t,i){if(!i||""===i)return t&&this.context.throwSCORMError(i,Bi(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,Bi(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=!1,s="The data model element passed to ".concat(e," (").concat(i,") has not been initialized."),l="The data model element passed to ".concat(e," (").concat(i,") is not a valid SCORM data model element."),c=this.getUndefinedDataModelErrorCode(),u=0;n.length>u;u++){var d=this.validateGetAttribute(r,o=n[u],i,t,c,l,u===n.length-1);if(void 0!==d.returnValue)return d.returnValue;if(d.error)return"";if(null==o){this.context.throwSCORMError(i,c,l);break}if(void 0===(r=r[o])){this.context.throwSCORMError(i,c,l);break}if(Li(r,ge)){var v=this.handleGetArrayAccess(r,n,u,i,t,a,s);if(v.error)return"";r=v.refObject,u=v.idx,a=v.foundFirstIndex}}return null==r?(t||("_children"===o?this.context.throwSCORMError(i,Bi(this.context.errorCodes,"CHILDREN_ERROR"),void 0):"_count"===o&&this.context.throwSCORMError(i,Bi(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(Fi))?this.context.isInitialized()?(this.context.throwSCORMError(n,Bi(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,Bi(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,Bi(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,l){var c=t[i];if(void 0===c||!this.context.checkObjectHasProperty(e,c))return this.context.throwSCORMError(r,s,l),{refObject:e,idx:i,foundFirstIndex:a,error:!0};if(!(e=e[c]))return this.context.throwSCORMError(r,s,l),{refObject:e,idx:i,foundFirstIndex:a,error:!0};if(Li(e,ge)){var u=this.handleSetArrayAccess(e,t,i,n,r,o,a,s,l);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,l){var c=parseInt(t[i+1]||"0",10);if(!isNaN(c)){var u=e.childArray[c];if(u)return{refObject:u,idx:i+1,foundFirstIndex:!0,error:!1};if(c>e.childArray.length){var d=Bi(this.context.errorCodes,o?"GENERAL_SET_FAILURE":"ARGUMENT_ERROR");return this.context.throwSCORMError(r,d,"Cannot set array element at index ".concat(c,". 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 v=this.context.getChildElement(r,n,a);return v?(e.initialized&&v.initialize(),e.childArray[c]=v,{refObject:v,idx:i+1,foundFirstIndex:!0,error:!1}):("0"===this.context.getLastErrorCode()&&this.context.throwSCORMError(r,s,l),{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(Fi)&&"function"==typeof e._isTargetValid){var l=s.substring(8,s.length-1);return{error:!1,returnValue:e._isTargetValid(l)}}if(void 0===t||!this.context.checkObjectHasProperty(e,t))return"_children"===t?(this.context.throwSCORMError(i,Bi(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element does not have children"),{error:!0}):"_count"===t?(this.context.throwSCORMError(i,Bi(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,Bi(this.context.errorCodes,"CHILDREN_ERROR")):"_count"===t?this.context.throwSCORMError(i,Bi(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,o,a){var s=parseInt(t[i+1]||"",10);if(!isNaN(s)){var l=e.childArray[s];if(e.childArray.length>s&&l)return{refObject:l,idx:i+1,foundFirstIndex:!0,error:!1};if(r)return this.context.throwSCORMError(n,Bi(this.context.errorCodes,"VALUE_NOT_INITIALIZED"),a),{refObject:e,idx:i,foundFirstIndex:o,error:!0};var c=t.slice(0,i+1).join(".");if("cmi.interactions"===c&&s===e.childArray.length&&/^cmi\.interactions\.\d+\.(objectives|correct_responses)\._count$/.test(n)){var u=this.context.getChildElement(n,"",o);if(u)return e.initialized&&u.initialize(),{refObject:u,idx:i+1,foundFirstIndex:!0,error:!1}}return this.context.throwSCORMError(n,Bi(this.context.errorCodes,"cmi.interactions"===c||/^cmi\.interactions\.\d+\.(objectives|correct_responses)$/.test(c)?"WRITE_ONLY_ELEMENT":"ARGUMENT_ERROR")),{refObject:e,idx:i,foundFirstIndex:o,error:!0}}return{refObject:e,idx:i,foundFirstIndex:o,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 Hi(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 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(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Gi(this,"_logLevel",ke.ERROR),Gi(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(ke.ERROR,e)}},{key:"warn",value:function(e){this.log(ke.WARN,e)}},{key:"info",value:function(e){this.log(ke.INFO,e)}},{key:"debug",value:function(e){this.log(ke.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 ke.NONE;if("number"==typeof e)return e;switch("string"==typeof e?e.toUpperCase():e){case"1":case"DEBUG":return ke.DEBUG;case"2":case"INFO":return ke.INFO;case"3":case"WARN":return ke.WARN;case"4":case"ERROR":default:return ke.ERROR;case"5":case"NONE":return ke.NONE}}}])&&Hi(t.prototype,i),n&&Hi(t,n),e}();Gi(Ki,"_instance");var Yi=Ki;function Wi(){return Yi.getInstance()}function Ji(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}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,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Xi(this,"_lastErrorCode","0"),Xi(this,"_lastDiagnostic",""),Xi(this,"_errorCodes"),Xi(this,"_apiLog"),Xi(this,"_getLmsErrorMessageDetails"),Xi(this,"_loggingService"),this._errorCodes=t,this._apiLog=i,this._getLmsErrorMessageDetails=n,this._loggingService=r||Wi()}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]:ke.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(Ji(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(Ji(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 l=JSON.stringify(t);this._loggingService.error("Error details: ".concat(l))}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 Zi=Object.defineProperty,en=function(e,t,i){return function(e,t,i){return t in e?Zi(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)},tn=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),en(this,"listenerMap",new Map),en(this,"listenerCount",0),en(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 l,c=this.parseListenerName(a.value);if(c){var u=c.functionName,d=c.CMIElement,v=null!==(l=this.listenerMap.get(u))&&void 0!==l?l:[];v.push({functionName:u,CMIElement:d,callback:t}),this.listenerMap.set(u,v),this.listenerCount++,this.apiLog("on","Added event listener: ".concat(this.listenerCount),ke.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,l=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),ke.INFO,i))},c=i[Symbol.iterator]();!(n=(s=c.next()).done);n=!0)a=this,l()}catch(e){r=!0,o=e}finally{try{n||null==c.return||c.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)}},l=t[Symbol.iterator]();!(i=(a=l.next()).done);i=!0)o=this,s()}catch(e){n=!0,r=e}finally{try{i||null==l.return||l.return()}finally{if(n)throw r}}}},{key:"processListeners",value:function(e,t,i,n){this.apiLog(e,i,ke.INFO,t);var r=this.listenerMap.get(e);if(r){var o=!0,a=!1,s=void 0;try{for(var l,c=r[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,d=!!u.CMIElement,v=!1;if(t&&u.CMIElement)if(u.CMIElement.endsWith("*")){var f=u.CMIElement.slice(0,-1);v=t.startsWith(f)}else v=u.CMIElement===t;d&&!v||(this.apiLog("processListeners","Processing listener: ".concat(u.functionName),ke.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==c.return||c.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 nn(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}function rn(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){nn(o,n,r,a,s,"next",e)}function s(e){nn(o,n,r,a,s,"throw",e)}a(void 0)})}}function an(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function sn(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}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){an(e,t,i[t])})}return e}function cn(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:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){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,l])}}}var un=Object.defineProperty,dn=function(e,t,i){return function(e,t,i){return t in e?un(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)},vn=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),dn(this,"apiLog",n),dn(this,"settings"),dn(this,"error_codes"),dn(this,"storeName","scorm_again_offline_data"),dn(this,"syncQueue","scorm_again_sync_queue"),dn(this,"isOnline",navigator.onLine),dn(this,"syncInProgress",!1),dn(this,"boundOnlineStatusChangeHandler"),dn(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...",ke.INFO),this.syncOfflineData().then(function(t){t?e.apiLog("OfflineStorageService","Sync completed successfully",ke.INFO):e.apiLog("OfflineStorageService","Sync failed",ke.ERROR)},function(t){e.apiLog("OfflineStorageService","Error during sync: ".concat(t),ke.ERROR)})):t&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",ke.INFO)}},{key:"handleCustomNetworkStatus",value:function(e){var t=this;if(sn(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"),ke.INFO),!n&&this.isOnline?(this.apiLog("OfflineStorageService","Device is back online, attempting to sync...",ke.INFO),this.syncOfflineData().then(function(e){e?t.apiLog("OfflineStorageService","Sync completed successfully",ke.INFO):t.apiLog("OfflineStorageService","Sync failed",ke.ERROR)},function(e){t.apiLog("OfflineStorageService","Error during sync: ".concat(e),ke.ERROR)})):n&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",ke.INFO)}else this.apiLog("OfflineStorageService","Invalid online status value in custom event",ke.WARN)}else this.apiLog("OfflineStorageService","Invalid network status event received",ke.WARN)}},{key:"storeOffline",value:function(e,t,i){try{var n=ln({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),ke.INFO),{result:V,errorCode:0}}catch(t){var o,a=(sn(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),ke.ERROR),{result:H,errorCode:null!==(o=this.error_codes.GENERAL)&&void 0!==o?o:0}}}},{key:"getOfflineData",value:function(e){return rn(function(){return cn(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),ke.ERROR),[2,null]}return[2]})}).call(this)}},{key:"syncOfflineData",value:function(){return rn(function(){var e,t,i,n,r,o,a,s,l,c,u,d,v,f;return cn(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"),ke.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(c=null!==(l=this.settings.maxSyncAttempts)&&void 0!==l?l:5,(s=a.value).syncAttempts>=c)return this.apiLog("OfflineStorageService","Removing abandoned item ".concat(s.id," after ").concat(c," failed sync attempts"),ke.WARN),[3,7];h.label=4;case 4:return h.trys.push([4,6,,7]),[4,this.sendDataToLMS(s.data,ln({},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),ke.INFO):(s.syncAttempts++,t.push(s),this.apiLog("OfflineStorageService","Failed to sync item ".concat(s.id,", attempt #").concat(s.syncAttempts),ke.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),ke.ERROR),[3,7];case 7:return i=!0,[3,3];case 8:return[3,11];case 9:return v=h.sent(),n=!0,r=v,[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"),ke.INFO),this.syncInProgress=!1,[2,!0];case 12:return f=h.sent(),this.apiLog("OfflineStorageService","Error during sync process: ".concat(f),ke.ERROR),this.syncInProgress=!1,[2,!1];case 13:return[2]}})}).call(this)}},{key:"sendDataToLMS",value:function(e,t){return rn(function(){var i,n,r,o,a,s,l,result,c,u;return cn(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,ln({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:(v=ln({},this.settings.xhrHeaders),f={"Content-Type":this.settings.commitRequestDataType},f=null!=f?f:{},Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(f)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(f)).forEach(function(e){Object.defineProperty(v,e,Object.getOwnPropertyDescriptor(f,e))}),v)},this.settings.xhrWithCredentials&&(s.credentials="include"),[4,fetch(a,s)];case 2:return l=d.sent(),"function"!=typeof this.settings.responseHandler?[3,4]:[4,this.settings.responseHandler(l)];case 3:return c=d.sent(),[3,6];case 4:return[4,l.json()];case 5:c=d.sent(),d.label=6;case 6:return result=c,200>l.status||l.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),ke.ERROR),[2,{result:H,errorCode:this.error_codes.GENERAL||101}];case 8:return[2]}var v,f})}).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(sn(e,DOMException)&&"QuotaExceededError"===e.name)throw Error("storage quota exceeded - localStorage is full",{cause:e});throw e}}},{key:"hasPendingOfflineData",value:function(e){return rn(function(){return cn(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}(),fn=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}),hn=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],l=void 0!==s&&""!==s&&"*"!==s;if(void 0!==a&&""!==a&&+a>t)throw new r(e,n);if(l&&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 mn(e,t,i,n){return fn(e,t,i,de.TYPE_MISMATCH,oe,n)}function pn(e,t,i){return hn(e,t,i,de.VALUE_OUT_OF_RANGE,oe)}function yn(e,t,i){return t=_n(t),n=e,!(r=On()?Reflect.construct(t,i||[],_n(e).constructor):t.apply(e,i))||"object"!==An(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 gn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bn(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 _n(e){return _n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_n(e)}function Sn(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&&Cn(e,t)}function wn(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function On(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(On=function(){return!!result})()}function Cn(e,t){return Cn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Cn(e,t)}function An(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var En=Object.defineProperty,jn=function(e,t,i){return function(e,t,i){return t in e?En(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":An(t))?t+"":t,i)},kn=function(e){return e.SATISFIED="satisfied",e.NOT_SATISFIED="notSatisfied",e.COMPLETED="completed",e.INCOMPLETE="incomplete",e}(kn||{}),Rn=function(e){return e.ALL="all",e.ANY="any",e}(Rn||{}),Mn=function(e){return e.ALL="all",e.ANY="any",e.NONE="none",e.AT_LEAST_COUNT="atLeastCount",e.AT_LEAST_PERCENT="atLeastPercent",e}(Mn||{}),Tn=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,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"noOp";return gn(this,t),e=yn(this,t,["rollupCondition"]),jn(e,"_condition","always"),jn(e,"_parameters",new Map),jn(e,"_operator","noOp"),e._condition=i,e._parameters=n,e._operator=r,e}return Sn(t,e),bn(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:"operator",get:function(){return this._operator},set:function(e){this._operator=e}},{key:"evaluate",value:function(e){var result,t=!1!==e.objectiveInfoAvailableInCurrentParentAttempt,i=!1!==e.progressInfoAvailableInCurrentParentAttempt;switch(this._condition){case"satisfied":result=t&&(!0===e.objectiveSatisfiedStatus||e.successStatus===we);break;case"objectiveStatusKnown":result=t&&e.objectiveSatisfiedStatusKnown;break;case"objectiveMeasureKnown":result=t&&e.objectiveMeasureStatus;break;case"objectiveMeasureGreaterThan":var n=this._parameters.get("threshold")||0;result=t&&e.objectiveMeasureStatus&&e.objectiveNormalizedMeasure>n;break;case"objectiveMeasureLessThan":var r=this._parameters.get("threshold")||0;result=t&&e.objectiveMeasureStatus&&r>e.objectiveNormalizedMeasure;break;case"completed":result=i&&e.isCompleted;break;case"progressKnown":result=i&&e.completionStatus!==je;break;case"attempted":result=i&&e.attemptCount>0;break;case"attemptLimitExceeded":result=e.hasAttemptLimitExceeded();break;case"notAttempted":result=!i||0===e.attemptCount;break;case"always":result=!0;break;default:result=!1}return"not"===this._operator?!result:result}},{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}}]),t}(E),In=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,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"any";return gn(this,t),e=yn(this,t,["rollupRule"]),jn(e,"_conditions",[]),jn(e,"_action","satisfied"),jn(e,"_consideration","all"),jn(e,"_minimumCount",0),jn(e,"_minimumPercent",0),jn(e,"conditionCombination","any"),e._action=i,e._consideration=n,e._minimumCount=r,e._minimumPercent=o,e.conditionCombination=a,e}return Sn(t,e),bn(t,[{key:"reset",value:function(){this._initialized=!1,this._conditions=[]}},{key:"conditions",get:function(){return this._conditions}},{key:"addCondition",value:function(e){if(!wn(e,Tn))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 0===t._conditions.length||("all"===t.conditionCombination?t._conditions.every(function(t){return t.evaluate(e)}):t._conditions.some(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,conditionCombination:this.conditionCombination};return this.jsonString=!1,result}}]),t}(E),Pn=function(e){function t(){var e;return gn(this,t),e=yn(this,t,["rollupRules"]),jn(e,"_rules",[]),e}return Sn(t,e),bn(t,[{key:"reset",value:function(){this._initialized=!1,this._rules=[]}},{key:"rules",get:function(){return this._rules}},{key:"addRule",value:function(e){if(!wn(e,In))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,l=this._rules[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value;if(c.evaluate(t))switch(c.action){case"satisfied":e.successStatus=we,n=!0;break;case"notSatisfied":e.successStatus=Oe,n=!0;break;case"completed":e.completionStatus=Ae,e.isCompleted=!0,i=!0;break;case"incomplete":e.completionStatus=Ee,e.isCompleted=!1,i=!0}}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.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=Ae,e.isCompleted=!0):t.some(function(e){return e.completionStatus===Ee})&&(e.completionStatus=Ee,e.isCompleted=!1)}},{key:"_objectiveRollupUsingMeasure",value:function(e,t){var i;if(!(null===(i=e.primaryObjective)||void 0===i?void 0:i.satisfiedByMeasure)||null===e.scaledPassingScore)return null;if(0>=e.sequencingControls.objectiveMeasureWeight)return null;var n=0,r=0,o=!1,a=!0,s=!1,l=void 0;try{for(var c,u=t[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var d=c.value;if(d.sequencingControls.rollupObjectiveSatisfied&&d.objectiveMeasureStatus&&!0===d.objectiveMeasureStatus){var v=d.sequencingControls.objectiveMeasureWeight;v>0&&(r+=d.objectiveNormalizedMeasure*v,n+=v,o=!0)}}}catch(e){s=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw l}}if(!o||0===n)return null;var f=r/n;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}(E);function xn(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 Dn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nn(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 qn(e,t,i){return t&&Nn(e.prototype,t),i&&Nn(e,i),e}function Ln(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function zn(e,t,i){return zn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Fn(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},zn(e,t,i||e)}function Fn(e){return Fn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Fn(e)}function Bn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Bn=function(){return!!result})()}function Vn(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){Ln(e,t,i[t])})}return e}function Hn(e,t){return Hn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Hn(e,t)}function Un(e){return function(e){if(Array.isArray(e))return xn(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 xn(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)?xn(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 Gn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}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":Gn(t))?t+"":t,i)},Wn=function(){function e(id){var t,i,n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Dn(this,e),Yn(this,"_id"),Yn(this,"_description"),Yn(this,"_satisfiedByMeasure"),Yn(this,"_minNormalizedMeasure"),Yn(this,"_mapInfo"),Yn(this,"_isPrimary"),Yn(this,"_satisfiedStatus",!1),Yn(this,"_satisfiedStatusKnown",!1),Yn(this,"_measureStatus",!1),Yn(this,"_normalizedMeasure",0),Yn(this,"_rawScore",""),Yn(this,"_rawScoreKnown",!1),Yn(this,"_minScore",""),Yn(this,"_minScoreKnown",!1),Yn(this,"_maxScore",""),Yn(this,"_maxScoreKnown",!1),Yn(this,"_progressMeasure",0),Yn(this,"_progressMeasureStatus",!1),Yn(this,"_completionStatus",je),Yn(this,"_progressStatus",!1),Yn(this,"_satisfiedStatusDirty",!1),Yn(this,"_normalizedMeasureDirty",!1),Yn(this,"_completionStatusDirty",!1),Yn(this,"_progressMeasureDirty",!1),Yn(this,"_rawScoreDirty",!1),Yn(this,"_minScoreDirty",!1),Yn(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?Un(o.mapInfo):[],this._isPrimary=null!==(r=o.isPrimary)&&void 0!==r&&r}return qn(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=Un(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:"initializeUnknownSatisfiedStatusFromCMI",value:function(){this._satisfiedStatus=!1,this._satisfiedStatusKnown=!1,this._progressStatus=!1,this._satisfiedStatusDirty=!0}},{key:"initializeUnknownCompletionStatusFromCMI",value:function(){this._completionStatus=je,this._completionStatusDirty=!0}},{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.satisfiedStatusKnown&&(this._satisfiedStatusKnown=e.satisfiedStatusKnown,this._progressStatus=e.satisfiedStatusKnown,e.satisfiedStatusKnown||(this._satisfiedStatus=!1)),void 0!==e.satisfiedStatus&&(this._satisfiedStatus=e.satisfiedStatus,this._satisfiedStatusKnown=!0,this._progressStatus=!0),void 0!==e.normalizedMeasureKnown&&(this._measureStatus=e.normalizedMeasureKnown,e.normalizedMeasureKnown||(this._normalizedMeasure=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=je,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}(),Jn=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 Dn(this,t),e=function(e,t,i){return t=Fn(t),n=e,!(r=Bn()?Reflect.construct(t,i||[],Fn(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}(this,t,["activity"]),Yn(e,"_id",""),Yn(e,"_title",""),Yn(e,"_children",[]),Yn(e,"_parent",null),Yn(e,"_isVisible",!0),Yn(e,"_isActive",!1),Yn(e,"_isSuspended",!1),Yn(e,"_deliveryWasResumed",!1),Yn(e,"_isCompleted",!1),Yn(e,"_completionStatus",je),Yn(e,"_successStatus",Ce),Yn(e,"_attemptCount",0),Yn(e,"_objectiveInfoAvailableInCurrentParentAttempt",!0),Yn(e,"_progressInfoAvailableInCurrentParentAttempt",!0),Yn(e,"_attemptCompletionAmount",0),Yn(e,"_attemptAbsoluteDuration","PT0H0M0S"),Yn(e,"_attemptExperiencedDuration","PT0H0M0S"),Yn(e,"_activityAbsoluteDuration","PT0H0M0S"),Yn(e,"_activityExperiencedDuration","PT0H0M0S"),Yn(e,"_attemptAbsoluteDurationValue","PT0H0M0S"),Yn(e,"_attemptExperiencedDurationValue","PT0H0M0S"),Yn(e,"_activityAbsoluteDurationValue","PT0H0M0S"),Yn(e,"_activityExperiencedDurationValue","PT0H0M0S"),Yn(e,"_activityStartTimestampUtc",null),Yn(e,"_attemptStartTimestampUtc",null),Yn(e,"_activityEndedDate",null),Yn(e,"_objectiveSatisfiedStatus",!1),Yn(e,"_objectiveSatisfiedStatusKnown",!1),Yn(e,"_objectiveMeasureStatus",!1),Yn(e,"_objectiveNormalizedMeasure",0),Yn(e,"_scaledPassingScore",1),Yn(e,"_objectiveSatisfiedStatusDirty",!1),Yn(e,"_objectiveNormalizedMeasureDirty",!1),Yn(e,"_objectiveMeasureStatusDirty",!1),Yn(e,"_progressMeasure",0),Yn(e,"_progressMeasureStatus",!1),Yn(e,"_location",""),Yn(e,"_attemptAbsoluteStartTime",""),Yn(e,"_learnerPrefs",null),Yn(e,"_activityAttemptActive",!1),Yn(e,"_isHiddenFromChoice",!1),Yn(e,"_isAvailable",!0),Yn(e,"_hideLmsUi",[]),Yn(e,"_auxiliaryResources",[]),Yn(e,"_sharedDataMaps",[]),Yn(e,"_attemptLimit",null),Yn(e,"_attemptAbsoluteDurationLimit",null),Yn(e,"_activityAbsoluteDurationLimit",null),Yn(e,"_timeLimitAction",null),Yn(e,"_timeLimitDuration",null),Yn(e,"_beginTimeLimit",null),Yn(e,"_endTimeLimit",null),Yn(e,"_launchData",""),Yn(e,"_credit","credit"),Yn(e,"_maxTimeAllowed",""),Yn(e,"_completionThreshold",""),Yn(e,"_sequencingControls"),Yn(e,"_sequencingRules"),Yn(e,"_rollupRules"),Yn(e,"_processedChildren",null),Yn(e,"_isNewAttempt",!1),Yn(e,"_primaryObjective",null),Yn(e,"_objectives",[]),Yn(e,"_rollupConsiderations",{requiredForSatisfied:"always",requiredForNotSatisfied:"always",requiredForCompleted:"always",requiredForIncomplete:"always",measureSatisfactionIfActive:!0}),Yn(e,"_wasSkipped",!1),Yn(e,"_attemptProgressStatus",!1),Yn(e,"_wasAutoCompleted",!1),Yn(e,"_wasAutoSatisfied",!1),Yn(e,"_completedByMeasure",!1),Yn(e,"_minProgressMeasure",1),Yn(e,"_progressWeight",1),Yn(e,"_attemptCompletionAmountStatus",!1),e._id=id,e._title=i,e._sequencingControls=new ii,e._sequencingRules=new Mt,e._rollupRules=new Pn,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&&Hn(e,t)}(t,e),qn(t,[{key:"initialize",value:function(){zn(Fn(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._deliveryWasResumed=!1,this._isCompleted=!1,this._completionStatus=je,this._successStatus=Ce,this._attemptCount=0,this._objectiveInfoAvailableInCurrentParentAttempt=!0,this._progressInfoAvailableInCurrentParentAttempt=!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 l,c=this._children[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)l.value.reset()}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.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){mn(this._cmi_element+".id",id,Je)&&(this._id=id)}},{key:"title",get:function(){return this._title},set:function(e){mn(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,l=e[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var id=s.value,c=i.get(id);c&&(n.push(c),i.delete(id))}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}if(i.size>0){var u=!0,d=!1,v=void 0;try{for(var f,h=this._children[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var m=f.value;i.has(m.id)&&(n.push(m),i.delete(m.id))}}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}}n.length===this._children.length&&(t=this._children).splice.apply(t,[0,this._children.length].concat(Un(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:"deliveryWasResumed",get:function(){return this._deliveryWasResumed},set:function(e){this._deliveryWasResumed=e}},{key:"isCompleted",get:function(){return this._isCompleted},set:function(e){this._isCompleted=e,this._completionStatus=e?Ae:Ee}},{key:"completionStatus",get:function(){return this._completionStatus},set:function(e){this._completionStatus=e,this._isCompleted=e===Ae,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:"objectiveInfoAvailableInCurrentParentAttempt",get:function(){return this._objectiveInfoAvailableInCurrentParentAttempt},set:function(e){this._objectiveInfoAvailableInCurrentParentAttempt=e}},{key:"progressInfoAvailableInCurrentParentAttempt",get:function(){return this._progressInfoAvailableInCurrentParentAttempt},set:function(e){this._progressInfoAvailableInCurrentParentAttempt=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:"initializeObjectiveProgressForNewAttempt",value:function(){var e;this._objectiveSatisfiedStatus=!1,this._objectiveSatisfiedStatusKnown=!1,this._objectiveMeasureStatus=!1,this._objectiveNormalizedMeasure=0,this._successStatus=Ce,null===(e=this._primaryObjective)||void 0===e||e.resetState();var t=!0,i=!1,n=void 0;try{for(var r,o=this._objectives[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)r.value.resetState()}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}this.clearAllObjectiveDirty()}},{key:"initializeAttemptProgressForNewAttempt",value:function(){this._isCompleted=!1,this._completionStatus=je,this._attemptCompletionAmount=0,this._attemptCompletionAmountStatus=!1,this._attemptProgressStatus=!1,this._progressMeasure=0,this._progressMeasureStatus=!1,this._attemptAbsoluteDurationValue="PT0H0M0S",this._attemptExperiencedDurationValue="PT0H0M0S",this._attemptStartTimestampUtc=null,this._attemptAbsoluteStartTime="",this._location="",this._activityAttemptActive=!1,this._wasSkipped=!1,this._wasAutoCompleted=!1,this._wasAutoSatisfied=!1}},{key:"initializeTrackingForNewAttempt",value:function(){this.initializeObjectiveProgressForNewAttempt(),this.initializeAttemptProgressForNewAttempt()}},{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._isSuspended&&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&&!v(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(!v(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&&!v(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(!v(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(!v(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(!v(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(!v(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(!v(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 Vn({},this._rollupConsiderations)},set:function(e){this._rollupConsiderations=Vn({},e)}},{key:"applyRollupConsiderations",value:function(e){this._rollupConsiderations=Vn({},this._rollupConsiderations,e)}},{key:"requiredForSatisfied",get:function(){return this._rollupConsiderations.requiredForSatisfied},set:function(e){this._rollupConsiderations.requiredForSatisfied=e}},{key:"requiredForNotSatisfied",get:function(){return this._rollupConsiderations.requiredForNotSatisfied},set:function(e){this._rollupConsiderations.requiredForNotSatisfied=e}},{key:"requiredForCompleted",get:function(){return this._rollupConsiderations.requiredForCompleted},set:function(e){this._rollupConsiderations.requiredForCompleted=e}},{key:"requiredForIncomplete",get:function(){return this._rollupConsiderations.requiredForIncomplete},set:function(e){this._rollupConsiderations.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=Un(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(Un(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:"createObjectiveEvaluationView",value:function(){var e=this,i=Object.assign(Object.create(t.prototype),this),n=function(e){return Object.assign(Object.create(Wn.prototype),e)};return i._primaryObjective=this._primaryObjective?n(this._primaryObjective):null,i._objectives=this._objectives.map(function(t){return t===e._primaryObjective?i._primaryObjective:n(t)}),i}},{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,a&&(this._successStatus=e?we:Oe),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),t.objective.clearAllDirty()}}var r=!0,o=!1,a=void 0;try{for(var s,l=e.objectives[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value,u=this.getObjectiveById(c.id);if(u&&!u.isPrimary){var d,v=u.objective;v.satisfiedStatus=c.satisfiedStatus,v.measureStatus=c.measureStatus,v.normalizedMeasure=c.normalizedMeasure,v.progressMeasure=c.progressMeasure,v.progressMeasureStatus=c.progressMeasureStatus,v.completionStatus=c.completionStatus,this.applyObjectiveScoreSnapshot(v,c),v.satisfiedByMeasure=null!==(d=c.satisfiedByMeasure)&&void 0!==d?d:v.satisfiedByMeasure,v.minNormalizedMeasure=void 0!==c.minNormalizedMeasure?c.minNormalizedMeasure:v.minNormalizedMeasure,v.clearAllDirty()}}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.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,objectiveInfoAvailableInCurrentParentAttempt:this._objectiveInfoAvailableInCurrentParentAttempt,progressInfoAvailableInCurrentParentAttempt:this._progressInfoAvailableInCurrentParentAttempt,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,sharedDataMaps:this.sharedDataMaps,rollupConsiderations:Vn({},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,satisfiedStatusKnown:this._primaryObjective.satisfiedStatusKnown,measureStatus:this._primaryObjective.measureStatus,normalizedMeasure:this._primaryObjective.normalizedMeasure,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: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,satisfiedStatusKnown:e.satisfiedStatusKnown,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,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,l,c,u,d,v,f,h,m,p,y,g,b,_,S,w,O,C,A,E,j,k,R,M,T,I,P,x,D,N,q,L,z,F,B;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._objectiveInfoAvailableInCurrentParentAttempt=null!==(l=e.objectiveInfoAvailableInCurrentParentAttempt)&&void 0!==l?l:this._objectiveInfoAvailableInCurrentParentAttempt,this._progressInfoAvailableInCurrentParentAttempt=null!==(c=e.progressInfoAvailableInCurrentParentAttempt)&&void 0!==c?c:this._progressInfoAvailableInCurrentParentAttempt,this._attemptCompletionAmount=null!==(u=e.attemptCompletionAmount)&&void 0!==u?u:this._attemptCompletionAmount,this._attemptAbsoluteDuration=null!==(d=e.attemptAbsoluteDuration)&&void 0!==d?d:this._attemptAbsoluteDuration,this._attemptExperiencedDuration=null!==(v=e.attemptExperiencedDuration)&&void 0!==v?v:this._attemptExperiencedDuration,this._activityAbsoluteDuration=null!==(f=e.activityAbsoluteDuration)&&void 0!==f?f:this._activityAbsoluteDuration,this._activityExperiencedDuration=null!==(h=e.activityExperiencedDuration)&&void 0!==h?h:this._activityExperiencedDuration,this._attemptAbsoluteDurationValue=null!==(m=e.attemptAbsoluteDurationValue)&&void 0!==m?m:this._attemptAbsoluteDurationValue,this._attemptExperiencedDurationValue=null!==(p=e.attemptExperiencedDurationValue)&&void 0!==p?p:this._attemptExperiencedDurationValue,this._activityAbsoluteDurationValue=null!==(y=e.activityAbsoluteDurationValue)&&void 0!==y?y:this._activityAbsoluteDurationValue,this._activityExperiencedDurationValue=null!==(g=e.activityExperiencedDurationValue)&&void 0!==g?g:this._activityExperiencedDurationValue,this._activityStartTimestampUtc=null!==(b=e.activityStartTimestampUtc)&&void 0!==b?b:this._activityStartTimestampUtc,this._attemptStartTimestampUtc=null!==(_=e.attemptStartTimestampUtc)&&void 0!==_?_:this._attemptStartTimestampUtc,this._objectiveSatisfiedStatus=null!==(S=e.objectiveSatisfiedStatus)&&void 0!==S?S:this._objectiveSatisfiedStatus,this._objectiveSatisfiedStatusKnown=null!==(w=e.objectiveSatisfiedStatusKnown)&&void 0!==w?w:this._objectiveSatisfiedStatusKnown,this._objectiveMeasureStatus=null!==(O=e.objectiveMeasureStatus)&&void 0!==O?O:this._objectiveMeasureStatus,this._objectiveNormalizedMeasure=null!==(C=e.objectiveNormalizedMeasure)&&void 0!==C?C:this._objectiveNormalizedMeasure,this._scaledPassingScore=null!==(A=e.scaledPassingScore)&&void 0!==A?A:this._scaledPassingScore,this._progressMeasure=null!==(E=e.progressMeasure)&&void 0!==E?E:this._progressMeasure,this._progressMeasureStatus=null!==(j=e.progressMeasureStatus)&&void 0!==j?j:this._progressMeasureStatus,this._location=null!==(k=e.location)&&void 0!==k?k:this._location,this._attemptAbsoluteStartTime=null!==(R=e.attemptAbsoluteStartTime)&&void 0!==R?R:this._attemptAbsoluteStartTime,this._activityAttemptActive=null!==(M=e.activityAttemptActive)&&void 0!==M?M:this._activityAttemptActive,this._isHiddenFromChoice=null!==(T=e.isHiddenFromChoice)&&void 0!==T?T:this._isHiddenFromChoice,this._isAvailable=null!==(I=e.isAvailable)&&void 0!==I?I:this._isAvailable,e.rollupConsiderations&&(this._rollupConsiderations=Vn({},e.rollupConsiderations)),this._wasSkipped=null!==(P=e.wasSkipped)&&void 0!==P?P:this._wasSkipped,this._attemptProgressStatus=null!==(x=e.attemptProgressStatus)&&void 0!==x?x:this._attemptProgressStatus,this._wasAutoCompleted=null!==(D=e.wasAutoCompleted)&&void 0!==D?D:this._wasAutoCompleted,this._wasAutoSatisfied=null!==(N=e.wasAutoSatisfied)&&void 0!==N?N:this._wasAutoSatisfied,this._completedByMeasure=null!==(q=e.completedByMeasure)&&void 0!==q?q:this._completedByMeasure,this._minProgressMeasure=null!==(L=e.minProgressMeasure)&&void 0!==L?L:this._minProgressMeasure,this._progressWeight=null!==(z=e.progressWeight)&&void 0!==z?z:this._progressWeight,this._attemptCompletionAmountStatus=null!==(F=e.attemptCompletionAmountStatus)&&void 0!==F?F:this._attemptCompletionAmountStatus,this._isNewAttempt=null!==(B=e.isNewAttempt)&&void 0!==B?B:this._isNewAttempt,void 0!==e.selectionCountStatus&&(this._sequencingControls.selectionCountStatus=e.selectionCountStatus),void 0!==e.reorderChildren&&(this._sequencingControls.reorderChildren=e.reorderChildren),e.processedChildren){var V=new Map(this._children.map(function(e){return[e.id,e]}));this._processedChildren=e.processedChildren.map(function(id){return V.get(id)}).filter(function(e){return void 0!==e})}else this._processedChildren=null;if(e.primaryObjective&&this._primaryObjective){var H,U,G,K,Y,W,J,$,X,Q,Z,ee=this._primaryObjective,te=e.primaryObjective;ee.satisfiedStatus=null!==(H=te.satisfiedStatus)&&void 0!==H?H:ee.satisfiedStatus,ee.satisfiedStatusKnown=null!==(U=te.satisfiedStatusKnown)&&void 0!==U?U:ee.satisfiedStatusKnown,ee.measureStatus=null!==(G=te.measureStatus)&&void 0!==G?G:ee.measureStatus,ee.normalizedMeasure=null!==(K=te.normalizedMeasure)&&void 0!==K?K:ee.normalizedMeasure,ee.progressMeasure=null!==(Y=te.progressMeasure)&&void 0!==Y?Y:ee.progressMeasure,ee.progressMeasureStatus=null!==(W=te.progressMeasureStatus)&&void 0!==W?W:ee.progressMeasureStatus,ee.completionStatus=null!==(J=te.completionStatus)&&void 0!==J?J:ee.completionStatus,ee.progressStatus=null!==($=te.progressStatus)&&void 0!==$?$:ee.progressStatus,void 0!==te.rawScore&&(ee.rawScore=te.rawScore,ee.rawScoreKnown=null!==(X=te.rawScoreKnown)&&void 0!==X?X:""!==te.rawScore),void 0!==te.minScore&&(ee.minScore=te.minScore,ee.minScoreKnown=null!==(Q=te.minScoreKnown)&&void 0!==Q?Q:""!==te.minScore),void 0!==te.maxScore&&(ee.maxScore=te.maxScore,ee.maxScoreKnown=null!==(Z=te.maxScoreKnown)&&void 0!==Z?Z:""!==te.maxScore),ee.clearAllDirty()}if(e.objectives){var ie=!0,ne=!1,re=void 0;try{for(var oe,ae,se=function(){var e,t,i,n,r,o,a,s,l,c,u,d=ae.value,v=oe._objectives.find(function(e){return e.id===d.id});v&&(v.satisfiedStatus=null!==(e=d.satisfiedStatus)&&void 0!==e?e:v.satisfiedStatus,v.satisfiedStatusKnown=null!==(t=d.satisfiedStatusKnown)&&void 0!==t?t:v.satisfiedStatusKnown,v.measureStatus=null!==(i=d.measureStatus)&&void 0!==i?i:v.measureStatus,v.normalizedMeasure=null!==(n=d.normalizedMeasure)&&void 0!==n?n:v.normalizedMeasure,v.progressMeasure=null!==(r=d.progressMeasure)&&void 0!==r?r:v.progressMeasure,v.progressMeasureStatus=null!==(o=d.progressMeasureStatus)&&void 0!==o?o:v.progressMeasureStatus,v.completionStatus=null!==(a=d.completionStatus)&&void 0!==a?a:v.completionStatus,v.progressStatus=null!==(s=d.progressStatus)&&void 0!==s?s:v.progressStatus,void 0!==d.rawScore&&(v.rawScore=d.rawScore,v.rawScoreKnown=null!==(l=d.rawScoreKnown)&&void 0!==l?l:""!==d.rawScore),void 0!==d.minScore&&(v.minScore=d.minScore,v.minScoreKnown=null!==(c=d.minScoreKnown)&&void 0!==c?c:""!==d.minScore),void 0!==d.maxScore&&(v.maxScore=d.maxScore,v.maxScoreKnown=null!==(u=d.maxScoreKnown)&&void 0!==u?u:""!==d.maxScore),v.clearAllDirty())},le=e.objectives[Symbol.iterator]();!(ie=(ae=le.next()).done);ie=!0)oe=this,se()}catch(e){ne=!0,re=e}finally{try{ie||null==le.return||le.return()}finally{if(ne)throw re}}}if(e.children&&Array.isArray(e.children)){var ce,ue=function(t){var i=e.children[t],n=ce._children.find(function(e){return e.id===i.id});n&&n.restoreSuspensionState(i)};this.setChildOrder(e.children.map(function(e){return e.id}));for(var de=0;e.children.length>de&&this._children.length>de;de++)ce=this,ue(de)}}}},{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,objectiveInfoAvailableInCurrentParentAttempt:this._objectiveInfoAvailableInCurrentParentAttempt,progressInfoAvailableInCurrentParentAttempt:this._progressInfoAvailableInCurrentParentAttempt,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:Vn({},this._rollupConsiderations),wasSkipped:this._wasSkipped,completedByMeasure:this._completedByMeasure,minProgressMeasure:this._minProgressMeasure,progressWeight:this._progressWeight,attemptCompletionAmountStatus:this._attemptCompletionAmountStatus,hideLmsUi:Un(this._hideLmsUi),auxiliaryResources:this._auxiliaryResources.map(function(e){return Vn({},e)}),sharedDataMaps:this.sharedDataMaps,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 Vn({},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 l=a.value;if(l){var c="string"==typeof l.resourceId?l.resourceId.trim():"",u="string"==typeof l.purpose?l.purpose.trim():"";c&&!i.has(c)&&(i.add(c),t.push({resourceId:c,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:"sharedDataMaps",get:function(){return this._sharedDataMaps.map(function(e){return Vn({},e)})},set:function(e){this._sharedDataMaps=(e||[]).filter(function(e){return e&&"string"==typeof e.targetID&&e.targetID.length>0}).map(function(e){return{targetID:e.targetID,readSharedData:e.readSharedData,writeSharedData:e.writeSharedData}})}},{key:"addAuxiliaryResource",value:function(e){this.auxiliaryResources=Un(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!==je,attemptCompletionStatus:this._completionStatus===Ae}}},{key:"hideLmsUi",get:function(){return Un(this._hideLmsUi)},set:function(e){var t=new Set(ut),i=new Set,n=[],r=!0,o=!1,a=void 0;try{for(var s,l=e[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value;t.has(c)&&!i.has(c)&&(i.add(c),n.push(c))}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.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}(E);var $n=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;if("measure"===t&&!1===e.objectiveInfoAvailableInCurrentParentAttempt)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!1!==e.objectiveInfoAvailableInCurrentParentAttempt&&(!0===e.objectiveSatisfiedStatus||!1!==e.objectiveSatisfiedStatus&&e.successStatus===we)}},{key:"isChildObjectiveStatusKnownForRollup",value:function(e){return!1!==e.objectiveInfoAvailableInCurrentParentAttempt&&e.objectiveSatisfiedStatusKnown}},{key:"isChildCompletedForRollup",value:function(e){return!1!==e.progressInfoAvailableInCurrentParentAttempt&&!("completed"!==e.completionStatus&&!e.isCompleted)}},{key:"isChildCompletionStatusKnownForRollup",value:function(e){return!1!==e.progressInfoAvailableInCurrentParentAttempt&&e.completionStatus!==je}},{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 Xn=Object.defineProperty,Qn=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?Xn(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 l,c=i[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,d=!1;switch(t.action){case kn.SATISFIED:d=this.childFilter.checkChildForRollupSubprocess(u,"objective","satisfied");break;case kn.NOT_SATISFIED:d=this.childFilter.checkChildForRollupSubprocess(u,"objective","notSatisfied");break;case kn.COMPLETED:d=this.childFilter.checkChildForRollupSubprocess(u,"progress","completed");break;case kn.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==c.return||c.return()}finally{if(a)throw s}}switch(t.consideration){case Mn.ALL:return n>0&&r===n;case Mn.ANY:return r>0;case Mn.NONE:return n>0&&0===r;case Mn.AT_LEAST_COUNT:return r>=t.minimumCount;case Mn.AT_LEAST_PERCENT:return n>0&&(n>0?r/n*100:0)>=t.minimumPercent;default:return!1}}},{key:"evaluateRollupConditionsSubprocess",value:function(e,t){return 0===t.conditions.length||(t.conditionCombination===Rn.ALL?t.conditions.every(function(t){return t.evaluate(e)}):t.conditions.some(function(t){return t.evaluate(e)}))}},{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,l=n[Symbol.iterator]();!(r=(s=l.next()).done);r=!0)if(this.evaluateRollupRule(e,s.value))return!0}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.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 Zn=Object.defineProperty,er=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":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},tr=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),er(this,"childFilter"),er(this,"eventCallback"),this.childFilter=t,this.eventCallback=i||null}return t=e,i=[{key:"measureRollupProcess",value:function(e){var t=this,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.sequencingControls.tracked}),n=i.filter(function(e){return!1!==e.progressInfoAvailableInCurrentParentAttempt&&e.attemptCompletionAmountStatus});if(0!==n.length){var r=0,o=0,a=!0,s=!1,l=void 0;try{for(var c,u=i[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var d=c.value;!1!==d.progressInfoAvailableInCurrentParentAttempt&&d.attemptCompletionAmountStatus&&(r+=d.attemptCompletionAmount*d.progressWeight),o+=d.progressWeight}}catch(e){s=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw l}}o>0&&(e.attemptCompletionAmount=r/o,e.attemptCompletionAmountStatus=!0)}else e.attemptCompletionAmountStatus=!1}}},{key:"calculateComplexWeightedMeasure",value:function(e,t,i){var n,r,o=0,a=0,s=[],l=null===(n=null==i?void 0:i.enableThresholdBias)||void 0===n||n,c=!0,u=!1,d=void 0;try{for(var v,f=t[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value;if(this.childFilter.checkChildForRollupSubprocess(h,"measure")&&h.objectiveMeasureStatus&&null!==h.objectiveNormalizedMeasure){var m=this.calculateAdjustedWeight(h,h.sequencingControls.objectiveMeasureWeight,l);o+=h.objectiveNormalizedMeasure*m,a+=m,s.push({childId:h.id,measure:h.objectiveNormalizedMeasure,weight:m})}}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.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 ir=Object.defineProperty,nr=function(e,t,i){return function(e,t,i){return t in e?ir(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){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),nr(this,"childFilter"),nr(this,"ruleEvaluator"),nr(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);var n=this.objectiveRollupUsingDefault(e);null!==n&&(e.objectiveSatisfiedStatus=n,this.syncPrimaryObjectiveFromActivity(e))}},{key:"objectiveRollupUsingRules",value:function(e,t){var i=t.filter(function(e){return e.action===kn.SATISFIED}),n=t.filter(function(e){return e.action===kn.NOT_SATISFIED}),r=!0,o=!1,a=void 0;try{for(var s,l=i[Symbol.iterator]();!(r=(s=l.next()).done);r=!0)if(this.ruleEvaluator.evaluateRollupRule(e,s.value))return!0}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}var c=!0,u=!1,d=void 0;try{for(var v,f=n[Symbol.iterator]();!(c=(v=f.next()).done);c=!0)if(this.ruleEvaluator.evaluateRollupRule(e,v.value))return!1}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}return null}},{key:"objectiveRollupUsingMeasure",value:function(e){var t=e.primaryObjective;return(null==t?void 0:t.satisfiedByMeasure)&&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 null;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))});if(0===r.length)return null;var o=!1,a=!0,s=!1,l=void 0;try{for(var c,u=r[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var d=c.value;if(this.childFilter.isChildObjectiveStatusKnownForRollup(d)){if(!this.childFilter.isChildSatisfiedForRollup(d))return!1}else o=!0}}catch(e){s=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw l}}return!o||null}},{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 or=Object.defineProperty,ar=function(e,t,i){return function(e,t,i){return t in e?or(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)},sr=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),ar(this,"childFilter"),ar(this,"ruleEvaluator"),ar(this,"objectiveProcessor"),ar(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===kn.COMPLETED}),r=i.rules.filter(function(e){return e.action===kn.INCOMPLETE}),o=!0,a=!1,s=void 0;try{for(var l,c=n[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)if(this.ruleEvaluator.evaluateRollupRule(e,l.value))return e.completionStatus=Ae,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e)}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}var u=!0,d=!1,v=void 0;try{for(var f,h=r[Symbol.iterator]();!(u=(f=h.next()).done);u=!0)if(this.ruleEvaluator.evaluateRollupRule(e,f.value))return e.completionStatus=Ee,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e)}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}if(0>=n.length&&0>=r.length){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=Ee,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e);var p=!1,y=!0,g=!1,b=void 0;try{for(var _,S=m[Symbol.iterator]();!(y=(_=S.next()).done);y=!0){var w=_.value;if(this.childFilter.isChildCompletionStatusKnownForRollup(w)){if(!this.childFilter.isChildCompletedForRollup(w))return e.completionStatus=Ee,void this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e)}else p=!0}}catch(e){g=!0,b=e}finally{try{y||null==S.return||S.return()}finally{if(g)throw b}}p||(e.completionStatus=Ae,this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e))}}}},{key:"activityProgressRollupUsingMeasure",value:function(e){return!!e.completedByMeasure&&(e.attemptCompletionAmountStatus?(e.completionStatus=e.minProgressMeasure>e.attemptCompletionAmount?Ee:Ae,this.objectiveProcessor.syncPrimaryObjectiveFromActivity(e),!0):(e.completionStatus=je,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 lr=Object.defineProperty,cr=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?lr(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,l=!0,u=!1,v=void 0;try{for(var f,h=t[Symbol.iterator]();!(l=(f=h.next()).done);l=!0){var m=f.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,v=e}finally{try{l||null==h.return||h.return()}finally{if(u)throw v}}if(null!==i){var g;if(e.activityStartTimestampUtc=i,!e.attemptStartTimestampUtc&&n&&(e.attemptStartTimestampUtc=n),e.activityEndedDate=r,r&&e.activityStartTimestampUtc){var b=new Date(e.activityStartTimestampUtc),_=r.getTime()-b.getTime();e.activityAbsoluteDurationValue=c(Math.max(0,_/1e3))}if(o&&e.attemptStartTimestampUtc){var S=new Date(e.attemptStartTimestampUtc),w=o.getTime()-S.getTime();e.attemptAbsoluteDurationValue=c(Math.max(0,w/1e3))}e.activityExperiencedDurationValue=c(a),e.attemptExperiencedDurationValue=c(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 ur=Object.defineProperty,dr=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)},vr=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),dr(this,"measureProcessor"),dr(this,"objectiveProcessor"),dr(this,"progressProcessor"),dr(this,"eventCallback"),dr(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,l;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 c=new Map,u=!0,d=!1,v=void 0;try{for(var f,h=t[Symbol.iterator]();!(u=(f=h.next()).done);u=!0)this.analyzeCrossClusterDependencies(f.value,c)}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}var m=this.resolveDependencyOrder(c),p=!0,y=!1,g=void 0;try{for(var b,_,S=function(){var e=_.value,i=t.find(function(t){return t.id===e});i&&b.processClusterRollup(i,a)},w=m[Symbol.iterator]();!(p=(_=w.next()).done);p=!0)b=this,S()}catch(e){y=!0,g=e}finally{try{p||null==w.return||w.return()}finally{if(y)throw g}}null===(l=this.eventCallback)||void 0===l||l.call(this,"cross_cluster_processing_completed",{activityId:e.id,processedClusters:m.length,dependencyMap:Array.from(c.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)||[],l=!0,c=!1,u=void 0;try{for(var d,v=s[Symbol.iterator]();!(l=(d=v.next()).done);l=!0)r(d.value)}catch(e){c=!0,u=e}finally{try{l||null==v.return||v.return()}finally{if(c)throw u}}n.delete(id),i.push(id)}},o=!0,a=!1,s=void 0;try{for(var l,c=Array.from(e.keys())[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)r(l.value)}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.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);this.measureProcessor.completionMeasureRollupProcess(e),this.objectiveProcessor.objectiveRollupProcess(e),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 fr(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 hr(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var mr=Object.defineProperty,pr=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?mr(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,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 l,c=r[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)this.syncGlobalObjectivesWritePhase(l.value,t)}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}var u=[],d=!0,v=!1,f=void 0;try{for(var h,m=r[Symbol.iterator]();!(d=(h=m.next()).done);d=!0){var p=h.value;this.syncGlobalObjectivesReadPhase(p,t)&&u.push(p)}}catch(e){v=!0,f=e}finally{try{d||null==m.return||m.return()}finally{if(v)throw f}}return null===(n=this.eventCallback)||void 0===n||n.call(this,"global_objective_processing_completed",{activityId:e.id,processedObjectives:t.size,changedActivityCount:u.length}),u}catch(t){var y;return null===(y=this.eventCallback)||void 0===y||y.call(this,"global_objective_processing_error",{activityId:e.id,error:hr(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(!e.isActive&&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,l=new Set,c=!0,u=!1,d=void 0;try{for(var v,f=s.mapInfo[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value,m=this.ensureGlobalObjectiveEntry(t,h.targetObjectiveID||s.id,s);if(h.writeSatisfiedStatus&&this.hasKnownSatisfiedStatus(s)&&s.isDirty("satisfiedStatus")&&(m.satisfiedStatus=s.satisfiedStatus,m.satisfiedStatusKnown=!0,l.add("satisfiedStatus")),h.writeNormalizedMeasure&&s.measureStatus&&s.isDirty("normalizedMeasure")&&(m.normalizedMeasure=s.normalizedMeasure,m.normalizedMeasureKnown=!0,l.add("normalizedMeasure"),h.writeSatisfiedStatus&&s.satisfiedByMeasure)){var p,y=null!==(p=s.minNormalizedMeasure)&&void 0!==p?p:1;m.satisfiedStatus=s.normalizedMeasure>=y,m.satisfiedStatusKnown=!0,l.add("satisfiedStatus")}h.writeCompletionStatus&&s.isDirty("completionStatus")&&(m.completionStatus=s.completionStatus,m.completionStatusKnown=s.completionStatus!==je,l.add("completionStatus")),h.writeRawScore&&s.rawScoreKnown&&s.isDirty("rawScore")&&(m.rawScore=s.rawScore,m.rawScoreKnown=!0,l.add("rawScore")),h.writeMinScore&&s.minScoreKnown&&s.isDirty("minScore")&&(m.minScore=s.minScore,m.minScoreKnown=!0,l.add("minScore")),h.writeMaxScore&&s.maxScoreKnown&&s.isDirty("maxScore")&&(m.maxScore=s.maxScore,m.maxScoreKnown=!0,l.add("maxScore")),h.writeProgressMeasure&&s.progressMeasureStatus&&s.isDirty("progressMeasure")&&(m.progressMeasure=s.progressMeasure,m.progressMeasureKnown=!0,l.add("progressMeasure")),h.updateAttemptData&&this.updateActivityAttemptData(e,m,s)}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}var g=!0,b=!1,_=void 0;try{for(var S,w=l[Symbol.iterator]();!(g=(S=w.next()).done);g=!0)s.clearDirty(S.value)}catch(e){b=!0,_=e}finally{try{g||null==w.return||w.return()}finally{if(b)throw _}}}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}}}},{key:"syncTerminatedActivityWritePhase",value:function(e,t){var i={satisfiedStatus:new Set,normalizedMeasure:new Set};if(!this.canWriteGlobalObjectives(e))return i;var n=!0,r=!1,o=void 0;try{for(var a,s=e.getAllObjectives()[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value,c=!0,u=!1,d=void 0;try{for(var v,f=l.mapInfo[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value,m=h.targetObjectiveID||l.id,p=this.ensureGlobalObjectiveEntry(t,m,l);h.writeSatisfiedStatus&&(i.satisfiedStatus.add(m),this.hasKnownSatisfiedStatus(l)?(p.satisfiedStatus=l.satisfiedStatus,p.satisfiedStatusKnown=!0):(p.satisfiedStatus=!1,p.satisfiedStatusKnown=!1),l.clearDirty("satisfiedStatus")),h.writeNormalizedMeasure&&(i.normalizedMeasure.add(m),l.measureStatus?(p.normalizedMeasure=l.normalizedMeasure,p.normalizedMeasureKnown=!0):(p.normalizedMeasure=0,p.normalizedMeasureKnown=!1),l.clearDirty("normalizedMeasure"))}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.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}}return i}},{key:"syncGlobalObjectivesReadPhase",value:function(e,t){return this.syncGlobalObjectivesReadPhaseInternal(e,t)}},{key:"syncGlobalObjectivesDeliveryReadPhase",value:function(e,t){return this.syncGlobalObjectivesReadPhaseInternal(e,t,void 0,!0)}},{key:"syncFreshlyWrittenGlobalObjectivesReadPhase",value:function(e,t,i){return this.syncGlobalObjectivesReadPhaseInternal(e,t,i)}},{key:"syncGlobalObjectivesReadPhaseInternal",value:function(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=t.captureRollupStatus(),a=t.objectiveSatisfiedStatusKnown,objectives=t.getAllObjectives(),s=!0,l=!1,c=void 0;try{for(var u,d=objectives[Symbol.iterator]();!(s=(u=d.next()).done);s=!0){var v=u.value,f=!0,h=!1,m=void 0;try{for(var p,y=v.mapInfo[Symbol.iterator]();!(f=(p=y.next()).done);f=!0){var g,b,_,S=p.value,w=S.targetObjectiveID||v.id,O=null!==(g=null==n?void 0:n.satisfiedStatus.has(w))&&void 0!==g&&g,C=null!==(b=null==n?void 0:n.normalizedMeasure.has(w))&&void 0!==b&&b;if(!n||O||C){var A=i.get(w);if(A){var E=v.isPrimary,j=e.getGlobalObjectiveReadState(t,v,S,A,n?{restrictToFreshWrites:!0,allowSatisfiedStatus:O,allowNormalizedMeasure:C}:r?{restrictToFreshWrites:!1,allowSatisfiedStatus:!0,allowNormalizedMeasure:!0}:void 0);this.applyGlobalObjectiveReadState(v,j),E&&v.applyToActivity(t),null===(_=this.eventCallback)||void 0===_||_.call(this,"objective_synchronized",{activityId:t.id,objectiveId:v.id,globalState:A,synchronizationTime:(new Date).toISOString()})}}}}catch(e){h=!0,m=e}finally{try{f||null==y.return||y.return()}finally{if(h)throw m}}}}catch(e){l=!0,c=e}finally{try{s||null==d.return||d.return()}finally{if(l)throw c}}return!Jn.compareRollupStatus(o,t.captureRollupStatus())||a!==t.objectiveSatisfiedStatusKnown}},{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,l=!0,c=!1,u=void 0;try{for(var d,v=s.mapInfo[Symbol.iterator]();!(l=(d=v.next()).done);l=!0){var f=d.value,h=this.ensureGlobalObjectiveEntry(t,f.targetObjectiveID||s.id,s);this.syncObjectiveState(e,s,f,h)}}catch(e){c=!0,u=e}finally{try{l||null==v.return||v.return()}finally{if(c)throw u}}}}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 l,c=null!==(l=i.minNormalizedMeasure)&&void 0!==l?l:1;r.satisfiedStatus=i.normalizedMeasure>=c,r.satisfiedStatusKnown=!0}n.writeCompletionStatus&&i.completionStatus!==je&&(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 u;null===(u=this.eventCallback)||void 0===u||u.call(this,"objective_sync_error",{activityId:t.id,objectiveId:i.id,error:hr(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:je,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.satisfiedByMeasure?e.measureStatus: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!==je&&e.completionStatus!==Ee||(e.completionStatus=Ae),"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:hr(t,Error)?t.message:t+"",timestamp:(new Date).toISOString()})}}}],n=[{key:"getGlobalObjectiveReadState",value:function(e,t,i,n,r){var o={},a=e.isActive&&i.writeNormalizedMeasure&&!(null==r?void 0:r.allowNormalizedMeasure);if(!i.readSatisfiedStatus||(null==r?void 0:r.restrictToFreshWrites)&&!r.allowSatisfiedStatus||e.isActive&&i.writeSatisfiedStatus&&!(null==r?void 0:r.allowSatisfiedStatus)||t.satisfiedByMeasure||(o.satisfiedStatusKnown=n.satisfiedStatusKnown,n.satisfiedStatusKnown&&(o.satisfiedStatus=n.satisfiedStatus)),i.readNormalizedMeasure&&(!(null==r?void 0:r.restrictToFreshWrites)||r.allowNormalizedMeasure)&&!a&&(o.normalizedMeasureKnown=n.normalizedMeasureKnown,n.normalizedMeasureKnown&&(o.normalizedMeasure=n.normalizedMeasure),t.satisfiedByMeasure&&(o.satisfiedStatusKnown=n.normalizedMeasureKnown,n.normalizedMeasureKnown))){var s,l=null!==(s=t.minNormalizedMeasure)&&void 0!==s?s:1;o.satisfiedStatus=n.normalizedMeasure>=l}return!(null==r?void 0:r.restrictToFreshWrites)&&i.readCompletionStatus&&n.completionStatusKnown&&(o.completionStatus=n.completionStatus),!(null==r?void 0:r.restrictToFreshWrites)&&i.readProgressMeasure&&n.progressMeasureKnown&&(o.progressMeasure=n.progressMeasure),!(null==r?void 0:r.restrictToFreshWrites)&&i.readRawScore&&n.rawScoreKnown&&(o.rawScore=n.rawScore),!(null==r?void 0:r.restrictToFreshWrites)&&i.readMinScore&&n.minScoreKnown&&(o.minScore=n.minScore),!(null==r?void 0:r.restrictToFreshWrites)&&i.readMaxScore&&n.maxScoreKnown&&(o.maxScore=n.maxScore),o}}],i&&fr(t.prototype,i),n&&fr(t,n),e}();function yr(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 gr=Object.defineProperty,br=function(e,t,i){return function(e,t,i){return t in e?gr(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,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),br(this,"rollupStateLog",[]),br(this,"childFilter"),br(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,n=this,r=e.id;e.objectiveMeasureStatus&&null===e.objectiveNormalizedMeasure&&t.push("Activity ".concat(r,": measure status true but normalized measure is null")),!0===(null===(i=e.primaryObjective)||void 0===i?void 0:i.satisfiedByMeasure)&&e.objectiveMeasureStatus&&null!==e.scaledPassingScore&&"unknown"!==e.successStatus&&e.objectiveSatisfiedStatus!==e.objectiveNormalizedMeasure>=e.scaledPassingScore&&t.push("Activity ".concat(r,": satisfaction status inconsistent with measure"));var o=e.sequencingControls,a=e.getAvailableChildren();if(a.length>0&&o.rollupObjectiveSatisfied){var s=a.filter(function(e){return n.childFilter.checkChildForRollupSubprocess(e,"objective","satisfied")&&n.childFilter.isChildSatisfiedForRollup(e)}),l=a.filter(function(e){return n.childFilter.checkChildForRollupSubprocess(e,"objective","notSatisfied")&&!n.childFilter.isChildSatisfiedForRollup(e)});s.length>0&&0===l.length&&!1===e.objectiveSatisfiedStatus&&0===e.rollupRules.rules.length&&t.push("Activity ".concat(r,": all children satisfied but parent is not satisfied (no rollup rules to override)"))}if(a.length>0&&o.rollupProgressCompletion){var c=a.filter(function(e){return n.childFilter.checkChildForRollupSubprocess(e,"progress","completed")&&n.childFilter.isChildCompletedForRollup(e)}),u=a.filter(function(e){return n.childFilter.checkChildForRollupSubprocess(e,"progress","incomplete")&&!n.childFilter.isChildCompletedForRollup(e)});c.length>0&&0===u.length&&"completed"!==e.completionStatus&&0===e.rollupRules.rules.length&&t.push("Activity ".concat(r,": all children completed but parent is incomplete (no rollup rules to override)"))}var d=!0,v=!1,f=void 0;try{for(var h,m=a[Symbol.iterator]();!(d=(h=m.next()).done);d=!0)this.validateActivityRollupState(h.value,t)}catch(e){v=!0,f=e}finally{try{d||null==m.return||m.return()}finally{if(v)throw f}}this.rollupStateLog.push({activity:r,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 yr(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 yr(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)?yr(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 Sr=Object.defineProperty,wr=function(e,t,i){return function(e,t,i){return t in e?Sr(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){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),wr(this,"childContributionControlsApplyToParent",!0),wr(this,"childFilter"),wr(this,"ruleEvaluator"),wr(this,"measureProcessor"),wr(this,"objectiveProcessor"),wr(this,"progressProcessor"),wr(this,"durationProcessor"),wr(this,"globalObjectiveSynchronizer"),wr(this,"stateValidator"),wr(this,"crossClusterProcessor"),wr(this,"eventCallback"),this.eventCallback=t||null,this.childFilter=new $n,this.ruleEvaluator=new Qn(this.childFilter),this.measureProcessor=new tr(this.childFilter,t),this.objectiveProcessor=new rr(this.childFilter,this.ruleEvaluator,t),this.progressProcessor=new sr(this.childFilter,this.ruleEvaluator,this.objectiveProcessor,t),this.durationProcessor=new cr(t),this.globalObjectiveSynchronizer=new pr(t),this.stateValidator=new _r(this.childFilter,t),this.crossClusterProcessor=new vr(this.measureProcessor,this.objectiveProcessor,this.progressProcessor,t)}return t=e,(i=[{key:"overallRollupProcess",value:function(e,t){for(var i=[],n=e.parent,r=!1,o=!0;n;){if(n.children.length>0&&this.durationProcessor.durationRollupProcess(n),!r){var a=n.captureRollupStatus();if(n.children.length>0){var s=this.measureProcessor.measureRollupProcess(n);this.measureProcessor.completionMeasureRollupProcess(n),s.length>1&&this.crossClusterProcessor.processCrossClusterDependencies(n,s)}this.objectiveProcessor.objectiveRollupProcess(n),this.progressProcessor.activityProgressRollupProcess(n),t&&this.globalObjectiveSynchronizer.syncGlobalObjectivesReadPhase(n,t);var l,c=n.captureRollupStatus();o||Jn.compareRollupStatus(a,c)&&(null===(l=this.eventCallback)||void 0===l||l.call(this,"rollup_optimization_activated",{activityId:n.id,depth:i.length}),r=!0),!o&&Jn.compareRollupStatus(a,c)||i.push(n)}n=n.parent,o=!1}return i}},{key:"validateRollupStateConsistency",value:function(e){return this.stateValidator.validateRollupStateConsistency(e)}},{key:"processGlobalObjectiveMapping",value:function(e,t){var i=this.globalObjectiveSynchronizer.processGlobalObjectiveMapping(e,t),n=new Set,r=function(e){for(var t=0,i=e.parent;i;)t+=1,i=i.parent;return t};i.sort(function(e,t){return r(t)-r(e)});var o=!0,a=!1,s=void 0;try{for(var l,c=i[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value;if(u.sequencingControls.tracked){this.globalObjectiveSynchronizer.syncGlobalObjectivesReadPhase(u,t);var d=u.parent;d&&!n.has(d)&&(this.overallRollupProcess(u,t),n.add(d))}}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}}},{key:"syncTerminatedActivityObjectives",value:function(e,t){return this.globalObjectiveSynchronizer.syncTerminatedActivityWritePhase(e,t)}},{key:"syncActivityObjectivesFromGlobals",value:function(e,t){return this.globalObjectiveSynchronizer.syncGlobalObjectivesDeliveryReadPhase(e,t)}},{key:"syncFreshlyWrittenObjectivesToActiveAncestor",value:function(e,t,i){return this.globalObjectiveSynchronizer.syncFreshlyWrittenGlobalObjectivesReadPhase(e,t,i)}},{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 Cr(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ar(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){Cr(e,t,i[t])})}return e}var Er=Object.defineProperty,jr=function(e,t,i){return function(e,t,i){return t in e?Er(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(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),jr(this,"activityTree",t),jr(this,"globalObjectives",i),jr(this,"synchronizer",new pr),jr(this,"treeQueries"),this.treeQueries=new It(t)}return t=e,i=[{key:"project",value:function(e){var t=this.activityTree.currentActivity,i=this.treeQueries.findCommonAncestor(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:e);if(!t||t===i)return e;for(var n=[],r=t.parent;r&&r!==i;)r.isActive&&n.push(r),r=r.parent;if(0===n.length)return e;var o=new Map(this.globalObjectives),a=!0,s=!1,l=void 0;try{for(var c,u=n[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var d=c.value,v=!0,f=!1,h=void 0;try{for(var m,p=d.getAllObjectives()[Symbol.iterator]();!(v=(m=p.next()).done);v=!0){var y=m.value,g=!0,b=!1,_=void 0;try{for(var S,w=y.mapInfo[Symbol.iterator]();!(g=(S=w.next()).done);g=!0){var O=S.value.targetObjectiveID||y.id,entry=o.get(O);entry&&o.set(O,Ar({},entry))}}catch(e){b=!0,_=e}finally{try{g||null==w.return||w.return()}finally{if(b)throw _}}}}catch(e){f=!0,h=e}finally{try{v||null==p.return||p.return()}finally{if(f)throw h}}this.synchronizer.syncTerminatedActivityWritePhase(d.createObjectiveEvaluationView(),o)}}catch(e){s=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw l}}var C=e.createObjectiveEvaluationView();return this.synchronizer.syncGlobalObjectivesReadPhase(C,o),C}}],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 Rr(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?Ee:Ae}return je}}return n||je}var Mr=Object.defineProperty,Tr=[we,Oe,Ce];function Ir(e){return e===Ae?Ae:e===Ee||"not attempted"===e?Ee:e===je?je:null}function Pr(e){return e&&Tr.includes(e)?e:null}var xr=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?Mr(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,n=!1;if(t.progress_measure&&""!==t.progress_measure){var r=parseFloat(t.progress_measure);isNaN(r)||(n=!0,e.progressMeasure=r,e.progressMeasureStatus=!0,e.attemptCompletionAmount=r,e.attemptCompletionAmountStatus=!0,e.primaryObjective&&(e.primaryObjective.progressMeasure=r,e.primaryObjective.progressMeasureStatus=!0))}if(n||(e.attemptCompletionAmountStatus=!1),e.completedByMeasure){var o=Rr({completionThreshold:e.minProgressMeasure,progressMeasure:t.progress_measure,storedCompletionStatus:je});e.completionStatus=o,e.attemptProgressStatus=o!==je}else{var a=Ir(t.completion_status);a&&a!==je&&(e.completionStatus=a,e.attemptProgressStatus=!0)}var s,l,c=!1,u=!1,d=!1,v=0,f=!0===(null===(i=e.primaryObjective)||void 0===i?void 0:i.satisfiedByMeasure),h=Pr(t.success_status);if(!f&&h&&h!==Ce&&(c=!0,e.objectiveSatisfiedStatus=u=h===we,e.objectiveSatisfiedStatusKnown=!0,e.successStatus=h),t.score){var m;null===(m=e.primaryObjective)||void 0===m||m.initializeScoreFromCMI(this.getObjectiveScoreState(t.score));var p=this.normalizeScore(t.score);null!==p&&(d=!0,e.objectiveNormalizedMeasure=v=p,e.objectiveMeasureStatus=!0)}f&&d&&(u=v>=(null!==(s=null===(l=e.primaryObjective)||void 0===l?void 0:l.minNormalizedMeasure)&&void 0!==s?s:1),c=!0,e.objectiveSatisfiedStatus=u,e.objectiveSatisfiedStatusKnown=!0,e.successStatus=u?we:Oe),e.primaryObjective&&(c||d)&&(e.primaryObjective.initializeFromCMI(c?u:e.primaryObjective.satisfiedStatus,d?v:e.primaryObjective.normalizedMeasure,d),c&&(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 l=e.getObjectiveById(s.id);if(l){var c=l.objective,u=l.isPrimary,d=!1,v=!1,f=!1,h=!1,m=0,p=!1,y=!1,g=Ir(t.completion_status),b=!0===t.completion_status_was_set||void 0===t.completion_status_was_set&&null!==g&&g!==je,_=Pr(t.success_status),S=!0===t.success_status_was_set||void 0===t.success_status_was_set&&null!==_&&_!==Ce,w=!0===t.score_was_set||void 0===t.score_was_set&&void 0!==t.score&&null!==this.normalizeScore(t.score),O=Pr(s.success_status);c.satisfiedByMeasure||!O||O===Ce||!1===s.success_status_was_set&&u&&S?c.satisfiedByMeasure||O!==Ce||!0!==s.success_status_was_set||(c.initializeUnknownSatisfiedStatusFromCMI(),v=!0):(f=O===we,d=!0,c.progressStatus=!0);var C,A=Ir(s.completion_status);if(A===je?!0===s.completion_status_was_set&&(c.initializeUnknownCompletionStatusFromCMI(),p=!0):null===A||!1===s.completion_status_was_set&&u&&b||(c.completionStatus=A,p=!0),s.score&&(!1!==s.score_was_set||!u||!w)){c.initializeScoreFromCMI(this.getObjectiveScoreState(s.score));var E=this.normalizeScore(s.score);null!==E&&(m=E,h=!0)}if(c.satisfiedByMeasure&&h&&(f=m>=(null!==(C=c.minNormalizedMeasure)&&void 0!==C?C:1),d=!0,c.progressStatus=!0),(d||h)&&(c.initializeFromCMI(d?f:c.satisfiedStatus,h?m:c.normalizedMeasure,h),d&&(c.satisfiedStatusKnown=!0)),s.progress_measure&&""!==s.progress_measure){var j=parseFloat(s.progress_measure);isNaN(j)||(c.progressMeasure=j,c.progressMeasureStatus=!0,y=!0)}u&&(d||v||h||p||y)&&(c.applyToActivity(e),d?e.successStatus=f?we:Oe:v&&(e.successStatus=Ce),p&&(e.attemptProgressStatus=c.completionStatus!==je),y&&(e.attemptCompletionAmount=c.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}();function Dr(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Nr(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){Dr(e,t,i[t])})}return e}function qr(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 Lr=Object.defineProperty,zr=function(e,t,i){return function(e,t,i){return t in e?Lr(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)},Fr=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),zr(this,"activityTree"),zr(this,"sequencingProcess"),zr(this,"rollupProcess"),zr(this,"globalObjectiveMap"),zr(this,"eventCallback"),zr(this,"getCMIData"),zr(this,"is4thEdition"),zr(this,"invalidateCacheCallback",null),zr(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 xr({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===zt.EXIT||request===zt.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("suspend"===t&&request===zt.EXIT&&(i.isSuspended=!0),request){case zt.EXIT:return this.handleExit(i,e);case zt.EXIT_ALL:return this.handleExitAll(i);case zt.ABANDON:return this.handleAbandon(i);case zt.ABANDON_ALL:return this.handleAbandonAll(i);case zt.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:zt.EXIT,sequencingRequest:null,exception:o.exception,valid:!1};do{if(n=!1,(r=this.evaluatePostConditions(this.activityTree.currentActivity||e)).terminationRequest===zt.EXIT_ALL){this.fireEvent("onPostConditionExitAll",{activity:(this.activityTree.currentActivity||e).id});var a=this.handleExitAll(this.activityTree.root);return r.sequencingRequest===zt.RETRY?qr(Nr({},a),{sequencingRequest:zt.RETRY_ALL}):a}if(r.terminationRequest===zt.EXIT_PARENT){var s=this.activityTree.currentActivity||e;if(!s.parent)return{terminationRequest:zt.EXIT_PARENT,sequencingRequest:null,exception:"TB.2.3-4",valid:!1};this.activityTree.currentActivity=s.parent,this.endAttempt(this.activityTree.currentActivity),n=!0,this.fireEvent("onPostConditionExitParent",{fromActivity:s.id,toActivity:this.activityTree.currentActivity.id})}if(!n&&(this.activityTree.currentActivity||e)===this.activityTree.root&&r.sequencingRequest!==zt.RETRY)return{terminationRequest:zt.EXIT,sequencingRequest:zt.EXIT,exception:null,valid:!0}}while(n);return{terminationRequest:zt.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:zt.EXIT_ALL,sequencingRequest:zt.EXIT,exception:null,valid:!0}}},{key:"handleAbandon",value:function(e){return e.isActive=!1,{terminationRequest:zt.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:zt.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:zt.ABANDON_ALL,sequencingRequest:null,exception:null,valid:!0}}},{key:"handleSuspendAll",value:function(e){var t=this.processSuspendAllRequest(e);return t.valid?{terminationRequest:zt.SUSPEND_ALL,sequencingRequest:zt.EXIT,exception:null,valid:!0}:t}},{key:"processSuspendAllRequest",value:function(e){var t,i=this.activityTree.root;if(!e||!i)return this.fireEvent("onSuspendError",{exception:"TB.2.3-1",message:"No current activity to suspend",activity:null==e?void 0:e.id}),{terminationRequest:zt.SUSPEND_ALL,sequencingRequest:null,exception:"TB.2.3-1",valid:!1};if(e===i&&!e.isActive&&!e.isSuspended)return this.fireEvent("onSuspendError",{exception:"TB.2.3-3",message:"Nothing to suspend (root activity)",activity:e.id}),{terminationRequest:zt.SUSPEND_ALL,sequencingRequest:null,exception:"TB.2.3-3",valid:!1};e.isActive&&0===e.children.length&&(null===(t=this.getCMIData)||void 0===t?void 0:t.call(this))&&(this._rteDataTransferService.transferRteData(e),this.rollupProcess.syncTerminatedActivityObjectives(e,this.globalObjectiveMap)),(e.isActive||e.isSuspended)&&this.rollupProcess.overallRollupProcess(e,this.globalObjectiveMap),this.activityTree.suspendedActivity=e;for(var n=e,r=[],o=n;null!==o;)r.push(o),o=o.parent;if(0===r.length)return this.fireEvent("onSuspendError",{exception:"TB.2.3-5",message:"Activity path is empty",activity:null==n?void 0:n.id}),{terminationRequest:zt.SUSPEND_ALL,sequencingRequest:null,exception:"TB.2.3-5",valid:!1};var a=!0,s=!1,l=void 0;try{for(var c,u=r[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var d=c.value;d.isActive=!1,d.isSuspended=!0}}catch(e){s=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw l}}return this.activityTree.currentActivity=i,i.isActive=!1,this.fireEvent("onActivitySuspended",{activity:null==n?void 0:n.id,suspendedPath:r.map(function(e){return e.id}),pathLength:r.length,timestamp:(new Date).toISOString()}),{terminationRequest:zt.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 l=a.value;if(l.evaluate(e)){if(l.action===At.EXIT)return{action:"EXIT",recursionDepth:t};if(l.action===At.EXIT_PARENT)return{action:"EXIT_PARENT",recursionDepth:t};if(l.action===At.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 l=a.value,c=this.exitActionRulesSubprocess(l);if("EXIT_ALL"===c)return this.fireEvent("onAncestorExitAction",{activity:l.id,action:c}),{action:"EXIT_ALL",activity:l};if("EXIT_PARENT"===c)return l.parent?(this.terminateDescendants(l.parent),this.activityTree.currentActivity=l.parent,this.endAttempt(l.parent),this.fireEvent("onAncestorExitAction",{activity:l.id,action:c,currentActivity:l.parent.id}),{action:"EXIT_PARENT",activity:l.parent}):{action:"EXIT_PARENT",activity:l,exception:"TB.2.3-4"};if("EXIT"===c)return this.terminateDescendants(l),this.activityTree.currentActivity=l,this.endAttempt(l),this.fireEvent("onAncestorExitAction",{activity:l.id,action:c}),{action:"EXIT",activity:l}}}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===At.EXIT)return"EXIT";if(s.action===At.EXIT_PARENT)return"EXIT_PARENT";if(s.action===At.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){var t=0===e.children.length&&this.contentCommunicatedObjectiveStatus(e);if(0===e.children.length&&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 i=e.primaryObjective;(i?i.progressStatus:e.objectiveSatisfiedStatusKnown)||t||(i&&(i.progressStatus=!0,i.satisfiedStatus=!0),e.objectiveSatisfiedStatus=!0,e.successStatus="passed",e.wasAutoSatisfied=!0,this.fireEvent("onAutoSatisfaction",{activityId:e.id,timestamp:(new Date).toISOString()}))}}else{var n=e.children.some(function(e){return e.isSuspended});e.isSuspended=n}"unknown"===e.completionStatus&&(e.completionStatus="incomplete"),"unknown"===e.successStatus&&e.objectiveSatisfiedStatus&&(e.successStatus=e.objectiveSatisfiedStatus?"passed":"failed");for(var r=this.rollupProcess.syncTerminatedActivityObjectives(e,this.globalObjectiveMap),o=e.parent;o;)o.isActive&&this.rollupProcess.syncFreshlyWrittenObjectivesToActiveAncestor(o,this.globalObjectiveMap,r),o=o.parent;for(this.rollupProcess.processGlobalObjectiveMapping(this.activityTree.root||e,this.globalObjectiveMap),this.rollupProcess.overallRollupProcess(e,this.globalObjectiveMap),o=e.parent;o;)o.isActive&&this.rollupProcess.syncFreshlyWrittenObjectivesToActiveAncestor(o,this.globalObjectiveMap,r)&&this.rollupProcess.overallRollupProcess(o,this.globalObjectiveMap),o=o.parent;this.invalidateCacheCallback&&this.invalidateCacheCallback(),this.activityTree.root&&this.rollupProcess.validateRollupStateConsistency(this.activityTree.root),oi.applySelectionAndRandomization(e,!1)}}},{key:"contentCommunicatedObjectiveStatus",value:function(e){var t,i,n,r=null===(t=this.getCMIData)||void 0===t?void 0:t.call(this);if(!r)return!1;if(!0===r.success_status_was_set)return!0;var o=null===(i=e.primaryObjective)||void 0===i?void 0:i.id;return!(!o||!(null===(n=r.objectives)||void 0===n?void 0:n.some(function(e){return e.id===o&&!0===e.success_status_was_set})))}},{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 Br(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 Vr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hr(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ur(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){Hr(e,t,i[t])})}return e}function Gr(e){return function(e){if(Array.isArray(e))return Br(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 Br(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)?Br(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 Kr=Object.defineProperty,Yr=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)},Wr=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;Vr(this,e),Yr(this,"valid"),Yr(this,"targetActivity"),Yr(this,"exception"),this.valid=t,this.targetActivity=i,this.exception=n},Jr=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;Vr(this,e),Yr(this,"activityTree"),Yr(this,"rollupProcess"),Yr(this,"globalObjectiveMap"),Yr(this,"adlNav"),Yr(this,"eventCallback"),Yr(this,"now"),Yr(this,"defaultHideLmsUi"),Yr(this,"defaultAuxiliaryResources"),Yr(this,"_deliveryInProgress",!1),Yr(this,"contentDelivered",!1),Yr(this,"endAttemptCallback",null),Yr(this,"checkActivityCallback",null),Yr(this,"invalidateCacheCallback",null),Yr(this,"updateNavigationValidityCallback",null),Yr(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)?Gr(a.defaultHideLmsUi):[],this.defaultAuxiliaryResources=(null==a?void 0:a.defaultAuxiliaryResources)?a.defaultAuxiliaryResources.map(function(e){return Ur({},e)}):[]}return t=e,i=[{key:"setEndAttemptCallback",value:function(e){this.endAttemptCallback=e}},{key:"terminateDescendentAttemptsProcess",value:function(e,t){if(e!==t)for(var i=e.parent;i&&i!==t;){var n=i.parent;i.isActive&&(this.endAttemptCallback?this.endAttemptCallback(i):i.isActive=!1),i=n}}},{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 Wr(!1,null,"DB.1.1-1");var t=this.getActivityPath(e,!0);if(0===t.length)return new Wr(!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,e))return new Wr(!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 Wr(!0,e)}},{key:"contentDeliveryEnvironmentProcess",value:function(e){this._deliveryInProgress=!0;try{var t,i=this.activityTree.currentActivity;if(i){var n=new It(this.activityTree).findCommonAncestor(i,e);this.terminateDescendentAttemptsProcess(i,n)}null===(t=this.rollupProcess)||void 0===t||t.processGlobalObjectiveMapping(e,this.globalObjectiveMap);var r=e.isSuspended,o=this.getActivityPath(e,!0),a=new Set(o.filter(function(e){return e.isSuspended}));e.deliveryWasResumed=r,this.activityTree.suspendedActivity&&this.clearSuspendedActivityCallback&&this.clearSuspendedActivityCallback();var s=[],l=!0,c=!1,u=void 0;try{for(var d,v=o[Symbol.iterator]();!(l=(d=v.next()).done);l=!0){var f=d.value;if(!f.isActive){var h=r||a.has(f);if(h)f.isSuspended=!1;else{f.incrementAttemptCount(),f.initializeTrackingForNewAttempt(),s.push(f),f.objectiveInfoAvailableInCurrentParentAttempt=!0,f.progressInfoAvailableInCurrentParentAttempt=!0;var m=!0,p=!1,y=void 0;try{for(var g,b=f.children[Symbol.iterator]();!(m=(g=b.next()).done);m=!0){var _=g.value;f.sequencingControls.useCurrentAttemptObjectiveInfo&&(_.objectiveInfoAvailableInCurrentParentAttempt=this.hasKnownReadMappedObjective(_)),f.sequencingControls.useCurrentAttemptProgressInfo&&(_.progressInfoAvailableInCurrentParentAttempt=!1)}}catch(e){p=!0,y=e}finally{try{m||null==b.return||b.return()}finally{if(p)throw y}}}f.isActive=!0,oi.applySelectionAndRandomization(f,!h)}}}catch(e){c=!0,u=e}finally{try{l||null==v.return||v.return()}finally{if(c)throw u}}var S=!0,w=!1,O=void 0;try{for(var C,A=s[Symbol.iterator]();!(S=(C=A.next()).done);S=!0){var E;null===(E=this.rollupProcess)||void 0===E||E.syncActivityObjectivesFromGlobals(C.value,this.globalObjectiveMap)}}catch(e){w=!0,O=e}finally{try{S||null==A.return||A.return()}finally{if(w)throw O}}this.activityTree.currentActivity=e,this.initializeForDelivery(e),this.setupAttemptTracking(e),function(e){dt.set(e,vt(e)+1)}(e),this.contentDelivered=!0,this.adlNav&&this.updateNavigationValidityCallback&&this.updateNavigationValidityCallback(),this.fireDeliveryEvent(e)}finally{this._deliveryInProgress=!1}}},{key:"hasKnownReadMappedObjective",value:function(e){var t=this,i=e.primaryObjective;return!!i&&i.mapInfo.some(function(e){var n=t.globalObjectiveMap.get(e.targetObjectiveID||i.id);return!1!==e.readSatisfiedStatus&&!0===(null==n?void 0:n.satisfiedStatusKnown)||!1!==e.readNormalizedMeasure&&!0===(null==n?void 0:n.normalizedMeasureKnown)})}},{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 l=t;l;){var c=!0,u=!1,d=void 0;try{for(var v,f=l.hideLmsUi[Symbol.iterator]();!(c=(v=f.next()).done);c=!0)i.add(v.value)}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}l=l.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,Ur({},s))}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}for(var l=[],c=e;c;)l.push(c),c=c.parent;var u=!0,d=!1,v=void 0;try{for(var f,h=l.reverse()[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var m=f.value,p=!0,y=!1,g=void 0;try{for(var b,_=m.auxiliaryResources[Symbol.iterator]();!(p=(b=_.next()).done);p=!0){var S=b.value;S.resourceId&&t.set(S.resourceId,Ur({},S))}}catch(e){y=!0,g=e}finally{try{p||null==_.return||_.return()}finally{if(y)throw g}}}}catch(e){d=!0,v=e}finally{try{u||null==h.return||h.return()}finally{if(d)throw v}}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}();Yr(Jr,"HIDE_LMS_UI_ORDER",Gr(ut));var $r=Jr;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,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Qr(this,"activityTree"),Qr(this,"sequencingProcess"),Qr(this,"cache",null),Qr(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}},{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(zt.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:"isActivityPotentiallyDeliverableBackward",value:function(e){if(!e.isAvailable)return!1;var t=e.sequencingRules.evaluatePreConditionRules(e);if(t===At.SKIP||t===At.DISABLED)return!1;if(0===e.children.length)return!0;var i=!0,n=!1,r=void 0;try{for(var o,a=e.children[Symbol.iterator]();!(i=(o=a.next()).done);i=!0)if(this.isActivityPotentiallyDeliverableBackward(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:"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 eo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var to=Object.defineProperty,io=function(e,t,i){return function(e,t,i){return t in e?to(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)},no=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}(no||{}),ro=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;eo(this,e),io(this,"valid"),io(this,"terminationRequest"),io(this,"sequencingRequest"),io(this,"targetActivityId"),io(this,"exception"),this.valid=t,this.terminationRequest=i,this.sequencingRequest=n,this.targetActivityId=r,this.exception=o},oo=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;eo(this,e),io(this,"activityTree"),io(this,"sequencingProcess"),io(this,"adlNav"),io(this,"eventCallback"),io(this,"navigationLookAhead"),io(this,"getEffectiveHideLmsUiCallback",null),io(this,"getEffectiveAuxiliaryResourcesCallback",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:"setGetEffectiveAuxiliaryResourcesCallback",value:function(e){this.getEffectiveAuxiliaryResourcesCallback=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 ro(!1,null,null,null,"NB.2.1-18")}}},{key:"validateStartRequest",value:function(e){return null!==e?new ro(!1,null,null,null,"NB.2.1-1"):new ro(!0,null,zt.START,null)}},{key:"validateResumeRequest",value:function(e){return null!==e?new ro(!1,null,null,null,"NB.2.1-2"):null===this.activityTree.suspendedActivity?new ro(!1,null,null,null,"NB.2.1-3"):new ro(!0,null,zt.RESUME_ALL,null)}},{key:"validateContinueRequest",value:function(e){return e?e.parent&&e.parent.sequencingControls.flow?new ro(!0,e.isActive?zt.EXIT:null,zt.CONTINUE,null):new ro(!1,null,null,null,"NB.2.1-5"):new ro(!1,null,null,null,"NB.2.1-4")}},{key:"validatePreviousRequest",value:function(e){if(!e)return new ro(!1,null,null,null,"NB.2.1-6");if(!e.parent||!e.parent.sequencingControls.flow)return new ro(!1,null,null,null,"NB.2.1-7");var t=this.validateForwardOnlyConstraints(e);return t.valid?new ro(!0,e.isActive?zt.EXIT:null,zt.PREVIOUS,null):new ro(!1,null,null,null,t.exception)}},{key:"validateChoiceRequest",value:function(e,t){if(!t)return new ro(!1,null,null,null,"NB.2.1-9");var i=this.activityTree.getActivity(t);if(!i)return new ro(!1,null,null,null,"NB.2.1-10");var n=this.validateChoicePath(e,i);return n.valid?new ro(!0,(null==e?void 0:e.isActive)?zt.EXIT:null,zt.CHOICE,t):new ro(!1,null,null,null,n.exception)}},{key:"validateJumpRequest",value:function(e){return e?new ro(!0,null,zt.JUMP,e):new ro(!1,null,null,null,"NB.2.1-12")}},{key:"validateExitRequest",value:function(e){return e?new ro(!0,e===this.activityTree.root?zt.EXIT_ALL:zt.EXIT,null,null):new ro(!1,null,null,null,"NB.2.1-13")}},{key:"validateExitAllRequest",value:function(e){return e?new ro(!0,zt.EXIT_ALL,null,null):new ro(!1,null,null,null,"NB.2.1-14")}},{key:"validateAbandonRequest",value:function(e){return e?new ro(!0,zt.ABANDON,null,null):new ro(!1,null,null,null,"NB.2.1-15")}},{key:"validateAbandonAllRequest",value:function(e){return e?new ro(!0,zt.ABANDON_ALL,null,null):new ro(!1,null,null,null,"NB.2.1-16")}},{key:"validateSuspendAllRequest",value:function(e){return e?new ro(!0,zt.SUSPEND_ALL,null,null):new ro(!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}return t.parent&&!t.parent.sequencingControls.choice?{valid:!1,exception:"NB.2.1-11"}:{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,l=this.findChildContaining(n,e);if(!l)return{valid:!1,exception:"NB.2.1-11"};if(t===n)return{valid:!1,exception:"NB.2.1-11"};var c=this.findChildContaining(n,t);if(!c)return{valid:!1,exception:"NB.2.1-11"};if((null===(a=n.sequencingControls)||void 0===a?void 0:a.constrainChoice)&&c!==l)return{valid:!1,exception:"NB.2.1-11"};if((null===(s=n.sequencingControls)||void 0===s?void 0:s.preventActivation)&&c!==l&&this.requiresNewActivation(c,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===At.DISABLED||t===At.HIDE_FROM_CHOICE||t===At.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){if(i===e)return{valid:!0,exception:null};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 l=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!==l&&s>l)return{valid:!1,exception:"NB.2.1-11"};if(s>a&&e.sequencingControls.forwardOnly)for(var c=a+1;s>c;c++){var u=n[c];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!==At.SKIP&&t!==At.DISABLED&&t!==At.HIDE_FROM_CHOICE&&t!==At.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===At.SKIP||t===At.DISABLED||t===At.HIDE_FROM_CHOICE||t===At.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 l,c=i[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,d=this.validateRequest("choice",u.id);n[u.id]=d.valid?"true":"false";var v=this.validateRequest("jump",u.id);r[u.id]=v.valid?"true":"false"}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.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 f=this.getEffectiveHideLmsUiCallback?this.getEffectiveHideLmsUiCallback(this.activityTree.currentActivity):[],h=this.getEffectiveAuxiliaryResourcesCallback?this.getEffectiveAuxiliaryResourcesCallback(this.activityTree.currentActivity):[];this.fireEvent("onNavigationValidityUpdate",{continue:e,previous:t,choice:n,jump:r,hideLmsUi:f,auxiliaryResources:h})}}},{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 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,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function lo(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function co(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){so(e,t,i[t])})}return e}function uo(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 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,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 vo=Object.defineProperty,fo=function(e,t,i){return function(e,t,i){return t in e?vo(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){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),fo(this,"globalObjectiveMap",new Map),fo(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:lo(e,Error)?e.message:e+"",timestamp:(new Date).toISOString()})}}},{key:"collectObjectives",value:function(e){var objectives=e.getAllObjectives(),t=!0,i=!1,n=void 0;try{for(var r,o=objectives[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value,s=!0,l=!1,c=void 0;try{for(var u,d=a.mapInfo[Symbol.iterator]();!(s=(u=d.next()).done);s=!0){var v,f,h,m,p,y,g,b,_,S,w,O,C,A,E,j=u.value,k=j.targetObjectiveID||a.id;this.globalObjectiveMap.has(k)||this.globalObjectiveMap.set(k,{id:k,satisfiedStatus:a.satisfiedStatus,satisfiedStatusKnown:a.satisfiedStatusKnown||a.progressStatus,normalizedMeasure:a.normalizedMeasure,normalizedMeasureKnown:a.measureStatus,rawScore:"",rawScoreKnown:!1,minScore:"",minScoreKnown:!1,maxScore:"",maxScoreKnown:!1,progressMeasure:a.progressMeasure,progressMeasureKnown:a.progressMeasureStatus,completionStatus:a.completionStatus,completionStatusKnown:a.completionStatus!==je,readSatisfiedStatus:null!==(v=j.readSatisfiedStatus)&&void 0!==v&&v,writeSatisfiedStatus:null!==(f=j.writeSatisfiedStatus)&&void 0!==f&&f,readNormalizedMeasure:null!==(h=j.readNormalizedMeasure)&&void 0!==h&&h,writeNormalizedMeasure:null!==(m=j.writeNormalizedMeasure)&&void 0!==m&&m,readProgressMeasure:null!==(p=j.readProgressMeasure)&&void 0!==p&&p,writeProgressMeasure:null!==(y=j.writeProgressMeasure)&&void 0!==y&&y,readCompletionStatus:null!==(g=j.readCompletionStatus)&&void 0!==g&&g,writeCompletionStatus:null!==(b=j.writeCompletionStatus)&&void 0!==b&&b,readRawScore:null!==(_=j.readRawScore)&&void 0!==_&&_,writeRawScore:null!==(S=j.writeRawScore)&&void 0!==S&&S,readMinScore:null!==(w=j.readMinScore)&&void 0!==w&&w,writeMinScore:null!==(O=j.writeMinScore)&&void 0!==O&&O,readMaxScore:null!==(C=j.readMaxScore)&&void 0!==C&&C,writeMaxScore:null!==(A=j.writeMaxScore)&&void 0!==A&&A,satisfiedByMeasure:a.satisfiedByMeasure,minNormalizedMeasure:a.minNormalizedMeasure,updateAttemptData:null!==(E=j.updateAttemptData)&&void 0!==E?E:a.isPrimary})}}catch(e){l=!0,c=e}finally{try{s||null==d.return||d.return()}finally{if(l)throw c}}}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}var R=!0,M=!1,T=void 0;try{for(var I,P=e.children[Symbol.iterator]();!(R=(I=P.next()).done);R=!0)this.collectObjectives(I.value)}catch(e){M=!0,T=e}finally{try{R||null==P.return||P.return()}finally{if(M)throw T}}}},{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=co({},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:lo(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]=co({},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=uo(r.value,2);this.globalObjectiveMap.set(a[0],co({},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 mo=Object.defineProperty,po=function(e,t,i){return function(e,t,i){return t in e?mo(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)},yo=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),po(this,"activityTree"),po(this,"globalObjectiveService"),po(this,"rollupProcess"),po(this,"adlNav"),po(this,"eventCallback"),po(this,"getEffectiveHideLmsUiCallback",null),po(this,"getEffectiveAuxiliaryResourcesCallback",null),po(this,"contentDeliveredGetter",null),po(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);if(t){var i,n=null===(i=e.activityStates)||void 0===i?void 0:i[e.currentActivity];if(t===this.activityTree.root&&e.suspendedActivity&&!1===(null==n?void 0:n.isActive)&&!0===(null==n?void 0:n.isSuspended))this.activityTree.setCurrentActivityWithoutActivation(null);else if(e.activityStates){var r;this.activityTree.setCurrentActivityWithoutActivation(t),t.isActive=null===(r=null==n?void 0:n.isActive)||void 0===r||r}else this.activityTree.currentActivity=t,t.isActive=!0}}else null===e.currentActivity&&this.activityTree.setCurrentActivityWithoutActivation(null);if(e.suspendedActivity){var o=this.activityTree.getActivity(e.suspendedActivity);o&&(this.activityTree.suspendedActivity=o,o.isSuspended=!0)}else null===e.suspendedActivity&&(this.activityTree.suspendedActivity=null);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,objectiveInfoAvailableInCurrentParentAttempt:i.objectiveInfoAvailableInCurrentParentAttempt,progressInfoAvailableInCurrentParentAttempt:i.progressInfoAvailableInCurrentParentAttempt,attemptCompletionAmount:i.attemptCompletionAmount,attemptCompletionAmountStatus:i.attemptCompletionAmountStatus,attemptAbsoluteDuration:i.attemptAbsoluteDuration,attemptExperiencedDuration:i.attemptExperiencedDuration,activityAbsoluteDuration:i.activityAbsoluteDuration,activityExperiencedDuration:i.activityExperiencedDuration,objectiveSatisfiedStatus:i.objectiveSatisfiedStatus,objectiveSatisfiedStatusKnown:i.objectiveSatisfiedStatusKnown,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,o,a,s,l=e[i.id];l&&(i.isActive=l.isActive||!1,i.isSuspended=l.isSuspended||!1,i.isCompleted=l.isCompleted||!1,i.completionStatus=l.completionStatus||"unknown",i.attemptCount=l.attemptCount||0,i.objectiveInfoAvailableInCurrentParentAttempt=null===(n=l.objectiveInfoAvailableInCurrentParentAttempt)||void 0===n||n,i.progressInfoAvailableInCurrentParentAttempt=null===(r=l.progressInfoAvailableInCurrentParentAttempt)||void 0===r||r,i.attemptCompletionAmount=l.attemptCompletionAmount||0,i.attemptCompletionAmountStatus=null!==(o=l.attemptCompletionAmountStatus)&&void 0!==o&&o,i.attemptAbsoluteDuration=l.attemptAbsoluteDuration||"PT0H0M0S",i.attemptExperiencedDuration=l.attemptExperiencedDuration||"PT0H0M0S",i.activityAbsoluteDuration=l.activityAbsoluteDuration||"PT0H0M0S",i.activityExperiencedDuration=l.activityExperiencedDuration||"PT0H0M0S",i.objectiveSatisfiedStatus=l.objectiveSatisfiedStatus||!1,i.objectiveSatisfiedStatusKnown=null!==(a=l.objectiveSatisfiedStatusKnown)&&void 0!==a?a:"unknown"!==l.successStatus,i.successStatus=l.successStatus||"unknown",i.objectiveMeasureStatus=l.objectiveMeasureStatus||!1,i.objectiveNormalizedMeasure=l.objectiveNormalizedMeasure||0,i.progressMeasure=null!==(s=l.progressMeasure)&&void 0!==s?s:0,i.progressMeasureStatus=l.progressMeasureStatus||!1,i.isAvailable=!1!==l.isAvailable,i.isHiddenFromChoice=!0===l.isHiddenFromChoice,i.location=l.location||"",i.attemptAbsoluteStartTime=l.attemptAbsoluteStartTime||"",Array.isArray(l.auxiliaryResources)&&(i.auxiliaryResources=l.auxiliaryResources),l.objectives&&i.applyObjectiveStateSnapshot(l.objectives));var c=!0,u=!1,d=void 0;try{for(var v,f=i.children[Symbol.iterator]();!(c=(v=f.next()).done);c=!0)t(v.value)}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}if(null==l?void 0:l.selectionRandomizationState){var h=l.selectionRandomizationState,m=i.sequencingControls;void 0!==h.selectionCountStatus&&(m.selectionCountStatus=h.selectionCountStatus),void 0!==h.reorderChildren&&(m.reorderChildren=h.reorderChildren),h.childOrder&&h.childOrder.length>0&&i.setChildOrder(h.childOrder);var p=Array.isArray(h.selectedChildIds)?new Set(h.selectedChildIds):null,y=Array.isArray(h.hiddenFromChoiceChildIds)?new Set(h.hiddenFromChoiceChildIds):null;if(p||y){var g=!0,b=!1,_=void 0;try{for(var S,w=i.children[Symbol.iterator]();!(g=(S=w.next()).done);g=!0){var O=S.value;if(p){var C=p.has(O.id);O.isAvailable=C,y||(O.isHiddenFromChoice=!C)}y&&(O.isHiddenFromChoice=y.has(O.id))}}catch(e){b=!0,_=e}finally{try{g||null==w.return||w.return()}finally{if(b)throw _}}}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):[],l=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:l}}},{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),void 0!==e.currentActivityId){var n=e.currentActivityId?this.activityTree.getActivity(e.currentActivityId):null;this.activityTree.currentActivity=null!=n?n:null}if(void 0!==e.suspendedActivityId){var r=e.suspendedActivityId?this.activityTree.getActivity(e.suspendedActivityId):null;this.activityTree.suspendedActivity=null!=r?r:null}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 go(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 bo(e){return function(e){if(Array.isArray(e))return go(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 go(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)?go(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,So=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)},wo=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),So(this,"activityTree"),So(this,"eventCallback"),So(this,"now"),So(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),l=!0,c=!1,u=void 0;try{for(var d,v=s[Symbol.iterator]();!(l=(d=v.next()).done);l=!0)if(!this.isObjectiveDependencySatisfied(d.value))return{satisfied:!1,exception:"DB.1.1-14"}}catch(e){c=!0,u=e}finally{try{l||null==v.return||v.return()}finally{if(c)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(e.isSuspended)return this.fireEvent("onLimitConditionCheck",{activity:e,result:!0,failureReason:"",attemptInProgress:!0}),!0;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 l=a.value;if(l.conditions&&l.conditions.length>0){var c=!0,u=!1,d=void 0;try{for(var v,f=l.conditions[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value;h.referencedObjectiveID&&h.referencedObjectiveID!==e.id&&i.push(h.referencedObjectiveID)}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.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,bo(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 l=bo(e.sequencingRules.preConditionRules||[]).concat(bo(e.sequencingRules.exitConditionRules||[]),bo(e.sequencingRules.postConditionRules||[])),c=!0,u=!1,d=void 0;try{for(var v,f=l[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=v.value;if(h.conditions&&h.conditions.length>0){var m=!0,p=!1,y=void 0;try{for(var g,b=h.conditions[Symbol.iterator]();!(m=(g=b.next()).done);m=!0){var _=g.value;_.objectiveReference&&_.objectiveReference!==e.id&&t.push(_.objectiveReference)}}catch(e){p=!0,y=e}finally{try{m||null==b.return||b.return()}finally{if(p)throw y}}}}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.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 l=!0,c=!1,u=void 0;try{for(var d,v=s.conditions[Symbol.iterator]();!(l=(d=v.next()).done);l=!0){var f=d.value;switch(f.conditionType||f.condition){case"activityProgressKnown":e.progressMeasureStatus||(t=!1);break;case"objectiveStatusKnown":case"objectiveSatisfied":this.isObjectiveDependencySatisfied(f.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){c=!0,u=e}finally{try{l||null==v.return||v.return()}finally{if(c)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 b=y.value;if(b.conditions&&b.conditions.length>0){var _=!0,S=!1,w=void 0;try{for(var O,C=b.conditions[Symbol.iterator]();!(_=(O=C.next()).done);_=!0){var A=O.value;["objectiveStatusKnown","objectiveSatisfied"].includes(A.conditionType||A.condition)&&(this.isObjectiveDependencySatisfied(A.referencedObjectiveID||e.id)||(t=!1))}}catch(e){S=!0,w=e}finally{try{_||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 E=!0,j=!1,k=void 0;try{for(var R,M=e.rollupRules.rules[Symbol.iterator]();!(E=(R=M.next()).done);E=!0){var T=R.value;if(T.conditions&&T.conditions.length>0&&e.children&&e.children.length>0){var I=!0,P=!1,x=void 0;try{for(var D,N=e.children[Symbol.iterator]();!(I=(D=N.next()).done);I=!0)if(!D.value.isCompleted){t=!1;break}}catch(e){P=!0,x=e}finally{try{I||null==N.return||N.return()}finally{if(P)throw x}}}}}catch(e){j=!0,k=e}finally{try{E||null==M.return||M.return()}finally{if(j)throw k}}}}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 Oo=Object.defineProperty,Co=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)},Ao=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),Co(this,"activityTree"),Co(this,"sequencingProcess"),Co(this,"rollupProcess"),Co(this,"adlNav"),Co(this,"eventCallback",null),Co(this,"terminationHandler"),Co(this,"deliveryHandler"),Co(this,"navigationValidityService"),Co(this,"globalObjectiveService"),Co(this,"stateManager"),Co(this,"deliveryValidator"),Co(this,"navigationLookAhead"),Co(this,"enhancedDeliveryValidation"),Co(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 ho(o||void 0),this.globalObjectiveService.initialize(t.root);var s={};(null==a?void 0:a.now)&&(s.now=a.now),this.deliveryValidator=new wo(t,o,s);var l={};(null==a?void 0:a.getCMIData)&&(l.getCMIData=a.getCMIData),void 0!==(null==a?void 0:a.is4thEdition)&&(l.is4thEdition=a.is4thEdition),this.terminationHandler=new Fr(t,i,n,this.globalObjectiveService.getMap(),o,l);var c={};(null==a?void 0:a.now)&&(c.now=a.now),(null==a?void 0:a.defaultHideLmsUi)&&(c.defaultHideLmsUi=a.defaultHideLmsUi),(null==a?void 0:a.defaultAuxiliaryResources)&&(c.defaultAuxiliaryResources=a.defaultAuxiliaryResources),this.deliveryHandler=new $r(t,n,this.globalObjectiveService.getMap(),r,o,c),this.navigationValidityService=new oo(t,i,r,o),this.stateManager=new yo(t,this.globalObjectiveService,n,r,o),this.navigationLookAhead=this.navigationValidityService.getNavigationLookAhead(),this.setupCallbacks()}return t=e,i=[{key:"setupCallbacks",value:function(){var e,t=this;this.terminationHandler.setInvalidateCacheCallback(function(){t.navigationLookAhead.invalidateCache()});var i=new kr(this.activityTree,this.globalObjectiveService.getMap());null===(e=this.sequencingProcess)||void 0===e||e.setActivityEvaluationCallback(function(e,t){return i.project(e,t)}),this.deliveryHandler.setEndAttemptCallback(function(e){return t.terminationHandler.endAttempt(e)}),this.deliveryHandler.setCheckActivityCallback(function(e,n){return t.deliveryValidator.checkActivity(i.project(e,n))}),this.deliveryHandler.setInvalidateCacheCallback(function(){t.navigationLookAhead.invalidateCache()}),this.deliveryHandler.setUpdateNavigationValidityCallback(function(){t.navigationValidityService.updateNavigationValidity()}),this.deliveryHandler.setClearSuspendedActivityCallback(function(){t.terminationHandler.clearSuspendedActivity()}),this.deliveryValidator.setContentDeliveredGetter(function(){return t.deliveryHandler.hasContentBeenDelivered()}),this.navigationValidityService.setGetEffectiveHideLmsUiCallback(function(e){return t.deliveryHandler.getEffectiveHideLmsUi(e)}),this.navigationValidityService.setGetEffectiveAuxiliaryResourcesCallback(function(e){return t.deliveryHandler.getEffectiveAuxiliaryResources(e)}),this.stateManager.setGetEffectiveHideLmsUiCallback(function(e){return t.deliveryHandler.getEffectiveHideLmsUi(e)}),this.stateManager.setGetEffectiveAuxiliaryResourcesCallback(function(e){return t.deliveryHandler.getEffectiveAuxiliaryResources(e)}),this.stateManager.setContentDeliveredAccessors(function(){return t.deliveryHandler.hasContentBeenDelivered()},function(e){return t.deliveryHandler.setContentDelivered(e)})}},{key:"processNavigationRequest",value:function(e){return this.completeNavigationRequest(this.prepareNavigationRequest(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2?arguments[2]:void 0))}},{key:"prepareNavigationRequest",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{navigationRequest:e,navResult:i,deliveryRequest:new Wr(!1,null,i.exception),sessionEndReason:null};if(i.terminationRequest){var n=!!i.sequencingRequest,r=this.terminationHandler.processTerminationRequest(i.terminationRequest,n,t);if(!r.valid)return{navigationRequest:e,navResult:i,deliveryRequest:new Wr(!1,null,r.exception||"TB.2.3-1"),sessionEndReason:null};if(null!==r.sequencingRequest&&(n||r.sequencingRequest!==zt.EXIT)&&(i.sequencingRequest=r.sequencingRequest),r.terminationRequest===zt.EXIT_ALL&&r.sequencingRequest===zt.EXIT)return i.sequencingRequest=null,{navigationRequest:e,navResult:i,deliveryRequest:null,sessionEndReason:"exit_all"};if(!i.sequencingRequest)return{navigationRequest:e,navResult:i,deliveryRequest:null,sessionEndReason:i.terminationRequest===zt.EXIT_ALL?"exit_all":i.terminationRequest===zt.ABANDON_ALL?"abandon_all":i.terminationRequest===zt.SUSPEND_ALL?"suspend_all":null}}return{navigationRequest:e,navResult:i,deliveryRequest:null,sessionEndReason:null}}},{key:"completeNavigationRequest",value:function(e){var t=e.navigationRequest,i=e.navResult;if(e.deliveryRequest)return e.deliveryRequest;if(e.sessionEndReason)return"suspend_all"===e.sessionEndReason&&this.activityTree.setCurrentActivityWithoutActivation(null),this.fireEvent("onSequencingSessionEnd",{reason:e.sessionEndReason,navigationRequest:t}),new Wr(!0,null);if(!i.sequencingRequest)return new Wr(!0,null);var n=this.sequencingProcess.sequencingRequestProcess(i.sequencingRequest,i.targetActivityId);return n.endSequencingSession?(this.fireEvent("onSequencingSessionEnd",{reason:"end_of_content",exception:n.exception,navigationRequest:t}),new Wr(!0,null)):n.exception?new Wr(!1,null,n.exception):n.deliveryRequest===Ft.DELIVER&&n.targetActivity?(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.processDelivery(n.targetActivity)):new Wr(!1,null,"OP.1-1")}},{key:"processDelivery",value:function(e){if(this.enhancedDeliveryValidation){var t=this.deliveryValidator.validateTreeConsistency(e);if(!t.consistent)return new Wr(!1,null,t.exception);var i=this.deliveryValidator.validateResources(e);if(!i.available)return new Wr(!1,null,i.exception);var n=this.deliveryValidator.validateConcurrentDelivery(e);if(!n.allowed)return new Wr(!1,null,n.exception);var r=this.deliveryValidator.validateDependencies(e);if(!r.satisfied)return new Wr(!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===je&&(e.completionStatus=Ae,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 Eo(e,t,i){return Eo="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=jo(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Eo(e,t,i||e)}function jo(e){return jo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},jo(e)}function ko(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Ro(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ro=function(){return!!result})()}function Mo(e,t){return Mo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Mo(e,t)}function To(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Io=Object.defineProperty,Po=function(e,t,i){return function(e,t,i){return t in e?Io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":To(t))?t+"":t,i)},xo=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=jo(t),n=e,!(r=Ro()?Reflect.construct(t,i||[],jo(e).constructor):t.apply(e,i))||"object"!==To(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"]),Po(i,"_root",null),Po(i,"_currentActivity",null),Po(i,"_suspendedActivity",null),Po(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&&Mo(e,t)}(t,e),i=t,n=[{key:"initialize",value:function(){Eo(jo(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&&!ko(e,Jn))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&&!ko(e,Jn))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&&!ko(e,Jn))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&&!ko(e,Jn))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}(E);function Do(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 No(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function qo(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){No(e,t,i[t])})}return e}function Lo(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 zo(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 Do(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)?Do(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 Fo=new Set([Object.prototype,Jn.prototype,Wn.prototype,xo.prototype,ii.prototype,kt.prototype,Rt.prototype,Mt.prototype,Tn.prototype,In.prototype,Pn.prototype]);function Bo(e){var t=new Map,i=function(e){if("function"==typeof e)throw Error("Preview cannot copy callbacks");if(null===e||"object"!=(void 0===e?"undefined":(n=e)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n))return e;var n;if(t.has(e))return t.get(e);var r=Object.getPrototypeOf(e);if([Date.prototype,Map.prototype,Set.prototype].includes(r)&&Reflect.ownKeys(e).length>0)throw Error("Preview cannot copy custom collection properties");if(r===Date.prototype)return new Date(Date.prototype.getTime.call(e));if(r===Map.prototype){var o=new Map;t.set(e,o);var a=!0,s=!1,l=void 0;try{for(var c,u=Map.prototype.entries.call(e)[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var d=zo(c.value,2),entry=d[1];o.set(i(d[0]),i(entry))}}catch(e){s=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw l}}return o}if(r===Set.prototype){var v=new Set;t.set(e,v);var f=!0,h=!1,m=void 0;try{for(var p,y=Set.prototype.values.call(e)[Symbol.iterator]();!(f=(p=y.next()).done);f=!0)v.add(i(p.value))}catch(e){h=!0,m=e}finally{try{f||null==y.return||y.return()}finally{if(h)throw m}}return v}if(null!==r&&r!==Array.prototype&&!Fo.has(r))throw Error("Preview cannot copy a custom model");var result=Array.isArray(e)?[]:Object.create(r);t.set(e,result);var g=!0,b=!1,_=void 0;try{for(var S,w=Reflect.ownKeys(e)[Symbol.iterator]();!(g=(S=w.next()).done);g=!0){var O=S.value,C=Object.getOwnPropertyDescriptor(e,O);if(!("value"in C))throw Error("Preview cannot copy accessors");Object.defineProperty(result,O,Lo(qo({},C),{value:i(C.value)}))}}catch(e){b=!0,_=e}finally{try{g||null==w.return||w.return()}finally{if(b)throw _}}return result};return i(e)}function Vo(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 Ho(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Uo(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){Ho(e,t,i[t])})}return e}function Go(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)||Yo(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 Ko(e){return function(e){if(Array.isArray(e))return Vo(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Yo(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 Yo(e,t){if(e){if("string"==typeof e)return Vo(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)?Vo(e,t):void 0}}var Wo=Object.defineProperty,Jo=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)},$o=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),Jo(this,"sequencing"),Jo(this,"cmi"),Jo(this,"adl"),Jo(this,"eventService"),Jo(this,"loggingService"),Jo(this,"activityDeliveryService"),Jo(this,"rollupProcess"),Jo(this,"overallSequencingProcess",null),Jo(this,"sequencingProcess",null),Jo(this,"eventListeners",{}),Jo(this,"configuration"),Jo(this,"isInitialized",!1),Jo(this,"navigationPreviewConfiguration",null),Jo(this,"isSequencingActive",!1),Jo(this,"lastCMIValues",new Map),Jo(this,"lastSequencingResult",null),this.sequencing=t,this.cmi=cmi,this.adl=adl,this.eventService=i,this.loggingService=n,this.configuration=Uo({autoRollupOnCMIChange:!1,autoProgressOnCompletion:!1,validateNavigationRequests:!0,enableEventSystem:!0,logLevel:"info",now:function(){return new Date}},o),this.activityDeliveryService=new ki(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 Or,this.configuration.now&&kt.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.navigationPreviewConfiguration=this.configuration,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 Ci(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=Ko(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.cmi.initialized?e.getCMIDataForTransfer():null},this.overallSequencingProcess=new Ao(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){var i=this.prepareNavigationRequest(request,e,t);return!!i&&this.completeNavigationRequest(i)}},{key:"previewNavigationRequest",value:function(request){var e,t,i,n={outcome:"unknown",targetActivityId:null,endSequencingSession:!1,exception:null};if(!this.isInitialized||!this.overallSequencingProcess||this.isDeliveryInProgress()||!(null===(e=this.sequencing.activityTree.currentActivity)||void 0===e?void 0:e.isActive)||"continue"!==request&&"previous"!==request)return n;try{for(var r,o,a,s=this.navigationPreviewConfiguration,l=Bo(this.sequencing.activityTree),c=l.root?[l.root]:[];c.length;){var u,d=c.pop(),v=d.sequencingControls;if(v.randomizeChildren&&"never"!==v.randomizationTiming||null!==v.selectCount&&"never"!==v.selectionTiming)return n;(u=c).push.apply(u,Ko(d.children))}var f=new Ci(l,null,null,null,Uo({},s.now?{now:s.now}:{},s.getAttemptElapsedSeconds?{getAttemptElapsedSeconds:s.getAttemptElapsedSeconds}:{},s.getActivityElapsedSeconds?{getActivityElapsedSeconds:s.getActivityElapsedSeconds}:{})),h=this.getCMIDataForTransfer(),m=!1,p=new Ao(l,f,new Or,null,function(e){"onSequencingSessionEnd"===e&&(m=!0)},(t=Uo({getCMIData:function(){return h}},s.now?{now:s.now}:{}),i=null!=(i={defaultHideLmsUi:Bo(this.sequencing.hideLmsUi),defaultAuxiliaryResources:Bo(this.sequencing.auxiliaryResources)})?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));p.getGlobalObjectiveMap().clear();var y=!0,g=!1,b=void 0;try{for(var _,S=this.overallSequencingProcess.getGlobalObjectiveMap()[Symbol.iterator]();!(y=(_=S.next()).done);y=!0){var w=Go(_.value,2),id=w[0],O=w[1];p.getGlobalObjectiveMap().set(id,Bo(O))}}catch(e){g=!0,b=e}finally{try{y||null==S.return||S.return()}finally{if(g)throw b}}p.setContentDelivered(this.overallSequencingProcess.hasContentBeenDelivered());var result=p.processNavigationRequest("continue"===request?no.CONTINUE:no.PREVIOUS,null,this.cmi.getExitValueInternal()||"");return{outcome:result.valid?"allowed":"blocked",targetActivityId:null!==(r=null===(a=result.targetActivity)||void 0===a?void 0:a.id)&&void 0!==r?r:null,endSequencingSession:m,exception:null!==(o=result.exception)&&void 0!==o?o:null}}catch(e){return n}}},{key:"prepareNavigationRequest",value:function(request,e,t){if(!this.isInitialized||!this.overallSequencingProcess)return this.log("warn","Navigation request '".concat(request,"' ignored - sequencing not initialized")),null;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)),null;var n=this.overallSequencingProcess.getSequencingState();return{request:request,operation:this.overallSequencingProcess.prepareNavigationRequest(i,e||null,t),rollbackState:n}}catch(e){var r="Error preparing navigation request '".concat(request,"': ").concat(e);return this.log("error",r),this.fireEvent("onSequencingError",r,"navigation"),null}}},{key:"completeNavigationRequest",value:function(e){if(!this.overallSequencingProcess)return!1;try{var t=this.overallSequencingProcess.completeNavigationRequest(e.operation);return this.handleNavigationDeliveryRequest(e.request,t)}catch(t){var i="Error completing navigation request '".concat(e.request,"': ").concat(t);return this.log("error",i),this.fireEvent("onSequencingError",i,"navigation"),!1}}},{key:"cancelPreparedNavigation",value:function(e){var t;null===(t=this.overallSequencingProcess)||void 0===t||t.restoreSequencingState(e.rollbackState)}},{key:"handleNavigationDeliveryRequest",value:function(request,e){var t,i,n={deliveryRequest:e.valid?Ft.DELIVER:Ft.DO_NOT_DELIVER,targetActivity:e.targetActivity,exception:e.exception||null,endSequencingSession:!1};return this.lastSequencingResult=n,e.valid&&e.targetActivity?(this.activityDeliveryService.processSequencingResult(n),null===(t=this.overallSequencingProcess)||void 0===t||t.updateNavigationValidity(),this.log("info","Navigation request '".concat(request,"' resulted in activity delivery: ").concat(e.targetActivity.id)),!0):(null===(i=this.overallSequencingProcess)||void 0===i||i.updateNavigationValidity(),e.exception?(this.log("warn","Navigation request '".concat(request,"' failed: ").concat(e.exception)),this.fireEvent("onSequencingError",e.exception,"navigation")):this.log("info","Navigation request '".concat(request,"' completed with no activity delivery")),e.valid)}},{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=Uo({},this.eventListeners,e),this.log("debug","Sequencing event listeners updated")}},{key:"updateConfiguration",value:function(e){this.configuration=Uo({},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,i=!1;if(""!==this.cmi.progress_measure){var n=parseFloat(this.cmi.progress_measure);isNaN(n)||(i=!0,e.progressMeasure=n,e.progressMeasureStatus=!0,e.attemptCompletionAmount=n,e.attemptCompletionAmountStatus=!0)}if(i||(e.attemptCompletionAmountStatus=!1),e.completedByMeasure){var r=Rr({completionThreshold:e.minProgressMeasure,progressMeasure:this.cmi.progress_measure,storedCompletionStatus:je});e.completionStatus=r,e.attemptProgressStatus=r!==je}else"unknown"!==this.cmi.completion_status&&(e.completionStatus=this.cmi.completion_status,e.attemptProgressStatus=!0);var o=!0===(null===(t=e.primaryObjective)||void 0===t?void 0:t.satisfiedByMeasure);if(o||"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 a=parseFloat(this.cmi.score.scaled);if(!isNaN(a)&&(e.objectiveNormalizedMeasure=a,e.objectiveMeasureStatus=!0,o)){var s,l,c=null!==(s=null===(l=e.primaryObjective)||void 0===l?void 0:l.minNormalizedMeasure)&&void 0!==s?s:1;e.objectiveSatisfiedStatus=a>=c,e.objectiveSatisfiedStatusKnown=!0,e.successStatus=c>a?Oe:we}}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,o,a,s,l=this,c={completion_status:this.cmi.completion_status,completion_status_was_set:!0===(null===(e=(t=this.configuration).wasCMIElementSetByContent)||void 0===e?void 0:e.call(t,"cmi.completion_status")),success_status:this.cmi.success_status,success_status_was_set:!0===(null===(i=(n=this.configuration).wasCMIElementSetByContent)||void 0===i?void 0:i.call(n,"cmi.success_status")),score_was_set:["scaled","raw","min","max"].some(function(e){var t,i;return!0===(null===(t=(i=l.configuration).wasCMIElementSetByContent)||void 0===t?void 0:t.call(i,"cmi.score.".concat(e)))}),progress_measure:this.cmi.progress_measure,score:{scaled:(null===(r=this.cmi.score)||void 0===r?void 0:r.scaled)||"",raw:(null===(o=this.cmi.score)||void 0===o?void 0:o.raw)||"",min:(null===(a=this.cmi.score)||void 0===a?void 0:a.min)||"",max:(null===(s=this.cmi.score)||void 0===s?void 0:s.max)||""},objectives:[]};if(this.cmi.objectives&&this.cmi.objectives.childArray){var u=!0,d=!1,v=void 0;try{for(var f,h,m=function(){var e,t,i,n,r,o,a,s,u=Go(h.value,2),d=u[0],v=u[1];v.id&&c.objectives.push({id:v.id,success_status:v.success_status,success_status_was_set:!0===(null===(e=(t=f.configuration).wasCMIElementSetByContent)||void 0===e?void 0:e.call(t,"cmi.objectives.".concat(d,".success_status"))),score_was_set:["scaled","raw","min","max"].some(function(e){var t,i;return!0===(null===(t=(i=l.configuration).wasCMIElementSetByContent)||void 0===t?void 0:t.call(i,"cmi.objectives.".concat(d,".score.").concat(e)))}),completion_status:v.completion_status,completion_status_was_set:!0===(null===(i=(n=f.configuration).wasCMIElementSetByContent)||void 0===i?void 0:i.call(n,"cmi.objectives.".concat(d,".completion_status"))),progress_measure:v.progress_measure,score:{scaled:(null===(r=v.score)||void 0===r?void 0:r.scaled)||"",raw:(null===(o=v.score)||void 0===o?void 0:o.raw)||"",min:(null===(a=v.score)||void 0===a?void 0:a.min)||"",max:(null===(s=v.score)||void 0===s?void 0:s.max)||""}})},p=this.cmi.objectives.childArray.entries()[Symbol.iterator]();!(u=(h=p.next()).done);u=!0)f=this,m()}catch(e){d=!0,v=e}finally{try{u||null==p.return||p.return()}finally{if(d)throw v}}}return c}},{key:"parseNavigationRequest",value:function(request){var e=request;if(e.startsWith("_")&&"_none_"!==e&&(e=e.substring(1)),request.includes("choice"))return no.CHOICE;if(request.includes("jump"))return no.JUMP;switch(e){case"start":return no.START;case"resumeAll":return no.RESUME_ALL;case"continue":return no.CONTINUE;case"previous":return no.PREVIOUS;case"exit":return no.EXIT;case"exitAll":return no.EXIT_ALL;case"abandon":return no.ABANDON;case"abandonAll":return no.ABANDON_ALL;case"suspendAll":return no.SUSPEND_ALL;case"_none_":return no.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,Ko(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(Ko(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,Ko(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,Uo({timestamp:(new Date).toISOString()},t));try{this.eventService.processListeners("Sequencing.onSequencingDebug",e,Uo({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.fireDebugEvent("Sequencing process selected activity for delivery",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 Xo=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=[],l=[];for(var c in e)if({}.hasOwnProperty.call(e,c)){var u=c.match(a);if(u){interactions.push({key:c,value:e[c],index:+u[2],field:u[3]||""});continue}var d=c.match(s);if(d){objectives.push({key:c,value:e[c],index:+d[2],field:d[3]||""});continue}l.push({key:c,value:e[c]})}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,void 0,{numeric:!0})}),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,void 0,{numeric:!0})}),l.sort(function(e,t){return e.key.localeCompare(t.key,void 0,{numeric:!0})});var v=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)})};v(interactions),v(objectives),v(l)}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 l=0;s.length>l;l++)if(s[l]){var c=s[l],u="".concat(a,".").concat(l);c.constructor===Object?this.loadFromJSON(c,u,i,n,r):i(u,c)}}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[ke.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 Qo(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 Zo(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}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":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,i)},ia=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ta(this,"settings"),ta(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,ke.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 Qo(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)?Qo(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 l=Zo(e,Error)?e.message:e+"";return{result:H,errorCode:this.error_codes.GENERAL_COMMIT_FAILURE||391,errorMessage:l}}}},{key:"_prepareRequestBody",value:function(e){return{body:Zo(e,Array)?e.join("&"):JSON.stringify(e),contentType:Zo(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 na(e,t,i,n){return fn(e,t,i,ue.TYPE_MISMATCH,Q,n)}function ra(e,t,i,n){if(""===t)throw new Q(e,ue.VALUE_OUT_OF_RANGE);return hn(e,t,i,ue.VALUE_OUT_OF_RANGE,Q)}var oa=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)||fn(e,t,i,r,a)&&(!n||hn(e,t,n,o,a))}},{key:"validateScorm12Audio",value:function(e,t){return na(e,t,xe)&&ra(e,t,"-1#100")}},{key:"validateScorm12Language",value:function(e,t){return""===t||na(e,t,Ie)}},{key:"validateScorm12Speed",value:function(e,t){return na(e,t,xe)&&ra(e,t,"-100#100")}},{key:"validateScorm12Text",value:function(e,t){return na(e,t,xe)&&ra(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}(),aa=new oa;function sa(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 la(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ca(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function ua(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){la(e,t,i[t])})}return e}function da(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 va(e){return function(e){if(Array.isArray(e))return sa(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 sa(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)?sa(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 fa(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var ha=Object.defineProperty,ma=function(e,t,i){return function(e,t,i){return t in e?ha(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":fa(t))?t+"":t,i)},pa=function(){function e(t,i,n,r,o,a,s,l,c){var u=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ma(this,"_timeout"),ma(this,"_error_codes"),ma(this,"_settings",Me),ma(this,"_httpService"),ma(this,"_eventService"),ma(this,"_serializationService"),ma(this,"_errorHandlingService"),ma(this,"_loggingService"),ma(this,"_offlineStorageService"),ma(this,"_cmiValueAccessService"),ma(this,"_courseId",""),ma(this,"_pendingCommitCount",0),ma(this,"_commitSequence",0),ma(this,"_commitSettleWaiters",[]),ma(this,"_setCMIElements",new Set),ma(this,"startingData"),ma(this,"currentState"),(ca(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=ua({},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=l||Wi(),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 qi(this.settings,this._error_codes)):this._httpService=new ia(this.settings,this._error_codes),this._eventService=r||new tn(function(e,t,i,n){return u.apiLog(e,t,i,n)}),this._serializationService=o||new Xo,this._errorHandlingService=s||new Qi(this._error_codes,function(e,t,i,n){return u.apiLog(e,t,i||ke.ERROR,n)},function(e,t){return u.getLmsErrorMessageDetails(e,t)},void 0),this.settings.enableOfflineSupport&&(this._offlineStorageService=c||new vn(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",ke.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),ke.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",ke.INFO),u.loadFromJSON(e.runtimeData))}).catch(function(e){u.apiLog("constructor","Error retrieving offline data: ".concat(e),ke.ERROR)})),this._cmiValueAccessService=new Vi({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,t){this.apiLog("reset","Called",ke.INFO),this.settings=ua({},this.settings,e),this.clearScheduledCommit(),this.currentState=0,this.lastErrorCode="0",!0!==(null==t?void 0:t.preserveListeners)&&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",ke.INFO),null===(i=n._offlineStorageService)||void 0===i||i.syncOfflineData().then(function(t){t&&(n.apiLog(e,"Successfully synced offline data",ke.INFO),n.processListeners("OfflineDataSynced"))}))})),this.apiLog(e,"returned: "+r,ke.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=ua({},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),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 l;n=!0,this.processListeners("BeforeTerminate");var result=this.storeData(!0,"terminate");if((null!==(l=result.errorCode)&&void 0!==l?l:0)>0){var c;result.errorMessage&&this.apiLog("terminate","Terminate failed with error: ".concat(result.errorMessage),ke.ERROR),result.errorDetails&&this.apiLog("terminate","Error details: ".concat(JSON.stringify(result.errorDetails)),ke.DEBUG),this.throwSCORMError("api",null!==(c=result.errorCode)&&void 0!==c?c: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,ke.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,ke.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,ke.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),r=H}else if(i&&this.isTerminated()){var s,l=null!==(s=this._error_codes.COMMIT_AFTER_TERM)&&void 0!==s?s:0;this.throwSCORMError("api",l),143===l&&(r=H)}else{var c,u,result=this.storeData(!1,n),d=null!==(c=result.errorCode)&&void 0!==c?c:0;d>0&&(result.errorMessage&&this.apiLog("commit","Commit failed with error: ".concat(result.errorMessage),ke.ERROR),result.errorDetails&&this.apiLog("commit","Error details: ".concat(JSON.stringify(result.errorDetails)),ke.DEBUG),this.throwSCORMError("api",d));var v=null!==(u=null==result?void 0:result.result)&&void 0!==u?u:H;this.apiLog(e," Result: "+(r="boolean"==typeof v?v+"":v),ke.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",ke.INFO),null===(n=t._offlineStorageService)||void 0===n||n.syncOfflineData().then(function(i){i?(t.apiLog(e,"Successfully synced offline data",ke.INFO),t.processListeners("OfflineDataSynced")):t.apiLog(e,"Failed to sync some offline data",ke.WARN)}))})}return this.apiLog(e,"returned: "+r,ke.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,ke.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,ke.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,ke.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":fa(e))&&t in e){var i=e[t];return ca(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":fa(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+)\.objectives\.(\d+)\.id$/);if(a&&a[1]&&a[2]){var s=parseInt(a[1],10),l=parseInt(a[2],10),interactions=i(this.cmi,"interactions");if(interactions){var c=interactions.childArray[s];if(c){var u=i(c,"objectives");if(u)return n(u,l,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 f(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,l=function(){a||(a=!0,i._pendingCommitCount-=1,0===i._pendingCommitCount&&i._flushCommitSettleWaiters())};try{var c=null!=r?r:n?"terminate":"manual",u=t;if(n&&this.settings.terminateCommitPayloadField){var d=this.settings.terminateCommitPayloadField;Array.isArray(u)?u=va(u).concat(["".concat(encodeURIComponent(d),"=true")]):u&&"object"===(void 0===u?"undefined":fa(u))&&(u=da(ua({},u),la({},d,!0)))}!0===this.settings.includeCommitSequence&&(Array.isArray(u)?u=va(u).concat(["commitSequence=".concat(o)]):u&&"object"===(void 0===u?"undefined":fa(u))&&(u=da(ua({},u),{commitSequence:o})));var v,f=n&&this.settings.terminateCommitParam?y(e,this.settings.terminateCommitParam,"true"):e,h={isTerminateCommit:n,trigger:c,sequence:o},m={url:f,trigger:c,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",ke.INFO),u&&"object"===(void 0===u?"undefined":fa(u))&&"cmi"in u?this._offlineStorageService.storeOffline(this._courseId,u,{isTerminateCommit:n,sequence:o}):(this.apiLog("processHttpRequest","Invalid commit data format for offline storage",ke.ERROR),{result:H,errorCode:null!==(v=this._error_codes.GENERAL)&&void 0!==v?v:101});var result=this._httpService.processHttpRequest(f,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),l(),i.processListeners(e,t,n,m)):i.processListeners(e,t,n)},h,l);return s=!0===this._httpService.reportsRequestCompletion,result}finally{s||l()}}},{key:"scheduleCommit",value:function(e,t){this._timeout||(this._timeout=new ct(this,e,t),this.apiLog("scheduleCommit","scheduled",ke.DEBUG,""))}},{key:"clearScheduledCommit",value:function(){this._timeout&&(this._timeout.cancel(),this._timeout=void 0,this.apiLog("clearScheduledCommit","cleared",ke.DEBUG,""))}},{key:"_checkObjectHasProperty",value:function(e,t){return null!=e&&"object"===(void 0===e?"undefined":fa(e))&&(Object.hasOwnProperty.call(e,t)||null!=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),t)||t in e)}},{key:"handleValueAccessException",value:function(e,t,i){return ca(t,B)?(this.lastErrorCode=t.errorCode+"",""!==i&&(i=H),this.throwSCORMError(e,t.errorCode,t.errorMessage)):ca(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 ya(e){return ya=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ya(e)}function ga(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ga=function(){return!!result})()}function ba(e,t){return ba=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ba(e,t)}function _a(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Sa=Object.defineProperty,wa=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":_a(t))?t+"":t,i)},Oa=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=ya(t),n=e,!(r=ga()?Reflect.construct(t,i||[],ya(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,[e.CMIElement]),wa(i,"__children"),wa(i,"__score_range"),wa(i,"__invalid_error_code"),wa(i,"__invalid_type_code"),wa(i,"__invalid_range_code"),wa(i,"__decimal_regex"),wa(i,"__error_class"),wa(i,"__allow_empty_string"),wa(i,"_raw",""),wa(i,"_min",""),wa(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||De,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&&ba(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){aa.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){aa.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){aa.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}(E);function Ca(e,t,i){return Ca="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Aa(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Ca(e,t,i||e)}function Aa(e){return Aa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Aa(e)}function Ea(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ea=function(){return!!result})()}function ja(e,t){return ja=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ja(e,t)}function ka(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ra=Object.defineProperty,Ma=function(e,t,i){return function(e,t,i){return t in e?Ra(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ka(t))?t+"":t,i)},Ta=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=Aa(t),n=e,!(r=Ea()?Reflect.construct(t,i||[],Aa(e).constructor):t.apply(e,i))||"object"!==ka(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"]),Ma(e,"score"),Ma(e,"__children",U.core_children),Ma(e,"_student_id",""),Ma(e,"_student_name",""),Ma(e,"_lesson_location",""),Ma(e,"_credit",""),Ma(e,"_lesson_status","not attempted"),Ma(e,"_entry",""),Ma(e,"_total_time",""),Ma(e,"_lesson_mode","normal"),Ma(e,"_exit",""),Ma(e,"_session_time","00:00:00"),Ma(e,"_suspend_data",""),e.score=new Oa({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&&ja(e,t)}(t,e),i=t,(n=[{key:"initialize",value:function(){var e;Ca(Aa(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){na(this._cmi_element+".lesson_location",lesson_location,Ie,!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);na(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?na(this._cmi_element+".lesson_status",lesson_status,"^(passed|completed|failed|incomplete|browsed)$")&&(this._lesson_status=lesson_status):na(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);na(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(na(this._cmi_element+".total_time",total_time,Pe,!0))if(total_time){var e=u(total_time,Pe);this._total_time=l(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);na(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=""),na(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(na(this._cmi_element+".session_time",session_time,Pe)){var e=u(session_time,Pe);this._session_time=l(e)}}},{key:"suspend_data",get:function(){return this._suspend_data},set:function(suspend_data){na(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=l(o/1e3)}return t=this._total_time,i=r,"string"==typeof(n=RegExp(Pe))&&(n=RegExp(n)),l(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}(E);function Ia(e,t,i){return t=xa(t),n=e,!(r=Na()?Reflect.construct(t,i||[],xa(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 Pa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xa(e){return xa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},xa(e)}function Da(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&&qa(e,t)}function Na(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Na=function(){return!!result})()}function qa(e,t){return qa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},qa(e,t)}function La(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var za=Object.defineProperty,Fa=function(e,t,i){return function(e,t,i){return t in e?za(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":La(t))?t+"":t,i)},Ba=function(e){function t(){return Pa(this,t),Ia(this,t,[{CMIElement:"cmi.objectives",children:U.objectives_children,errorCode:ue.INVALID_SET_VALUE,errorClass:Q}])}return Da(t,e),t}(ge),Va=function(e){function t(){var e;return Pa(this,t),e=Ia(this,t,["cmi.objectives.n"]),Fa(e,"score"),Fa(e,"_id",""),Fa(e,"_status",""),e.score=new Oa({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 Da(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){na(this._cmi_element+".id",id,Ne)&&(this._id=id)}},{key:"status",get:function(){return this._status},set:function(status){na(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}(E);function Ha(e){return Ha=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ha(e)}function Ua(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ua=function(){return!!result})()}function Ga(e,t){return Ga=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ga(e,t)}function Ka(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ya=Object.defineProperty,Wa=function(e,t,i){return function(e,t,i){return t in e?Ya(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Ka(t))?t+"":t,i)},Ja=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=Ua()?Reflect.construct(t,i||[],Ha(e).constructor):t.apply(e,i))||"object"!==Ka(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"]),Wa(i,"__children"),Wa(i,"_mastery_score",""),Wa(i,"_max_time_allowed",""),Wa(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&&Ga(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(aa.validateReadOnly(this._cmi_element+".mastery_score",this.initialized),null!=mastery_score){var e=mastery_score;"string"!=typeof e&&(e+=""),""!==e?na(this._cmi_element+".mastery_score",e,De)&&ra(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(aa.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{na(t,e,Pe,!0);var i=u(e,Pe);return l(i)}catch(e){}try{na(t,e,Ke,!0);var n=d(e,Ke);return l(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(aa.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+"";na(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}(E);function $a(e){return $a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},$a(e)}function Xa(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Xa=function(){return!!result})()}function Qa(e,t){return Qa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Qa(e,t)}function Za(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var es=Object.defineProperty,ts=function(e,t,i){return function(e,t,i){return t in e?es(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Za(t))?t+"":t,i)},is=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=$a(t),n=e,!(r=Xa()?Reflect.construct(t,i||[],$a(e).constructor):t.apply(e,i))||"object"!==Za(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"]),ts(i,"__children"),ts(i,"_audio",""),ts(i,"_language",""),ts(i,"_speed",""),ts(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&&Qa(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){aa.validateScorm12Audio(this._cmi_element+".audio",audio)&&(this._audio=audio)}},{key:"language",get:function(){return this._language},set:function(language){aa.validateScorm12Language(this._cmi_element+".language",language)&&(this._language=language)}},{key:"speed",get:function(){return this._speed},set:function(speed){aa.validateScorm12Speed(this._cmi_element+".speed",speed)&&(this._speed=speed)}},{key:"text",get:function(){return this._text},set:function(text){aa.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}(E);function ns(e,t,i){return t=ss(t),n=e,!(r=cs()?Reflect.construct(t,i||[],ss(e).constructor):t.apply(e,i))||"object"!==ds(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 rs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function os(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 as(e,t,i){return as="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ss(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},as(e,t,i||e)}function ss(e){return ss=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ss(e)}function ls(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&&us(e,t)}function cs(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(cs=function(){return!!result})()}function us(e,t){return us=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},us(e,t)}function ds(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var vs=Object.defineProperty,fs=function(e,t,i){return function(e,t,i){return t in e?vs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ds(t))?t+"":t,i)},hs=function(e){function t(){return rs(this,t),ns(this,t,[{CMIElement:"cmi.interactions",children:U.interactions_children,errorCode:ue.INVALID_SET_VALUE,errorClass:Q}])}return ls(t,e),t}(ge),ms=function(e){function t(){var e;return rs(this,t),e=ns(this,t,["cmi.interactions.n"]),fs(e,"objectives"),fs(e,"correct_responses"),fs(e,"_id",""),fs(e,"_time",""),fs(e,"_type",""),fs(e,"_weighting",""),fs(e,"_student_response",""),fs(e,"_result",""),fs(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 ls(t,e),os(t,[{key:"initialize",value:function(){var e,i;as(ss(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){na(this._cmi_element+".id",id,Ne)&&(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){na(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){na(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){na(this._cmi_element+".weighting",weighting,De)&&ra(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){na(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'.")),na(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(na(this._cmi_element+".latency",latency,Pe)){var e=u(latency,Pe);this._latency=l(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}(E),ps=function(e){function t(){var e;return rs(this,t),e=ns(this,t,["cmi.interactions.n.objectives.n"]),fs(e,"_id",""),e}return ls(t,e),os(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){na(this._cmi_element+".id",id,Ne)&&(this._id=id)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id};return this.jsonString=!1,result}}]),t}(E),ys=function(e){function t(){var e;return rs(this,t),e=ns(this,t,["cmi.interactions.correct_responses.n"]),fs(e,"_pattern",""),e}return ls(t,e),os(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){na(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}(E);function gs(e,t,i){return gs="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}},gs(e,t,i||e)}function bs(e){return bs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},bs(e)}function _s(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_s=function(){return!!result})()}function Ss(e,t){return Ss=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ss(e,t)}function ws(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Os=Object.defineProperty,Cs=function(e,t,i){return function(e,t,i){return t in e?Os(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ws(t))?t+"":t,i)},As=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=bs(t),n=e,!(r=_s()?Reflect.construct(t,i||[],bs(e).constructor):t.apply(e,i))||"object"!==ws(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"]),Cs(n,"__children",""),Cs(n,"__version","3.4"),Cs(n,"_launch_data",""),Cs(n,"_comments",""),Cs(n,"_comments_from_lms",""),Cs(n,"core"),Cs(n,"objectives"),Cs(n,"student_data"),Cs(n,"student_preference"),Cs(n,"interactions"),i&&n.initialize(),n.__children=e||U.cmi_children,n.core=new Ta,n.objectives=new Ba,n.student_data=student_data||new Ja,n.student_preference=new is,n.interactions=new hs,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&&Ss(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;gs(bs(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){na(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}(j);function Es(e){return Es=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Es(e)}function js(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(js=function(){return!!result})()}function ks(e,t){return ks=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ks(e,t)}function Rs(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ms=Object.defineProperty,Ts=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=Es(t),n=e,!(r=js()?Reflect.construct(t,i||[],Es(e).constructor):t.apply(e,i))||"object"!==Rs(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?Ms(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==Rs(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&&ks(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||na(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}(E);function Is(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 Ps(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 xs(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ds(e){return Ds=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ds(e)}function Ns(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ns=function(){return!!result})()}function qs(e,t){return qs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},qs(e,t)}function Ls(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var zs=Object.defineProperty,Fs=function(e,t,i){return function(e,t,i){return t in e?zs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Ls(t))?t+"":t,i)},Bs=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){xs(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=Ds(t),n=e,!(r=Ns()?Reflect.construct(t,i||[],Ds(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]),Fs(n,"statusSetByModule",!1),Fs(n,"cmi"),Fs(n,"nav"),Fs(n,"LMSInitialize"),Fs(n,"LMSFinish"),Fs(n,"LMSGetValue"),Fs(n,"LMSSetValue"),Fs(n,"LMSCommit"),Fs(n,"LMSGetLastError"),Fs(n,"LMSGetErrorString"),Fs(n,"LMSGetDiagnostic"),n.cmi=new As,n.nav=new Ts,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&&qs(e,t)}(t,e),i=t,n=[{key:"reset",value:function(e,t){var i,n;this.commonReset(e,t),null===(i=this.cmi)||void 0===i||i.reset(),!0===(null==t?void 0:t.resetTotalTime)&&(this.cmi.core.total_time="00:00:00"),null===(n=this.nav)||void 0===n||n.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.isNotInitialized()?this.commit("LMSCommit",!1):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 ys:i&&m(e,"cmi\\.interactions\\.\\d+\\.objectives\\.\\d+")?new ps:!i&&m(e,"cmi\\.interactions\\.\\d+")?new ms: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=f(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 Is(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)?Is(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,Pe),l=this.cmi.core.lesson_status,c=je,d=Ce;l&&(c="completed"===l||"passed"===l?Ae:Ee,"passed"===l?d=we:"failed"===l&&(d=Oe));var v=(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())||{},f={successStatus:d,completionStatus:c,runtimeData:o,totalTimeSeconds:s};return v&&(f.score=v),this.settings.autoPopulateCommitMetadata&&(this.settings.courseId&&(f.courseId=this.settings.courseId),this.settings.scoId&&(f.scoId=this.settings.scoId),this.cmi.core.student_id&&(f.learnerId=this.cmi.core.student_id),this.cmi.core.student_name&&(f.learnerName=this.cmi.core.student_name)),f}},{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),l=parseFloat(this.cmi.student_data.mastery_score);isNaN(s)||isNaN(l)||(this.cmi.core.lesson_status=l>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&&Ps(i.prototype,n),r&&Ps(i,r),t}(pa);Fs(Bs,"_globalLearnerPrefs",null);var Scorm12API=Bs;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 Us(e,t){return Us=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Us(e,t)}function Gs(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ks=Object.defineProperty,Ys=function(e,t,i){return function(e,t,i){return t in e?Ks(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Gs(t))?t+"":t,i)},Ws=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"!==Gs(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"]),Ys(e,"__children",G.student_preference_children),Ys(e,"_audio_level","1"),Ys(e,"_language",""),Ys(e,"_delivery_speed","1"),Ys(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&&Us(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){mn(this._cmi_element+".audio_level",audio_level,Ye)&&pn(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){mn(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(mn(this._cmi_element+".delivery_speed",delivery_speed,Ye)&&pn(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){mn(this._cmi_element+".audio_captioning",audio_captioning,"^-?([0-9]+)$")&&pn(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}(E);function Js(e){return e.replace(/[[\]]/g,"")}function $s(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xs(e,t){if(!t)return[e];if(e.includes(t))return e.split(t);var i=Js(t);if(!i)return[e];var n=RegExp("(?<!\\\\)".concat($s(i)),"g"),r=RegExp("\\\\".concat($s(i)),"g");return e.split(n).map(function(e){return e.replace(r,i)})}function Qs(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=Js(t);if(!r)return[e];var o=RegExp("(?<!\\\\)".concat($s(r))),a=RegExp("\\\\".concat($s(r)),"g"),s=e.split(o),l=(null!==(i=s[0])&&void 0!==i?i:"").replace(a,r);return 1===s.length?[l]:[l,s.slice(1).join(r).replace(a,r)]}function Zs(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 el(e,t,i){return t=rl(t),n=e,!(r=al()?Reflect.construct(t,i||[],rl(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}function tl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function il(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 nl(e,t,i){return nl="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}},nl(e,t,i||e)}function rl(e){return rl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},rl(e)}function ol(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)}function al(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(al=function(){return!!result})()}function sl(e,t){return sl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},sl(e,t)}function ll(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 Zs(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)?Zs(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 cl(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}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)},vl=function(e){function t(){return tl(this,t),el(this,t,[{CMIElement:"cmi.interactions",children:G.interactions_children,errorCode:de.READ_ONLY_ELEMENT,errorClass:oe}])}return ol(t,e),t}(ge),fl=function(e){function t(){var e;return tl(this,t),e=el(this,t,["cmi.interactions.n"]),dl(e,"_id",""),dl(e,"_idIsSet",!1),dl(e,"_type",""),dl(e,"_timestamp",""),dl(e,"_weighting",""),dl(e,"_learner_response",""),dl(e,"_result",""),dl(e,"_latency",""),dl(e,"_description",""),dl(e,"objectives"),dl(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 ol(t,e),il(t,[{key:"initialize",value:function(){var e,i;nl(rl(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);mn(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);mn(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);mn(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);mn(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=Xs(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:"",l="performance"===this.type?Qs(s,t.delimiter2):Xs(s,t.delimiter2);if(2!==(null==l?void 0:l.length))throw new oe(this._cmi_element+".learner_response",de.TYPE_MISMATCH);if("performance"===this.type&&""===l[0]&&""===l[1])throw new oe(this._cmi_element+".learner_response",de.TYPE_MISMATCH);if(!(null===(o=l[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=l[1])||void 0===a?void 0:a.match(RegExp(t.format2))))throw new oe(this._cmi_element+".learner_response",de.TYPE_MISMATCH)}else{var c;if(!(null===(c=e[n])||void 0===c?void 0:c.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){mn(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);mn(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);mn(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}(E),hl=function(e){function t(){var e;return tl(this,t),e=el(this,t,["cmi.interactions.n.objectives.n"]),dl(e,"_id",""),e}return ol(t,e),il(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);mn(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}(E),ml=/^\{(?:lang|case_matters|order_matters)=[^}]+\}/;function pl(e){for(var result=e;ml.test(result);)result=result.replace(ml,"");return result}var yl=function(e){function t(e){var i;return tl(this,t),i=el(this,t,["cmi.interactions.n.correct_responses.n"]),dl(i,"_pattern",""),dl(i,"_interactionType"),i._interactionType=e,i}return ol(t,e),il(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(mn(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?Xs(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 l=e.delimiter?Xs(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(l).size!==l.length)throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH);if(0===l.length||l.length>e.max)throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.GENERAL_SET_FAILURE);var c=RegExp(e.format),u=e.format2?RegExp(e.format2):null,d=function(e){if(!c.test(e))throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH)},v=function(e,t){if(!t)throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH);var i=Xs(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]&&!c.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)},f=!0,h=!1,m=void 0;try{for(var p,y=l[Symbol.iterator]();!(f=(p=y.next()).done);f=!0){var g=p.value;switch(type){case"numeric":if(""===g){if(2>l.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 b=e.delimiter2;if(!b)throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH);var _=Qs(pl(g),b);if(2!==_.length)throw new oe("cmi.interactions.n.correct_responses.n.pattern",de.TYPE_MISMATCH);var S=ll(_,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||!c.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?v(g,e.delimiter2):d(g)}}}catch(e){h=!0,m=e}finally{try{f||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}(E);function gl(e,t,i){return gl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=bl(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},gl(e,t,i||e)}function bl(e){return bl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},bl(e)}function _l(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_l=function(){return!!result})()}function Sl(e,t){return Sl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Sl(e,t)}function wl(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ol=Object.defineProperty,Cl=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=bl(t),n=e,!(r=_l()?Reflect.construct(t,i||[],bl(e).constructor):t.apply(e,i))||"object"!==wl(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?Ol(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==wl(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&&Sl(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){mn(this._cmi_element+".scaled",e,Ye)&&pn(this._cmi_element+".scaled",e,"-1#1")&&(this._scaled=e)}},{key:"getScoreObject",value:function(){var e=gl(bl(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}(Oa);function Al(e,t,i){return t=jl(t),n=e,!(r=Rl()?Reflect.construct(t,i||[],jl(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}function El(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jl(e){return jl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},jl(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&&Ml(e,t)}function Rl(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Rl=function(){return!!result})()}function Ml(e,t){return Ml=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ml(e,t)}function Tl(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Il=Object.defineProperty,Pl=function(e,t,i){return function(e,t,i){return t in e?Il(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Tl(t))?t+"":t,i)},xl=function(e){function t(){return El(this,t),Al(this,t,[{CMIElement:"cmi.comments_from_lms",children:G.comments_children,errorCode:de.READ_ONLY_ELEMENT,errorClass:oe}])}return kl(t,e),t}(ge),Dl=function(e){function t(){return El(this,t),Al(this,t,[{CMIElement:"cmi.comments_from_learner",children:G.comments_children,errorCode:de.READ_ONLY_ELEMENT,errorClass:oe}])}return kl(t,e),t}(ge),Nl=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return El(this,t),e=Al(this,t,["cmi.comments_from_learner.n"]),Pl(e,"_comment",""),Pl(e,"_location",""),Pl(e,"_timestamp",""),Pl(e,"_readOnlyAfterInit"),e._comment="",e._location="",e._timestamp="",e._readOnlyAfterInit=i,e}return kl(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);mn(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);mn(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);mn(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}(E);function ql(e,t,i){return t=Bl(t),n=e,!(r=Hl()?Reflect.construct(t,i||[],Bl(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}function Ll(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zl(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 Fl(e,t,i){return Fl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Bl(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Fl(e,t,i||e)}function Bl(e){return Bl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Bl(e)}function Vl(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)}function Hl(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Hl=function(){return!!result})()}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}var Kl=Object.defineProperty,Yl=function(e,t,i){return function(e,t,i){return t in e?Kl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Gl(t))?t+"":t,i)},Wl=function(e){function t(){return Ll(this,t),ql(this,t,[{CMIElement:"cmi.objectives",children:G.objectives_children,errorCode:de.READ_ONLY_ELEMENT,errorClass:oe}])}return Vl(t,e),zl(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),Jl=function(e){function t(){var e;return Ll(this,t),e=ql(this,t,["cmi.objectives.n"]),Yl(e,"_id",""),Yl(e,"_idIsSet",!1),Yl(e,"_success_status","unknown"),Yl(e,"_completion_status","unknown"),Yl(e,"_progress_measure",""),Yl(e,"_description",""),Yl(e,"score"),e.score=new Cl,e}return Vl(t,e),zl(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;Fl(Bl(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);mn(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);mn(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);mn(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);mn(this._cmi_element+".progress_measure",progress_measure,Ye)&&pn(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);mn(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":Gl(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"===Gl(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}(E);function $l(e){return $l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},$l(e)}function Xl(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Xl=function(){return!!result})()}function Ql(e,t){return Ql=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ql(e,t)}function Zl(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}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":Zl(t))?t+"":t,i)},ic=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=$l(t),n=e,!(r=Xl()?Reflect.construct(t,i||[],$l(e).constructor):t.apply(e,i))||"object"!==Zl(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"]),tc(e,"__version","1.0"),tc(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&&Ql(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}(E);function nc(e){return nc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},nc(e)}function rc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(rc=function(){return!!result})()}function oc(e,t){return oc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},oc(e,t)}function ac(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var sc=Object.defineProperty,lc=function(e,t,i){return function(e,t,i){return t in e?sc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":ac(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=nc(t),n=e,!(r=rc()?Reflect.construct(t,i||[],nc(e).constructor):t.apply(e,i))||"object"!==ac(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"]),lc(e,"_learner_id",""),lc(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&&oc(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}(E);function uc(e){return uc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},uc(e)}function dc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(dc=function(){return!!result})()}function vc(e,t){return vc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},vc(e,t)}function fc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}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(){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=uc(t),n=e,!(r=dc()?Reflect.construct(t,i||[],uc(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}(this,t,["cmi"]),mc(e,"_completion_status","unknown"),mc(e,"_success_status","unknown"),mc(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&&vc(e,t)}(t,e),i=t,(n=[{key:"completion_status",get:function(){return this._completion_status},set:function(completion_status){mn(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){mn(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){mn(this._cmi_element+".progress_measure",progress_measure,Ye)&&pn(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}(E);function yc(e){return yc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},yc(e)}function gc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(gc=function(){return!!result})()}function bc(e,t){return bc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},bc(e,t)}function _c(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Sc=Object.defineProperty,wc=function(e,t,i){return function(e,t,i){return t in e?Sc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":_c(t))?t+"":t,i)},Oc=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=yc(t),n=e,!(r=gc()?Reflect.construct(t,i||[],yc(e).constructor):t.apply(e,i))||"object"!==_c(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"]),wc(e,"_entry",""),wc(e,"_exit",""),wc(e,"_session_time","PT0H0M0S"),wc(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&&bc(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.'),mn(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){mn(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=c(o/1e3)}return t=this._total_time,i=r,n=RegExp(Ke),c(d(t,n)+d(i,n))}},{key:"accumulateSessionTime",value:function(e){this._total_time=this.getCurrentTotalTime(e),this._session_time="PT0H0M0S"}},{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}(E);function Cc(e){return Cc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Cc(e)}function Ac(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ac=function(){return!!result})()}function Ec(e,t){return Ec=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ec(e,t)}function jc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var kc=Object.defineProperty,Rc=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":jc(t))?t+"":t,i)},Mc=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=Cc(t),n=e,!(r=Ac()?Reflect.construct(t,i||[],Cc(e).constructor):t.apply(e,i))||"object"!==jc(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"]),Rc(e,"_location",""),Rc(e,"_launch_data",""),Rc(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&&Ec(e,t)}(t,e),i=t,(n=[{key:"location",get:function(){return this._location},set:function(location){mn(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){mn(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}(E);function Tc(e){return Tc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Tc(e)}function Ic(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ic=function(){return!!result})()}function Pc(e,t){return Pc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Pc(e,t)}function xc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Dc=Object.defineProperty,Nc=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":xc(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=Tc(t),n=e,!(r=Ic()?Reflect.construct(t,i||[],Tc(e).constructor):t.apply(e,i))||"object"!==xc(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"]),Nc(e,"_credit","credit"),Nc(e,"_mode","normal"),Nc(e,"_time_limit_action","continue,no message"),Nc(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&&Pc(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}(E);function Lc(e){return Lc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Lc(e)}function zc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(zc=function(){return!!result})()}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}var Vc=Object.defineProperty,Hc=function(e,t,i){return function(e,t,i){return t in e?Vc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Bc(t))?t+"":t,i)},Uc=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=Lc(t),n=e,!(r=zc()?Reflect.construct(t,i||[],Lc(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"]),Hc(e,"_scaled_passing_score",""),Hc(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&&Fc(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}(E);function Gc(e,t,i){return Gc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Kc(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Gc(e,t,i||e)}function Kc(e){return Kc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Kc(e)}function Yc(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Yc=function(){return!!result})()}function Wc(e,t){return Wc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Wc(e,t)}function Jc(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}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":Jc(t))?t+"":t,i)},Qc=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=Kc(t),n=e,!(r=Yc()?Reflect.construct(t,i||[],Kc(e).constructor):t.apply(e,i))||"object"!==Jc(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,"metadata"),Xc(e,"learner"),Xc(e,"status"),Xc(e,"session"),Xc(e,"content"),Xc(e,"settings"),Xc(e,"thresholds"),Xc(e,"learner_preference"),Xc(e,"score"),Xc(e,"comments_from_learner"),Xc(e,"comments_from_lms"),Xc(e,"interactions"),Xc(e,"objectives"),e.metadata=new ic,e.learner=new cc,e.status=new pc,e.session=new Oc,e.content=new Mc,e.settings=new qc,e.thresholds=new Uc,e.learner_preference=new Ws,e.score=new Cl,e.comments_from_learner=new Dl,e.comments_from_lms=new xl,e.interactions=new vl,e.objectives=new Wl,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&&Wc(e,t)}(t,e),i=t,(n=[{key:"initialize",value:function(){var e,i,n,r,o,a,s,l,c,u,d,v,f;Gc(Kc(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===(l=this.learner_preference)||void 0===l||l.initialize(),null===(c=this.score)||void 0===c||c.initialize(),null===(u=this.comments_from_learner)||void 0===u||u.initialize(),null===(d=this.comments_from_lms)||void 0===d||d.initialize(),null===(v=this.interactions)||void 0===v||v.initialize(),null===(f=this.objectives)||void 0===f||f.initialize()}},{key:"reset",value:function(){var e,t,i,n,r,o,a,s,l,c,u,d,v;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===(l=this.interactions)||void 0===l||l.reset(!0),null===(c=this.score)||void 0===c||c.reset(),null===(u=this.comments_from_learner)||void 0===u||u.reset(),null===(d=this.comments_from_lms)||void 0===d||d.reset(),null===(v=this.learner_preference)||void 0===v||v.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:"accumulateSessionTime",value:function(){this.session.accumulateSessionTime(this.start_time),void 0!==this._start_time&&(this._start_time=(new Date).getTime())}},{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}(j);function Zc(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=ou(t),n=e,!(r=su()?Reflect.construct(t,i||[],ou(e).constructor):t.apply(e,i))||"object"!==du(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 tu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iu(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 nu(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ru(e,t,i){return ru="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ou(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},ru(e,t,i||e)}function ou(e){return ou=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ou(e)}function au(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&&cu(e,t)}function su(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(su=function(){return!!result})()}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){nu(e,t,i[t])})}return e}function cu(e,t){return cu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},cu(e,t)}function uu(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 Zc(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)?Zc(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 du(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var vu=Object.defineProperty,fu=function(e,t,i){return function(e,t,i){return t in e?vu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":du(t))?t+"":t,i)},hu=function(e){function t(){var e;return tu(this,t),e=eu(this,t,["adl"]),fu(e,"nav"),fu(e,"data",new pu),fu(e,"_sequencing",null),fu(e,"_sharedDataStores",Object.create(null)),e.nav=new mu,e.data=new pu,e}return au(t,e),iu(t,[{key:"initialize",value:function(){var e,i;ru(ou(t.prototype),"initialize",this).call(this),null===(e=this.nav)||void 0===e||e.initialize(),null===(i=this.data)||void 0===i||i.initialize()}},{key:"reset",value:function(){var e,t;this._initialized=!1,null===(e=this.nav)||void 0===e||e.reset(),null===(t=this.data)||void 0===t||t.reset()}},{key:"configureSharedDataMaps",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.captureVisibleSharedData(),this.data.configure(e,this._sharedDataStores)}},{key:"captureSharedDataSnapshot",value:function(){return this.captureVisibleSharedData(),lu({},this._sharedDataStores)}},{key:"captureWritableSharedDataSnapshot",value:function(){this.captureVisibleSharedData();var e={},t=!0,i=!1,n=void 0;try{for(var r,o=this.data.childArray[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value;a.id&&a.storeIsSet&&a.writeSharedData&&(e[a.id]=a.storeValue)}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return e}},{key:"restoreSharedDataSnapshot",value:function(e){if(e&&"object"===(void 0===e?"undefined":du(e))){var t=!0,i=!1,n=void 0;try{for(var r,o=Object.keys(this._sharedDataStores)[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)delete this._sharedDataStores[r.value]}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}var a=!0,s=!1,l=void 0;try{for(var c,u=Object.entries(e)[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var d=uu(c.value,2),v=d[0],f=d[1];"string"==typeof v&&"string"==typeof f&&(this._sharedDataStores[v]=f)}}catch(e){s=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw l}}this.data.refreshStores(this._sharedDataStores)}}},{key:"isConfiguredSharedDataElement",value:function(e){return this.data.isConfiguredElement(e)}},{key:"captureVisibleSharedData",value:function(){var e=!0,t=!1,i=void 0;try{for(var n,r=this.data.childArray[Symbol.iterator]();!(e=(n=r.next()).done);e=!0){var o=n.value;o.id&&o.storeIsSet&&(this._sharedDataStores[o.id]=o.storeValue)}}catch(e){t=!0,i=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw i}}}},{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}(E),mu=function(e){function t(){var e;return tu(this,t),e=eu(this,t,["adl.nav"]),fu(e,"_request","_none_"),fu(e,"_sequencing",null),fu(e,"request_valid"),e.request_valid=new _u,e.request_valid.setParentNav(e),e}return au(t,e),iu(t,[{key:"sequencing",get:function(){return this._sequencing},set:function(e){this._sequencing=e}},{key:"initialize",value:function(){var e;ru(ou(t.prototype),"initialize",this).call(this),"function"==typeof(null===(e=this.request_valid)||void 0===e?void 0:e.initialize)&&this.request_valid.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){mn(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}(E),pu=function(e){function t(){return tu(this,t),eu(this,t,[{CMIElement:"adl.data",children:G.adl_data_children,errorCode:de.READ_ONLY_ELEMENT,errorClass:oe}])}return au(t,e),iu(t,[{key:"initialize",value:function(){ru(ou(t.prototype),"initialize",this).call(this);var e=!0,i=!1,n=void 0;try{for(var r,o=this.childArray[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(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._initialized=!1,e)this.childArray=[];else{var t=!0,i=!1,n=void 0;try{for(var r,o=this.childArray[Symbol.iterator]();!(t=(r=o.next()).done);t=!0)r.value.deinitialize()}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}}},{key:"configure",value:function(e,t){var i=this;this.childArray=e.map(function(e){var n=new yu,r={}.hasOwnProperty.call(t,e.targetID);return n.configure(e.targetID,r?t[e.targetID]:"",e.readSharedData,e.writeSharedData,r,function(i){t[e.targetID]=i}),i.initialized&&n.initialize(),n})}},{key:"refreshStores",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=this.childArray[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var a=r.value,s={}.hasOwnProperty.call(e,a.id);a.refreshStore(s?e[a.id]:"",s)}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"isConfiguredElement",value:function(e){var t=/^adl\.data\.(\d+)\.store$/.exec(e);if(!t)return!1;var i=+t[1];return Number.isInteger(i)&&i>=0&&this.childArray.length>i}}]),t}(ge),yu=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return tu(this,t),e=eu(this,t,["adl.data.n"]),fu(e,"_id",""),fu(e,"_store",""),fu(e,"_idIsSet",!1),fu(e,"_storeIsSet",!1),fu(e,"_readSharedData",!0),fu(e,"_writeSharedData",!0),fu(e,"_onStoreChange",null),fu(e,"_allowStoreWithoutId"),e._allowStoreWithoutId=i,e}return au(t,e),iu(t,[{key:"reset",value:function(){this._initialized=!1,this._idIsSet=!1,this._storeIsSet=!1}},{key:"configure",value:function(id,e,t,i,n,r){this._id=id,this._store=null!=e?e:"",this._idIsSet=!0,this._storeIsSet=n,this._readSharedData=t,this._writeSharedData=i,this._onStoreChange=r}},{key:"refreshStore",value:function(e,t){this._store=e,this._storeIsSet=t}},{key:"deinitialize",value:function(){this._initialized=!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);mn(this._cmi_element+".id",id,Je)&&(this._id=id,this._idIsSet=!0)}},{key:"store",get:function(){if(this.initialized&&!this._readSharedData)throw new oe(this._cmi_element+".store",de.WRITE_ONLY_ELEMENT);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._writeSharedData)throw new oe(this._cmi_element+".store",de.READ_ONLY_ELEMENT);if(this.initialized&&!this._allowStoreWithoutId&&!this._idIsSet)throw new oe(this._cmi_element+".store",de.DEPENDENCY_NOT_ESTABLISHED);var t;mn(this._cmi_element+".store",e,Be,!0)&&(this._store=e,this._storeIsSet=!0,null===(t=this._onStoreChange)||void 0===t||t.call(this,e))}},{key:"storeValue",get:function(){return this._store}},{key:"storeIsSet",get:function(){return this._storeIsSet}},{key:"writeSharedData",get:function(){return this._writeSharedData}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this._id,store:this._store};return this.jsonString=!1,result}}]),t}(E),gu=function(){function e(){tu(this,e),fu(this,"_parentNav",null),fu(this,"_staticValues",{})}return iu(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===_e?"true":r===Se?"false":"unknown"}},{key:"getAll",value:function(){return lu({},this._staticValues)}},{key:"setAll",value:function(e){this._staticValues=lu({},e)}}]),e}(),bu=function(){function e(){tu(this,e),fu(this,"_parentNav",null),fu(this,"_staticValues",{})}return iu(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===_e?"true":n===Se?"false":"unknown"}},{key:"getAll",value:function(){return lu({},this._staticValues)}},{key:"setAll",value:function(e){this._staticValues=lu({},e)}}]),e}(),_u=function(e){function t(){var e;return tu(this,t),e=eu(this,t,["adl.nav.request_valid"]),fu(e,"_continue","unknown"),fu(e,"_previous","unknown"),fu(e,"_choice"),fu(e,"_jump"),fu(e,"_exit","unknown"),fu(e,"_exitAll","unknown"),fu(e,"_abandon","unknown"),fu(e,"_abandonAll","unknown"),fu(e,"_suspendAll","unknown"),fu(e,"_parentNav",null),e._choice=new gu,e._jump=new bu,e}return au(t,e),iu(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);mn(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);mn(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":du(e)))throw new oe(this._cmi_element+".choice",de.TYPE_MISMATCH);var t={};for(var i in e)if({}.hasOwnProperty.call(e,i)&&mn(this._cmi_element+".choice."+i,e[i]||"",Ze)&&mn(this._cmi_element+".choice."+i,i,et)){var n=e[i];"true"===n?t[i]=_e:"false"===n?t[i]=Se:"unknown"===n&&(t[i]=be)}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":du(e)))throw new oe(this._cmi_element+".jump",de.TYPE_MISMATCH);var t={};for(var i in e)if({}.hasOwnProperty.call(e,i)&&mn(this._cmi_element+".jump."+i,e[i]||"",Ze)&&mn(this._cmi_element+".jump."+i,i,et)){var n=e[i];"true"===n?t[i]=_e:"false"===n?t[i]=Se:"unknown"===n&&(t[i]=be)}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);mn(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);mn(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);mn(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);mn(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);mn(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}(E);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,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ou(e,t,i){return Ou="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Cu(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},Ou(e,t,i||e)}function Cu(e){return Cu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Cu(e)}function Au(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Eu(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Eu=function(){return!!result})()}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){wu(e,t,i[t])})}return e}function ku(e,t){return ku=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ku(e,t)}function Ru(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.")}()}function Mu(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Tu=Object.defineProperty,Iu=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)},Pu=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=Cu(t),n=e,!(r=Eu()?Reflect.construct(t,i||[],Cu(e).constructor):t.apply(e,i))||"object"!==Mu(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"]),Iu(e,"_activityTree"),Iu(e,"_sequencingRules"),Iu(e,"_sequencingControls"),Iu(e,"_rollupRules"),Iu(e,"_adlNav",null),Iu(e,"_hideLmsUi",[]),Iu(e,"_auxiliaryResources",[]),Iu(e,"_overallSequencingProcess",null),e._activityTree=new xo,e._sequencingRules=new Mt,e._sequencingControls=new ii,e._rollupRules=new Pn,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&&ku(e,t)}(t,e),i=t,(n=[{key:"initialize",value:function(){Ou(Cu(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(!Au(e,xo))throw new oe(this._cmi_element+".activityTree",de.TYPE_MISMATCH);this._activityTree=e}},{key:"sequencingRules",get:function(){return this._sequencingRules},set:function(e){if(!Au(e,Mt))throw new oe(this._cmi_element+".sequencingRules",de.TYPE_MISMATCH);this._sequencingRules=e}},{key:"sequencingControls",get:function(){return this._sequencingControls},set:function(e){if(!Au(e,ii))throw new oe(this._cmi_element+".sequencingControls",de.TYPE_MISMATCH);this._sequencingControls=e}},{key:"hideLmsUi",get:function(){return Ru(this._hideLmsUi)},set:function(e){this._hideLmsUi=Ru(e)}},{key:"auxiliaryResources",get:function(){return this._auxiliaryResources.map(function(e){return ju({},e)})},set:function(e){this._auxiliaryResources=e.map(function(e){return ju({},e)})}},{key:"rollupRules",get:function(){return this._rollupRules},set:function(e){if(!Au(e,Pn))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}(E);var xu=Object.defineProperty,Du=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?xu(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=Xs(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,l,c="performance"===t?Qs(i[a],r.delimiter2):Xs(i[a],r.delimiter2);2===c.length?"performance"===t&&""===c[0]&&""===c[1]?this.context.throwSCORMError(e,de.TYPE_MISMATCH,"".concat(t,": ").concat(n)):(null===(s=c[0])||void 0===s?void 0:s.match(o))&&r.format2&&(null===(l=c[1])||void 0===l?void 0:l.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 l;switch(s[2]){case"lang":if(i=t.match("^(({lang=([a-zA-Z]{1,8}|i|x)?(-[a-zA-Z0-9-]{2,8})?}))(.*?)$")){var c=i[3];void 0!==c&&c.length>0&&(at.includes(c.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===(l=s[1])||void 0===l?void 0:l.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 Nu=Object.defineProperty,qu=function(e,t,i){return function(e,t,i){return t in e?Nu(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)},Lu=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),qu(this,"context"),qu(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 Jl;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 hl}else if(m(e,"cmi\\.interactions\\.\\d+"))return new fl;return m(e,"cmi\\.comments_from_learner\\.\\d+")?new Nl:m(e,"cmi\\.comments_from_lms\\.\\d+")?new Nl(!0):m(e,"adl\\.data\\.\\d+")?new yu(!0):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 yl(null==n?void 0:n.type):null}},{key:"evaluateCompletionStatus",value:function(){return Rr({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 zu(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 Fu(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}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){Fu(e,t,i[t])})}return e}function Vu(e){return function(e){if(Array.isArray(e))return zu(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Hu(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 Hu(e,t){if(e){if("string"==typeof e)return zu(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)?zu(e,t):void 0}}var Uu=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 l=!0,c=!1,u=void 0;try{for(var d,v=t.exitConditionRules[Symbol.iterator]();!(l=(d=v.next()).done);l=!0){var f=this.createSequencingRule(d.value);e.addExitConditionRule(f)}}catch(e){c=!0,u=e}finally{try{l||null==v.return||v.return()}finally{if(c)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 b=this.createSequencingRule(y.value);e.addPostConditionRule(b)}}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 Rt(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,l=new kt(s.condition,s.operator,new Map(Object.entries(s.parameters||{})));s.referencedObjective&&(l.referencedObjective=s.referencedObjective),t.addCondition(l)}}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 In(e.action,e.consideration,e.minimumCount,e.minimumPercent,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,l=new Tn(s.condition,new Map(Object.entries(s.parameters||{})),s.operator);t.addCondition(l)}}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=Array.isArray(e)?e.map(function(e){var t;return[null!==(t=e.id)&&void 0!==t?t:"",e]}):Object.entries(e),n=!0,r=!1,o=void 0;try{for(var a,s,l=function(){var e,i,n=(i=2,function(e){if(Array.isArray(e))return e}(e=s.value)||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,i)||Hu(e,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],o=n[0].trim();if(!o)return"continue";var l,c={},u=function(e){if(e){var t=Bu({},e);return e.mapInfo&&(t.mapInfo=e.mapInfo.map(function(e){return Bu({},e)})),t}},d=u(r.primaryObjective);if(d&&(c.primaryObjective=d),r.objectives&&(c.objectives=r.objectives.map(function(e){return u(e)}).filter(function(e){return void 0!==e})),r.sequencingControls&&(c.sequencingControls=Bu({},r.sequencingControls)),r.sequencingRules){var v=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=Bu({},e.parameters)),void 0!==e.referencedObjective&&(t.referencedObjective=e.referencedObjective),t})};return void 0!==e.conditionCombination&&(t.conditionCombination=e.conditionCombination),t};c.sequencingRules={},r.sequencingRules.preConditionRules&&(c.sequencingRules.preConditionRules=r.sequencingRules.preConditionRules.map(v)),r.sequencingRules.exitConditionRules&&(c.sequencingRules.exitConditionRules=r.sequencingRules.exitConditionRules.map(v)),r.sequencingRules.postConditionRules&&(c.sequencingRules.postConditionRules=r.sequencingRules.postConditionRules.map(v))}r.rollupRules&&(c.rollupRules={rules:null===(l=r.rollupRules.rules)||void 0===l?void 0:l.map(function(e){var t={action:e.action,conditions:e.conditions.map(function(e){var t={condition:e.condition};return e.parameters&&(t.parameters=Bu({},e.parameters)),void 0!==e.operator&&(t.operator=e.operator),t})};return void 0!==e.conditionCombination&&(t.conditionCombination=e.conditionCombination),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})}),r.rollupConsiderations&&(c.rollupConsiderations=Bu({},r.rollupConsiderations)),r.selectionRandomizationState&&(c.selectionRandomizationState=a.cloneSelectionRandomizationState(r.selectionRandomizationState)),r.hideLmsUi&&(c.hideLmsUi=a.sanitizeHideLmsUi(r.hideLmsUi)),r.auxiliaryResources&&(c.auxiliaryResources=a.sanitizeAuxiliaryResources(r.auxiliaryResources)),t[o]=c},c=i[Symbol.iterator]();!(n=(s=c.next()).done);n=!0)a=this,l()}catch(e){r=!0,o=e}finally{try{n||null==c.return||c.return()}finally{if(r)throw o}}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 l=a.value.trim();l&&!i.has(l)&&(i.add(l),result.push(l))}}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){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t){if(t.sequencingControls&&this.applySequencingControlsSettings(e.sequencingControls,t.sequencingControls),t.sequencingRules&&!n&&this.applySequencingRulesSettings(e.sequencingRules,t.sequencingRules),t.rollupRules&&this.applyRollupRulesSettings(e.rollupRules,t.rollupRules),t.rollupConsiderations&&e.applyRollupConsiderations(t.rollupConsiderations),t.hideLmsUi){var r=this.mergeHideLmsUi(e.hideLmsUi,t.hideLmsUi);r.length>0&&(e.hideLmsUi=r)}if(t.auxiliaryResources){var o=this.sanitizeAuxiliaryResources(t.auxiliaryResources);o.length>0&&(e.auxiliaryResources=this.mergeAuxiliaryResources(e.auxiliaryResources,o))}t.selectionRandomizationState&&i.push(this.cloneSelectionRandomizationState(t.selectionRandomizationState))}}},{key:"sanitizeHideLmsUi",value:function(e){if(!e)return[];var t=new Set(ut),i=new Set,n=[],r=!0,o=!1,a=void 0;try{for(var s,l=e[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value;t.has(c)&&!i.has(c)&&(i.add(c),n.push(c))}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}return n}},{key:"mergeHideLmsUi",value:function(e,t){return t&&0!==t.length?this.sanitizeHideLmsUi(Vu(e).concat(Vu(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 l=a.value;if(l&&l.resourceId&&"string"==typeof l.resourceId&&l.purpose&&"string"==typeof l.purpose){var c=l.resourceId.trim(),u=l.purpose.trim();if(c&&u){var d="".concat(c,"::").concat(u);t.has(d)||(t.add(d),i.push({resourceId:c,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,l=Vu(null!=e?e:[]).concat(Vu(null!=t?t:[]))[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value;if(c){var u=c.resourceId;u&&!n.has(u)&&(n.add(u),i.push({resourceId:u,purpose:c.purpose}))}}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}return i}},{key:"cloneSelectionRandomizationState",value:function(e){var t={};return e.childOrder&&(t.childOrder=Vu(e.childOrder)),e.selectedChildIds&&(t.selectedChildIds=Vu(e.selectedChildIds)),e.hiddenFromChoiceChildIds&&(t.hiddenFromChoiceChildIds=Vu(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,l=void 0;try{for(var c,u=e.children[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var d=c.value;if(n){var v=n.has(d.id);d.isAvailable=v,r||(d.isHiddenFromChoice=!v),o=!0}r&&(d.isHiddenFromChoice=r.has(d.id),o=!0)}}catch(e){s=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw l}}}(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}))}}],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 Gu(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 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)||Ju(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 Wu(e){return function(e){if(Array.isArray(e))return Gu(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ju(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 Ju(e,t){if(e){if("string"==typeof e)return Gu(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)?Gu(e,t):void 0}}var $u=Object.defineProperty,Xu=function(e,t,i){return function(e,t,i){return t in e?$u(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)},Qu=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Xu(this,"sequencingCollections"),Xu(this,"sequencingConfigBuilder"),this.sequencingCollections=t||{},this.sequencingConfigBuilder=i||new Uu}return t=e,i=[{key:"setSequencingCollections",value:function(e){this.sequencingCollections=e}},{key:"createActivity",value:function(e){var t,i,n=new Jn(e.id,e.title),r=[],o=this.sequencingConfigBuilder.normalizeCollectionRefs(null!==(t=e.sequencingCollectionRefs)&&void 0!==t?t:e.sequencingIdRef),a=new Map,s=null,l=function(e,t){var i,n,r,o,l,c=null!==(i=null==e?void 0:e.objectiveID)&&void 0!==i?i:null==e?void 0:e.id;if(e&&c){var u=a.get(c);a.set(c,(o=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){Ku(e,t,i[t])})}return e}({},u,e),l=null!=(l={objectiveID:c,mapInfo:Wu(null!==(n=null==u?void 0:u.mapInfo)&&void 0!==n?n:[]).concat(Wu(null!==(r=e.mapInfo)&&void 0!==r?r:[]))})?l:{},Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(l)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t.push.apply(t,i)}return t}(Object(l)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(l,e))}),o)),t&&(s=c)}},c=!0,u=!1,d=void 0;try{for(var v,f=o[Symbol.iterator]();!(c=(v=f.next()).done);c=!0){var h=this.sequencingCollections[v.value];if(h){var m;this.sequencingConfigBuilder.applySequencingCollection(n,h,r,void 0!==e.sequencingRules),l(h.primaryObjective,!0);var p=!0,y=!1,g=void 0;try{for(var b,_=(null!==(m=h.objectives)&&void 0!==m?m:[])[Symbol.iterator]();!(p=(b=_.next()).done);p=!0){var S=b.value;l(S,!0===S.isPrimary)}}catch(e){y=!0,g=e}finally{try{p||null==_.return||_.return()}finally{if(y)throw g}}}}}catch(e){u=!0,d=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw d}}void 0!==e.isVisible&&(n.isVisible=e.isVisible),void 0!==e.isActive&&(n.isActive=e.isActive),void 0!==e.isSuspended&&(n.isSuspended=e.isSuspended),void 0!==e.isCompleted&&(n.isCompleted=e.isCompleted),void 0!==e.isHiddenFromChoice&&(n.isHiddenFromChoice=e.isHiddenFromChoice),void 0!==e.isAvailable&&(n.isAvailable=e.isAvailable),void 0!==e.attemptLimit&&(n.attemptLimit=e.attemptLimit),void 0!==e.attemptAbsoluteDurationLimit&&(n.attemptAbsoluteDurationLimit=e.attemptAbsoluteDurationLimit),void 0!==e.activityAbsoluteDurationLimit&&(n.activityAbsoluteDurationLimit=e.activityAbsoluteDurationLimit),void 0!==e.timeLimitAction&&(n.timeLimitAction=e.timeLimitAction),void 0!==e.timeLimitDuration&&(n.timeLimitDuration=e.timeLimitDuration),void 0!==e.beginTimeLimit&&(n.beginTimeLimit=e.beginTimeLimit),void 0!==e.endTimeLimit&&(n.endTimeLimit=e.endTimeLimit),l(e.primaryObjective,!0);var w=!0,O=!1,C=void 0;try{for(var A,E=(null!==(i=e.objectives)&&void 0!==i?i:[])[Symbol.iterator]();!(w=(A=E.next()).done);w=!0){var j=A.value;l(j,!0===j.isPrimary)}}catch(e){O=!0,C=e}finally{try{w||null==E.return||E.return()}finally{if(O)throw C}}if(s){var k=a.get(s);if(k){var R=this.createActivityObjectiveFromSettings(k,!0);n.primaryObjective=R,null!==R.minNormalizedMeasure&&(n.scaledPassingScore=R.minNormalizedMeasure)}}var M=!0,T=!1,I=void 0;try{for(var P,x=a[Symbol.iterator]();!(M=(P=x.next()).done);M=!0){var D=Yu(P.value,2);D[0]!==s&&n.addObjective(this.createActivityObjectiveFromSettings(D[1],!1))}}catch(e){T=!0,I=e}finally{try{M||null==x.return||x.return()}finally{if(T)throw I}}if(e.sequencingControls&&this.sequencingConfigBuilder.applySequencingControlsSettings(n.sequencingControls,e.sequencingControls),e.deliveryControls&&this.sequencingConfigBuilder.applySequencingControlsSettings(n.sequencingControls,e.deliveryControls),e.sequencingRules&&this.sequencingConfigBuilder.applySequencingRulesSettings(n.sequencingRules,e.sequencingRules),e.rollupRules&&this.sequencingConfigBuilder.applyRollupRulesSettings(n.rollupRules,e.rollupRules),e.rollupConsiderations&&n.applyRollupConsiderations(e.rollupConsiderations),e.completionThreshold){var N=e.completionThreshold;void 0!==N.completedByMeasure&&(n.completedByMeasure=N.completedByMeasure),void 0!==N.minProgressMeasure&&(n.minProgressMeasure=N.minProgressMeasure),n.completedByMeasure&&(n.completionThreshold=""+n.minProgressMeasure),void 0!==N.progressWeight&&(n.progressWeight=N.progressWeight)}if(e.hideLmsUi){var q=this.sequencingConfigBuilder.mergeHideLmsUi(n.hideLmsUi,e.hideLmsUi);q.length>0&&(n.hideLmsUi=q)}if(e.auxiliaryResources){var L=this.sequencingConfigBuilder.sanitizeAuxiliaryResources(e.auxiliaryResources);L.length>0&&(n.auxiliaryResources=this.sequencingConfigBuilder.mergeAuxiliaryResources(n.auxiliaryResources,L))}if(e.sharedDataMaps&&(n.sharedDataMaps=e.sharedDataMaps.map(function(e){var t,i;return{targetID:e.targetID,readSharedData:null===(t=e.readSharedData)||void 0===t||t,writeSharedData:null!==(i=e.writeSharedData)&&void 0!==i&&i}})),e.children){var z=!0,F=!1,B=void 0;try{for(var V,H=e.children[Symbol.iterator]();!(z=(V=H.next()).done);z=!0){var U=this.createActivity(V.value);n.addChild(U)}}catch(e){F=!0,B=e}finally{try{z||null==H.return||H.return()}finally{if(F)throw B}}}e.selectionRandomizationState&&r.push(this.sequencingConfigBuilder.cloneSelectionRandomizationState(e.selectionRandomizationState));var G=!0,K=!1,Y=void 0;try{for(var W,J=r[Symbol.iterator]();!(G=(W=J.next()).done);G=!0)this.sequencingConfigBuilder.applySelectionRandomizationState(n,W.value)}catch(e){K=!0,Y=e}finally{try{G||null==J.return||J.return()}finally{if(K)throw Y}}return n}},{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,l,c,u,d,v,f,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!==(l=e.writeProgressMeasure)&&void 0!==l&&l,readRawScore:null===(c=e.readRawScore)||void 0===c||c,writeRawScore:null!==(u=e.writeRawScore)&&void 0!==u&&u,readMinScore:null===(d=e.readMinScore)||void 0===d||d,writeMinScore:null!==(v=e.writeMinScore)&&void 0!==v&&v,readMaxScore:null===(f=e.readMaxScore)||void 0===f||f,writeMaxScore:null!==(h=e.writeMaxScore)&&void 0!==h&&h,updateAttemptData:null!==(m=e.updateAttemptData)&&void 0!==m&&m}});return new Wn(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})}}],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 Zu(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 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){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 nd(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 rd(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 Zu(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)?Zu(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 od(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}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":od(t))?t+"":t,i)},ld=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),sd(this,"_globalObjectives",[]),sd(this,"context"),sd(this,"hostDeclaredGlobalObjectiveIds"),this.context=t,this.hostDeclaredGlobalObjectiveIds=new Set(t.hostDeclaredGlobalObjectiveIds)}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:"isHostDeclaredGlobalObjectiveId",value:function(e){return this.hostDeclaredGlobalObjectiveIds.has(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(){var e;if(0!==this._globalObjectives.length)for(var t=!!(null===(e=this.context.sequencing)||void 0===e?void 0:e.getCurrentActivity()),i=0;this._globalObjectives.length>i;i++){var n=this._globalObjectives[i];if(n&&n.id&&(!t||this.hostDeclaredGlobalObjectiveIds.has(n.id))&&!this.context.cmi.objectives.findObjectiveById(n.id)){var r=this.context.cmi.objectives.childArray.length;this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(r,".id"),n.id),n.success_status&&"unknown"!==n.success_status&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(r,".success_status"),n.success_status),n.completion_status&&"unknown"!==n.completion_status&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(r,".completion_status"),n.completion_status),""!==n.score.scaled&&null!==n.score.scaled&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(r,".score.scaled"),n.score.scaled),""!==n.score.raw&&null!==n.score.raw&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(r,".score.raw"),n.score.raw),""!==n.score.min&&null!==n.score.min&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(r,".score.min"),n.score.min),""!==n.score.max&&null!==n.score.max&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(r,".score.max"),n.score.max),""!==n.progress_measure&&null!==n.progress_measure&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(r,".progress_measure"),n.progress_measure),""!==n.description&&this.context.commonSetCMIValue("RestoreGlobalObjective",!0,"cmi.objectives.".concat(r,".description"),n.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 l=this.parseObjectiveNumber(null===(i=t.score)||void 0===i?void 0:i.scaled);null!==l&&(s.normalizedMeasure=l,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 c=this.parseObjectiveNumber(t.progress_measure);null!==c&&(s.progressMeasure=c,s.progressMeasureKnown=!0),t.completion_status&&t.completion_status!==je&&(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!==je&&(entry.completionStatus=e.completion_status,entry.completionStatusKnown=!0),entry}},{key:"buildCMIObjectivesFromMap",value:function(e){var objectives=[];if(!e||"object"!==(void 0===e?"undefined":od(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=rd(r.value,2),l=s[0],entry=s[1];if(entry&&"object"===(void 0===entry?"undefined":od(entry))){var c=new Jl;c.id=null!==(a=entry.id)&&void 0!==a?a:l,!0===entry.satisfiedStatusKnown&&(c.success_status=entry.satisfiedStatus?we:Oe);var u,d,v,f=this.parseObjectiveNumber(entry.normalizedMeasure);!0===entry.normalizedMeasureKnown&&null!==f&&(c.score.scaled=f+""),!0===entry.rawScoreKnown&&(c.score.raw=(null!==(u=entry.rawScore)&&void 0!==u?u:"")+""),!0===entry.minScoreKnown&&(c.score.min=(null!==(d=entry.minScore)&&void 0!==d?d:"")+""),!0===entry.maxScoreKnown&&(c.score.max=(null!==(v=entry.maxScore)&&void 0!==v?v:"")+"");var h=this.parseObjectiveNumber(entry.progressMeasure);!0===entry.progressMeasureKnown&&null!==h&&(c.progress_measure=h+""),!0===entry.completionStatusKnown&&"string"==typeof entry.completionStatus&&(c.completion_status=entry.completionStatus),objectives.push(c)}}}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 Jl;if(!e||"object"!==(void 0===e?"undefined":od(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":od(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,l=void 0;try{for(var c,u=Object.entries(o)[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var d=rd(c.value,2);n[d[0]]=td({},d[1])}}catch(e){s=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(s)throw l}}}var v=!0,f=!1,h=void 0;try{for(var m,p=this._globalObjectives[Symbol.iterator]();!(v=(m=p.next()).done);v=!0){var y=m.value;y.id&&!n[y.id]&&(n[y.id]=this.buildObjectiveMapEntryFromCMI(y))}}catch(e){f=!0,h=e}finally{try{v||null==p.return||p.return()}finally{if(f)throw h}}return n}},{key:"restoreGlobalObjectiveSnapshot",value:function(e){var t,i;if(e&&"object"===(void 0===e?"undefined":od(e))){var n=null!==(t=null===(i=this.context.sequencingService)||void 0===i?void 0:i.getOverallSequencingProcess())&&void 0!==t?t:null;if(n){var r=!0,o=!1,a=void 0;try{for(var s,l=Object.entries(e)[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c,u=rd(s.value,2),d=u[0],v=u[1];d&&v&&"object"===(void 0===v?"undefined":od(v))&&n.updateGlobalObjective(d,nd(td({},v),{id:null!==(c=v.id)&&void 0!==c?c:d}))}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}n.synchronizeGlobalObjectives()}this._globalObjectives=this.buildCMIObjectivesFromMap(e)}}},{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,o=!0===r.satisfiedByMeasure;if(o||t===Ce||(r.satisfiedStatus=t===we,r.satisfiedStatusKnown=!0,n.objectiveSatisfiedStatus=t===we,n.objectiveSatisfiedStatusKnown=!0),e!==je&&(r.completionStatus=e),void 0!==(null==i?void 0:i.scaled)&&null!==i.scaled&&Number.isFinite(i.scaled)){var a=i.scaled;if(r.normalizedMeasure=a,r.measureStatus=!0,o){var s,l=a>=(null!==(s=r.minNormalizedMeasure)&&void 0!==s?s:1);r.satisfiedStatus=l,r.satisfiedStatusKnown=!0,n.objectiveSatisfiedStatus=l,n.objectiveSatisfiedStatusKnown=!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 Jl;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 cd(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}function ud(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){cd(o,n,r,a,s,"next",e)}function s(e){cd(o,n,r,a,s,"throw",e)}a(void 0)})}}function dd(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function vd(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function fd(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){dd(e,t,i[t])})}return e}function hd(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:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){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,l])}}}function md(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var pd=Object.defineProperty,yd=function(e,t,i){return function(e,t,i){return t in e?pd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":md(t))?t+"":t,i)},gd=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),yd(this,"context"),yd(this,"globalObjectiveManager"),yd(this,"inFlightLoads",new Map),this.context=t,this.globalObjectiveManager=i}return t=e,(i=[{key:"saveSequencingState",value:function(e){return ud(function(){var t,i,n,r,o,a,s;return hd(this,function(l){switch(l.label){case 0:if(!(t=this.context.getSettings()).sequencingStatePersistence)return this.context.apiLog("saveSequencingState","No persistence configuration provided",ke.WARN),[2,!1];l.label=1;case 1:if(l.trys.push([1,3,,4]),i=this.serializeSequencingState(),n=fd({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=l.sent(),r.debugPersistence&&this.context.apiLog("saveSequencingState","State save ".concat(a?"succeeded":"failed",": size=").concat(o.length),a?ke.INFO:ke.WARN),[2,a];case 3:return s=l.sent(),this.context.apiLog("saveSequencingState","Error saving sequencing state: ".concat(vd(s,Error)?s.message:s+""),ke.ERROR),[2,!1];case 4:return[2]}})}).call(this)}},{key:"loadSequencingState",value:function(e){var t=this,i=this.context.getSettings();if(!i.sequencingStatePersistence)return this.context.apiLog("loadSequencingState","No persistence configuration provided",ke.WARN),Promise.resolve(!1);var n=i.sequencingStatePersistence,r=fd({learnerId:this.context.learnerId||"unknown",courseId:i.courseId||"unknown",attemptNumber:1,version:n.stateVersion||"1.0"},e),o=JSON.stringify({learnerId:r.learnerId,courseId:r.courseId,attemptNumber:r.attemptNumber,version:r.version}),a=this.inFlightLoads.get(o);if(a)return a;var s=ud(function(){var e,t,i,o;return hd(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,n.persistence.loadState(r)];case 1:return(e=a.sent())?(t=e,!1!==n.compress&&(t=this.decompressStateData(e)),i=this.deserializeSequencingState(t),n.debugPersistence&&this.context.apiLog("loadSequencingState","State load ".concat(i?"succeeded":"failed",": size=").concat(e.length),i?ke.INFO:ke.WARN),[2,i]):(n.debugPersistence&&this.context.apiLog("loadSequencingState","No sequencing state found to load",ke.INFO),[2,!1]);case 2:return o=a.sent(),this.context.apiLog("loadSequencingState","Error loading sequencing state: ".concat(vd(o,Error)?o.message:o+""),ke.ERROR),[2,!1];case 3:return[2]}})}).call(t);return this.inFlightLoads.set(o,s),s.finally(function(){t.inFlightLoads.get(o)===s&&t.inFlightLoads.delete(o)}),s}},{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},sharedData:"function"==typeof this.context.adl.captureSharedDataSnapshot?this.context.adl.captureSharedDataSnapshot():{},contentDelivered:!1};if(this.context.sequencingService){var i=this.context.sequencingService.getOverallSequencingProcess();if(i){var n=i.getSequencingState();t.sequencing=n,"function"==typeof i.getSuspensionState&&(t.suspensionState=i.getSuspensionState()),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),ke.WARN),n.globalObjectiveMap&&n.sequencing&&!n.sequencing.globalObjectiveMap&&(n.sequencing.globalObjectiveMap=n.globalObjectiveMap),this.context.sequencingService){var o=this.context.sequencingService.getOverallSequencingProcess();o&&(n.sequencing&&o.restoreSequencingState(n.sequencing),void 0!==n.suspensionState&&"function"==typeof o.restoreSuspensionState&&o.restoreSuspensionState(n.suspensionState),n.sequencing&&n.contentDelivered&&o.setContentDelivered(!0))}var a=new Map;if(n.globalObjectiveMap&&"object"===md(n.globalObjectiveMap)){var s=this.globalObjectiveManager.buildCMIObjectivesFromMap(n.globalObjectiveMap),l=!0,c=!1,u=void 0;try{for(var d,v=s[Symbol.iterator]();!(l=(d=v.next()).done);l=!0){var f=d.value;f.id&&a.set(f.id,f)}}catch(e){c=!0,u=e}finally{try{l||null==v.return||v.return()}finally{if(c)throw u}}}if(Array.isArray(n.globalObjectives)){var h=!0,m=!1,p=void 0;try{for(var y,g=n.globalObjectives[Symbol.iterator]();!(h=(y=g.next()).done);h=!0){var b=this.globalObjectiveManager.buildCMIObjectiveFromJSON(y.value);if(b.id){var _=a.get(b.id);_?!_.description&&b.description&&(_.description=b.description):a.set(b.id,b)}}}catch(e){m=!0,p=e}finally{try{h||null==g.return||g.return()}finally{if(m)throw p}}}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.sharedData&&"object"===md(n.sharedData)&&"function"==typeof this.context.adl.restoreSharedDataSnapshot&&this.context.adl.restoreSharedDataSnapshot(n.sharedData);var S=this.context.sequencing.getCurrentActivity();if(S&&"function"==typeof this.context.adl.configureSharedDataMaps&&this.context.adl.configureSharedDataMaps(S.sharedDataMaps),n.adlNavState){this.context.adl.nav.request=n.adlNavState.request||"_none_";var w=this.context.adl.nav.request_valid,O=w.initialized,C=n.adlNavState.request_valid||{};w.reset();try{for(var A,E,j=0,k=["continue","previous","exit","exitAll","abandon","abandonAll","suspendAll"];k.length>j;j++){var R,M=k[j];w[M]=null!==(R=C[M])&&void 0!==R?R:"unknown"}w.choice=null!==(A=C.choice)&&void 0!==A?A:{},w.jump=null!==(E=C.jump)&&void 0!==E?E:{}}finally{O&&w.initialize()}}return!0}catch(e){return this.context.apiLog("deserializeSequencingState","Error deserializing sequencing state: ".concat(vd(e,Error)?e.message:e+""),ke.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 bd(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 _d=Object.defineProperty,Sd=function(e,t,i){return function(e,t,i){return t in e?_d(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)},wd=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Sd(this,"context"),Sd(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=this.renderCMIExport(e,arguments.length>1&&void 0!==arguments[1]&&arguments[1]),i=this.captureSharedData(),n=f(t);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 bd(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)?bd(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&&(t.sharedData=i),t}}},{key:"renderCMIExport",value:function(e,t){var i=this.context.renderCMIToJSONObject();return this.context.adl&&this.context.adl.data._count>0&&(i.adl={data:JSON.parse(JSON.stringify(this.context.adl.data))}),e||t?i.cmi.total_time=this.context.cmi.getCurrentTotalTime():delete i.cmi.total_time,i}},{key:"captureSharedData",value:function(){if(!this.context.adl||"function"!=typeof this.context.adl.captureWritableSharedDataSnapshot)return null;var e=this.context.adl.captureWritableSharedDataSnapshot();return Object.keys(e).length>0?e:null}},{key:"renderCommitObject",value:function(e){var t,i,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=this.renderCommitCMI(e,r);Array.isArray(o)||delete o.sharedData;var a=e||r?this.context.cmi.getCurrentTotalTime():"",s=d(a,Ke),l=je,c=Ce;this.context.cmi.completion_status&&("completed"===this.context.cmi.completion_status?l=Ae:"incomplete"===this.context.cmi.completion_status&&(l=Ee)),this.context.cmi.success_status&&("passed"===this.context.cmi.success_status?c=we:"failed"===this.context.cmi.success_status&&(c=Oe));var u,v,f=null===(t=this.context.sequencingService)||void 0===t?void 0:t.getSequencingState().rootActivity;f&&(l=null!==(u=f.completionStatus)&&void 0!==u?u:je,c=null!==(v=f.successStatus)&&void 0!==v?v:Ce);var h=(null===(n=this.context.cmi)||void 0===n||null===(i=n.score)||void 0===i?void 0:i.getScoreObject())||{};if(f){var m=f.primaryObjective;(f.objectiveMeasureStatus||!0===(null==m?void 0:m.rawScoreKnown)||!0===(null==m?void 0:m.minScoreKnown)||!0===(null==m?void 0:m.maxScoreKnown))&&(h={},f.objectiveMeasureStatus&&(h.scaled=f.objectiveNormalizedMeasure),(null==m?void 0:m.rawScoreKnown)&&(h.raw=+m.rawScore),(null==m?void 0:m.minScoreKnown)&&(h.min=+m.minScore),(null==m?void 0:m.maxScoreKnown)&&(h.max=+m.maxScore))}var p={completionStatus:l,successStatus:c,totalTimeSeconds:s,runtimeData:o},y=this.captureSharedData();y&&(p.sharedData=y),h&&(p.score=h);var g=this.context.getSettings();if(g.autoPopulateCommitMetadata){var b,_;g.courseId&&(p.courseId=g.courseId),g.scoId&&(p.scoId=g.scoId),this.context.cmi.learner_id&&(p.learnerId=this.context.cmi.learner_id),this.context.cmi.learner_name&&(p.learnerName=this.context.cmi.learner_name);var S=null===(b=this.context.sequencingService)||void 0===b?void 0:b.getSequencingState();(null==S||null===(_=S.currentActivity)||void 0===_?void 0:_.id)&&(p.activityId=S.currentActivity.id)}return this.globalObjectiveManager&&(p.globalObjectives=this.globalObjectiveManager.captureGlobalObjectiveSnapshot()),p}},{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 Od(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 Cd(e,t,i,n,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(n,r)}function Ad(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){Cd(o,n,r,a,s,"next",e)}function s(e){Cd(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 jd(e,t,i){return jd="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=kd(e)););return e}(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(i||e):r.value}},jd(e,t,i||e)}function kd(e){return kd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},kd(e)}function Rd(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Md(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Md=function(){return!!result})()}function Td(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 Id(e,t){return Id=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Id(e,t)}function Pd(e){return function(e){if(Array.isArray(e))return Od(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 Od(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)?Od(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 xd(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:l(0)}),s(a,"throw",{value:l(1)}),s(a,"return",{value:l(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function l(s){return function(l){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,l])}}}function Dd(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Nd=Object.defineProperty,qd=function(e,t,i){return function(e,t,i){return t in e?Nd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i}(e,"symbol"!==(void 0===t?"undefined":Dd(t))?t+"":t,i)},Ld=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","adl.data.N.store"]),Scorm2004API=function(e){function Scorm2004API(e,t){var i,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Scorm2004API);var r=e?Td({},e):void 0;r&&void 0===r.mastery_override&&(r.mastery_override=!1),i=function(e,t,i){return t=kd(t),n=e,!(r=Md()?Reflect.construct(t,i||[],kd(e).constructor):t.apply(e,i))||"object"!==Dd(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,r,t]),qd(i,"_version","1.0"),qd(i,"_sequencing"),qd(i,"_sequencingService",null),qd(i,"_restoringFromJSON",!1),qd(i,"_runtimeSetCMIElements",new Set),qd(i,"_extractedScoItemIds",[]),qd(i,"_sequencingCollections",{}),qd(i,"_responseValidator"),qd(i,"_cmiHandler"),qd(i,"_activityTreeBuilder"),qd(i,"_sequencingConfigBuilder"),qd(i,"_globalObjectiveManager"),qd(i,"_statePersistence",null),qd(i,"_dataSerializer"),qd(i,"cmi"),qd(i,"adl"),qd(i,"Initialize"),qd(i,"Terminate"),qd(i,"GetValue"),qd(i,"SetValue"),qd(i,"Commit"),qd(i,"GetLastError"),qd(i,"GetErrorString"),qd(i,"GetDiagnostic"),i.cmi=new Qc,i.adl=new hu,i._sequencing=new Pu,i.adl.sequencing=i._sequencing,i._sequencingConfigBuilder=new Uu,i._activityTreeBuilder=new Qu({},i._sequencingConfigBuilder);var o={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 Du(o);var a={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 Lu(a,i._responseValidator);var s={getSettings:function(){return i.settings},hostDeclaredGlobalObjectiveIds:Pd(null!==(n=null==r?void 0:r.globalObjectiveIds)&&void 0!==n?n:[]),cmi:i.cmi,sequencing:i._sequencing,sequencingService:i._sequencingService,commonSetCMIValue:i._commonSetCMIValue.bind(i)};i._globalObjectiveManager=new ld(s);var l={getSettings:function(){return i.settings},cmi:i.cmi,adl:i.adl,sequencingService:i._sequencingService,renderCMIToJSONObject:i.renderCMIToJSONObject.bind(i)};return i._dataSerializer=new wd(l,i._globalObjectiveManager),(null==r?void 0:r.sequencing)&&i.configureSequencing(r.sequencing),i.initializeSequencingService(r),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&&Id(e,t)}(Scorm2004API,e),t=Scorm2004API,i=[{key:"reset",value:function(e,t){var i,n,r,o;this.commonReset(e,t),this._runtimeSetCMIElements.clear(),null===(i=this.cmi)||void 0===i||i.reset(),!0===(null==t?void 0:t.resetTotalTime)&&(this.cmi.total_time="PT0S"),null===(n=this.adl)||void 0===n||n.reset(),this.applyCurrentActivityLaunchData(),(null===(r=this._sequencing)||void 0===r?void 0:r.getCurrentActivity())&&(this.adl.sequencing=this._sequencing,null===(o=this._sequencing.overallSequencingProcess)||void 0===o||o.updateNavigationValidity())}},{key:"applyCurrentActivityLaunchData",value:function(){var e,t=null===(e=this._sequencing)||void 0===e?void 0:e.getCurrentActivity();t&&(this.adl.configureSharedDataMaps(t.sharedDataMaps),this.applyActivityLaunchData(t))}},{key:"applyDeliveredActivityLaunchData",value:function(e){this.adl.configureSharedDataMaps(e.sharedDataMaps),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=[];e.primaryObjective&&i.push(e.primaryObjective),(t=i).push.apply(t,Pd(e.objectives));var n=new Set,r=!0,o=!1,a=void 0;try{for(var s,l=i[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value,u=this.getSeedableObjectiveId(c);if(u&&!n.has(u)){n.add(u);var d=this.findOrSeedCMIObjective(u);if(null!==d){var v=this.cmi.objectives.findObjectiveByIndex(d);v&&this.cmi.objectives.initialized&&!v.initialized&&v.initialize();var f=this.getActivityObjectiveSuccessStatus(c);f&&this._commonSetCMIValue("SeedActivityObjective",!0,"cmi.objectives.".concat(d,".success_status"),f),this.seedObjectiveReadMapValues(e,c,d)}}}}catch(e){o=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw a}}}},{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 l,c=t.mapInfo[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,d=r.get(u.targetObjectiveID||t.id);if(d){var v=pr.getGlobalObjectiveReadState(e,t,u,d,{restrictToFreshWrites:!1,allowSatisfiedStatus:!0,allowNormalizedMeasure:!0});this.applyObjectiveReadStateToCMI(i,v)}}}catch(e){a=!0,s=e}finally{try{o||null==c.return||c.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:"restoreGlobalObjectiveSnapshot",value:function(e){this._globalObjectiveManager.restoreGlobalObjectiveSnapshot(e)}},{key:"restoreSharedDataSnapshot",value:function(e){this.adl.restoreSharedDataSnapshot(e)}},{key:"captureSharedDataSnapshot",value:function(){return this.adl.captureSharedDataSnapshot()}},{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.adl.initialize(),result===V&&this._sequencingService&&(this._sequencingService.initialize(),this.applyCurrentActivityObjectiveData()),result===V&&this._globalObjectiveManager.restoreGlobalObjectivesToCMI(),result===V&&this.settings.sequencingStatePersistence&&!1!==this.settings.sequencingStatePersistence.autoLoadOnInitialize&&this.loadSequencingState().catch(function(){e.apiLog("lmsInitialize","Failed to auto-load sequencing state",ke.WARN)}),result}},{key:"lmsFinish",value:function(){var e,t,i,n,r,o;if(""!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""))return this.throwSCORMError("api",this._error_codes.ARGUMENT_ERROR),H;var a=(null===(i=this.adl)||void 0===i||null===(t=i.nav)||void 0===t?void 0:t.request)||"_none_",s=(null===(n=this.cmi)||void 0===n?void 0:n.getExitValueInternal())||"",l=this.isTerminated(),c=null!==(e=null===(r=this._sequencingService)||void 0===r?void 0:r.isDeliveryInProgress())&&void 0!==e&&e,u=a,d="",v=RegExp(Qe);if("_none_"!==a){var f,h,m,p=a.match(v);if(p)if(null===(f=p.groups)||void 0===f?void 0:f.choice_target)d=null===(m=p.groups)||void 0===m?void 0:m.choice_target,u="choice";else if(null===(h=p.groups)||void 0===h?void 0:h.jump_target){var y;d=null===(y=p.groups)||void 0===y?void 0:y.jump_target,u="jump"}}var g,b=null;"_none_"!==u?(b=u,g=d||void 0):this._sequencing.getCurrentActivity()&&(b="exit");var _=!l&&!c&&b&&this._sequencingService?this._sequencingService.prepareNavigationRequest(b,g,s):null,result=this.terminate("Terminate",!0);if(result!==V&&_&&this._sequencingService&&this._sequencingService.cancelPreparedNavigation(_),result!==V||l||!0!==this.settings.accumulateSessionTimeOnTerminate&&!0!==(null===(o=this._sequencingService)||void 0===o?void 0:o.getSequencingState().isInitialized)||this.cmi.accumulateSessionTime(),result===V&&!l&&!c){var S=!1,w=!1,O=null;if(this._sequencingService)try{b&&(w=!0===this._sequencingService.getSequencingState().isInitialized,S=_?this._sequencingService.completeNavigationRequest(_):this._sequencingService.processNavigationRequest(b,g,s),O=b)}catch(e){this.apiLog("lmsFinish","Sequencing navigation failed: ".concat(e),ke.WARN),S=!1}if(!S&&!w)if("_none_"!==a){var C={continue:"SequenceNext",previous:"SequencePrevious",choice:"SequenceChoice",jump:"SequenceJump",exit:"SequenceExit",exitAll:"SequenceExitAll",abandon:"SequenceAbandon",abandonAll:"SequenceAbandonAll"}[u];C&&this.processListeners(C,"adl.nav.request",d)}else this.settings.autoProgress&&this.processListeners("SequenceNext",void 0,"next");this._sequencingService&&O&&["exitAll","abandonAll","suspendAll"].includes(O)&&this._sequencingService.terminate(),this.adl.nav.request="_none_"}if(result===V&&!l){var A,E,j=null!==(A=null===(E=this.settings.sequencingStatePersistence)||void 0===E?void 0:E.autoSaveOn)&&void 0!==A?A:"commit";this.settings.sequencingStatePersistence&&["commit","navigate"].includes(j)&&this.autoSaveSequencingState("lmsFinish")}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,l=null===(o=this._sequencing)||void 0===o?void 0:o.overallSequencingProcess;return this.settings.scoItemIdValidator?this.settings.scoItemIdValidator(r)+"":(null==l?void 0:l.predictChoiceEnabled)&&"choice"===request?l.predictChoiceEnabled(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._runtimeSetCMIElements.add(e),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",ke.WARN)}),result}},{key:"lmsCommit",value:function(){var e;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"),this.settings.sequencingStatePersistence&&"commit"===(null!==(e=this.settings.sequencingStatePersistence.autoSaveOn)&&void 0!==e?e:"commit")&&this.autoSaveSequencingState("lmsCommit"),V;var t,result=this.commit("Commit",!0);return result===V&&this.settings.sequencingStatePersistence&&"commit"===(null!==(t=this.settings.sequencingStatePersistence.autoSaveOn)&&void 0!==t?t:"commit")&&this.autoSaveSequencingState("lmsCommit"),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:"loadFromJSON",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this._restoringFromJSON=!0;try{jd(kd(Scorm2004API.prototype),"loadFromJSON",this).call(this,e,t)}finally{this._restoringFromJSON=!1}}},{key:"setCMIValue",value:function(e,t){if(m(e,"cmi\\.objectives\\.\\d+")){var i,n=+e.split(".")[2],r="cmi.objectives.".concat(n);if(m(e,"cmi\\.objectives\\.\\d+\\.id"))i=t;else{var o=this.cmi.objectives.findObjectiveByIndex(n);i=o?o.id:void 0}if((!this._restoringFromJSON||!this.settings.sequencingStatePersistence)&&i&&this._globalObjectiveManager.isHostDeclaredGlobalObjectiveId(i)&&this.currentActivityAllowsGlobalObjectiveWrites()){var a=this._globalObjectiveManager.findOrCreateGlobalObjective(i).index,s=e.replace(r,"_globalObjectives.".concat(a));this._commonSetCMIValue("SetGlobalObjectiveValue",!0,s,t);var l=this._globalObjectiveManager.globalObjectives[a];i&&l&&this._globalObjectiveManager.updateGlobalObjectiveFromCMI(i,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(Rd(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)||this.adl.isConfiguredSharedDataElement(e)||Ld.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;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 o=!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&&(o=!0);var a=this.getCommitObject(e);if("string"==typeof this.settings.lmsCommitUrl){var result=this.processHttpRequest(this.settings.lmsCommitUrl,a,e,t);if(o&&void 0!==result.navRequest&&""!==result.navRequest&&"string"==typeof result.navRequest){var s=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(s.valid){var l={start:"SequenceStart",resumeAll:"SequenceResumeAll",continue:"SequenceNext",previous:"SequencePrevious",choice:"SequenceChoice",jump:"SequenceJump",exit:"SequenceExit",exitAll:"SequenceExitAll",abandon:"SequenceAbandon",abandonAll:"SequenceAbandonAll",suspendAll:"SequenceSuspendAll"}[s.command];l&&this.processListeners(l,"adl.nav.request",s.targetActivityId)}else this.apiLog("storeData","Invalid navigation request from LMS: ".concat(s.error),ke.WARN)}else(null==result?void 0:result.navRequest)&&!o&&"object"===Dd(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:"createPersistenceContext",value:function(){var e=this,t=this;return{getSettings:function(){return e.settings},apiLog:this.apiLog.bind(this),adl:this.adl,sequencing:this._sequencing,sequencingService:this._sequencingService,get learnerId(){return t.cmi.learner_id}}}},{key:"initializeSequencingService",value:function(e){var t=this;try{var i,n,r,o,a,s,l,c,u,d,v,f={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===(l=e.sequencing)||void 0===l?void 0:l.autoProgressOnCompletion)&&void 0!==n&&n,validateNavigationRequests:null===(r=null==e||null===(c=e.sequencing)||void 0===c?void 0:c.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",wasCMIElementSetByContent:function(e){return t._runtimeSetCMIElements.has(e)}};this._sequencingService=new $o(this._sequencing,this.cmi,this.adl,this.eventService||this,this.loggingService,f),this._sequencingService.setEventListeners(this.buildSequencingEventListeners(null==e||null===(v=e.sequencing)||void 0===v?void 0:v.eventListeners)),this._globalObjectiveManager.updateSequencingService(this._sequencingService),this._dataSerializer.updateSequencingService(this._sequencingService),(null==e?void 0:e.sequencingStatePersistence)&&(this._statePersistence=new gd(this.createPersistenceContext(),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=Td({},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:"previewNavigationRequest",value:function(request){return this.isInitialized()&&this._sequencingService?this._sequencingService.previewNavigationRequest(request):{outcome:"unknown",targetActivityId:null,endSequencingSession:!1,exception:null}}},{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){if(this._sequencingService){var t,result=this._sequencingService.processNavigationRequest(request,e);return result&&"navigate"===(null===(t=this.settings.sequencingStatePersistence)||void 0===t?void 0:t.autoSaveOn)&&this.autoSaveSequencingState("processNavigationRequest"),result}return!1}},{key:"autoSaveSequencingState",value:function(e){var t=this;this.saveSequencingState().then(function(i){i||t.apiLog(e,"Failed to auto-save sequencing state",ke.WARN)}).catch(function(){t.apiLog(e,"Failed to auto-save sequencing state",ke.WARN)})}},{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,attemptCompletionAmount:n.attemptCompletionAmount,attemptCompletionAmountStatus:n.attemptCompletionAmountStatus,score:n.objectiveMeasureStatus?n.objectiveNormalizedMeasure:null}:null}},{key:"saveSequencingState",value:function(e){return Ad(function(){return xd(this,function(t){return this._statePersistence?[2,this._statePersistence.saveSequencingState(e)]:this.settings.sequencingStatePersistence?[2,new gd(this.createPersistenceContext(),this._globalObjectiveManager).saveSequencingState(e)]:(this.apiLog("saveSequencingState","No persistence configuration provided",ke.WARN),[2,!1])})}).call(this)}},{key:"loadSequencingState",value:function(e){return Ad(function(){return xd(this,function(t){return this._statePersistence?[2,this._statePersistence.loadSequencingState(e)]:this.settings.sequencingStatePersistence?[2,new gd(this.createPersistenceContext(),this._globalObjectiveManager).loadSequencingState(e)]:(this.apiLog("loadSequencingState","No persistence configuration provided",ke.WARN),[2,!1])})}).call(this)}},{key:"serializeSequencingState",value:function(){return this._statePersistence?this._statePersistence.serializeSequencingState():new gd(this.createPersistenceContext(),this._globalObjectiveManager).serializeSequencingState()}},{key:"deserializeSequencingState",value:function(e){return this._statePersistence?this._statePersistence.deserializeSequencingState(e):new gd(this.createPersistenceContext(),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}(pa);"undefined"!=typeof window&&(window.Scorm12API=Scorm12API,window.Scorm2004API=Scorm2004API)}();
//# sourceMappingURL=scorm-again.min.js.map
