core.pageScript["course-configuration"]={"audio-enabled-setting-checkbox":{change:function(t,e){core.setSetting("audio-enabled",t.call("isSelected"))}},"video-subtitles-setting-checkbox":{change:function(t,e){core.setSetting("video-subtitles",t.call("isSelected"))}},"focus-outline-setting-checkbox":{change:function(t,e){core.setSetting("focus-outline",t.call("isSelected"))}},"high-contrast-setting-checkbox":{change:function(t,e){core.setSetting("high-contrast",t.call("isSelected"))}}},core.pageScript["course-copyright"]={block2:{animcomplete:function(t,e){var a=t.call("getVal","fade"),n=!1;return 1===a?n=core.completed():t.call("getVal","resume")&&core.resume(),{completed:n}}},"course-start":{advance:function(t,e){return core.audio.call("init"),{resume:core.start()}}}},core.pageScript["cub-01-010-030"]={getElement:function(t,e){var a=e.find("#"+t);return a.length>0?a:null},getPhase:function(t){var e=[1,2,3,4];return t>0?Util.nullValue(e[t-1],t):t},primePhase:function(t){function e(){c("phase-text"),a(),n(1),n(2)}function a(){var e=l.getElement("stopwatch",t);Util.isSet(e)&&e.call("reset")}function n(e){var a=l.getElement("category"+e,t);if(Util.isSet(a)){var n=l.getPhase(o),c="phase"+n+"-"+e,i=r[c];a.call("setText",StringUtil.parseVars(i.category,{manifest:core.manifest}))}}function c(e){var a=l.getElement("phase",t);Util.isSet(a)&&a.call("setText",StringUtil.parseVars(r[e],{phaseIndex:o}))}var i=t.attr("id"),l=core.pageScript[i],r=core.manifest[i],o=t.call("getVal","phaseIndex");e()},startPhase:function(t,e){function a(t){d(StringUtil.parseVars(E["countdown-text"],{seconds:t})),t>0?setTimeout(a,1e3,t-1):m()}function n(){if(Util.isSet(V.stopwatch)&&Util.isSet(b)){var t={phaseIndex:w,time:V.stopwatch.html()};b.append(StringUtil.parseVars(E["result-text"],t))}}function c(){S(!1),p(!1),d("");var e=0,a=0;w>0&&(e=o(w),n()),w===y-1?t.call("setVal","time",e):w===y&&(a=i(e),h("finished-text")),t.off(ElementEvent.CHANGE,v),t.trigger(ElementEvent.JS_ECHO,{func:"startPhase",phaseIndex:w,feedback:a})}function i(e){var a=1e3,n=Util.nullValue(t.call("getVal","time"),0);return e>n+a?1:n-a>e?2:3}function l(t,e){var a=function(t){n[t]=x.getElement(t,e)},n={};return t.forEach(a),n}function r(){var t=I.length;if(t>0){var e=Math.floor(Math.random()*t);return I.splice(e,1)[0]}return null}function o(e){var a=0;if(Util.isSet(V.stopwatch)){var n=Util.nullValue(t.call("getVal","times"),[]);n[e]=V.stopwatch.html(),a=V.stopwatch.call("getTime"),n[0]=Util.nullValue(n[0],0)+a,t.call("setVal","times",n)}return a}function s(){t.on(ElementEvent.CHANGE,v),0===w&&h("practice-text"),f(1),f(2),a(3)}function u(){k=r(),Util.isSet(k)?d(k.value):c()}function g(){Util.isSet(V.incorrect)&&V.incorrect.call("play",0),Util.isSet(V.stopwatch)&&(V.stopwatch.call("offset",2e3),V.stopwatch.stop(!0,!0),V.stopwatch.css("color","red").animate({color:"white"},1e3))}function f(t){var e=function(e){return{categoryIndex:t,value:e}},a=x.getPhase(w),n="phase"+a+"-"+t,c=E[n],i=StringUtil.parseVars(c.words,{manifest:core.manifest}),l=i.split(",");I=I.concat(l.map(e))}function p(e){var a=x.getElement("selector",t);Util.isSet(a)&&a.call("setEnabled",e)}function h(t){Util.isSet(V.phase)&&V.phase.call("setText",E[t])}function d(t){Util.isSet(V.word)&&V.word.call("setText",t)}function m(){p(!0),S(!0),u()}function S(t){Util.isSet(V.stopwatch)&&V.stopwatch.call(t?"start":"stop")}function v(t,e){var a=x.getElement(e.targetId,$(t.target));if(Util.isSet(a)){var n=a.call("getVal","categoryIndex");k.categoryIndex!==n&&g(),u()}}var U=({page:t.getVal("data"),manifest:core.manifest},t.attr("id")),x=core.pageScript[U],E=core.manifest[U],w=t.call("getVal","phaseIndex"),V=l(["incorrect","phase","stopwatch","word","category1","category2"],x.getElement("console",t)),b=x.getElement("results",t),y=4,I=[],k=null;s()}};