scorm-again 3.1.2 → 3.1.3

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){var r=new Map;return function(){for(var i=arguments.length,o=Array(i),s=0;i>s;s++)o[s]=arguments[s];var result,a=n?n.apply(void 0,t(o)):JSON.stringify(o);return r.has(a)?r.get(a):(result=e.apply(void 0,t(o)),r.set(a,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 O(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t,n){return S=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},S.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 S(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 M=Object.defineProperty,k=function(e,t,n){return function(e,t,n){return t in e?M(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 O(this,t),r=E(this,t,["".concat(e," : ").concat(""+n)]),k(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 O(this,t),o=E(this,t,[e,n]),k(o,"_errorMessage"),k(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 Z(e){return Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Z(e)}function Q(e,t){return Q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Q(e,t)}function X(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function K(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(K=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":X(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=Z(t),r=e,!(i=K()?Reflect.construct(t,n||[],Z(e).constructor):t.apply(e,n))||"object"!==X(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&&Q(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="completed",oe="unknown",se={_:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5};function ae(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 ce={autocommit:!1,autocommitSeconds:10,throttleCommits:!1,useAsynchronousCommits:!1,sendFullCommit:!0,lmsCommitUrl:!1,dataCommitFormat:"json",commitRequestDataType:"application/json;charset=UTF-8",autoProgress:!1,logLevel:se.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){ae(o,r,i,s,a,"next",e)}function a(e){ae(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:le,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 le(e,t){switch(e){case"4":case 4:case"ERROR":case se.ERROR:console.error(t);break;case"3":case 3:case"WARN":case se.WARN:console.warn(t);break;case"2":case 2:case"INFO":case se.INFO:console.info(t);break;case"1":case 1:case"DEBUG":case se.DEBUG:console.debug?console.debug(t):console.log(t)}}var ue="^[\\s\\S]{0,255}$",fe="^([0-9]+):([0-9]{2}):([0-9]{2})(\\.\\d{1,2})?$",de="^-?([0-9]+)$",he="^-?([0-9]{0,10})(\\.[0-9]*)?$",me="^[\\u0021-\\u007E\\s]{0,255}$",ve="^.*$",ye="^(passed|completed|failed|incomplete|browsed|not attempted)$",_e="0#100",pe="^P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?(?:T?(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:(\\d+(?:\\.\\d{1,2})?)S)?)?$";function ge(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function be(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){ge(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 Ee=Object.defineProperty,Oe=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":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},Se=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){be(o,r,i,s,a,"next",e)}function a(e){be(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 we(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 Ce(e){return Ce=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ce(e)}function Re(e,t){return Re=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Re(e,t)}function Ie(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Ne(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ne=function(){return!!result})()}var Te=Object.defineProperty,Le=function(e,t,n){return function(e,t,n){return t in e?Te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":Ie(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=Ce(t),r=e,!(i=Ne()?Reflect.construct(t,n||[],Ce(e).constructor):t.apply(e,n))||"object"!==Ie(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"]),Le(e,"_condition","always"),Le(e,"_operator",null),Le(e,"_parameters",new Map),Le(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&&Re(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=this.resolveReferencedObjective(e);switch(this._condition){case"satisfied":case"objectiveSatisfied":result=t?!0===t.satisfiedStatus:e.successStatus===re||!0===e.objectiveSatisfiedStatus;break;case"objectiveStatusKnown":case"objectiveMeasureKnown":result=t?!!t.measureStatus:!!e.objectiveMeasureStatus;break;case"objectiveMeasureGreaterThan":var n=this._parameters.get("threshold")||0;result=!!(t?t.measureStatus:e.objectiveMeasureStatus)&&(t?t.normalizedMeasure:e.objectiveNormalizedMeasure)>n;break;case"objectiveMeasureLessThan":var r=this._parameters.get("threshold")||0;result=!!(t?t.measureStatus:e.objectiveMeasureStatus)&&r>(t?t.normalizedMeasure:e.objectiveNormalizedMeasure);break;case"completed":case"activityCompleted":result=t?t.completionStatus===ie:e.isCompleted;break;case"progressKnown":case"activityProgressKnown":result=t?t.completionStatus!==oe:"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=!result),result}},{key:"evaluateTimeLimitExceeded",value:function(e){var n=e.timeLimitDuration;if(!n&&e.attemptAbsoluteDurationLimit&&(n=e.attemptAbsoluteDurationLimit),!n)return!1;var r=o(n,pe);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,pe);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,pe)}},{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}}])&&we(n.prototype,r),i&&we(n,i),t}(g);Le(Me,"_now",function(){return new Date}),Le(Me,"_getElapsedSecondsHook");var ke=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(ke||{}),Ae=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(Ae||{});function je(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 Pe(e){return function(e){if(Array.isArray(e))return je(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 je(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)?je(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 xe=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=Pe(e.children);if(t.selectionTiming===ke.NEVER)return n;if(t.selectionTiming===ke.ONCE&&t.selectionCountStatus)return n;if(t.selectionTiming!==ke.ONCE&&!t.selectionCountStatus)return n;var r=t.selectCount;if(null===r||r>=n.length)return t.selectionTiming===ke.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===ke.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=Pe(e.children);if(n.randomizationTiming===Ae.NEVER)return r;if(n.randomizationTiming===Ae.ONCE&&n.reorderChildren)return r;if(!n.randomizeChildren)return r;for(var i=Pe(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===Ae.ONCE&&(n.reorderChildren=!0),e.children.length=0,(t=e.children).push.apply(t,Pe(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===ke.ON_EACH_NEW_ATTEMPT?(r=t,t&&(n.selectionCountStatus=!0)):n.selectionTiming===ke.ONCE&&(r=!n.selectionCountStatus),n.randomizationTiming===Ae.ON_EACH_NEW_ATTEMPT?(i=t,t&&(n.reorderChildren=!1)):n.randomizationTiming===Ae.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!==ke.NEVER&&(t.selectionTiming!==ke.ONCE||!t.selectionCountStatus)&&null!==t.selectCount&&e.children.length>t.selectCount}},{key:"isRandomizationNeeded",value:function(e){var t=e.sequencingControls;return t.randomizationTiming!==Ae.NEVER&&(t.randomizationTiming!==Ae.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 De(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 Fe(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){De(o,r,i,s,a,"next",e)}function a(e){De(o,r,i,s,a,"throw",e)}s(void 0)})}}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 Ue(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Ve(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])})}return e}function Ge(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 ze=Object.defineProperty,He=function(e,t,n){return function(e,t,n){return t in e?ze(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)},qe=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),He(this,"reportsRequestCompletion",!0),He(this,"settings"),He(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 Fe(function(){var a,c,l,result,u,f;return Ge(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=Ue(u,Error)?u.message:u+"",r("processHttpRequest","Async request failed: ".concat(f),se.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:Ue(e,Array)?e.join("&"):JSON.stringify(e),contentType:Ue(e,Array)?"application/x-www-form-urlencoded":this.settings.commitRequestDataType}}},{key:"performFetch",value:function(e,t){return Fe(function(){var n,r,i;return Ge(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=Ve({},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 Fe(function(){var n,r,i;return Ge(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 Fe(function(){return Ge(this,function(e){return[2,{result:i?"true":"false",errorCode:i?0:this.error_codes.GENERAL_COMMIT_FAILURE||391}]})}).call(n)},text:function(){return Fe(function(){return Ge(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 Fe(function(){var result,t,n,r;return Ge(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(Ue(n,Error)?n.message:n+""),errorDetails:JSON.stringify({status:e.status,statusText:e.statusText,url:e.url,responseText:r.substring(0,500),parseError:Ue(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=Ve({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 We(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var Je=Object.defineProperty,Ye="{target=";function $e(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?Je(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 $e(this.context.errorCodes,"UNDEFINED_DATA_MODEL")}},{key:"setCMIValue",value:function(e,t,n,r){if(!n||""===n)return t&&this.context.throwSCORMError(n,$e(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),se.WARN),s}},{key:"getCMIValue",value:function(e,t,n){if(!n||""===n)return t&&this.context.throwSCORMError(n,$e(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,$e(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(We(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,$e(this.context.errorCodes,"CHILDREN_ERROR"),void 0):"_count"===o&&this.context.throwSCORMError(n,$e(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(Ye))?this.context.isInitialized()?(this.context.throwSCORMError(r,$e(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,$e(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,$e(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(We(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?$e(this.context.errorCodes,"GENERAL_SET_FAILURE"):$e(this.context.errorCodes,"INVALID_SET_VALUE")||$e(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(Ye)&&"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,$e(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element does not have children"),{error:!0}):"_count"===t?(this.context.throwSCORMError(n,$e(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,$e(this.context.errorCodes,"CHILDREN_ERROR")):"_count"===t?this.context.throwSCORMError(n,$e(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,$e(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,Ke=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)},et=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ke(this,"_logLevel",se.ERROR),Ke(this,"_logHandler"),this._logHandler=le}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(se.ERROR,e)}},{key:"warn",value:function(e){this.log(se.WARN,e)}},{key:"info",value:function(e){this.log(se.INFO,e)}},{key:"debug",value:function(e){this.log(se.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 se.NONE;if("number"==typeof e)return e;switch("string"==typeof e?e.toUpperCase():e){case"1":case"DEBUG":return se.DEBUG;case"2":case"INFO":return se.INFO;case"3":case"WARN":return se.WARN;case"4":case"ERROR":default:return se.ERROR;case"5":case"NONE":return se.NONE}}}])&&Qe(t.prototype,n),r&&Qe(t,r),e}();Ke(et,"_instance");var tt=et;function nt(){return tt.getInstance()}function rt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var it=Object.defineProperty,ot=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)},st=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),ot(this,"_lastErrorCode","0"),ot(this,"_lastDiagnostic",""),ot(this,"_errorCodes"),ot(this,"_apiLog"),ot(this,"_getLmsErrorMessageDetails"),ot(this,"_loggingService"),this._errorCodes=t,this._apiLog=n,this._getLmsErrorMessageDetails=r,this._loggingService=i||nt()}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,se.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(rt(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(rt(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 at=Object.defineProperty,ct=function(e,t,n){return function(e,t,n){return t in e?at(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)},lt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ct(this,"listenerMap",new Map),ct(this,"listenerCount",0),ct(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),se.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),se.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,se.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),se.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 ut(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 ft(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){ut(o,r,i,s,a,"next",e)}function a(e){ut(o,r,i,s,a,"throw",e)}s(void 0)})}}function dt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ht(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function mt(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){dt(e,t,n[t])})}return e}function vt(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 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":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},pt=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),_t(this,"apiLog",r),_t(this,"settings"),_t(this,"error_codes"),_t(this,"storeName","scorm_again_offline_data"),_t(this,"syncQueue","scorm_again_sync_queue"),_t(this,"isOnline",navigator.onLine),_t(this,"syncInProgress",!1),_t(this,"boundOnlineStatusChangeHandler"),_t(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...",se.INFO),this.syncOfflineData().then(function(t){t?e.apiLog("OfflineStorageService","Sync completed successfully",se.INFO):e.apiLog("OfflineStorageService","Sync failed",se.ERROR)},function(t){e.apiLog("OfflineStorageService","Error during sync: ".concat(t),se.ERROR)})):t&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",se.INFO)}},{key:"handleCustomNetworkStatus",value:function(e){var t=this;if(ht(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"),se.INFO),!r&&this.isOnline?(this.apiLog("OfflineStorageService","Device is back online, attempting to sync...",se.INFO),this.syncOfflineData().then(function(e){e?t.apiLog("OfflineStorageService","Sync completed successfully",se.INFO):t.apiLog("OfflineStorageService","Sync failed",se.ERROR)},function(e){t.apiLog("OfflineStorageService","Error during sync: ".concat(e),se.ERROR)})):r&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",se.INFO)}else this.apiLog("OfflineStorageService","Invalid online status value in custom event",se.WARN)}else this.apiLog("OfflineStorageService","Invalid network status event received",se.WARN)}},{key:"storeOffline",value:function(e,t,n){try{var r=mt({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),se.INFO),{result:P,errorCode:0}}catch(t){var o,s=(ht(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),se.ERROR),{result:x,errorCode:null!==(o=this.error_codes.GENERAL)&&void 0!==o?o:0}}}},{key:"getOfflineData",value:function(e){return ft(function(){return vt(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),se.ERROR),[2,null]}return[2]})}).call(this)}},{key:"syncOfflineData",value:function(){return ft(function(){var e,t,n,r,i,o,s,a,c,l,u,f,d,h;return vt(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"),se.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"),se.WARN),[3,7];m.label=4;case 4:return m.trys.push([4,6,,7]),[4,this.sendDataToLMS(a.data,mt({},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),se.INFO):(a.syncAttempts++,t.push(a),this.apiLog("OfflineStorageService","Failed to sync item ".concat(a.id,", attempt #").concat(a.syncAttempts),se.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),se.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"),se.INFO),this.syncInProgress=!1,[2,!0];case 12:return h=m.sent(),this.apiLog("OfflineStorageService","Error during sync process: ".concat(h),se.ERROR),this.syncInProgress=!1,[2,!1];case 13:return[2]}})}).call(this)}},{key:"sendDataToLMS",value:function(e,t){return ft(function(){var n,r,i,o,s,a,c,result,l,f;return vt(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,mt({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=mt({},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),se.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(ht(e,DOMException)&&"QuotaExceededError"===e.name)throw Error("storage quota exceeded - localStorage is full",{cause:e});throw e}}},{key:"hasPendingOfflineData",value:function(e){return ft(function(){return vt(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}(),gt=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)}),bt=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)});function Et(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 St(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){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){St(e,t,n[t])})}return e}function Ct(e){return function(e){if(Array.isArray(e))return Et(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 Et(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)?Et(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 Rt=Object.defineProperty,It=function(e,t,n){return function(e,t,n){return t in e?Rt(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)},Nt=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),It(this,"valid"),It(this,"targetActivity"),It(this,"exception"),this.valid=t,this.targetActivity=n,this.exception=r},Tt=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),It(this,"activityTree"),It(this,"rollupProcess"),It(this,"globalObjectiveMap"),It(this,"adlNav"),It(this,"eventCallback"),It(this,"now"),It(this,"defaultHideLmsUi"),It(this,"defaultAuxiliaryResources"),It(this,"_deliveryInProgress",!1),It(this,"contentDelivered",!1),It(this,"checkActivityCallback",null),It(this,"invalidateCacheCallback",null),It(this,"updateNavigationValidityCallback",null),It(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)?Ct(s.defaultHideLmsUi):[],this.defaultAuxiliaryResources=(null==s?void 0:s.defaultAuxiliaryResources)?s.defaultAuxiliaryResources.map(function(e){return wt({},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 Nt(!1,null,"DB.1.1-1");var t=this.getActivityPath(e,!0);if(0===t.length)return new Nt(!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 Nt(!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 Nt(!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,xe.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,wt({},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,wt({},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}();It(Tt,"HIDE_LMS_UI_ORDER",Ct(["continue","previous","exit","exitAll","abandon","abandonAll","suspendAll"]));var Lt=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[se.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 kt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var At=Object.defineProperty,jt=function(e,t,n){return function(e,t,n){return t in e?At(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)},Pt=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),jt(this,"settings"),jt(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=kt(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:kt(e,Array)?e.join("&"):JSON.stringify(e),contentType:kt(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 xt(e,t,n,r){return gt(e,t,n,$.TYPE_MISMATCH,H,r)}function Dt(e,t,n,r){if(""===t)throw new H(e,$.VALUE_OUT_OF_RANGE);return bt(e,t,n,$.VALUE_OUT_OF_RANGE,H)}var Ft=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)||gt(e,t,n,i,s)&&(!r||bt(e,t,r,o,s))}},{key:"validateScorm12Audio",value:function(e,t){return xt(e,t,de)&&Dt(e,t,"-1#100")}},{key:"validateScorm12Language",value:function(e,t){return xt(e,t,ue)}},{key:"validateScorm12Speed",value:function(e,t){return xt(e,t,de)&&Dt(e,t,"-100#100")}},{key:"validateScorm12Text",value:function(e,t){return xt(e,t,de)&&Dt(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}(),Bt=new Ft;function Ut(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 Vt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function zt(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){Vt(e,t,n[t])})}return e}function Ht(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 qt(e){return function(e){if(Array.isArray(e))return Ut(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 Ut(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)?Ut(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 Wt(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Jt=Object.defineProperty,Yt=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":Wt(t))?t+"":t,n)},$t=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),Yt(this,"_timeout"),Yt(this,"_error_codes"),Yt(this,"_settings",ce),Yt(this,"_httpService"),Yt(this,"_eventService"),Yt(this,"_serializationService"),Yt(this,"_errorHandlingService"),Yt(this,"_loggingService"),Yt(this,"_offlineStorageService"),Yt(this,"_cmiValueAccessService"),Yt(this,"_courseId",""),Yt(this,"_pendingCommitCount",0),Yt(this,"_commitSequence",0),Yt(this,"_commitSettleWaiters",[]),Yt(this,"_setCMIElements",new Set),Yt(this,"startingData"),Yt(this,"currentState"),(Gt(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=zt({},ce,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||nt(),this._loggingService.setLogLevel(this.settings.logLevel),this._loggingService.setLogHandler(this.settings.onLogMessage?this.settings.onLogMessage:le),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 qe(this.settings,this._error_codes)):this._httpService=new Pt(this.settings,this._error_codes),this._eventService=i||new lt(function(e,t,n,r){return u.apiLog(e,t,n,r)}),this._serializationService=o||new Lt,this._errorHandlingService=a||new st(this._error_codes,function(e,t,n,r){return u.apiLog(e,t,n||se.ERROR,r)},function(e,t){return u.getLmsErrorMessageDetails(e,t)},void 0),this.settings.enableOfflineSupport&&(this._offlineStorageService=l||new pt(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",se.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),se.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",se.INFO),u.loadFromJSON(e.runtimeData))}).catch(function(e){u.apiLog("constructor","Error retrieving offline data: ".concat(e),se.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",se.INFO),this.settings=zt({},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",se.INFO),null===(n=r._offlineStorageService)||void 0===n||n.syncOfflineData().then(function(t){t&&(r.apiLog(e,"Successfully synced offline data",se.INFO),r.processListeners("OfflineDataSynced"))}))})),this.apiLog(e,"returned: "+i,se.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=zt({},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),se.ERROR),result.errorDetails&&this.apiLog("terminate","Error details: ".concat(JSON.stringify(result.errorDetails)),se.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,se.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,se.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,se.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),se.ERROR),result.errorDetails&&this.apiLog("commit","Error details: ".concat(JSON.stringify(result.errorDetails)),se.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),se.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",se.INFO),null===(r=t._offlineStorageService)||void 0===r||r.syncOfflineData().then(function(n){n?(t.apiLog(e,"Successfully synced offline data",se.INFO),t.processListeners("OfflineDataSynced")):t.apiLog(e,"Failed to sync some offline data",se.WARN)}))})}return this.apiLog(e,"returned: "+i,se.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,se.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,se.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,se.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":Wt(e))&&t in e){var n=e[t];return Gt(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":Wt(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=qt(f).concat(["".concat(encodeURIComponent(d),"=true")]):f&&"object"===(void 0===f?"undefined":Wt(f))&&(f=Ht(zt({},f),Vt({},d,!0)))}!0===this.settings.includeCommitSequence&&(Array.isArray(f)?f=qt(f).concat(["commitSequence=".concat(o)]):f&&"object"===(void 0===f?"undefined":Wt(f))&&(f=Ht(zt({},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",se.INFO),f&&"object"===(void 0===f?"undefined":Wt(f))&&"cmi"in f?this._offlineStorageService.storeOffline(this._courseId,f,{isTerminateCommit:r,sequence:o}):(this.apiLog("processHttpRequest","Invalid commit data format for offline storage",se.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 Se(this,e,t),this.apiLog("scheduleCommit","scheduled",se.DEBUG,""))}},{key:"clearScheduledCommit",value:function(){this._timeout&&(this._timeout.cancel(),this._timeout=void 0,this.apiLog("clearScheduledCommit","cleared",se.DEBUG,""))}},{key:"_checkObjectHasProperty",value:function(e,t){return null!=e&&"object"===(void 0===e?"undefined":Wt(e))&&(Object.hasOwnProperty.call(e,t)||null!=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),t)||t in e)}},{key:"handleValueAccessException",value:function(e,t,n){return Gt(t,j)?(this.lastErrorCode=t.errorCode+"",""!==n&&(n=x),this.throwSCORMError(e,t.errorCode,t.errorMessage)):Gt(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 Kt(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Kt=function(){return!!result})()}var en=Object.defineProperty,tn=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":Xt(t))?t+"":t,n)},nn=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=Kt()?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]),tn(n,"__children"),tn(n,"__score_range"),tn(n,"__invalid_error_code"),tn(n,"__invalid_type_code"),tn(n,"__invalid_range_code"),tn(n,"__decimal_regex"),tn(n,"__error_class"),tn(n,"__allow_empty_string"),tn(n,"_raw",""),tn(n,"_min",""),tn(n,"_max"),n.__children=e.score_children||D.score_children,n.__score_range=!!e.score_range&&_e,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||he,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){Bt.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){Bt.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){Bt.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 rn(e,t,n){return rn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=sn(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n||e):i.value}},rn(e,t,n||e)}function sn(e){return sn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},sn(e)}function an(e,t){return an=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},an(e,t)}function cn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function ln(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ln=function(){return!!result})()}var un=Object.defineProperty,fn=function(e,t,n){return function(e,t,n){return t in e?un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":cn(t))?t+"":t,n)},dn=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=sn(t),r=e,!(i=ln()?Reflect.construct(t,n||[],sn(e).constructor):t.apply(e,n))||"object"!==cn(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"]),fn(e,"score"),fn(e,"__children",D.core_children),fn(e,"_student_id",""),fn(e,"_student_name",""),fn(e,"_lesson_location",""),fn(e,"_credit",""),fn(e,"_lesson_status","not attempted"),fn(e,"_entry",""),fn(e,"_total_time",""),fn(e,"_lesson_mode","normal"),fn(e,"_exit",""),fn(e,"_session_time","00:00:00"),fn(e,"_suspend_data",""),e.score=new nn({CMIElement:"cmi.core.score",score_children:D.score_children,score_range:_e,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&&an(e,t)}(t,e),n=t,(o=[{key:"initialize",value:function(){var e;rn(sn(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){xt(this._cmi_element+".lesson_location",lesson_location,ue,!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);xt(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?xt(this._cmi_element+".lesson_status",lesson_status,"^(passed|completed|failed|incomplete|browsed)$")&&(this._lesson_status=lesson_status):xt(this._cmi_element+".lesson_status",lesson_status,ye)&&(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);xt(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(xt(this._cmi_element+".total_time",total_time,fe,!0))if(total_time){var e=i(total_time,fe);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);xt(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=""),xt(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(xt(this._cmi_element+".session_time",session_time,fe)){var e=i(session_time,fe);this._session_time=r(e)}}},{key:"suspend_data",get:function(){return this._suspend_data},set:function(suspend_data){xt(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(fe))&&(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 hn(e,t,n){return t=vn(t),r=e,!(i=gn()?Reflect.construct(t,n||[],vn(e).constructor):t.apply(e,n))||"object"!==pn(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 mn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vn(e){return vn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},vn(e)}function yn(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 _n(e,t){return _n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_n(e,t)}function pn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function gn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(gn=function(){return!!result})()}var bn=Object.defineProperty,En=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":pn(t))?t+"":t,n)},On=function(e){function t(){return mn(this,t),hn(this,t,[{CMIElement:"cmi.objectives",children:D.objectives_children,errorCode:$.INVALID_SET_VALUE,errorClass:H}])}return yn(t,e),t}(ne),Sn=function(e){function t(){var e;return mn(this,t),e=hn(this,t,["cmi.objectives.n"]),En(e,"score"),En(e,"_id",""),En(e,"_status",""),e.score=new nn({CMIElement:"cmi.objectives.n.score",score_children:D.score_children,score_range:_e,invalidErrorCode:$.INVALID_SET_VALUE,invalidTypeCode:$.TYPE_MISMATCH,invalidRangeCode:$.VALUE_OUT_OF_RANGE,errorClass:H,allowEmptyString:!0}),e}return yn(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){xt(this._cmi_element+".id",id,me)&&(this._id=id)}},{key:"status",get:function(){return this._status},set:function(status){xt(this._cmi_element+".status",status,ye)&&(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 wn(e){return wn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},wn(e)}function Cn(e,t){return Cn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Cn(e,t)}function Rn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function In(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(In=function(){return!!result})()}var Nn=Object.defineProperty,Tn=function(e,t,n){return function(e,t,n){return t in e?Nn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":Rn(t))?t+"":t,n)},Ln=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=wn(t),r=e,!(i=In()?Reflect.construct(t,n||[],wn(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,["cmi.student_data"]),Tn(n,"__children"),Tn(n,"_mastery_score",""),Tn(n,"_max_time_allowed",""),Tn(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&&Cn(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(Bt.validateReadOnly(this._cmi_element+".mastery_score",this.initialized),null!=mastery_score){var e=mastery_score;"string"!=typeof e&&(e+=""),""!==e?xt(this._cmi_element+".mastery_score",e,he)&&Dt(this._cmi_element+".mastery_score",e,_e)&&(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(Bt.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{xt(t,e,fe,!0);var n=i(e,fe);return r(n)}catch(e){}try{xt(t,e,pe,!0);var s=o(e,pe);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(Bt.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+"";xt(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 kn(e,t){return kn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},kn(e,t)}function An(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 Pn=Object.defineProperty,xn=function(e,t,n){return function(e,t,n){return t in e?Pn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":An(t))?t+"":t,n)},Dn=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=jn()?Reflect.construct(t,n||[],Mn(e).constructor):t.apply(e,n))||"object"!==An(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"]),xn(n,"__children"),xn(n,"_audio",""),xn(n,"_language",""),xn(n,"_speed",""),xn(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&&kn(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){Bt.validateScorm12Audio(this._cmi_element+".audio",audio)&&(this._audio=audio)}},{key:"language",get:function(){return this._language},set:function(language){Bt.validateScorm12Language(this._cmi_element+".language",language)&&(this._language=language)}},{key:"speed",get:function(){return this._speed},set:function(speed){Bt.validateScorm12Speed(this._cmi_element+".speed",speed)&&(this._speed=speed)}},{key:"text",get:function(){return this._text},set:function(text){Bt.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 Fn(e,t,n){return t=Gn(t),r=e,!(i=Wn()?Reflect.construct(t,n||[],Gn(e).constructor):t.apply(e,n))||"object"!==qn(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 Bn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Un(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 Vn(e,t,n){return Vn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Gn(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n||e):i.value}},Vn(e,t,n||e)}function Gn(e){return Gn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Gn(e)}function zn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Hn(e,t)}function Hn(e,t){return Hn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Hn(e,t)}function qn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Wn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Wn=function(){return!!result})()}var Jn=Object.defineProperty,Yn=function(e,t,n){return function(e,t,n){return t in e?Jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":qn(t))?t+"":t,n)},$n=function(e){function t(){return Bn(this,t),Fn(this,t,[{CMIElement:"cmi.interactions",children:D.interactions_children,errorCode:$.INVALID_SET_VALUE,errorClass:H}])}return zn(t,e),t}(ne),Zn=function(e){function t(){var e;return Bn(this,t),e=Fn(this,t,["cmi.interactions.n"]),Yn(e,"objectives"),Yn(e,"correct_responses"),Yn(e,"_id",""),Yn(e,"_time",""),Yn(e,"_type",""),Yn(e,"_weighting",""),Yn(e,"_student_response",""),Yn(e,"_result",""),Yn(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 zn(t,e),Un(t,[{key:"initialize",value:function(){var e,n;Vn(Gn(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){xt(this._cmi_element+".id",id,me)&&(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){xt(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){xt(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){xt(this._cmi_element+".weighting",weighting,he)&&Dt(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){xt(this._cmi_element+".student_response",student_response,ve,!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'.")),xt(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(xt(this._cmi_element+".latency",latency,fe)){var e=i(latency,fe);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 Bn(this,t),e=Fn(this,t,["cmi.interactions.n.objectives.n"]),Yn(e,"_id",""),e}return zn(t,e),Un(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){xt(this._cmi_element+".id",id,me)&&(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 Bn(this,t),e=Fn(this,t,["cmi.interactions.correct_responses.n"]),Yn(e,"_pattern",""),e}return zn(t,e),Un(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){xt(this._cmi_element+".pattern",pattern,ve,!0)&&(this._pattern=pattern)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={pattern:this._pattern};return this.jsonString=!1,result}}]),t}(g);function Kn(e,t,n){return Kn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=er(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n||e):i.value}},Kn(e,t,n||e)}function er(e){return er=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},er(e)}function tr(e,t){return tr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},tr(e,t)}function nr(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function rr(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(rr=function(){return!!result})()}var ir=Object.defineProperty,or=function(e,t,n){return function(e,t,n){return t in e?ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":nr(t))?t+"":t,n)},sr=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=er(t),r=e,!(i=rr()?Reflect.construct(t,n||[],er(e).constructor):t.apply(e,n))||"object"!==nr(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"]),or(r,"__children",""),or(r,"__version","3.4"),or(r,"_launch_data",""),or(r,"_comments",""),or(r,"_comments_from_lms",""),or(r,"core"),or(r,"objectives"),or(r,"student_data"),or(r,"student_preference"),or(r,"interactions"),n&&r.initialize(),r.__children=e||D.cmi_children,r.core=new dn,r.objectives=new On,r.student_data=student_data||new Ln,r.student_preference=new Dn,r.interactions=new $n,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&tr(e,t)}(t,e),n=t,(r=[{key:"reset",value:function(){var e,t,n,r,i;this._initialized=!1,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;Kn(er(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){xt(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 ar(e){return ar=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ar(e)}function cr(e,t){return cr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},cr(e,t)}function lr(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function ur(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ur=function(){return!!result})()}var fr=Object.defineProperty,dr=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=ar(t),r=e,!(i=ur()?Reflect.construct(t,n||[],ar(e).constructor):t.apply(e,n))||"object"!==lr(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?fr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==lr(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&&cr(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||xt(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 hr(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 mr(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 vr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yr(e){return yr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},yr(e)}function _r(e,t){return _r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_r(e,t)}function pr(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function gr(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(gr=function(){return!!result})()}var br=Object.defineProperty,Er=function(e,t,n){return function(e,t,n){return t in e?br(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":pr(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){vr(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=yr(t),r=e,!(i=gr()?Reflect.construct(t,n||[],yr(e).constructor):t.apply(e,n))||"object"!==pr(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]),Er(r,"statusSetByModule",!1),Er(r,"cmi"),Er(r,"nav"),Er(r,"LMSInitialize"),Er(r,"LMSFinish"),Er(r,"LMSGetValue"),Er(r,"LMSSetValue"),Er(r,"LMSCommit"),Er(r,"LMSGetLastError"),Er(r,"LMSGetErrorString"),Er(r,"LMSGetDiagnostic"),r.cmi=new sr,r.nav=new dr,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&&_r(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 Sn: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 hr(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)?hr(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,fe),l=this.cmi.core.lesson_status,u=oe,f="unknown";l&&(u="completed"===l||"passed"===l?ie:"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&&mr(n.prototype,r),o&&mr(n,o),t}($t);return Er(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=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){var r=new Map;return function(){for(var i=arguments.length,o=Array(i),s=0;i>s;s++)o[s]=arguments[s];var result,a=n?n.apply(void 0,t(o)):JSON.stringify(o);return r.has(a)?r.get(a):(result=e.apply(void 0,t(o)),r.set(a,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 O(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t,n){return S=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},S.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 S(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 M=Object.defineProperty,k=function(e,t,n){return function(e,t,n){return t in e?M(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 O(this,t),r=E(this,t,["".concat(e," : ").concat(""+n)]),k(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 O(this,t),o=E(this,t,[e,n]),k(o,"_errorMessage"),k(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 Z(e){return Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Z(e)}function Q(e,t){return Q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Q(e,t)}function X(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function K(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(K=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":X(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=Z(t),r=e,!(i=K()?Reflect.construct(t,n||[],Z(e).constructor):t.apply(e,n))||"object"!==X(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&&Q(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="completed",oe="unknown",se={_:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5};function ae(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 ce={autocommit:!1,autocommitSeconds:10,throttleCommits:!1,useAsynchronousCommits:!1,sendFullCommit:!0,lmsCommitUrl:!1,dataCommitFormat:"json",commitRequestDataType:"application/json;charset=UTF-8",autoProgress:!1,logLevel:se.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){ae(o,r,i,s,a,"next",e)}function a(e){ae(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:le,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 le(e,t){switch(e){case"4":case 4:case"ERROR":case se.ERROR:console.error(t);break;case"3":case 3:case"WARN":case se.WARN:console.warn(t);break;case"2":case 2:case"INFO":case se.INFO:console.info(t);break;case"1":case 1:case"DEBUG":case se.DEBUG:console.debug?console.debug(t):console.log(t)}}var ue="^[\\s\\S]{0,255}$",fe="^([0-9]+):([0-9]{2}):([0-9]{2})(\\.\\d{1,2})?$",de="^-?([0-9]+)$",he="^-?([0-9]{0,10})(\\.[0-9]*)?$",me="^[\\u0021-\\u007E\\s]{0,255}$",ve="^.*$",ye="^(passed|completed|failed|incomplete|browsed|not attempted)$",_e="0#100",pe="^P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?(?:T?(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:(\\d+(?:\\.\\d{1,2})?)S)?)?$";function ge(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function be(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){ge(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 Ee=Object.defineProperty,Oe=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":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},Se=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){be(o,r,i,s,a,"next",e)}function a(e){be(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 we(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 Ce(e){return Ce=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ce(e)}function Re(e,t){return Re=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Re(e,t)}function Ie(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Ne(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ne=function(){return!!result})()}var Te=Object.defineProperty,Le=function(e,t,n){return function(e,t,n){return t in e?Te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":Ie(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=Ce(t),r=e,!(i=Ne()?Reflect.construct(t,n||[],Ce(e).constructor):t.apply(e,n))||"object"!==Ie(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"]),Le(e,"_condition","always"),Le(e,"_operator",null),Le(e,"_parameters",new Map),Le(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&&Re(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=this.resolveReferencedObjective(e);switch(this._condition){case"satisfied":case"objectiveSatisfied":result=t?!0===t.satisfiedStatus:e.successStatus===re||!0===e.objectiveSatisfiedStatus;break;case"objectiveStatusKnown":case"objectiveMeasureKnown":result=t?!!t.measureStatus:!!e.objectiveMeasureStatus;break;case"objectiveMeasureGreaterThan":var n=this._parameters.get("threshold")||0;result=!!(t?t.measureStatus:e.objectiveMeasureStatus)&&(t?t.normalizedMeasure:e.objectiveNormalizedMeasure)>n;break;case"objectiveMeasureLessThan":var r=this._parameters.get("threshold")||0;result=!!(t?t.measureStatus:e.objectiveMeasureStatus)&&r>(t?t.normalizedMeasure:e.objectiveNormalizedMeasure);break;case"completed":case"activityCompleted":result=t?t.completionStatus===ie:e.isCompleted;break;case"progressKnown":case"activityProgressKnown":result=t?t.completionStatus!==oe:"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=!result),result}},{key:"evaluateTimeLimitExceeded",value:function(e){var n=e.timeLimitDuration;if(!n&&e.attemptAbsoluteDurationLimit&&(n=e.attemptAbsoluteDurationLimit),!n)return!1;var r=o(n,pe);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,pe);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,pe)}},{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}}])&&we(n.prototype,r),i&&we(n,i),t}(g);Le(Me,"_now",function(){return new Date}),Le(Me,"_getElapsedSecondsHook");var ke=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(ke||{}),Ae=function(e){return e.NEVER="never",e.ONCE="once",e.ON_EACH_NEW_ATTEMPT="onEachNewAttempt",e}(Ae||{});function je(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 Pe(e){return function(e){if(Array.isArray(e))return je(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 je(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)?je(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 xe=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=Pe(e.children);if(t.selectionTiming===ke.NEVER)return n;if(t.selectionTiming===ke.ONCE&&t.selectionCountStatus)return n;if(t.selectionTiming!==ke.ONCE&&!t.selectionCountStatus)return n;var r=t.selectCount;if(null===r||r>=n.length)return t.selectionTiming===ke.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===ke.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=Pe(e.children);if(n.randomizationTiming===Ae.NEVER)return r;if(n.randomizationTiming===Ae.ONCE&&n.reorderChildren)return r;if(!n.randomizeChildren)return r;for(var i=Pe(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===Ae.ONCE&&(n.reorderChildren=!0),e.children.length=0,(t=e.children).push.apply(t,Pe(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===ke.ON_EACH_NEW_ATTEMPT?(r=t,t&&(n.selectionCountStatus=!0)):n.selectionTiming===ke.ONCE&&(r=!n.selectionCountStatus),n.randomizationTiming===Ae.ON_EACH_NEW_ATTEMPT?(i=t,t&&(n.reorderChildren=!1)):n.randomizationTiming===Ae.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!==ke.NEVER&&(t.selectionTiming!==ke.ONCE||!t.selectionCountStatus)&&null!==t.selectCount&&e.children.length>t.selectCount}},{key:"isRandomizationNeeded",value:function(e){var t=e.sequencingControls;return t.randomizationTiming!==Ae.NEVER&&(t.randomizationTiming!==Ae.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 De(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 Fe(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){De(o,r,i,s,a,"next",e)}function a(e){De(o,r,i,s,a,"throw",e)}s(void 0)})}}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 Ue(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Ve(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])})}return e}function Ge(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 ze=Object.defineProperty,He=function(e,t,n){return function(e,t,n){return t in e?ze(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)},qe=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),He(this,"reportsRequestCompletion",!0),He(this,"settings"),He(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 Fe(function(){var a,c,l,result,u,f;return Ge(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=Ue(u,Error)?u.message:u+"",r("processHttpRequest","Async request failed: ".concat(f),se.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:Ue(e,Array)?e.join("&"):JSON.stringify(e),contentType:Ue(e,Array)?"application/x-www-form-urlencoded":this.settings.commitRequestDataType}}},{key:"performFetch",value:function(e,t){return Fe(function(){var n,r,i;return Ge(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=Ve({},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 Fe(function(){var n,r,i;return Ge(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 Fe(function(){return Ge(this,function(e){return[2,{result:i?"true":"false",errorCode:i?0:this.error_codes.GENERAL_COMMIT_FAILURE||391}]})}).call(n)},text:function(){return Fe(function(){return Ge(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 Fe(function(){var result,t,n,r;return Ge(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(Ue(n,Error)?n.message:n+""),errorDetails:JSON.stringify({status:e.status,statusText:e.statusText,url:e.url,responseText:r.substring(0,500),parseError:Ue(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=Ve({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 We(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var Je=Object.defineProperty,Ye="{target=";function $e(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?Je(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 $e(this.context.errorCodes,"UNDEFINED_DATA_MODEL")}},{key:"setCMIValue",value:function(e,t,n,r){if(!n||""===n)return t&&this.context.throwSCORMError(n,$e(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),se.WARN),s}},{key:"getCMIValue",value:function(e,t,n){if(!n||""===n)return t&&this.context.throwSCORMError(n,$e(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,$e(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(We(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,$e(this.context.errorCodes,"CHILDREN_ERROR"),void 0):"_count"===o&&this.context.throwSCORMError(n,$e(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(Ye))?this.context.isInitialized()?(this.context.throwSCORMError(r,$e(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,$e(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,$e(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(We(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?$e(this.context.errorCodes,"GENERAL_SET_FAILURE"):$e(this.context.errorCodes,"INVALID_SET_VALUE")||$e(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(Ye)&&"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,$e(this.context.errorCodes,"GENERAL_GET_FAILURE"),"The data model element does not have children"),{error:!0}):"_count"===t?(this.context.throwSCORMError(n,$e(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,$e(this.context.errorCodes,"CHILDREN_ERROR")):"_count"===t?this.context.throwSCORMError(n,$e(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,$e(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,Ke=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)},et=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ke(this,"_logLevel",se.ERROR),Ke(this,"_logHandler"),this._logHandler=le}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(se.ERROR,e)}},{key:"warn",value:function(e){this.log(se.WARN,e)}},{key:"info",value:function(e){this.log(se.INFO,e)}},{key:"debug",value:function(e){this.log(se.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 se.NONE;if("number"==typeof e)return e;switch("string"==typeof e?e.toUpperCase():e){case"1":case"DEBUG":return se.DEBUG;case"2":case"INFO":return se.INFO;case"3":case"WARN":return se.WARN;case"4":case"ERROR":default:return se.ERROR;case"5":case"NONE":return se.NONE}}}])&&Qe(t.prototype,n),r&&Qe(t,r),e}();Ke(et,"_instance");var tt=et;function nt(){return tt.getInstance()}function rt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var it=Object.defineProperty,ot=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)},st=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),ot(this,"_lastErrorCode","0"),ot(this,"_lastDiagnostic",""),ot(this,"_errorCodes"),ot(this,"_apiLog"),ot(this,"_getLmsErrorMessageDetails"),ot(this,"_loggingService"),this._errorCodes=t,this._apiLog=n,this._getLmsErrorMessageDetails=r,this._loggingService=i||nt()}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,se.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(rt(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(rt(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 at=Object.defineProperty,ct=function(e,t,n){return function(e,t,n){return t in e?at(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)},lt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ct(this,"listenerMap",new Map),ct(this,"listenerCount",0),ct(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),se.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),se.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,se.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),se.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 ut(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 ft(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){ut(o,r,i,s,a,"next",e)}function a(e){ut(o,r,i,s,a,"throw",e)}s(void 0)})}}function dt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ht(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function mt(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){dt(e,t,n[t])})}return e}function vt(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 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":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t))?t+"":t,n)},pt=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),_t(this,"apiLog",r),_t(this,"settings"),_t(this,"error_codes"),_t(this,"storeName","scorm_again_offline_data"),_t(this,"syncQueue","scorm_again_sync_queue"),_t(this,"isOnline",navigator.onLine),_t(this,"syncInProgress",!1),_t(this,"boundOnlineStatusChangeHandler"),_t(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...",se.INFO),this.syncOfflineData().then(function(t){t?e.apiLog("OfflineStorageService","Sync completed successfully",se.INFO):e.apiLog("OfflineStorageService","Sync failed",se.ERROR)},function(t){e.apiLog("OfflineStorageService","Error during sync: ".concat(t),se.ERROR)})):t&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",se.INFO)}},{key:"handleCustomNetworkStatus",value:function(e){var t=this;if(ht(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"),se.INFO),!r&&this.isOnline?(this.apiLog("OfflineStorageService","Device is back online, attempting to sync...",se.INFO),this.syncOfflineData().then(function(e){e?t.apiLog("OfflineStorageService","Sync completed successfully",se.INFO):t.apiLog("OfflineStorageService","Sync failed",se.ERROR)},function(e){t.apiLog("OfflineStorageService","Error during sync: ".concat(e),se.ERROR)})):r&&!this.isOnline&&this.apiLog("OfflineStorageService","Device is offline, data will be stored locally",se.INFO)}else this.apiLog("OfflineStorageService","Invalid online status value in custom event",se.WARN)}else this.apiLog("OfflineStorageService","Invalid network status event received",se.WARN)}},{key:"storeOffline",value:function(e,t,n){try{var r=mt({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),se.INFO),{result:P,errorCode:0}}catch(t){var o,s=(ht(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),se.ERROR),{result:x,errorCode:null!==(o=this.error_codes.GENERAL)&&void 0!==o?o:0}}}},{key:"getOfflineData",value:function(e){return ft(function(){return vt(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),se.ERROR),[2,null]}return[2]})}).call(this)}},{key:"syncOfflineData",value:function(){return ft(function(){var e,t,n,r,i,o,s,a,c,l,u,f,d,h;return vt(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"),se.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"),se.WARN),[3,7];m.label=4;case 4:return m.trys.push([4,6,,7]),[4,this.sendDataToLMS(a.data,mt({},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),se.INFO):(a.syncAttempts++,t.push(a),this.apiLog("OfflineStorageService","Failed to sync item ".concat(a.id,", attempt #").concat(a.syncAttempts),se.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),se.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"),se.INFO),this.syncInProgress=!1,[2,!0];case 12:return h=m.sent(),this.apiLog("OfflineStorageService","Error during sync process: ".concat(h),se.ERROR),this.syncInProgress=!1,[2,!1];case 13:return[2]}})}).call(this)}},{key:"sendDataToLMS",value:function(e,t){return ft(function(){var n,r,i,o,s,a,c,result,l,f;return vt(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,mt({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=mt({},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),se.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(ht(e,DOMException)&&"QuotaExceededError"===e.name)throw Error("storage quota exceeded - localStorage is full",{cause:e});throw e}}},{key:"hasPendingOfflineData",value:function(e){return ft(function(){return vt(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}(),gt=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)}),bt=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)});function Et(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 St(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){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){St(e,t,n[t])})}return e}function Ct(e){return function(e){if(Array.isArray(e))return Et(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 Et(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)?Et(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 Rt=Object.defineProperty,It=function(e,t,n){return function(e,t,n){return t in e?Rt(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)},Nt=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),It(this,"valid"),It(this,"targetActivity"),It(this,"exception"),this.valid=t,this.targetActivity=n,this.exception=r},Tt=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),It(this,"activityTree"),It(this,"rollupProcess"),It(this,"globalObjectiveMap"),It(this,"adlNav"),It(this,"eventCallback"),It(this,"now"),It(this,"defaultHideLmsUi"),It(this,"defaultAuxiliaryResources"),It(this,"_deliveryInProgress",!1),It(this,"contentDelivered",!1),It(this,"checkActivityCallback",null),It(this,"invalidateCacheCallback",null),It(this,"updateNavigationValidityCallback",null),It(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)?Ct(s.defaultHideLmsUi):[],this.defaultAuxiliaryResources=(null==s?void 0:s.defaultAuxiliaryResources)?s.defaultAuxiliaryResources.map(function(e){return wt({},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 Nt(!1,null,"DB.1.1-1");var t=this.getActivityPath(e,!0);if(0===t.length)return new Nt(!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 Nt(!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 Nt(!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,xe.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,wt({},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,wt({},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}();It(Tt,"HIDE_LMS_UI_ORDER",Ct(["continue","previous","exit","exitAll","abandon","abandonAll","suspendAll"]));var Lt=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[se.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 kt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var At=Object.defineProperty,jt=function(e,t,n){return function(e,t,n){return t in e?At(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)},Pt=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),jt(this,"settings"),jt(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=kt(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:kt(e,Array)?e.join("&"):JSON.stringify(e),contentType:kt(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 xt(e,t,n,r){return gt(e,t,n,$.TYPE_MISMATCH,H,r)}function Dt(e,t,n,r){if(""===t)throw new H(e,$.VALUE_OUT_OF_RANGE);return bt(e,t,n,$.VALUE_OUT_OF_RANGE,H)}var Ft=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)||gt(e,t,n,i,s)&&(!r||bt(e,t,r,o,s))}},{key:"validateScorm12Audio",value:function(e,t){return xt(e,t,de)&&Dt(e,t,"-1#100")}},{key:"validateScorm12Language",value:function(e,t){return xt(e,t,ue)}},{key:"validateScorm12Speed",value:function(e,t){return xt(e,t,de)&&Dt(e,t,"-100#100")}},{key:"validateScorm12Text",value:function(e,t){return xt(e,t,de)&&Dt(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}(),Bt=new Ft;function Ut(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 Vt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function zt(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){Vt(e,t,n[t])})}return e}function Ht(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 qt(e){return function(e){if(Array.isArray(e))return Ut(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 Ut(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)?Ut(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 Wt(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Jt=Object.defineProperty,Yt=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":Wt(t))?t+"":t,n)},$t=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),Yt(this,"_timeout"),Yt(this,"_error_codes"),Yt(this,"_settings",ce),Yt(this,"_httpService"),Yt(this,"_eventService"),Yt(this,"_serializationService"),Yt(this,"_errorHandlingService"),Yt(this,"_loggingService"),Yt(this,"_offlineStorageService"),Yt(this,"_cmiValueAccessService"),Yt(this,"_courseId",""),Yt(this,"_pendingCommitCount",0),Yt(this,"_commitSequence",0),Yt(this,"_commitSettleWaiters",[]),Yt(this,"_setCMIElements",new Set),Yt(this,"startingData"),Yt(this,"currentState"),(Gt(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=zt({},ce,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||nt(),this._loggingService.setLogLevel(this.settings.logLevel),this._loggingService.setLogHandler(this.settings.onLogMessage?this.settings.onLogMessage:le),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 qe(this.settings,this._error_codes)):this._httpService=new Pt(this.settings,this._error_codes),this._eventService=i||new lt(function(e,t,n,r){return u.apiLog(e,t,n,r)}),this._serializationService=o||new Lt,this._errorHandlingService=a||new st(this._error_codes,function(e,t,n,r){return u.apiLog(e,t,n||se.ERROR,r)},function(e,t){return u.getLmsErrorMessageDetails(e,t)},void 0),this.settings.enableOfflineSupport&&(this._offlineStorageService=l||new pt(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",se.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),se.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",se.INFO),u.loadFromJSON(e.runtimeData))}).catch(function(e){u.apiLog("constructor","Error retrieving offline data: ".concat(e),se.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",se.INFO),this.settings=zt({},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",se.INFO),null===(n=r._offlineStorageService)||void 0===n||n.syncOfflineData().then(function(t){t&&(r.apiLog(e,"Successfully synced offline data",se.INFO),r.processListeners("OfflineDataSynced"))}))})),this.apiLog(e,"returned: "+i,se.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=zt({},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),se.ERROR),result.errorDetails&&this.apiLog("terminate","Error details: ".concat(JSON.stringify(result.errorDetails)),se.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,se.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,se.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,se.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),se.ERROR),result.errorDetails&&this.apiLog("commit","Error details: ".concat(JSON.stringify(result.errorDetails)),se.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),se.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",se.INFO),null===(r=t._offlineStorageService)||void 0===r||r.syncOfflineData().then(function(n){n?(t.apiLog(e,"Successfully synced offline data",se.INFO),t.processListeners("OfflineDataSynced")):t.apiLog(e,"Failed to sync some offline data",se.WARN)}))})}return this.apiLog(e,"returned: "+i,se.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,se.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,se.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,se.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":Wt(e))&&t in e){var n=e[t];return Gt(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":Wt(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=qt(f).concat(["".concat(encodeURIComponent(d),"=true")]):f&&"object"===(void 0===f?"undefined":Wt(f))&&(f=Ht(zt({},f),Vt({},d,!0)))}!0===this.settings.includeCommitSequence&&(Array.isArray(f)?f=qt(f).concat(["commitSequence=".concat(o)]):f&&"object"===(void 0===f?"undefined":Wt(f))&&(f=Ht(zt({},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",se.INFO),f&&"object"===(void 0===f?"undefined":Wt(f))&&"cmi"in f?this._offlineStorageService.storeOffline(this._courseId,f,{isTerminateCommit:r,sequence:o}):(this.apiLog("processHttpRequest","Invalid commit data format for offline storage",se.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 Se(this,e,t),this.apiLog("scheduleCommit","scheduled",se.DEBUG,""))}},{key:"clearScheduledCommit",value:function(){this._timeout&&(this._timeout.cancel(),this._timeout=void 0,this.apiLog("clearScheduledCommit","cleared",se.DEBUG,""))}},{key:"_checkObjectHasProperty",value:function(e,t){return null!=e&&"object"===(void 0===e?"undefined":Wt(e))&&(Object.hasOwnProperty.call(e,t)||null!=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),t)||t in e)}},{key:"handleValueAccessException",value:function(e,t,n){return Gt(t,j)?(this.lastErrorCode=t.errorCode+"",""!==n&&(n=x),this.throwSCORMError(e,t.errorCode,t.errorMessage)):Gt(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 Kt(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Kt=function(){return!!result})()}var en=Object.defineProperty,tn=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":Xt(t))?t+"":t,n)},nn=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=Kt()?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]),tn(n,"__children"),tn(n,"__score_range"),tn(n,"__invalid_error_code"),tn(n,"__invalid_type_code"),tn(n,"__invalid_range_code"),tn(n,"__decimal_regex"),tn(n,"__error_class"),tn(n,"__allow_empty_string"),tn(n,"_raw",""),tn(n,"_min",""),tn(n,"_max"),n.__children=e.score_children||D.score_children,n.__score_range=!!e.score_range&&_e,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||he,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){Bt.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){Bt.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){Bt.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 rn(e,t,n){return rn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=sn(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n||e):i.value}},rn(e,t,n||e)}function sn(e){return sn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},sn(e)}function an(e,t){return an=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},an(e,t)}function cn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function ln(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ln=function(){return!!result})()}var un=Object.defineProperty,fn=function(e,t,n){return function(e,t,n){return t in e?un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":cn(t))?t+"":t,n)},dn=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=sn(t),r=e,!(i=ln()?Reflect.construct(t,n||[],sn(e).constructor):t.apply(e,n))||"object"!==cn(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"]),fn(e,"score"),fn(e,"__children",D.core_children),fn(e,"_student_id",""),fn(e,"_student_name",""),fn(e,"_lesson_location",""),fn(e,"_credit",""),fn(e,"_lesson_status","not attempted"),fn(e,"_entry",""),fn(e,"_total_time",""),fn(e,"_lesson_mode","normal"),fn(e,"_exit",""),fn(e,"_session_time","00:00:00"),fn(e,"_suspend_data",""),e.score=new nn({CMIElement:"cmi.core.score",score_children:D.score_children,score_range:_e,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&&an(e,t)}(t,e),n=t,(o=[{key:"initialize",value:function(){var e;rn(sn(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){xt(this._cmi_element+".lesson_location",lesson_location,ue,!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);xt(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?xt(this._cmi_element+".lesson_status",lesson_status,"^(passed|completed|failed|incomplete|browsed)$")&&(this._lesson_status=lesson_status):xt(this._cmi_element+".lesson_status",lesson_status,ye)&&(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);xt(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(xt(this._cmi_element+".total_time",total_time,fe,!0))if(total_time){var e=i(total_time,fe);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);xt(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=""),xt(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(xt(this._cmi_element+".session_time",session_time,fe)){var e=i(session_time,fe);this._session_time=r(e)}}},{key:"suspend_data",get:function(){return this._suspend_data},set:function(suspend_data){xt(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(fe))&&(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 hn(e,t,n){return t=vn(t),r=e,!(i=gn()?Reflect.construct(t,n||[],vn(e).constructor):t.apply(e,n))||"object"!==pn(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 mn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vn(e){return vn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},vn(e)}function yn(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 _n(e,t){return _n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_n(e,t)}function pn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function gn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(gn=function(){return!!result})()}var bn=Object.defineProperty,En=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":pn(t))?t+"":t,n)},On=function(e){function t(){return mn(this,t),hn(this,t,[{CMIElement:"cmi.objectives",children:D.objectives_children,errorCode:$.INVALID_SET_VALUE,errorClass:H}])}return yn(t,e),t}(ne),Sn=function(e){function t(){var e;return mn(this,t),e=hn(this,t,["cmi.objectives.n"]),En(e,"score"),En(e,"_id",""),En(e,"_status",""),e.score=new nn({CMIElement:"cmi.objectives.n.score",score_children:D.score_children,score_range:_e,invalidErrorCode:$.INVALID_SET_VALUE,invalidTypeCode:$.TYPE_MISMATCH,invalidRangeCode:$.VALUE_OUT_OF_RANGE,errorClass:H,allowEmptyString:!0}),e}return yn(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){xt(this._cmi_element+".id",id,me)&&(this._id=id)}},{key:"status",get:function(){return this._status},set:function(status){xt(this._cmi_element+".status",status,ye)&&(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 wn(e){return wn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},wn(e)}function Cn(e,t){return Cn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Cn(e,t)}function Rn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function In(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(In=function(){return!!result})()}var Nn=Object.defineProperty,Tn=function(e,t,n){return function(e,t,n){return t in e?Nn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":Rn(t))?t+"":t,n)},Ln=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=wn(t),r=e,!(i=In()?Reflect.construct(t,n||[],wn(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,["cmi.student_data"]),Tn(n,"__children"),Tn(n,"_mastery_score",""),Tn(n,"_max_time_allowed",""),Tn(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&&Cn(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(Bt.validateReadOnly(this._cmi_element+".mastery_score",this.initialized),null!=mastery_score){var e=mastery_score;"string"!=typeof e&&(e+=""),""!==e?xt(this._cmi_element+".mastery_score",e,he)&&Dt(this._cmi_element+".mastery_score",e,_e)&&(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(Bt.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{xt(t,e,fe,!0);var n=i(e,fe);return r(n)}catch(e){}try{xt(t,e,pe,!0);var s=o(e,pe);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(Bt.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+"";xt(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 kn(e,t){return kn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},kn(e,t)}function An(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 Pn=Object.defineProperty,xn=function(e,t,n){return function(e,t,n){return t in e?Pn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":An(t))?t+"":t,n)},Dn=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=jn()?Reflect.construct(t,n||[],Mn(e).constructor):t.apply(e,n))||"object"!==An(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"]),xn(n,"__children"),xn(n,"_audio",""),xn(n,"_language",""),xn(n,"_speed",""),xn(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&&kn(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){Bt.validateScorm12Audio(this._cmi_element+".audio",audio)&&(this._audio=audio)}},{key:"language",get:function(){return this._language},set:function(language){Bt.validateScorm12Language(this._cmi_element+".language",language)&&(this._language=language)}},{key:"speed",get:function(){return this._speed},set:function(speed){Bt.validateScorm12Speed(this._cmi_element+".speed",speed)&&(this._speed=speed)}},{key:"text",get:function(){return this._text},set:function(text){Bt.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 Fn(e,t,n){return t=Gn(t),r=e,!(i=Wn()?Reflect.construct(t,n||[],Gn(e).constructor):t.apply(e,n))||"object"!==qn(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 Bn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Un(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 Vn(e,t,n){return Vn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Gn(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n||e):i.value}},Vn(e,t,n||e)}function Gn(e){return Gn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Gn(e)}function zn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Hn(e,t)}function Hn(e,t){return Hn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Hn(e,t)}function qn(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Wn(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Wn=function(){return!!result})()}var Jn=Object.defineProperty,Yn=function(e,t,n){return function(e,t,n){return t in e?Jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":qn(t))?t+"":t,n)},$n=function(e){function t(){return Bn(this,t),Fn(this,t,[{CMIElement:"cmi.interactions",children:D.interactions_children,errorCode:$.INVALID_SET_VALUE,errorClass:H}])}return zn(t,e),t}(ne),Zn=function(e){function t(){var e;return Bn(this,t),e=Fn(this,t,["cmi.interactions.n"]),Yn(e,"objectives"),Yn(e,"correct_responses"),Yn(e,"_id",""),Yn(e,"_time",""),Yn(e,"_type",""),Yn(e,"_weighting",""),Yn(e,"_student_response",""),Yn(e,"_result",""),Yn(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 zn(t,e),Un(t,[{key:"initialize",value:function(){var e,n;Vn(Gn(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){xt(this._cmi_element+".id",id,me)&&(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){xt(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){xt(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){xt(this._cmi_element+".weighting",weighting,he)&&Dt(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){xt(this._cmi_element+".student_response",student_response,ve,!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'.")),xt(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(xt(this._cmi_element+".latency",latency,fe)){var e=i(latency,fe);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 Bn(this,t),e=Fn(this,t,["cmi.interactions.n.objectives.n"]),Yn(e,"_id",""),e}return zn(t,e),Un(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){xt(this._cmi_element+".id",id,me)&&(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 Bn(this,t),e=Fn(this,t,["cmi.interactions.correct_responses.n"]),Yn(e,"_pattern",""),e}return zn(t,e),Un(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){xt(this._cmi_element+".pattern",pattern,ve,!0)&&(this._pattern=pattern)}},{key:"toJSON",value:function(){this.jsonString=!0;var result={pattern:this._pattern};return this.jsonString=!1,result}}]),t}(g);function Kn(e,t,n){return Kn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=er(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n||e):i.value}},Kn(e,t,n||e)}function er(e){return er=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},er(e)}function tr(e,t){return tr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},tr(e,t)}function nr(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function rr(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(rr=function(){return!!result})()}var ir=Object.defineProperty,or=function(e,t,n){return function(e,t,n){return t in e?ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":nr(t))?t+"":t,n)},sr=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=er(t),r=e,!(i=rr()?Reflect.construct(t,n||[],er(e).constructor):t.apply(e,n))||"object"!==nr(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"]),or(r,"__children",""),or(r,"__version","3.4"),or(r,"_launch_data",""),or(r,"_comments",""),or(r,"_comments_from_lms",""),or(r,"core"),or(r,"objectives"),or(r,"student_data"),or(r,"student_preference"),or(r,"interactions"),n&&r.initialize(),r.__children=e||D.cmi_children,r.core=new dn,r.objectives=new On,r.student_data=student_data||new Ln,r.student_preference=new Dn,r.interactions=new $n,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&tr(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;Kn(er(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){xt(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 ar(e){return ar=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ar(e)}function cr(e,t){return cr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},cr(e,t)}function lr(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function ur(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ur=function(){return!!result})()}var fr=Object.defineProperty,dr=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=ar(t),r=e,!(i=ur()?Reflect.construct(t,n||[],ar(e).constructor):t.apply(e,n))||"object"!==lr(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?fr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==lr(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&&cr(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||xt(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 hr(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 mr(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 vr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yr(e){return yr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},yr(e)}function _r(e,t){return _r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_r(e,t)}function pr(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function gr(){try{var result=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(gr=function(){return!!result})()}var br=Object.defineProperty,Er=function(e,t,n){return function(e,t,n){return t in e?br(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==(void 0===t?"undefined":pr(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){vr(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=yr(t),r=e,!(i=gr()?Reflect.construct(t,n||[],yr(e).constructor):t.apply(e,n))||"object"!==pr(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]),Er(r,"statusSetByModule",!1),Er(r,"cmi"),Er(r,"nav"),Er(r,"LMSInitialize"),Er(r,"LMSFinish"),Er(r,"LMSGetValue"),Er(r,"LMSSetValue"),Er(r,"LMSCommit"),Er(r,"LMSGetLastError"),Er(r,"LMSGetErrorString"),Er(r,"LMSGetDiagnostic"),r.cmi=new sr,r.nav=new dr,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&&_r(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 Sn: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 hr(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)?hr(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,fe),l=this.cmi.core.lesson_status,u=oe,f="unknown";l&&(u="completed"===l||"passed"===l?ie:"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&&mr(n.prototype,r),o&&mr(n,o),t}($t);return Er(Or,"_globalLearnerPrefs",null),Or}();
2
2
  //# sourceMappingURL=scorm12.min.js.map