Files
scorm-again/dist/scorm-again.min.js

41 lines
160 KiB
JavaScript

(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (global){(function (){
function debounce(e,t,r){function o(t){var r=s,o=v;return s=v=void 0,O=t,j=e.apply(o,r)}function n(e){return O=e,y=setTimeout(a,t),d?o(e):j}function i(e){var r=e-p,o=e-O,n=t-r;return T?nativeMin(n,m-o):n}function u(e){var r=e-p,o=e-O;return void 0===p||r>=t||r<0||T&&o>=m}function a(){var e=now();if(u(e))return f(e);y=setTimeout(a,i(e))}function f(e){return y=void 0,g&&s?o(e):(s=v=void 0,j)}function c(){void 0!==y&&clearTimeout(y),O=0,s=p=v=y=void 0}function l(){return void 0===y?j:f(now())}function b(){var e=now(),r=u(e);if(s=arguments,v=this,p=e,r){if(void 0===y)return n(p);if(T)return y=setTimeout(a,t),o(p)}return void 0===y&&(y=setTimeout(a,t)),j}var s,v,m,j,y,p,O=0,d=!1,T=!1,g=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT);return t=toNumber(t)||0,isObject(r)&&(d=!!r.leading,T="maxWait"in r,m=T?nativeMax(toNumber(r.maxWait)||0,t):m,g="trailing"in r?!!r.trailing:g),b.cancel=c,b.flush=l,b}function isObject(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function isObjectLike(e){return!!e&&"object"==typeof e}function isSymbol(e){return"symbol"==typeof e||isObjectLike(e)&&objectToString.call(e)==symbolTag}function toNumber(e){if("number"==typeof e)return e;if(isSymbol(e))return NAN;if(isObject(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=isObject(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(reTrim,"");var r=reIsBinary.test(e);return r||reIsOctal.test(e)?freeParseInt(e.slice(2),r?2:8):reIsBadHex.test(e)?NAN:+e}var FUNC_ERROR_TEXT="Expected a function",NAN=NaN,symbolTag="[object Symbol]",reTrim=/^\s+|\s+$/g,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt,freeGlobal="object"==typeof global&&global&&global.Object===Object&&global,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),objectProto=Object.prototype,objectToString=objectProto.toString,nativeMax=Math.max,nativeMin=Math.min,now=function(){return root.Date.now()};module.exports=debounce;
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],2:[function(require,module,exports){
"use strict";function _typeof(e){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _get(e,t,r){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var o=_superPropBase(e,t);if(o){var n=Object.getOwnPropertyDescriptor(o,t);return n.get?n.get.call(r):n.value}})(e,t,r||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _inherits(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&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,o=_getPrototypeOf(e);if(t){var n=_getPrototypeOf(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _Scorm12API2=_interopRequireDefault(require("./Scorm12API")),_aicc_cmi=require("./cmi/aicc_cmi"),_scorm12_cmi=require("./cmi/scorm12_cmi"),AICC=function(e){function t(e){var o;_classCallCheck(this,t);var n=_objectSpread(_objectSpread({},{mastery_override:!1}),e);return o=r.call(this,n),o.cmi=new _aicc_cmi.CMI,o.nav=new _scorm12_cmi.NAV,o}_inherits(t,e);var r=_createSuper(t);return _createClass(t,[{key:"getChildElement",value:function(e,r,o){var n=_get(_getPrototypeOf(t.prototype),"getChildElement",this).call(this,e,r,o);return n||(this.stringMatches(e,"cmi\\.evaluation\\.comments\\.\\d+")?n=new _aicc_cmi.CMIEvaluationCommentsObject:this.stringMatches(e,"cmi\\.student_data\\.tries\\.\\d+")?n=new _aicc_cmi.CMITriesObject:this.stringMatches(e,"cmi\\.student_data\\.attempt_records\\.\\d+")&&(n=new _aicc_cmi.CMIAttemptRecordsObject)),n}},{key:"replaceWithAnotherScormAPI",value:function(e){this.cmi=e.cmi,this.nav=e.nav}}]),t}(_Scorm12API2.default);exports.default=AICC;
},{"./Scorm12API":4,"./cmi/aicc_cmi":6,"./cmi/scorm12_cmi":8}],3:[function(require,module,exports){
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function _iterableToArrayLimit(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],s=!0,o=!1,i=void 0;try{for(var n,a=e[Symbol.iterator]();!(s=(n=a.next()).done)&&(r.push(n.value),!t||r.length!==t);s=!0);}catch(e){o=!0,i=e}finally{try{s||null==a.return||a.return()}finally{if(o)throw i}}return r}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _typeof(e){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _classPrivateFieldGet(e,t){return _classApplyDescriptorGet(e,_classExtractFieldDescriptor(e,t,"get"))}function _classApplyDescriptorGet(e,t){return t.get?t.get.call(e):t.value}function _classPrivateFieldSet(e,t,r){return _classApplyDescriptorSet(e,_classExtractFieldDescriptor(e,t,"set"),r),r}function _classExtractFieldDescriptor(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function _classApplyDescriptorSet(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _common=require("./cmi/common"),_exceptions=require("./exceptions"),_error_codes2=_interopRequireDefault(require("./constants/error_codes")),_api_constants=_interopRequireDefault(require("./constants/api_constants")),_utilities=require("./utilities"),_lodash=_interopRequireDefault(require("lodash.debounce")),global_constants=_api_constants.default.global,scorm12_error_codes=_error_codes2.default.scorm12,_timeout=new WeakMap,_error_codes=new WeakMap,_settings=new WeakMap,BaseAPI=function(){function e(t,r){if(_classCallCheck(this,e),_timeout.set(this,{writable:!0,value:void 0}),_error_codes.set(this,{writable:!0,value:void 0}),_settings.set(this,{writable:!0,value:{autocommit:!1,autocommitSeconds:10,asyncCommit:!1,sendBeaconCommit:!1,lmsCommitUrl:!1,dataCommitFormat:"json",commitRequestDataType:"application/json;charset=UTF-8",autoProgress:!1,logLevel:global_constants.LOG_LEVEL_ERROR,selfReportSessionTime:!1,alwaysSendTotalTime:!1,responseHandler:function(e){var t;return void 0!==e&&(null!==(t=JSON.parse(e.responseText))&&{}.hasOwnProperty.call(t,"result")||(t={},200===e.status?(t.result=global_constants.SCORM_TRUE,t.errorCode=0):(t.result=global_constants.SCORM_FALSE,t.errorCode=101))),t}}}),_defineProperty(this,"cmi",void 0),_defineProperty(this,"startingData",void 0),(this instanceof e?this.constructor:void 0)===e)throw new TypeError("Cannot construct BaseAPI instances directly");this.currentState=global_constants.STATE_NOT_INITIALIZED,this.lastErrorCode=0,this.listenerArray=[],_classPrivateFieldSet(this,_timeout,null),_classPrivateFieldSet(this,_error_codes,t),this.settings=r,this.apiLogLevel=this.settings.logLevel,this.selfReportSessionTime=this.settings.selfReportSessionTime}return _createClass(e,[{key:"initialize",value:function(e,t,r){var s=global_constants.SCORM_FALSE;return this.isInitialized()?this.throwSCORMError(_classPrivateFieldGet(this,_error_codes).INITIALIZED,t):this.isTerminated()?this.throwSCORMError(_classPrivateFieldGet(this,_error_codes).TERMINATED,r):(this.selfReportSessionTime&&this.cmi.setStartTime(),this.currentState=global_constants.STATE_INITIALIZED,this.lastErrorCode=0,s=global_constants.SCORM_TRUE,this.processListeners(e)),this.apiLog(e,null,"returned: "+s,global_constants.LOG_LEVEL_INFO),this.clearSCORMError(s),s}},{key:"error_codes",get:function(){return _classPrivateFieldGet(this,_error_codes)}},{key:"settings",get:function(){return _classPrivateFieldGet(this,_settings)},set:function(e){_classPrivateFieldSet(this,_settings,_objectSpread(_objectSpread({},_classPrivateFieldGet(this,_settings)),e))}},{key:"terminate",value:function(e,t){var r=global_constants.SCORM_FALSE;if(this.checkState(t,_classPrivateFieldGet(this,_error_codes).TERMINATION_BEFORE_INIT,_classPrivateFieldGet(this,_error_codes).MULTIPLE_TERMINATION)){this.currentState=global_constants.STATE_TERMINATED;var s=this.storeData(!0);!this.settings.sendBeaconCommit&&!this.settings.asyncCommit&&void 0!==s.errorCode&&s.errorCode>0&&this.throwSCORMError(s.errorCode),r=void 0!==s&&s.result?s.result:global_constants.SCORM_FALSE,t&&(this.lastErrorCode=0),r=global_constants.SCORM_TRUE,this.processListeners(e)}return this.apiLog(e,null,"returned: "+r,global_constants.LOG_LEVEL_INFO),this.clearSCORMError(r),r}},{key:"getValue",value:function(e,t,r){var s;return this.checkState(t,_classPrivateFieldGet(this,_error_codes).RETRIEVE_BEFORE_INIT,_classPrivateFieldGet(this,_error_codes).RETRIEVE_AFTER_TERM)&&(t&&(this.lastErrorCode=0),s=this.getCMIValue(r),this.processListeners(e,r)),this.apiLog(e,r,": returned: "+s,global_constants.LOG_LEVEL_INFO),this.clearSCORMError(s),s}},{key:"setValue",value:function(e,t,r,s,o){void 0!==o&&(o=String(o));var i=global_constants.SCORM_FALSE;if(this.checkState(r,_classPrivateFieldGet(this,_error_codes).STORE_BEFORE_INIT,_classPrivateFieldGet(this,_error_codes).STORE_AFTER_TERM)){r&&(this.lastErrorCode=0);try{i=this.setCMIValue(s,o)}catch(e){e instanceof _exceptions.ValidationError?(this.lastErrorCode=e.errorCode,i=global_constants.SCORM_FALSE):(e.message?console.error(e.message):console.error(e),this.throwSCORMError(_classPrivateFieldGet(this,_error_codes).GENERAL))}this.processListeners(e,s,o)}return void 0===i&&(i=global_constants.SCORM_FALSE),"0"===String(this.lastErrorCode)&&this.settings.autocommit&&!_classPrivateFieldGet(this,_timeout)&&this.scheduleCommit(1e3*this.settings.autocommitSeconds,t),this.apiLog(e,s,": "+o+": result: "+i,global_constants.LOG_LEVEL_INFO),this.clearSCORMError(i),i}},{key:"commit",value:function(e,t){this.clearScheduledCommit();var r=global_constants.SCORM_FALSE;if(this.checkState(t,_classPrivateFieldGet(this,_error_codes).COMMIT_BEFORE_INIT,_classPrivateFieldGet(this,_error_codes).COMMIT_AFTER_TERM)){var s=this.storeData(!1);!this.settings.sendBeaconCommit&&!this.settings.asyncCommit&&s.errorCode&&s.errorCode>0&&this.throwSCORMError(s.errorCode),r=void 0!==s&&s.result?s.result:global_constants.SCORM_FALSE,this.apiLog(e,"HttpRequest"," Result: "+r,global_constants.LOG_LEVEL_DEBUG),t&&(this.lastErrorCode=0),this.processListeners(e)}return this.apiLog(e,null,"returned: "+r,global_constants.LOG_LEVEL_INFO),this.clearSCORMError(r),r}},{key:"getLastError",value:function(e){var t=String(this.lastErrorCode);return this.processListeners(e),this.apiLog(e,null,"returned: "+t,global_constants.LOG_LEVEL_INFO),t}},{key:"getErrorString",value:function(e,t){var r="";return null!==t&&""!==t&&(r=this.getLmsErrorMessageDetails(t),this.processListeners(e)),this.apiLog(e,null,"returned: "+r,global_constants.LOG_LEVEL_INFO),r}},{key:"getDiagnostic",value:function(e,t){var r="";return null!==t&&""!==t&&(r=this.getLmsErrorMessageDetails(t,!0),this.processListeners(e)),this.apiLog(e,null,"returned: "+r,global_constants.LOG_LEVEL_INFO),r}},{key:"checkState",value:function(e,t,r){return this.isNotInitialized()?(this.throwSCORMError(t),!1):!e||!this.isTerminated()||(this.throwSCORMError(r),!1)}},{key:"apiLog",value:function(e,t,r,s){if(r=this.formatMessage(e,t,r),s>=this.apiLogLevel)switch(s){case global_constants.LOG_LEVEL_ERROR:console.error(r);break;case global_constants.LOG_LEVEL_WARNING:console.warn(r);break;case global_constants.LOG_LEVEL_INFO:console.info(r);break;case global_constants.LOG_LEVEL_DEBUG:console.debug?console.debug(r):console.log(r)}}},{key:"formatMessage",value:function(e,t,r){var s="";s+=e;for(var o=20-s.length,i=0;i<o;i++)s+=" ";if(s+=": ",t){s+=t,o=70-s.length;for(var n=0;n<o;n++)s+=" "}return r&&(s+=r),s}},{key:"stringMatches",value:function(e,t){return e&&t&&e.match(t)}},{key:"_checkObjectHasProperty",value:function(e,t){return Object.hasOwnProperty.call(e,t)||Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),t)||t in e}},{key:"getLmsErrorMessageDetails",value:function(e,t){throw new Error("The getLmsErrorMessageDetails method has not been implemented")}},{key:"getCMIValue",value:function(e){throw new Error("The getCMIValue method has not been implemented")}},{key:"setCMIValue",value:function(e,t){throw new Error("The setCMIValue method has not been implemented")}},{key:"_commonSetCMIValue",value:function(e,t,r,s){if(!r||""===r)return global_constants.SCORM_FALSE;for(var o=r.split("."),i=this,n=global_constants.SCORM_FALSE,a=!1,l="The data model element passed to ".concat(e," (").concat(r,") is not a valid SCORM data model element."),c=t?_classPrivateFieldGet(this,_error_codes).UNDEFINED_DATA_MODEL:_classPrivateFieldGet(this,_error_codes).GENERAL,u=0;u<o.length;u++){var _=o[u];if(u===o.length-1)t&&"{target="===_.substr(0,8)&&"function"==typeof i._isTargetValid?this.throwSCORMError(_classPrivateFieldGet(this,_error_codes).READ_ONLY_ELEMENT):this._checkObjectHasProperty(i,_)?(this.isInitialized()&&this.stringMatches(r,"\\.correct_responses\\.\\d+")&&this.validateCorrectResponse(r,s),t&&0!==this.lastErrorCode||(i[_]=s,n=global_constants.SCORM_TRUE)):this.throwSCORMError(c,l);else{if(!(i=i[_])){this.throwSCORMError(c,l);break}if(i instanceof _common.CMIArray){var h=parseInt(o[u+1],10);if(!isNaN(h)){var d=i.childArray[h];if(d)i=d,a=!0;else{var f=this.getChildElement(r,s,a);a=!0,f?(i.initialized&&f.initialize(),i.childArray.push(f),i=f):this.throwSCORMError(c,l)}u++}}}}return n===global_constants.SCORM_FALSE&&this.apiLog(e,null,"There was an error setting the value for: ".concat(r,", value of: ").concat(s),global_constants.LOG_LEVEL_WARNING),n}},{key:"validateCorrectResponse",value:function(e,t){}},{key:"getChildElement",value:function(e,t,r){throw new Error("The getChildElement method has not been implemented")}},{key:"_commonGetCMIValue",value:function(e,t,r){if(!r||""===r)return"";for(var s=r.split("."),o=this,i=null,n="The data model element passed to ".concat(e," (").concat(r,") has not been initialized."),a="The data model element passed to ".concat(e," (").concat(r,") is not a valid SCORM data model element."),l=t?_classPrivateFieldGet(this,_error_codes).UNDEFINED_DATA_MODEL:_classPrivateFieldGet(this,_error_codes).GENERAL,c=0;c<s.length;c++){if(i=s[c],t){if("{target="===String(i).substr(0,8)&&"function"==typeof o._isTargetValid){var u=String(i).substr(8,String(i).length-9);return o._isTargetValid(u)}if(!this._checkObjectHasProperty(o,i))return void this.throwSCORMError(l,a)}else if(c===s.length-1&&!this._checkObjectHasProperty(o,i))return void this.throwSCORMError(l,a);if(void 0===(o=o[i])){this.throwSCORMError(l,a);break}if(o instanceof _common.CMIArray){var _=parseInt(s[c+1],10);if(!isNaN(_)){var h=o.childArray[_];if(!h){this.throwSCORMError(_classPrivateFieldGet(this,_error_codes).VALUE_NOT_INITIALIZED,n);break}o=h,c++}}}if(null!==o&&void 0!==o)return o;t||("_children"===i?this.throwSCORMError(scorm12_error_codes.CHILDREN_ERROR):"_count"===i&&this.throwSCORMError(scorm12_error_codes.COUNT_ERROR))}},{key:"isInitialized",value:function(){return this.currentState===global_constants.STATE_INITIALIZED}},{key:"isNotInitialized",value:function(){return this.currentState===global_constants.STATE_NOT_INITIALIZED}},{key:"isTerminated",value:function(){return this.currentState===global_constants.STATE_TERMINATED}},{key:"on",value:function(e,t){if(t)for(var r=e.split(" "),s=0;s<r.length;s++){var o=r[s].split(".");if(0===o.length)return;var i=o[0],n=null;o.length>1&&(n=e.replace(i+".","")),this.listenerArray.push({functionName:i,CMIElement:n,callback:t}),this.apiLog("on",i,"Added event listener: ".concat(this.listenerArray.length),global_constants.LOG_LEVEL_INFO)}}},{key:"off",value:function(e,t){var r=this;if(t)for(var s=e.split(" "),o=0;o<s.length;o++){var i=function(o){var i=s[o].split(".");if(0===i.length)return{v:void 0};var n=i[0],a=null;i.length>1&&(a=e.replace(n+".",""));var l=r.listenerArray.findIndex(function(e){return e.functionName===n&&e.CMIElement===a&&e.callback===t});-1!==l&&(r.listenerArray.splice(l,1),r.apiLog("off",n,"Removed event listener: ".concat(r.listenerArray.length),global_constants.LOG_LEVEL_INFO))}(o);if("object"===_typeof(i))return i.v}}},{key:"clear",value:function(e){for(var t=this,r=e.split(" "),s=0;s<r.length;s++){var o=function(s){var o=r[s].split(".");if(0===o.length)return{v:void 0};var i=o[0],n=null;o.length>1&&(n=e.replace(i+".","")),t.listenerArray=t.listenerArray.filter(function(e){return e.functionName!==i&&e.CMIElement!==n})}(s);if("object"===_typeof(o))return o.v}}},{key:"processListeners",value:function(e,t,r){this.apiLog(e,t,r);for(var s=0;s<this.listenerArray.length;s++){var o=this.listenerArray[s],i=o.functionName===e,n=!!o.CMIElement,a=!1;a=t&&o.CMIElement&&"*"===o.CMIElement.substring(o.CMIElement.length-1)?0===t.indexOf(o.CMIElement.substring(0,o.CMIElement.length-1)):o.CMIElement===t,!i||n&&!a||o.callback(t,r)}}},{key:"throwSCORMError",value:function(e,t){t||(t=this.getLmsErrorMessageDetails(e)),this.apiLog("throwSCORMError",null,e+": "+t,global_constants.LOG_LEVEL_ERROR),this.lastErrorCode=String(e)}},{key:"clearSCORMError",value:function(e){void 0!==e&&e!==global_constants.SCORM_FALSE&&(this.lastErrorCode=0)}},{key:"storeData",value:function(e){throw new Error("The storeData method has not been implemented")}},{key:"loadFromFlattenedJSON",value:function(e,t){function r(e,t,r){var s,o=e.match(r);if(null!==o&&null!==(s=t.match(r))){var i=Number(o[2]),n=Number(s[2]);return i===n?"id"===o[3]?-1:"type"===o[3]?"id"===s[3]?1:-1:1:i-n}return null}var s=this;if(!this.isNotInitialized())return void console.error("loadFromFlattenedJSON can only be called before the call to lmsInitialize.");var o=/^(cmi\.interactions\.)(\d+)\.(.*)$/,i=/^(cmi\.objectives\.)(\d+)\.(.*)$/,n=Object.keys(e).map(function(t){return[String(t),e[t]]});n.sort(function(e,t){var s,n=_slicedToArray(e,2),a=n[0],l=(n[1],_slicedToArray(t,2)),c=l[0];l[1];return null!==(s=r(a,c,o))?s:null!==(s=r(a,c,i))?s:a<c?-1:a>c?1:0});var a;n.forEach(function(e){a={},a[e[0]]=e[1],s.loadFromJSON((0,_utilities.unflatten)(a),t)})}},{key:"loadFromJSON",value:function(e,t){if(!this.isNotInitialized())return void console.error("loadFromJSON can only be called before the call to lmsInitialize.");t=void 0!==t?t:"cmi",this.startingData=e;for(var r in e)if({}.hasOwnProperty.call(e,r)&&e[r]){var s=(t?t+".":"")+r,o=e[r];if(o.childArray)for(var i=0;i<o.childArray.length;i++)this.loadFromJSON(o.childArray[i],s+"."+i);else o.constructor===Object?this.loadFromJSON(o,s):this.setCMIValue(s,o)}}},{key:"renderCMIToJSONString",value:function(){var e=this.cmi;return JSON.stringify({cmi:e})}},{key:"renderCMIToJSONObject",value:function(){return JSON.parse(this.renderCMIToJSONString())}},{key:"renderCommitCMI",value:function(e){throw new Error("The storeData method has not been implemented")}},{key:"processHttpRequest",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=this,o=function(e,t,r,o){var i,n={result:global_constants.SCORM_FALSE,errorCode:o.GENERAL};if(r.sendBeaconCommit)try{var a,l={type:r.commitRequestDataType};a=t instanceof Array?new Blob([t.join("&")],l):new Blob([JSON.stringify(t)],l),i={},navigator.sendBeacon(e,a)?(i.result=global_constants.SCORM_TRUE,i.errorCode=0):(i.result=global_constants.SCORM_FALSE,i.errorCode=101)}catch(e){return console.error(e),s.processListeners("CommitError"),n}else{var c=new XMLHttpRequest;c.open("POST",e,r.asyncCommit),r.asyncCommit&&(c.onload=function(e){i="function"==typeof r.responseHandler?r.responseHandler(c):JSON.parse(c.responseText)});try{if(t instanceof Array?(c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(t.join("&"))):(c.setRequestHeader("Content-Type",r.commitRequestDataType),c.send(JSON.stringify(t))),r.asyncCommit)return i={},i.result=global_constants.SCORM_TRUE,i.errorCode=0,s.processListeners("CommitSuccess"),i;i="function"==typeof r.responseHandler?r.responseHandler(c):JSON.parse(c.responseText)}catch(e){return console.error(e),s.processListeners("CommitError"),n}}return void 0===i?(s.processListeners("CommitError"),n):(!0===i.result||i.result===global_constants.SCORM_TRUE?s.processListeners("CommitSuccess"):s.processListeners("CommitError"),i)};if(void 0!==_lodash.default){var i=(0,_lodash.default)(o,500);return i(e,t,this.settings,this.error_codes),r&&i.flush(),{result:global_constants.SCORM_TRUE,errorCode:0}}return o(e,t,this.settings,this.error_codes)}},{key:"scheduleCommit",value:function(e,t){_classPrivateFieldSet(this,_timeout,new ScheduledCommit(this,e,t)),this.apiLog("scheduleCommit","","scheduled",global_constants.LOG_LEVEL_DEBUG)}},{key:"clearScheduledCommit",value:function(){_classPrivateFieldGet(this,_timeout)&&(_classPrivateFieldGet(this,_timeout).cancel(),_classPrivateFieldSet(this,_timeout,null),this.apiLog("clearScheduledCommit","","cleared",global_constants.LOG_LEVEL_DEBUG))}}]),e}();exports.default=BaseAPI;var _API=new WeakMap,_cancelled=new WeakMap,_timeout2=new WeakMap,_callback=new WeakMap,ScheduledCommit=function(){function e(t,r,s){_classCallCheck(this,e),_API.set(this,{writable:!0,value:void 0}),_cancelled.set(this,{writable:!0,value:!1}),_timeout2.set(this,{writable:!0,value:void 0}),_callback.set(this,{writable:!0,value:void 0}),_classPrivateFieldSet(this,_API,t),_classPrivateFieldSet(this,_timeout2,setTimeout(this.wrapper.bind(this),r)),_classPrivateFieldSet(this,_callback,s)}return _createClass(e,[{key:"cancel",value:function(){_classPrivateFieldSet(this,_cancelled,!0),_classPrivateFieldGet(this,_timeout2)&&clearTimeout(_classPrivateFieldGet(this,_timeout2))}},{key:"wrapper",value:function(){_classPrivateFieldGet(this,_cancelled)||_classPrivateFieldGet(this,_API).commit(_classPrivateFieldGet(this,_callback))}}]),e}();
},{"./cmi/common":7,"./constants/api_constants":10,"./constants/error_codes":11,"./exceptions":15,"./utilities":17,"lodash.debounce":1}],4:[function(require,module,exports){
"use strict";function _typeof(e){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!==_typeof(e)&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var n=o?Object.getOwnPropertyDescriptor(e,i):null;n&&(n.get||n.set)?Object.defineProperty(r,i,n):r[i]=e[i]}return r.default=e,t&&t.set(e,r),r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _inherits(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&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,o=_getPrototypeOf(e);if(t){var i=_getPrototypeOf(this).constructor;r=Reflect.construct(o,arguments,i)}else r=o.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _BaseAPI2=_interopRequireDefault(require("./BaseAPI")),_scorm12_cmi=require("./cmi/scorm12_cmi"),Utilities=_interopRequireWildcard(require("./utilities")),_api_constants=_interopRequireDefault(require("./constants/api_constants")),_error_codes=_interopRequireDefault(require("./constants/error_codes")),scorm12_constants=_api_constants.default.scorm12,global_constants=_api_constants.default.global,scorm12_error_codes=_error_codes.default.scorm12,Scorm12API=function(e){function t(e){var o;_classCallCheck(this,t);var i=_objectSpread(_objectSpread({},{mastery_override:!1}),e);return o=r.call(this,scorm12_error_codes,i),o.cmi=new _scorm12_cmi.CMI,o.nav=new _scorm12_cmi.NAV,o.LMSInitialize=o.lmsInitialize,o.LMSFinish=o.lmsFinish,o.LMSGetValue=o.lmsGetValue,o.LMSSetValue=o.lmsSetValue,o.LMSCommit=o.lmsCommit,o.LMSGetLastError=o.lmsGetLastError,o.LMSGetErrorString=o.lmsGetErrorString,o.LMSGetDiagnostic=o.lmsGetDiagnostic,o}_inherits(t,e);var r=_createSuper(t);return _createClass(t,[{key:"lmsInitialize",value:function(){return this.cmi.initialize(),this.initialize("LMSInitialize","LMS was already initialized!","LMS is already finished!")}},{key:"lmsFinish",value:function(){var e=this.terminate("LMSFinish",!0);return e===global_constants.SCORM_TRUE&&(""!==this.nav.event?"continue"===this.nav.event?this.processListeners("SequenceNext"):this.processListeners("SequencePrevious"):this.settings.autoProgress&&this.processListeners("SequenceNext")),e}},{key:"lmsGetValue",value:function(e){return this.getValue("LMSGetValue",!1,e)}},{key:"lmsSetValue",value:function(e,t){return this.setValue("LMSSetValue","LMSCommit",!1,e,t)}},{key:"lmsCommit",value:function(){return 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){return this._commonSetCMIValue("LMSSetValue",!1,e,t)}},{key:"getCMIValue",value:function(e){return this._commonGetCMIValue("getCMIValue",!1,e)}},{key:"getChildElement",value:function(e,t,r){var o;return this.stringMatches(e,"cmi\\.objectives\\.\\d+")?o=new _scorm12_cmi.CMIObjectivesObject:r&&this.stringMatches(e,"cmi\\.interactions\\.\\d+\\.correct_responses\\.\\d+")?o=new _scorm12_cmi.CMIInteractionsCorrectResponsesObject:r&&this.stringMatches(e,"cmi\\.interactions\\.\\d+\\.objectives\\.\\d+")?o=new _scorm12_cmi.CMIInteractionsObjectivesObject:!r&&this.stringMatches(e,"cmi\\.interactions\\.\\d+")&&(o=new _scorm12_cmi.CMIInteractionsObject),o}},{key:"validateCorrectResponse",value:function(e,t){return!0}},{key:"getLmsErrorMessageDetails",value:function(e,t){var r="No Error",o="No Error";return e=String(e),scorm12_constants.error_descriptions[e]&&(r=scorm12_constants.error_descriptions[e].basicMessage,o=scorm12_constants.error_descriptions[e].detailMessage),t?o:r}},{key:"replaceWithAnotherScormAPI",value:function(e){this.cmi=e.cmi}},{key:"renderCommitCMI",value:function(e){var t=this.renderCMIToJSONObject();e&&(t.cmi.core.total_time=this.cmi.getCurrentTotalTime());var r=[],o=Utilities.flatten(t);switch(this.settings.dataCommitFormat){case"flattened":return Utilities.flatten(t);case"params":for(var i in o)({}).hasOwnProperty.call(o,i)&&r.push("".concat(i,"=").concat(o[i]));return r;case"json":default:return t}}},{key:"storeData",value:function(e){if(e){var t=this.cmi.core.lesson_status;if("not attempted"===t&&(this.cmi.core.lesson_status="completed"),"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&&(parseFloat(this.cmi.core.score.raw)>=parseFloat(this.cmi.student_data.mastery_score)?this.cmi.core.lesson_status="passed":this.cmi.core.lesson_status="failed");else if("browse"===this.cmi.core.lesson_mode){var r,o,i;""===((null===(r=this.startingData)||void 0===r?void 0:null===(o=r.cmi)||void 0===o?void 0:null===(i=o.core)||void 0===i?void 0:i.lesson_status)||"")&&"not attempted"===t&&(this.cmi.core.lesson_status="browsed")}}var n=this.renderCommitCMI(e||this.settings.alwaysSendTotalTime);return this.settings.lmsCommitUrl?(this.apiLogLevel===global_constants.LOG_LEVEL_DEBUG&&(console.debug("Commit (terminated: "+(e?"yes":"no")+"): "),console.debug(n)),this.processHttpRequest(this.settings.lmsCommitUrl,n,e)):(console.log("Commit (terminated: "+(e?"yes":"no")+"): "),console.log(n),global_constants.SCORM_TRUE)}}]),t}(_BaseAPI2.default);exports.default=Scorm12API;
},{"./BaseAPI":3,"./cmi/scorm12_cmi":8,"./constants/api_constants":10,"./constants/error_codes":11,"./utilities":17}],5:[function(require,module,exports){
"use strict";function _typeof(e){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!==_typeof(e)&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=s?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,t&&t.set(e,r),r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _inherits(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&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,s=_getPrototypeOf(e);if(t){var o=_getPrototypeOf(this).constructor;r=Reflect.construct(s,arguments,o)}else r=s.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _classPrivateFieldGet(e,t){return _classApplyDescriptorGet(e,_classExtractFieldDescriptor(e,t,"get"))}function _classExtractFieldDescriptor(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function _classApplyDescriptorGet(e,t){return t.get?t.get.call(e):t.value}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _BaseAPI2=_interopRequireDefault(require("./BaseAPI")),_scorm2004_cmi=require("./cmi/scorm2004_cmi"),Utilities=_interopRequireWildcard(require("./utilities")),_api_constants=_interopRequireDefault(require("./constants/api_constants")),_error_codes=_interopRequireDefault(require("./constants/error_codes")),_response_constants=_interopRequireDefault(require("./constants/response_constants")),_language_constants=_interopRequireDefault(require("./constants/language_constants")),_regex=_interopRequireDefault(require("./constants/regex")),scorm2004_constants=_api_constants.default.scorm2004,global_constants=_api_constants.default.global,scorm2004_error_codes=_error_codes.default.scorm2004,correct_responses=_response_constants.default.correct,scorm2004_regex=_regex.default.scorm2004,_version=new WeakMap,Scorm2004API=function(e){function t(e){var s;_classCallCheck(this,t);var o=_objectSpread(_objectSpread({},{mastery_override:!1}),e);return s=r.call(this,scorm2004_error_codes,o),_version.set(_assertThisInitialized(s),{writable:!0,value:void 0}),_defineProperty(_assertThisInitialized(s),"checkDuplicatedPattern",function(e,t,r){for(var s=!1,o=e._count,i=0;i<o&&!s;i++)i!==t&&e.childArray[i]===r&&(s=!0);return s}),s.cmi=new _scorm2004_cmi.CMI,s.adl=new _scorm2004_cmi.ADL,s.Initialize=s.lmsInitialize,s.Terminate=s.lmsTerminate,s.GetValue=s.lmsGetValue,s.SetValue=s.lmsSetValue,s.Commit=s.lmsCommit,s.GetLastError=s.lmsGetLastError,s.GetErrorString=s.lmsGetErrorString,s.GetDiagnostic=s.lmsGetDiagnostic,s}_inherits(t,e);var r=_createSuper(t);return _createClass(t,[{key:"version",get:function(){return _classPrivateFieldGet(this,_version)}},{key:"lmsInitialize",value:function(){return this.cmi.initialize(),this.initialize("Initialize")}},{key:"lmsTerminate",value:function(){var e=this.terminate("Terminate",!0);if(e===global_constants.SCORM_TRUE)if("_none_"!==this.adl.nav.request)switch(this.adl.nav.request){case"continue":this.processListeners("SequenceNext");break;case"previous":this.processListeners("SequencePrevious");break;case"choice":this.processListeners("SequenceChoice");break;case"exit":this.processListeners("SequenceExit");break;case"exitAll":this.processListeners("SequenceExitAll");break;case"abandon":this.processListeners("SequenceAbandon");break;case"abandonAll":this.processListeners("SequenceAbandonAll")}else this.settings.autoProgress&&this.processListeners("SequenceNext");return e}},{key:"lmsGetValue",value:function(e){return this.getValue("GetValue",!0,e)}},{key:"lmsSetValue",value:function(e,t){return this.setValue("SetValue","Commit",!0,e,t)}},{key:"lmsCommit",value:function(){return this.commit("Commit")}},{key:"lmsGetLastError",value:function(){return this.getLastError("GetLastError")}},{key:"lmsGetErrorString",value:function(e){return this.getErrorString("GetErrorString",e)}},{key:"lmsGetDiagnostic",value:function(e){return this.getDiagnostic("GetDiagnostic",e)}},{key:"setCMIValue",value:function(e,t){return this._commonSetCMIValue("SetValue",!0,e,t)}},{key:"getChildElement",value:function(e,t,r){var s;if(this.stringMatches(e,"cmi\\.objectives\\.\\d+"))s=new _scorm2004_cmi.CMIObjectivesObject;else if(r&&this.stringMatches(e,"cmi\\.interactions\\.\\d+\\.correct_responses\\.\\d+")){var o=e.split("."),i=Number(o[2]),n=this.cmi.interactions.childArray[i];if(this.isInitialized())if(n.type){this.checkDuplicateChoiceResponse(n,t);var c=correct_responses[n.type];c?this.checkValidResponseType(c,t,n.type):this.throwSCORMError(scorm2004_error_codes.GENERAL_SET_FAILURE,"Incorrect Response Type: "+n.type)}else this.throwSCORMError(scorm2004_error_codes.DEPENDENCY_NOT_ESTABLISHED);0===this.lastErrorCode&&(s=new _scorm2004_cmi.CMIInteractionsCorrectResponsesObject)}else r&&this.stringMatches(e,"cmi\\.interactions\\.\\d+\\.objectives\\.\\d+")?s=new _scorm2004_cmi.CMIInteractionsObjectivesObject:!r&&this.stringMatches(e,"cmi\\.interactions\\.\\d+")?s=new _scorm2004_cmi.CMIInteractionsObject:this.stringMatches(e,"cmi\\.comments_from_learner\\.\\d+")?s=new _scorm2004_cmi.CMICommentsObject:this.stringMatches(e,"cmi\\.comments_from_lms\\.\\d+")&&(s=new _scorm2004_cmi.CMICommentsObject(!0));return s}},{key:"checkValidResponseType",value:function(e,t,r){var s=[];null!==e&&void 0!==e&&e.delimiter?s=String(t).split(e.delimiter):s[0]=t,s.length>0&&s.length<=e.max?this.checkCorrectResponseValue(r,s,t):s.length>e.max&&this.throwSCORMError(scorm2004_error_codes.GENERAL_SET_FAILURE,"Data Model Element Pattern Too Long")}},{key:"checkDuplicateChoiceResponse",value:function(e,t){var r=e.correct_responses._count;if("choice"===e.type)for(var s=0;s<r&&0===this.lastErrorCode;s++){var o=e.correct_responses.childArray[s];o.pattern===t&&this.throwSCORMError(scorm2004_error_codes.GENERAL_SET_FAILURE)}}},{key:"validateCorrectResponse",value:function(e,t){var r=e.split("."),s=Number(r[2]),o=Number(r[4]),i=this.cmi.interactions.childArray[s],n=i.correct_responses._count;this.checkDuplicateChoiceResponse(i,t);var c=correct_responses[i.type];void 0===c.limit||n<=c.limit?(this.checkValidResponseType(c,t,i.type),0===this.lastErrorCode&&(!c.duplicate||!this.checkDuplicatedPattern(i.correct_responses,o,t))||0===this.lastErrorCode&&""===t||0===this.lastErrorCode&&this.throwSCORMError(scorm2004_error_codes.GENERAL_SET_FAILURE,"Data Model Element Pattern Already Exists")):this.throwSCORMError(scorm2004_error_codes.GENERAL_SET_FAILURE,"Data Model Element Collection Limit Reached")}},{key:"getCMIValue",value:function(e){return this._commonGetCMIValue("GetValue",!0,e)}},{key:"getLmsErrorMessageDetails",value:function(e,t){var r="",s="";return e=String(e),scorm2004_constants.error_descriptions[e]&&(r=scorm2004_constants.error_descriptions[e].basicMessage,s=scorm2004_constants.error_descriptions[e].detailMessage),t?s:r}},{key:"checkCorrectResponseValue",value:function(e,t,r){for(var s=correct_responses[e],o=new RegExp(s.format),i=0;i<t.length&&0===this.lastErrorCode;i++)if(e.match("^(fill-in|long-fill-in|matching|performance|sequencing)$")&&(t[i]=this.removeCorrectResponsePrefixes(t[i])),null!==s&&void 0!==s&&s.delimiter2){var n=t[i].split(s.delimiter2);if(2===n.length){var c=n[0].match(o);c?n[1].match(new RegExp(s.format2))||this.throwSCORMError(scorm2004_error_codes.TYPE_MISMATCH):this.throwSCORMError(scorm2004_error_codes.TYPE_MISMATCH)}else this.throwSCORMError(scorm2004_error_codes.TYPE_MISMATCH)}else{var a=t[i].match(o);if(!a&&""!==r||!a&&"true-false"===e)this.throwSCORMError(scorm2004_error_codes.TYPE_MISMATCH);else if("numeric"===e&&t.length>1)Number(t[0])>Number(t[1])&&this.throwSCORMError(scorm2004_error_codes.TYPE_MISMATCH);else if(""!==t[i]&&s.unique)for(var l=0;l<i&&0===this.lastErrorCode;l++)t[i]===t[l]&&this.throwSCORMError(scorm2004_error_codes.TYPE_MISMATCH)}}},{key:"removeCorrectResponsePrefixes",value:function(e){for(var t=!1,r=!1,s=!1,o=new RegExp("^({(lang|case_matters|order_matters)=([^}]+)})"),i=e.match(o),n=null;i;){switch(i[2]){case"lang":if(n=e.match(scorm2004_regex.CMILangcr)){var c=n[3];void 0!==c&&c.length>0&&void 0===_language_constants.default[c.toLowerCase()]&&this.throwSCORMError(scorm2004_error_codes.TYPE_MISMATCH)}s=!0;break;case"case_matters":s||t||r||"true"!==i[3]&&"false"!==i[3]&&this.throwSCORMError(scorm2004_error_codes.TYPE_MISMATCH),r=!0;break;case"order_matters":r||s||t||"true"!==i[3]&&"false"!==i[3]&&this.throwSCORMError(scorm2004_error_codes.TYPE_MISMATCH),t=!0}e=e.substr(i[1].length),i=e.match(o)}return e}},{key:"replaceWithAnotherScormAPI",value:function(e){this.cmi=e.cmi,this.adl=e.adl}},{key:"renderCommitCMI",value:function(e){var t=this.renderCMIToJSONObject();e&&(t.cmi.total_time=this.cmi.getCurrentTotalTime());var r=[],s=Utilities.flatten(t);switch(this.settings.dataCommitFormat){case"flattened":return Utilities.flatten(t);case"params":for(var o in s)({}).hasOwnProperty.call(s,o)&&r.push("".concat(o,"=").concat(s[o]));return r;case"json":default:return t}}},{key:"storeData",value:function(e){var t,r,s;e&&"normal"===this.cmi.mode&&"credit"===this.cmi.credit&&(this.cmi.completion_threshold&&this.cmi.progress_measure&&(this.cmi.progress_measure>=this.cmi.completion_threshold?(console.debug("Setting Completion Status: Completed"),this.cmi.completion_status="completed"):(console.debug("Setting Completion Status: Incomplete"),this.cmi.completion_status="incomplete")),this.cmi.scaled_passing_score&&this.cmi.score.scaled&&(this.cmi.score.scaled>=this.cmi.scaled_passing_score?(console.debug("Setting Success Status: Passed"),this.cmi.success_status="passed"):(console.debug("Setting Success Status: Failed"),this.cmi.success_status="failed")));var o=!1;this.adl.nav.request!==(null===(t=this.startingData)||void 0===t?void 0:null===(r=t.adl)||void 0===r?void 0:null===(s=r.nav)||void 0===s?void 0:s.request)&&"_none_"!==this.adl.nav.request&&(this.adl.nav.request=encodeURIComponent(this.adl.nav.request),o=!0);var i=this.renderCommitCMI(e||this.settings.alwaysSendTotalTime);if(this.settings.lmsCommitUrl){this.apiLogLevel===global_constants.LOG_LEVEL_DEBUG&&(console.debug("Commit (terminated: "+(e?"yes":"no")+"): "),console.debug(i));var n=this.processHttpRequest(this.settings.lmsCommitUrl,i,e);return o&&void 0!==n.navRequest&&""!==n.navRequest&&Function('"use strict";(() => { '.concat(n.navRequest," })()"))(),n}return console.log("Commit (terminated: "+(e?"yes":"no")+"): "),console.log(i),global_constants.SCORM_TRUE}}]),t}(_BaseAPI2.default);exports.default=Scorm2004API;
},{"./BaseAPI":3,"./cmi/scorm2004_cmi":9,"./constants/api_constants":10,"./constants/error_codes":11,"./constants/language_constants":12,"./constants/regex":13,"./constants/response_constants":14,"./utilities":17}],6:[function(require,module,exports){
"use strict";function _typeof(e){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!==_typeof(e)&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var i={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var a=r?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(i,s,a):i[s]=e[s]}return i.default=e,t&&t.set(e,i),i}function _classPrivateFieldSet(e,t,i){return _classApplyDescriptorSet(e,_classExtractFieldDescriptor(e,t,"set"),i),i}function _classApplyDescriptorSet(e,t,i){if(t.set)t.set.call(e,i);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=i}}function _classPrivateFieldGet(e,t){return _classApplyDescriptorGet(e,_classExtractFieldDescriptor(e,t,"get"))}function _classExtractFieldDescriptor(e,t,i){if(!t.has(e))throw new TypeError("attempted to "+i+" private field on non-instance");return t.get(e)}function _classApplyDescriptorGet(e,t){return t.get?t.get.call(e):t.value}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,i){return t&&_defineProperties(e.prototype,t),i&&_defineProperties(e,i),e}function _get(e,t,i){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var r=_superPropBase(e,t);if(r){var s=Object.getOwnPropertyDescriptor(r,t);return s.get?s.get.call(i):s.value}})(e,t,i||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _inherits(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&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var i,r=_getPrototypeOf(e);if(t){var s=_getPrototypeOf(this).constructor;i=Reflect.construct(r,arguments,s)}else i=r.apply(this,arguments);return _possibleConstructorReturn(this,i)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.CMIEvaluationCommentsObject=exports.CMIAttemptRecordsObject=exports.CMIAttemptRecords=exports.CMITriesObject=exports.CMITries=exports.CMIPathsObject=exports.CMIPaths=exports.CMIStudentDemographics=exports.CMI=void 0;var Scorm12CMI=_interopRequireWildcard(require("./scorm12_cmi")),_common=require("./common"),_api_constants=_interopRequireDefault(require("../constants/api_constants")),_regex=_interopRequireDefault(require("../constants/regex")),_error_codes=_interopRequireDefault(require("../constants/error_codes")),aicc_constants=_api_constants.default.aicc,aicc_regex=_regex.default.aicc,scorm12_error_codes=_error_codes.default.scorm12,CMI=function(e){function t(e){var r;return _classCallCheck(this,t),r=i.call(this,aicc_constants.cmi_children),e&&r.initialize(),r.student_preference=new AICCStudentPreferences,r.student_data=new AICCCMIStudentData,r.student_demographics=new CMIStudentDemographics,r.evaluation=new CMIEvaluation,r.paths=new CMIPaths,r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"initialize",value:function(){var e,i,r,s,a;_get(_getPrototypeOf(t.prototype),"initialize",this).call(this),null===(e=this.student_preference)||void 0===e||e.initialize(),null===(i=this.student_data)||void 0===i||i.initialize(),null===(r=this.student_demographics)||void 0===r||r.initialize(),null===(s=this.evaluation)||void 0===s||s.initialize(),null===(a=this.paths)||void 0===a||a.initialize()}},{key:"toJSON",value:function(){this.jsonString=!0;var e={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,student_demographics:this.student_demographics,interactions:this.interactions,evaluation:this.evaluation,paths:this.paths};return delete this.jsonString,e}}]),t}(Scorm12CMI.CMI);exports.CMI=CMI;var CMIEvaluation=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),e.comments=new CMIEvaluationComments,e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"initialize",value:function(){var e;_get(_getPrototypeOf(t.prototype),"initialize",this).call(this),null===(e=this.comments)||void 0===e||e.initialize()}},{key:"toJSON",value:function(){this.jsonString=!0;var e={comments:this.comments};return delete this.jsonString,e}}]),t}(_common.BaseCMI),CMIEvaluationComments=function(e){function t(){return _classCallCheck(this,t),i.call(this,aicc_constants.comments_children,scorm12_error_codes.INVALID_SET_VALUE)}_inherits(t,e);var i=_createSuper(t);return t}(_common.CMIArray),_lesson_type=new WeakMap,_text_color=new WeakMap,_text_location=new WeakMap,_text_size=new WeakMap,_video=new WeakMap,AICCStudentPreferences=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this,aicc_constants.student_preference_children),_lesson_type.set(_assertThisInitialized(e),{writable:!0,value:""}),_text_color.set(_assertThisInitialized(e),{writable:!0,value:""}),_text_location.set(_assertThisInitialized(e),{writable:!0,value:""}),_text_size.set(_assertThisInitialized(e),{writable:!0,value:""}),_video.set(_assertThisInitialized(e),{writable:!0,value:""}),e.windows=new _common.CMIArray({errorCode:scorm12_error_codes.INVALID_SET_VALUE,children:""}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"initialize",value:function(){var e;_get(_getPrototypeOf(t.prototype),"initialize",this).call(this),null===(e=this.windows)||void 0===e||e.initialize()}},{key:"lesson_type",get:function(){return _classPrivateFieldGet(this,_lesson_type)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMIString256)&&_classPrivateFieldSet(this,_lesson_type,e)}},{key:"text_color",get:function(){return _classPrivateFieldGet(this,_text_color)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMIString256)&&_classPrivateFieldSet(this,_text_color,e)}},{key:"text_location",get:function(){return _classPrivateFieldGet(this,_text_location)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMIString256)&&_classPrivateFieldSet(this,_text_location,e)}},{key:"text_size",get:function(){return _classPrivateFieldGet(this,_text_size)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMIString256)&&_classPrivateFieldSet(this,_text_size,e)}},{key:"video",get:function(){return _classPrivateFieldGet(this,_video)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMIString256)&&_classPrivateFieldSet(this,_video,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={audio:this.audio,language:this.language,lesson_type:this.lesson_type,speed:this.speed,text:this.text,text_color:this.text_color,text_location:this.text_location,text_size:this.text_size,video:this.video,windows:this.windows};return delete this.jsonString,e}}]),t}(Scorm12CMI.CMIStudentPreference),_tries_during_lesson=new WeakMap,AICCCMIStudentData=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this,aicc_constants.student_data_children),_tries_during_lesson.set(_assertThisInitialized(e),{writable:!0,value:""}),e.tries=new CMITries,e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"initialize",value:function(){var e;_get(_getPrototypeOf(t.prototype),"initialize",this).call(this),null===(e=this.tries)||void 0===e||e.initialize()}},{key:"tries_during_lesson",get:function(){return _classPrivateFieldGet(this,_tries_during_lesson)},set:function(e){this.initialized?(0,Scorm12CMI.throwReadOnlyError)():_classPrivateFieldSet(this,_tries_during_lesson,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={mastery_score:this.mastery_score,max_time_allowed:this.max_time_allowed,time_limit_action:this.time_limit_action,tries:this.tries};return delete this.jsonString,e}}]),t}(Scorm12CMI.CMIStudentData),_children=new WeakMap,_city=new WeakMap,_class=new WeakMap,_company=new WeakMap,_country=new WeakMap,_experience=new WeakMap,_familiar_name=new WeakMap,_instructor_name=new WeakMap,_title=new WeakMap,_native_language=new WeakMap,_state=new WeakMap,_street_address=new WeakMap,_telephone=new WeakMap,_years_experience=new WeakMap,CMIStudentDemographics=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_children.set(_assertThisInitialized(e),{writable:!0,value:aicc_constants.student_demographics_children}),_city.set(_assertThisInitialized(e),{writable:!0,value:""}),_class.set(_assertThisInitialized(e),{writable:!0,value:""}),_company.set(_assertThisInitialized(e),{writable:!0,value:""}),_country.set(_assertThisInitialized(e),{writable:!0,value:""}),_experience.set(_assertThisInitialized(e),{writable:!0,value:""}),_familiar_name.set(_assertThisInitialized(e),{writable:!0,value:""}),_instructor_name.set(_assertThisInitialized(e),{writable:!0,value:""}),_title.set(_assertThisInitialized(e),{writable:!0,value:""}),_native_language.set(_assertThisInitialized(e),{writable:!0,value:""}),_state.set(_assertThisInitialized(e),{writable:!0,value:""}),_street_address.set(_assertThisInitialized(e),{writable:!0,value:""}),_telephone.set(_assertThisInitialized(e),{writable:!0,value:""}),_years_experience.set(_assertThisInitialized(e),{writable:!0,value:""}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"city",get:function(){return _classPrivateFieldGet(this,_city)},set:function(e){this.initialized?(0,Scorm12CMI.throwReadOnlyError)():_classPrivateFieldSet(this,_city,e)}},{key:"class",get:function(){return _classPrivateFieldGet(this,_class)},set:function(e){this.initialized?(0,Scorm12CMI.throwReadOnlyError)():_classPrivateFieldSet(this,_class,e)}},{key:"company",get:function(){return _classPrivateFieldGet(this,_company)},set:function(e){this.initialized?(0,Scorm12CMI.throwReadOnlyError)():_classPrivateFieldSet(this,_company,e)}},{key:"country",get:function(){return _classPrivateFieldGet(this,_country)},set:function(e){this.initialized?(0,Scorm12CMI.throwReadOnlyError)():_classPrivateFieldSet(this,_country,e)}},{key:"experience",get:function(){return _classPrivateFieldGet(this,_experience)},set:function(e){this.initialized?(0,Scorm12CMI.throwReadOnlyError)():_classPrivateFieldSet(this,_experience,e)}},{key:"familiar_name",get:function(){return _classPrivateFieldGet(this,_familiar_name)},set:function(e){this.initialized?(0,Scorm12CMI.throwReadOnlyError)():_classPrivateFieldSet(this,_familiar_name,e)}},{key:"instructor_name",get:function(){return _classPrivateFieldGet(this,_instructor_name)},set:function(e){this.initialized?(0,Scorm12CMI.throwReadOnlyError)():_classPrivateFieldSet(this,_instructor_name,e)}},{key:"title",get:function(){return _classPrivateFieldGet(this,_title)},set:function(e){this.initialized?(0,Scorm12CMI.throwReadOnlyError)():_classPrivateFieldSet(this,_title,e)}},{key:"native_language",get:function(){return _classPrivateFieldGet(this,_native_language)},set:function(e){this.initialized?(0,Scorm12CMI.throwReadOnlyError)():_classPrivateFieldSet(this,_native_language,e)}},{key:"state",get:function(){return _classPrivateFieldGet(this,_state)},set:function(e){this.initialized?(0,Scorm12CMI.throwReadOnlyError)():_classPrivateFieldSet(this,_state,e)}},{key:"street_address",get:function(){return _classPrivateFieldGet(this,_street_address)},set:function(e){this.initialized?(0,Scorm12CMI.throwReadOnlyError)():_classPrivateFieldSet(this,_street_address,e)}},{key:"telephone",get:function(){return _classPrivateFieldGet(this,_telephone)},set:function(e){this.initialized?(0,Scorm12CMI.throwReadOnlyError)():_classPrivateFieldSet(this,_telephone,e)}},{key:"years_experience",get:function(){return _classPrivateFieldGet(this,_years_experience)},set:function(e){this.initialized?(0,Scorm12CMI.throwReadOnlyError)():_classPrivateFieldSet(this,_years_experience,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={city:this.city,class:this.class,company:this.company,country:this.country,experience:this.experience,familiar_name:this.familiar_name,instructor_name:this.instructor_name,title:this.title,native_language:this.native_language,state:this.state,street_address:this.street_address,telephone:this.telephone,years_experience:this.years_experience};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMIStudentDemographics=CMIStudentDemographics;var CMIPaths=function(e){function t(){return _classCallCheck(this,t),i.call(this,aicc_constants.paths_children)}_inherits(t,e);var i=_createSuper(t);return t}(_common.CMIArray);exports.CMIPaths=CMIPaths;var _location_id=new WeakMap,_date=new WeakMap,_time=new WeakMap,_status=new WeakMap,_why_left=new WeakMap,_time_in_element=new WeakMap,CMIPathsObject=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_location_id.set(_assertThisInitialized(e),{writable:!0,value:""}),_date.set(_assertThisInitialized(e),{writable:!0,value:""}),_time.set(_assertThisInitialized(e),{writable:!0,value:""}),_status.set(_assertThisInitialized(e),{writable:!0,value:""}),_why_left.set(_assertThisInitialized(e),{writable:!0,value:""}),_time_in_element.set(_assertThisInitialized(e),{writable:!0,value:""}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"location_id",get:function(){return _classPrivateFieldGet(this,_location_id)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMIString256)&&_classPrivateFieldSet(this,_location_id,e)}},{key:"date",get:function(){return _classPrivateFieldGet(this,_date)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMIString256)&&_classPrivateFieldSet(this,_date,e)}},{key:"time",get:function(){return _classPrivateFieldGet(this,_time)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMITime)&&_classPrivateFieldSet(this,_time,e)}},{key:"status",get:function(){return _classPrivateFieldGet(this,_status)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMIStatus2)&&_classPrivateFieldSet(this,_status,e)}},{key:"why_left",get:function(){return _classPrivateFieldGet(this,_why_left)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMIString256)&&_classPrivateFieldSet(this,_why_left,e)}},{key:"time_in_element",get:function(){return _classPrivateFieldGet(this,_time_in_element)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMITime)&&_classPrivateFieldSet(this,_time_in_element,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={location_id:this.location_id,date:this.date,time:this.time,status:this.status,why_left:this.why_left,time_in_element:this.time_in_element};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMIPathsObject=CMIPathsObject;var CMITries=function(e){function t(){return _classCallCheck(this,t),i.call(this,aicc_constants.tries_children)}_inherits(t,e);var i=_createSuper(t);return t}(_common.CMIArray);exports.CMITries=CMITries;var _status2=new WeakMap,_time2=new WeakMap,CMITriesObject=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_status2.set(_assertThisInitialized(e),{writable:!0,value:""}),_time2.set(_assertThisInitialized(e),{writable:!0,value:""}),e.score=new _common.CMIScore({score_children:aicc_constants.score_children,score_range:aicc_regex.score_range,invalidErrorCode:scorm12_error_codes.INVALID_SET_VALUE,invalidTypeCode:scorm12_error_codes.TYPE_MISMATCH,invalidRangeCode:scorm12_error_codes.VALUE_OUT_OF_RANGE}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"initialize",value:function(){var e;_get(_getPrototypeOf(t.prototype),"initialize",this).call(this),null===(e=this.score)||void 0===e||e.initialize()}},{key:"status",get:function(){return _classPrivateFieldGet(this,_status2)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMIStatus2)&&_classPrivateFieldSet(this,_status2,e)}},{key:"time",get:function(){return _classPrivateFieldGet(this,_time2)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMITime)&&_classPrivateFieldSet(this,_time2,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={status:this.status,time:this.time,score:this.score};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMITriesObject=CMITriesObject;var CMIAttemptRecords=function(e){function t(){return _classCallCheck(this,t),i.call(this,aicc_constants.attempt_records_children)}_inherits(t,e);var i=_createSuper(t);return t}(_common.CMIArray);exports.CMIAttemptRecords=CMIAttemptRecords;var _lesson_status=new WeakMap,CMIAttemptRecordsObject=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_lesson_status.set(_assertThisInitialized(e),{writable:!0,value:""}),e.score=new _common.CMIScore({score_children:aicc_constants.score_children,score_range:aicc_regex.score_range,invalidErrorCode:scorm12_error_codes.INVALID_SET_VALUE,invalidTypeCode:scorm12_error_codes.TYPE_MISMATCH,invalidRangeCode:scorm12_error_codes.VALUE_OUT_OF_RANGE}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"initialize",value:function(){var e;_get(_getPrototypeOf(t.prototype),"initialize",this).call(this),null===(e=this.score)||void 0===e||e.initialize()}},{key:"lesson_status",get:function(){return _classPrivateFieldGet(this,_lesson_status)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMIStatus2)&&_classPrivateFieldSet(this,_lesson_status,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={lesson_status:this.lesson_status,score:this.score};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMIAttemptRecordsObject=CMIAttemptRecordsObject;var _content=new WeakMap,_location=new WeakMap,_time3=new WeakMap,CMIEvaluationCommentsObject=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_content.set(_assertThisInitialized(e),{writable:!0,value:""}),_location.set(_assertThisInitialized(e),{writable:!0,value:""}),_time3.set(_assertThisInitialized(e),{writable:!0,value:""}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"content",get:function(){return _classPrivateFieldGet(this,_content)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMIString256)&&_classPrivateFieldSet(this,_content,e)}},{key:"location",get:function(){return _classPrivateFieldGet(this,_location)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMIString256)&&_classPrivateFieldSet(this,_location,e)}},{key:"time",get:function(){return _classPrivateFieldGet(this,_time3)},set:function(e){(0,Scorm12CMI.check12ValidFormat)(e,aicc_regex.CMITime)&&_classPrivateFieldSet(this,_time3,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={content:this.content,location:this.location,time:this.time};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMIEvaluationCommentsObject=CMIEvaluationCommentsObject;
},{"../constants/api_constants":10,"../constants/error_codes":11,"../constants/regex":13,"./common":7,"./scorm12_cmi":8}],7:[function(require,module,exports){
"use strict";function _typeof(e){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _inherits(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&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var i,r=_getPrototypeOf(e);if(t){var a=_getPrototypeOf(this).constructor;i=Reflect.construct(r,arguments,a)}else i=r.apply(this,arguments);return _possibleConstructorReturn(this,i)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,i){return t&&_defineProperties(e.prototype,t),i&&_defineProperties(e,i),e}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _classPrivateFieldSet(e,t,i){return _classApplyDescriptorSet(e,_classExtractFieldDescriptor(e,t,"set"),i),i}function _classApplyDescriptorSet(e,t,i){if(t.set)t.set.call(e,i);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=i}}function _classPrivateFieldGet(e,t){return _classApplyDescriptorGet(e,_classExtractFieldDescriptor(e,t,"get"))}function _classExtractFieldDescriptor(e,t,i){if(!t.has(e))throw new TypeError("attempted to "+i+" private field on non-instance");return t.get(e)}function _classApplyDescriptorGet(e,t){return t.get?t.get.call(e):t.value}function checkValidFormat(e,t,i,r){var a=new RegExp(t),s=e.match(a);if(r&&""===e)return!0;if(void 0===e||!s||""===s[0])throw new _exceptions.ValidationError(i);return!0}function checkValidRange(e,t,i){var r=t.split("#");if((e*=1)>=r[0]){if("*"===r[1]||e<=r[1])return!0;throw new _exceptions.ValidationError(i)}throw new _exceptions.ValidationError(i)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkValidFormat=checkValidFormat,exports.checkValidRange=checkValidRange,exports.CMIArray=exports.CMIScore=exports.BaseCMI=void 0;var _api_constants=_interopRequireDefault(require("../constants/api_constants")),_error_codes=_interopRequireDefault(require("../constants/error_codes")),_exceptions=require("../exceptions"),_regex=_interopRequireDefault(require("../constants/regex")),scorm12_constants=_api_constants.default.scorm12,scorm12_regex=_regex.default.scorm12,scorm12_error_codes=_error_codes.default.scorm12,_initialized=new WeakMap,_start_time=new WeakMap,BaseCMI=function(){function e(){if(_classCallCheck(this,e),_defineProperty(this,"jsonString",!1),_initialized.set(this,{writable:!0,value:!1}),_start_time.set(this,{writable:!0,value:void 0}),(this instanceof e?this.constructor:void 0)===e)throw new TypeError("Cannot construct BaseCMI instances directly")}return _createClass(e,[{key:"initialized",get:function(){return _classPrivateFieldGet(this,_initialized)}},{key:"start_time",get:function(){return _classPrivateFieldGet(this,_start_time)}},{key:"initialize",value:function(){_classPrivateFieldSet(this,_initialized,!0)}},{key:"setStartTime",value:function(){_classPrivateFieldSet(this,_start_time,(new Date).getTime())}}]),e}();exports.BaseCMI=BaseCMI;var _children2=new WeakMap,_score_range=new WeakMap,_invalid_error_code=new WeakMap,_invalid_type_code=new WeakMap,_invalid_range_code=new WeakMap,_decimal_regex=new WeakMap,_raw=new WeakMap,_min=new WeakMap,_max=new WeakMap,CMIScore=function(e){function t(e){var r,a=e.score_children,s=e.score_range,n=e.max,o=e.invalidErrorCode,l=e.invalidTypeCode,c=e.invalidRangeCode,_=e.decimalRegex;return _classCallCheck(this,t),r=i.call(this),_children2.set(_assertThisInitialized(r),{writable:!0,value:void 0}),_score_range.set(_assertThisInitialized(r),{writable:!0,value:void 0}),_invalid_error_code.set(_assertThisInitialized(r),{writable:!0,value:void 0}),_invalid_type_code.set(_assertThisInitialized(r),{writable:!0,value:void 0}),_invalid_range_code.set(_assertThisInitialized(r),{writable:!0,value:void 0}),_decimal_regex.set(_assertThisInitialized(r),{writable:!0,value:void 0}),_raw.set(_assertThisInitialized(r),{writable:!0,value:""}),_min.set(_assertThisInitialized(r),{writable:!0,value:""}),_max.set(_assertThisInitialized(r),{writable:!0,value:void 0}),_classPrivateFieldSet(_assertThisInitialized(r),_children2,a||scorm12_constants.score_children),_classPrivateFieldSet(_assertThisInitialized(r),_score_range,!!s&&scorm12_regex.score_range),_classPrivateFieldSet(_assertThisInitialized(r),_max,n||""===n?n:"100"),_classPrivateFieldSet(_assertThisInitialized(r),_invalid_error_code,o||scorm12_error_codes.INVALID_SET_VALUE),_classPrivateFieldSet(_assertThisInitialized(r),_invalid_type_code,l||scorm12_error_codes.TYPE_MISMATCH),_classPrivateFieldSet(_assertThisInitialized(r),_invalid_range_code,c||scorm12_error_codes.VALUE_OUT_OF_RANGE),_classPrivateFieldSet(_assertThisInitialized(r),_decimal_regex,_||scorm12_regex.CMIDecimal),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"_children",get:function(){return _classPrivateFieldGet(this,_children2)},set:function(e){throw new _exceptions.ValidationError(_classPrivateFieldGet(this,_invalid_error_code))}},{key:"raw",get:function(){return _classPrivateFieldGet(this,_raw)},set:function(e){!checkValidFormat(e,_classPrivateFieldGet(this,_decimal_regex),_classPrivateFieldGet(this,_invalid_type_code))||_classPrivateFieldGet(this,_score_range)&&!checkValidRange(e,_classPrivateFieldGet(this,_score_range),_classPrivateFieldGet(this,_invalid_range_code))||_classPrivateFieldSet(this,_raw,e)}},{key:"min",get:function(){return _classPrivateFieldGet(this,_min)},set:function(e){!checkValidFormat(e,_classPrivateFieldGet(this,_decimal_regex),_classPrivateFieldGet(this,_invalid_type_code))||_classPrivateFieldGet(this,_score_range)&&!checkValidRange(e,_classPrivateFieldGet(this,_score_range),_classPrivateFieldGet(this,_invalid_range_code))||_classPrivateFieldSet(this,_min,e)}},{key:"max",get:function(){return _classPrivateFieldGet(this,_max)},set:function(e){!checkValidFormat(e,_classPrivateFieldGet(this,_decimal_regex),_classPrivateFieldGet(this,_invalid_type_code))||_classPrivateFieldGet(this,_score_range)&&!checkValidRange(e,_classPrivateFieldGet(this,_score_range),_classPrivateFieldGet(this,_invalid_range_code))||_classPrivateFieldSet(this,_max,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={raw:this.raw,min:this.min,max:this.max};return delete this.jsonString,e}}]),t}(BaseCMI);exports.CMIScore=CMIScore;var _errorCode=new WeakMap,_children3=new WeakMap,CMIArray=function(e){function t(e){var r,a=e.children,s=e.errorCode;return _classCallCheck(this,t),r=i.call(this),_errorCode.set(_assertThisInitialized(r),{writable:!0,value:void 0}),_children3.set(_assertThisInitialized(r),{writable:!0,value:void 0}),_classPrivateFieldSet(_assertThisInitialized(r),_children3,a),_classPrivateFieldSet(_assertThisInitialized(r),_errorCode,s),r.childArray=[],r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"_children",get:function(){return _classPrivateFieldGet(this,_children3)},set:function(e){throw new _exceptions.ValidationError(_classPrivateFieldGet(this,_errorCode))}},{key:"_count",get:function(){return this.childArray.length},set:function(e){throw new _exceptions.ValidationError(_classPrivateFieldGet(this,_errorCode))}},{key:"toJSON",value:function(){this.jsonString=!0;for(var e={},t=0;t<this.childArray.length;t++)e[t+""]=this.childArray[t];return delete this.jsonString,e}}]),t}(BaseCMI);exports.CMIArray=CMIArray;
},{"../constants/api_constants":10,"../constants/error_codes":11,"../constants/regex":13,"../exceptions":15}],8:[function(require,module,exports){
"use strict";function _typeof(e){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!==_typeof(e)&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var i={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var n=r?Object.getOwnPropertyDescriptor(e,s):null;n&&(n.get||n.set)?Object.defineProperty(i,s,n):i[s]=e[s]}return i.default=e,t&&t.set(e,i),i}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,i){return t&&_defineProperties(e.prototype,t),i&&_defineProperties(e,i),e}function _get(e,t,i){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var r=_superPropBase(e,t);if(r){var s=Object.getOwnPropertyDescriptor(r,t);return s.get?s.get.call(i):s.value}})(e,t,i||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _inherits(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&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var i,r=_getPrototypeOf(e);if(t){var s=_getPrototypeOf(this).constructor;i=Reflect.construct(r,arguments,s)}else i=r.apply(this,arguments);return _possibleConstructorReturn(this,i)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _classPrivateFieldGet(e,t){return _classApplyDescriptorGet(e,_classExtractFieldDescriptor(e,t,"get"))}function _classApplyDescriptorGet(e,t){return t.get?t.get.call(e):t.value}function _classPrivateFieldSet(e,t,i){return _classApplyDescriptorSet(e,_classExtractFieldDescriptor(e,t,"set"),i),i}function _classExtractFieldDescriptor(e,t,i){if(!t.has(e))throw new TypeError("attempted to "+i+" private field on non-instance");return t.get(e)}function _classApplyDescriptorSet(e,t,i){if(t.set)t.set.call(e,i);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=i}}function throwReadOnlyError(){throw new _exceptions.ValidationError(scorm12_error_codes.READ_ONLY_ELEMENT)}function throwWriteOnlyError(){throw new _exceptions.ValidationError(scorm12_error_codes.WRITE_ONLY_ELEMENT)}function throwInvalidValueError(){throw new _exceptions.ValidationError(scorm12_error_codes.INVALID_SET_VALUE)}function check12ValidFormat(e,t,i){return(0,_common.checkValidFormat)(e,t,scorm12_error_codes.TYPE_MISMATCH,i)}function check12ValidRange(e,t,i){return(0,_common.checkValidRange)(e,t,scorm12_error_codes.VALUE_OUT_OF_RANGE,i)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.throwReadOnlyError=throwReadOnlyError,exports.throwWriteOnlyError=throwWriteOnlyError,exports.check12ValidFormat=check12ValidFormat,exports.check12ValidRange=check12ValidRange,exports.NAV=exports.CMIInteractionsCorrectResponsesObject=exports.CMIInteractionsObjectivesObject=exports.CMIObjectivesObject=exports.CMIInteractionsObject=exports.CMIStudentPreference=exports.CMIStudentData=exports.CMI=void 0;var _common=require("./common"),_api_constants=_interopRequireDefault(require("../constants/api_constants")),_error_codes=_interopRequireDefault(require("../constants/error_codes")),_regex=_interopRequireDefault(require("../constants/regex")),_exceptions=require("../exceptions"),Utilities=_interopRequireWildcard(require("../utilities")),Util=Utilities,scorm12_constants=_api_constants.default.scorm12,scorm12_regex=_regex.default.scorm12,scorm12_error_codes=_error_codes.default.scorm12,_children2=new WeakMap,_version2=new WeakMap,_launch_data=new WeakMap,_comments=new WeakMap,_comments_from_lms=new WeakMap,CMI=function(e){function t(e,r,s){var n;return _classCallCheck(this,t),n=i.call(this),_children2.set(_assertThisInitialized(n),{writable:!0,value:""}),_version2.set(_assertThisInitialized(n),{writable:!0,value:"3.4"}),_launch_data.set(_assertThisInitialized(n),{writable:!0,value:""}),_comments.set(_assertThisInitialized(n),{writable:!0,value:""}),_comments_from_lms.set(_assertThisInitialized(n),{writable:!0,value:""}),_defineProperty(_assertThisInitialized(n),"student_data",null),s&&n.initialize(),_classPrivateFieldSet(_assertThisInitialized(n),_children2,e||scorm12_constants.cmi_children),n.core=new CMICore,n.objectives=new CMIObjectives,n.student_data=r||new CMIStudentData,n.student_preference=new CMIStudentPreference,n.interactions=new CMIInteractions,n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"initialize",value:function(){var e,i,r,s,n;_get(_getPrototypeOf(t.prototype),"initialize",this).call(this),null===(e=this.core)||void 0===e||e.initialize(),null===(i=this.objectives)||void 0===i||i.initialize(),null===(r=this.student_data)||void 0===r||r.initialize(),null===(s=this.student_preference)||void 0===s||s.initialize(),null===(n=this.interactions)||void 0===n||n.initialize()}},{key:"toJSON",value:function(){this.jsonString=!0;var e={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 delete this.jsonString,e}},{key:"_version",get:function(){return _classPrivateFieldGet(this,_version2)},set:function(e){throwInvalidValueError()}},{key:"_children",get:function(){return _classPrivateFieldGet(this,_children2)},set:function(e){throwInvalidValueError()}},{key:"suspend_data",get:function(){var e;return null===(e=this.core)||void 0===e?void 0:e.suspend_data},set:function(e){this.core&&(this.core.suspend_data=e)}},{key:"launch_data",get:function(){return _classPrivateFieldGet(this,_launch_data)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_launch_data,e)}},{key:"comments",get:function(){return _classPrivateFieldGet(this,_comments)},set:function(e){check12ValidFormat(e,scorm12_regex.CMIString4096,!0)&&_classPrivateFieldSet(this,_comments,e)}},{key:"comments_from_lms",get:function(){return _classPrivateFieldGet(this,_comments_from_lms)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_comments_from_lms,e)}},{key:"getCurrentTotalTime",value:function(){return this.core.getCurrentTotalTime(this.start_time)}}]),t}(_common.BaseCMI);exports.CMI=CMI;var _children3=new WeakMap,_student_id=new WeakMap,_student_name=new WeakMap,_lesson_location=new WeakMap,_credit=new WeakMap,_lesson_status=new WeakMap,_entry=new WeakMap,_total_time=new WeakMap,_lesson_mode=new WeakMap,_exit=new WeakMap,_session_time=new WeakMap,_suspend_data=new WeakMap,CMICore=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_children3.set(_assertThisInitialized(e),{writable:!0,value:scorm12_constants.core_children}),_student_id.set(_assertThisInitialized(e),{writable:!0,value:""}),_student_name.set(_assertThisInitialized(e),{writable:!0,value:""}),_lesson_location.set(_assertThisInitialized(e),{writable:!0,value:""}),_credit.set(_assertThisInitialized(e),{writable:!0,value:""}),_lesson_status.set(_assertThisInitialized(e),{writable:!0,value:"not attempted"}),_entry.set(_assertThisInitialized(e),{writable:!0,value:""}),_total_time.set(_assertThisInitialized(e),{writable:!0,value:""}),_lesson_mode.set(_assertThisInitialized(e),{writable:!0,value:"normal"}),_exit.set(_assertThisInitialized(e),{writable:!0,value:""}),_session_time.set(_assertThisInitialized(e),{writable:!0,value:"00:00:00"}),_suspend_data.set(_assertThisInitialized(e),{writable:!0,value:""}),e.score=new _common.CMIScore({score_children:scorm12_constants.score_children,score_range:scorm12_regex.score_range,invalidErrorCode:scorm12_error_codes.INVALID_SET_VALUE,invalidTypeCode:scorm12_error_codes.TYPE_MISMATCH,invalidRangeCode:scorm12_error_codes.VALUE_OUT_OF_RANGE}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"initialize",value:function(){var e;_get(_getPrototypeOf(t.prototype),"initialize",this).call(this),null===(e=this.score)||void 0===e||e.initialize()}},{key:"_children",get:function(){return _classPrivateFieldGet(this,_children3)},set:function(e){throwInvalidValueError()}},{key:"student_id",get:function(){return _classPrivateFieldGet(this,_student_id)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_student_id,e)}},{key:"student_name",get:function(){return _classPrivateFieldGet(this,_student_name)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_student_name,e)}},{key:"lesson_location",get:function(){return _classPrivateFieldGet(this,_lesson_location)},set:function(e){check12ValidFormat(e,scorm12_regex.CMIString256,!0)&&_classPrivateFieldSet(this,_lesson_location,e)}},{key:"credit",get:function(){return _classPrivateFieldGet(this,_credit)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_credit,e)}},{key:"lesson_status",get:function(){return _classPrivateFieldGet(this,_lesson_status)},set:function(e){check12ValidFormat(e,scorm12_regex.CMIStatus2)&&_classPrivateFieldSet(this,_lesson_status,e)}},{key:"entry",get:function(){return _classPrivateFieldGet(this,_entry)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_entry,e)}},{key:"total_time",get:function(){return _classPrivateFieldGet(this,_total_time)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_total_time,e)}},{key:"lesson_mode",get:function(){return _classPrivateFieldGet(this,_lesson_mode)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_lesson_mode,e)}},{key:"exit",get:function(){return this.jsonString?_classPrivateFieldGet(this,_exit):throwWriteOnlyError()},set:function(e){check12ValidFormat(e,scorm12_regex.CMIExit,!0)&&_classPrivateFieldSet(this,_exit,e)}},{key:"session_time",get:function(){return this.jsonString?_classPrivateFieldGet(this,_session_time):throwWriteOnlyError()},set:function(e){check12ValidFormat(e,scorm12_regex.CMITimespan)&&_classPrivateFieldSet(this,_session_time,e)}},{key:"suspend_data",get:function(){return _classPrivateFieldGet(this,_suspend_data)},set:function(e){check12ValidFormat(e,scorm12_regex.CMIString4096,!0)&&_classPrivateFieldSet(this,_suspend_data,e)}},{key:"getCurrentTotalTime",value:function(e){var t=_classPrivateFieldGet(this,_session_time),i=e;if(void 0!==i&&null!==i){var r=(new Date).getTime()-i;t=Util.getSecondsAsHHMMSS(r/1e3)}return Utilities.addHHMMSSTimeStrings(_classPrivateFieldGet(this,_total_time),t,new RegExp(scorm12_regex.CMITimespan))}},{key:"toJSON",value:function(){this.jsonString=!0;var e={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 delete this.jsonString,e}}]),t}(_common.BaseCMI),CMIObjectives=function(e){function t(){return _classCallCheck(this,t),i.call(this,{children:scorm12_constants.objectives_children,errorCode:scorm12_error_codes.INVALID_SET_VALUE})}_inherits(t,e);var i=_createSuper(t);return t}(_common.CMIArray),_children4=new WeakMap,_mastery_score=new WeakMap,_max_time_allowed=new WeakMap,_time_limit_action=new WeakMap,CMIStudentData=function(e){function t(e){var r;return _classCallCheck(this,t),r=i.call(this),_children4.set(_assertThisInitialized(r),{writable:!0,value:void 0}),_mastery_score.set(_assertThisInitialized(r),{writable:!0,value:""}),_max_time_allowed.set(_assertThisInitialized(r),{writable:!0,value:""}),_time_limit_action.set(_assertThisInitialized(r),{writable:!0,value:""}),_classPrivateFieldSet(_assertThisInitialized(r),_children4,e||scorm12_constants.student_data_children),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"_children",get:function(){return _classPrivateFieldGet(this,_children4)},set:function(e){throwInvalidValueError()}},{key:"mastery_score",get:function(){return _classPrivateFieldGet(this,_mastery_score)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_mastery_score,e)}},{key:"max_time_allowed",get:function(){return _classPrivateFieldGet(this,_max_time_allowed)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_max_time_allowed,e)}},{key:"time_limit_action",get:function(){return _classPrivateFieldGet(this,_time_limit_action)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_time_limit_action,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={mastery_score:this.mastery_score,max_time_allowed:this.max_time_allowed,time_limit_action:this.time_limit_action};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMIStudentData=CMIStudentData;var _children5=new WeakMap,_audio=new WeakMap,_language=new WeakMap,_speed=new WeakMap,_text=new WeakMap,CMIStudentPreference=function(e){function t(e){var r;return _classCallCheck(this,t),r=i.call(this),_children5.set(_assertThisInitialized(r),{writable:!0,value:void 0}),_audio.set(_assertThisInitialized(r),{writable:!0,value:""}),_language.set(_assertThisInitialized(r),{writable:!0,value:""}),_speed.set(_assertThisInitialized(r),{writable:!0,value:""}),_text.set(_assertThisInitialized(r),{writable:!0,value:""}),_classPrivateFieldSet(_assertThisInitialized(r),_children5,e||scorm12_constants.student_preference_children),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"_children",get:function(){return _classPrivateFieldGet(this,_children5)},set:function(e){throwInvalidValueError()}},{key:"audio",get:function(){return _classPrivateFieldGet(this,_audio)},set:function(e){check12ValidFormat(e,scorm12_regex.CMISInteger)&&check12ValidRange(e,scorm12_regex.audio_range)&&_classPrivateFieldSet(this,_audio,e)}},{key:"language",get:function(){return _classPrivateFieldGet(this,_language)},set:function(e){check12ValidFormat(e,scorm12_regex.CMIString256)&&_classPrivateFieldSet(this,_language,e)}},{key:"speed",get:function(){return _classPrivateFieldGet(this,_speed)},set:function(e){check12ValidFormat(e,scorm12_regex.CMISInteger)&&check12ValidRange(e,scorm12_regex.speed_range)&&_classPrivateFieldSet(this,_speed,e)}},{key:"text",get:function(){return _classPrivateFieldGet(this,_text)},set:function(e){check12ValidFormat(e,scorm12_regex.CMISInteger)&&check12ValidRange(e,scorm12_regex.text_range)&&_classPrivateFieldSet(this,_text,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={audio:this.audio,language:this.language,speed:this.speed,text:this.text};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMIStudentPreference=CMIStudentPreference;var CMIInteractions=function(e){function t(){return _classCallCheck(this,t),i.call(this,{children:scorm12_constants.interactions_children,errorCode:scorm12_error_codes.INVALID_SET_VALUE})}_inherits(t,e);var i=_createSuper(t);return t}(_common.CMIArray),_id=new WeakMap,_time=new WeakMap,_type=new WeakMap,_weighting=new WeakMap,_student_response=new WeakMap,_result=new WeakMap,_latency=new WeakMap,CMIInteractionsObject=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_id.set(_assertThisInitialized(e),{writable:!0,value:""}),_time.set(_assertThisInitialized(e),{writable:!0,value:""}),_type.set(_assertThisInitialized(e),{writable:!0,value:""}),_weighting.set(_assertThisInitialized(e),{writable:!0,value:""}),_student_response.set(_assertThisInitialized(e),{writable:!0,value:""}),_result.set(_assertThisInitialized(e),{writable:!0,value:""}),_latency.set(_assertThisInitialized(e),{writable:!0,value:""}),e.objectives=new _common.CMIArray({errorCode:scorm12_error_codes.INVALID_SET_VALUE,children:scorm12_constants.objectives_children}),e.correct_responses=new _common.CMIArray({errorCode:scorm12_error_codes.INVALID_SET_VALUE,children:scorm12_constants.correct_responses_children}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"initialize",value:function(){var e,i;_get(_getPrototypeOf(t.prototype),"initialize",this).call(this),null===(e=this.objectives)||void 0===e||e.initialize(),null===(i=this.correct_responses)||void 0===i||i.initialize()}},{key:"id",get:function(){return this.jsonString?_classPrivateFieldGet(this,_id):throwWriteOnlyError()},set:function(e){check12ValidFormat(e,scorm12_regex.CMIIdentifier)&&_classPrivateFieldSet(this,_id,e)}},{key:"time",get:function(){return this.jsonString?_classPrivateFieldGet(this,_time):throwWriteOnlyError()},set:function(e){check12ValidFormat(e,scorm12_regex.CMITime)&&_classPrivateFieldSet(this,_time,e)}},{key:"type",get:function(){return this.jsonString?_classPrivateFieldGet(this,_type):throwWriteOnlyError()},set:function(e){check12ValidFormat(e,scorm12_regex.CMIType)&&_classPrivateFieldSet(this,_type,e)}},{key:"weighting",get:function(){return this.jsonString?_classPrivateFieldGet(this,_weighting):throwWriteOnlyError()},set:function(e){check12ValidFormat(e,scorm12_regex.CMIDecimal)&&check12ValidRange(e,scorm12_regex.weighting_range)&&_classPrivateFieldSet(this,_weighting,e)}},{key:"student_response",get:function(){return this.jsonString?_classPrivateFieldGet(this,_student_response):throwWriteOnlyError()},set:function(e){check12ValidFormat(e,scorm12_regex.CMIFeedback,!0)&&_classPrivateFieldSet(this,_student_response,e)}},{key:"result",get:function(){return this.jsonString?_classPrivateFieldGet(this,_result):throwWriteOnlyError()},set:function(e){check12ValidFormat(e,scorm12_regex.CMIResult)&&_classPrivateFieldSet(this,_result,e)}},{key:"latency",get:function(){return this.jsonString?_classPrivateFieldGet(this,_latency):throwWriteOnlyError()},set:function(e){check12ValidFormat(e,scorm12_regex.CMITimespan)&&_classPrivateFieldSet(this,_latency,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={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 delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMIInteractionsObject=CMIInteractionsObject;var _id2=new WeakMap,_status=new WeakMap,CMIObjectivesObject=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_id2.set(_assertThisInitialized(e),{writable:!0,value:""}),_status.set(_assertThisInitialized(e),{writable:!0,value:""}),e.score=new _common.CMIScore({score_children:scorm12_constants.score_children,score_range:scorm12_regex.score_range,invalidErrorCode:scorm12_error_codes.INVALID_SET_VALUE,invalidTypeCode:scorm12_error_codes.TYPE_MISMATCH,invalidRangeCode:scorm12_error_codes.VALUE_OUT_OF_RANGE}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"id",get:function(){return _classPrivateFieldGet(this,_id2)},set:function(e){check12ValidFormat(e,scorm12_regex.CMIIdentifier)&&_classPrivateFieldSet(this,_id2,e)}},{key:"status",get:function(){return _classPrivateFieldGet(this,_status)},set:function(e){check12ValidFormat(e,scorm12_regex.CMIStatus2)&&_classPrivateFieldSet(this,_status,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={id:this.id,status:this.status,score:this.score};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMIObjectivesObject=CMIObjectivesObject;var _id3=new WeakMap,CMIInteractionsObjectivesObject=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_id3.set(_assertThisInitialized(e),{writable:!0,value:""}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"id",get:function(){return _classPrivateFieldGet(this,_id3)},set:function(e){check12ValidFormat(e,scorm12_regex.CMIIdentifier)&&_classPrivateFieldSet(this,_id3,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={id:this.id};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMIInteractionsObjectivesObject=CMIInteractionsObjectivesObject;var _pattern=new WeakMap,CMIInteractionsCorrectResponsesObject=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_pattern.set(_assertThisInitialized(e),{writable:!0,value:""}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"pattern",get:function(){return this.jsonString?_classPrivateFieldGet(this,_pattern):throwWriteOnlyError()},set:function(e){check12ValidFormat(e,scorm12_regex.CMIFeedback,!0)&&_classPrivateFieldSet(this,_pattern,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={pattern:this.pattern};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMIInteractionsCorrectResponsesObject=CMIInteractionsCorrectResponsesObject;var _event=new WeakMap,NAV=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_event.set(_assertThisInitialized(e),{writable:!0,value:""}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"event",get:function(){return _classPrivateFieldGet(this,_event)},set:function(e){check12ValidFormat(e,scorm12_regex.NAVEvent)&&_classPrivateFieldSet(this,_event,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={event:this.event};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.NAV=NAV;
},{"../constants/api_constants":10,"../constants/error_codes":11,"../constants/regex":13,"../exceptions":15,"../utilities":17,"./common":7}],9:[function(require,module,exports){
"use strict";function _typeof(e){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!==_typeof(e)&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var i={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var n=r?Object.getOwnPropertyDescriptor(e,s):null;n&&(n.get||n.set)?Object.defineProperty(i,s,n):i[s]=e[s]}return i.default=e,t&&t.set(e,i),i}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,i){return t&&_defineProperties(e.prototype,t),i&&_defineProperties(e,i),e}function _get(e,t,i){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var r=_superPropBase(e,t);if(r){var s=Object.getOwnPropertyDescriptor(r,t);return s.get?s.get.call(i):s.value}})(e,t,i||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _inherits(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&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var i,r=_getPrototypeOf(e);if(t){var s=_getPrototypeOf(this).constructor;i=Reflect.construct(r,arguments,s)}else i=r.apply(this,arguments);return _possibleConstructorReturn(this,i)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _classPrivateFieldSet(e,t,i){return _classApplyDescriptorSet(e,_classExtractFieldDescriptor(e,t,"set"),i),i}function _classApplyDescriptorSet(e,t,i){if(t.set)t.set.call(e,i);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=i}}function _classPrivateFieldGet(e,t){return _classApplyDescriptorGet(e,_classExtractFieldDescriptor(e,t,"get"))}function _classExtractFieldDescriptor(e,t,i){if(!t.has(e))throw new TypeError("attempted to "+i+" private field on non-instance");return t.get(e)}function _classApplyDescriptorGet(e,t){return t.get?t.get.call(e):t.value}function throwReadOnlyError(){throw new _exceptions.ValidationError(scorm2004_error_codes.READ_ONLY_ELEMENT)}function throwWriteOnlyError(){throw new _exceptions.ValidationError(scorm2004_error_codes.WRITE_ONLY_ELEMENT)}function throwTypeMismatchError(){throw new _exceptions.ValidationError(scorm2004_error_codes.TYPE_MISMATCH)}function check2004ValidFormat(e,t,i){return(0,_common.checkValidFormat)(e,t,scorm2004_error_codes.TYPE_MISMATCH,i)}function check2004ValidRange(e,t){return(0,_common.checkValidRange)(e,t,scorm2004_error_codes.VALUE_OUT_OF_RANGE)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ADL=exports.CMIInteractionsCorrectResponsesObject=exports.CMIInteractionsObjectivesObject=exports.CMICommentsObject=exports.CMIObjectivesObject=exports.CMIInteractionsObject=exports.CMI=void 0;var _common=require("./common"),_api_constants=_interopRequireDefault(require("../constants/api_constants")),_regex=_interopRequireDefault(require("../constants/regex")),_error_codes=_interopRequireDefault(require("../constants/error_codes")),_response_constants=_interopRequireDefault(require("../constants/response_constants")),_exceptions=require("../exceptions"),Util=_interopRequireWildcard(require("../utilities")),scorm2004_constants=_api_constants.default.scorm2004,scorm2004_error_codes=_error_codes.default.scorm2004,learner_responses=_response_constants.default.learner,scorm2004_regex=_regex.default.scorm2004,_version2=new WeakMap,_children2=new WeakMap,_completion_status=new WeakMap,_completion_threshold=new WeakMap,_credit=new WeakMap,_entry=new WeakMap,_exit=new WeakMap,_launch_data=new WeakMap,_learner_id=new WeakMap,_learner_name=new WeakMap,_location=new WeakMap,_max_time_allowed=new WeakMap,_mode=new WeakMap,_progress_measure=new WeakMap,_scaled_passing_score=new WeakMap,_session_time=new WeakMap,_success_status=new WeakMap,_suspend_data=new WeakMap,_time_limit_action=new WeakMap,_total_time=new WeakMap,CMI=function(e){function t(e){var r;return _classCallCheck(this,t),r=i.call(this),_version2.set(_assertThisInitialized(r),{writable:!0,value:"1.0"}),_children2.set(_assertThisInitialized(r),{writable:!0,value:scorm2004_constants.cmi_children}),_completion_status.set(_assertThisInitialized(r),{writable:!0,value:"unknown"}),_completion_threshold.set(_assertThisInitialized(r),{writable:!0,value:""}),_credit.set(_assertThisInitialized(r),{writable:!0,value:"credit"}),_entry.set(_assertThisInitialized(r),{writable:!0,value:""}),_exit.set(_assertThisInitialized(r),{writable:!0,value:""}),_launch_data.set(_assertThisInitialized(r),{writable:!0,value:""}),_learner_id.set(_assertThisInitialized(r),{writable:!0,value:""}),_learner_name.set(_assertThisInitialized(r),{writable:!0,value:""}),_location.set(_assertThisInitialized(r),{writable:!0,value:""}),_max_time_allowed.set(_assertThisInitialized(r),{writable:!0,value:""}),_mode.set(_assertThisInitialized(r),{writable:!0,value:"normal"}),_progress_measure.set(_assertThisInitialized(r),{writable:!0,value:""}),_scaled_passing_score.set(_assertThisInitialized(r),{writable:!0,value:""}),_session_time.set(_assertThisInitialized(r),{writable:!0,value:"PT0H0M0S"}),_success_status.set(_assertThisInitialized(r),{writable:!0,value:"unknown"}),_suspend_data.set(_assertThisInitialized(r),{writable:!0,value:""}),_time_limit_action.set(_assertThisInitialized(r),{writable:!0,value:"continue,no message"}),_total_time.set(_assertThisInitialized(r),{writable:!0,value:""}),r.learner_preference=new CMILearnerPreference,r.score=new Scorm2004CMIScore,r.comments_from_learner=new CMICommentsFromLearner,r.comments_from_lms=new CMICommentsFromLMS,r.interactions=new CMIInteractions,r.objectives=new CMIObjectives,e&&r.initialize(),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"initialize",value:function(){var e,i,r,s,n,a;_get(_getPrototypeOf(t.prototype),"initialize",this).call(this),null===(e=this.learner_preference)||void 0===e||e.initialize(),null===(i=this.score)||void 0===i||i.initialize(),null===(r=this.comments_from_learner)||void 0===r||r.initialize(),null===(s=this.comments_from_lms)||void 0===s||s.initialize(),null===(n=this.interactions)||void 0===n||n.initialize(),null===(a=this.objectives)||void 0===a||a.initialize()}},{key:"_version",get:function(){return _classPrivateFieldGet(this,_version2)},set:function(e){throwReadOnlyError()}},{key:"_children",get:function(){return _classPrivateFieldGet(this,_children2)},set:function(e){throwReadOnlyError()}},{key:"completion_status",get:function(){return _classPrivateFieldGet(this,_completion_status)},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMICStatus)&&_classPrivateFieldSet(this,_completion_status,e)}},{key:"completion_threshold",get:function(){return _classPrivateFieldGet(this,_completion_threshold)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_completion_threshold,e)}},{key:"credit",get:function(){return _classPrivateFieldGet(this,_credit)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_credit,e)}},{key:"entry",get:function(){return _classPrivateFieldGet(this,_entry)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_entry,e)}},{key:"exit",get:function(){return this.jsonString?_classPrivateFieldGet(this,_exit):throwWriteOnlyError()},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMIExit,!0)&&_classPrivateFieldSet(this,_exit,e)}},{key:"launch_data",get:function(){return _classPrivateFieldGet(this,_launch_data)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_launch_data,e)}},{key:"learner_id",get:function(){return _classPrivateFieldGet(this,_learner_id)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_learner_id,e)}},{key:"learner_name",get:function(){return _classPrivateFieldGet(this,_learner_name)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_learner_name,e)}},{key:"location",get:function(){return _classPrivateFieldGet(this,_location)},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMIString1000)&&_classPrivateFieldSet(this,_location,e)}},{key:"max_time_allowed",get:function(){return _classPrivateFieldGet(this,_max_time_allowed)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_max_time_allowed,e)}},{key:"mode",get:function(){return _classPrivateFieldGet(this,_mode)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_mode,e)}},{key:"progress_measure",get:function(){return _classPrivateFieldGet(this,_progress_measure)},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMIDecimal)&&check2004ValidRange(e,scorm2004_regex.progress_range)&&_classPrivateFieldSet(this,_progress_measure,e)}},{key:"scaled_passing_score",get:function(){return _classPrivateFieldGet(this,_scaled_passing_score)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_scaled_passing_score,e)}},{key:"session_time",get:function(){return this.jsonString?_classPrivateFieldGet(this,_session_time):throwWriteOnlyError()},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMITimespan)&&_classPrivateFieldSet(this,_session_time,e)}},{key:"success_status",get:function(){return _classPrivateFieldGet(this,_success_status)},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMISStatus)&&_classPrivateFieldSet(this,_success_status,e)}},{key:"suspend_data",get:function(){return _classPrivateFieldGet(this,_suspend_data)},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMIString64000,!0)&&_classPrivateFieldSet(this,_suspend_data,e)}},{key:"time_limit_action",get:function(){return _classPrivateFieldGet(this,_time_limit_action)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_time_limit_action,e)}},{key:"total_time",get:function(){return _classPrivateFieldGet(this,_total_time)},set:function(e){this.initialized?throwReadOnlyError():_classPrivateFieldSet(this,_total_time,e)}},{key:"getCurrentTotalTime",value:function(){var e=_classPrivateFieldGet(this,_session_time),t=this.start_time;if(void 0!==t&&null!==t){var i=(new Date).getTime()-t;e=Util.getSecondsAsISODuration(i/1e3)}return Util.addTwoDurations(_classPrivateFieldGet(this,_total_time),e,scorm2004_regex.CMITimespan)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={comments_from_learner:this.comments_from_learner,comments_from_lms:this.comments_from_lms,completion_status:this.completion_status,completion_threshold:this.completion_threshold,credit:this.credit,entry:this.entry,exit:this.exit,interactions:this.interactions,launch_data:this.launch_data,learner_id:this.learner_id,learner_name:this.learner_name,learner_preference:this.learner_preference,location:this.location,max_time_allowed:this.max_time_allowed,mode:this.mode,objectives:this.objectives,progress_measure:this.progress_measure,scaled_passing_score:this.scaled_passing_score,score:this.score,session_time:this.session_time,success_status:this.success_status,suspend_data:this.suspend_data,time_limit_action:this.time_limit_action};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMI=CMI;var _children3=new WeakMap,_audio_level=new WeakMap,_language=new WeakMap,_delivery_speed=new WeakMap,_audio_captioning=new WeakMap,CMILearnerPreference=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_children3.set(_assertThisInitialized(e),{writable:!0,value:scorm2004_constants.student_preference_children}),_audio_level.set(_assertThisInitialized(e),{writable:!0,value:"1"}),_language.set(_assertThisInitialized(e),{writable:!0,value:""}),_delivery_speed.set(_assertThisInitialized(e),{writable:!0,value:"1"}),_audio_captioning.set(_assertThisInitialized(e),{writable:!0,value:"0"}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"_children",get:function(){return _classPrivateFieldGet(this,_children3)},set:function(e){throwReadOnlyError()}},{key:"audio_level",get:function(){return _classPrivateFieldGet(this,_audio_level)},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMIDecimal)&&check2004ValidRange(e,scorm2004_regex.audio_range)&&_classPrivateFieldSet(this,_audio_level,e)}},{key:"language",get:function(){return _classPrivateFieldGet(this,_language)},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMILang)&&_classPrivateFieldSet(this,_language,e)}},{key:"delivery_speed",get:function(){return _classPrivateFieldGet(this,_delivery_speed)},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMIDecimal)&&check2004ValidRange(e,scorm2004_regex.speed_range)&&_classPrivateFieldSet(this,_delivery_speed,e)}},{key:"audio_captioning",get:function(){return _classPrivateFieldGet(this,_audio_captioning)},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMISInteger)&&check2004ValidRange(e,scorm2004_regex.text_range)&&_classPrivateFieldSet(this,_audio_captioning,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={audio_level:this.audio_level,language:this.language,delivery_speed:this.delivery_speed,audio_captioning:this.audio_captioning};return delete this.jsonString,e}}]),t}(_common.BaseCMI),CMIInteractions=function(e){function t(){return _classCallCheck(this,t),i.call(this,{children:scorm2004_constants.interactions_children,errorCode:scorm2004_error_codes.READ_ONLY_ELEMENT})}_inherits(t,e);var i=_createSuper(t);return t}(_common.CMIArray),CMIObjectives=function(e){function t(){return _classCallCheck(this,t),i.call(this,{children:scorm2004_constants.objectives_children,errorCode:scorm2004_error_codes.READ_ONLY_ELEMENT})}_inherits(t,e);var i=_createSuper(t);return t}(_common.CMIArray),CMICommentsFromLMS=function(e){function t(){return _classCallCheck(this,t),i.call(this,{children:scorm2004_constants.comments_children,errorCode:scorm2004_error_codes.READ_ONLY_ELEMENT})}_inherits(t,e);var i=_createSuper(t);return t}(_common.CMIArray),CMICommentsFromLearner=function(e){function t(){return _classCallCheck(this,t),i.call(this,{children:scorm2004_constants.comments_children,errorCode:scorm2004_error_codes.READ_ONLY_ELEMENT})}_inherits(t,e);var i=_createSuper(t);return t}(_common.CMIArray),_id=new WeakMap,_type=new WeakMap,_timestamp=new WeakMap,_weighting=new WeakMap,_learner_response=new WeakMap,_result=new WeakMap,_latency=new WeakMap,_description=new WeakMap,CMIInteractionsObject=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_id.set(_assertThisInitialized(e),{writable:!0,value:""}),_type.set(_assertThisInitialized(e),{writable:!0,value:""}),_timestamp.set(_assertThisInitialized(e),{writable:!0,value:""}),_weighting.set(_assertThisInitialized(e),{writable:!0,value:""}),_learner_response.set(_assertThisInitialized(e),{writable:!0,value:""}),_result.set(_assertThisInitialized(e),{writable:!0,value:""}),_latency.set(_assertThisInitialized(e),{writable:!0,value:""}),_description.set(_assertThisInitialized(e),{writable:!0,value:""}),e.objectives=new _common.CMIArray({errorCode:scorm2004_error_codes.READ_ONLY_ELEMENT,children:scorm2004_constants.objectives_children}),e.correct_responses=new _common.CMIArray({errorCode:scorm2004_error_codes.READ_ONLY_ELEMENT,children:scorm2004_constants.correct_responses_children}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"initialize",value:function(){var e,i;_get(_getPrototypeOf(t.prototype),"initialize",this).call(this),null===(e=this.objectives)||void 0===e||e.initialize(),null===(i=this.correct_responses)||void 0===i||i.initialize()}},{key:"id",get:function(){return _classPrivateFieldGet(this,_id)},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMILongIdentifier)&&_classPrivateFieldSet(this,_id,e)}},{key:"type",get:function(){return _classPrivateFieldGet(this,_type)},set:function(e){if(this.initialized&&""===_classPrivateFieldGet(this,_id))throw new _exceptions.ValidationError(scorm2004_error_codes.DEPENDENCY_NOT_ESTABLISHED);check2004ValidFormat(e,scorm2004_regex.CMIType)&&_classPrivateFieldSet(this,_type,e)}},{key:"timestamp",get:function(){return _classPrivateFieldGet(this,_timestamp)},set:function(e){if(this.initialized&&""===_classPrivateFieldGet(this,_id))throw new _exceptions.ValidationError(scorm2004_error_codes.DEPENDENCY_NOT_ESTABLISHED);check2004ValidFormat(e,scorm2004_regex.CMITime)&&_classPrivateFieldSet(this,_timestamp,e)}},{key:"weighting",get:function(){return _classPrivateFieldGet(this,_weighting)},set:function(e){if(this.initialized&&""===_classPrivateFieldGet(this,_id))throw new _exceptions.ValidationError(scorm2004_error_codes.DEPENDENCY_NOT_ESTABLISHED);check2004ValidFormat(e,scorm2004_regex.CMIDecimal)&&_classPrivateFieldSet(this,_weighting,e)}},{key:"learner_response",get:function(){return _classPrivateFieldGet(this,_learner_response)},set:function(e){if(this.initialized&&(""===_classPrivateFieldGet(this,_type)||""===_classPrivateFieldGet(this,_id)))throw new _exceptions.ValidationError(scorm2004_error_codes.DEPENDENCY_NOT_ESTABLISHED);var t=[],i=learner_responses[this.type];if(!i)throw new _exceptions.ValidationError(scorm2004_error_codes.TYPE_MISMATCH);if(null!==i&&void 0!==i&&i.delimiter?t=e.split(i.delimiter):t[0]=e,!(t.length>0&&t.length<=i.max))throw new _exceptions.ValidationError(scorm2004_error_codes.GENERAL_SET_FAILURE);for(var r=new RegExp(i.format),s=0;s<t.length;s++)if(null!==i&&void 0!==i&&i.delimiter2){var n=t[s].split(i.delimiter2);2===n.length&&n[0].match(r)?n[1].match(new RegExp(i.format2))||throwTypeMismatchError():throwTypeMismatchError()}else if(t[s].match(r)){if(""!==t[s]&&i.unique)for(var a=0;a<s;a++)t[s]===t[a]&&throwTypeMismatchError()}else throwTypeMismatchError();_classPrivateFieldSet(this,_learner_response,e)}},{key:"result",get:function(){return _classPrivateFieldGet(this,_result)},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMIResult)&&_classPrivateFieldSet(this,_result,e)}},{key:"latency",get:function(){return _classPrivateFieldGet(this,_latency)},set:function(e){if(this.initialized&&""===_classPrivateFieldGet(this,_id))throw new _exceptions.ValidationError(scorm2004_error_codes.DEPENDENCY_NOT_ESTABLISHED);check2004ValidFormat(e,scorm2004_regex.CMITimespan)&&_classPrivateFieldSet(this,_latency,e)}},{key:"description",get:function(){return _classPrivateFieldGet(this,_description)},set:function(e){if(this.initialized&&""===_classPrivateFieldGet(this,_id))throw new _exceptions.ValidationError(scorm2004_error_codes.DEPENDENCY_NOT_ESTABLISHED);check2004ValidFormat(e,scorm2004_regex.CMILangString250,!0)&&_classPrivateFieldSet(this,_description,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={id:this.id,type:this.type,objectives:this.objectives,timestamp:this.timestamp,weighting:this.weighting,learner_response:this.learner_response,result:this.result,latency:this.latency,description:this.description,correct_responses:this.correct_responses};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMIInteractionsObject=CMIInteractionsObject;var _id2=new WeakMap,_success_status2=new WeakMap,_completion_status2=new WeakMap,_progress_measure2=new WeakMap,_description2=new WeakMap,CMIObjectivesObject=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_id2.set(_assertThisInitialized(e),{writable:!0,value:""}),_success_status2.set(_assertThisInitialized(e),{writable:!0,value:"unknown"}),_completion_status2.set(_assertThisInitialized(e),{writable:!0,value:"unknown"}),_progress_measure2.set(_assertThisInitialized(e),{writable:!0,value:""}),_description2.set(_assertThisInitialized(e),{writable:!0,value:""}),e.score=new Scorm2004CMIScore,e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"initialize",value:function(){var e;_get(_getPrototypeOf(t.prototype),"initialize",this).call(this),null===(e=this.score)||void 0===e||e.initialize()}},{key:"id",get:function(){return _classPrivateFieldGet(this,_id2)},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMILongIdentifier)&&_classPrivateFieldSet(this,_id2,e)}},{key:"success_status",get:function(){return _classPrivateFieldGet(this,_success_status2)},set:function(e){if(this.initialized&&""===_classPrivateFieldGet(this,_id2))throw new _exceptions.ValidationError(scorm2004_error_codes.DEPENDENCY_NOT_ESTABLISHED);check2004ValidFormat(e,scorm2004_regex.CMISStatus)&&_classPrivateFieldSet(this,_success_status2,e)}},{key:"completion_status",get:function(){return _classPrivateFieldGet(this,_completion_status2)},set:function(e){if(this.initialized&&""===_classPrivateFieldGet(this,_id2))throw new _exceptions.ValidationError(scorm2004_error_codes.DEPENDENCY_NOT_ESTABLISHED);check2004ValidFormat(e,scorm2004_regex.CMICStatus)&&_classPrivateFieldSet(this,_completion_status2,e)}},{key:"progress_measure",get:function(){return _classPrivateFieldGet(this,_progress_measure2)},set:function(e){if(this.initialized&&""===_classPrivateFieldGet(this,_id2))throw new _exceptions.ValidationError(scorm2004_error_codes.DEPENDENCY_NOT_ESTABLISHED);check2004ValidFormat(e,scorm2004_regex.CMIDecimal)&&check2004ValidRange(e,scorm2004_regex.progress_range)&&_classPrivateFieldSet(this,_progress_measure2,e)}},{key:"description",get:function(){return _classPrivateFieldGet(this,_description2)},set:function(e){if(this.initialized&&""===_classPrivateFieldGet(this,_id2))throw new _exceptions.ValidationError(scorm2004_error_codes.DEPENDENCY_NOT_ESTABLISHED);check2004ValidFormat(e,scorm2004_regex.CMILangString250,!0)&&_classPrivateFieldSet(this,_description2,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={id:this.id,success_status:this.success_status,completion_status:this.completion_status,progress_measure:this.progress_measure,description:this.description,score:this.score};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMIObjectivesObject=CMIObjectivesObject;var _scaled=new WeakMap,Scorm2004CMIScore=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this,{score_children:scorm2004_constants.score_children,max:"",invalidErrorCode:scorm2004_error_codes.READ_ONLY_ELEMENT,invalidTypeCode:scorm2004_error_codes.TYPE_MISMATCH,invalidRangeCode:scorm2004_error_codes.VALUE_OUT_OF_RANGE,decimalRegex:scorm2004_regex.CMIDecimal}),_scaled.set(_assertThisInitialized(e),{writable:!0,value:""}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"scaled",get:function(){return _classPrivateFieldGet(this,_scaled)},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMIDecimal)&&check2004ValidRange(e,scorm2004_regex.scaled_range)&&_classPrivateFieldSet(this,_scaled,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={scaled:this.scaled,raw:_get(_getPrototypeOf(t.prototype),"raw",this),min:_get(_getPrototypeOf(t.prototype),"min",this),max:_get(_getPrototypeOf(t.prototype),"max",this)};return delete this.jsonString,e}}]),t}(_common.CMIScore),_comment=new WeakMap,_location2=new WeakMap,_timestamp2=new WeakMap,_readOnlyAfterInit=new WeakMap,CMICommentsObject=function(e){function t(){var e,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return _classCallCheck(this,t),e=i.call(this),_comment.set(_assertThisInitialized(e),{writable:!0,value:""}),_location2.set(_assertThisInitialized(e),{writable:!0,value:""}),_timestamp2.set(_assertThisInitialized(e),{writable:!0,value:""}),_readOnlyAfterInit.set(_assertThisInitialized(e),{writable:!0,value:void 0}),_classPrivateFieldSet(_assertThisInitialized(e),_comment,""),_classPrivateFieldSet(_assertThisInitialized(e),_location2,""),_classPrivateFieldSet(_assertThisInitialized(e),_timestamp2,""),_classPrivateFieldSet(_assertThisInitialized(e),_readOnlyAfterInit,r),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"comment",get:function(){return _classPrivateFieldGet(this,_comment)},set:function(e){this.initialized&&_classPrivateFieldGet(this,_readOnlyAfterInit)?throwReadOnlyError():check2004ValidFormat(e,scorm2004_regex.CMILangString4000,!0)&&_classPrivateFieldSet(this,_comment,e)}},{key:"location",get:function(){return _classPrivateFieldGet(this,_location2)},set:function(e){this.initialized&&_classPrivateFieldGet(this,_readOnlyAfterInit)?throwReadOnlyError():check2004ValidFormat(e,scorm2004_regex.CMIString250)&&_classPrivateFieldSet(this,_location2,e)}},{key:"timestamp",get:function(){return _classPrivateFieldGet(this,_timestamp2)},set:function(e){this.initialized&&_classPrivateFieldGet(this,_readOnlyAfterInit)?throwReadOnlyError():check2004ValidFormat(e,scorm2004_regex.CMITime)&&_classPrivateFieldSet(this,_timestamp2,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={comment:this.comment,location:this.location,timestamp:this.timestamp};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMICommentsObject=CMICommentsObject;var _id3=new WeakMap,CMIInteractionsObjectivesObject=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_id3.set(_assertThisInitialized(e),{writable:!0,value:""}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"id",get:function(){return _classPrivateFieldGet(this,_id3)},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMILongIdentifier)&&_classPrivateFieldSet(this,_id3,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={id:this.id};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMIInteractionsObjectivesObject=CMIInteractionsObjectivesObject;var _pattern=new WeakMap,CMIInteractionsCorrectResponsesObject=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_pattern.set(_assertThisInitialized(e),{writable:!0,value:""}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"pattern",get:function(){return _classPrivateFieldGet(this,_pattern)},set:function(e){check2004ValidFormat(e,scorm2004_regex.CMIFeedback)&&_classPrivateFieldSet(this,_pattern,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={pattern:this.pattern};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.CMIInteractionsCorrectResponsesObject=CMIInteractionsCorrectResponsesObject;var ADL=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),e.nav=new ADLNav,e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"initialize",value:function(){var e;_get(_getPrototypeOf(t.prototype),"initialize",this).call(this),null===(e=this.nav)||void 0===e||e.initialize()}},{key:"toJSON",value:function(){this.jsonString=!0;var e={nav:this.nav};return delete this.jsonString,e}}]),t}(_common.BaseCMI);exports.ADL=ADL;var _request=new WeakMap,ADLNav=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_request.set(_assertThisInitialized(e),{writable:!0,value:"_none_"}),e.request_valid=new ADLNavRequestValid,e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"initialize",value:function(){var e;_get(_getPrototypeOf(t.prototype),"initialize",this).call(this),null===(e=this.request_valid)||void 0===e||e.initialize()}},{key:"request",get:function(){return _classPrivateFieldGet(this,_request)},set:function(e){check2004ValidFormat(e,scorm2004_regex.NAVEvent)&&_classPrivateFieldSet(this,_request,e)}},{key:"toJSON",value:function(){this.jsonString=!0;var e={request:this.request};return delete this.jsonString,e}}]),t}(_common.BaseCMI),_continue=new WeakMap,_previous=new WeakMap,ADLNavRequestValid=function(e){function t(){var e;return _classCallCheck(this,t),e=i.call(this),_continue.set(_assertThisInitialized(e),{writable:!0,value:"unknown"}),_previous.set(_assertThisInitialized(e),{writable:!0,value:"unknown"}),_defineProperty(_assertThisInitialized(e),"choice",function e(){_classCallCheck(this,e),_defineProperty(this,"_isTargetValid",function(e){return"unknown"})}),_defineProperty(_assertThisInitialized(e),"jump",function e(){_classCallCheck(this,e),_defineProperty(this,"_isTargetValid",function(e){return"unknown"})}),e}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"continue",get:function(){return _classPrivateFieldGet(this,_continue)},set:function(e){throwReadOnlyError()}},{key:"previous",get:function(){return _classPrivateFieldGet(this,_previous)},set:function(e){throwReadOnlyError()}},{key:"toJSON",value:function(){this.jsonString=!0;var e={previous:this.previous,continue:this.continue};return delete this.jsonString,e}}]),t}(_common.BaseCMI);
},{"../constants/api_constants":10,"../constants/error_codes":11,"../constants/regex":13,"../constants/response_constants":14,"../exceptions":15,"../utilities":17,"./common":7}],10:[function(require,module,exports){
"use strict";function ownKeys(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);a&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,i)}return t}function _objectSpread(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?ownKeys(Object(t),!0).forEach(function(a){_defineProperty(e,a,t[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))})}return e}function _defineProperty(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var global={SCORM_TRUE:"true",SCORM_FALSE:"false",STATE_NOT_INITIALIZED:0,STATE_INITIALIZED:1,STATE_TERMINATED:2,LOG_LEVEL_DEBUG:1,LOG_LEVEL_INFO:2,LOG_LEVEL_WARNING:3,LOG_LEVEL_ERROR:4,LOG_LEVEL_NONE:5},scorm12={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",comments_children:"content,location,time",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:{101:{basicMessage:"General Exception",detailMessage:"No specific error code exists to describe the error. Use LMSGetDiagnostic for more information"},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."}}},aicc=_objectSpread(_objectSpread({},scorm12),{cmi_children:"core,suspend_data,launch_data,comments,objectives,student_data,student_preference,interactions,evaluation",student_preference_children:"audio,language,lesson_type,speed,text,text_color,text_location,text_size,video,windows",student_data_children:"attempt_number,tries,mastery_score,max_time_allowed,time_limit_action",student_demographics_children:"city,class,company,country,experience,familiar_name,instructor_name,title,native_language,state,street_address,telephone,years_experience",tries_children:"time,status,score",attempt_records_children:"score,lesson_status",paths_children:"location_id,date,time,status,why_left,time_in_element"}),scorm2004={cmi_children:"_version,comments_from_learner,comments_from_lms,completion_status,credit,entry,exit,interactions,launch_data,learner_id,learner_name,learner_preference,location,max_time_allowed,mode,objectives,progress_measure,scaled_passing_score,score,session_time,success_status,suspend_data,time_limit_action,total_time",comments_children:"comment,timestamp,location",score_children:"max,raw,scaled,min",objectives_children:"progress_measure,completion_status,success_status,description,score,id",correct_responses_children:"pattern",student_data_children:"mastery_score,max_time_allowed,time_limit_action",student_preference_children:"audio_level,audio_captioning,delivery_speed,language",interactions_children:"id,type,objectives,timestamp,correct_responses,weighting,learner_response,result,latency,description",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. Use GetDiagnostic for more information."},102:{basicMessage:"General Initialization Failure",detailMessage:"Call to Initialize failed for an unknown reason."},103:{basicMessage:"Already Initialized",detailMessage:"Call to Initialize failed because Initialize was already called."},104:{basicMessage:"Content Instance Terminated",detailMessage:"Call to Initialize failed because Terminate was already called."},111:{basicMessage:"General Termination Failure",detailMessage:"Call to Terminate failed for an unknown reason."},112:{basicMessage:"Termination Before Initialization",detailMessage:"Call to Terminate failed because it was made before the call to Initialize."},113:{basicMessage:"Termination After Termination",detailMessage:"Call to Terminate failed because Terminate was already called."},122:{basicMessage:"Retrieve Data Before Initialization",detailMessage:"Call to GetValue failed because it was made before the call to Initialize."},123:{basicMessage:"Retrieve Data After Termination",detailMessage:"Call to GetValue failed because it was made after the call to Terminate."},132:{basicMessage:"Store Data Before Initialization",detailMessage:"Call to SetValue failed because it was made before the call to Initialize."},133:{basicMessage:"Store Data After Termination",detailMessage:"Call to SetValue failed because it was made after the call to Terminate."},142:{basicMessage:"Commit Before Initialization",detailMessage:"Call to Commit failed because it was made before the call to Initialize."},143:{basicMessage:"Commit After Termination",detailMessage:"Call to Commit failed because it was made after the call to Terminate."},201:{basicMessage:"General Argument Error",detailMessage:"An invalid argument was passed to an API method (usually indicates that Initialize, Commit or Terminate did not receive the expected empty string argument."},301:{basicMessage:"General Get Failure",detailMessage:"Indicates a failed GetValue call where no other specific error code is applicable. Use GetDiagnostic for more information."},351:{basicMessage:"General Set Failure",detailMessage:"Indicates a failed SetValue call where no other specific error code is applicable. Use GetDiagnostic for more information."},391:{basicMessage:"General Commit Failure",detailMessage:"Indicates a failed Commit call where no other specific error code is applicable. Use GetDiagnostic for more information."},401:{basicMessage:"Undefined Data Model Element",detailMessage:"The data model element name passed to GetValue or SetValue is not a valid SCORM data model element."},402:{basicMessage:"Unimplemented Data Model Element",detailMessage:"The data model element indicated in a call to GetValue or SetValue is valid, but was not implemented by this LMS. In SCORM 2004, this error would indicate an LMS that is not fully SCORM conformant."},403:{basicMessage:"Data Model Element Value Not Initialized",detailMessage:"Attempt to read a data model element that has not been initialized by the LMS or through a SetValue call. This error condition is often reached during normal execution of a SCO."},404:{basicMessage:"Data Model Element Is Read Only",detailMessage:"SetValue was called with a data model element that can only be read."},405:{basicMessage:"Data Model Element Is Write Only",detailMessage:"GetValue was called on a data model element that can only be written to."},406:{basicMessage:"Data Model Element Type Mismatch",detailMessage:"SetValue was called with a value that is not consistent with the data format of the supplied data model element."},407:{basicMessage:"Data Model Element Value Out Of Range",detailMessage:"The numeric value supplied to a SetValue call is outside of the numeric range allowed for the supplied data model element."},408:{basicMessage:"Data Model Dependency Not Established",detailMessage:"Some data model elements cannot be set until another data model element was set. This error condition indicates that the prerequisite element was not set before the dependent element."}}},APIConstants={global:global,scorm12:scorm12,aicc:aicc,scorm2004:scorm2004},_default=APIConstants;exports.default=_default;
},{}],11:[function(require,module,exports){
"use strict";function ownKeys(E,_){var T=Object.keys(E);if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(E);_&&(I=I.filter(function(_){return Object.getOwnPropertyDescriptor(E,_).enumerable})),T.push.apply(T,I)}return T}function _objectSpread(E){for(var _=1;_<arguments.length;_++){var T=null!=arguments[_]?arguments[_]:{};_%2?ownKeys(Object(T),!0).forEach(function(_){_defineProperty(E,_,T[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(E,Object.getOwnPropertyDescriptors(T)):ownKeys(Object(T)).forEach(function(_){Object.defineProperty(E,_,Object.getOwnPropertyDescriptor(T,_))})}return E}function _defineProperty(E,_,T){return _ in E?Object.defineProperty(E,_,{value:T,enumerable:!0,configurable:!0,writable:!0}):E[_]=T,E}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var global={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},scorm12=_objectSpread(_objectSpread({},global),{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:407,DEPENDENCY_NOT_ESTABLISHED:408}),scorm2004=_objectSpread(_objectSpread({},global),{INITIALIZATION_FAILED:102,INITIALIZED:103,TERMINATED:104,TERMINATION_FAILURE:111,TERMINATION_BEFORE_INIT:112,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}),ErrorCodes={scorm12:scorm12,scorm2004:scorm2004},_default=ErrorCodes;exports.default=_default;
},{}],12:[function(require,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var ValidLanguages={aa:"aa",ab:"ab",ae:"ae",af:"af",ak:"ak",am:"am",an:"an",ar:"ar",as:"as",av:"av",ay:"ay",az:"az",ba:"ba",be:"be",bg:"bg",bh:"bh",bi:"bi",bm:"bm",bn:"bn",bo:"bo",br:"br",bs:"bs",ca:"ca",ce:"ce",ch:"ch",co:"co",cr:"cr",cs:"cs",cu:"cu",cv:"cv",cy:"cy",da:"da",de:"de",dv:"dv",dz:"dz",ee:"ee",el:"el",en:"en",eo:"eo",es:"es",et:"et",eu:"eu",fa:"fa",ff:"ff",fi:"fi",fj:"fj",fo:"fo",fr:"fr",fy:"fy",ga:"ga",gd:"gd",gl:"gl",gn:"gn",gu:"gu",gv:"gv",ha:"ha",he:"he",hi:"hi",ho:"ho",hr:"hr",ht:"ht",hu:"hu",hy:"hy",hz:"hz",ia:"ia",id:"id",ie:"ie",ig:"ig",ii:"ii",ik:"ik",io:"io",is:"is",it:"it",iu:"iu",ja:"ja",jv:"jv",ka:"ka",kg:"kg",ki:"ki",kj:"kj",kk:"kk",kl:"kl",km:"km",kn:"kn",ko:"ko",kr:"kr",ks:"ks",ku:"ku",kv:"kv",kw:"kw",ky:"ky",la:"la",lb:"lb",lg:"lg",li:"li",ln:"ln",lo:"lo",lt:"lt",lu:"lu",lv:"lv",mg:"mg",mh:"mh",mi:"mi",mk:"mk",ml:"ml",mn:"mn",mo:"mo",mr:"mr",ms:"ms",mt:"mt",my:"my",na:"na",nb:"nb",nd:"nd",ne:"ne",ng:"ng",nl:"nl",nn:"nn",no:"no",nr:"nr",nv:"nv",ny:"ny",oc:"oc",oj:"oj",om:"om",or:"or",os:"os",pa:"pa",pi:"pi",pl:"pl",ps:"ps",pt:"pt",qu:"qu",rm:"rm",rn:"rn",ro:"ro",ru:"ru",rw:"rw",sa:"sa",sc:"sc",sd:"sd",se:"se",sg:"sg",sh:"sh",si:"si",sk:"sk",sl:"sl",sm:"sm",sn:"sn",so:"so",sq:"sq",sr:"sr",ss:"ss",st:"st",su:"su",sv:"sv",sw:"sw",ta:"ta",te:"te",tg:"tg",th:"th",ti:"ti",tk:"tk",tl:"tl",tn:"tn",to:"to",tr:"tr",ts:"ts",tt:"tt",tw:"tw",ty:"ty",ug:"ug",uk:"uk",ur:"ur",uz:"uz",ve:"ve",vi:"vi",vo:"vo",wa:"wa",wo:"wo",xh:"xh",yi:"yi",yo:"yo",za:"za",zh:"zh",zu:"zu",aar:"aar",abk:"abk",ave:"ave",afr:"afr",aka:"aka",amh:"amh",arg:"arg",ara:"ara",asm:"asm",ava:"ava",aym:"aym",aze:"aze",bak:"bak",bel:"bel",bul:"bul",bih:"bih",bis:"bis",bam:"bam",ben:"ben",tib:"tib",bod:"bod",bre:"bre",bos:"bos",cat:"cat",che:"che",cha:"cha",cos:"cos",cre:"cre",cze:"cze",ces:"ces",chu:"chu",chv:"chv",wel:"wel",cym:"cym",dan:"dan",ger:"ger",deu:"deu",div:"div",dzo:"dzo",ewe:"ewe",gre:"gre",ell:"ell",eng:"eng",epo:"epo",spa:"spa",est:"est",baq:"baq",eus:"eus",per:"per",fas:"fas",ful:"ful",fin:"fin",fij:"fij",fao:"fao",fre:"fre",fra:"fra",fry:"fry",gle:"gle",gla:"gla",glg:"glg",grn:"grn",guj:"guj",glv:"glv",hau:"hau",heb:"heb",hin:"hin",hmo:"hmo",hrv:"hrv",hat:"hat",hun:"hun",arm:"arm",hye:"hye",her:"her",ina:"ina",ind:"ind",ile:"ile",ibo:"ibo",iii:"iii",ipk:"ipk",ido:"ido",ice:"ice",isl:"isl",ita:"ita",iku:"iku",jpn:"jpn",jav:"jav",geo:"geo",kat:"kat",kon:"kon",kik:"kik",kua:"kua",kaz:"kaz",kal:"kal",khm:"khm",kan:"kan",kor:"kor",kau:"kau",kas:"kas",kur:"kur",kom:"kom",cor:"cor",kir:"kir",lat:"lat",ltz:"ltz",lug:"lug",lim:"lim",lin:"lin",lao:"lao",lit:"lit",lub:"lub",lav:"lav",mlg:"mlg",mah:"mah",mao:"mao",mri:"mri",mac:"mac",mkd:"mkd",mal:"mal",mon:"mon",mol:"mol",mar:"mar",may:"may",msa:"msa",mlt:"mlt",bur:"bur",mya:"mya",nau:"nau",nob:"nob",nde:"nde",nep:"nep",ndo:"ndo",dut:"dut",nld:"nld",nno:"nno",nor:"nor",nbl:"nbl",nav:"nav",nya:"nya",oci:"oci",oji:"oji",orm:"orm",ori:"ori",oss:"oss",pan:"pan",pli:"pli",pol:"pol",pus:"pus",por:"por",que:"que",roh:"roh",run:"run",rum:"rum",ron:"ron",rus:"rus",kin:"kin",san:"san",srd:"srd",snd:"snd",sme:"sme",sag:"sag",slo:"slo",sin:"sin",slk:"slk",slv:"slv",smo:"smo",sna:"sna",som:"som",alb:"alb",sqi:"sqi",srp:"srp",ssw:"ssw",sot:"sot",sun:"sun",swe:"swe",swa:"swa",tam:"tam",tel:"tel",tgk:"tgk",tha:"tha",tir:"tir",tuk:"tuk",tgl:"tgl",tsn:"tsn",ton:"ton",tur:"tur",tso:"tso",tat:"tat",twi:"twi",tah:"tah",uig:"uig",ukr:"ukr",urd:"urd",uzb:"uzb",ven:"ven",vie:"vie",vol:"vol",wln:"wln",wol:"wol",xho:"xho",yid:"yid",yor:"yor",zha:"zha",chi:"chi",zho:"zho",zul:"zul"},_default=ValidLanguages;exports.default=_default;
},{}],13:[function(require,module,exports){
"use strict";function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach(function(t){_defineProperty(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var scorm12={CMIString256:"^.{0,255}$",CMIString4096:"^.{0,4096}$",CMITime:"^(?:[01]\\d|2[0123]):(?:[012345]\\d):(?:[012345]\\d)$",CMITimespan:"^([0-9]{2,}):([0-9]{2}):([0-9]{2})(.[0-9]{1,2})?$",CMIInteger:"^\\d+$",CMISInteger:"^-?([0-9]+)$",CMIDecimal:"^-?([0-9]{0,3})(.[0-9]*)?$",CMIIdentifier:"^[\\u0021-\\u007E\\s]{0,255}$",CMIFeedback:"^.{0,255}$",CMIIndex:"[._](\\d+).",CMIStatus:"^(passed|completed|failed|incomplete|browsed)$",CMIStatus2:"^(passed|completed|failed|incomplete|browsed|not attempted)$",CMIExit:"^(time-out|suspend|logout|)$",CMIType:"^(true-false|choice|fill-in|matching|performance|sequencing|likert|numeric)$",CMIResult:"^(correct|wrong|unanticipated|neutral|([0-9]{0,3})?(\\.[0-9]*)?)$",NAVEvent:"^(previous|continue)$",score_range:"0#100",audio_range:"-1#100",speed_range:"-100#100",weighting_range:"-100#100",text_range:"-1#1"},aicc=_objectSpread(_objectSpread({},scorm12),{CMIIdentifier:"^\\w{1,255}$"}),scorm2004={CMIString200:"^[\\u0000-\\uFFFF]{0,200}$",CMIString250:"^[\\u0000-\\uFFFF]{0,250}$",CMIString1000:"^[\\u0000-\\uFFFF]{0,1000}$",CMIString4000:"^[\\u0000-\\uFFFF]{0,4000}$",CMIString64000:"^[\\u0000-\\uFFFF]{0,64000}$",CMILang:"^([a-zA-Z]{2,3}|i|x)(-[a-zA-Z0-9-]{2,8})?$|^$",CMILangString250:"^({lang=([a-zA-Z]{2,3}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,250}$)?$",CMILangcr:"^(({lang=([a-zA-Z]{2,3}|i|x)?(-[a-zA-Z0-9-]{2,8})?}))(.*?)$",CMILangString250cr:"^(({lang=([a-zA-Z]{2,3}|i|x)?(-[a-zA-Z0-9-]{2,8})?})?(.{0,250})?)?$",CMILangString4000:"^({lang=([a-zA-Z]{2,3}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,4000}$)?$",CMITime:"^(19[7-9]{1}[0-9]{1}|20[0-2]{1}[0-9]{1}|203[0-8]{1})((-(0[1-9]{1}|1[0-2]{1}))((-(0[1-9]{1}|[1-2]{1}[0-9]{1}|3[0-1]{1}))(T([0-1]{1}[0-9]{1}|2[0-3]{1})((:[0-5]{1}[0-9]{1})((:[0-5]{1}[0-9]{1})((\\.[0-9]{1,2})((Z|([+|-]([0-1]{1}[0-9]{1}|2[0-3]{1})))(:[0-5]{1}[0-9]{1})?)?)?)?)?)?)?)?$",CMITimespan:"^P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?(?:T?(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:([.,\\d]+)S)?)?$",CMIInteger:"^\\d+$",CMISInteger:"^-?([0-9]+)$",CMIDecimal:"^-?([0-9]{1,5})(\\.[0-9]{1,18})?$",CMIIdentifier:"^\\S{1,250}[a-zA-Z0-9]$",CMIShortIdentifier:"^[\\w\\.\\-\\_]{1,250}$",CMILongIdentifier:"^(?:(?!urn:)\\S{1,4000}|urn:[A-Za-z0-9-]{1,31}:\\S{1,4000}|.{1,4000})$",CMIFeedback:"^.*$",CMIIndex:"[._](\\d+).",CMIIndexStore:".N(\\d+).",CMICStatus:"^(completed|incomplete|not attempted|unknown)$",CMISStatus:"^(passed|failed|unknown)$",CMIExit:"^(time-out|suspend|logout|normal)$",CMIType:"^(true-false|choice|fill-in|long-fill-in|matching|performance|sequencing|likert|numeric|other)$",CMIResult:"^(correct|incorrect|unanticipated|neutral|-?([0-9]{1,4})(\\.[0-9]{1,18})?)$",NAVEvent:"^(previous|continue|exit|exitAll|abandon|abandonAll|suspendAll|{target=\\S{0,200}[a-zA-Z0-9]}choice|jump)$",NAVBoolean:"^(unknown|true|false$)",NAVTarget:"^(previous|continue|choice.{target=\\S{0,200}[a-zA-Z0-9]})$",scaled_range:"-1#1",audio_range:"0#*",speed_range:"0#*",text_range:"-1#1",progress_range:"0#1"},Regex={aicc:aicc,scorm12:scorm12,scorm2004:scorm2004},_default=Regex;exports.default=_default;
},{}],14:[function(require,module,exports){
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _regex=_interopRequireDefault(require("./regex")),scorm2004_regex=_regex.default.scorm2004,learner={"true-false":{format:"^true$|^false$",max:1,delimiter:"",unique:!1},choice:{format:scorm2004_regex.CMIShortIdentifier,max:36,delimiter:"[,]",unique:!0},"fill-in":{format:scorm2004_regex.CMILangString250,max:10,delimiter:"[,]",unique:!1},"long-fill-in":{format:scorm2004_regex.CMILangString4000,max:1,delimiter:"",unique:!1},matching:{format:scorm2004_regex.CMIShortIdentifier,format2:scorm2004_regex.CMIShortIdentifier,max:36,delimiter:"[,]",delimiter2:"[.]",unique:!1},performance:{format:"^$|"+scorm2004_regex.CMIShortIdentifier,format2:scorm2004_regex.CMIDecimal+"|^$|"+scorm2004_regex.CMIShortIdentifier,max:250,delimiter:"[,]",delimiter2:"[.]",unique:!1},sequencing:{format:scorm2004_regex.CMIShortIdentifier,max:36,delimiter:"[,]",unique:!1},likert:{format:scorm2004_regex.CMIShortIdentifier,max:1,delimiter:"",unique:!1},numeric:{format:scorm2004_regex.CMIDecimal,max:1,delimiter:"",unique:!1},other:{format:scorm2004_regex.CMIString4000,max:1,delimiter:"",unique:!1}},correct={"true-false":{max:1,delimiter:"",unique:!1,duplicate:!1,format:"^true$|^false$",limit:1},choice:{max:36,delimiter:"[,]",unique:!0,duplicate:!1,format:scorm2004_regex.CMIShortIdentifier},"fill-in":{max:10,delimiter:"[,]",unique:!1,duplicate:!1,format:scorm2004_regex.CMILangString250cr},"long-fill-in":{max:1,delimiter:"",unique:!1,duplicate:!0,format:scorm2004_regex.CMILangString4000},matching:{max:36,delimiter:"[,]",delimiter2:"[.]",unique:!1,duplicate:!1,format:scorm2004_regex.CMIShortIdentifier,format2:scorm2004_regex.CMIShortIdentifier},performance:{max:250,delimiter:"[,]",delimiter2:"[.]",unique:!1,duplicate:!1,format:"^$|"+scorm2004_regex.CMIShortIdentifier,format2:scorm2004_regex.CMIDecimal+"|^$|"+scorm2004_regex.CMIShortIdentifier},sequencing:{max:36,delimiter:"[,]",unique:!1,duplicate:!1,format:scorm2004_regex.CMIShortIdentifier},likert:{max:1,delimiter:"",unique:!1,duplicate:!1,format:scorm2004_regex.CMIShortIdentifier,limit:1},numeric:{max:2,delimiter:"[:]",unique:!1,duplicate:!1,format:scorm2004_regex.CMIDecimal,limit:1},other:{max:1,delimiter:"",unique:!1,duplicate:!1,format:scorm2004_regex.CMIString4000,limit:1}},Responses={learner:learner,correct:correct},_default=Responses;exports.default=_default;
},{"./regex":13}],15:[function(require,module,exports){
"use strict";function _typeof(t){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function _createClass(t,e,r){return e&&_defineProperties(t.prototype,e),r&&_defineProperties(t,r),t}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_setPrototypeOf(t,e)}function _createSuper(t){var e=_isNativeReflectConstruct();return function(){var r,o=_getPrototypeOf(t);if(e){var n=_getPrototypeOf(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _possibleConstructorReturn(t,e){return!e||"object"!==_typeof(e)&&"function"!=typeof e?_assertThisInitialized(t):e}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _wrapNativeSuper(t){var e="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(t){function r(){return _construct(t,arguments,_getPrototypeOf(this).constructor)}if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(r,t)})(t)}function _construct(t,e,r){return _construct=_isNativeReflectConstruct()?Reflect.construct:function(t,e,r){var o=[null];o.push.apply(o,e);var n=Function.bind.apply(t,o),i=new n;return r&&_setPrototypeOf(i,r.prototype),i},_construct.apply(null,arguments)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function _isNativeFunction(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _classPrivateFieldGet(t,e){return _classApplyDescriptorGet(t,_classExtractFieldDescriptor(t,e,"get"))}function _classApplyDescriptorGet(t,e){return e.get?e.get.call(t):e.value}function _classPrivateFieldSet(t,e,r){return _classApplyDescriptorSet(t,_classExtractFieldDescriptor(t,e,"set"),r),r}function _classExtractFieldDescriptor(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function _classApplyDescriptorSet(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ValidationError=void 0;var _errorCode=new WeakMap,ValidationError=function(t){function e(t){var o;return _classCallCheck(this,e),o=r.call(this,t),_errorCode.set(_assertThisInitialized(o),{writable:!0,value:void 0}),_classPrivateFieldSet(_assertThisInitialized(o),_errorCode,t),o}_inherits(e,t);var r=_createSuper(e);return _createClass(e,[{key:"errorCode",get:function(){return _classPrivateFieldGet(this,_errorCode)}},{key:"message",get:function(){return _classPrivateFieldGet(this,_errorCode)+""}}]),e}(_wrapNativeSuper(Error));exports.ValidationError=ValidationError;
},{}],16:[function(require,module,exports){
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _Scorm2004API=_interopRequireDefault(require("./Scorm2004API")),_Scorm12API=_interopRequireDefault(require("./Scorm12API")),_AICC=_interopRequireDefault(require("./AICC"));window.Scorm12API=_Scorm12API.default,window.Scorm2004API=_Scorm2004API.default,window.AICC=_AICC.default;
},{"./AICC":2,"./Scorm12API":4,"./Scorm2004API":5}],17:[function(require,module,exports){
"use strict";function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(r,e){if(r){if("string"==typeof r)return _arrayLikeToArray(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,e):void 0}}function _arrayLikeToArray(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function _iterableToArrayLimit(r,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var t=[],n=!0,o=!1,a=void 0;try{for(var i,s=r[Symbol.iterator]();!(n=(i=s.next()).done)&&(t.push(i.value),!e||t.length!==e);n=!0);}catch(r){o=!0,a=r}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return t}}function _arrayWithHoles(r){if(Array.isArray(r))return r}function getSecondsAsHHMMSS(r){if(!r||r<=0)return"00:00:00";var e=Math.floor(r/SECONDS_PER_HOUR),t=new Date(1e3*r),n=t.getUTCMinutes(),o=t.getSeconds(),a=r%1,i="";return countDecimals(a)>0&&(i=countDecimals(a)>2?a.toFixed(2):String(a),i="."+i.split(".")[1]),(e+":"+n+":"+o).replace(/\b\d\b/g,"0$&")+i}function getSecondsAsISODuration(r){if(!r||r<=0)return"PT0S";var e="P",t=r;return designations.forEach(function(r){var n=_slicedToArray(r,2),o=n[0],a=n[1],i=Math.floor(t/a);t%=a,countDecimals(t)>2&&(t=Number(Number(t).toFixed(2))),"S"===o&&t>0&&(i+=t),i&&((e.indexOf("D")>0||"H"===o||"M"===o||"S"===o)&&-1===e.indexOf("T")&&(e+="T"),e+="".concat(i).concat(o))}),e}function getTimeAsSeconds(r,e){if(!r||"string"!=typeof r||!r.match(e))return 0;var t=r.split(":");return 3600*Number(t[0])+60*Number(t[1])+Number(t[2])}function getDurationAsSeconds(r,e){if(!r||!r.match(e))return 0;var t=new RegExp(e).exec(r)||[],n=_slicedToArray(t,8),o=n[1],a=(n[2],n[4]),i=n[5],s=n[6],S=n[7],u=0;return u+=1*Number(S)||0,u+=60*Number(s)||0,u+=3600*Number(i)||0,u+=86400*Number(a)||0,u+=31536e3*Number(o)||0}function addTwoDurations(r,e,t){return getSecondsAsISODuration(getDurationAsSeconds(r,t)+getDurationAsSeconds(e,t))}function addHHMMSSTimeStrings(r,e,t){return getSecondsAsHHMMSS(getTimeAsSeconds(r,t)+getTimeAsSeconds(e,t))}function flatten(r){function e(r,n){if(Object(r)!==r)t[n]=r;else if(Array.isArray(r))for(var o=0,a=r.length;o<a;o++)e(r[o],n+"["+o+"]"),0===a&&(t[n]=[]);else{var i=!0;for(var s in r)({}).hasOwnProperty.call(r,s)&&(i=!1,e(r[s],n?n+"."+s:s));i&&n&&(t[n]={})}}var t={};return e(r,""),t}function unflatten(r){if(Object(r)!==r||Array.isArray(r))return r;var e=/\.?([^.[\]]+)|\[(\d+)]/g,t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){for(var o=t,a="",i=e.exec(n);i;)o=o[a]||(o[a]=i[2]?[]:{}),a=i[2]||i[1],i=e.exec(n);o[a]=r[n]}return t[""]||t}function countDecimals(r){return Math.floor(r)===r||String(r).indexOf(".")<0?0:r.toString().split(".")[1].length||0}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSecondsAsHHMMSS=getSecondsAsHHMMSS,exports.getSecondsAsISODuration=getSecondsAsISODuration,exports.getTimeAsSeconds=getTimeAsSeconds,exports.getDurationAsSeconds=getDurationAsSeconds,exports.addTwoDurations=addTwoDurations,exports.addHHMMSSTimeStrings=addHHMMSSTimeStrings,exports.flatten=flatten,exports.unflatten=unflatten,exports.countDecimals=countDecimals,exports.SECONDS_PER_DAY=exports.SECONDS_PER_HOUR=exports.SECONDS_PER_MINUTE=exports.SECONDS_PER_SECOND=void 0;var SECONDS_PER_SECOND=1;exports.SECONDS_PER_SECOND=SECONDS_PER_SECOND;var SECONDS_PER_MINUTE=60;exports.SECONDS_PER_MINUTE=SECONDS_PER_MINUTE;var SECONDS_PER_HOUR=60*SECONDS_PER_MINUTE;exports.SECONDS_PER_HOUR=SECONDS_PER_HOUR;var SECONDS_PER_DAY=24*SECONDS_PER_HOUR;exports.SECONDS_PER_DAY=SECONDS_PER_DAY;var designations=[["D",SECONDS_PER_DAY],["H",SECONDS_PER_HOUR],["M",SECONDS_PER_MINUTE],["S",SECONDS_PER_SECOND]];
},{}]},{},[2,3,6,7,8,9,10,11,12,13,14,15,16,4,5,17])
//# sourceMappingURL=scorm-again.js.map