scorm-again 3.1.5 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- this.Scorm12API=function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);t>n;n++)r[n]=e[n];return r}function t(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,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}var r=function(e){if(!e||0>=e)return"00:00:00";var t=Math.floor(e/3600),n=new Date(1e3*e),r=n.getUTCMinutes(),i=n.getSeconds(),o=e%1,s="";return a(o)>0&&(s="."+(s=a(o)>2?o.toFixed(2):o+"").split(".")[1]),(t+":"+r+":"+i).replace(/\b\d\b/g,"0$&")+s},i=l(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 n=e.split(":");return 3600*+n[0]+60*+n[1]+ +n[2]},function(e,t){var n,r="string"==typeof t?t:null!==(n=null==t?void 0:""+t)&&void 0!==n?n:"";return"".concat("string"==typeof e?e:(null!=e?e:"")+"",":").concat(r)}),o=l(function(e,t){var r,i,o,s;if("string"==typeof t&&(t=RegExp(t)),!e||!(null==e||null===(i=e.match)||void 0===i?void 0:i.call(e,t)))return 0;var a,c,l=(a=null!==(r=null===(o=(s=RegExp(t)).exec)||void 0===o?void 0:o.call(s,e))&&void 0!==r?r:[],c=8,function(e){if(Array.isArray(e))return e}(a)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}}(a,c)||n(a,c)||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.")}()),result=0;return result+=+l[7]||0,result+=60*+l[6]||0,result+=3600*+l[5]||0,result+=86400*+l[4]||0,result+=604800*+l[3]||0,(result+=2592e3*+l[2]||0)+(31536e3*+l[1]||0)},function(e,t){var n,r="string"==typeof t?t:null!==(n=null==t?void 0:""+t)&&void 0!==n?n:"";return"".concat(null!=e?e:"",":").concat(r)});function s(e){var result={};return function e(t,n){if(Object(t)!==t)result[n]=t;else if(Array.isArray(t))t.forEach(function(t,r){e(t,"".concat(n,"[").concat(r,"]"))}),0===t.length&&(result[n]=[]);else{var r=Object.keys(t).filter(function(e){return{}.hasOwnProperty.call(t,e)}),i=0===r.length;r.forEach(function(r){e(t[r],n?"".concat(n,".").concat(r):r)}),i&&n&&(result[n]={})}}(e,""),result}function a(e){var t,n,r,i;if(Math.floor(e)===e||0>(null===(r=e+"")||void 0===r||null===(n=r.indexOf)||void 0===n?void 0:n.call(r,".")))return 0;var o=null===(i=(""+e).split("."))||void 0===i?void 0:i[1];return null!==(t=null==o?void 0:o.length)&&void 0!==t?t:0}function c(e,t){return"string"==typeof e&&RegExp(t).test(e)}function l(e,n,r){var i=new Map;return function(){for(var o=arguments.length,s=Array(o),a=0;o>a;a++)s[a]=arguments[a];var result,c=n?n.apply(void 0,t(s)):JSON.stringify(s);return void 0!==(null==r?void 0:r.maxKeyLength)&&c.length>r.maxKeyLength?e.apply(void 0,t(s)):i.has(c)?i.get(c):(result=e.apply(void 0,t(s)),void 0===(null==r?void 0:r.maxEntries)||r.maxEntries>i.size||i.delete(i.keys().next().value),i.set(c,result),result)}}var u=function(e,t,n){var r=e.indexOf("#"),i=-1===r?e:e.slice(0,r),o=-1===r?"":e.slice(r),s=i.includes("?")?i.endsWith("?")||i.endsWith("&")?"":"&":"?",a="".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n+""));return"".concat(i).concat(s).concat(a).concat(o)};function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t,n){return t&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function m(e,t){return m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},m(e,t)}function v(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function y(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(y=function(){return!!result})()}var _=Object.defineProperty,p=function(e,t,n){return function(e,t,n){return t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":v(t))?t+"":t,n)},g=function(){function e(t){f(this,e),p(this,"jsonString",!1),p(this,"_cmi_element"),p(this,"_initialized",!1),this._cmi_element=t}return d(e,[{key:"initialized",get:function(){return this._initialized}},{key:"initialize",value:function(){this._initialized=!0}}]),e}(),b=function(e){function t(){var e;return f(this,t),e=function(e,t,n){return t=h(t),r=e,!(i=y()?Reflect.construct(t,n||[],h(e).constructor):t.apply(e,n))||"object"!==v(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,arguments),p(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&&m(e,t)}(t,e),d(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}(g);function E(e,t,n){return t=C(t),r=e,!(i=L()?Reflect.construct(t,n||[],C(e).constructor):t.apply(e,n))||"object"!==N(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t,n){return O=L()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&I(i,n.prototype),i},O.apply(null,arguments)}function w(e,t,n){return t&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},C(e)}function R(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&&I(e,t)}function I(e,t){return I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},I(e,t)}function N(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function T(e){var t="function"==typeof Map?new Map:void 0;return T=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,n)}function n(){return O(e,arguments,C(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),I(n,e)},T(e)}function L(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(L=function(){return!!result})()}var k=Object.defineProperty,M=function(e,t,n){return function(e,t,n){return t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":N(t))?t+"":t,n)},A=function(e){function t(e,n){var r;return S(this,t),r=E(this,t,["".concat(e," : ").concat(""+n)]),M(r,"_errorCode"),r._errorCode=n,Object.setPrototypeOf(r,t.prototype),r}return R(t,e),w(t,[{key:"errorCode",get:function(){return this._errorCode}}]),t}(T(Error)),j=function(e){function t(e,n,r,i){var o;return S(this,t),o=E(this,t,[e,n]),M(o,"_errorMessage"),M(o,"_detailedMessage",""),o.message="".concat(e," : ").concat(r),o._errorMessage=r,i&&(o._detailedMessage=i),Object.setPrototypeOf(o,t.prototype),o}return R(t,e),w(t,[{key:"errorMessage",get:function(){return this._errorMessage}},{key:"detailedMessage",get:function(){return this._detailedMessage}}]),t}(A),P="true",x="false",D={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."}}};function F(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function B(e,t,n){return t=U(t),r=e,!(i=G()?Reflect.construct(t,n||[],U(e).constructor):t.apply(e,n))||"object"!=((o=i)&&"undefined"!=typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)&&"function"!=typeof i?F(r):i;var r,i,o}function U(e){return U=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},U(e)}function V(e,t){return V=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},V(e,t)}function G(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(G=function(){return!!result})()}var z=D.error_descriptions,H=function(e){function t(e,n){var r,i,o,s,a,c;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r={}.hasOwnProperty.call(z,n+"")?B(this,t,[e,n,(null===(i=z[n+""])||void 0===i?void 0:i.basicMessage)||"Unknown error",null===(o=z[n+""])||void 0===o?void 0:o.detailMessage]):B(this,t,[e,101,null!==(s=null===(a=z[101])||void 0===a?void 0:a.basicMessage)&&void 0!==s?s:"General error",null===(c=z[101])||void 0===c?void 0:c.detailMessage]),Object.setPrototypeOf(F(r),t.prototype),F(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&&V(e,t)}(t,e),t}(j);function q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){q(e,t,n[t])})}return e}function J(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 n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var Y={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},$=J(W({},Y),{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});function K(e){return K=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},K(e)}function Z(e,t){return Z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Z(e,t)}function Q(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function X(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(X=function(){return!!result})()}J(W({},Y),{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});var ee=Object.defineProperty,te=function(e,t,n){return function(e,t,n){return t in e?ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":Q(t))?t+"":t,n)},ne=function(e){function t(e){var n,r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,n){return t=K(t),r=e,!(i=X()?Reflect.construct(t,n||[],K(e).constructor):t.apply(e,n))||"object"!==Q(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,[e.CMIElement]),te(n,"_errorCode"),te(n,"_errorClass"),te(n,"__children"),te(n,"childArray"),n.__children=e.children,n._errorCode=null!==(r=e.errorCode)&&void 0!==r?r:$.GENERAL,n._errorClass=e.errorClass||A,n.childArray=[],n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Z(e,t)}(t,e),n=t,r=[{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 n;null===(n=this.childArray[t])||void 0===n||n.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}}],r&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,r),t;var n,r}(g),re="passed",ie="unknown",oe="completed",se="unknown",ae={_:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5};function ce(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}var le={autocommit:!1,autocommitSeconds:10,throttleCommits:!1,useAsynchronousCommits:!1,sendFullCommit:!0,lmsCommitUrl:!1,dataCommitFormat:"json",commitRequestDataType:"application/json;charset=UTF-8",autoProgress:!1,logLevel:ae.ERROR,selfReportSessionTime:!1,alwaysSendTotalTime:!1,renderCommonCommitFields:!1,autoCompleteLessonStatus:!1,strict_errors:!0,xhrHeaders:{},xhrWithCredentials:!1,fetchMode:"cors",asyncModeBeaconBehavior:"never",includeCommitSequence:!1,responseHandler:function(e){return(t=function(){var t,n;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(s,"next",{value:c(0)}),a(s,"throw",{value:c(1)}),a(s,"return",{value:c(2)}),"function"==typeof Symbol&&a(s,Symbol.iterator,{value:function(){return this}}),s;function c(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&i[3]>a[1])){o.label=a[1];break}if(6===a[0]&&i[1]>o.label){o.label=i[1],i=a;break}if(i&&i[2]>o.label){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}(this,function(r){switch(r.label){case 0:if(void 0===e)return[3,8];t=null,r.label=1;case 1:return r.trys.push([1,6,,7]),"function"!=typeof e.json?[3,3]:[4,e.json()];case 2:return t=r.sent(),[3,5];case 3:return"function"!=typeof e.text?[3,5]:[4,e.text()];case 4:(n=r.sent())&&(t=JSON.parse(n)),r.label=5;case 5:return[3,7];case 6:return r.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===P?0:101}]:200===e.status?[2,{result:P,errorCode:0}]:[2,{result:x,errorCode:101}];case 8:return[2,{result:x,errorCode:101}]}})},function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(e){ce(o,r,i,s,a,"next",e)}function a(e){ce(o,r,i,s,a,"throw",e)}s(void 0)})})();var t},xhrResponseHandler:function(e){if(void 0!==e){var t=null;if(200>e.status||e.status>299)return{result:x,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===P?0:101}:{result:P,errorCode:0}}return{result:x,errorCode:101}},requestHandler:function(e){return e},onLogMessage:ue,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 ue(e,t){switch(e){case"4":case 4:case"ERROR":case ae.ERROR:console.error(t);break;case"3":case 3:case"WARN":case ae.WARN:console.warn(t);break;case"2":case 2:case"INFO":case ae.INFO:console.info(t);break;case"1":case 1:case"DEBUG":case ae.DEBUG:console.debug?console.debug(t):console.log(t)}}var fe="^[\\s\\S]{0,255}$",de="^([0-9]+):([0-9]{2}):([0-9]{2})(\\.\\d{1,2})?$",he="^-?([0-9]+)$",me="^-?([0-9]{0,10})(\\.[0-9]*)?$",ve="^[\\u0021-\\u007E\\s]{0,255}$",ye="^.*$",_e="^(passed|completed|failed|incomplete|browsed|not attempted)$",pe="0#100",ge="^P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?(?:T?(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:(\\d+(?:\\.\\d{1,2})?)S)?)?$";function be(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ee(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}!function(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){be(e,t,n[t])})}}({},{"NB.2.1-1":"Sequencing session already started","NB.2.1-2":"Current activity not defined / sequencing not begun","NB.2.1-3":"No suspended activity to resume","NB.2.1-4":"Flow not enabled / current activity is root","NB.2.1-5":"Violates control mode (forward only or flow disabled)","NB.2.1-6":"Cannot move backward from root","NB.2.1-7":"Forward/Backward navigation not supported","NB.2.1-8":"Forward-only constraint violation","NB.2.1-9":"Activity path empty","NB.2.1-10":"Choice control disabled on parent","NB.2.1-11":"Target activity does not exist","NB.2.1-12":"Activity already terminated","NB.2.1-13":"Undefined navigation request","NB.2.1-14":"No current activity for EXIT_ALL","NB.2.1-15":"No current activity for ABANDON","NB.2.1-16":"No current activity for ABANDON_ALL","NB.2.1-17":"No current activity for SUSPEND_ALL","NB.2.1-18":"Invalid navigation request type"},{"TB.2.3-1":"No current activity to terminate","TB.2.3-2":"Current activity already terminated","TB.2.3-3":"Nothing to suspend (root activity)","TB.2.3-4":"Cannot EXIT_PARENT from root activity","TB.2.3-5":"Activity path is empty during suspend","TB.2.3-6":"Nothing to abandon","TB.2.3-7":"Undefined termination request"},{"SB.2.1-2":"No available children to deliver","SB.2.1-3":"Reached beginning of course","SB.2.1-4":"Forward only violation - cannot traverse backward"},{"SB.2.2-1":"Flow control disabled on parent","SB.2.2-2":"Activity not available"},{"SB.2.7-1":"Sequencing session not begun (current activity not terminated)","SB.2.7-2":"Cannot continue - flow disabled or no activity available"},{"SB.2.8-1":"Current activity not terminated","SB.2.8-2":"Cannot go previous - at beginning or forwardOnly enabled"},{"SB.2.9-1":"Target activity does not exist","SB.2.9-2":"Target activity not in tree","SB.2.9-3":"Cannot choose root activity","SB.2.9-4":"Activity hidden from choice","SB.2.9-5":"Choice control is not allowed","SB.2.9-6":"Current activity not terminated","SB.2.9-7":"No activity available from target","SB.2.9-8":"choiceExit prevents navigation outside ancestor subtree"},{"SB.2.4-1":"Stop forward traversal rule evaluates to true","SB.2.4-2":"Constrained choice requires forward traversal from leaf","SB.2.4-3":"Cannot walk backward from root of activity tree"},{"SB.2.10-1":"Current activity not defined","SB.2.10-2":"Activity is still active or suspended","SB.2.10-3":"Flow subprocess returned false (nothing to deliver)"},{"SB.2.11-1":"Exit not allowed - no parent","SB.2.11-2":"Exit not allowed by sequencing controls"},{"SB.2.12-1":"No current activity","SB.2.12-5":"No target activity specified","SB.2.12-6":"Undefined sequencing request"},{"SB.2.13-1":"Target activity does not exist","SB.2.13-2":"Target activity not in tree","SB.2.13-3":"Target not available"},{"SB.2.5-1":"No activity tree","SB.2.5-2":"Sequencing session already begun","SB.2.5-3":"No activity available"},{"SB.2.6-1":"No suspended activity","SB.2.6-2":"Current activity already defined"},{"SB.2.15-1":"Cannot suspend root"});var Se=Object.defineProperty,Oe=function(e,t,n){return function(e,t,n){return t in e?Se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},we=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Oe(this,"_API"),Oe(this,"_cancelled",!1),Oe(this,"_timeout"),Oe(this,"_callback"),this._API=t,this._timeout=setTimeout(this.wrapper.bind(this),n),this._callback=r}return t=e,n=[{key:"cancel",value:function(){this._cancelled=!0,this._timeout&&clearTimeout(this._timeout)}},{key:"wrapper",value:function(){var e;this._cancelled||this._API.isInitialized()&&(e=function(){return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(s,"next",{value:c(0)}),a(s,"throw",{value:c(1)}),a(s,"return",{value:c(2)}),"function"==typeof Symbol&&a(s,Symbol.iterator,{value:function(){return this}}),s;function c(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&i[3]>a[1])){o.label=a[1];break}if(6===a[0]&&i[1]>o.label){o.label=i[1],i=a;break}if(i&&i[2]>o.label){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}(this,function(e){switch(e.label){case 0:return[4,this._API.commit(this._callback,!1,"autocommit")];case 1:return[2,e.sent()]}})},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Ee(o,r,i,s,a,"next",e)}function a(e){Ee(o,r,i,s,a,"throw",e)}s(void 0)})}).call(this)}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();function Ce(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Re(e){return Re=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Re(e)}function Ie(e,t){return Ie=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ie(e,t)}function Ne(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Te(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Te=function(){return!!result})()}var Le=Object.defineProperty,ke=function(e,t,n){return function(e,t,n){return t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":Ne(t))?t+"":t,n)},Me=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"always",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Map;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,n){return t=Re(t),r=e,!(i=Te()?Reflect.construct(t,n||[],Re(e).constructor):t.apply(e,n))||"object"!==Ne(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,["ruleCondition"]),ke(e,"_condition","always"),ke(e,"_operator",null),ke(e,"_parameters",new Map),ke(e,"_referencedObjective",null),e._condition=n,e._operator=r,e._parameters=i,e}var n,r,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&&Ie(e,t)}(t,e),n=t,i=[{key:"setNowProvider",value:function(e){"function"==typeof e&&(t._now=e)}},{key:"setElapsedSecondsHook",value:function(e){t._getElapsedSecondsHook=e}}],(r=[{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,n=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===n._referencedObjective})||null:null}},{key:"evaluate",value:function(e){var result,t,n=null!==this._referencedObjective,r=this.resolveReferencedObjective(e);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.successStatus!==ie?e.successStatus===re:"unknown");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 i=this._parameters.get("threshold")||0;result=(r?r.measureStatus:e.objectiveMeasureStatus)?(r?r.normalizedMeasure:e.objectiveNormalizedMeasure)>i:"unknown";break;case"objectiveMeasureLessThan":if(n&&!r){result=!1;break}var o=this._parameters.get("threshold")||0;result=(r?r.measureStatus:e.objectiveMeasureStatus)?o>(r?r.normalizedMeasure:e.objectiveNormalizedMeasure):"unknown";break;case"completed":case"activityCompleted":result=!(n&&!r)&&(r?r.completionStatus===se?"unknown":r.completionStatus===oe:e.completionStatus===se?"unknown":e.completionStatus===oe);break;case"progressKnown":case"activityProgressKnown":result=!(n&&!r)&&(r?r.completionStatus!==se:"unknown"!==e.completionStatus);break;case"attempted":result=e.attemptCount>0;break;case"attemptLimitExceeded":result=e.hasAttemptLimitExceeded();break;case"timeLimitExceeded":result=this.evaluateTimeLimitExceeded(e);break;case"outsideAvailableTimeRange":result=this.evaluateOutsideAvailableTimeRange(e);break;case"always":result=!0;break;default:result=!1}return"not"===this._operator&&(result="unknown"===(t=result)?"unknown":!t),result}},{key:"evaluateTimeLimitExceeded",value:function(e){var n=e.timeLimitDuration;if(!n&&e.attemptAbsoluteDurationLimit&&(n=e.attemptAbsoluteDurationLimit),!n)return!1;var r=o(n,ge);if(0>=r)return!1;var i=0;if(t._getElapsedSecondsHook)try{var s=t._getElapsedSecondsHook(e);"number"!=typeof s||Number.isNaN(s)||0>s||(i=s)}catch(e){i=0}if(0===i&&e.attemptExperiencedDuration){var a=o(e.attemptExperiencedDuration,ge);a>0&&(i=a)}if(0===i&&e.attemptAbsoluteStartTime)try{var c=new Date(e.attemptAbsoluteStartTime).getTime(),l=t._now().getTime();Number.isNaN(c)||Number.isNaN(l)||c>l||(i=(l-c)/1e3)}catch(e){i=0}return i>r}},{key:"evaluateOutsideAvailableTimeRange",value:function(e){var n=e.beginTimeLimit,r=e.endTimeLimit;if(!n&&!r)return!1;var i=t._now();return!(!n||i>=new Date(n))||!(!r||new Date(r)>=i)}},{key:"parseISO8601Duration",value:function(e){return 1e3*o(e,ge)}},{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}}])&&Ce(n.prototype,r),i&&Ce(n,i),t}(g);ke(Me,"_now",function(){return new Date}),ke(Me,"_getElapsedSecondsHook");var Ae=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(Ae||{}),je=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(je||{});function Pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);t>n;n++)r[n]=e[n];return r}function xe(e){return function(e){if(Array.isArray(e))return Pe(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 Pe(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pe(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 De=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,n=[{key:"selectChildrenProcess",value:function(e){var t=e.sequencingControls,n=xe(e.children);if(t.selectionTiming===Ae.NEVER)return n;if(t.selectionTiming===Ae.ONCE&&t.selectionCountStatus)return n;if(t.selectionTiming!==Ae.ONCE&&!t.selectionCountStatus)return n;var r=t.selectCount;if(null===r||r>=n.length)return t.selectionTiming===Ae.ONCE&&(t.selectionCountStatus=!0),n;for(var i=[],o=n.map(function(e,t){return t}),s=0;r>s&&0!==o.length;s++){var a=Math.floor(Math.random()*o.length),c=o[a];void 0!==c&&n[c]&&i.push(n[c]),o.splice(a,1)}t.selectionTiming===Ae.ONCE&&(t.selectionCountStatus=!0);var l=!0,u=!1,f=void 0;try{for(var d,h=n[Symbol.iterator]();!(l=(d=h.next()).done);l=!0){var m=d.value;i.includes(m)||(m.isHiddenFromChoice=!0,m.isAvailable=!1)}}catch(e){u=!0,f=e}finally{try{l||null==h.return||h.return()}finally{if(u)throw f}}return i}},{key:"randomizeChildrenProcess",value:function(e){var t,n=e.sequencingControls,r=xe(e.children);if(n.randomizationTiming===je.NEVER)return r;if(n.randomizationTiming===je.ONCE&&n.reorderChildren)return r;if(!n.randomizeChildren)return r;for(var i=xe(r),o=i.length-1;o>0;o--){var s=Math.floor(Math.random()*(o+1)),a=i[o],c=i[s];a&&c&&(i[o]=c,i[s]=a)}return n.randomizationTiming===je.ONCE&&(n.reorderChildren=!0),e.children.length=0,(t=e.children).push.apply(t,xe(i)),i}},{key:"applySelectionAndRandomization",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.sequencingControls;if(!t&&(e.isActive||e.isSuspended))return e.children;var r=!1,i=!1;n.selectionTiming===Ae.ON_EACH_NEW_ATTEMPT?(r=t,t&&(n.selectionCountStatus=!0)):n.selectionTiming===Ae.ONCE&&(r=!n.selectionCountStatus),n.randomizationTiming===je.ON_EACH_NEW_ATTEMPT?(i=t,t&&(n.reorderChildren=!1)):n.randomizationTiming===je.ONCE&&(i=!n.reorderChildren),r&&this.selectChildrenProcess(e),i&&this.randomizeChildrenProcess(e);var o=e.children.filter(function(e){return e.isAvailable});return e.setProcessedChildren(o),o}},{key:"isSelectionNeeded",value:function(e){var t=e.sequencingControls;return t.selectionTiming!==Ae.NEVER&&(t.selectionTiming!==Ae.ONCE||!t.selectionCountStatus)&&null!==t.selectCount&&e.children.length>t.selectCount}},{key:"isRandomizationNeeded",value:function(e){var t=e.sequencingControls;return t.randomizationTiming!==je.NEVER&&(t.randomizationTiming!==je.ONCE||!t.reorderChildren)&&t.randomizeChildren}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t,n),e;var t,n}();function Fe(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Be(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Fe(o,r,i,s,a,"next",e)}function a(e){Fe(o,r,i,s,a,"throw",e)}s(void 0)})}}function Ue(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ve(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Ge(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Ue(e,t,n[t])})}return e}function ze(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(s,"next",{value:c(0)}),a(s,"throw",{value:c(1)}),a(s,"return",{value:c(2)}),"function"==typeof Symbol&&a(s,Symbol.iterator,{value:function(){return this}}),s;function c(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&i[3]>a[1])){o.label=a[1];break}if(6===a[0]&&i[1]>o.label){o.label=i[1],i=a;break}if(i&&i[2]>o.label){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var He=Object.defineProperty,qe=function(e,t,n){return function(e,t,n){return t in e?He(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},We=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),qe(this,"reportsRequestCompletion",!0),qe(this,"settings"),qe(this,"error_codes"),this.settings=t,this.error_codes=n}return t=e,n=[{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:P,errorCode:0}}},{key:"_performAsyncRequest",value:function(e,t,n,r,i,o,s){return Be(function(){var a,c,l,result,u,f;return ze(this,function(d){switch(d.label){case 0:return d.trys.push([0,6,7,8]),a=void 0===o?this.settings.requestHandler(t):this.settings.requestHandler(t,o),c=a,n&&"never"!==this.settings.asyncModeBeaconBehavior?[4,this.performBeacon(e,c)]:[3,2];case 1:return l=d.sent(),[3,4];case 2:return[4,this.performFetch(e,c)];case 3:l=d.sent(),d.label=4;case 4:return[4,this.transformResponse(l,i)];case 5:return result=d.sent(),this._isSuccessResponse(l,result)?i("CommitSuccess"):i("CommitError",void 0,result.errorCode),[3,8];case 6:return u=d.sent(),f=Ve(u,Error)?u.message:u+"",r("processHttpRequest","Async request failed: ".concat(f),ae.ERROR),i("CommitError",void 0,this.error_codes.GENERAL_COMMIT_FAILURE||391),[3,8];case 7:return null==s||s(),[7];case 8:return[2]}})}).call(this)}},{key:"_prepareRequestBody",value:function(e){return{body:Ve(e,Array)?e.join("&"):JSON.stringify(e),contentType:Ve(e,Array)?"application/x-www-form-urlencoded":this.settings.commitRequestDataType}}},{key:"performFetch",value:function(e,t){return Be(function(){var n,r,i;return ze(this,function(o){return"always"===this.settings.asyncModeBeaconBehavior?[2,this.performBeacon(e,t)]:(n=this._prepareRequestBody(t),r=n.contentType,i={method:"POST",mode:this.settings.fetchMode,body:n.body,headers:(s=Ge({},this.settings.xhrHeaders),a={"Content-Type":r},a=null!=a?a:{},Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(a)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(a)).forEach(function(e){Object.defineProperty(s,e,Object.getOwnPropertyDescriptor(a,e))}),s),keepalive:!0},this.settings.xhrWithCredentials&&(i.credentials="include"),[2,fetch(e,i)]);var s,a})}).call(this)}},{key:"performBeacon",value:function(e,t){return Be(function(){var n,r,i;return ze(this,function(o){return n=this,r=this._prepareRequestBody(t),i=navigator.sendBeacon(e,new Blob([r.body],{type:r.contentType})),[2,Promise.resolve({status:i?200:0,ok:i,json:function(){return Be(function(){return ze(this,function(e){return[2,{result:i?"true":"false",errorCode:i?0:this.error_codes.GENERAL_COMMIT_FAILURE||391}]})}).call(n)},text:function(){return Be(function(){return ze(this,function(e){return[2,JSON.stringify({result:i?"true":"false",errorCode:i?0:this.error_codes.GENERAL_COMMIT_FAILURE||391})]})}).call(n)}})]})}).call(this)}},{key:"transformResponse",value:function(e,t){return Be(function(){var result,t,n,r;return ze(this,function(i){switch(i.label){case 0:return i.trys.push([0,5,,7]),"function"!=typeof this.settings.responseHandler?[3,2]:[4,this.settings.responseHandler(e)];case 1:return t=i.sent(),[3,4];case 2:return[4,e.json()];case 3:t=i.sent(),i.label=4;case 4:return result=t,[3,7];case 5:return n=i.sent(),[4,e.text().catch(function(){return"Unable to read response text"})];case 6:return r=i.sent(),[2,{result:x,errorCode:this.error_codes.GENERAL_COMMIT_FAILURE||391,errorMessage:"Failed to parse LMS response: ".concat(Ve(n,Error)?n.message:n+""),errorDetails:JSON.stringify({status:e.status,statusText:e.statusText,url:e.url,responseText:r.substring(0,500),parseError:Ve(n,Error)?n.message:n+""})}];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=Ge({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!==P)}},{key:"updateSettings",value:function(e){this.settings=e}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();function Je(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var Ye=Object.defineProperty,$e="{target=";function Ke(e,t){var n,r=e[t];return void 0===r?(void 0!==console&&console.warn&&console.warn("CMIValueAccessService: Unknown error code key: ".concat(t)),null!==(n=e.GENERAL)&&void 0!==n?n:0):r}var Ze=function(){function e(t){var n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,n){t in e?Ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(n="context")?n+"":n,r),this.context=t}return t=e,(n=[{key:"getUndefinedDataModelErrorCode",value:function(){return Ke(this.context.errorCodes,"UNDEFINED_DATA_MODEL")}},{key:"setCMIValue",value:function(e,t,n,r){if(!n||""===n)return t&&this.context.throwSCORMError(n,Ke(this.context.errorCodes,"GENERAL_SET_FAILURE"),"The data model element was not specified"),x;this.context.setLastErrorCode("0");for(var i=n.split("."),o=this.context.getDataModel(),s=x,a=!1,c="The data model element passed to ".concat(e," (").concat(n,") is not a valid SCORM data model element."),l=this.getUndefinedDataModelErrorCode(),u=0;i.length>u;u++){if(u===i.length-1){s=this.setFinalAttribute(o,i[u],r,n,t,l,c);break}var f=this.traverseToNextLevel(o,i,u,r,n,t,a,l,c);if(f.error)break;o=f.refObject,u=f.idx,a=f.foundFirstIndex}return s===x&&this.context.apiLog(e,"There was an error setting the value for: ".concat(n,", value of: ").concat(r),ae.WARN),s}},{key:"getCMIValue",value:function(e,t,n){if(!n||""===n)return t&&this.context.throwSCORMError(n,Ke(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element was not specified"),"";if(t&&n.endsWith("._version")&&"cmi._version"!==n)return this.context.throwSCORMError(n,Ke(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The _version keyword was used incorrectly"),"";this.context.setLastErrorCode("0");for(var r=n.split("."),i=this.context.getDataModel(),o=null,s="The data model element passed to ".concat(e," (").concat(n,") has not been initialized."),a="The data model element passed to ".concat(e," (").concat(n,") is not a valid SCORM data model element."),c=this.getUndefinedDataModelErrorCode(),l=0;r.length>l;l++){var u=this.validateGetAttribute(i,o=r[l],n,t,c,a,l===r.length-1);if(void 0!==u.returnValue)return u.returnValue;if(u.error)return"";if(null==o){this.context.throwSCORMError(n,c,a);break}if(void 0===(i=i[o])){this.context.throwSCORMError(n,c,a);break}if(Je(i,ne)){var f=this.handleGetArrayAccess(i,r,l,n,s);if(f.error)return"";i=f.refObject,l=f.idx}}return null==i?(t||("_children"===o?this.context.throwSCORMError(n,Ke(this.context.errorCodes,"CHILDREN_ERROR"),void 0):"_count"===o&&this.context.throwSCORMError(n,Ke(this.context.errorCodes,"COUNT_ERROR"),void 0)),""):i}},{key:"setFinalAttribute",value:function(e,t,n,r,i,o,s){return i&&(null==t?void 0:t.startsWith($e))?this.context.isInitialized()?(this.context.throwSCORMError(r,Ke(this.context.errorCodes,"READ_ONLY_ELEMENT")),x):P:void 0!==t&&this.context.checkObjectHasProperty(e,t)?c(r,"\\.correct_responses\\.\\d+$")&&this.context.isInitialized()&&"pattern"!==t&&(this.context.validateCorrectResponse(r,n),"0"!==this.context.getLastErrorCode())?(this.context.throwSCORMError(r,Ke(this.context.errorCodes,"TYPE_MISMATCH")),x):i&&"0"!==this.context.getLastErrorCode()?x:void 0===t||"__proto__"===t||"constructor"===t?(this.context.throwSCORMError(r,o,s),x):i&&"id"===t&&this.context.isInitialized()&&this.context.checkForDuplicateId(r,n)?(this.context.throwSCORMError(r,Ke(this.context.errorCodes,"GENERAL_SET_FAILURE")),x):(e[t]=n,P):(this.context.throwSCORMError(r,o,s),x)}},{key:"traverseToNextLevel",value:function(e,t,n,r,i,o,s,a,c){var l=t[n];if(void 0===l||!this.context.checkObjectHasProperty(e,l))return this.context.throwSCORMError(i,a,c),{refObject:e,idx:n,foundFirstIndex:s,error:!0};if(!(e=e[l]))return this.context.throwSCORMError(i,a,c),{refObject:e,idx:n,foundFirstIndex:s,error:!0};if(Je(e,ne)){var u=this.handleSetArrayAccess(e,t,n,r,i,o,s,a,c);return u.error?{refObject:e,idx:n,foundFirstIndex:s,error:!0}:u}return{refObject:e,idx:n,foundFirstIndex:s,error:!1}}},{key:"handleSetArrayAccess",value:function(e,t,n,r,i,o,s,a,c){var l=parseInt(t[n+1]||"0",10);if(!isNaN(l)){var u=e.childArray[l];if(u)return{refObject:u,idx:n+1,foundFirstIndex:!0,error:!1};if(l>e.childArray.length){var f=o?Ke(this.context.errorCodes,"GENERAL_SET_FAILURE"):Ke(this.context.errorCodes,"INVALID_SET_VALUE")||Ke(this.context.errorCodes,"GENERAL_SET_FAILURE");return this.context.throwSCORMError(i,f,"Cannot set array element at index ".concat(l,". Array indices must be sequential. Current array length is ").concat(e.childArray.length,", expected index ").concat(e.childArray.length,".")),{refObject:e,idx:n,foundFirstIndex:s,error:!0}}var d=this.context.getChildElement(i,r,s);return d?(e.initialized&&d.initialize(),e.childArray[l]=d,{refObject:d,idx:n+1,foundFirstIndex:!0,error:!1}):("0"===this.context.getLastErrorCode()&&this.context.throwSCORMError(i,a,c),{refObject:e,idx:n,foundFirstIndex:s,error:!0})}return{refObject:e,idx:n,foundFirstIndex:s,error:!1}}},{key:"validateGetAttribute",value:function(e,t,n,r,i,o,s){if(r){var a=t+"";if(a.startsWith($e)&&"function"==typeof e._isTargetValid){var c=a.substring(8,a.length-1);return{error:!1,returnValue:e._isTargetValid(c)}}if(void 0===t||!this.context.checkObjectHasProperty(e,t))return"_children"===t?(this.context.throwSCORMError(n,Ke(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element does not have children"),{error:!0}):"_count"===t?(this.context.throwSCORMError(n,Ke(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(n,i,o),{error:!0})}else if(s&&(void 0===t||!this.context.checkObjectHasProperty(e,t)))return"_children"===t?this.context.throwSCORMError(n,Ke(this.context.errorCodes,"CHILDREN_ERROR")):"_count"===t?this.context.throwSCORMError(n,Ke(this.context.errorCodes,"COUNT_ERROR")):this.context.throwSCORMError(n,i,o),{error:!0};return{error:!1}}},{key:"handleGetArrayAccess",value:function(e,t,n,r,i){var o=parseInt(t[n+1]||"",10);if(!isNaN(o)){var s=e.childArray[o];return s?{refObject:s,idx:n+1,error:!1}:(this.context.throwSCORMError(r,Ke(this.context.errorCodes,"VALUE_NOT_INITIALIZED"),i),{refObject:e,idx:n,error:!0})}return{refObject:e,idx:n,error:!1}}}])&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();function Qe(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Xe=Object.defineProperty,et=function(e,t,n){return function(e,t,n){return t in e?Xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},tt=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),et(this,"_logLevel",ae.ERROR),et(this,"_logHandler"),this._logHandler=ue}var t,n,r;return t=e,r=[{key:"getInstance",value:function(){return e._instance||(e._instance=new e),e._instance}}],(n=[{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(ae.ERROR,e)}},{key:"warn",value:function(e){this.log(ae.WARN,e)}},{key:"info",value:function(e){this.log(ae.INFO,e)}},{key:"debug",value:function(e){this.log(ae.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 ae.NONE;if("number"==typeof e)return e;switch("string"==typeof e?e.toUpperCase():e){case"1":case"DEBUG":return ae.DEBUG;case"2":case"INFO":return ae.INFO;case"3":case"WARN":return ae.WARN;case"4":case"ERROR":default:return ae.ERROR;case"5":case"NONE":return ae.NONE}}}])&&Qe(t.prototype,n),r&&Qe(t,r),e}();et(tt,"_instance");var nt=tt;function rt(){return nt.getInstance()}function it(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var ot=Object.defineProperty,st=function(e,t,n){return function(e,t,n){return t in e?ot(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},at=function(){function e(t,n,r,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),st(this,"_lastErrorCode","0"),st(this,"_lastDiagnostic",""),st(this,"_errorCodes"),st(this,"_apiLog"),st(this,"_getLmsErrorMessageDetails"),st(this,"_loggingService"),this._errorCodes=t,this._apiLog=n,this._getLmsErrorMessageDetails=r,this._loggingService=i||rt()}return t=e,(n=[{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,n){this._lastDiagnostic=n||"",n||(n=this._getLmsErrorMessageDetails(t,!0));var r="SCORM Error ".concat(t,": ").concat(n).concat(e?" [Element: ".concat(e,"]"):"");this._apiLog("throwSCORMError",t+": "+n,ae.ERROR,e),this._loggingService.error(r),this._lastErrorCode=t+""}},{key:"clearSCORMError",value:function(e){void 0!==e&&e!==x&&(this._lastErrorCode="0")}},{key:"handleValueAccessException",value:function(e,t,n){if(it(t,j)){var r=t;this._lastErrorCode=r.errorCode+"",this._lastDiagnostic="";var i="Validation Error ".concat(r.errorCode,": ").concat(r.message," [Element: ").concat(e,"]");this._loggingService.warn(i),n=x}else if(it(t,Error)){var o=t.constructor.name,s="".concat(o,": ").concat(t.message," [Element: ").concat(e,"]"),a=t.stack||"";this._loggingService.error("".concat(s,"\n").concat(a)),this.throwSCORMError(e,this._errorCodes.GENERAL,"".concat(o,": ").concat(t.message)),n=x}else{this._loggingService.error("Unknown error occurred while accessing [Element: ".concat(e,"]"));try{var c=JSON.stringify(t);this._loggingService.error("Error details: ".concat(c))}catch(e){this._loggingService.error("Could not stringify error object for details")}this.throwSCORMError(e,this._errorCodes.GENERAL,"Unknown error"),n=x}return n}},{key:"errorCodes",get:function(){return this._errorCodes}}])&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();var ct=Object.defineProperty,lt=function(e,t,n){return function(e,t,n){return t in e?ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},ut=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),lt(this,"listenerMap",new Map),lt(this,"listenerCount",0),lt(this,"apiLog"),this.apiLog=t}return t=e,(n=[{key:"parseListenerName",value:function(e){if(!e)return null;var t=e.split("."),n=t[0],r=null;return t.length>1&&(r=e.replace("".concat(n,"."),"")),{functionName:null!=n?n:e,CMIElement:r}}},{key:"on",value:function(e,t){if(t){var n=e.split(" "),r=!0,i=!1,o=void 0;try{for(var s,a=n[Symbol.iterator]();!(r=(s=a.next()).done);r=!0){var c,l=this.parseListenerName(s.value);if(l){var u=l.functionName,f=l.CMIElement,d=null!==(c=this.listenerMap.get(u))&&void 0!==c?c:[];d.push({functionName:u,CMIElement:f,callback:t}),this.listenerMap.set(u,d),this.listenerCount++,this.apiLog("on","Added event listener: ".concat(this.listenerCount),ae.INFO,u)}}}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}}}},{key:"off",value:function(e,t){if(t){var n=e.split(" "),r=!0,i=!1,o=void 0;try{for(var s,a,c=function(){var e=s.parseListenerName(a.value);if(!e)return"continue";var n=e.functionName,r=e.CMIElement,i=s.listenerMap.get(n);if(!i)return"continue";var o=i.findIndex(function(e){return e.CMIElement===r&&e.callback===t});-1!==o&&(i.splice(o,1),s.listenerCount--,0===i.length&&s.listenerMap.delete(n),s.apiLog("off","Removed event listener: ".concat(s.listenerCount),ae.INFO,n))},l=n[Symbol.iterator]();!(r=(a=l.next()).done);r=!0)s=this,c()}catch(e){i=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(i)throw o}}}}},{key:"clear",value:function(e){var t=e.split(" "),n=!0,r=!1,i=void 0;try{for(var o,s,a=function(){var e=o.parseListenerName(s.value);if(!e)return"continue";var t=e.functionName,n=e.CMIElement;if(o.listenerMap.has(t)){var r=o.listenerMap.get(t),i=null===n?[]:r.filter(function(e){return e.CMIElement!==n});o.listenerCount-=r.length-i.length,0===i.length?o.listenerMap.delete(t):o.listenerMap.set(t,i)}},c=t[Symbol.iterator]();!(n=(s=c.next()).done);n=!0)o=this,a()}catch(e){r=!0,i=e}finally{try{n||null==c.return||c.return()}finally{if(r)throw i}}}},{key:"processListeners",value:function(e,t,n,r){this.apiLog(e,n,ae.INFO,t);var i=this.listenerMap.get(e);if(i){var o=!0,s=!1,a=void 0;try{for(var c,l=i[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value,f=!!u.CMIElement,d=!1;if(t&&u.CMIElement)if(u.CMIElement.endsWith("*")){var h=u.CMIElement.slice(0,-1);d=t.startsWith(h)}else d=u.CMIElement===t;f&&!d||(this.apiLog("processListeners","Processing listener: ".concat(u.functionName),ae.DEBUG,t),e.startsWith("Sequence")?u.callback(n):"CommitError"===e?void 0!==r?u.callback(n,r):u.callback(n):"CommitSuccess"===e?void 0!==r?u.callback(r):u.callback():u.callback(t,n))}}catch(e){s=!0,a=e}finally{try{o||null==l.return||l.return()}finally{if(s)throw a}}}}},{key:"reset",value:function(){this.listenerMap.clear(),this.listenerCount=0}}])&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();function ft(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function dt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){ft(o,r,i,s,a,"next",e)}function a(e){ft(o,r,i,s,a,"throw",e)}s(void 0)})}}function ht(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function vt(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ht(e,t,n[t])})}return e}function yt(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(s,"next",{value:c(0)}),a(s,"throw",{value:c(1)}),a(s,"return",{value:c(2)}),"function"==typeof Symbol&&a(s,Symbol.iterator,{value:function(){return this}}),s;function c(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&i[3]>a[1])){o.label=a[1];break}if(6===a[0]&&i[1]>o.label){o.label=i[1],i=a;break}if(i&&i[2]>o.label){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var _t=Object.defineProperty,pt=function(e,t,n){return function(e,t,n){return t in e?_t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},gt=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),pt(this,"apiLog",r),pt(this,"settings"),pt(this,"error_codes"),pt(this,"storeName","scorm_again_offline_data"),pt(this,"syncQueue","scorm_again_sync_queue"),pt(this,"isOnline",navigator.onLine),pt(this,"syncInProgress",!1),pt(this,"boundOnlineStatusChangeHandler"),pt(this,"boundCustomNetworkStatusHandler"),this.settings=t,this.error_codes=n,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,(n=[{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...",ae.INFO),this.syncOfflineData().then(function(t){t?e.apiLog("OfflineStorageService","Sync completed successfully",ae.INFO):e.apiLog("OfflineStorageService","Sync failed",ae.ERROR)},function(t){e.apiLog("OfflineStorageService","Error during sync: ".concat(t),ae.ERROR)})):t&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",ae.INFO)}},{key:"handleCustomNetworkStatus",value:function(e){var t=this;if(mt(e,CustomEvent)){var n=e.detail.online;if("boolean"==typeof n){var r=this.isOnline;this.isOnline=n,this.apiLog("OfflineStorageService","Network status updated via custom event: ".concat(n?"online":"offline"),ae.INFO),!r&&this.isOnline?(this.apiLog("OfflineStorageService","Device is back online, attempting to sync...",ae.INFO),this.syncOfflineData().then(function(e){e?t.apiLog("OfflineStorageService","Sync completed successfully",ae.INFO):t.apiLog("OfflineStorageService","Sync failed",ae.ERROR)},function(e){t.apiLog("OfflineStorageService","Error during sync: ".concat(e),ae.ERROR)})):r&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",ae.INFO)}else this.apiLog("OfflineStorageService","Invalid online status value in custom event",ae.WARN)}else this.apiLog("OfflineStorageService","Invalid network status event received",ae.WARN)}},{key:"storeOffline",value:function(e,t,n){try{var r=vt({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==n?void 0:n.isTerminateCommit)?{isTerminateCommit:n.isTerminateCommit}:{},void 0!==(null==n?void 0:n.sequence)?{sequence:n.sequence}:{}),i=this.getFromStorage(this.syncQueue)||[];return i.push(r),this.saveToStorage(this.syncQueue,i),this.saveToStorage("".concat(this.storeName,"_").concat(e),t),this.apiLog("OfflineStorageService","Stored data offline for course ".concat(e),ae.INFO),{result:P,errorCode:0}}catch(t){var o,s=(mt(t,Error)?t.message:t+"").includes("storage quota");return this.apiLog("OfflineStorageService",s?"storage quota exceeded - cannot store offline data for course ".concat(e):"Error storing offline data: ".concat(t),ae.ERROR),{result:x,errorCode:null!==(o=this.error_codes.GENERAL)&&void 0!==o?o:0}}}},{key:"getOfflineData",value:function(e){return dt(function(){return yt(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),ae.ERROR),[2,null]}return[2]})}).call(this)}},{key:"syncOfflineData",value:function(){return dt(function(){var e,t,n,r,i,o,s,a,c,l,u,f,d,h;return yt(this,function(m){switch(m.label){case 0:if(this.syncInProgress||!this.isOnline)return[2,!1];this.syncInProgress=!0,m.label=1;case 1:if(m.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"),ae.INFO),t=[],n=!0,r=!1,i=void 0,m.label=2;case 2:m.trys.push([2,9,10,11]),o=e[Symbol.iterator](),m.label=3;case 3:if(n=(s=o.next()).done)return[3,8];if(l=null!==(c=this.settings.maxSyncAttempts)&&void 0!==c?c:5,(a=s.value).syncAttempts>=l)return this.apiLog("OfflineStorageService","Removing abandoned item ".concat(a.id," after ").concat(l," failed sync attempts"),ae.WARN),[3,7];m.label=4;case 4:return m.trys.push([4,6,,7]),[4,this.sendDataToLMS(a.data,vt({},void 0!==a.isTerminateCommit?{isTerminateCommit:a.isTerminateCommit}:{},void 0!==a.sequence?{sequence:a.sequence}:{}))];case 5:return!0===(u=m.sent()).result||u.result===P?this.apiLog("OfflineStorageService","Successfully synced item ".concat(a.id),ae.INFO):(a.syncAttempts++,t.push(a),this.apiLog("OfflineStorageService","Failed to sync item ".concat(a.id,", attempt #").concat(a.syncAttempts),ae.WARN)),[3,7];case 6:return f=m.sent(),a.syncAttempts++,t.push(a),this.apiLog("OfflineStorageService","Error syncing item ".concat(a.id,": ").concat(f),ae.ERROR),[3,7];case 7:return n=!0,[3,3];case 8:return[3,11];case 9:return d=m.sent(),r=!0,i=d,[3,11];case 10:try{n||null==o.return||o.return()}finally{if(r)throw i}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"),ae.INFO),this.syncInProgress=!1,[2,!0];case 12:return h=m.sent(),this.apiLog("OfflineStorageService","Error during sync process: ".concat(h),ae.ERROR),this.syncInProgress=!1,[2,!1];case 13:return[2]}})}).call(this)}},{key:"sendDataToLMS",value:function(e,t){return dt(function(){var n,r,i,o,s,a,c,result,l,f;return yt(this,function(d){switch(d.label){case 0:if(!(n=this.settings.lmsCommitUrl))return[2,{result:x,errorCode:this.error_codes.GENERAL||101}];d.label=1;case 1:return d.trys.push([1,7,,8]),i=n+"",o=this.settings.requestHandler(e,vt({isTerminateCommit:null!==(r=null==t?void 0:t.isTerminateCommit)&&void 0!==r&&r,trigger:"offline-replay"},void 0!==(null==t?void 0:t.sequence)?{sequence:t.sequence}:{})),s=(null==t?void 0:t.isTerminateCommit)&&this.settings.terminateCommitParam?u(i,this.settings.terminateCommitParam,"true"):i,a={method:"POST",mode:this.settings.fetchMode,body:JSON.stringify(o),headers:(h=vt({},this.settings.xhrHeaders),m={"Content-Type":this.settings.commitRequestDataType},m=null!=m?m:{},Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(m)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(m)).forEach(function(e){Object.defineProperty(h,e,Object.getOwnPropertyDescriptor(m,e))}),h)},this.settings.xhrWithCredentials&&(a.credentials="include"),[4,fetch(s,a)];case 2:return c=d.sent(),"function"!=typeof this.settings.responseHandler?[3,4]:[4,this.settings.responseHandler(c)];case 3:return l=d.sent(),[3,6];case 4:return[4,c.json()];case 5:l=d.sent(),d.label=6;case 6:return result=l,200>c.status||c.status>299||!0!==result.result&&result.result!==P?(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 f=d.sent(),this.apiLog("OfflineStorageService","Error sending data to LMS: ".concat(f),ae.ERROR),[2,{result:x,errorCode:this.error_codes.GENERAL||101}];case 8:return[2]}var h,m})}).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(mt(e,DOMException)&&"QuotaExceededError"===e.name)throw Error("storage quota exceeded - localStorage is full",{cause:e});throw e}}},{key:"hasPendingOfflineData",value:function(e){return dt(function(){return yt(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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}(),bt=l(function(e,t,n,r,i,o){if("string"!=typeof t)return!1;var s=RegExp(n),a=t.match(s);if(o&&""===t)return!0;if(!a||""===a[0])throw new i(e,r);return!0},function(e,t,n,r,i,o){var s,a="string"==typeof t?t:"[".concat(void 0===t?"undefined":(s=t)&&"undefined"!=typeof Symbol&&s.constructor===Symbol?"symbol":typeof s,"]");return"".concat(e,":").concat(a,":").concat(n,":").concat(r,":").concat(o||!1)},{maxEntries:1e3,maxKeyLength:2e3}),Et=l(function(e,t,n,r,i){var o=n.split("#");if(isNaN(t=+t))throw new i(e,r);var s=o[0],a=o[1],c=void 0!==a&&""!==a&&"*"!==a;if(void 0!==s&&""!==s&&+s>t)throw new i(e,r);if(c&&t>+a)throw new i(e,r);return!0},function(e,t,n,r,i){return"".concat(e,":").concat(t,":").concat(n,":").concat(r)},{maxEntries:1e3});function St(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);t>n;n++)r[n]=e[n];return r}function Ot(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ct(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){wt(e,t,n[t])})}return e}function Rt(e){return function(e){if(Array.isArray(e))return St(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 St(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?St(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 It=Object.defineProperty,Nt=function(e,t,n){return function(e,t,n){return t in e?It(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},Tt=function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;Ot(this,e),Nt(this,"valid"),Nt(this,"targetActivity"),Nt(this,"exception"),this.valid=t,this.targetActivity=n,this.exception=r},Lt=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5?arguments[5]:void 0;Ot(this,e),Nt(this,"activityTree"),Nt(this,"rollupProcess"),Nt(this,"globalObjectiveMap"),Nt(this,"adlNav"),Nt(this,"eventCallback"),Nt(this,"now"),Nt(this,"defaultHideLmsUi"),Nt(this,"defaultAuxiliaryResources"),Nt(this,"_deliveryInProgress",!1),Nt(this,"contentDelivered",!1),Nt(this,"checkActivityCallback",null),Nt(this,"invalidateCacheCallback",null),Nt(this,"updateNavigationValidityCallback",null),Nt(this,"clearSuspendedActivityCallback",null),this.activityTree=t,this.rollupProcess=n,this.globalObjectiveMap=r,this.adlNav=i,this.eventCallback=o,this.now=(null==s?void 0:s.now)||function(){return new Date},this.defaultHideLmsUi=(null==s?void 0:s.defaultHideLmsUi)?Rt(s.defaultHideLmsUi):[],this.defaultAuxiliaryResources=(null==s?void 0:s.defaultAuxiliaryResources)?s.defaultAuxiliaryResources.map(function(e){return Ct({},e)}):[]}return t=e,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 Tt(!1,null,"DB.1.1-1");var t=this.getActivityPath(e,!0);if(0===t.length)return new Tt(!1,null,"DB.1.1-2");var n=!0,r=!1,i=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done);n=!0)if(this.checkActivityCallback&&!this.checkActivityCallback(o.value))return new Tt(!1,null,"DB.1.1-3")}catch(e){r=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw i}}return new Tt(!0,e)}},{key:"contentDeliveryEnvironmentProcess",value:function(e){this._deliveryInProgress=!0;try{var t=e.isSuspended;this.activityTree.suspendedActivity&&this.clearSuspendedActivityCallback&&this.clearSuspendedActivityCallback();var n=this.getActivityPath(e,!0),r=!0,i=!1,o=void 0;try{for(var s,a=n[Symbol.iterator]();!(r=(s=a.next()).done);r=!0){var c=s.value;c.isActive||(t||c.isSuspended?c.isSuspended=!1:c.incrementAttemptCount(),c.isActive=!0,De.applySelectionAndRandomization(c,1>=c.attemptCount))}}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}this.activityTree.currentActivity=e,this.initializeForDelivery(e),this.setupAttemptTracking(e),this.contentDelivered=!0,this.adlNav&&this.updateNavigationValidityCallback&&this.updateNavigationValidityCallback(),this.fireDeliveryEvent(e)}finally{this._deliveryInProgress=!1}}},{key:"initializeForDelivery",value:function(e){"unknown"===e.completionStatus&&0===e.children.length&&(e.completionStatus="not attempted"),null===e.objectiveSatisfiedStatus&&(e.objectiveSatisfiedStatus=!1),null===e.progressMeasure&&(e.progressMeasure=0,e.progressMeasureStatus=!1),null===e.objectiveNormalizedMeasure&&(e.objectiveNormalizedMeasure=0,e.objectiveMeasureStatus=!1),e.attemptAbsoluteDuration="PT0H0M0S",e.attemptExperiencedDuration="PT0H0M0S",e.isAvailable=!0}},{key:"setupAttemptTracking",value:function(e){e.wasSkipped=!1,e.attemptAbsoluteStartTime=this.now().toISOString(),e.location||(e.location=""),e.activityAttemptActive=!0,e.learnerPrefs||(e.learnerPrefs={audioCaptioning:"0",audioLevel:"1",deliverySpeed:"1",language:""})}},{key:"fireDeliveryEvent",value:function(e){try{this.eventCallback&&this.eventCallback("onActivityDelivery",e),console.debug("Activity delivered: ".concat(e.id," - ").concat(e.title))}catch(e){console.warn("Failed to fire activity delivery event: ".concat(e))}}},{key:"getEffectiveHideLmsUi",value:function(t){var n=new Set,r=!0,i=!1,o=void 0;try{for(var s,a=this.defaultHideLmsUi[Symbol.iterator]();!(r=(s=a.next()).done);r=!0)n.add(s.value)}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}for(var c=t;c;){var l=!0,u=!1,f=void 0;try{for(var d,h=c.hideLmsUi[Symbol.iterator]();!(l=(d=h.next()).done);l=!0)n.add(d.value)}catch(e){u=!0,f=e}finally{try{l||null==h.return||h.return()}finally{if(u)throw f}}c=c.parent}return e.HIDE_LMS_UI_ORDER.filter(function(e){return n.has(e)})}},{key:"getEffectiveAuxiliaryResources",value:function(e){var t=new Map,n=!0,r=!1,i=void 0;try{for(var o,s=this.defaultAuxiliaryResources[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var a=o.value;a.resourceId&&t.set(a.resourceId,Ct({},a))}}catch(e){r=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw i}}for(var c=[],l=e;l;)c.push(l),l=l.parent;var u=!0,f=!1,d=void 0;try{for(var h,m=c.reverse()[Symbol.iterator]();!(u=(h=m.next()).done);u=!0){var v=h.value,y=!0,_=!1,p=void 0;try{for(var g,b=v.auxiliaryResources[Symbol.iterator]();!(y=(g=b.next()).done);y=!0){var E=g.value;E.resourceId&&t.set(E.resourceId,Ct({},E))}}catch(e){_=!0,p=e}finally{try{y||null==b.return||b.return()}finally{if(_)throw p}}}}catch(e){f=!0,d=e}finally{try{u||null==m.return||m.return()}finally{if(f)throw d}}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],n=[],r=e;null!==r;)n.unshift(r),r=r.parent;return!t&&n.length>0&&n.pop(),n}},{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))}}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();Nt(Lt,"HIDE_LMS_UI_ORDER",Rt(["continue","previous","exit","exitAll","abandon","abandonAll","suspendAll"]));var kt=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,n=[{key:"loadFromFlattenedJSON",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(i()){var s=/^(cmi\.interactions\.)(\d+)\.(.*)$/,a=/^(cmi\.objectives\.)(\d+)\.(.*)$/,interactions=[],objectives=[],c=[];for(var l in e)if({}.hasOwnProperty.call(e,l)){var u=l.match(s);if(u){interactions.push({key:l,value:e[l],index:+u[2],field:u[3]||""});continue}var f=l.match(a);if(f){objectives.push({key:l,value:e[l],index:+f[2],field:f[3]||""});continue}c.push({key:l,value:e[l]})}interactions.sort(function(e,t){return e.index!==t.index?e.index-t.index:"id"===e.field?-1:"id"===t.field?1:"type"===e.field?-1:"type"===t.field?1:e.field.localeCompare(t.field)}),objectives.sort(function(e,t){return e.index!==t.index?e.index-t.index:"id"===e.field?-1:"id"===t.field?1:e.field.localeCompare(t.field)}),c.sort(function(e,t){return e.key.localeCompare(t.key)});var d=function(e){e.forEach(function(e){var s={};s[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 n,r,i=result,o="",s=RegExp(pattern);Array.from({length:null!==(n=null===(r=t.match(RegExp(pattern,"g")))||void 0===r?void 0:r.length)&&void 0!==n?n:0},function(){return s.exec(t)}).forEach(function(e){var t;e&&(i=null!==(t=i[o])&&void 0!==t?t:i[o]=e[2]?[]:{},o=e[2]||e[1]||"")}),i[o]=e[t]}),null!==(t=result[""])&&void 0!==t?t:result}(s),n,r,i,o)})};d(interactions),d(objectives),d(c)}else console.error("loadFromFlattenedJSON can only be called before the call to lmsInitialize.")}},{key:"loadFromJSON",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(r()){for(var o in t=void 0!==t?t:"cmi",i(e),e)if({}.hasOwnProperty.call(e,o)&&e[o]){var s=(t?t+".":"")+o,a=e[o];if(a.constructor===Array){for(var c=0;a.length>c;c++)if(a[c]){var l=a[c],u="".concat(s,".").concat(c);l.constructor===Object?this.loadFromJSON(l,u,n,r,i):n(u,l)}}else a.constructor===Object?this.loadFromJSON(a,s,n,r,i):n(s,a)}}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,n,r,i,o){var s=t||e,a=n?r(e,s):i(e,s);return[ae.DEBUG,"1",1,"DEBUG"].includes(o)&&(console.debug("Commit (terminated: "+(e?"yes":"no")+"): "),console.debug(a)),a}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();function Mt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);t>n;n++)r[n]=e[n];return r}function At(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var jt=Object.defineProperty,Pt=function(e,t,n){return function(e,t,n){return t in e?jt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},xt=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Pt(this,"settings"),Pt(this,"error_codes"),this.settings=t,this.error_codes=n}return t=e,n=[{key:"processHttpRequest",value:function(e,t){var n=arguments.length>5?arguments[5]:void 0;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?this._handleImmediateRequest(e,t,n):this._performSyncXHR(e,t,n)}},{key:"_handleImmediateRequest",value:function(e,t,n){var r=void 0===n?this.settings.requestHandler(t):this.settings.requestHandler(t,n),i=this._prepareRequestBody(null!=r?r:t).body,o=navigator.sendBeacon(e,new Blob([i],{type:"text/plain;charset=UTF-8"}));return{result:o?"true":"false",errorCode:o?0:this.error_codes.GENERAL_COMMIT_FAILURE||391}}},{key:"_performSyncXHR",value:function(e,t,n){var r=void 0===n?this.settings.requestHandler(t):this.settings.requestHandler(t,n),i=this._prepareRequestBody(null!=r?r:t),o=i.body,s=i.contentType,a=new XMLHttpRequest;a.open("POST",e,!1),a.setRequestHeader("Content-Type",s),Object.entries(this.settings.xhrHeaders).forEach(function(e){var t,n,r=(n=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Mt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mt(e,t):void 0}}(t,n)||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.")}());a.setRequestHeader(r[0],r[1]+"")}),this.settings.xhrWithCredentials&&(a.withCredentials=!0);try{return a.send(o),this.settings.xhrResponseHandler(a)}catch(e){var c=At(e,Error)?e.message:e+"";return{result:x,errorCode:this.error_codes.GENERAL_COMMIT_FAILURE||391,errorMessage:c}}}},{key:"_prepareRequestBody",value:function(e){return{body:At(e,Array)?e.join("&"):JSON.stringify(e),contentType:At(e,Array)?"application/x-www-form-urlencoded":this.settings.commitRequestDataType}}},{key:"updateSettings",value:function(e){this.settings=e}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();function Dt(e,t,n,r){return bt(e,t,n,$.TYPE_MISMATCH,H,r)}function Ft(e,t,n,r){if(""===t)throw new H(e,$.VALUE_OUT_OF_RANGE);return Et(e,t,n,$.VALUE_OUT_OF_RANGE,H)}var Bt=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,n=[{key:"validateScore",value:function(e,t,n,r,i,o,s){return!(7>=arguments.length||void 0===arguments[7]||!arguments[7]||""!==t)||bt(e,t,n,i,s)&&(!r||Et(e,t,r,o,s))}},{key:"validateScorm12Audio",value:function(e,t){return Dt(e,t,he)&&Ft(e,t,"-1#100")}},{key:"validateScorm12Language",value:function(e,t){return Dt(e,t,fe)}},{key:"validateScorm12Speed",value:function(e,t){return Dt(e,t,he)&&Ft(e,t,"-100#100")}},{key:"validateScorm12Text",value:function(e,t){return Dt(e,t,he)&&Ft(e,t,"-1#1")}},{key:"validateReadOnly",value:function(e,t){if(t)throw new H(e,$.READ_ONLY_ELEMENT)}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}(),Ut=new Bt;function Vt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);t>n;n++)r[n]=e[n];return r}function Gt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Ht(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Gt(e,t,n[t])})}return e}function qt(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 n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function Wt(e){return function(e){if(Array.isArray(e))return Vt(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 Vt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vt(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 Jt(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Yt=Object.defineProperty,$t=function(e,t,n){return function(e,t,n){return t in e?Yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":Jt(t))?t+"":t,n)},Kt=function(){function e(t,n,r,i,o,s,a,c,l){var u=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),$t(this,"_timeout"),$t(this,"_error_codes"),$t(this,"_settings",le),$t(this,"_httpService"),$t(this,"_eventService"),$t(this,"_serializationService"),$t(this,"_errorHandlingService"),$t(this,"_loggingService"),$t(this,"_offlineStorageService"),$t(this,"_cmiValueAccessService"),$t(this,"_courseId",""),$t(this,"_pendingCommitCount",0),$t(this,"_commitSequence",0),$t(this,"_commitSettleWaiters",[]),$t(this,"_setCMIElements",new Set),$t(this,"startingData"),$t(this,"currentState"),(zt(this,e)?this.constructor:void 0)===e)throw new TypeError("Cannot construct BaseAPI instances directly");this.currentState=0,this._error_codes=t,n&&(this.settings=Ht({},le,n)),void 0!==(null==n?void 0:n.asyncCommit)&&void 0===n.useAsynchronousCommits&&void 0===n.throttleCommits&&(console.warn("DEPRECATED: 'asyncCommit' setting is deprecated and will be removed in a future version. Use 'useAsynchronousCommits: true' and 'throttleCommits: true' instead."),n.asyncCommit&&(this.settings.useAsynchronousCommits=!0,this.settings.throttleCommits=!0)),!this.settings.useAsynchronousCommits&&this.settings.throttleCommits&&(console.warn("throttleCommits cannot be used with synchronous commits. Setting throttleCommits to false."),this.settings.throttleCommits=!1),this._loggingService=c||rt(),this._loggingService.setLogLevel(this.settings.logLevel),this._loggingService.setLogHandler(this.settings.onLogMessage?this.settings.onLogMessage:ue),r?this._httpService=r: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 We(this.settings,this._error_codes)):this._httpService=new xt(this.settings,this._error_codes),this._eventService=i||new ut(function(e,t,n,r){return u.apiLog(e,t,n,r)}),this._serializationService=o||new kt,this._errorHandlingService=a||new at(this._error_codes,function(e,t,n,r){return u.apiLog(e,t,n||ae.ERROR,r)},function(e,t){return u.getLmsErrorMessageDetails(e,t)},void 0),this.settings.enableOfflineSupport&&(this._offlineStorageService=l||new gt(this.settings,this._error_codes,function(e,t,n,r){return u.apiLog(e,t,n,r)}),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",ae.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),ae.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",ae.INFO),u.loadFromJSON(e.runtimeData))}).catch(function(e){u.apiLog("constructor","Error retrieving offline data: ".concat(e),ae.ERROR)})),this._cmiValueAccessService=new Ze({errorCodes:this._error_codes,getLastErrorCode:function(){return u.lastErrorCode},setLastErrorCode:function(e){u.lastErrorCode=e},throwSCORMError:function(e,t,n){return u.throwSCORMError(e,t,n)},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,n){return u.getChildElement(e,t,n)},apiLog:function(e,t,n){return u.apiLog(e,t,n)},checkObjectHasProperty:function(e,t){return u._checkObjectHasProperty(e,t)},getDataModel:function(){return u}})}return t=e,n=[{key:"lastErrorCode",get:function(){var e,t;return null!==(e=null===(t=this._errorHandlingService)||void 0===t?void 0:t.lastErrorCode)&&void 0!==e?e:"0"},set:function(e){this._errorHandlingService&&(this._errorHandlingService.lastErrorCode=e)}},{key:"eventService",get:function(){return this._eventService}},{key:"loggingService",get:function(){return this._loggingService}},{key:"commonReset",value:function(e){this.apiLog("reset","Called",ae.INFO),this.settings=Ht({},this.settings,e),this.clearScheduledCommit(),this.currentState=0,this.lastErrorCode="0",this._eventService.reset(),this.startingData={},this._setCMIElements.clear(),this._offlineStorageService&&(this._offlineStorageService.updateSettings(this.settings),(null==e?void 0:e.courseId)&&(this._courseId=e.courseId))}},{key:"initialize",value:function(e,t,n){var r=this,i=x;return this.isInitialized()?this.throwSCORMError("api",this._error_codes.INITIALIZED,t):this.isTerminated()?this.throwSCORMError("api",this._error_codes.TERMINATED,n):(this.settings.selfReportSessionTime&&this.cmi.setStartTime(),this.currentState=1,this.lastErrorCode="0",i=P,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 n;t&&(r.apiLog(e,"Syncing pending offline data on initialization",ae.INFO),null===(n=r._offlineStorageService)||void 0===n||n.syncOfflineData().then(function(t){t&&(r.apiLog(e,"Successfully synced offline data",ae.INFO),r.processListeners("OfflineDataSynced"))}))})),this.apiLog(e,"returned: "+i,ae.INFO),this.clearSCORMError(i),i}},{key:"apiLog",value:function(e,t,n,r){t=function(e,t,n){var r=e?"".concat((e+"").padEnd(20),": "):"";return n&&(r=(r+=n).padEnd(70)),r+(null!=t?t:"")}(e,t,r),this._loggingService.log(n,t)}},{key:"settings",get:function(){return this._settings},set:function(e){var t,n,r,i=this._settings;this._settings=Ht({},this._settings,e),null===(t=this._httpService)||void 0===t||t.updateSettings(this._settings),void 0!==e.logLevel&&e.logLevel!==i.logLevel&&(null===(n=this._loggingService)||void 0===n||n.setLogLevel(e.logLevel)),void 0!==e.onLogMessage&&e.onLogMessage!==i.onLogMessage&&(null===(r=this._loggingService)||void 0===r||r.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(n){var r={resolve:n};void 0!==(null==e?void 0:e.timeoutMs)&&(r.timeoutId=setTimeout(function(){var e=t._commitSettleWaiters.indexOf(r);-1!==e&&(t._commitSettleWaiters.splice(e,1),n())},e.timeoutMs)),t._commitSettleWaiters.push(r)})}},{key:"_flushCommitSettleWaiters",value:function(){var e=this._commitSettleWaiters.splice(0),t=!0,n=!1,r=void 0;try{for(var i,o=e[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var s=i.value;void 0!==s.timeoutId&&clearTimeout(s.timeoutId),s.resolve()}}catch(e){n=!0,r=e}finally{try{t||null==o.return||o.return()}finally{if(n)throw r}}}},{key:"terminate",value:function(e,t){var n=P,r=!1;if(this.isNotInitialized()){var i,o=null!==(i=this._error_codes.TERMINATION_BEFORE_INIT)&&void 0!==i?i:0;this.throwSCORMError("api",o),112===o&&(n=x)}else if(t&&this.isTerminated()){var s,a=null!==(s=this._error_codes.MULTIPLE_TERMINATION)&&void 0!==s?s:0;this.throwSCORMError("api",a),113===a&&(n=x)}else{var c;r=!0,this.processListeners("BeforeTerminate");var result=this.storeData(!0,"terminate");if((null!==(c=result.errorCode)&&void 0!==c?c:0)>0){var l;result.errorMessage&&this.apiLog("terminate","Terminate failed with error: ".concat(result.errorMessage),ae.ERROR),result.errorDetails&&this.apiLog("terminate","Error details: ".concat(JSON.stringify(result.errorDetails)),ae.DEBUG),this.throwSCORMError("api",null!==(l=result.errorCode)&&void 0!==l?l:0),n=x}else{var u;this.currentState=2,t&&(this.lastErrorCode="0");var f=null!==(u=null==result?void 0:result.result)&&void 0!==u?u:P;n="boolean"==typeof f?f+"":f}this.processListeners(e)}return this.apiLog(e,"returned: "+n,ae.INFO),r&&this.clearSCORMError(n),n}},{key:"getValue",value:function(e,t,n){var r,i,o="";if(this.checkState(t,null!==(r=this._error_codes.RETRIEVE_BEFORE_INIT)&&void 0!==r?r:0,null!==(i=this._error_codes.RETRIEVE_AFTER_TERM)&&void 0!==i?i:0)){try{o=this.getCMIValue(n)}catch(e){o=this.handleValueAccessException(n,e,o)}"0"===this.lastErrorCode&&this.checkUninitializedGet(n,o),this.processListeners(e,n)}return this.apiLog(e,": returned: "+o,ae.INFO,n),void 0===o?"":("0"===this.lastErrorCode&&this.clearSCORMError(o),"number"==typeof o||"boolean"==typeof o?o+"":o)}},{key:"setValue",value:function(e,t,n,r,i){var o,s;void 0!==i&&(i+="");var a=x;if(this.checkState(n,null!==(o=this._error_codes.STORE_BEFORE_INIT)&&void 0!==o?o:0,null!==(s=this._error_codes.STORE_AFTER_TERM)&&void 0!==s?s:0)){try{a=this.setCMIValue(r,i)}catch(e){a=this.handleValueAccessException(r,e,a)}this.processListeners(e,r,i)}return void 0===a&&(a=x),this.lastErrorCode+""=="0"&&this.settings.autocommit&&this.scheduleCommit(1e3*this.settings.autocommitSeconds,t),this.apiLog(e,": "+i+": result: "+a,ae.INFO,r),"0"===this.lastErrorCode&&this.clearSCORMError(a),a}},{key:"commit",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"manual";this.clearScheduledCommit();var i=P;if(this.isNotInitialized()){var o,s=null!==(o=this._error_codes.COMMIT_BEFORE_INIT)&&void 0!==o?o:0;this.throwSCORMError("api",s),142===s&&(i=x)}else if(n&&this.isTerminated()){var a,c=null!==(a=this._error_codes.COMMIT_AFTER_TERM)&&void 0!==a?a:0;this.throwSCORMError("api",c),143===c&&(i=x)}else{var l,u,result=this.storeData(!1,r),f=null!==(l=result.errorCode)&&void 0!==l?l:0;f>0&&(result.errorMessage&&this.apiLog("commit","Commit failed with error: ".concat(result.errorMessage),ae.ERROR),result.errorDetails&&this.apiLog("commit","Error details: ".concat(JSON.stringify(result.errorDetails)),ae.DEBUG),this.throwSCORMError("api",f));var d=null!==(u=null==result?void 0:result.result)&&void 0!==u?u:x;this.apiLog(e," Result: "+(i="boolean"==typeof d?d+"":d),ae.DEBUG,"HttpRequest"),n&&0===f&&(this.lastErrorCode="0"),this.processListeners(e),this.settings.enableOfflineSupport&&this._offlineStorageService&&this._offlineStorageService.isDeviceOnline()&&this._courseId&&this._offlineStorageService.hasPendingOfflineData(this._courseId).then(function(n){var r;n&&(t.apiLog(e,"Syncing pending offline data",ae.INFO),null===(r=t._offlineStorageService)||void 0===r||r.syncOfflineData().then(function(n){n?(t.apiLog(e,"Successfully synced offline data",ae.INFO),t.processListeners("OfflineDataSynced")):t.apiLog(e,"Failed to sync some offline data",ae.WARN)}))})}return this.apiLog(e,"returned: "+i,ae.INFO),this.isNotInitialized()||n&&this.isTerminated()||this.clearSCORMError(i),i}},{key:"getLastError",value:function(e){var t=this.lastErrorCode+"";return this.processListeners(e),this.apiLog(e,"returned: "+t,ae.INFO),t}},{key:"getErrorString",value:function(e,t){var n="";return null!==t&&""!==t&&(n=this.getLmsErrorMessageDetails(t),this.processListeners(e)),n.length>255&&(n=n.substring(0,255)),this.apiLog(e,"returned: "+n,ae.INFO),n}},{key:"getDiagnostic",value:function(e,t){var n="",r=""===t?this.lastErrorCode+"":t;if(null!==r&&""!==r){var i=this._errorHandlingService.lastDiagnostic;n=i&&r+""==this.lastErrorCode+""?i:this.getLmsErrorMessageDetails(r,!0),this.processListeners(e)}return n.length>255&&(n=n.substring(0,255)),this.apiLog(e,"returned: "+n,ae.INFO),n}},{key:"checkState",value:function(e,t,n){return this.isNotInitialized()?(this.throwSCORMError("api",t),!1):!e||!this.isTerminated()||(this.throwSCORMError("api",n),!1)}},{key:"_checkForDuplicateId",value:function(e,t){var n=function(e,t){if(e&&"object"===(void 0===e?"undefined":Jt(e))&&t in e){var n=e[t];return zt(n,ne)?n:void 0}},r=function(e,t,n){for(var r=0;e.childArray.length>r;r++)if(r!==t){var i=e.childArray[r];if(i&&"object"===(void 0===i?"undefined":Jt(i))&&"id"in i&&i.id===n)return!0}return!1},i=e.match(/^cmi\.objectives\.(\d+)\.id$/);if(i&&i[1]){var o=parseInt(i[1],10),objectives=n(this.cmi,"objectives");return!!objectives&&r(objectives,o,t)}var s=e.match(/^cmi\.interactions\.(\d+)\.id$/);if(s&&s[1]){var a=parseInt(s[1],10),interactions=n(this.cmi,"interactions");return!!interactions&&r(interactions,a,t)}var c=e.match(/^cmi\.interactions\.(\d+)\.objectives\.(\d+)\.id$/);if(c&&c[1]&&c[2]){var l=parseInt(c[1],10),u=parseInt(c[2],10),f=n(this.cmi,"interactions");if(f){var d=f.childArray[l];if(d){var h=n(d,"objectives");if(h)return r(h,u,t)}}return!1}return!1}},{key:"getLmsErrorMessageDetails",value:function(e){throw Error("The getLmsErrorMessageDetails method has not been implemented")}},{key:"getCMIValue",value:function(e){throw Error("The getCMIValue method has not been implemented")}},{key:"setCMIValue",value:function(e,t){throw Error("The setCMIValue method has not been implemented")}},{key:"_commonSetCMIValue",value:function(e,t,n,r){var result=this._cmiValueAccessService.setCMIValue(e,t,n,r);return result===P&&this._setCMIElements.add(n),result}},{key:"_commonGetCMIValue",value:function(e,t,n){return this._cmiValueAccessService.getCMIValue(e,t,n)}},{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,n,r){void 0!==r?this._eventService.processListeners(e,t,n,r):this._eventService.processListeners(e,t,n)}},{key:"throwSCORMError",value:function(e,t,n){this._errorHandlingService.throwSCORMError(e,null!=t?t:0,n)}},{key:"clearSCORMError",value:function(e){this._errorHandlingService.clearSCORMError(e)}},{key:"loadFromFlattenedJSON",value:function(e,t){var n=this;t||(t=""),this._serializationService.loadFromFlattenedJSON(e,t,function(e,t){return n.setCMIValue(e,t)},function(){return n.isNotInitialized()},function(e){n.startingData=e})}},{key:"getFlattenedCMI",value:function(){return s(this.renderCMIToJSONObject())}},{key:"loadFromJSON",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";n&&""!==n||Object.hasOwnProperty.call(e,"cmi")||Object.hasOwnProperty.call(e,"adl")||(n="cmi"),this._serializationService.loadFromJSON(e,n,function(e,n){return t.setCMIValue(e,n)},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 n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0,o=++this._commitSequence;this._pendingCommitCount+=1;var s=!1,a=!1,c=function(){s||(s=!0,n._pendingCommitCount-=1,0===n._pendingCommitCount&&n._flushCommitSettleWaiters())};try{var l=null!=i?i:r?"terminate":"manual",f=t;if(r&&this.settings.terminateCommitPayloadField){var d=this.settings.terminateCommitPayloadField;Array.isArray(f)?f=Wt(f).concat(["".concat(encodeURIComponent(d),"=true")]):f&&"object"===(void 0===f?"undefined":Jt(f))&&(f=qt(Ht({},f),Gt({},d,!0)))}!0===this.settings.includeCommitSequence&&(Array.isArray(f)?f=Wt(f).concat(["commitSequence=".concat(o)]):f&&"object"===(void 0===f?"undefined":Jt(f))&&(f=qt(Ht({},f),{commitSequence:o})));var h,m=r&&this.settings.terminateCommitParam?u(e,this.settings.terminateCommitParam,"true"):e,v={isTerminateCommit:r,trigger:l,sequence:o},y={url:m,trigger:l,isTerminateCommit:r,sequence:o};if(this.settings.enableOfflineSupport&&this._offlineStorageService&&!this._offlineStorageService.isDeviceOnline()&&this._courseId)return this.apiLog("processHttpRequest","Device is offline, storing data locally",ae.INFO),f&&"object"===(void 0===f?"undefined":Jt(f))&&"cmi"in f?this._offlineStorageService.storeOffline(this._courseId,f,{isTerminateCommit:r,sequence:o}):(this.apiLog("processHttpRequest","Invalid commit data format for offline storage",ae.ERROR),{result:x,errorCode:null!==(h=this._error_codes.GENERAL)&&void 0!==h?h:101});var result=this._httpService.processHttpRequest(m,f,r,function(e,t,r,i){return n.apiLog(e,t,r,i)},function(e,t,r){"CommitSuccess"===e||"CommitError"===e?("CommitError"===e&&"number"==typeof r&&(y.errorCode=r),c(),n.processListeners(e,t,r,y)):n.processListeners(e,t,r)},v,c);return a=!0===this._httpService.reportsRequestCompletion,result}finally{a||c()}}},{key:"scheduleCommit",value:function(e,t){this._timeout||(this._timeout=new we(this,e,t),this.apiLog("scheduleCommit","scheduled",ae.DEBUG,""))}},{key:"clearScheduledCommit",value:function(){this._timeout&&(this._timeout.cancel(),this._timeout=void 0,this.apiLog("clearScheduledCommit","cleared",ae.DEBUG,""))}},{key:"_checkObjectHasProperty",value:function(e,t){return null!=e&&"object"===(void 0===e?"undefined":Jt(e))&&(Object.hasOwnProperty.call(e,t)||null!=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),t)||t in e)}},{key:"handleValueAccessException",value:function(e,t,n){return zt(t,j)?(this.lastErrorCode=t.errorCode+"",""!==n&&(n=x),this.throwSCORMError(e,t.errorCode,t.errorMessage)):zt(t,Error)&&t.message?this.throwSCORMError(e,this._error_codes.GENERAL,t.message):this.throwSCORMError(e,this._error_codes.GENERAL,"Unknown error"),n}},{key:"getCommitObject",value:function(e){var t=this;return this._serializationService.getCommitObject(e,this.settings.alwaysSendTotalTime,this.settings.renderCommonCommitFields,function(e,n){return t.renderCommitObject(e,n)},function(e,n){return t.renderCommitCMI(e,n)},this.settings.logLevel)}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();function Zt(e){return Zt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Zt(e)}function Qt(e,t){return Qt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Qt(e,t)}function Xt(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function en(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(en=function(){return!!result})()}var tn=Object.defineProperty,nn=function(e,t,n){return function(e,t,n){return t in e?tn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":Xt(t))?t+"":t,n)},rn=function(e){function t(e){var n,r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,n){return t=Zt(t),r=e,!(i=en()?Reflect.construct(t,n||[],Zt(e).constructor):t.apply(e,n))||"object"!==Xt(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,[e.CMIElement]),nn(n,"__children"),nn(n,"__score_range"),nn(n,"__invalid_error_code"),nn(n,"__invalid_type_code"),nn(n,"__invalid_range_code"),nn(n,"__decimal_regex"),nn(n,"__error_class"),nn(n,"__allow_empty_string"),nn(n,"_raw",""),nn(n,"_min",""),nn(n,"_max"),n.__children=e.score_children||D.score_children,n.__score_range=!!e.score_range&&pe,n._max=e.max||""===e.max?e.max:"100",n.__invalid_error_code=e.invalidErrorCode||$.INVALID_SET_VALUE,n.__invalid_type_code=e.invalidTypeCode||$.TYPE_MISMATCH,n.__invalid_range_code=e.invalidRangeCode||$.VALUE_OUT_OF_RANGE,n.__decimal_regex=e.decimalRegex||me,n.__error_class=e.errorClass,n.__allow_empty_string=null!==(r=e.allowEmptyString)&&void 0!==r&&r,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&&Qt(e,t)}(t,e),n=t,(r=[{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){Ut.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){Ut.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){Ut.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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,r),t;var n,r}(g);function sn(e,t,n){return sn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=an(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n||e):i.value}},sn(e,t,n||e)}function an(e){return an=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},an(e)}function cn(e,t){return cn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},cn(e,t)}function ln(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function un(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(un=function(){return!!result})()}var fn=Object.defineProperty,dn=function(e,t,n){return function(e,t,n){return t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":ln(t))?t+"":t,n)},hn=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,n){return t=an(t),r=e,!(i=un()?Reflect.construct(t,n||[],an(e).constructor):t.apply(e,n))||"object"!==ln(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,["cmi.core"]),dn(e,"score"),dn(e,"__children",D.core_children),dn(e,"_student_id",""),dn(e,"_student_name",""),dn(e,"_lesson_location",""),dn(e,"_credit",""),dn(e,"_lesson_status","not attempted"),dn(e,"_entry",""),dn(e,"_total_time",""),dn(e,"_lesson_mode","normal"),dn(e,"_exit",""),dn(e,"_session_time","00:00:00"),dn(e,"_suspend_data",""),e.score=new rn({CMIElement:"cmi.core.score",score_children:D.score_children,score_range:pe,invalidErrorCode:$.INVALID_SET_VALUE,invalidTypeCode:$.TYPE_MISMATCH,invalidRangeCode:$.VALUE_OUT_OF_RANGE,errorClass:H,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&&cn(e,t)}(t,e),n=t,(o=[{key:"initialize",value:function(){var e;sn(an(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 H(this._cmi_element+"._children",$.INVALID_SET_VALUE)}},{key:"student_id",get:function(){return this._student_id},set:function(student_id){if(this.initialized)throw new H(this._cmi_element+".student_id",$.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 H(this._cmi_element+".student_name",$.READ_ONLY_ELEMENT);this._student_name=student_name}},{key:"lesson_location",get:function(){return this._lesson_location},set:function(lesson_location){Dt(this._cmi_element+".lesson_location",lesson_location,fe,!0)&&(this._lesson_location=lesson_location)}},{key:"credit",get:function(){return this._credit},set:function(credit){if(this.initialized)throw new H(this._cmi_element+".credit",$.READ_ONLY_ELEMENT);Dt(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?Dt(this._cmi_element+".lesson_status",lesson_status,"^(passed|completed|failed|incomplete|browsed)$")&&(this._lesson_status=lesson_status):Dt(this._cmi_element+".lesson_status",lesson_status,_e)&&(this._lesson_status=lesson_status)}},{key:"entry",get:function(){return this._entry},set:function(entry){if(this.initialized)throw new H(this._cmi_element+".entry",$.READ_ONLY_ELEMENT);Dt(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 H(this._cmi_element+".total_time",$.READ_ONLY_ELEMENT);if(Dt(this._cmi_element+".total_time",total_time,de,!0))if(total_time){var e=i(total_time,de);this._total_time=r(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 H(this._cmi_element+".lesson_mode",$.READ_ONLY_ELEMENT);Dt(this._cmi_element+".lesson_mode",lesson_mode,"^(normal|browse|review)$")&&(this._lesson_mode=lesson_mode)}},{key:"exit",get:function(){if(!this.jsonString)throw new H(this._cmi_element+".exit",$.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=""),Dt(this._cmi_element+".exit",exit,"^(time-out|suspend|logout|)$",!0)&&(this._exit=exit)}},{key:"session_time",get:function(){if(!this.jsonString)throw new H(this._cmi_element+".session_time",$.WRITE_ONLY_ELEMENT);return this._session_time},set:function(session_time){if(Dt(this._cmi_element+".session_time",session_time,de)){var e=i(session_time,de);this._session_time=r(e)}}},{key:"suspend_data",get:function(){return this._suspend_data},set:function(suspend_data){Dt(this._cmi_element+".suspend_data",suspend_data,"^[\\s\\S]{0,64000}$",!0)&&(this._suspend_data=suspend_data)}},{key:"getCurrentTotalTime",value:function(e){var t,n,o,s=this._session_time;return void 0!==e&&(s=r(((new Date).getTime()-e)/1e3)),t=this._total_time,n=s,"string"==typeof(o=RegExp(de))&&(o=RegExp(o)),r(i(t,o)+i(n,o))}},{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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,o),t;var n,o}(g);function mn(e,t,n){return t=yn(t),r=e,!(i=bn()?Reflect.construct(t,n||[],yn(e).constructor):t.apply(e,n))||"object"!==gn(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}function vn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yn(e){return yn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},yn(e)}function _n(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&&pn(e,t)}function pn(e,t){return pn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},pn(e,t)}function gn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function bn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(bn=function(){return!!result})()}var En=Object.defineProperty,Sn=function(e,t,n){return function(e,t,n){return t in e?En(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":gn(t))?t+"":t,n)},On=function(e){function t(){return vn(this,t),mn(this,t,[{CMIElement:"cmi.objectives",children:D.objectives_children,errorCode:$.INVALID_SET_VALUE,errorClass:H}])}return _n(t,e),t}(ne),wn=function(e){function t(){var e;return vn(this,t),e=mn(this,t,["cmi.objectives.n"]),Sn(e,"score"),Sn(e,"_id",""),Sn(e,"_status",""),e.score=new rn({CMIElement:"cmi.objectives.n.score",score_children:D.score_children,score_range:pe,invalidErrorCode:$.INVALID_SET_VALUE,invalidTypeCode:$.TYPE_MISMATCH,invalidRangeCode:$.VALUE_OUT_OF_RANGE,errorClass:H,allowEmptyString:!0}),e}return _n(t,e),n=t,(r=[{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){Dt(this._cmi_element+".id",id,ve)&&(this._id=id)}},{key:"status",get:function(){return this._status},set:function(status){Dt(this._cmi_element+".status",status,_e)&&(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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,r),t;var n,r}(g);function Cn(e){return Cn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Cn(e)}function Rn(e,t){return Rn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Rn(e,t)}function In(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Nn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Nn=function(){return!!result})()}var Tn=Object.defineProperty,Ln=function(e,t,n){return function(e,t,n){return t in e?Tn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":In(t))?t+"":t,n)},kn=function(e){function t(e){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,n){return t=Cn(t),r=e,!(i=Nn()?Reflect.construct(t,n||[],Cn(e).constructor):t.apply(e,n))||"object"!==In(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,["cmi.student_data"]),Ln(n,"__children"),Ln(n,"_mastery_score",""),Ln(n,"_max_time_allowed",""),Ln(n,"_time_limit_action",""),n.__children=e||D.student_data_children,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&&Rn(e,t)}(t,e),n=t,(s=[{key:"reset",value:function(){this._initialized=!1}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new H(this._cmi_element+"._children",$.INVALID_SET_VALUE)}},{key:"mastery_score",get:function(){return this._mastery_score},set:function(mastery_score){if(Ut.validateReadOnly(this._cmi_element+".mastery_score",this.initialized),null!=mastery_score){var e=mastery_score;"string"!=typeof e&&(e+=""),""!==e?Dt(this._cmi_element+".mastery_score",e,me)&&Ft(this._cmi_element+".mastery_score",e,pe)&&(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(Ut.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{Dt(t,e,de,!0);var n=i(e,de);return r(n)}catch(e){}try{Dt(t,e,ge,!0);var s=o(e,ge);return r(s)}catch(e){}throw new H(t,$.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(Ut.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+"";Dt(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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,s),t;var n,s}(g);function Mn(e){return Mn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Mn(e)}function An(e,t){return An=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},An(e,t)}function jn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Pn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Pn=function(){return!!result})()}var xn=Object.defineProperty,Dn=function(e,t,n){return function(e,t,n){return t in e?xn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":jn(t))?t+"":t,n)},Fn=function(e){function t(e){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,n){return t=Mn(t),r=e,!(i=Pn()?Reflect.construct(t,n||[],Mn(e).constructor):t.apply(e,n))||"object"!==jn(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,["cmi.student_preference"]),Dn(n,"__children"),Dn(n,"_audio",""),Dn(n,"_language",""),Dn(n,"_speed",""),Dn(n,"_text",""),n.__children=e||D.student_preference_children,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&&An(e,t)}(t,e),n=t,(r=[{key:"reset",value:function(){this._initialized=!1}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new H(this._cmi_element+"._children",$.INVALID_SET_VALUE)}},{key:"audio",get:function(){return this._audio},set:function(audio){Ut.validateScorm12Audio(this._cmi_element+".audio",audio)&&(this._audio=audio)}},{key:"language",get:function(){return this._language},set:function(language){Ut.validateScorm12Language(this._cmi_element+".language",language)&&(this._language=language)}},{key:"speed",get:function(){return this._speed},set:function(speed){Ut.validateScorm12Speed(this._cmi_element+".speed",speed)&&(this._speed=speed)}},{key:"text",get:function(){return this._text},set:function(text){Ut.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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,r),t;var n,r}(g);function Bn(e,t,n){return t=zn(t),r=e,!(i=Jn()?Reflect.construct(t,n||[],zn(e).constructor):t.apply(e,n))||"object"!==Wn(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}function Un(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vn(e,t,n){return t&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Gn(e,t,n){return Gn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=zn(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n||e):i.value}},Gn(e,t,n||e)}function zn(e){return zn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},zn(e)}function Hn(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&&qn(e,t)}function qn(e,t){return qn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},qn(e,t)}function Wn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Jn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Jn=function(){return!!result})()}var Yn=Object.defineProperty,$n=function(e,t,n){return function(e,t,n){return t in e?Yn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":Wn(t))?t+"":t,n)},Kn=function(e){function t(){return Un(this,t),Bn(this,t,[{CMIElement:"cmi.interactions",children:D.interactions_children,errorCode:$.INVALID_SET_VALUE,errorClass:H}])}return Hn(t,e),t}(ne),Zn=function(e){function t(){var e;return Un(this,t),e=Bn(this,t,["cmi.interactions.n"]),$n(e,"objectives"),$n(e,"correct_responses"),$n(e,"_id",""),$n(e,"_time",""),$n(e,"_type",""),$n(e,"_weighting",""),$n(e,"_student_response",""),$n(e,"_result",""),$n(e,"_latency",""),e.objectives=new ne({CMIElement:"cmi.interactions.n.objectives",errorCode:$.INVALID_SET_VALUE,errorClass:H,children:D.objectives_children}),e.correct_responses=new ne({CMIElement:"cmi.interactions.correct_responses",errorCode:$.INVALID_SET_VALUE,errorClass:H,children:D.correct_responses_children}),e}return Hn(t,e),Vn(t,[{key:"initialize",value:function(){var e,n;Gn(zn(t.prototype),"initialize",this).call(this),null===(e=this.objectives)||void 0===e||e.initialize(),null===(n=this.correct_responses)||void 0===n||n.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 H(this._cmi_element+".id",$.WRITE_ONLY_ELEMENT);return this._id},set:function(id){Dt(this._cmi_element+".id",id,ve)&&(this._id=id)}},{key:"time",get:function(){if(!this.jsonString)throw new H(this._cmi_element+".time",$.WRITE_ONLY_ELEMENT);return this._time},set:function(time){Dt(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 H(this._cmi_element+".type",$.WRITE_ONLY_ELEMENT);return this._type},set:function(type){Dt(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 H(this._cmi_element+".weighting",$.WRITE_ONLY_ELEMENT);return this._weighting},set:function(weighting){Dt(this._cmi_element+".weighting",weighting,me)&&Ft(this._cmi_element+".weighting",weighting,"-100#100")&&(this._weighting=weighting)}},{key:"student_response",get:function(){if(!this.jsonString)throw new H(this._cmi_element+".student_response",$.WRITE_ONLY_ELEMENT);return this._student_response},set:function(student_response){Dt(this._cmi_element+".student_response",student_response,ye,!0)&&(this._student_response=student_response)}},{key:"result",get:function(){if(!this.jsonString)throw new H(this._cmi_element+".result",$.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'.")),Dt(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 H(this._cmi_element+".latency",$.WRITE_ONLY_ELEMENT);return this._latency},set:function(latency){if(Dt(this._cmi_element+".latency",latency,de)){var e=i(latency,de);this._latency=r(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}(g),Qn=function(e){function t(){var e;return Un(this,t),e=Bn(this,t,["cmi.interactions.n.objectives.n"]),$n(e,"_id",""),e}return Hn(t,e),Vn(t,[{key:"reset",value:function(){this._initialized=!1,this._id=""}},{key:"id",get:function(){if(!this.jsonString)throw new H(this._cmi_element+".id",$.WRITE_ONLY_ELEMENT);return this._id},set:function(id){Dt(this._cmi_element+".id",id,ve)&&(this._id=id)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id};return this.jsonString=!1,result}}]),t}(g),Xn=function(e){function t(){var e;return Un(this,t),e=Bn(this,t,["cmi.interactions.correct_responses.n"]),$n(e,"_pattern",""),e}return Hn(t,e),Vn(t,[{key:"reset",value:function(){this._initialized=!1,this._pattern=""}},{key:"pattern",get:function(){if(!this.jsonString)throw new H(this._cmi_element+".pattern",$.WRITE_ONLY_ELEMENT);return this._pattern},set:function(pattern){Dt(this._cmi_element+".pattern",pattern,ye,!0)&&(this._pattern=pattern)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={pattern:this._pattern};return this.jsonString=!1,result}}]),t}(g);function er(e,t,n){return er="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=tr(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n||e):i.value}},er(e,t,n||e)}function tr(e){return tr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},tr(e)}function nr(e,t){return nr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},nr(e,t)}function rr(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function ir(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ir=function(){return!!result})()}var or=Object.defineProperty,sr=function(e,t,n){return function(e,t,n){return t in e?or(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":rr(t))?t+"":t,n)},ar=function(e){function t(e,student_data,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=function(e,t,n){return t=tr(t),r=e,!(i=ir()?Reflect.construct(t,n||[],tr(e).constructor):t.apply(e,n))||"object"!==rr(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,["cmi"]),sr(r,"__children",""),sr(r,"__version","3.4"),sr(r,"_launch_data",""),sr(r,"_comments",""),sr(r,"_comments_from_lms",""),sr(r,"core"),sr(r,"objectives"),sr(r,"student_data"),sr(r,"student_preference"),sr(r,"interactions"),n&&r.initialize(),r.__children=e||D.cmi_children,r.core=new hn,r.objectives=new On,r.student_data=student_data||new kn,r.student_preference=new Fn,r.interactions=new Kn,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&&nr(e,t)}(t,e),n=t,(r=[{key:"reset",value:function(){var e,t,n,r,i;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===(n=this.interactions)||void 0===n||n.reset(!0),null===(r=this.student_data)||void 0===r||r.reset(),null===(i=this.student_preference)||void 0===i||i.reset()}},{key:"initialize",value:function(){var e,n,r,i,o;er(tr(t.prototype),"initialize",this).call(this),null===(e=this.core)||void 0===e||e.initialize(),null===(n=this.objectives)||void 0===n||n.initialize(),null===(r=this.student_data)||void 0===r||r.initialize(),null===(i=this.student_preference)||void 0===i||i.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 H(this._cmi_element+"._version",$.INVALID_SET_VALUE)}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new H(this._cmi_element+"._children",$.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 H(this._cmi_element+".launch_data",$.READ_ONLY_ELEMENT);this._launch_data=launch_data}},{key:"comments",get:function(){return this._comments},set:function(comments){Dt(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 H(this._cmi_element+".comments_from_lms",$.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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,r),t;var n,r}(b);function cr(e){return cr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},cr(e)}function lr(e,t){return lr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},lr(e,t)}function ur(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function fr(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(fr=function(){return!!result})()}var dr=Object.defineProperty,hr=function(e){function t(){var e,n,r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,n){return t=cr(t),r=e,!(i=fr()?Reflect.construct(t,n||[],cr(e).constructor):t.apply(e,n))||"object"!==ur(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,["cmi.nav"]),r="",function(e,t,n){t in e?dr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==ur(n="_event")?n+"":n,r),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&&lr(e,t)}(t,e),n=t,(r=[{key:"reset",value:function(){this._event="",this._initialized=!1}},{key:"event",get:function(){return this._event},set:function(e){(""===e||Dt(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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,r),t;var n,r}(g);function mr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);t>n;n++)r[n]=e[n];return r}function vr(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function yr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _r(e){return _r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_r(e)}function pr(e,t){return pr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},pr(e,t)}function gr(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function br(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(br=function(){return!!result})()}var Er=Object.defineProperty,Sr=function(e,t,n){return function(e,t,n){return t in e?Er(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":gr(t))?t+"":t,n)},Or=function(e){function t(e,n){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=e?function(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){yr(e,t,n[t])})}return e}({},e):void 0;return i&&void 0===i.mastery_override&&(i.mastery_override=!0),r=function(e,t,n){return t=_r(t),r=e,!(i=br()?Reflect.construct(t,n||[],_r(e).constructor):t.apply(e,n))||"object"!==gr(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,[$,i,n]),Sr(r,"statusSetByModule",!1),Sr(r,"cmi"),Sr(r,"nav"),Sr(r,"LMSInitialize"),Sr(r,"LMSFinish"),Sr(r,"LMSGetValue"),Sr(r,"LMSSetValue"),Sr(r,"LMSCommit"),Sr(r,"LMSGetLastError"),Sr(r,"LMSGetErrorString"),Sr(r,"LMSGetDiagnostic"),r.cmi=new ar,r.nav=new hr,r.settings.globalStudentPreferences&&t._globalLearnerPrefs&&(""!==t._globalLearnerPrefs.audio&&(r.cmi.student_preference.audio=t._globalLearnerPrefs.audio),""!==t._globalLearnerPrefs.language&&(r.cmi.student_preference.language=t._globalLearnerPrefs.language),""!==t._globalLearnerPrefs.speed&&(r.cmi.student_preference.speed=t._globalLearnerPrefs.speed),""!==t._globalLearnerPrefs.text&&(r.cmi.student_preference.text=t._globalLearnerPrefs.text)),r.LMSInitialize=r.lmsInitialize,r.LMSFinish=r.lmsFinish,r.LMSGetValue=r.lmsGetValue,r.LMSSetValue=r.lmsSetValue,r.LMSCommit=r.lmsCommit,r.LMSGetLastError=r.lmsGetLastError,r.LMSGetErrorString=r.lmsGetErrorString,r.LMSGetDiagnostic=r.lmsGetDiagnostic,r}var n,r,o;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&&pr(e,t)}(t,e),n=t,r=[{key:"reset",value:function(e){var t,n;this.commonReset(e),null===(t=this.cmi)||void 0===t||t.reset(),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),x):(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),x;var result=this.terminate("LMSFinish",!0);return result===P&&(""!==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),x):this.settings.throttleCommits?(this.scheduleCommit(500,"LMSCommit"),P):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===P&&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,n){t._globalLearnerPrefs||(t._globalLearnerPrefs={audio:"",language:"",speed:"",text:""}),t._globalLearnerPrefs[e]=n}},{key:"getCMIValue",value:function(e){return this._commonGetCMIValue("getCMIValue",!1,e)}},{key:"getChildElement",value:function(e,t,n){return c(e,"cmi\\.objectives\\.\\d+")?new wn:n&&c(e,"cmi\\.interactions\\.\\d+\\.correct_responses\\.\\d+")?new Xn:n&&c(e,"cmi\\.interactions\\.\\d+\\.objectives\\.\\d+")?new Qn:!n&&c(e,"cmi\\.interactions\\.\\d+")?new Zn:null}},{key:"validateCorrectResponse",value:function(e,t){}},{key:"getLmsErrorMessageDetails",value:function(e,t){var n,r,i="No Error",o="No Error";return D.error_descriptions[e+=""]&&(i=(null===(n=D.error_descriptions[e])||void 0===n?void 0:n.basicMessage)||i,o=(null===(r=D.error_descriptions[e])||void 0===r?void 0:r.detailMessage)||o),t?o:i}},{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],n=this.renderCMIToJSONObject();(e||t)&&(n.cmi.core.total_time=this.cmi.getCurrentTotalTime());var r=s(n);switch(this.settings.dataCommitFormat){case"flattened":return r;case"params":return Object.entries(r).map(function(e){var t,n,r=(n=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}}(t,n)||function(e,t){if(e){if("string"==typeof e)return mr(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mr(e,t):void 0}}(t,n)||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.")}()),i=r[1];return"".concat(r[0],"=").concat(i)});default:return n}}},{key:"renderCommitObject",value:function(e){var t,n,r,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=this.renderCommitCMI(e,o),a=e||o?this.cmi.getCurrentTotalTime():"",c=i(a,de),l=this.cmi.core.lesson_status,u=se,f=ie;l&&(u="completed"===l||"passed"===l?oe:"incomplete","passed"===l?f=re:"failed"===l&&(f="failed"));var d=(null===(r=this.cmi)||void 0===r||null===(n=r.core)||void 0===n||null===(t=n.score)||void 0===t?void 0:t.getScoreObject())||{},h={successStatus:f,completionStatus:u,runtimeData:s,totalTimeSeconds:c};return d&&(h.score=d),this.settings.autoPopulateCommitMetadata&&(this.settings.courseId&&(h.courseId=this.settings.courseId),this.settings.scoId&&(h.scoId=this.settings.scoId),this.cmi.core.student_id&&(h.learnerId=this.cmi.core.student_id),this.cmi.core.student_name&&(h.learnerName=this.cmi.core.student_name)),h}},{key:"storeData",value:function(e,t){if(e){var n,r,i;if("browse"===this.cmi.core.lesson_mode&&""===((null===(i=this.startingData)||void 0===i||null===(r=i.cmi)||void 0===r||null===(n=r.core)||void 0===n?void 0:n.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),s=parseFloat(this.cmi.student_data.mastery_score);isNaN(o)||isNaN(s)||(this.cmi.core.lesson_status=s>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 a=parseFloat(this.cmi.core.score.raw),c=parseFloat(this.cmi.student_data.mastery_score);isNaN(a)||isNaN(c)||(this.cmi.core.lesson_status=c>a?"failed":"passed")}}return this.processCommitData(e,t)}},{key:"processCommitData",value:function(e,t){var n=this.getCommitObject(e);return"string"==typeof this.settings.lmsCommitUrl?this.processHttpRequest(this.settings.lmsCommitUrl,n,e,t):{result:P,errorCode:0}}}],o=[{key:"clearGlobalPreferences",value:function(){t._globalLearnerPrefs=null}}],r&&vr(n.prototype,r),o&&vr(n,o),t}(Kt);return Sr(Or,"_globalLearnerPrefs",null),Or}();
1
+ this.Scorm12API=function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);t>n;n++)r[n]=e[n];return r}function t(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,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}var r=["text/plain","application/x-www-form-urlencoded","multipart/form-data"];function i(e){var t,n=(null!==(t=(e||"").split(";")[0])&&void 0!==t?t:"").trim().toLowerCase();return r.includes(n)}function o(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=function(e){if(!e||0>=e)return"00:00:00";var t=Math.floor(e/3600),n=new Date(1e3*e),r=n.getUTCMinutes(),i=n.getSeconds(),o=e%1,s="";return u(o)>0&&(s="."+(s=u(o)>2?o.toFixed(2):o+"").split(".")[1]),(t+":"+r+":"+i).replace(/\b\d\b/g,"0$&")+s},a=d(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 n=e.split(":");return 3600*+n[0]+60*+n[1]+ +n[2]},function(e,t){var n,r="string"==typeof t?t:null!==(n=null==t?void 0:""+t)&&void 0!==n?n:"";return"".concat("string"==typeof e?e:(null!=e?e:"")+"",":").concat(r)}),c=d(function(e,t){var r,i,o,s;if("string"==typeof t&&(t=RegExp(t)),!e||!(null==e||null===(i=e.match)||void 0===i?void 0:i.call(e,t)))return 0;var a,c,l=(a=null!==(r=null===(o=(s=RegExp(t)).exec)||void 0===o?void 0:o.call(s,e))&&void 0!==r?r:[],c=8,function(e){if(Array.isArray(e))return e}(a)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}}(a,c)||n(a,c)||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.")}()),result=0;return result+=+l[7]||0,result+=60*+l[6]||0,result+=3600*+l[5]||0,result+=86400*+l[4]||0,result+=604800*+l[3]||0,(result+=2592e3*+l[2]||0)+(31536e3*+l[1]||0)},function(e,t){var n,r="string"==typeof t?t:null!==(n=null==t?void 0:""+t)&&void 0!==n?n:"";return"".concat(null!=e?e:"",":").concat(r)});function l(e){var result={};return function e(t,n){if(Object(t)!==t)result[n]=t;else if(Array.isArray(t))t.forEach(function(t,r){e(t,"".concat(n,"[").concat(r,"]"))}),0===t.length&&(result[n]=[]);else{var r=Object.keys(t).filter(function(e){return{}.hasOwnProperty.call(t,e)}),i=0===r.length;r.forEach(function(r){e(t[r],n?"".concat(n,".").concat(r):r)}),i&&n&&(result[n]={})}}(e,""),result}function u(e){var t,n,r,i;if(Math.floor(e)===e||0>(null===(r=e+"")||void 0===r||null===(n=r.indexOf)||void 0===n?void 0:n.call(r,".")))return 0;var o=null===(i=(""+e).split("."))||void 0===i?void 0:i[1];return null!==(t=null==o?void 0:o.length)&&void 0!==t?t:0}function f(e,t){return"string"==typeof e&&RegExp(t).test(e)}function d(e,n,r){var i=new Map;return function(){for(var o=arguments.length,s=Array(o),a=0;o>a;a++)s[a]=arguments[a];var result,c=n?n.apply(void 0,t(s)):JSON.stringify(s);return void 0!==(null==r?void 0:r.maxKeyLength)&&c.length>r.maxKeyLength?e.apply(void 0,t(s)):i.has(c)?i.get(c):(result=e.apply(void 0,t(s)),void 0===(null==r?void 0:r.maxEntries)||r.maxEntries>i.size||i.delete(i.keys().next().value),i.set(c,result),result)}}var h=function(e,t,n){var r=e.indexOf("#"),i=-1===r?e:e.slice(0,r),o=-1===r?"":e.slice(r),s=i.includes("?")?i.endsWith("?")||i.endsWith("&")?"":"&":"?",a="".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n+""));return"".concat(i).concat(s).concat(a).concat(o)};function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t,n){return t&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function p(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!result})()}function _(e,t){return _=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_(e,t)}function g(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var b=Object.defineProperty,E=function(e,t,n){return function(e,t,n){return t in e?b(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":g(t))?t+"":t,n)},S=function(){function e(t){m(this,e),E(this,"jsonString",!1),E(this,"_cmi_element"),E(this,"_initialized",!1),this._cmi_element=t}return v(e,[{key:"initialized",get:function(){return this._initialized}},{key:"initialize",value:function(){this._initialized=!0}}]),e}(),O=function(e){function t(){var e;return m(this,t),e=function(e,t,n){return t=y(t),r=e,!(i=p()?Reflect.construct(t,n||[],y(e).constructor):t.apply(e,n))||"object"!==g(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,arguments),E(e,"_start_time"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_(e,t)}(t,e),v(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}(S);function w(e,t,n){return t=N(t),r=e,!(i=L()?Reflect.construct(t,n||[],N(e).constructor):t.apply(e,n))||"object"!==M(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}function C(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function R(e,t,n){return R=L()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&k(i,n.prototype),i},R.apply(null,arguments)}function I(e,t,n){return t&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function N(e){return N=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},N(e)}function T(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&k(e,t)}function L(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(L=function(){return!!result})()}function k(e,t){return k=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},k(e,t)}function M(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function A(e){var t="function"==typeof Map?new Map:void 0;return A=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,n)}function n(){return R(e,arguments,N(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),k(n,e)},A(e)}var j=Object.defineProperty,P=function(e,t,n){return function(e,t,n){return t in e?j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":M(t))?t+"":t,n)},x=function(e){function t(e,n){var r;return C(this,t),r=w(this,t,["".concat(e," : ").concat(""+n)]),P(r,"_errorCode"),r._errorCode=n,Object.setPrototypeOf(r,t.prototype),r}return T(t,e),I(t,[{key:"errorCode",get:function(){return this._errorCode}}]),t}(A(Error)),D=function(e){function t(e,n,r,i){var o;return C(this,t),o=w(this,t,[e,n]),P(o,"_errorMessage"),P(o,"_detailedMessage",""),o.message="".concat(e," : ").concat(r),o._errorMessage=r,i&&(o._detailedMessage=i),Object.setPrototypeOf(o,t.prototype),o}return T(t,e),I(t,[{key:"errorMessage",get:function(){return this._errorMessage}},{key:"detailedMessage",get:function(){return this._detailedMessage}}]),t}(x),F="true",B="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."}}};function V(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function G(e,t,n){return t=z(t),i=e,!(o=H()?Reflect.construct(t,n||[],z(e).constructor):t.apply(e,n))||"object"!=((r=o)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)&&"function"!=typeof o?V(i):o;var r,i,o}function z(e){return z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},z(e)}function H(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(H=function(){return!!result})()}function q(e,t){return q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},q(e,t)}var W=U.error_descriptions,J=function(e){function t(e,n){var r,i,o,s,a,c;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r={}.hasOwnProperty.call(W,n+"")?G(this,t,[e,n,(null===(i=W[n+""])||void 0===i?void 0:i.basicMessage)||"Unknown error",null===(o=W[n+""])||void 0===o?void 0:o.detailMessage]):G(this,t,[e,101,null!==(s=null===(a=W[101])||void 0===a?void 0:a.basicMessage)&&void 0!==s?s:"General error",null===(c=W[101])||void 0===c?void 0:c.detailMessage]),Object.setPrototypeOf(V(r),t.prototype),V(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&&q(e,t)}(t,e),t}(D);function Y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Y(e,t,n[t])})}return e}function K(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 n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var Z={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},Q=K($({},Z),{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});function X(e){return X=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},X(e)}function ee(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ee=function(){return!!result})()}function te(e,t){return te=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},te(e,t)}function ne(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}K($({},Z),{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});var re=Object.defineProperty,ie=function(e,t,n){return function(e,t,n){return t in e?re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":ne(t))?t+"":t,n)},oe=function(e){function t(e){var n,r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,n){return t=X(t),r=e,!(i=ee()?Reflect.construct(t,n||[],X(e).constructor):t.apply(e,n))||"object"!==ne(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,[e.CMIElement]),ie(n,"_errorCode"),ie(n,"_errorClass"),ie(n,"__children"),ie(n,"childArray"),n.__children=e.children,n._errorCode=null!==(r=e.errorCode)&&void 0!==r?r:Q.GENERAL,n._errorClass=e.errorClass||x,n.childArray=[],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&&te(e,t)}(t,e),n=t,r=[{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 n;null===(n=this.childArray[t])||void 0===n||n.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}}],r&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,r),t;var n,r}(S),se="passed",ae="unknown",ce="completed",le="unknown",ue={_:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5};function fe(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}var de={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:ue.ERROR,uninitializedGetLogLevel:ue.WARN,selfReportSessionTime:!1,alwaysSendTotalTime:!1,renderCommonCommitFields:!1,autoCompleteLessonStatus:!1,strict_errors:!0,xhrHeaders:{},xhrWithCredentials:!1,fetchMode:"cors",asyncModeBeaconBehavior:"never",includeCommitSequence:!1,responseHandler:function(e){return(t=function(){var t,n;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(s,"next",{value:c(0)}),a(s,"throw",{value:c(1)}),a(s,"return",{value:c(2)}),"function"==typeof Symbol&&a(s,Symbol.iterator,{value:function(){return this}}),s;function c(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&i[3]>a[1])){o.label=a[1];break}if(6===a[0]&&i[1]>o.label){o.label=i[1],i=a;break}if(i&&i[2]>o.label){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}(this,function(r){switch(r.label){case 0:if(void 0===e)return[3,8];t=null,r.label=1;case 1:return r.trys.push([1,6,,7]),"function"!=typeof e.json?[3,3]:[4,e.json()];case 2:return t=r.sent(),[3,5];case 3:return"function"!=typeof e.text?[3,5]:[4,e.text()];case 4:(n=r.sent())&&(t=JSON.parse(n)),r.label=5;case 5:return[3,7];case 6:return r.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===F?0:101}]:200===e.status?[2,{result:F,errorCode:0}]:[2,{result:B,errorCode:101}];case 8:return[2,{result:B,errorCode:101}]}})},function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(e){fe(o,r,i,s,a,"next",e)}function a(e){fe(o,r,i,s,a,"throw",e)}s(void 0)})})();var t},xhrResponseHandler:function(e){if(void 0!==e){var t=null;if(200>e.status||e.status>299)return{result:B,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===F?0:101}:{result:F,errorCode:0}}return{result:B,errorCode:101}},requestHandler:function(e){return e},onLogMessage:he,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 he(e,t){switch(e){case"4":case 4:case"ERROR":case ue.ERROR:console.error(t);break;case"3":case 3:case"WARN":case ue.WARN:console.warn(t);break;case"2":case 2:case"INFO":case ue.INFO:console.info(t);break;case"1":case 1:case"DEBUG":case ue.DEBUG:console.debug?console.debug(t):console.log(t)}}var me="^[\\s\\S]{0,255}$",ve="^([0-9]+):([0-9]{2}):([0-9]{2})(\\.\\d{1,2})?$",ye="^-?([0-9]+)$",pe="^-?([0-9]{0,10})(\\.[0-9]*)?$",_e="^[\\u0021-\\u007E\\s]{0,255}$",ge="^.*$",be="^(passed|completed|failed|incomplete|browsed|not attempted)$",Ee="0#100",Se="^P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?(?:T?(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:(\\d+(?:\\.\\d{1,2})?)S)?)?$";function Oe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function we(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}!function(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Oe(e,t,n[t])})}}({},{"NB.2.1-1":"Sequencing session already started","NB.2.1-2":"Current activity not defined / sequencing not begun","NB.2.1-3":"No suspended activity to resume","NB.2.1-4":"Flow not enabled / current activity is root","NB.2.1-5":"Violates control mode (forward only or flow disabled)","NB.2.1-6":"Cannot move backward from root","NB.2.1-7":"Forward/Backward navigation not supported","NB.2.1-8":"Forward-only constraint violation","NB.2.1-9":"Activity path empty","NB.2.1-10":"Choice control disabled on parent","NB.2.1-11":"Target activity does not exist","NB.2.1-12":"Activity already terminated","NB.2.1-13":"Undefined navigation request","NB.2.1-14":"No current activity for EXIT_ALL","NB.2.1-15":"No current activity for ABANDON","NB.2.1-16":"No current activity for ABANDON_ALL","NB.2.1-17":"No current activity for SUSPEND_ALL","NB.2.1-18":"Invalid navigation request type"},{"TB.2.3-1":"No current activity to terminate","TB.2.3-2":"Current activity already terminated","TB.2.3-3":"Nothing to suspend (root activity)","TB.2.3-4":"Cannot EXIT_PARENT from root activity","TB.2.3-5":"Activity path is empty during suspend","TB.2.3-6":"Nothing to abandon","TB.2.3-7":"Undefined termination request"},{"SB.2.1-2":"No available children to deliver","SB.2.1-3":"Reached beginning of course","SB.2.1-4":"Forward only violation - cannot traverse backward"},{"SB.2.2-1":"Flow control disabled on parent","SB.2.2-2":"Activity not available"},{"SB.2.7-1":"Sequencing session not begun (current activity not terminated)","SB.2.7-2":"Cannot continue - flow disabled or no activity available"},{"SB.2.8-1":"Current activity not terminated","SB.2.8-2":"Cannot go previous - at beginning or forwardOnly enabled"},{"SB.2.9-1":"Target activity does not exist","SB.2.9-2":"Target activity not in tree","SB.2.9-3":"Cannot choose root activity","SB.2.9-4":"Activity hidden from choice","SB.2.9-5":"Choice control is not allowed","SB.2.9-6":"Current activity not terminated","SB.2.9-7":"No activity available from target","SB.2.9-8":"choiceExit prevents navigation outside ancestor subtree"},{"SB.2.4-1":"Stop forward traversal rule evaluates to true","SB.2.4-2":"Constrained choice requires forward traversal from leaf","SB.2.4-3":"Cannot walk backward from root of activity tree"},{"SB.2.10-1":"Current activity not defined","SB.2.10-2":"Activity is still active or suspended","SB.2.10-3":"Flow subprocess returned false (nothing to deliver)"},{"SB.2.11-1":"Exit not allowed - no parent","SB.2.11-2":"Exit not allowed by sequencing controls"},{"SB.2.12-1":"No current activity","SB.2.12-5":"No target activity specified","SB.2.12-6":"Undefined sequencing request"},{"SB.2.13-1":"Target activity does not exist","SB.2.13-2":"Target activity not in tree","SB.2.13-3":"Target not available"},{"SB.2.5-1":"No activity tree","SB.2.5-2":"Sequencing session already begun","SB.2.5-3":"No activity available"},{"SB.2.6-1":"No suspended activity","SB.2.6-2":"Current activity already defined"},{"SB.2.15-1":"Cannot suspend root"});var Ce=Object.defineProperty,Re=function(e,t,n){return function(e,t,n){return t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},Ie=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Re(this,"_API"),Re(this,"_cancelled",!1),Re(this,"_timeout"),Re(this,"_callback"),this._API=t,this._timeout=setTimeout(this.wrapper.bind(this),n),this._callback=r}return t=e,n=[{key:"cancel",value:function(){this._cancelled=!0,this._timeout&&clearTimeout(this._timeout)}},{key:"wrapper",value:function(){var e;this._cancelled||this._API.isInitialized()&&(e=function(){return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(s,"next",{value:c(0)}),a(s,"throw",{value:c(1)}),a(s,"return",{value:c(2)}),"function"==typeof Symbol&&a(s,Symbol.iterator,{value:function(){return this}}),s;function c(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&i[3]>a[1])){o.label=a[1];break}if(6===a[0]&&i[1]>o.label){o.label=i[1],i=a;break}if(i&&i[2]>o.label){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}(this,function(e){switch(e.label){case 0:return[4,this._API.commit(this._callback,!1,"autocommit")];case 1:return[2,e.sent()]}})},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){we(o,r,i,s,a,"next",e)}function a(e){we(o,r,i,s,a,"throw",e)}s(void 0)})}).call(this)}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();function Ne(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Te(e){return Te=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Te(e)}function Le(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Le=function(){return!!result})()}function ke(e,t){return ke=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ke(e,t)}function Me(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ae=Object.defineProperty,je=function(e,t,n){return function(e,t,n){return t in e?Ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":Me(t))?t+"":t,n)},Pe=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"always",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Map;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,n){return t=Te(t),r=e,!(i=Le()?Reflect.construct(t,n||[],Te(e).constructor):t.apply(e,n))||"object"!==Me(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,["ruleCondition"]),je(e,"_condition","always"),je(e,"_operator",null),je(e,"_parameters",new Map),je(e,"_referencedObjective",null),e._condition=n,e._operator=r,e._parameters=i,e}var n,r,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&&ke(e,t)}(t,e),n=t,i=[{key:"setNowProvider",value:function(e){"function"==typeof e&&(t._now=e)}},{key:"setElapsedSecondsHook",value:function(e){t._getElapsedSecondsHook=e}}],(r=[{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,n=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===n._referencedObjective})||null:null}},{key:"evaluate",value:function(e){var result,t,n=null!==this._referencedObjective,r=this.resolveReferencedObjective(e);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.successStatus!==ae?e.successStatus===se:"unknown");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 i=this._parameters.get("threshold")||0;result=(r?r.measureStatus:e.objectiveMeasureStatus)?(r?r.normalizedMeasure:e.objectiveNormalizedMeasure)>i:"unknown";break;case"objectiveMeasureLessThan":if(n&&!r){result=!1;break}var o=this._parameters.get("threshold")||0;result=(r?r.measureStatus:e.objectiveMeasureStatus)?o>(r?r.normalizedMeasure:e.objectiveNormalizedMeasure):"unknown";break;case"completed":case"activityCompleted":result=!(n&&!r)&&(r?r.completionStatus===le?"unknown":r.completionStatus===ce:e.completionStatus===le?"unknown":e.completionStatus===ce);break;case"progressKnown":case"activityProgressKnown":result=!(n&&!r)&&(r?r.completionStatus!==le:"unknown"!==e.completionStatus);break;case"attempted":result=e.attemptCount>0;break;case"attemptLimitExceeded":result=e.hasAttemptLimitExceeded();break;case"timeLimitExceeded":result=this.evaluateTimeLimitExceeded(e);break;case"outsideAvailableTimeRange":result=this.evaluateOutsideAvailableTimeRange(e);break;case"always":result=!0;break;default:result=!1}return"not"===this._operator&&(result="unknown"===(t=result)?"unknown":!t),result}},{key:"evaluateTimeLimitExceeded",value:function(e){var n=e.timeLimitDuration;if(!n&&e.attemptAbsoluteDurationLimit&&(n=e.attemptAbsoluteDurationLimit),!n)return!1;var r=c(n,Se);if(0>=r)return!1;var i=0;if(t._getElapsedSecondsHook)try{var o=t._getElapsedSecondsHook(e);"number"!=typeof o||Number.isNaN(o)||0>o||(i=o)}catch(e){i=0}if(0===i&&e.attemptExperiencedDuration){var s=c(e.attemptExperiencedDuration,Se);s>0&&(i=s)}if(0===i&&e.attemptAbsoluteStartTime)try{var a=new Date(e.attemptAbsoluteStartTime).getTime(),l=t._now().getTime();Number.isNaN(a)||Number.isNaN(l)||a>l||(i=(l-a)/1e3)}catch(e){i=0}return i>r}},{key:"evaluateOutsideAvailableTimeRange",value:function(e){var n=e.beginTimeLimit,r=e.endTimeLimit;if(!n&&!r)return!1;var i=t._now();return!(!n||i>=new Date(n))||!(!r||new Date(r)>=i)}},{key:"parseISO8601Duration",value:function(e){return 1e3*c(e,Se)}},{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}}])&&Ne(n.prototype,r),i&&Ne(n,i),t}(S);je(Pe,"_now",function(){return new Date}),je(Pe,"_getElapsedSecondsHook");var xe=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(xe||{}),De=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(De||{});function Fe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);t>n;n++)r[n]=e[n];return r}function Be(e){return function(e){if(Array.isArray(e))return Fe(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 Fe(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fe(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 Ue=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,n=[{key:"selectChildrenProcess",value:function(e){var t=e.sequencingControls,n=Be(e.children);if(t.selectionTiming===xe.NEVER)return n;if(t.selectionTiming===xe.ONCE&&t.selectionCountStatus)return n;if(t.selectionTiming!==xe.ONCE&&!t.selectionCountStatus)return n;var r=t.selectCount;if(null===r||r>=n.length)return t.selectionTiming===xe.ONCE&&(t.selectionCountStatus=!0),n;for(var i=[],o=n.map(function(e,t){return t}),s=0;r>s&&0!==o.length;s++){var a=Math.floor(Math.random()*o.length),c=o[a];void 0!==c&&n[c]&&i.push(n[c]),o.splice(a,1)}t.selectionTiming===xe.ONCE&&(t.selectionCountStatus=!0);var l=!0,u=!1,f=void 0;try{for(var d,h=n[Symbol.iterator]();!(l=(d=h.next()).done);l=!0){var m=d.value;i.includes(m)||(m.isHiddenFromChoice=!0,m.isAvailable=!1)}}catch(e){u=!0,f=e}finally{try{l||null==h.return||h.return()}finally{if(u)throw f}}return i}},{key:"randomizeChildrenProcess",value:function(e){var t,n=e.sequencingControls,r=Be(e.children);if(n.randomizationTiming===De.NEVER)return r;if(n.randomizationTiming===De.ONCE&&n.reorderChildren)return r;if(!n.randomizeChildren)return r;for(var i=Be(r),o=i.length-1;o>0;o--){var s=Math.floor(Math.random()*(o+1)),a=i[o],c=i[s];a&&c&&(i[o]=c,i[s]=a)}return n.randomizationTiming===De.ONCE&&(n.reorderChildren=!0),e.children.length=0,(t=e.children).push.apply(t,Be(i)),i}},{key:"applySelectionAndRandomization",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.sequencingControls;if(!t&&(e.isActive||e.isSuspended))return e.children;var r=!1,i=!1;n.selectionTiming===xe.ON_EACH_NEW_ATTEMPT?(r=t,t&&(n.selectionCountStatus=!0)):n.selectionTiming===xe.ONCE&&(r=!n.selectionCountStatus),n.randomizationTiming===De.ON_EACH_NEW_ATTEMPT?(i=t,t&&(n.reorderChildren=!1)):n.randomizationTiming===De.ONCE&&(i=!n.reorderChildren),r&&this.selectChildrenProcess(e),i&&this.randomizeChildrenProcess(e);var o=e.children.filter(function(e){return e.isAvailable});return e.setProcessedChildren(o),o}},{key:"isSelectionNeeded",value:function(e){var t=e.sequencingControls;return t.selectionTiming!==xe.NEVER&&(t.selectionTiming!==xe.ONCE||!t.selectionCountStatus)&&null!==t.selectCount&&e.children.length>t.selectCount}},{key:"isRandomizationNeeded",value:function(e){var t=e.sequencingControls;return t.randomizationTiming!==De.NEVER&&(t.randomizationTiming!==De.ONCE||!t.reorderChildren)&&t.randomizeChildren}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t,n),e;var t,n}();function Ve(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Ge(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Ve(o,r,i,s,a,"next",e)}function a(e){Ve(o,r,i,s,a,"throw",e)}s(void 0)})}}function ze(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function He(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function qe(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ze(e,t,n[t])})}return e}function We(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(s,"next",{value:c(0)}),a(s,"throw",{value:c(1)}),a(s,"return",{value:c(2)}),"function"==typeof Symbol&&a(s,Symbol.iterator,{value:function(){return this}}),s;function c(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&i[3]>a[1])){o.label=a[1];break}if(6===a[0]&&i[1]>o.label){o.label=i[1],i=a;break}if(i&&i[2]>o.label){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var Je=Object.defineProperty,Ye=function(e,t,n){return function(e,t,n){return t in e?Je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},$e=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ye(this,"reportsRequestCompletion",!0),Ye(this,"settings"),Ye(this,"error_codes"),this.settings=t,this.error_codes=n}return t=e,n=[{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:F,errorCode:0}}},{key:"_performAsyncRequest",value:function(e,t,n,r,i,o,s){return Ge(function(){var a,c,l,result,u,f;return We(this,function(d){switch(d.label){case 0:return d.trys.push([0,6,7,8]),a=void 0===o?this.settings.requestHandler(t):this.settings.requestHandler(t,o),c=a,n&&"never"!==this.settings.asyncModeBeaconBehavior?[4,this.performBeacon(e,c)]:[3,2];case 1:return l=d.sent(),[3,4];case 2:return[4,this.performFetch(e,c)];case 3:l=d.sent(),d.label=4;case 4:return[4,this.transformResponse(l,i)];case 5:return result=d.sent(),this._isSuccessResponse(l,result)?i("CommitSuccess"):i("CommitError",void 0,result.errorCode),[3,8];case 6:return u=d.sent(),f=He(u,Error)?u.message:u+"",r("processHttpRequest","Async request failed: ".concat(f),ue.ERROR),i("CommitError",void 0,this.error_codes.GENERAL_COMMIT_FAILURE||391),[3,8];case 7:return null==s||s(),[7];case 8:return[2]}})}).call(this)}},{key:"_prepareRequestBody",value:function(e){return{body:He(e,Array)?e.join("&"):JSON.stringify(e),contentType:He(e,Array)?"application/x-www-form-urlencoded":this.settings.commitRequestDataType}}},{key:"performFetch",value:function(e,t){return Ge(function(){var n,r,i;return We(this,function(o){return"always"===this.settings.asyncModeBeaconBehavior?[2,this.performBeacon(e,t)]:(n=this._prepareRequestBody(t),r=n.contentType,i={method:"POST",mode:this.settings.fetchMode,body:n.body,headers:(s=qe({},this.settings.xhrHeaders),a={"Content-Type":r},a=null!=a?a:{},Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(a)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(a)).forEach(function(e){Object.defineProperty(s,e,Object.getOwnPropertyDescriptor(a,e))}),s),keepalive:!0},this.settings.xhrWithCredentials&&(i.credentials="include"),[2,fetch(e,i)]);var s,a})}).call(this)}},{key:"performBeacon",value:function(e,t){return Ge(function(){var n,r,i,o,s,a;return We(this,function(c){return n=this,r=this._prepareRequestBody(t),i=r.body,o=r.contentType,this._warnIfBeaconContentTypeUnsafe(e,s=Array.isArray(t)?o:this.settings.terminationCommitContentType),a=navigator.sendBeacon(e,new Blob([i],{type:s})),[2,Promise.resolve({status:a?200:0,ok:a,json:function(){return Ge(function(){return We(this,function(e){return[2,{result:a?"true":"false",errorCode:a?0:this.error_codes.GENERAL_COMMIT_FAILURE||391}]})}).call(n)},text:function(){return Ge(function(){return We(this,function(e){return[2,JSON.stringify({result:a?"true":"false",errorCode:a?0:this.error_codes.GENERAL_COMMIT_FAILURE||391})]})}).call(n)}})]})}).call(this)}},{key:"_warnIfBeaconContentTypeUnsafe",value:function(e,t){var n,r;o(e)&&!i(t)&&(null===(n=(r=this.settings).onLogMessage)||void 0===n||n.call(r,ue.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 Ge(function(){var result,t,n,r;return We(this,function(i){switch(i.label){case 0:return i.trys.push([0,5,,7]),"function"!=typeof this.settings.responseHandler?[3,2]:[4,this.settings.responseHandler(e)];case 1:return t=i.sent(),[3,4];case 2:return[4,e.json()];case 3:t=i.sent(),i.label=4;case 4:return result=t,[3,7];case 5:return n=i.sent(),[4,e.text().catch(function(){return"Unable to read response text"})];case 6:return r=i.sent(),[2,{result:B,errorCode:this.error_codes.GENERAL_COMMIT_FAILURE||391,errorMessage:"Failed to parse LMS response: ".concat(He(n,Error)?n.message:n+""),errorDetails:JSON.stringify({status:e.status,statusText:e.statusText,url:e.url,responseText:r.substring(0,500),parseError:He(n,Error)?n.message:n+""})}];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=qe({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!==F)}},{key:"updateSettings",value:function(e){this.settings=e}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();function Ke(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var Ze=Object.defineProperty,Qe="{target=";function Xe(e,t){var n,r=e[t];return void 0===r?(void 0!==console&&console.warn&&console.warn("CMIValueAccessService: Unknown error code key: ".concat(t)),null!==(n=e.GENERAL)&&void 0!==n?n:0):r}var et=function(){function e(t){var n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,n){t in e?Ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(this,"symbol"!==function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(n="context")?n+"":n,r),this.context=t}return t=e,(n=[{key:"getUndefinedDataModelErrorCode",value:function(){return Xe(this.context.errorCodes,"UNDEFINED_DATA_MODEL")}},{key:"setCMIValue",value:function(e,t,n,r){if(!n||""===n)return t&&this.context.throwSCORMError(n,Xe(this.context.errorCodes,"GENERAL_SET_FAILURE"),"The data model element was not specified"),B;this.context.setLastErrorCode("0");for(var i=n.split("."),o=this.context.getDataModel(),s=B,a=!1,c="The data model element passed to ".concat(e," (").concat(n,") is not a valid SCORM data model element."),l=this.getUndefinedDataModelErrorCode(),u=0;i.length>u;u++){if(u===i.length-1){s=this.setFinalAttribute(o,i[u],r,n,t,l,c);break}var f=this.traverseToNextLevel(o,i,u,r,n,t,a,l,c);if(f.error)break;o=f.refObject,u=f.idx,a=f.foundFirstIndex}return s===B&&this.context.apiLog(e,"There was an error setting the value for: ".concat(n,", value of: ").concat(r),ue.WARN),s}},{key:"getCMIValue",value:function(e,t,n){if(!n||""===n)return t&&this.context.throwSCORMError(n,Xe(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element was not specified"),"";if(t&&n.endsWith("._version")&&"cmi._version"!==n)return this.context.throwSCORMError(n,Xe(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The _version keyword was used incorrectly"),"";this.context.setLastErrorCode("0");for(var r=n.split("."),i=this.context.getDataModel(),o=null,s="The data model element passed to ".concat(e," (").concat(n,") has not been initialized."),a="The data model element passed to ".concat(e," (").concat(n,") is not a valid SCORM data model element."),c=this.getUndefinedDataModelErrorCode(),l=0;r.length>l;l++){var u=this.validateGetAttribute(i,o=r[l],n,t,c,a,l===r.length-1);if(void 0!==u.returnValue)return u.returnValue;if(u.error)return"";if(null==o){this.context.throwSCORMError(n,c,a);break}if(void 0===(i=i[o])){this.context.throwSCORMError(n,c,a);break}if(Ke(i,oe)){var f=this.handleGetArrayAccess(i,r,l,n,s);if(f.error)return"";i=f.refObject,l=f.idx}}return null==i?(t||("_children"===o?this.context.throwSCORMError(n,Xe(this.context.errorCodes,"CHILDREN_ERROR"),void 0):"_count"===o&&this.context.throwSCORMError(n,Xe(this.context.errorCodes,"COUNT_ERROR"),void 0)),""):i}},{key:"setFinalAttribute",value:function(e,t,n,r,i,o,s){return i&&(null==t?void 0:t.startsWith(Qe))?this.context.isInitialized()?(this.context.throwSCORMError(r,Xe(this.context.errorCodes,"READ_ONLY_ELEMENT")),B):F:void 0!==t&&this.context.checkObjectHasProperty(e,t)?f(r,"\\.correct_responses\\.\\d+$")&&this.context.isInitialized()&&"pattern"!==t&&(this.context.validateCorrectResponse(r,n),"0"!==this.context.getLastErrorCode())?(this.context.throwSCORMError(r,Xe(this.context.errorCodes,"TYPE_MISMATCH")),B):i&&"0"!==this.context.getLastErrorCode()?B:void 0===t||"__proto__"===t||"constructor"===t?(this.context.throwSCORMError(r,o,s),B):i&&"id"===t&&this.context.isInitialized()&&this.context.checkForDuplicateId(r,n)?(this.context.throwSCORMError(r,Xe(this.context.errorCodes,"GENERAL_SET_FAILURE")),B):(e[t]=n,F):(this.context.throwSCORMError(r,o,s),B)}},{key:"traverseToNextLevel",value:function(e,t,n,r,i,o,s,a,c){var l=t[n];if(void 0===l||!this.context.checkObjectHasProperty(e,l))return this.context.throwSCORMError(i,a,c),{refObject:e,idx:n,foundFirstIndex:s,error:!0};if(!(e=e[l]))return this.context.throwSCORMError(i,a,c),{refObject:e,idx:n,foundFirstIndex:s,error:!0};if(Ke(e,oe)){var u=this.handleSetArrayAccess(e,t,n,r,i,o,s,a,c);return u.error?{refObject:e,idx:n,foundFirstIndex:s,error:!0}:u}return{refObject:e,idx:n,foundFirstIndex:s,error:!1}}},{key:"handleSetArrayAccess",value:function(e,t,n,r,i,o,s,a,c){var l=parseInt(t[n+1]||"0",10);if(!isNaN(l)){var u=e.childArray[l];if(u)return{refObject:u,idx:n+1,foundFirstIndex:!0,error:!1};if(l>e.childArray.length){var f=o?Xe(this.context.errorCodes,"GENERAL_SET_FAILURE"):Xe(this.context.errorCodes,"INVALID_SET_VALUE")||Xe(this.context.errorCodes,"GENERAL_SET_FAILURE");return this.context.throwSCORMError(i,f,"Cannot set array element at index ".concat(l,". Array indices must be sequential. Current array length is ").concat(e.childArray.length,", expected index ").concat(e.childArray.length,".")),{refObject:e,idx:n,foundFirstIndex:s,error:!0}}var d=this.context.getChildElement(i,r,s);return d?(e.initialized&&d.initialize(),e.childArray[l]=d,{refObject:d,idx:n+1,foundFirstIndex:!0,error:!1}):("0"===this.context.getLastErrorCode()&&this.context.throwSCORMError(i,a,c),{refObject:e,idx:n,foundFirstIndex:s,error:!0})}return{refObject:e,idx:n,foundFirstIndex:s,error:!1}}},{key:"validateGetAttribute",value:function(e,t,n,r,i,o,s){if(r){var a=t+"";if(a.startsWith(Qe)&&"function"==typeof e._isTargetValid){var c=a.substring(8,a.length-1);return{error:!1,returnValue:e._isTargetValid(c)}}if(void 0===t||!this.context.checkObjectHasProperty(e,t))return"_children"===t?(this.context.throwSCORMError(n,Xe(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element does not have children"),{error:!0}):"_count"===t?(this.context.throwSCORMError(n,Xe(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(n,i,o),{error:!0})}else if(s&&(void 0===t||!this.context.checkObjectHasProperty(e,t)))return"_children"===t?this.context.throwSCORMError(n,Xe(this.context.errorCodes,"CHILDREN_ERROR")):"_count"===t?this.context.throwSCORMError(n,Xe(this.context.errorCodes,"COUNT_ERROR")):this.context.throwSCORMError(n,i,o),{error:!0};return{error:!1}}},{key:"handleGetArrayAccess",value:function(e,t,n,r,i){var o=parseInt(t[n+1]||"",10);if(!isNaN(o)){var s=e.childArray[o];return s?{refObject:s,idx:n+1,error:!1}:(this.context.throwSCORMError(r,Xe(this.context.errorCodes,"VALUE_NOT_INITIALIZED"),i),{refObject:e,idx:n,error:!0})}return{refObject:e,idx:n,error:!1}}}])&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();function tt(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var nt=Object.defineProperty,rt=function(e,t,n){return function(e,t,n){return t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},it=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),rt(this,"_logLevel",ue.ERROR),rt(this,"_logHandler"),this._logHandler=he}var t,n,r;return t=e,r=[{key:"getInstance",value:function(){return e._instance||(e._instance=new e),e._instance}}],(n=[{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(ue.ERROR,e)}},{key:"warn",value:function(e){this.log(ue.WARN,e)}},{key:"info",value:function(e){this.log(ue.INFO,e)}},{key:"debug",value:function(e){this.log(ue.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 ue.NONE;if("number"==typeof e)return e;switch("string"==typeof e?e.toUpperCase():e){case"1":case"DEBUG":return ue.DEBUG;case"2":case"INFO":return ue.INFO;case"3":case"WARN":return ue.WARN;case"4":case"ERROR":default:return ue.ERROR;case"5":case"NONE":return ue.NONE}}}])&&tt(t.prototype,n),r&&tt(t,r),e}();rt(it,"_instance");var ot=it;function st(){return ot.getInstance()}function at(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var ct=Object.defineProperty,lt=function(e,t,n){return function(e,t,n){return t in e?ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},ut=function(){function e(t,n,r,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),lt(this,"_lastErrorCode","0"),lt(this,"_lastDiagnostic",""),lt(this,"_errorCodes"),lt(this,"_apiLog"),lt(this,"_getLmsErrorMessageDetails"),lt(this,"_loggingService"),this._errorCodes=t,this._apiLog=n,this._getLmsErrorMessageDetails=r,this._loggingService=i||st()}return t=e,n=[{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,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ue.ERROR;this._lastDiagnostic=n||"",n||(n=this._getLmsErrorMessageDetails(t,!0));var i="SCORM Error ".concat(t,": ").concat(n).concat(e?" [Element: ".concat(e,"]"):"");this._apiLog("throwSCORMError",t+": "+n,r,e),this._loggingService.log(r,i),this._lastErrorCode=t+""}},{key:"clearSCORMError",value:function(e){void 0!==e&&e!==B&&(this._lastErrorCode="0")}},{key:"handleValueAccessException",value:function(e,t,n){if(at(t,D)){var r=t;this._lastErrorCode=r.errorCode+"",this._lastDiagnostic="";var i="Validation Error ".concat(r.errorCode,": ").concat(r.message," [Element: ").concat(e,"]");this._loggingService.warn(i),n=B}else if(at(t,Error)){var o=t.constructor.name,s="".concat(o,": ").concat(t.message," [Element: ").concat(e,"]"),a=t.stack||"";this._loggingService.error("".concat(s,"\n").concat(a)),this.throwSCORMError(e,this._errorCodes.GENERAL,"".concat(o,": ").concat(t.message)),n=B}else{this._loggingService.error("Unknown error occurred while accessing [Element: ".concat(e,"]"));try{var c=JSON.stringify(t);this._loggingService.error("Error details: ".concat(c))}catch(e){this._loggingService.error("Could not stringify error object for details")}this.throwSCORMError(e,this._errorCodes.GENERAL,"Unknown error"),n=B}return n}},{key:"errorCodes",get:function(){return this._errorCodes}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();var ft=Object.defineProperty,dt=function(e,t,n){return function(e,t,n){return t in e?ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},ht=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),dt(this,"listenerMap",new Map),dt(this,"listenerCount",0),dt(this,"apiLog"),this.apiLog=t}return t=e,(n=[{key:"parseListenerName",value:function(e){if(!e)return null;var t=e.split("."),n=t[0],r=null;return t.length>1&&(r=e.replace("".concat(n,"."),"")),{functionName:null!=n?n:e,CMIElement:r}}},{key:"on",value:function(e,t){if(t){var n=e.split(" "),r=!0,i=!1,o=void 0;try{for(var s,a=n[Symbol.iterator]();!(r=(s=a.next()).done);r=!0){var c,l=this.parseListenerName(s.value);if(l){var u=l.functionName,f=l.CMIElement,d=null!==(c=this.listenerMap.get(u))&&void 0!==c?c:[];d.push({functionName:u,CMIElement:f,callback:t}),this.listenerMap.set(u,d),this.listenerCount++,this.apiLog("on","Added event listener: ".concat(this.listenerCount),ue.INFO,u)}}}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}}}},{key:"off",value:function(e,t){if(t){var n=e.split(" "),r=!0,i=!1,o=void 0;try{for(var s,a,c=function(){var e=s.parseListenerName(a.value);if(!e)return"continue";var n=e.functionName,r=e.CMIElement,i=s.listenerMap.get(n);if(!i)return"continue";var o=i.findIndex(function(e){return e.CMIElement===r&&e.callback===t});-1!==o&&(i.splice(o,1),s.listenerCount--,0===i.length&&s.listenerMap.delete(n),s.apiLog("off","Removed event listener: ".concat(s.listenerCount),ue.INFO,n))},l=n[Symbol.iterator]();!(r=(a=l.next()).done);r=!0)s=this,c()}catch(e){i=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(i)throw o}}}}},{key:"clear",value:function(e){var t=e.split(" "),n=!0,r=!1,i=void 0;try{for(var o,s,a=function(){var e=o.parseListenerName(s.value);if(!e)return"continue";var t=e.functionName,n=e.CMIElement;if(o.listenerMap.has(t)){var r=o.listenerMap.get(t),i=null===n?[]:r.filter(function(e){return e.CMIElement!==n});o.listenerCount-=r.length-i.length,0===i.length?o.listenerMap.delete(t):o.listenerMap.set(t,i)}},c=t[Symbol.iterator]();!(n=(s=c.next()).done);n=!0)o=this,a()}catch(e){r=!0,i=e}finally{try{n||null==c.return||c.return()}finally{if(r)throw i}}}},{key:"processListeners",value:function(e,t,n,r){this.apiLog(e,n,ue.INFO,t);var i=this.listenerMap.get(e);if(i){var o=!0,s=!1,a=void 0;try{for(var c,l=i[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value,f=!!u.CMIElement,d=!1;if(t&&u.CMIElement)if(u.CMIElement.endsWith("*")){var h=u.CMIElement.slice(0,-1);d=t.startsWith(h)}else d=u.CMIElement===t;f&&!d||(this.apiLog("processListeners","Processing listener: ".concat(u.functionName),ue.DEBUG,t),e.startsWith("Sequence")?u.callback(n):"CommitError"===e?void 0!==r?u.callback(n,r):u.callback(n):"CommitSuccess"===e?void 0!==r?u.callback(r):u.callback():u.callback(t,n))}}catch(e){s=!0,a=e}finally{try{o||null==l.return||l.return()}finally{if(s)throw a}}}}},{key:"reset",value:function(){this.listenerMap.clear(),this.listenerCount=0}}])&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();function mt(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function vt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){mt(o,r,i,s,a,"next",e)}function a(e){mt(o,r,i,s,a,"throw",e)}s(void 0)})}}function yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _t(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){yt(e,t,n[t])})}return e}function gt(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(s,"next",{value:c(0)}),a(s,"throw",{value:c(1)}),a(s,"return",{value:c(2)}),"function"==typeof Symbol&&a(s,Symbol.iterator,{value:function(){return this}}),s;function c(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&i[3]>a[1])){o.label=a[1];break}if(6===a[0]&&i[1]>o.label){o.label=i[1],i=a;break}if(i&&i[2]>o.label){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var bt=Object.defineProperty,Et=function(e,t,n){return function(e,t,n){return t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},St=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Et(this,"apiLog",r),Et(this,"settings"),Et(this,"error_codes"),Et(this,"storeName","scorm_again_offline_data"),Et(this,"syncQueue","scorm_again_sync_queue"),Et(this,"isOnline",navigator.onLine),Et(this,"syncInProgress",!1),Et(this,"boundOnlineStatusChangeHandler"),Et(this,"boundCustomNetworkStatusHandler"),this.settings=t,this.error_codes=n,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,(n=[{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...",ue.INFO),this.syncOfflineData().then(function(t){t?e.apiLog("OfflineStorageService","Sync completed successfully",ue.INFO):e.apiLog("OfflineStorageService","Sync failed",ue.ERROR)},function(t){e.apiLog("OfflineStorageService","Error during sync: ".concat(t),ue.ERROR)})):t&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",ue.INFO)}},{key:"handleCustomNetworkStatus",value:function(e){var t=this;if(pt(e,CustomEvent)){var n=e.detail.online;if("boolean"==typeof n){var r=this.isOnline;this.isOnline=n,this.apiLog("OfflineStorageService","Network status updated via custom event: ".concat(n?"online":"offline"),ue.INFO),!r&&this.isOnline?(this.apiLog("OfflineStorageService","Device is back online, attempting to sync...",ue.INFO),this.syncOfflineData().then(function(e){e?t.apiLog("OfflineStorageService","Sync completed successfully",ue.INFO):t.apiLog("OfflineStorageService","Sync failed",ue.ERROR)},function(e){t.apiLog("OfflineStorageService","Error during sync: ".concat(e),ue.ERROR)})):r&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",ue.INFO)}else this.apiLog("OfflineStorageService","Invalid online status value in custom event",ue.WARN)}else this.apiLog("OfflineStorageService","Invalid network status event received",ue.WARN)}},{key:"storeOffline",value:function(e,t,n){try{var r=_t({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==n?void 0:n.isTerminateCommit)?{isTerminateCommit:n.isTerminateCommit}:{},void 0!==(null==n?void 0:n.sequence)?{sequence:n.sequence}:{}),i=this.getFromStorage(this.syncQueue)||[];return i.push(r),this.saveToStorage(this.syncQueue,i),this.saveToStorage("".concat(this.storeName,"_").concat(e),t),this.apiLog("OfflineStorageService","Stored data offline for course ".concat(e),ue.INFO),{result:F,errorCode:0}}catch(t){var o,s=(pt(t,Error)?t.message:t+"").includes("storage quota");return this.apiLog("OfflineStorageService",s?"storage quota exceeded - cannot store offline data for course ".concat(e):"Error storing offline data: ".concat(t),ue.ERROR),{result:B,errorCode:null!==(o=this.error_codes.GENERAL)&&void 0!==o?o:0}}}},{key:"getOfflineData",value:function(e){return vt(function(){return gt(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),ue.ERROR),[2,null]}return[2]})}).call(this)}},{key:"syncOfflineData",value:function(){return vt(function(){var e,t,n,r,i,o,s,a,c,l,u,f,d,h;return gt(this,function(m){switch(m.label){case 0:if(this.syncInProgress||!this.isOnline)return[2,!1];this.syncInProgress=!0,m.label=1;case 1:if(m.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"),ue.INFO),t=[],n=!0,r=!1,i=void 0,m.label=2;case 2:m.trys.push([2,9,10,11]),o=e[Symbol.iterator](),m.label=3;case 3:if(n=(s=o.next()).done)return[3,8];if(l=null!==(c=this.settings.maxSyncAttempts)&&void 0!==c?c:5,(a=s.value).syncAttempts>=l)return this.apiLog("OfflineStorageService","Removing abandoned item ".concat(a.id," after ").concat(l," failed sync attempts"),ue.WARN),[3,7];m.label=4;case 4:return m.trys.push([4,6,,7]),[4,this.sendDataToLMS(a.data,_t({},void 0!==a.isTerminateCommit?{isTerminateCommit:a.isTerminateCommit}:{},void 0!==a.sequence?{sequence:a.sequence}:{}))];case 5:return!0===(u=m.sent()).result||u.result===F?this.apiLog("OfflineStorageService","Successfully synced item ".concat(a.id),ue.INFO):(a.syncAttempts++,t.push(a),this.apiLog("OfflineStorageService","Failed to sync item ".concat(a.id,", attempt #").concat(a.syncAttempts),ue.WARN)),[3,7];case 6:return f=m.sent(),a.syncAttempts++,t.push(a),this.apiLog("OfflineStorageService","Error syncing item ".concat(a.id,": ").concat(f),ue.ERROR),[3,7];case 7:return n=!0,[3,3];case 8:return[3,11];case 9:return d=m.sent(),r=!0,i=d,[3,11];case 10:try{n||null==o.return||o.return()}finally{if(r)throw i}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"),ue.INFO),this.syncInProgress=!1,[2,!0];case 12:return h=m.sent(),this.apiLog("OfflineStorageService","Error during sync process: ".concat(h),ue.ERROR),this.syncInProgress=!1,[2,!1];case 13:return[2]}})}).call(this)}},{key:"sendDataToLMS",value:function(e,t){return vt(function(){var n,r,i,o,s,a,c,result,l,u;return gt(this,function(f){switch(f.label){case 0:if(!(n=this.settings.lmsCommitUrl))return[2,{result:B,errorCode:this.error_codes.GENERAL||101}];f.label=1;case 1:return f.trys.push([1,7,,8]),i=n+"",o=this.settings.requestHandler(e,_t({isTerminateCommit:null!==(r=null==t?void 0:t.isTerminateCommit)&&void 0!==r&&r,trigger:"offline-replay"},void 0!==(null==t?void 0:t.sequence)?{sequence:t.sequence}:{})),s=(null==t?void 0:t.isTerminateCommit)&&this.settings.terminateCommitParam?h(i,this.settings.terminateCommitParam,"true"):i,a={method:"POST",mode:this.settings.fetchMode,body:JSON.stringify(o),headers:(d=_t({},this.settings.xhrHeaders),m={"Content-Type":this.settings.commitRequestDataType},m=null!=m?m:{},Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(m)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(m)).forEach(function(e){Object.defineProperty(d,e,Object.getOwnPropertyDescriptor(m,e))}),d)},this.settings.xhrWithCredentials&&(a.credentials="include"),[4,fetch(s,a)];case 2:return c=f.sent(),"function"!=typeof this.settings.responseHandler?[3,4]:[4,this.settings.responseHandler(c)];case 3:return l=f.sent(),[3,6];case 4:return[4,c.json()];case 5:l=f.sent(),f.label=6;case 6:return result=l,200>c.status||c.status>299||!0!==result.result&&result.result!==F?(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=f.sent(),this.apiLog("OfflineStorageService","Error sending data to LMS: ".concat(u),ue.ERROR),[2,{result:B,errorCode:this.error_codes.GENERAL||101}];case 8:return[2]}var d,m})}).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(pt(e,DOMException)&&"QuotaExceededError"===e.name)throw Error("storage quota exceeded - localStorage is full",{cause:e});throw e}}},{key:"hasPendingOfflineData",value:function(e){return vt(function(){return gt(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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}(),Ot=d(function(e,t,n,r,i,o){if("string"!=typeof t)return!1;var s=RegExp(n),a=t.match(s);if(o&&""===t)return!0;if(!a||""===a[0])throw new i(e,r);return!0},function(e,t,n,r,i,o){var s,a="string"==typeof t?t:"[".concat(void 0===t?"undefined":(s=t)&&"undefined"!=typeof Symbol&&s.constructor===Symbol?"symbol":typeof s,"]");return"".concat(e,":").concat(a,":").concat(n,":").concat(r,":").concat(o||!1)},{maxEntries:1e3,maxKeyLength:2e3}),wt=d(function(e,t,n,r,i){var o=n.split("#");if(isNaN(t=+t))throw new i(e,r);var s=o[0],a=o[1],c=void 0!==a&&""!==a&&"*"!==a;if(void 0!==s&&""!==s&&+s>t)throw new i(e,r);if(c&&t>+a)throw new i(e,r);return!0},function(e,t,n,r,i){return"".concat(e,":").concat(t,":").concat(n,":").concat(r)},{maxEntries:1e3});function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);t>n;n++)r[n]=e[n];return r}function Rt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function It(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nt(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){It(e,t,n[t])})}return e}function Tt(e){return function(e){if(Array.isArray(e))return Ct(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 Ct(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ct(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 Lt=Object.defineProperty,kt=function(e,t,n){return function(e,t,n){return t in e?Lt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},Mt=function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;Rt(this,e),kt(this,"valid"),kt(this,"targetActivity"),kt(this,"exception"),this.valid=t,this.targetActivity=n,this.exception=r},At=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5?arguments[5]:void 0;Rt(this,e),kt(this,"activityTree"),kt(this,"rollupProcess"),kt(this,"globalObjectiveMap"),kt(this,"adlNav"),kt(this,"eventCallback"),kt(this,"now"),kt(this,"defaultHideLmsUi"),kt(this,"defaultAuxiliaryResources"),kt(this,"_deliveryInProgress",!1),kt(this,"contentDelivered",!1),kt(this,"checkActivityCallback",null),kt(this,"invalidateCacheCallback",null),kt(this,"updateNavigationValidityCallback",null),kt(this,"clearSuspendedActivityCallback",null),this.activityTree=t,this.rollupProcess=n,this.globalObjectiveMap=r,this.adlNav=i,this.eventCallback=o,this.now=(null==s?void 0:s.now)||function(){return new Date},this.defaultHideLmsUi=(null==s?void 0:s.defaultHideLmsUi)?Tt(s.defaultHideLmsUi):[],this.defaultAuxiliaryResources=(null==s?void 0:s.defaultAuxiliaryResources)?s.defaultAuxiliaryResources.map(function(e){return Nt({},e)}):[]}return t=e,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 Mt(!1,null,"DB.1.1-1");var t=this.getActivityPath(e,!0);if(0===t.length)return new Mt(!1,null,"DB.1.1-2");var n=!0,r=!1,i=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done);n=!0)if(this.checkActivityCallback&&!this.checkActivityCallback(o.value))return new Mt(!1,null,"DB.1.1-3")}catch(e){r=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw i}}return new Mt(!0,e)}},{key:"contentDeliveryEnvironmentProcess",value:function(e){this._deliveryInProgress=!0;try{var t=e.isSuspended;this.activityTree.suspendedActivity&&this.clearSuspendedActivityCallback&&this.clearSuspendedActivityCallback();var n=this.getActivityPath(e,!0),r=!0,i=!1,o=void 0;try{for(var s,a=n[Symbol.iterator]();!(r=(s=a.next()).done);r=!0){var c=s.value;c.isActive||(t||c.isSuspended?c.isSuspended=!1:c.incrementAttemptCount(),c.isActive=!0,Ue.applySelectionAndRandomization(c,1>=c.attemptCount))}}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}this.activityTree.currentActivity=e,this.initializeForDelivery(e),this.setupAttemptTracking(e),this.contentDelivered=!0,this.adlNav&&this.updateNavigationValidityCallback&&this.updateNavigationValidityCallback(),this.fireDeliveryEvent(e)}finally{this._deliveryInProgress=!1}}},{key:"initializeForDelivery",value:function(e){"unknown"===e.completionStatus&&0===e.children.length&&(e.completionStatus="not attempted"),null===e.objectiveSatisfiedStatus&&(e.objectiveSatisfiedStatus=!1),null===e.progressMeasure&&(e.progressMeasure=0,e.progressMeasureStatus=!1),null===e.objectiveNormalizedMeasure&&(e.objectiveNormalizedMeasure=0,e.objectiveMeasureStatus=!1),e.attemptAbsoluteDuration="PT0H0M0S",e.attemptExperiencedDuration="PT0H0M0S",e.isAvailable=!0}},{key:"setupAttemptTracking",value:function(e){e.wasSkipped=!1,e.attemptAbsoluteStartTime=this.now().toISOString(),e.location||(e.location=""),e.activityAttemptActive=!0,e.learnerPrefs||(e.learnerPrefs={audioCaptioning:"0",audioLevel:"1",deliverySpeed:"1",language:""})}},{key:"fireDeliveryEvent",value:function(e){try{this.eventCallback&&this.eventCallback("onActivityDelivery",e),console.debug("Activity delivered: ".concat(e.id," - ").concat(e.title))}catch(e){console.warn("Failed to fire activity delivery event: ".concat(e))}}},{key:"getEffectiveHideLmsUi",value:function(t){var n=new Set,r=!0,i=!1,o=void 0;try{for(var s,a=this.defaultHideLmsUi[Symbol.iterator]();!(r=(s=a.next()).done);r=!0)n.add(s.value)}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}for(var c=t;c;){var l=!0,u=!1,f=void 0;try{for(var d,h=c.hideLmsUi[Symbol.iterator]();!(l=(d=h.next()).done);l=!0)n.add(d.value)}catch(e){u=!0,f=e}finally{try{l||null==h.return||h.return()}finally{if(u)throw f}}c=c.parent}return e.HIDE_LMS_UI_ORDER.filter(function(e){return n.has(e)})}},{key:"getEffectiveAuxiliaryResources",value:function(e){var t=new Map,n=!0,r=!1,i=void 0;try{for(var o,s=this.defaultAuxiliaryResources[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var a=o.value;a.resourceId&&t.set(a.resourceId,Nt({},a))}}catch(e){r=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw i}}for(var c=[],l=e;l;)c.push(l),l=l.parent;var u=!0,f=!1,d=void 0;try{for(var h,m=c.reverse()[Symbol.iterator]();!(u=(h=m.next()).done);u=!0){var v=h.value,y=!0,p=!1,_=void 0;try{for(var g,b=v.auxiliaryResources[Symbol.iterator]();!(y=(g=b.next()).done);y=!0){var E=g.value;E.resourceId&&t.set(E.resourceId,Nt({},E))}}catch(e){p=!0,_=e}finally{try{y||null==b.return||b.return()}finally{if(p)throw _}}}}catch(e){f=!0,d=e}finally{try{u||null==m.return||m.return()}finally{if(f)throw d}}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],n=[],r=e;null!==r;)n.unshift(r),r=r.parent;return!t&&n.length>0&&n.pop(),n}},{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))}}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();kt(At,"HIDE_LMS_UI_ORDER",Tt(["continue","previous","exit","exitAll","abandon","abandonAll","suspendAll"]));var jt=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,n=[{key:"loadFromFlattenedJSON",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(i()){var s=/^(cmi\.interactions\.)(\d+)\.(.*)$/,a=/^(cmi\.objectives\.)(\d+)\.(.*)$/,interactions=[],objectives=[],c=[];for(var l in e)if({}.hasOwnProperty.call(e,l)){var u=l.match(s);if(u){interactions.push({key:l,value:e[l],index:+u[2],field:u[3]||""});continue}var f=l.match(a);if(f){objectives.push({key:l,value:e[l],index:+f[2],field:f[3]||""});continue}c.push({key:l,value:e[l]})}interactions.sort(function(e,t){return e.index!==t.index?e.index-t.index:"id"===e.field?-1:"id"===t.field?1:"type"===e.field?-1:"type"===t.field?1:e.field.localeCompare(t.field)}),objectives.sort(function(e,t){return e.index!==t.index?e.index-t.index:"id"===e.field?-1:"id"===t.field?1:e.field.localeCompare(t.field)}),c.sort(function(e,t){return e.key.localeCompare(t.key)});var d=function(e){e.forEach(function(e){var s={};s[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 n,r,i=result,o="",s=RegExp(pattern);Array.from({length:null!==(n=null===(r=t.match(RegExp(pattern,"g")))||void 0===r?void 0:r.length)&&void 0!==n?n:0},function(){return s.exec(t)}).forEach(function(e){var t;e&&(i=null!==(t=i[o])&&void 0!==t?t:i[o]=e[2]?[]:{},o=e[2]||e[1]||"")}),i[o]=e[t]}),null!==(t=result[""])&&void 0!==t?t:result}(s),n,r,i,o)})};d(interactions),d(objectives),d(c)}else console.error("loadFromFlattenedJSON can only be called before the call to lmsInitialize.")}},{key:"loadFromJSON",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(r()){for(var o in t=void 0!==t?t:"cmi",i(e),e)if({}.hasOwnProperty.call(e,o)&&e[o]){var s=(t?t+".":"")+o,a=e[o];if(a.constructor===Array){for(var c=0;a.length>c;c++)if(a[c]){var l=a[c],u="".concat(s,".").concat(c);l.constructor===Object?this.loadFromJSON(l,u,n,r,i):n(u,l)}}else a.constructor===Object?this.loadFromJSON(a,s,n,r,i):n(s,a)}}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,n,r,i,o){var s=t||e,a=n?r(e,s):i(e,s);return[ue.DEBUG,"1",1,"DEBUG"].includes(o)&&(console.debug("Commit (terminated: "+(e?"yes":"no")+"): "),console.debug(a)),a}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();function Pt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);t>n;n++)r[n]=e[n];return r}function xt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var Dt=Object.defineProperty,Ft=function(e,t,n){return function(e,t,n){return t in e?Dt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},Bt=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ft(this,"settings"),Ft(this,"error_codes"),this.settings=t,this.error_codes=n}return t=e,n=[{key:"processHttpRequest",value:function(e,t){var n=arguments.length>5?arguments[5]:void 0;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?this._handleImmediateRequest(e,t,n):this._performSyncXHR(e,t,n)}},{key:"_handleImmediateRequest",value:function(e,t,n){var r=void 0===n?this.settings.requestHandler(t):this.settings.requestHandler(t,n),i=this._prepareRequestBody(null!=r?r:t).body,o=this.settings.terminationCommitContentType;this._warnIfBeaconContentTypeUnsafe(e,o);var s=navigator.sendBeacon(e,new Blob([i],{type:o}));return{result:s?"true":"false",errorCode:s?0:this.error_codes.GENERAL_COMMIT_FAILURE||391}}},{key:"_warnIfBeaconContentTypeUnsafe",value:function(e,t){var n,r;o(e)&&!i(t)&&(null===(n=(r=this.settings).onLogMessage)||void 0===n||n.call(r,ue.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,n){var r=void 0===n?this.settings.requestHandler(t):this.settings.requestHandler(t,n),i=this._prepareRequestBody(null!=r?r:t),o=i.body,s=i.contentType,a=new XMLHttpRequest;a.open("POST",e,!1),a.setRequestHeader("Content-Type",s),Object.entries(this.settings.xhrHeaders).forEach(function(e){var t,n,r=(n=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Pt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pt(e,t):void 0}}(t,n)||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.")}());a.setRequestHeader(r[0],r[1]+"")}),this.settings.xhrWithCredentials&&(a.withCredentials=!0);try{return a.send(o),this.settings.xhrResponseHandler(a)}catch(e){var c=xt(e,Error)?e.message:e+"";return{result:B,errorCode:this.error_codes.GENERAL_COMMIT_FAILURE||391,errorMessage:c}}}},{key:"_prepareRequestBody",value:function(e){return{body:xt(e,Array)?e.join("&"):JSON.stringify(e),contentType:xt(e,Array)?"application/x-www-form-urlencoded":this.settings.commitRequestDataType}}},{key:"updateSettings",value:function(e){this.settings=e}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();function Ut(e,t,n,r){return Ot(e,t,n,Q.TYPE_MISMATCH,J,r)}function Vt(e,t,n,r){if(""===t)throw new J(e,Q.VALUE_OUT_OF_RANGE);return wt(e,t,n,Q.VALUE_OUT_OF_RANGE,J)}var Gt=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,n=[{key:"validateScore",value:function(e,t,n,r,i,o,s){return!(7>=arguments.length||void 0===arguments[7]||!arguments[7]||""!==t)||Ot(e,t,n,i,s)&&(!r||wt(e,t,r,o,s))}},{key:"validateScorm12Audio",value:function(e,t){return Ut(e,t,ye)&&Vt(e,t,"-1#100")}},{key:"validateScorm12Language",value:function(e,t){return Ut(e,t,me)}},{key:"validateScorm12Speed",value:function(e,t){return Ut(e,t,ye)&&Vt(e,t,"-100#100")}},{key:"validateScorm12Text",value:function(e,t){return Ut(e,t,ye)&&Vt(e,t,"-1#1")}},{key:"validateReadOnly",value:function(e,t){if(t)throw new J(e,Q.READ_ONLY_ELEMENT)}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}(),zt=new Gt;function Ht(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);t>n;n++)r[n]=e[n];return r}function qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Jt(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){qt(e,t,n[t])})}return e}function Yt(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 n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function $t(e){return function(e){if(Array.isArray(e))return Ht(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 Ht(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ht(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 Kt(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Zt=Object.defineProperty,Qt=function(e,t,n){return function(e,t,n){return t in e?Zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":Kt(t))?t+"":t,n)},Xt=function(){function e(t,n,r,i,o,s,a,c,l){var u=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Qt(this,"_timeout"),Qt(this,"_error_codes"),Qt(this,"_settings",de),Qt(this,"_httpService"),Qt(this,"_eventService"),Qt(this,"_serializationService"),Qt(this,"_errorHandlingService"),Qt(this,"_loggingService"),Qt(this,"_offlineStorageService"),Qt(this,"_cmiValueAccessService"),Qt(this,"_courseId",""),Qt(this,"_pendingCommitCount",0),Qt(this,"_commitSequence",0),Qt(this,"_commitSettleWaiters",[]),Qt(this,"_setCMIElements",new Set),Qt(this,"startingData"),Qt(this,"currentState"),(Wt(this,e)?this.constructor:void 0)===e)throw new TypeError("Cannot construct BaseAPI instances directly");this.currentState=0,this._error_codes=t,n&&(this.settings=Jt({},de,n)),void 0!==(null==n?void 0:n.asyncCommit)&&void 0===n.useAsynchronousCommits&&void 0===n.throttleCommits&&(console.warn("DEPRECATED: 'asyncCommit' setting is deprecated and will be removed in a future version. Use 'useAsynchronousCommits: true' and 'throttleCommits: true' instead."),n.asyncCommit&&(this.settings.useAsynchronousCommits=!0,this.settings.throttleCommits=!0)),!this.settings.useAsynchronousCommits&&this.settings.throttleCommits&&(console.warn("throttleCommits cannot be used with synchronous commits. Setting throttleCommits to false."),this.settings.throttleCommits=!1),this._loggingService=c||st(),this._loggingService.setLogLevel(this.settings.logLevel),this._loggingService.setLogHandler(this.settings.onLogMessage?this.settings.onLogMessage:he),r?this._httpService=r: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 $e(this.settings,this._error_codes)):this._httpService=new Bt(this.settings,this._error_codes),this._eventService=i||new ht(function(e,t,n,r){return u.apiLog(e,t,n,r)}),this._serializationService=o||new jt,this._errorHandlingService=a||new ut(this._error_codes,function(e,t,n,r){return u.apiLog(e,t,n||ue.ERROR,r)},function(e,t){return u.getLmsErrorMessageDetails(e,t)},void 0),this.settings.enableOfflineSupport&&(this._offlineStorageService=l||new St(this.settings,this._error_codes,function(e,t,n,r){return u.apiLog(e,t,n,r)}),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",ue.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),ue.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",ue.INFO),u.loadFromJSON(e.runtimeData))}).catch(function(e){u.apiLog("constructor","Error retrieving offline data: ".concat(e),ue.ERROR)})),this._cmiValueAccessService=new et({errorCodes:this._error_codes,getLastErrorCode:function(){return u.lastErrorCode},setLastErrorCode:function(e){u.lastErrorCode=e},throwSCORMError:function(e,t,n){return u.throwSCORMError(e,t,n)},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,n){return u.getChildElement(e,t,n)},apiLog:function(e,t,n){return u.apiLog(e,t,n)},checkObjectHasProperty:function(e,t){return u._checkObjectHasProperty(e,t)},getDataModel:function(){return u}})}return t=e,n=[{key:"lastErrorCode",get:function(){var e,t;return null!==(e=null===(t=this._errorHandlingService)||void 0===t?void 0:t.lastErrorCode)&&void 0!==e?e:"0"},set:function(e){this._errorHandlingService&&(this._errorHandlingService.lastErrorCode=e)}},{key:"eventService",get:function(){return this._eventService}},{key:"loggingService",get:function(){return this._loggingService}},{key:"commonReset",value:function(e){this.apiLog("reset","Called",ue.INFO),this.settings=Jt({},this.settings,e),this.clearScheduledCommit(),this.currentState=0,this.lastErrorCode="0",this._eventService.reset(),this.startingData={},this._setCMIElements.clear(),this._offlineStorageService&&(this._offlineStorageService.updateSettings(this.settings),(null==e?void 0:e.courseId)&&(this._courseId=e.courseId))}},{key:"initialize",value:function(e,t,n){var r=this,i=B;return this.isInitialized()?this.throwSCORMError("api",this._error_codes.INITIALIZED,t):this.isTerminated()?this.throwSCORMError("api",this._error_codes.TERMINATED,n):(this.settings.selfReportSessionTime&&this.cmi.setStartTime(),this.currentState=1,this.lastErrorCode="0",i=F,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 n;t&&(r.apiLog(e,"Syncing pending offline data on initialization",ue.INFO),null===(n=r._offlineStorageService)||void 0===n||n.syncOfflineData().then(function(t){t&&(r.apiLog(e,"Successfully synced offline data",ue.INFO),r.processListeners("OfflineDataSynced"))}))})),this.apiLog(e,"returned: "+i,ue.INFO),this.clearSCORMError(i),i}},{key:"apiLog",value:function(e,t,n,r){t=function(e,t,n){var r=e?"".concat((e+"").padEnd(20),": "):"";return n&&(r=(r+=n).padEnd(70)),r+(null!=t?t:"")}(e,t,r),this._loggingService.log(n,t)}},{key:"settings",get:function(){return this._settings},set:function(e){var t,n,r,i=this._settings;this._settings=Jt({},this._settings,e),null===(t=this._httpService)||void 0===t||t.updateSettings(this._settings),void 0!==e.logLevel&&e.logLevel!==i.logLevel&&(null===(n=this._loggingService)||void 0===n||n.setLogLevel(e.logLevel)),void 0!==e.onLogMessage&&e.onLogMessage!==i.onLogMessage&&(null===(r=this._loggingService)||void 0===r||r.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(n){var r={resolve:n};void 0!==(null==e?void 0:e.timeoutMs)&&(r.timeoutId=setTimeout(function(){var e=t._commitSettleWaiters.indexOf(r);-1!==e&&(t._commitSettleWaiters.splice(e,1),n())},e.timeoutMs)),t._commitSettleWaiters.push(r)})}},{key:"_flushCommitSettleWaiters",value:function(){var e=this._commitSettleWaiters.splice(0),t=!0,n=!1,r=void 0;try{for(var i,o=e[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var s=i.value;void 0!==s.timeoutId&&clearTimeout(s.timeoutId),s.resolve()}}catch(e){n=!0,r=e}finally{try{t||null==o.return||o.return()}finally{if(n)throw r}}}},{key:"terminate",value:function(e,t){var n=F,r=!1;if(this.isNotInitialized()){var i,o=null!==(i=this._error_codes.TERMINATION_BEFORE_INIT)&&void 0!==i?i:0;this.throwSCORMError("api",o),112===o&&(n=B)}else if(t&&this.isTerminated()){var s,a=null!==(s=this._error_codes.MULTIPLE_TERMINATION)&&void 0!==s?s:0;this.throwSCORMError("api",a),113===a&&(n=B)}else{var c;r=!0,this.processListeners("BeforeTerminate");var result=this.storeData(!0,"terminate");if((null!==(c=result.errorCode)&&void 0!==c?c:0)>0){var l;result.errorMessage&&this.apiLog("terminate","Terminate failed with error: ".concat(result.errorMessage),ue.ERROR),result.errorDetails&&this.apiLog("terminate","Error details: ".concat(JSON.stringify(result.errorDetails)),ue.DEBUG),this.throwSCORMError("api",null!==(l=result.errorCode)&&void 0!==l?l:0),n=B}else{var u;this.currentState=2,t&&(this.lastErrorCode="0");var f=null!==(u=null==result?void 0:result.result)&&void 0!==u?u:F;n="boolean"==typeof f?f+"":f}this.processListeners(e)}return this.apiLog(e,"returned: "+n,ue.INFO),r&&this.clearSCORMError(n),n}},{key:"getValue",value:function(e,t,n){var r,i,o="";if(this.checkState(t,null!==(r=this._error_codes.RETRIEVE_BEFORE_INIT)&&void 0!==r?r:0,null!==(i=this._error_codes.RETRIEVE_AFTER_TERM)&&void 0!==i?i:0)){try{o=this.getCMIValue(n)}catch(e){o=this.handleValueAccessException(n,e,o)}"0"===this.lastErrorCode&&this.checkUninitializedGet(n,o),this.processListeners(e,n)}return this.apiLog(e,": returned: "+o,ue.INFO,n),void 0===o?"":("0"===this.lastErrorCode&&this.clearSCORMError(o),"number"==typeof o||"boolean"==typeof o?o+"":o)}},{key:"setValue",value:function(e,t,n,r,i){var o,s;void 0!==i&&(i+="");var a=B;if(this.checkState(n,null!==(o=this._error_codes.STORE_BEFORE_INIT)&&void 0!==o?o:0,null!==(s=this._error_codes.STORE_AFTER_TERM)&&void 0!==s?s:0)){try{a=this.setCMIValue(r,i)}catch(e){a=this.handleValueAccessException(r,e,a)}this.processListeners(e,r,i)}return void 0===a&&(a=B),this.lastErrorCode+""=="0"&&this.settings.autocommit&&this.scheduleCommit(1e3*this.settings.autocommitSeconds,t),this.apiLog(e,": "+i+": result: "+a,ue.INFO,r),"0"===this.lastErrorCode&&this.clearSCORMError(a),a}},{key:"commit",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"manual";this.clearScheduledCommit();var i=F;if(this.isNotInitialized()){var o,s=null!==(o=this._error_codes.COMMIT_BEFORE_INIT)&&void 0!==o?o:0;this.throwSCORMError("api",s),142===s&&(i=B)}else if(n&&this.isTerminated()){var a,c=null!==(a=this._error_codes.COMMIT_AFTER_TERM)&&void 0!==a?a:0;this.throwSCORMError("api",c),143===c&&(i=B)}else{var l,u,result=this.storeData(!1,r),f=null!==(l=result.errorCode)&&void 0!==l?l:0;f>0&&(result.errorMessage&&this.apiLog("commit","Commit failed with error: ".concat(result.errorMessage),ue.ERROR),result.errorDetails&&this.apiLog("commit","Error details: ".concat(JSON.stringify(result.errorDetails)),ue.DEBUG),this.throwSCORMError("api",f));var d=null!==(u=null==result?void 0:result.result)&&void 0!==u?u:B;this.apiLog(e," Result: "+(i="boolean"==typeof d?d+"":d),ue.DEBUG,"HttpRequest"),n&&0===f&&(this.lastErrorCode="0"),this.processListeners(e),this.settings.enableOfflineSupport&&this._offlineStorageService&&this._offlineStorageService.isDeviceOnline()&&this._courseId&&this._offlineStorageService.hasPendingOfflineData(this._courseId).then(function(n){var r;n&&(t.apiLog(e,"Syncing pending offline data",ue.INFO),null===(r=t._offlineStorageService)||void 0===r||r.syncOfflineData().then(function(n){n?(t.apiLog(e,"Successfully synced offline data",ue.INFO),t.processListeners("OfflineDataSynced")):t.apiLog(e,"Failed to sync some offline data",ue.WARN)}))})}return this.apiLog(e,"returned: "+i,ue.INFO),this.isNotInitialized()||n&&this.isTerminated()||this.clearSCORMError(i),i}},{key:"getLastError",value:function(e){var t=this.lastErrorCode+"";return this.processListeners(e),this.apiLog(e,"returned: "+t,ue.INFO),t}},{key:"getErrorString",value:function(e,t){var n="";return null!==t&&""!==t&&(n=this.getLmsErrorMessageDetails(t),this.processListeners(e)),n.length>255&&(n=n.substring(0,255)),this.apiLog(e,"returned: "+n,ue.INFO),n}},{key:"getDiagnostic",value:function(e,t){var n="",r=""===t?this.lastErrorCode+"":t;if(null!==r&&""!==r){var i=this._errorHandlingService.lastDiagnostic;n=i&&r+""==this.lastErrorCode+""?i:this.getLmsErrorMessageDetails(r,!0),this.processListeners(e)}return n.length>255&&(n=n.substring(0,255)),this.apiLog(e,"returned: "+n,ue.INFO),n}},{key:"checkState",value:function(e,t,n){return this.isNotInitialized()?(this.throwSCORMError("api",t),!1):!e||!this.isTerminated()||(this.throwSCORMError("api",n),!1)}},{key:"_checkForDuplicateId",value:function(e,t){var n=function(e,t){if(e&&"object"===(void 0===e?"undefined":Kt(e))&&t in e){var n=e[t];return Wt(n,oe)?n:void 0}},r=function(e,t,n){for(var r=0;e.childArray.length>r;r++)if(r!==t){var i=e.childArray[r];if(i&&"object"===(void 0===i?"undefined":Kt(i))&&"id"in i&&i.id===n)return!0}return!1},i=e.match(/^cmi\.objectives\.(\d+)\.id$/);if(i&&i[1]){var o=parseInt(i[1],10),objectives=n(this.cmi,"objectives");return!!objectives&&r(objectives,o,t)}var s=e.match(/^cmi\.interactions\.(\d+)\.id$/);if(s&&s[1]){var a=parseInt(s[1],10),interactions=n(this.cmi,"interactions");return!!interactions&&r(interactions,a,t)}var c=e.match(/^cmi\.interactions\.(\d+)\.objectives\.(\d+)\.id$/);if(c&&c[1]&&c[2]){var l=parseInt(c[1],10),u=parseInt(c[2],10),f=n(this.cmi,"interactions");if(f){var d=f.childArray[l];if(d){var h=n(d,"objectives");if(h)return r(h,u,t)}}return!1}return!1}},{key:"getLmsErrorMessageDetails",value:function(e){throw Error("The getLmsErrorMessageDetails method has not been implemented")}},{key:"getCMIValue",value:function(e){throw Error("The getCMIValue method has not been implemented")}},{key:"setCMIValue",value:function(e,t){throw Error("The setCMIValue method has not been implemented")}},{key:"_commonSetCMIValue",value:function(e,t,n,r){var result=this._cmiValueAccessService.setCMIValue(e,t,n,r);return result===F&&this._setCMIElements.add(n),result}},{key:"_commonGetCMIValue",value:function(e,t,n){return this._cmiValueAccessService.getCMIValue(e,t,n)}},{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,n,r){void 0!==r?this._eventService.processListeners(e,t,n,r):this._eventService.processListeners(e,t,n)}},{key:"throwSCORMError",value:function(e,t,n,r){this._errorHandlingService.throwSCORMError(e,null!=t?t:0,n,r)}},{key:"clearSCORMError",value:function(e){this._errorHandlingService.clearSCORMError(e)}},{key:"loadFromFlattenedJSON",value:function(e,t){var n=this;t||(t=""),this._serializationService.loadFromFlattenedJSON(e,t,function(e,t){return n.setCMIValue(e,t)},function(){return n.isNotInitialized()},function(e){n.startingData=e})}},{key:"getFlattenedCMI",value:function(){return l(this.renderCMIToJSONObject())}},{key:"loadFromJSON",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";n&&""!==n||Object.hasOwnProperty.call(e,"cmi")||Object.hasOwnProperty.call(e,"adl")||(n="cmi"),this._serializationService.loadFromJSON(e,n,function(e,n){return t.setCMIValue(e,n)},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 n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0,o=++this._commitSequence;this._pendingCommitCount+=1;var s=!1,a=!1,c=function(){s||(s=!0,n._pendingCommitCount-=1,0===n._pendingCommitCount&&n._flushCommitSettleWaiters())};try{var l=null!=i?i:r?"terminate":"manual",u=t;if(r&&this.settings.terminateCommitPayloadField){var f=this.settings.terminateCommitPayloadField;Array.isArray(u)?u=$t(u).concat(["".concat(encodeURIComponent(f),"=true")]):u&&"object"===(void 0===u?"undefined":Kt(u))&&(u=Yt(Jt({},u),qt({},f,!0)))}!0===this.settings.includeCommitSequence&&(Array.isArray(u)?u=$t(u).concat(["commitSequence=".concat(o)]):u&&"object"===(void 0===u?"undefined":Kt(u))&&(u=Yt(Jt({},u),{commitSequence:o})));var d,m=r&&this.settings.terminateCommitParam?h(e,this.settings.terminateCommitParam,"true"):e,v={isTerminateCommit:r,trigger:l,sequence:o},y={url:m,trigger:l,isTerminateCommit:r,sequence:o};if(this.settings.enableOfflineSupport&&this._offlineStorageService&&!this._offlineStorageService.isDeviceOnline()&&this._courseId)return this.apiLog("processHttpRequest","Device is offline, storing data locally",ue.INFO),u&&"object"===(void 0===u?"undefined":Kt(u))&&"cmi"in u?this._offlineStorageService.storeOffline(this._courseId,u,{isTerminateCommit:r,sequence:o}):(this.apiLog("processHttpRequest","Invalid commit data format for offline storage",ue.ERROR),{result:B,errorCode:null!==(d=this._error_codes.GENERAL)&&void 0!==d?d:101});var result=this._httpService.processHttpRequest(m,u,r,function(e,t,r,i){return n.apiLog(e,t,r,i)},function(e,t,r){"CommitSuccess"===e||"CommitError"===e?("CommitError"===e&&"number"==typeof r&&(y.errorCode=r),c(),n.processListeners(e,t,r,y)):n.processListeners(e,t,r)},v,c);return a=!0===this._httpService.reportsRequestCompletion,result}finally{a||c()}}},{key:"scheduleCommit",value:function(e,t){this._timeout||(this._timeout=new Ie(this,e,t),this.apiLog("scheduleCommit","scheduled",ue.DEBUG,""))}},{key:"clearScheduledCommit",value:function(){this._timeout&&(this._timeout.cancel(),this._timeout=void 0,this.apiLog("clearScheduledCommit","cleared",ue.DEBUG,""))}},{key:"_checkObjectHasProperty",value:function(e,t){return null!=e&&"object"===(void 0===e?"undefined":Kt(e))&&(Object.hasOwnProperty.call(e,t)||null!=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),t)||t in e)}},{key:"handleValueAccessException",value:function(e,t,n){return Wt(t,D)?(this.lastErrorCode=t.errorCode+"",""!==n&&(n=B),this.throwSCORMError(e,t.errorCode,t.errorMessage)):Wt(t,Error)&&t.message?this.throwSCORMError(e,this._error_codes.GENERAL,t.message):this.throwSCORMError(e,this._error_codes.GENERAL,"Unknown error"),n}},{key:"getCommitObject",value:function(e){var t=this;return this._serializationService.getCommitObject(e,this.settings.alwaysSendTotalTime,this.settings.renderCommonCommitFields,function(e,n){return t.renderCommitObject(e,n)},function(e,n){return t.renderCommitCMI(e,n)},this.settings.logLevel)}}],n&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),e;var t,n}();function en(e){return en=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},en(e)}function tn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tn=function(){return!!result})()}function nn(e,t){return nn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},nn(e,t)}function rn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var sn=Object.defineProperty,an=function(e,t,n){return function(e,t,n){return t in e?sn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":rn(t))?t+"":t,n)},cn=function(e){function t(e){var n,r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,n){return t=en(t),r=e,!(i=tn()?Reflect.construct(t,n||[],en(e).constructor):t.apply(e,n))||"object"!==rn(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,[e.CMIElement]),an(n,"__children"),an(n,"__score_range"),an(n,"__invalid_error_code"),an(n,"__invalid_type_code"),an(n,"__invalid_range_code"),an(n,"__decimal_regex"),an(n,"__error_class"),an(n,"__allow_empty_string"),an(n,"_raw",""),an(n,"_min",""),an(n,"_max"),n.__children=e.score_children||U.score_children,n.__score_range=!!e.score_range&&Ee,n._max=e.max||""===e.max?e.max:"100",n.__invalid_error_code=e.invalidErrorCode||Q.INVALID_SET_VALUE,n.__invalid_type_code=e.invalidTypeCode||Q.TYPE_MISMATCH,n.__invalid_range_code=e.invalidRangeCode||Q.VALUE_OUT_OF_RANGE,n.__decimal_regex=e.decimalRegex||pe,n.__error_class=e.errorClass,n.__allow_empty_string=null!==(r=e.allowEmptyString)&&void 0!==r&&r,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&&nn(e,t)}(t,e),n=t,(r=[{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){zt.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){zt.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){zt.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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,r),t;var n,r}(S);function ln(e,t,n){return ln="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=un(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n||e):i.value}},ln(e,t,n||e)}function un(e){return un=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},un(e)}function fn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(fn=function(){return!!result})()}function dn(e,t){return dn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},dn(e,t)}function hn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var mn=Object.defineProperty,vn=function(e,t,n){return function(e,t,n){return t in e?mn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":hn(t))?t+"":t,n)},yn=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,n){return t=un(t),r=e,!(i=fn()?Reflect.construct(t,n||[],un(e).constructor):t.apply(e,n))||"object"!==hn(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,["cmi.core"]),vn(e,"score"),vn(e,"__children",U.core_children),vn(e,"_student_id",""),vn(e,"_student_name",""),vn(e,"_lesson_location",""),vn(e,"_credit",""),vn(e,"_lesson_status","not attempted"),vn(e,"_entry",""),vn(e,"_total_time",""),vn(e,"_lesson_mode","normal"),vn(e,"_exit",""),vn(e,"_session_time","00:00:00"),vn(e,"_suspend_data",""),e.score=new cn({CMIElement:"cmi.core.score",score_children:U.score_children,score_range:Ee,invalidErrorCode:Q.INVALID_SET_VALUE,invalidTypeCode:Q.TYPE_MISMATCH,invalidRangeCode:Q.VALUE_OUT_OF_RANGE,errorClass:J,allowEmptyString:!0}),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&dn(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){var e;ln(un(t.prototype),"initialize",this).call(this),null===(e=this.score)||void 0===e||e.initialize()}},{key:"reset",value:function(){var e;this._initialized=!1,this._exit="",this._entry="",this._session_time="00:00:00",null===(e=this.score)||void 0===e||e.reset()}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new J(this._cmi_element+"._children",Q.INVALID_SET_VALUE)}},{key:"student_id",get:function(){return this._student_id},set:function(student_id){if(this.initialized)throw new J(this._cmi_element+".student_id",Q.READ_ONLY_ELEMENT);this._student_id=student_id}},{key:"student_name",get:function(){return this._student_name},set:function(student_name){if(this.initialized)throw new J(this._cmi_element+".student_name",Q.READ_ONLY_ELEMENT);this._student_name=student_name}},{key:"lesson_location",get:function(){return this._lesson_location},set:function(lesson_location){Ut(this._cmi_element+".lesson_location",lesson_location,me,!0)&&(this._lesson_location=lesson_location)}},{key:"credit",get:function(){return this._credit},set:function(credit){if(this.initialized)throw new J(this._cmi_element+".credit",Q.READ_ONLY_ELEMENT);Ut(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?Ut(this._cmi_element+".lesson_status",lesson_status,"^(passed|completed|failed|incomplete|browsed)$")&&(this._lesson_status=lesson_status):Ut(this._cmi_element+".lesson_status",lesson_status,be)&&(this._lesson_status=lesson_status)}},{key:"entry",get:function(){return this._entry},set:function(entry){if(this.initialized)throw new J(this._cmi_element+".entry",Q.READ_ONLY_ELEMENT);Ut(this._cmi_element+".entry",entry,"^(ab-initio|resume|)$",!0)&&(this._entry=entry)}},{key:"total_time",get:function(){return this._total_time},set:function(total_time){if(this.initialized)throw new J(this._cmi_element+".total_time",Q.READ_ONLY_ELEMENT);if(Ut(this._cmi_element+".total_time",total_time,ve,!0))if(total_time){var e=a(total_time,ve);this._total_time=s(e)}else this._total_time=total_time}},{key:"lesson_mode",get:function(){return this._lesson_mode},set:function(lesson_mode){if(this.initialized)throw new J(this._cmi_element+".lesson_mode",Q.READ_ONLY_ELEMENT);Ut(this._cmi_element+".lesson_mode",lesson_mode,"^(normal|browse|review)$")&&(this._lesson_mode=lesson_mode)}},{key:"exit",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".exit",Q.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=""),Ut(this._cmi_element+".exit",exit,"^(time-out|suspend|logout|)$",!0)&&(this._exit=exit)}},{key:"session_time",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".session_time",Q.WRITE_ONLY_ELEMENT);return this._session_time},set:function(session_time){if(Ut(this._cmi_element+".session_time",session_time,ve)){var e=a(session_time,ve);this._session_time=s(e)}}},{key:"suspend_data",get:function(){return this._suspend_data},set:function(suspend_data){Ut(this._cmi_element+".suspend_data",suspend_data,"^[\\s\\S]{0,64000}$",!0)&&(this._suspend_data=suspend_data)}},{key:"getCurrentTotalTime",value:function(e){var t,n,r,i=this._session_time;if(void 0!==e){var o=(new Date).getTime()-e;i=s(o/1e3)}return t=this._total_time,n=i,"string"==typeof(r=RegExp(ve))&&(r=RegExp(r)),s(a(t,r)+a(n,r))}},{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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,r),t;var n,r}(S);function pn(e,t,n){return t=gn(t),r=e,!(i=En()?Reflect.construct(t,n||[],gn(e).constructor):t.apply(e,n))||"object"!==On(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}function _n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gn(e){return gn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},gn(e)}function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Sn(e,t)}function En(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(En=function(){return!!result})()}function Sn(e,t){return Sn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Sn(e,t)}function On(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var wn=Object.defineProperty,Cn=function(e,t,n){return function(e,t,n){return t in e?wn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":On(t))?t+"":t,n)},Rn=function(e){function t(){return _n(this,t),pn(this,t,[{CMIElement:"cmi.objectives",children:U.objectives_children,errorCode:Q.INVALID_SET_VALUE,errorClass:J}])}return bn(t,e),t}(oe),In=function(e){function t(){var e;return _n(this,t),e=pn(this,t,["cmi.objectives.n"]),Cn(e,"score"),Cn(e,"_id",""),Cn(e,"_status",""),e.score=new cn({CMIElement:"cmi.objectives.n.score",score_children:U.score_children,score_range:Ee,invalidErrorCode:Q.INVALID_SET_VALUE,invalidTypeCode:Q.TYPE_MISMATCH,invalidRangeCode:Q.VALUE_OUT_OF_RANGE,errorClass:J,allowEmptyString:!0}),e}return bn(t,e),n=t,(r=[{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){Ut(this._cmi_element+".id",id,_e)&&(this._id=id)}},{key:"status",get:function(){return this._status},set:function(status){Ut(this._cmi_element+".status",status,be)&&(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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,r),t;var n,r}(S);function Nn(e){return Nn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Nn(e)}function Tn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Tn=function(){return!!result})()}function Ln(e,t){return Ln=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ln(e,t)}function kn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Mn=Object.defineProperty,An=function(e,t,n){return function(e,t,n){return t in e?Mn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":kn(t))?t+"":t,n)},jn=function(e){function t(e){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,n){return t=Nn(t),r=e,!(i=Tn()?Reflect.construct(t,n||[],Nn(e).constructor):t.apply(e,n))||"object"!==kn(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,["cmi.student_data"]),An(n,"__children"),An(n,"_mastery_score",""),An(n,"_max_time_allowed",""),An(n,"_time_limit_action",""),n.__children=e||U.student_data_children,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&&Ln(e,t)}(t,e),n=t,(r=[{key:"reset",value:function(){this._initialized=!1}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new J(this._cmi_element+"._children",Q.INVALID_SET_VALUE)}},{key:"mastery_score",get:function(){return this._mastery_score},set:function(mastery_score){if(zt.validateReadOnly(this._cmi_element+".mastery_score",this.initialized),null!=mastery_score){var e=mastery_score;"string"!=typeof e&&(e+=""),""!==e?Ut(this._cmi_element+".mastery_score",e,pe)&&Vt(this._cmi_element+".mastery_score",e,Ee)&&(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(zt.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{Ut(t,e,ve,!0);var n=a(e,ve);return s(n)}catch(e){}try{Ut(t,e,Se,!0);var r=c(e,Se);return s(r)}catch(e){}throw new J(t,Q.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(zt.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+"";Ut(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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,r),t;var n,r}(S);function Pn(e){return Pn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Pn(e)}function xn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(xn=function(){return!!result})()}function Dn(e,t){return Dn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Dn(e,t)}function Fn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Bn=Object.defineProperty,Un=function(e,t,n){return function(e,t,n){return t in e?Bn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":Fn(t))?t+"":t,n)},Vn=function(e){function t(e){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,n){return t=Pn(t),r=e,!(i=xn()?Reflect.construct(t,n||[],Pn(e).constructor):t.apply(e,n))||"object"!==Fn(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,["cmi.student_preference"]),Un(n,"__children"),Un(n,"_audio",""),Un(n,"_language",""),Un(n,"_speed",""),Un(n,"_text",""),n.__children=e||U.student_preference_children,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&&Dn(e,t)}(t,e),n=t,(r=[{key:"reset",value:function(){this._initialized=!1}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new J(this._cmi_element+"._children",Q.INVALID_SET_VALUE)}},{key:"audio",get:function(){return this._audio},set:function(audio){zt.validateScorm12Audio(this._cmi_element+".audio",audio)&&(this._audio=audio)}},{key:"language",get:function(){return this._language},set:function(language){zt.validateScorm12Language(this._cmi_element+".language",language)&&(this._language=language)}},{key:"speed",get:function(){return this._speed},set:function(speed){zt.validateScorm12Speed(this._cmi_element+".speed",speed)&&(this._speed=speed)}},{key:"text",get:function(){return this._text},set:function(text){zt.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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,r),t;var n,r}(S);function Gn(e,t,n){return t=Wn(t),r=e,!(i=Yn()?Reflect.construct(t,n||[],Wn(e).constructor):t.apply(e,n))||"object"!==Kn(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}function zn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hn(e,t,n){return t&&function(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function qn(e,t,n){return qn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Wn(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n||e):i.value}},qn(e,t,n||e)}function Wn(e){return Wn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Wn(e)}function Jn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$n(e,t)}function Yn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Yn=function(){return!!result})()}function $n(e,t){return $n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},$n(e,t)}function Kn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Zn=Object.defineProperty,Qn=function(e,t,n){return function(e,t,n){return t in e?Zn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":Kn(t))?t+"":t,n)},Xn=function(e){function t(){return zn(this,t),Gn(this,t,[{CMIElement:"cmi.interactions",children:U.interactions_children,errorCode:Q.INVALID_SET_VALUE,errorClass:J}])}return Jn(t,e),t}(oe),er=function(e){function t(){var e;return zn(this,t),e=Gn(this,t,["cmi.interactions.n"]),Qn(e,"objectives"),Qn(e,"correct_responses"),Qn(e,"_id",""),Qn(e,"_time",""),Qn(e,"_type",""),Qn(e,"_weighting",""),Qn(e,"_student_response",""),Qn(e,"_result",""),Qn(e,"_latency",""),e.objectives=new oe({CMIElement:"cmi.interactions.n.objectives",errorCode:Q.INVALID_SET_VALUE,errorClass:J,children:U.objectives_children}),e.correct_responses=new oe({CMIElement:"cmi.interactions.correct_responses",errorCode:Q.INVALID_SET_VALUE,errorClass:J,children:U.correct_responses_children}),e}return Jn(t,e),Hn(t,[{key:"initialize",value:function(){var e,n;qn(Wn(t.prototype),"initialize",this).call(this),null===(e=this.objectives)||void 0===e||e.initialize(),null===(n=this.correct_responses)||void 0===n||n.initialize()}},{key:"reset",value:function(){var e,t;this._initialized=!1,this._id="",this._time="",this._type="",this._weighting="",this._student_response="",this._result="",this._latency="",null===(e=this.objectives)||void 0===e||e.reset(),null===(t=this.correct_responses)||void 0===t||t.reset()}},{key:"id",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".id",Q.WRITE_ONLY_ELEMENT);return this._id},set:function(id){Ut(this._cmi_element+".id",id,_e)&&(this._id=id)}},{key:"time",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".time",Q.WRITE_ONLY_ELEMENT);return this._time},set:function(time){Ut(this._cmi_element+".time",time,"^(?:[01]\\d|2[0123]):(?:[012345]\\d):(?:[012345]\\d)(\\.\\d{1,2})?$")&&(this._time=time)}},{key:"type",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".type",Q.WRITE_ONLY_ELEMENT);return this._type},set:function(type){Ut(this._cmi_element+".type",type,"^(true-false|choice|fill-in|matching|performance|sequencing|likert|numeric)$")&&(this._type=type)}},{key:"weighting",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".weighting",Q.WRITE_ONLY_ELEMENT);return this._weighting},set:function(weighting){Ut(this._cmi_element+".weighting",weighting,pe)&&Vt(this._cmi_element+".weighting",weighting,"-100#100")&&(this._weighting=weighting)}},{key:"student_response",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".student_response",Q.WRITE_ONLY_ELEMENT);return this._student_response},set:function(student_response){Ut(this._cmi_element+".student_response",student_response,ge,!0)&&(this._student_response=student_response)}},{key:"result",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".result",Q.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'.")),Ut(this._cmi_element+".result",e,"^(correct|wrong|unanticipated|neutral|([0-9]{0,3})?(\\.[0-9]*)?)$")&&(this._result=e)}},{key:"latency",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".latency",Q.WRITE_ONLY_ELEMENT);return this._latency},set:function(latency){if(Ut(this._cmi_element+".latency",latency,ve)){var e=a(latency,ve);this._latency=s(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}(S),tr=function(e){function t(){var e;return zn(this,t),e=Gn(this,t,["cmi.interactions.n.objectives.n"]),Qn(e,"_id",""),e}return Jn(t,e),Hn(t,[{key:"reset",value:function(){this._initialized=!1,this._id=""}},{key:"id",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".id",Q.WRITE_ONLY_ELEMENT);return this._id},set:function(id){Ut(this._cmi_element+".id",id,_e)&&(this._id=id)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={id:this.id};return this.jsonString=!1,result}}]),t}(S),nr=function(e){function t(){var e;return zn(this,t),e=Gn(this,t,["cmi.interactions.correct_responses.n"]),Qn(e,"_pattern",""),e}return Jn(t,e),Hn(t,[{key:"reset",value:function(){this._initialized=!1,this._pattern=""}},{key:"pattern",get:function(){if(!this.jsonString)throw new J(this._cmi_element+".pattern",Q.WRITE_ONLY_ELEMENT);return this._pattern},set:function(pattern){Ut(this._cmi_element+".pattern",pattern,ge,!0)&&(this._pattern=pattern)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={pattern:this._pattern};return this.jsonString=!1,result}}]),t}(S);function rr(e,t,n){return rr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ir(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n||e):i.value}},rr(e,t,n||e)}function ir(e){return ir=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ir(e)}function or(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(or=function(){return!!result})()}function sr(e,t){return sr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},sr(e,t)}function ar(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var cr=Object.defineProperty,lr=function(e,t,n){return function(e,t,n){return t in e?cr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":ar(t))?t+"":t,n)},ur=function(e){function t(e,student_data,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=function(e,t,n){return t=ir(t),r=e,!(i=or()?Reflect.construct(t,n||[],ir(e).constructor):t.apply(e,n))||"object"!==ar(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,["cmi"]),lr(r,"__children",""),lr(r,"__version","3.4"),lr(r,"_launch_data",""),lr(r,"_comments",""),lr(r,"_comments_from_lms",""),lr(r,"core"),lr(r,"objectives"),lr(r,"student_data"),lr(r,"student_preference"),lr(r,"interactions"),n&&r.initialize(),r.__children=e||U.cmi_children,r.core=new yn,r.objectives=new Rn,r.student_data=student_data||new jn,r.student_preference=new Vn,r.interactions=new Xn,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&&sr(e,t)}(t,e),n=t,(r=[{key:"reset",value:function(){var e,t,n,r,i;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===(n=this.interactions)||void 0===n||n.reset(!0),null===(r=this.student_data)||void 0===r||r.reset(),null===(i=this.student_preference)||void 0===i||i.reset()}},{key:"initialize",value:function(){var e,n,r,i,o;rr(ir(t.prototype),"initialize",this).call(this),null===(e=this.core)||void 0===e||e.initialize(),null===(n=this.objectives)||void 0===n||n.initialize(),null===(r=this.student_data)||void 0===r||r.initialize(),null===(i=this.student_preference)||void 0===i||i.initialize(),null===(o=this.interactions)||void 0===o||o.initialize()}},{key:"toJSON",value:function(){this.jsonString=!0;var result={suspend_data:this.suspend_data,launch_data:this.launch_data,comments:this.comments,comments_from_lms:this.comments_from_lms,core:this.core,objectives:this.objectives,student_data:this.student_data,student_preference:this.student_preference,interactions:this.interactions};return this.jsonString=!1,result}},{key:"_version",get:function(){return this.__version},set:function(_version){throw new J(this._cmi_element+"._version",Q.INVALID_SET_VALUE)}},{key:"_children",get:function(){return this.__children},set:function(_children){throw new J(this._cmi_element+"._children",Q.INVALID_SET_VALUE)}},{key:"suspend_data",get:function(){var e;return null===(e=this.core)||void 0===e?void 0:e.suspend_data},set:function(suspend_data){this.core&&(this.core.suspend_data=suspend_data)}},{key:"launch_data",get:function(){return this._launch_data},set:function(launch_data){if(this.initialized)throw new J(this._cmi_element+".launch_data",Q.READ_ONLY_ELEMENT);this._launch_data=launch_data}},{key:"comments",get:function(){return this._comments},set:function(comments){Ut(this._cmi_element+".comments",comments,"^[\\s\\S]{0,4096}$",!0)&&(this._comments=comments)}},{key:"comments_from_lms",get:function(){return this._comments_from_lms},set:function(comments_from_lms){if(this.initialized)throw new J(this._cmi_element+".comments_from_lms",Q.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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,r),t;var n,r}(O);function fr(e){return fr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},fr(e)}function dr(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(dr=function(){return!!result})()}function hr(e,t){return hr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},hr(e,t)}function mr(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var vr=Object.defineProperty,yr=function(e){function t(){var e,n,r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,n){return t=fr(t),r=e,!(i=dr()?Reflect.construct(t,n||[],fr(e).constructor):t.apply(e,n))||"object"!==mr(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,["cmi.nav"]),r="",function(e,t,n){t in e?vr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==mr(n="_event")?n+"":n,r),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&&hr(e,t)}(t,e),n=t,(r=[{key:"reset",value:function(){this._event="",this._initialized=!1}},{key:"event",get:function(){return this._event},set:function(e){(""===e||Ut(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 n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,r),t;var n,r}(S);function pr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);t>n;n++)r[n]=e[n];return r}function _r(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function gr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function br(e){return br=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},br(e)}function Er(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Er=function(){return!!result})()}function Sr(e,t){return Sr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Sr(e,t)}function Or(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var wr=Object.defineProperty,Cr=function(e,t,n){return function(e,t,n){return t in e?wr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":Or(t))?t+"":t,n)},Rr=function(e){function t(e,n){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=e?function(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){gr(e,t,n[t])})}return e}({},e):void 0;return i&&void 0===i.mastery_override&&(i.mastery_override=!0),r=function(e,t,n){return t=br(t),r=e,!(i=Er()?Reflect.construct(t,n||[],br(e).constructor):t.apply(e,n))||"object"!==Or(i)&&"function"!=typeof i?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):i;var r,i}(this,t,[Q,i,n]),Cr(r,"statusSetByModule",!1),Cr(r,"cmi"),Cr(r,"nav"),Cr(r,"LMSInitialize"),Cr(r,"LMSFinish"),Cr(r,"LMSGetValue"),Cr(r,"LMSSetValue"),Cr(r,"LMSCommit"),Cr(r,"LMSGetLastError"),Cr(r,"LMSGetErrorString"),Cr(r,"LMSGetDiagnostic"),r.cmi=new ur,r.nav=new yr,r.settings.globalStudentPreferences&&t._globalLearnerPrefs&&(""!==t._globalLearnerPrefs.audio&&(r.cmi.student_preference.audio=t._globalLearnerPrefs.audio),""!==t._globalLearnerPrefs.language&&(r.cmi.student_preference.language=t._globalLearnerPrefs.language),""!==t._globalLearnerPrefs.speed&&(r.cmi.student_preference.speed=t._globalLearnerPrefs.speed),""!==t._globalLearnerPrefs.text&&(r.cmi.student_preference.text=t._globalLearnerPrefs.text)),r.LMSInitialize=r.lmsInitialize,r.LMSFinish=r.lmsFinish,r.LMSGetValue=r.lmsGetValue,r.LMSSetValue=r.lmsSetValue,r.LMSCommit=r.lmsCommit,r.LMSGetLastError=r.lmsGetLastError,r.LMSGetErrorString=r.lmsGetErrorString,r.LMSGetDiagnostic=r.lmsGetDiagnostic,r}var n,r,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&&Sr(e,t)}(t,e),n=t,r=[{key:"reset",value:function(e){var t,n;this.commonReset(e),null===(t=this.cmi)||void 0===t||t.reset(),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),B):(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),B;var result=this.terminate("LMSFinish",!0);return result===F&&(""!==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),B):this.settings.throttleCommits?(this.scheduleCommit(500,"LMSCommit"),F):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===F&&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,n){t._globalLearnerPrefs||(t._globalLearnerPrefs={audio:"",language:"",speed:"",text:""}),t._globalLearnerPrefs[e]=n}},{key:"getCMIValue",value:function(e){return this._commonGetCMIValue("getCMIValue",!1,e)}},{key:"getChildElement",value:function(e,t,n){return f(e,"cmi\\.objectives\\.\\d+")?new In:n&&f(e,"cmi\\.interactions\\.\\d+\\.correct_responses\\.\\d+")?new nr:n&&f(e,"cmi\\.interactions\\.\\d+\\.objectives\\.\\d+")?new tr:!n&&f(e,"cmi\\.interactions\\.\\d+")?new er:null}},{key:"validateCorrectResponse",value:function(e,t){}},{key:"getLmsErrorMessageDetails",value:function(e,t){var n,r,i="No Error",o="No Error";return U.error_descriptions[e+=""]&&(i=(null===(n=U.error_descriptions[e])||void 0===n?void 0:n.basicMessage)||i,o=(null===(r=U.error_descriptions[e])||void 0===r?void 0:r.detailMessage)||o),t?o:i}},{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],n=this.renderCMIToJSONObject();(e||t)&&(n.cmi.core.total_time=this.cmi.getCurrentTotalTime());var r=l(n);switch(this.settings.dataCommitFormat){case"flattened":return r;case"params":return Object.entries(r).map(function(e){var t,n,r=(n=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}}(t,n)||function(e,t){if(e){if("string"==typeof e)return pr(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pr(e,t):void 0}}(t,n)||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.")}()),i=r[1];return"".concat(r[0],"=").concat(i)});default:return n}}},{key:"renderCommitObject",value:function(e){var t,n,r,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=this.renderCommitCMI(e,i),s=e||i?this.cmi.getCurrentTotalTime():"",c=a(s,ve),l=this.cmi.core.lesson_status,u=le,f=ae;l&&(u="completed"===l||"passed"===l?ce:"incomplete","passed"===l?f=se:"failed"===l&&(f="failed"));var d=(null===(r=this.cmi)||void 0===r||null===(n=r.core)||void 0===n||null===(t=n.score)||void 0===t?void 0:t.getScoreObject())||{},h={successStatus:f,completionStatus:u,runtimeData:o,totalTimeSeconds:c};return d&&(h.score=d),this.settings.autoPopulateCommitMetadata&&(this.settings.courseId&&(h.courseId=this.settings.courseId),this.settings.scoId&&(h.scoId=this.settings.scoId),this.cmi.core.student_id&&(h.learnerId=this.cmi.core.student_id),this.cmi.core.student_name&&(h.learnerName=this.cmi.core.student_name)),h}},{key:"storeData",value:function(e,t){if(e){var n,r,i;if("browse"===this.cmi.core.lesson_mode&&""===((null===(i=this.startingData)||void 0===i||null===(r=i.cmi)||void 0===r||null===(n=r.core)||void 0===n?void 0:n.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),s=parseFloat(this.cmi.student_data.mastery_score);isNaN(o)||isNaN(s)||(this.cmi.core.lesson_status=s>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 a=parseFloat(this.cmi.core.score.raw),c=parseFloat(this.cmi.student_data.mastery_score);isNaN(a)||isNaN(c)||(this.cmi.core.lesson_status=c>a?"failed":"passed")}}return this.processCommitData(e,t)}},{key:"processCommitData",value:function(e,t){var n=this.getCommitObject(e);return"string"==typeof this.settings.lmsCommitUrl?this.processHttpRequest(this.settings.lmsCommitUrl,n,e,t):{result:F,errorCode:0}}}],i=[{key:"clearGlobalPreferences",value:function(){t._globalLearnerPrefs=null}}],r&&_r(n.prototype,r),i&&_r(n,i),t}(Xt);return Cr(Rr,"_globalLearnerPrefs",null),Rr}();
2
2
  //# sourceMappingURL=scorm12.min.js.map