/*!
 * ActivePresenter HTML5 Output File
 * Copyright (c) Atomi Systems, Inc. All rights reserved.
 * https://atomisystems.com/activepresenter/
 * Version: 8.0.6
 * Date: 2020.04.28
 */
!function(e){var t=e.ControlKind,a=e.ControlType,i=e.ResponseResult,c=e.PlayModes,r=!1,n={},o=0,s=0;function u(e){var t,a;return e-=t=e%60,"PT"+((e-=a=e%3600)%3600!=0?0:e/3600)+"H"+(a%60!=0?0:a/60)+"M"+t+"S"}function d(e,t){var a=t;switch((void 0==a||a<0)&&(a=0),e){case i.Ei:return""+a;case i.Ti:return"neutral";case i.xi:return"correct";case i.Si:return"incorrect";default:return""+a}}function l(){var e=o;return o++,e}function m(e){var t=n[e];return void 0===t?-1:t}function f(e,i,c){switch(e){case t.S:return c?"long-fill-in":"fill-in";case t.P:return"matching";case t.L:switch(i){case a.nt:case a.it:case a.et:return"choice";case a.rt:return"sequencing";case a.ht:return"performance";case a.ot:return"matching";case a.ut:return"likert";default:return""}return"";default:return"performance"}return""}function S(e,i,c,r,n){var o,s,u,d="";switch(c){case t.S:u=n?4e3:250,(d=e).length>u&&(d=d.substr(0,u));break;case t.P:d=e+"[.]"+i;break;case t.L:switch(r){case a.nt:case a.it:case a.et:case a.rt:for(d="",o=0,s=e.length||0;o<s;++o)""!=d&&(d+="[,]"),d+=e[o];break;case a.ht:case a.ot:var l,m=[];for(l in e)e.hasOwnProperty(l)&&m.push(l);for(m.sort(),d="",o=0,s=m.length;o<s;++o)""!=d&&(d+="[,]"),d+=m[o]+"[.]"+e[m[o]];break;case a.ut:d=parseInt(e[i])+1}}return d}var V=e.createClass({$init:function(e){this.Es=e},initialize:function(){return doInitialize()},terminate:function(){var e,t,a=this.Es,i=a._s.options,r=c[a.options.playMode];return r!=c.Tutorial&&r!=c.Practice&&r!=c.Test||(e=a.score(),t=a.maxScore(),doSetValue("cmi.score.min",Math.round(0)),doSetValue("cmi.score.scaled",t>0?e/t:0),i.scormScorePercent?(doSetValue("cmi.score.max",Math.round(100)),doSetValue("cmi.score.raw",t>0&&e>0?Math.round(100*e/t):0)):(doSetValue("cmi.score.max",Math.round(t)),doSetValue("cmi.score.raw",e>0?Math.round(e):0))),doSetValue("cmi.session_time",u(Math.ceil(a.elapsedTime()/1e3))),doCommit(),doTerminate()},startLesson:function(){r||(r=!0,doSetValue("cmi.completion_status","incomplete"),doSetValue("cmi.success_status","unknown"),doSetValue("cmi.exit","suspend"),doCommit())},endLesson:function(e){if(r){r=!1;var t,a,i,n=this.Es,o=n._s.options,s=c[n.options.playMode];s==c.Tutorial||s==c.Practice||s==c.Test?(t=n.score(),a=n.maxScore(),doSetValue("cmi.score.min",Math.round(0)),doSetValue("cmi.score.scaled",t/a),o.scormScorePercent?(doSetValue("cmi.score.max",Math.round(100)),doSetValue("cmi.score.raw",a>0&&t>0?Math.round(100*t/a):0)):(doSetValue("cmi.score.max",Math.round(a)),doSetValue("cmi.score.raw",t>0?Math.round(t):0)),i=n.result(),doSetValue("cmi.success_status",i?"passed":"failed")):doSetValue("cmi.success_status","passed"),doSetValue("cmi.completion_status","completed"),doSetValue("cmi.exit",e?"time-out":"normal"),doSetValue("cmi.session_time",u(Math.ceil(n.elapsedTime()/1e3))),doCommit()}},loadSuspendData:function(){var e=doGetValue("cmi.entry");if("resume"==e){var t=doGetValue("cmi.suspend_data");if(n={},o=0,""!=t)try{var a,i,c=JSON.parse(t);if(c.info&&c.info instanceof Object&&(this.Es.ws=c.info),c.map&&c.map instanceof Object&&void 0!==c.nextIdx)o=c.nextIdx,n=c.map;else for(o=parseInt(doGetValue("cmi.interactions._count")),isNaN(o)&&(o=0),a=0;a<o;a++)i=doGetValue("cmi.interactions."+a+".id"),n[i]=a}catch(e){}}},storeSuspendData:function(e,t){var a={};a.info=e,a.map=n,a.nextIdx=o;try{var i=JSON.stringify(a);""!=i&&(i.length>64e3&&(i=""),doSetValue("cmi.suspend_data",i))}catch(e){doSetValue("cmi.suspend_data","")}1==t&&doCommit(),s=e.ts||0},getSuspendDataTS:function(){return s},storeInteractionData:function(e,r,o,s,u){var V,h,p,v,w,_=c[this.Es.options.playMode];if(_==c.Tutorial||_==c.Practice||_==c.Test)if(e.kind==t.L&&e.type==a.ut)for(w in s)s.hasOwnProperty(w)&&((V=m(w))<0?(V=l(),n[w]=V,p="cmi.interactions."+V+".",doSetValue(p+"id",w),doSetValue(p+"type",f(e.kind,e.type,e.multiline))):p="cmi.interactions."+V+".",""!=(v=S(s,w,e.kind,e.type,e.multiline))&&doSetValue(p+"learner_response",v),doSetValue(p+"result",d(r,o)));else{if((V=m(w=e.reportid))<0){if(V=l(),n[w]=V,p="cmi.interactions."+V+".",doSetValue(p+"id",w),doSetValue(p+"type",f(e.kind,e.type,e.multiline)),r!=i.Ti)for(h=0;h<(u.length||0);++h)""!=(v=S(u[h],w,e.kind,e.type,e.multiline))&&doSetValue(p+"correct_responses."+h+".pattern",v)}else p="cmi.interactions."+V+".";""!=(v=S(s,w,e.kind,e.type,e.multiline))&&doSetValue(p+"learner_response",v),doSetValue(p+"result",d(r,o))}this.storeSuspendData(this.Es.ws),doCommit()},setBookmark:function(e,t,a){}});e.LMS=V}(window.AtomiAP=window.AtomiAP||{});