(()=>{var e,t,n,i,o,r,a,s,c,l,d,u={2093:e=>{e.exports=function(e){try{return void 0!==e()}catch(e){return!1}}},6203:e=>{function t(e){return t="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},t(e)}function n(e,n){for(var i=0;i<n.length;i++){var o=n[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(r=o.key,a=void 0,a=function(e,n){if("object"!==t(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var o=i.call(e,n||"default");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(r,"string"),"symbol"===t(a)?a:String(a)),o)}var r,a}e.exports=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.token=t,this.excludedVerbsList=n,this.bindings={shutdown:this.shutdown.bind(this),send:this.send.bind(this)},this.statements={},this.timer,window.addEventListener("beforeunload",this.bindings.shutdown),window.addEventListener("unload",this.bindings.shutdown),window.addEventListener("pagehide",this.bindings.send),this.startTimer()}var i,o,r;return i=e,o=[{key:"startTimer",value:function(){clearTimeout(this.timer),this.timer=setTimeout(this.bindings.send,3e4)}},{key:"getPostEndpoint",value:function(e){return H5PIntegration.ajax.xapi.replace(":contentId",e)}},{key:"includeStatement",value:function(e){return!this.excludedVerbsList||-1===this.excludedVerbsList.indexOf(e.getVerb())}},{key:"shutdown",value:function(){window.removeEventListener("beforeunload",this.bindings.shutdown),window.removeEventListener("unload",this.bindings.shutdown),window.removeEventListener("pagehide",this.bindings.send),this.send(!1),clearTimeout(this.timer)}},{key:"add",value:function(e){if(e.valid()){if(this.includeStatement(e)){var t=e.contentId();this.statements[t]||(this.statements[t]=[]),this.statements[t].push(e.json())}e.verbIsOneOf(["answered","completed","progressed"])&&this.send()}}},{key:"send",value:function(){var e=this,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];clearTimeout(this.timer);var i=!1,o=function(){var t=e.statements[r];if(delete e.statements[r],0!==t.length){var o,a;i=!0;var s=e.getPostEndpoint(r),c={_token:e.token,statements:JSON.stringify(t),async:n},l=function(){e.startTimer()},d=function(n){0===n.readyState&&(e.statements[r]=t.concat(void 0===e.statements[r]?[]:e.statements[r]))};if("embed"!==(null===(o=window)||void 0===o||null===(a=o.H5PIntegration)||void 0===a?void 0:a.context)&&window.parent&&window.parent.ltiWorker)return delete c.async,window.parent.ltiWorker.sendStatements(s,c,l,d),{v:void 0};H5P.jQuery.post(s,c).always(l).fail(d)}};for(var r in this.statements){var a=o();if("object"===t(a))return a.v}i||this.startTimer()}}],o&&n(i.prototype,o),r&&n(i,r),Object.defineProperty(i,"prototype",{writable:!1}),e}()},9933:(e,t,n)=>{function i(e){return i="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},i(e)}function o(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(r=o.key,a=void 0,a=function(e,t){if("object"!==i(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!==i(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(r,"string"),"symbol"===i(a)?a:String(a)),o)}var r,a}var r=n(2093);e.exports=function(){function e(t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.xAPIEvent=t,n&&void 0!==H5PIntegration.user){var i=H5PIntegration.user;delete H5PIntegration.user,this.xAPIEvent.setActor(),H5PIntegration.user=i}this.statement=t.data.statement,this.statement.timestamp||(this.statement.timestamp=(new Date).toISOString())}var t,n,i;return t=e,(n=[{key:"valid",value:function(){var e=this;return r((function(){return e.statement.actor}))&&r((function(){return e.statement.verb}))&&r((function(){return e.statement.object.definition.extensions["http://h5p.org/x-api/h5p-local-content-id"]}))}},{key:"verbIs",value:function(e){return this.getVerb()===e}},{key:"getVerb",value:function(){return this.xAPIEvent.getVerb()}},{key:"verbIsOneOf",value:function(e){return e.some(this.verbIs.bind(this))}},{key:"json",value:function(){return this.statement}},{key:"contentId",value:function(){return this.statement.object.definition.extensions["http://h5p.org/x-api/h5p-local-content-id"]}}])&&o(t.prototype,n),i&&o(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}()}},f={};function p(e){var t=f[e];if(void 0!==t)return t.exports;var n=f[e]={exports:{}};return u[e](n,n.exports,p),n.exports}(()=>{function e(t){return e="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(t)}var t=window.H5P=window.H5P||{};if(t.isFramed=window.self!==window.parent,t.$window=t.jQuery(window),t.instances=[],document.documentElement.requestFullscreen?t.fullScreenBrowserPrefix="":document.documentElement.webkitRequestFullScreen?(t.safariBrowser=navigator.userAgent.match(/version\/([.\d]+)/i),t.safariBrowser=null===t.safariBrowser?0:parseInt(t.safariBrowser[1]),(0===t.safariBrowser||t.safariBrowser>6)&&(t.fullScreenBrowserPrefix="webkit")):document.documentElement.mozRequestFullScreen?t.fullScreenBrowserPrefix="moz":document.documentElement.msRequestFullscreen&&(t.fullScreenBrowserPrefix="ms"),void 0!==t.fullScreenBrowserPrefix&&window.H5PIntegration&&H5PIntegration.contents&&("iPad"===navigator.platform||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1))for(var n in H5PIntegration.contents)if(H5PIntegration.contents.hasOwnProperty(n)&&H5PIntegration.contents[n].library&&-1!==["H5P.Chase","H5P.MultiPoll","H5P.WordCloud","H5P.Emoticon","H5P.DragQuestion","H5P.ThreeImage","H5P.InteractiveBook"].indexOf(H5PIntegration.contents[n].library.split(" ")[0])){delete t.fullScreenBrowserPrefix;break}t.opened={},t.init=function(e){void 0===t.$body&&(t.$body=t.jQuery(document.body)),void 0===t.fullscreenSupported&&(t.fullscreenSupported=!(H5PIntegration.fullscreenDisabled||t.fullscreenDisabled||t.isFramed&&!1!==t.externalEmbed&&(!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled)||void 0===t.fullScreenBrowserPrefix))),void 0===t.canHasFullScreen&&(t.canHasFullScreen=t.fullscreenSupported),t.jQuery(".h5p-content:not(.h5p-initialized)",e).each((function(){var e=t.jQuery(this).addClass("h5p-initialized"),n=t.jQuery('<div class="h5p-container"></div>').appendTo(e),i=e.data("content-id"),o=H5PIntegration.contents["cid-"+i];if(void 0===o)return t.error("No data for content id "+i+". Perhaps the library is gone?");var r={library:o.library,params:JSON.parse(o.jsonContent),metadata:o.metadata};t.getUserData(i,"state",(function(e,s,c){if(s)r.userDatas={state:s};else if(c&&H5PIntegration.saveFreq){delete o.contentUserData;var l=new t.Dialog("content-user-data-reset",t.t("contentChangedTitle"),"<p>"+t.t("contentChanged")+"</p><p>"+t.t("startingOver")+'</p><div class="h5p-dialog-ok-button" tabIndex="0" role="button">OK</div>',n);t.jQuery(l).on("dialog-opened",(function(e,n){var o=function(e){"click"!==e.type&&32!==e.which||(l.close(),t.deleteUserData(i,"state",0))};n.find(".h5p-dialog-ok-button").click(o).keypress(o),t.trigger(a,"resize")})).on("dialog-closed",(function(){t.trigger(a,"resize")})),l.open()}}));var a=t.newRunnable(r,i,n,!0,{standalone:!0});if(t.offlineRequestQueue=new t.OfflineRequestQueue({instance:a}),1==o.fullScreen&&t.fullscreenSupported&&t.jQuery('<div class="h5p-content-controls"><div role="button" tabindex="0" class="h5p-enable-fullscreen" aria-label="'+t.t("fullscreen")+'" title="'+t.t("fullscreen")+'"></div></div>').prependTo(n).children().click((function(){t.fullScreen(n,a)})).keydown((function(e){if(32===e.which||13===e.which)return t.fullScreen(n,a),!1})),!0===H5PIntegration.userStatusAvailable&&H5PIntegration.isAttemptsBarEnabled){var s=!o.contentUserStatus||!o.contentUserStatus.enabled;t.attemptsBar=new t.AttemptsBar(e,n,a,s);var c=!!o.contentUserData&&o.contentUserData!=={}&&!!o.contentUserData[0].state&&"RESET"!==o.contentUserData[0].state&&"ANSWERED"!==o.contentUserData[0].state&&!t.isEmpty(JSON.parse(o.contentUserData[0].state));t.attemptsBar.getNumAttempts()>0?t.attemptsBar.info():c?t.attemptsBar.savedState():t.attemptsBar.hideBar()}t.on(a,"resetState",(function(){t.attemptsBar.hideBar(),a.resetTask?(a.resetTask(),t.deleteUserData(a.contentId,"state",0)):console.error("".concat(Object.values(H5PIntegration.contents)[0].library," does not implement resetTask()"))}));var l,d=o.displayOptions,u=!1;if(d.frame){if(d.copyright){var f=t.getCopyrights(a,r.params,i,r.metadata);f||(d.copyright=!1)}var p=new t.ActionBar(d,n),h=p.getDOMElement();p.on("resize",(function(){t.trigger(a,"resize")})),p.on("reuse",(function(){t.openReuseDialog(h,o,r,a,i),a.triggerXAPI("accessed-reuse")})),p.on("copyrights",(function(){new t.Dialog("copyrights",t.t("copyrightInformation"),f,n).open(!0),a.triggerXAPI("accessed-copyright")})),p.on("embed",(function(){t.openEmbedDialog(h,o.embedCode,o.resizeCode,{width:e.width(),height:e.height()},a),a.triggerXAPI("accessed-embed")})),p.on("confusion",(function(){var o=e.find(".h5p-confusion-dialog").first();0==o.length?(new t.ConfusionPopup(n,a,i,d.anonymous).open(),a.triggerXAPI("accessed-confusion")):o.find(".h5p-confusion-close").first().trigger("click")})),p.hasActions()&&(u=!0,h.insertAfter(n))}if(e.addClass(u?"h5p-frame":"h5p-no-frame"),t.opened[i]=new Date,!1!==H5PIntegration.saveFreq&&(a.getCurrentState instanceof Function||"function"==typeof a.getCurrentState)){var v,g=function e(){var n=a.getCurrentState();void 0!==n&&t.setUserData(i,"state",n,{deleteOnChange:!0}),H5PIntegration.saveFreq&&(v=setTimeout(e,1e3*H5PIntegration.saveFreq))};H5PIntegration.saveFreq&&(v=setTimeout(g,1e3*H5PIntegration.saveFreq)),t.on(a,"xAPI",(function(e){var t=e.getVerb();"completed"!==t&&"progressed"!==t||(clearTimeout(v),v=setTimeout(g,3e3))}))}if(t.isFramed||window.H5PIntegration&&"lti"===H5PIntegration.context)if(!1===t.externalEmbed){var m=window.frameElement;t.on(a,"resize",(function(){clearTimeout(l),l=setTimeout((function(){!function(){if(!window.parent.H5P.isFullscreen){var e=m.parentElement.style.height;m.parentElement.style.height=m.parentElement.clientHeight+"px",m.getBoundingClientRect(),m.style.height="1px",m.style.height=m.contentDocument.body.scrollHeight+"px",m.parentElement.style.height=e,t.externalDispatcher&&t.externalDispatcher.trigger("iframeResized")}}()}),1)}))}else if(t.communicator){var b=!1;t.communicator.on("ready",(function(){t.communicator.send("hello")})),t.communicator.on("hello",(function(){b=!0,document.body.style.height="auto",document.body.style.overflow="hidden",t.trigger(a,"resize")})),t.communicator.on("resizePrepared",(function(){t.communicator.send("resize",{scrollHeight:document.body.scrollHeight})})),t.communicator.on("resize",(function(){t.trigger(a,"resize")})),t.on(a,"resize",(function(){t.isFullscreen||(clearTimeout(l),l=setTimeout((function(){b?t.communicator.send("prepareResize",{scrollHeight:document.body.scrollHeight,clientHeight:document.body.clientHeight}):t.communicator.send("hello")}),0))}))}t.isFramed&&!1!==t.externalEmbed||t.jQuery(window.parent).resize((function(){t.trigger(a,"resize")})),t.instances.push(a),t.trigger(a,"resize"),e.addClass("using-mouse"),e.on("mousedown keydown keyup",(function(t){e.toggleClass("using-mouse","mousedown"===t.type)})),t.externalDispatcher&&t.externalDispatcher.trigger("initialized")})),t.jQuery("iframe.h5p-iframe:not(.h5p-initialized)",e).each((function(){var e=this,n=t.jQuery(e),i=n.data("content-id"),o=H5PIntegration.contents["cid-"+i],r=o&&o.metadata&&o.metadata.defaultLanguage?o.metadata.defaultLanguage:"en",a=function(){e.contentDocument.open(),e.contentDocument.write('<!doctype html><html class="h5p-iframe" lang="'+r+'"><head>'+t.getHeadTags(i)+'</head><body><div class="h5p-content" data-content-id="'+i+'"/></body></html>'),e.contentDocument.close()};n.addClass("h5p-initialized"),null===e.contentDocument?(n.on("load",a),n.attr("src","about:blank")):a()}))},t.getHeadTags=function(e){var t=function(e){for(var t="",n=0;n<e.length;n++)t+='<link rel="stylesheet" href="'+e[n]+'">';return t},n=function(e){for(var t="",n=0;n<e.length;n++)t+='<script src="'+e[n]+'"><\/script>';return t};return'<base target="_parent">'+t(H5PIntegration.core.styles)+t(H5PIntegration.contents["cid-"+e].styles)+"<script>H5PIntegration = window.parent.H5PIntegration; var H5P = H5P || {}; H5P.externalEmbed = false;<\/script>"+n(H5PIntegration.core.scripts)+n(H5PIntegration.contents["cid-"+e].scripts)},t.communicator=window.postMessage&&window.addEventListener?new function(){var e={};window.addEventListener("message",(function(t){window.parent===t.source&&"h5p"===t.data.context&&void 0!==e[t.data.action]&&e[t.data.action](t.data)}),!1),this.on=function(t,n){e[t]=n},this.send=function(e,t){void 0===t&&(t={}),t.context="h5p",t.action=e,window.parent.postMessage(t,"*")}}:void 0,t.semiFullScreen=function(e,n,i,o){t.fullScreen(e,n,i,o,!0)},t.fullScreen=function(e,n,i,o,r){if(void 0===t.exitFullScreen){if(t.isFramed&&!1===t.externalEmbed)return window.parent.H5P.fullScreen(e,n,i,t.$body.get(),r),t.isFullscreen=!0,t.exitFullScreen=function(){window.parent.H5P.exitFullScreen()},void t.on(n,"exitFullScreen",(function(){t.isFullscreen=!1,t.exitFullScreen=void 0}));var a,s,c,l=e;if(void 0===o)c=t.$body;else{c=t.jQuery(o),a=c.add(e.get());var d="#h5p-iframe-"+e.parent().data("content-id");e=(s=t.jQuery(d)).parent()}a=e.add(t.$body).add(a);var u=function(e){a.addClass(e),void 0!==s&&s.css("height","")},f=function(){t.trigger(n,"resize"),t.trigger(n,"focus"),t.trigger(n,"enterFullScreen")},p=function(e){t.isFullscreen=!1,a.removeClass(e),t.trigger(n,"resize"),t.trigger(n,"focus"),t.exitFullScreen=void 0,void 0!==i&&i(),t.trigger(n,"exitFullScreen")};if(t.isFullscreen=!0,void 0===t.fullScreenBrowserPrefix||!0===r){if(t.isFramed)return;u("h5p-semi-fullscreen");var h,v,g,m=t.jQuery('<div role="button" tabindex="0" class="h5p-disable-fullscreen" title="'+t.t("disableFullscreen")+'" aria-label="'+t.t("disableFullscreen")+'"></div>').appendTo(l.find(".h5p-content-controls")),b=t.exitFullScreen=function(){v?g.content=v:P.removeChild(g),m.remove(),c.unbind("keyup",h),p("h5p-semi-fullscreen")};h=function(e){27===e.keyCode&&b()},m.click(b),c.keyup(h);for(var y=document.getElementsByTagName("meta"),w=0;w<y.length;w++)if("viewport"===y[w].name){g=y[w],v=g.content;break}if(v||((g=document.createElement("meta")).name="viewport"),g.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0",!v){var P=document.getElementsByTagName("head")[0];P.appendChild(g)}f()}else{u("h5p-fullscreen");var H="ms"===t.fullScreenBrowserPrefix?"MSFullscreenChange":t.fullScreenBrowserPrefix+"fullscreenchange";if(document.addEventListener(H,(function(){document.fullscreenElement||document.webkitFullscreenElement||document.msFullscreenElement?f():(p("h5p-fullscreen"),document.removeEventListener(H,arguments.callee,!1))})),""===t.fullScreenBrowserPrefix)e[0].requestFullscreen();else{var x="ms"===t.fullScreenBrowserPrefix?"msRequestFullscreen":t.fullScreenBrowserPrefix+"RequestFullScreen",I="webkit"===t.fullScreenBrowserPrefix&&0===t.safariBrowser?Element.ALLOW_KEYBOARD_INPUT:void 0;e[0][x](I)}t.exitFullScreen=function(){""===t.fullScreenBrowserPrefix?document.exitFullscreen():"moz"===t.fullScreenBrowserPrefix?document.mozCancelFullScreen():document[t.fullScreenBrowserPrefix+"ExitFullscreen"]()}}}},function(){t.addQueryParameter=function(e,t){var n,i,o=e.split("?");return o[1]?(i=o[1].split("#"),n=o[0]+"?"+i[0]+"&"):n=(i=o[0].split("#"))[0]+"?",n+=t,i[1]&&(n+="#"+i[1]),n},t.setSource=function(e,n,i){var o=n.path,r=t.getCrossOrigin(n);r&&!o.match(/https?:\/\/[^\/]*(vimeo|akamaized)/gi)?(e.crossOrigin=r,H5PIntegration.crossoriginCacheBuster&&(o=t.addQueryParameter(o,H5PIntegration.crossoriginCacheBuster))):e.removeAttribute("crossorigin"),e.src=t.getPath(o,i)};var n=function(e){return e.match(/^[a-z0-9]+:\/\//i)};t.getCrossOrigin=function(t){return"object"!==e(t)?H5PIntegration.crossorigin&&H5PIntegration.crossoriginRegex&&t.match(H5PIntegration.crossoriginRegex)?H5PIntegration.crossorigin:null:H5PIntegration.crossorigin?H5PIntegration.crossorigin:void 0},t.getPath=function(e,t){if(n(e))return e;var i,o="#tmp"===e.substr(-4,4);if(void 0===t||o){if(void 0===window.H5PEditor)return;i=H5PEditor.filesPath}else void 0!==H5PIntegration.contents&&H5PIntegration.contents["cid-"+t]&&(i=H5PIntegration.contents["cid-"+t].contentUrl),i||(i=H5PIntegration.url+"/content/"+t);return n(i)||(i=window.location.protocol+"//"+window.location.host+i),i+"/"+e}}(),t.getContentPath=function(e){return H5PIntegration.url+"/content/"+e},t.classFromName=function(e){var t=e.split(".");return this[t[t.length-1]]},t.newRunnable=function(e,n,i,o,r){var a,s,c,l;try{c=(a=e.library.split(" ",2))[0],s=a[1].split(".",2)}catch(n){return t.error("Invalid library string: "+e.library)}if(e.params instanceof Object!=!0||e.params instanceof Array==!0)return t.error("Invalid library params for: "+e.library),t.error(e.params);try{a=a[0].split("."),l=window;for(var d=0;d<a.length;d++)l=l[a[d]];if("function"!=typeof l)throw null}catch(n){return t.error("Unable to find constructor for: "+e.library)}void 0===r&&(r={}),e.subContentId&&(r.subContentId=e.subContentId),e.userDatas&&e.userDatas.state&&H5PIntegration.saveFreq&&(r.previousState=e.userDatas.state),e.metadata&&(r.metadata=e.metadata),r.isScoringEnabled=void 0!==e.isScoringEnabled?e.isScoringEnabled:!!H5PIntegration.postUserStatistics,r.isReportingAvailable=void 0!==e.isReportingAvailable?e.isReportingAvailable:!!H5PIntegration.reportingIsAvailable,r.isReportingEnabled=void 0!==e.isReportingEnabled?e.isReportingEnabled:!!H5PIntegration.reportingIsEnabled;var u,f=r.standalone||!1;return l.prototype=t.jQuery.extend({},t.ContentType(f).prototype,l.prototype),void 0===(u=t.jQuery.inArray(e.library,["H5P.CoursePresentation 1.0","H5P.CoursePresentation 1.1","H5P.CoursePresentation 1.2","H5P.CoursePresentation 1.3"])>-1?new l(e.params,n):new l(e.params,n,r)).$&&(u.$=t.jQuery(u)),void 0===u.contentId&&(u.contentId=n),void 0===u.subContentId&&e.subContentId&&(u.subContentId=e.subContentId),void 0===u.parent&&r&&r.parent&&(u.parent=r.parent),void 0===u.libraryInfo&&(u.libraryInfo={versionedName:e.library,versionedNameNoSpaces:c+"-"+s[0]+"."+s[1],machineName:c,majorVersion:s[0],minorVersion:s[1]}),void 0!==i&&(i.toggleClass("h5p-standalone",f),u.attach(i),t.trigger(u,"domChanged",{$target:i,library:c,key:"newLibrary"},{bubbles:!0,external:!0}),void 0!==o&&o||t.trigger(u,"resize")),u},t.error=function(e){void 0!==window.console&&void 0!==console.error&&console.error(e.stack?e.stack:e)},t.t=function(e,t,n){if(void 0===n&&(n="H5P"),void 0===H5PIntegration.l10n[n])return'[Missing translation namespace "'+n+'"]';if(void 0===H5PIntegration.l10n[n][e])return'[Missing translation "'+e+'" in "'+n+'"]';var i=H5PIntegration.l10n[n][e];if(void 0!==t)for(var o in t)i=i.replace(o,t[o]);return i},t.Dialog=function(e,n,i,o,r){var a=this;this.activeElement=document.activeElement;var s=t.jQuery('<div class="h5p-popup-dialog h5p-'+e+'-dialog" aria-labelledby="'+e+'-dialog-header" aria-modal="true" role="dialog" tabindex="-1">                              <div class="h5p-inner">                                <h2 id="'+e+'-dialog-header">'+n+'</h2>                                <div class="h5p-scroll-content">'+i+'</div>                                <div class="h5p-close" role="button" tabindex="0" aria-label="'+t.t("close")+'" title="'+t.t("close")+'"></div>                              </div>                            </div>').insertAfter(o).click((function(e){e&&e.originalEvent&&e.originalEvent.preventClosing||a.close()})).children(".h5p-inner").click((function(e){e.originalEvent.preventClosing=!0})).find(".h5p-close").click((function(){a.close()})).keypress((function(e){if(13===e.which||32===e.which)return a.close(),!1})).end().find("a").click((function(e){e.stopPropagation()})).end().end(),c='button, a, input, select, textarea, [tabindex]:not([tabindex="-1"])',l=function(e){e.preventDefault(),s.find(c).first().focus()},d=function(e){"Tab"===e.key&&e.shiftKey&&(e.preventDefault(),s.find(c).last().focus())},u=function(e){"Tab"!==e.key||e.shiftKey||(e.preventDefault(),s.find(c).first().focus())};a.open=function(e){e&&s.css("height","100%"),setTimeout((function(){o.parent().find(c).not(".h5p-popup-dialog *").on("focus",l),s.addClass("h5p-open"),t.jQuery(a).trigger("dialog-opened",[s]),s.find(".h5p-close").on("keydown",u),s.find(c).first().on("keydown",d),s.find(c).first().focus()}),1)},a.close=function(){s.removeClass("h5p-open"),setTimeout((function(){s.remove(),o.parent().find(c).off("focus",l),t.jQuery(a).trigger("dialog-closed",[s]),o.attr("tabindex","-1"),r?r.focus():a.activeElement?a.activeElement.focus():o.focus()}),200)}},t.getCopyrights=function(e,n,i,o){var r;if(void 0!==e.getCopyrights)try{r=e.getCopyrights()}catch(e){}void 0===r&&(r=new t.ContentCopyrights,t.findCopyrights(r,n,i));var a=t.buildMetadataCopyrights(o,e.libraryInfo.machineName);return void 0!==a&&r.addMediaInFront(a),void 0!==r&&(r=r.toString()),r},t.findCopyrights=function(n,i,o,r){var a;for(var s in r&&(r.params=i,d(r,r.machineName,o)),i)if(i.hasOwnProperty(s))if("overrideSettings"!==s){var c=i[s];if(c&&c.library&&"string"==typeof c.library?a=c.library.split(" ")[0]:c&&c.library&&"object"===e(c.library)&&(a=c.library.library&&"string"==typeof c.library.library?c.library.library.split(" ")[0]:a),c instanceof Array)t.findCopyrights(n,c,o);else if(c instanceof Object)if(d(c,a,o),void 0===c.copyright||void 0===c.copyright.license||void 0===c.path||void 0===c.mime)t.findCopyrights(n,c,o);else{var l=new t.MediaCopyright(c.copyright);void 0!==c.width&&void 0!==c.height&&l.setThumbnail(new t.Thumbnail(t.getPath(c.path,o),c.width,c.height)),n.addMedia(l)}}else console.warn("The semantics field 'overrideSettings' is DEPRECATED and should not be used."),console.warn(i);function d(e,i,o){if(e.metadata){var r=t.buildMetadataCopyrights(e.metadata,i);if(void 0!==r){if(e.params&&"Image"===e.params.contentName&&e.params.file){var a=e.params.file.path,s=e.params.file.width,c=e.params.file.height;r.setThumbnail(new t.Thumbnail(t.getPath(a,o),s,c,e.params.alt))}n.addMedia(r)}}}},t.buildMetadataCopyrights=function(e){if(e&&void 0!==e.license&&"U"!==e.license){var n={contentType:e.contentType,title:e.title,author:e.authors&&e.authors.length>0?e.authors.map((function(e){return e.role?e.name+" ("+e.role+")":e.name})).join(", "):void 0,source:e.source,year:e.yearFrom?e.yearFrom+(e.yearTo?"-"+e.yearTo:""):void 0,license:e.license,version:e.licenseVersion,licenseExtras:e.licenseExtras,changes:e.changes&&e.changes.length>0?e.changes.map((function(e){return e.log+(e.author?", "+e.author:"")+(e.date?", "+e.date:"")})).join(" / "):void 0};return new t.MediaCopyright(n)}},t.openReuseDialog=function(e,n,i,o,r){var a="";n.displayOptions.export&&(a+='<button type="button" class="h5p-big-button h5p-download-button"><div class="h5p-button-title">'+t.t("downloadButtonTitle")+'</div><div class="h5p-button-description">'+t.t("downloadButtonDescription")+"</div></button>"),n.displayOptions.export&&n.displayOptions.copy&&(a+='<div class="h5p-horizontal-line-text"><span>'+t.t("or")+"</span></div>"),n.displayOptions.copy&&(a+='<button type="button" class="h5p-big-button h5p-copy-button"><div class="h5p-button-title">'+t.t("copyContentTitle")+'</div><div class="h5p-button-description">'+t.t("copyContentDescription")+"</div></button>");var s=new t.Dialog("reuse",t.t("reuseContent"),a,e);t.jQuery(s).on("dialog-opened",(function(e,a){t.jQuery('<a href="https://h5p.org/node/442225" target="_blank">'+t.t("moreInfoLinkText")+"</a>").click((function(e){e.stopPropagation()})).appendTo(a.find("h2")),a.find(".h5p-download-button").click((function(){this.disabled=!0,this.querySelector(".h5p-button-title").innerHTML=t.t("downloadStartTitle"),this.querySelector(".h5p-button-description").innerHTML=t.t("downloadStartDescription");var e=(new Date).getTime();setTimeout((function t(){2===document.cookie.split("h5pdl"+e+"=").length?(o.triggerXAPI("downloaded"),s.close()):setTimeout(t,1e3)}),1e3),void 0!==t.alternativeExport?t.alternativeExport(n.exportUrl+"?dl="+e):window.location.href=n.exportUrl+"?dl="+e})),a.find(".h5p-copy-button").click((function(){var e=new t.ClipboardItem(i);e.contentId=r,t.setClipboard(e),o.triggerXAPI("copied"),s.close(),t.attachToastTo(t.jQuery(".h5p-content:first")[0],t.t("contentCopied"),{position:{horizontal:"centered",vertical:"centered",noOverflowX:!0}})})),t.trigger(o,"resize")})).on("dialog-closed",(function(){t.trigger(o,"resize")})),s.open()},t.openEmbedDialog=function(e,n,i,o,r){var a=n+i,s=new t.Dialog("embed",t.t("embed"),'<textarea class="h5p-embed-code-container" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>'+t.t("size")+': <input aria-label="'+t.t("width")+'" type="text" value="'+Math.ceil(o.width)+'" class="h5p-embed-size"/> × <input aria-label="'+t.t("height")+'" type="text" value="'+Math.ceil(o.height)+'" class="h5p-embed-size"/> px<br/><div role="button" tabindex="0" class="h5p-expander">'+t.t("showAdvanced")+'</div><div class="h5p-expander-content"><p>'+t.t("advancedHelp")+'</p><textarea class="h5p-embed-code-container" autocorrect="off" autocapitalize="off" spellcheck="false">'+i+"</textarea></div>",e);t.jQuery(s).on("dialog-opened",(function(e,n){var i=n.find(".h5p-inner").find(".h5p-scroll-content"),s=(i.outerHeight(),i.innerHeight(),function(){t.trigger(r,"resize")}),c=n.find(".h5p-embed-size:eq(0)"),l=n.find(".h5p-embed-size:eq(1)"),d=function(e,t){var n=parseFloat(e.val());return isNaN(n)?t:Math.ceil(n)},u=function(){n.find(".h5p-embed-code-container:first").val(a.replace(":w",d(c,o.width)).replace(":h",d(l,o.height)))};c.change(u),l.change(u),u(),n.find(".h5p-embed-code-container").each((function(){t.jQuery(this).css("height",this.scrollHeight+"px").focus((function(){t.jQuery(this).select()}))})),n.find(".h5p-embed-code-container").eq(0).select(),s();var f=function(){var e=t.jQuery(this),i=e.next();i.is(":visible")?(e.removeClass("h5p-open").text(t.t("showAdvanced")).attr("aria-expanded","true"),i.hide()):(e.addClass("h5p-open").text(t.t("hideAdvanced")).attr("aria-expanded","false"),i.show()),n.find(".h5p-embed-code-container").each((function(){t.jQuery(this).css("height",this.scrollHeight+"px")})),s()};n.find(".h5p-expander").click(f).keypress((function(e){if(32===e.keyCode)return f.apply(this),!1}))})).on("dialog-closed",(function(){t.trigger(r,"resize")})),s.open()},t.ConfusionPopup=function(e,n,i,o){var r=this,a=t.t("defaultConfusionHolder"),s=null,c="",l=1023;if(r.humanizeTime=function(e){var t=Math.floor(e/60),n=Math.floor(e%60),i=Math.floor(t/60);t%=60;var o="";return 0!==i&&(o+=i+":",t<10&&(o+="0")),o+=t+":",n<10&&(o+="0"),o+=n},n.getContext)switch((s=n.getContext()).type){case"time":var d=r.humanizeTime(s.value);a=t.t("videoConfusionHolder",{":feedbackLocation":d});break;case"slide":case"page":case"question":a=t.t("commonConfusionHolder",{":feedbackLocation":s.type+" "+s.value}),s.actual&&(s.value=s.actual,delete s.actual)}o&&(c='<input class="h5p-confusion-checkbox" type="checkbox"/>'+t.t("confusionLabel"));var u,f='\n  <div class="h5p-confusion-dialog h5p-popup-dialog" role="dialog" tabindex="-1">\n    <div class="h5p-confusion-dialog-container">\n      <div class="h5p-confusion-close" role="button" aria-label="'+t.t("close")+'" tabindex="0"></div>\n      <div class="h5p-confusion-container">\n        <div class="h5p-confusion-header">'+t.t("confusionTitle")+'</div>\n        <textarea class="h5p-confusion-text" maxlength="'+l+'">'+a+'</textarea>\n        <div class="h5p-confusion-bottom">\n          <label class="h5p-confusion-checkbox-label">\n          '+c+'</label>\n          <button class="h5p-confusion-button" title="'+t.t("confusionButton")+'" type="button">'+t.t("confusionButton")+"</button>\n        </div>\n      </div>\n    </div>\n  </div>\n  ",p=t.jQuery(f).insertAfter(e).click((function(e){u||e&&e.originalEvent&&e.originalEvent.preventClosing?u=!1:r.close()})).mouseleave((function(){u=!1})).children(".h5p-confusion-dialog-container").mousedown((function(){u=!0})).click((function(e){e&&e.originalEvent&&(e.originalEvent.preventClosing=!0)})).find(".h5p-confusion-close").click((function(){r.close()})).keypress((function(e){if(13===e.which||32===e.which)return r.close(),!1})).end().find(".h5p-confusion-button").click((function(){r.submit()})).end().find(".h5p-confusion-text").keyup((function(e){p.find(".h5p-confusion-button").removeAttr("disabled"),e.currentTarget.value.trim()?e.currentTarget.value.length>l&&(e.currentTarget.value=e.currentTarget.value.substring(0,l)):p.find(".h5p-confusion-button").attr("disabled","disabled")})).end().end(),h=function(e){e.preventDefault(),p.find(".h5p-confusion-close").first().focus()},v=function(e){9==e.keyCode&&e.shiftKey&&(e.preventDefault(),p.next().find(".h5p-confusion").focus())},g=function(e){9!=e.keyCode||e.shiftKey||(e.preventDefault(),p.find(".h5p-confusion-close").focus())},m=null,b=!1;r.open=function(){setTimeout((function(){r.activeElement=document.activeElement,p.addClass("h5p-open");var i=e[0].getBoundingClientRect().height,o=p.find(".h5p-confusion-dialog-container").height()+parseInt(p.css("padding-top"));i<o&&(e.css("height",o+"px"),t.trigger(n,"resize"),b=!0),p.focus(),p.find(".h5p-confusion-close").on("keydown",v),p.next().find(".h5p-confusion").on("keydown",g),e.find("*").on("focus",h),(m=e.find("*").not("[aria-hidden]")).attr("aria-hidden","true"),window.addEventListener("resize",y)}),1)};var y=function(){if(p.hasClass("h5p-open")){var t=e[0].getBoundingClientRect().height,n=p.find(".h5p-confusion-dialog-container").height()+parseInt(p.css("padding-top"));t<n&&(e.css("height",n+"px"),b=!0)}};r.close=function(){p.removeClass("h5p-open"),setTimeout((function(){p.next().find(".h5p-confusion").off("keydown",g),p.remove(),b&&(e.css("height",""),t.trigger(n,"resize")),e.find("*").off("focus",h),m.removeAttr("aria-hidden"),r.activeElement?r.activeElement.focus():(e.attr("tabindex","-1"),e.focus()),window.removeEventListener("resize",y)}),200)},r.submit=function(){var e,n,o=p.find(".h5p-confusion-text").first().val(),r=p[0].querySelector(".h5p-confusion-checkbox"),a=null;s&&Object.keys(s).length>0&&(a=JSON.stringify(s));var c=H5PIntegration.ajax.confusionFeedback.replace(":contentId",i),l={feedback:o,context:a,anonymous:r&&r.checked?1:0};"embed"!==(null===(e=window)||void 0===e||null===(n=e.H5PIntegration)||void 0===n?void 0:n.context)&&window.parent&&window.parent.ltiWorker?window.parent.ltiWorker.postConfusion(c,l):t.jQuery.ajax({url:c,type:"POST",data:l,dataType:"json",headers:{"x-csrf-token":H5PIntegration.csrfToken}}),p.find(".h5p-confusion-container").first().html('<div class="h5p-confusion-done-title">'+t.t("confusionDoneTitle")+'</div> <div class="h5p-confusion-done-text">'+t.t("confusionDoneText")+"</div>")}},t.attachToastTo=function(e,t,n){if(void 0!==e&&void 0!==t){var i=function(t){-1===function(e){var t=e.composedPath&&e.composedPath()||e.path,n=e.target;return null!=t?t.indexOf(window)<0?t.concat(window):t:n===window?[window]:[n].concat(function e(t,n){n=n||[];var i=t.parentNode;return i?e(i,n.concat(i)):n}(n),window)}(t).indexOf(e)&&(clearTimeout(c),o())},o=function(){document.removeEventListener("click",i),r.parentNode&&r.parentNode.removeChild(r)};(n=n||{}).style=n.style||"h5p-toast",n.duration=n.duration||3e3;var r=document.createElement("div");r.setAttribute("id",n.style),r.classList.add("h5p-toast-disabled"),r.classList.add(n.style);var a=document.createElement("span");a.innerHTML=t,r.appendChild(a),document.body.appendChild(r);var s=function(e,t,n){(n=n||{}).offsetHorizontal=n.offsetHorizontal||0,n.offsetVertical=n.offsetVertical||0;var i=t.getBoundingClientRect(),o=e.getBoundingClientRect(),r=0,a=0;switch(n.horizontal){case"before":r=o.left-i.width-n.offsetHorizontal;break;case"after":r=o.left+o.width+n.offsetHorizontal;break;case"left":r=o.left+n.offsetHorizontal;break;case"right":r=o.left+o.width-i.width-n.offsetHorizontal;break;default:r=o.left+o.width/2-i.width/2+n.offsetHorizontal}switch(n.vertical){case"above":a=o.top-i.height-n.offsetVertical;break;case"below":default:a=o.top+o.height+n.offsetVertical;break;case"top":a=o.top+n.offsetVertical;break;case"bottom":a=o.top+o.height-i.height-n.offsetVertical;break;case"centered":a=o.top+o.height/2-i.height/2+n.offsetVertical}var s=document.body.getBoundingClientRect();return(n.noOverflowLeft||n.noOverflowX)&&r<s.x&&(r=s.x),(n.noOverflowRight||n.noOverflowX)&&r+i.width>s.x+s.width&&(r=s.x+s.width-i.width),(n.noOverflowTop||n.noOverflowY)&&a<s.y&&(a=s.y),(n.noOverflowBottom||n.noOverflowY)&&a+i.height>s.y+s.height&&(r=s.y+s.height-i.height),{left:r,top:a}}(e,r,n.position);r.style.left=Math.round(s.left)+"px",r.style.top=Math.round(s.top)+"px",r.classList.remove("h5p-toast-disabled");var c=setTimeout(o,n.duration);document.addEventListener("click",i)}},t.ContentCopyrights=function(){var e,t=[],n=[];this.setLabel=function(t){e=t},this.addMedia=function(e){void 0!==e&&t.push(e)},this.addMediaInFront=function(e){void 0!==e&&t.unshift(e)},this.addContent=function(e){void 0!==e&&n.push(e)},this.toString=function(){for(var i="",o=0;o<t.length;o++)i+=t[o];for(o=0;o<n.length;o++)i+=n[o];return""!==i&&(void 0!==e&&(i="<h3>"+e+"</h3>"+i),i='<div class="h5p-content-copyrights">'+i+"</div>"),i}},t.MediaCopyright=function(e,n,i,o){var r,a=new t.DefinitionList,s=function(e){return void 0===n||void 0===n[e]?t.t(e):n[e]},c=function(e,n){var i,o,r=t.copyrightLicenses[e],a="";"PD"===e&&n||(a+=r.hasOwnProperty("label")?r.label:r),r.versions&&(!r.versions.default||n&&r.versions[n]||(n=r.versions.default),n&&r.versions[n]&&(i=r.versions[n])),i&&(a&&(a+=" "),a+=i.hasOwnProperty("label")?i.label:i),r.hasOwnProperty("link")?o=r.link.replace(":version",r.linkVersions?r.linkVersions[n]:n):i&&r.hasOwnProperty("link")&&(o=i.link),o&&(a='<a href="'+o+'" target="_blank">'+a+"</a>");var s="";return"PD"!==e&&"C"!==e&&(s+=e),n&&"CC0 1.0"!==n&&(s&&"GNU GPL"!==e&&(s+=" "),s+=n),s&&(a+=" ("+s+")"),"C"===e&&(a+=" &copy;"),a};if(void 0!==e){for(var l in o)o.hasOwnProperty(l)&&(e[l]=o[l]);void 0===i&&(i=["contentType","title","license","author","year","source","licenseExtras","changes"]);for(var d=0;d<i.length;d++){var u=i[d];if(void 0!==e[u]&&""!==e[u]){var f=e[u];"license"===u&&(f=c(e.license,e.version)),"source"===u&&(f=f?'<a href="'+f+'" target="_blank">'+f+"</a>":void 0),a.add(new t.Field(s(u),f))}}}this.setThumbnail=function(e){r=e},this.undisclosed=function(){if(1===a.size()){var e=a.get(0);if(e.getLabel()===s("license")&&e.getValue()===c("U"))return!0}return!1},this.toString=function(){var e="";return this.undisclosed()||(void 0!==r&&(e+=r),""!==(e+=a)&&(e='<div class="h5p-media-copyright">'+e+"</div>")),e}},t.Thumbnail=function(e,t,n,i){var o;void 0!==t&&(o=Math.round(t/n*100)),this.toString=function(){return'<img src="'+e+'" alt="'+(i||"")+'" class="h5p-thumbnail" height="100"'+(void 0===o?"":' width="'+o+'"')+"/>"}},t.Field=function(e,t){this.getLabel=function(){return e},this.getValue=function(){return t}},t.DefinitionList=function(){var e=[];this.add=function(t){e.push(t)},this.size=function(){return e.length},this.get=function(t){return e[t]},this.toString=function(){for(var t="",n=0;n<e.length;n++){var i=e[n];t+="<dt>"+i.getLabel()+"</dt><dd>"+i.getValue()+"</dd>"}return""===t?t:'<dl class="h5p-definition-list">'+t+"</dl>"}},t.Coords=function(n,i,o,r){return this instanceof t.Coords?(this.x=0,this.y=0,this.w=1,this.h=1,"object"===e(n)?(this.x=n.x,this.y=n.y,this.w=n.w,this.h=n.h):(void 0!==n&&(this.x=n),void 0!==i&&(this.y=i),void 0!==o&&(this.w=o),void 0!==r&&(this.h=r)),this):new t.Coords(n,i,o,r)},t.libraryFromString=function(e){var t=/(.+)\s(\d+)\.(\d+)$/g.exec(e);return null!==t&&{machineName:t[1],majorVersion:parseInt(t[2]),minorVersion:parseInt(t[3])}},t.getLibraryPath=function(e){return H5PIntegration&&H5PIntegration.libraryDirectories&&e in H5PIntegration.libraryDirectories&&(e=H5PIntegration.libraryDirectories[e]),void 0!==H5PIntegration.urlLibraries?H5PIntegration.urlLibraries+"/"+e:H5PIntegration.url+"/libraries/"+e},t.cloneObject=function(n,i){var o=n instanceof Array?[]:{};for(var r in n)n.hasOwnProperty(r)&&(void 0!==i&&i&&"object"===e(n[r])?o[r]=t.cloneObject(n[r],i):o[r]=n[r]);return o},t.trim=function(e){return e.replace(/^\s+|\s+$/g,"")},t.isEmpty=function(n){if(!n&&0!==n&&!1!==n)return!0;if(Array.isArray(n)){for(var i=0;i<n.length;i++)if(!t.isEmpty(n[i]))return!1;return!0}if("object"===e(n)){for(var o in n)if(n.hasOwnProperty(o)&&!t.isEmpty(n[o]))return!1;return!0}return!1},t.jsLoaded=function(e){return H5PIntegration.loadedJs=H5PIntegration.loadedJs||[],-1!==t.jQuery.inArray(e,H5PIntegration.loadedJs)},t.cssLoaded=function(e){return H5PIntegration.loadedCss=H5PIntegration.loadedCss||[],-1!==t.jQuery.inArray(e,H5PIntegration.loadedCss)},t.shuffleArray=function(e){if(e instanceof Array){var t,n,i,o=e.length;if(0===o)return!1;for(;--o;)t=Math.floor(Math.random()*(o+1)),n=e[o],i=e[t],e[o]=i,e[t]=n;return e}},Array.prototype.indexOf||(Array.prototype.indexOf=function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return t;return-1}),void 0===String.prototype.trim&&(String.prototype.trim=function(){return t.trim(this)}),t.trigger=function(e,t,n,i){void 0!==e.trigger?e.trigger(t,n,i):void 0!==e.$&&void 0!==e.$.trigger&&e.$.trigger(t)},t.on=function(e,t,n){void 0!==e.on?e.on(t,n):void 0!==e.$&&void 0!==e.$.on&&e.$.on(t,n)},t.createUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},t.createTitle=function(e,n){if(!e)return"";void 0===n&&(n=60);var i=t.jQuery("<div></div>").text(e.replace(/(<([^>]+)>)/gi,"")).text();return i.length>n&&(i=i.substr(0,n-3)+"..."),i},function(e){function n(n,i,o,r,a,s,c,l){var d,u;if(void 0!==H5PIntegration.user){var f=H5PIntegration.ajax.contentUserData.replace(":contentId",n).replace(":dataType",i).replace(":subContentId",o||0);if(void 0===a){var p={type:"GET",url:f,dataType:"json",async:void 0===l||l};void 0!==r&&(p.error=function(e,t){r(t)},p.success=function(e){e.success?!1!==e.data&&void 0!==e.data?r(void 0,e.data):r():r(e.message)}),"embed"!==(null===(d=window)||void 0===d||null===(u=d.H5PIntegration)||void 0===u?void 0:u.context)&&window.parent&&window.parent.ltiWorker?window.parent.ltiWorker.contentUserData(p):e.ajax(p)}else{var h=t.sendBeacon(f,{data:null===a?0:a,preload:s?1:0,invalidate:c?1:0});void 0!==r&&r(h?void 0:"failed sending")}}else r("Not signed in.")}t.sendBeacon=function(e,n){var i,o;if("embed"!==(null===(i=window)||void 0===i||null===(o=i.H5PIntegration)||void 0===o?void 0:o.context)&&window.parent&&window.parent.ltiWorker)return window.parent.ltiWorker.sendBeacon(e,n),!0;t.externalDispatcher.trigger("before-send-beacon",{data:n,url:e});var r=new FormData;for(var a in n)r.append(a,n[a]);return navigator.sendBeacon(e,r)};var i=function(e,t,n){return"h5p-user-data-".concat(e,"-").concat(t,"-").concat(n)};t.getUserData=function(e,t,o,r){r||(r=0),H5PIntegration.contents=H5PIntegration.contents||{};var a=H5PIntegration.contents["cid-"+e]||{},s=a.contentUserData;if(s&&s[r]&&void 0!==s[r][t]){if("RESET"===s[r][t])return void o(void 0,null,!0);if("ANSWERED"===s[r][t])return void o(void 0,null);try{o(void 0,JSON.parse(s[r][t]))}catch(e){o(e)}}else if("state"!==t){var c=i(e,t,r);try{var l=JSON.parse(localStorage.getItem(c));if(null!==l)return void o(void 0,l)}catch(e){}n(e,t,r,(function(e,n){if(e||void 0===n)o(e,n);else{void 0===a.contentUserData&&(a.contentUserData=s={}),void 0===s[r]&&(s[r]={}),s[r][t]=n;try{if(n)try{localStorage.setItem(c,n)}catch(e){}o(void 0,n)}catch(e){o(e)}}}))}},t.setUserData=function(e,o,r,a){var s=t.jQuery.extend(!0,{},{subContentId:0,preloaded:!0,deleteOnChange:!1,async:!0},a);try{r=JSON.stringify(r)}catch(e){return void(s.errorCallback&&s.errorCallback(e))}var c=H5PIntegration.contents["cid-"+e];void 0===c&&(c=H5PIntegration.contents["cid-"+e]={}),c.contentUserData||(c.contentUserData={});var l=c.contentUserData;if(void 0===l[s.subContentId]&&(l[s.subContentId]={}),r!==l[s.subContentId][o]){if(l[s.subContentId][o]=r,"state"!==o)try{localStorage.setItem(i(e,o,s.subContentId),r)}catch(e){}n(e,o,s.subContentId,(function(e){s.errorCallback&&e&&s.errorCallback(e)}),r,s.preloaded,s.deleteOnChange,s.async)}},t.deleteUserData=function(e,t,i){i||(i=0);var o=H5PIntegration.contents["cid-"+e].contentUserData;o&&o[i]&&o[i][t]&&delete o[i][t],n(e,t,i,void 0,null)},t.getContentForInstance=function(e){var t="cid-"+e;return H5PIntegration&&H5PIntegration.contents&&H5PIntegration.contents[t]?H5PIntegration.contents[t]:void 0},t.ClipboardItem=function(e,t,n){var i=this;t||(t="action",e={action:e}),i.specific=e,t&&e[t]&&(i.generic=t),n&&(i.from=n),window.H5PEditor&&H5PEditor.contentId&&(i.contentId=H5PEditor.contentId),i.specific.width||i.specific.height||function(){if(i.generic){var e=i.specific[i.generic];e.params.file&&e.params.file.width&&e.params.file.height&&(i.width=20,i.height=e.params.file.height/e.params.file.width*i.width)}}()},t.clipboardify=function(e){e instanceof t.ClipboardItem||(e=new t.ClipboardItem(e)),t.setClipboard(e)},t.getClipboard=function(){return o()},t.setClipboard=function(e){localStorage.setItem("h5pClipboard",JSON.stringify(e)),t.externalDispatcher.trigger("datainclipboard",{reset:!1})},t.getLibraryConfig=function(e){return H5PIntegration.libraryConfig&&H5PIntegration.libraryConfig[e]?H5PIntegration.libraryConfig[e]:{}};var o=function(){var e=localStorage.getItem("h5pClipboard");if(e){try{e=JSON.parse(e)}catch(e){return void console.error("Unable to parse JSON from clipboard.",e)}return r(e.specific,(function(t){var n;return"#tmp"===t.substr(-4,4)||!e.contentId||t.match(/^https?:\/\//i)?t:(n=H5PEditor.contentId?"../"+e.contentId+"/":(H5PEditor.contentRelUrl?H5PEditor.contentRelUrl:"../content/")+e.contentId+"/",t.substr(0,n.length)===n?t:n+t)})),e.generic&&(e.generic=e.specific[e.generic]),e}},r=function e(t,n){for(var i in t)if(t.hasOwnProperty(i)&&t[i]instanceof Object){var o=t[i];void 0!==o.path&&void 0!==o.mime?o.path=n(o.path):(void 0!==o.library&&void 0!==o.subContentId&&delete o.subContentId,e(o,n))}};e(document).ready((function(){window.addEventListener("storage",(function(e){"h5pClipboard"===e.key&&t.externalDispatcher.trigger("datainclipboard",{reset:null===e.newValue})}));var e={default:"4.0","4.0":t.t("licenseCC40"),"3.0":t.t("licenseCC30"),2.5:t.t("licenseCC25"),"2.0":t.t("licenseCC20"),"1.0":t.t("licenseCC10")};t.copyrightLicenses={U:t.t("licenseU"),"CC BY":{label:t.t("licenseCCBY"),link:"http://creativecommons.org/licenses/by/:version",versions:e},"CC BY-SA":{label:t.t("licenseCCBYSA"),link:"http://creativecommons.org/licenses/by-sa/:version",versions:e},"CC BY-ND":{label:t.t("licenseCCBYND"),link:"http://creativecommons.org/licenses/by-nd/:version",versions:e},"CC BY-NC":{label:t.t("licenseCCBYNC"),link:"http://creativecommons.org/licenses/by-nc/:version",versions:e},"CC BY-NC-SA":{label:t.t("licenseCCBYNCSA"),link:"http://creativecommons.org/licenses/by-nc-sa/:version",versions:e},"CC BY-NC-ND":{label:t.t("licenseCCBYNCND"),link:"http://creativecommons.org/licenses/by-nc-nd/:version",versions:e},"CC0 1.0":{label:t.t("licenseCC010"),link:"https://creativecommons.org/publicdomain/zero/1.0/"},"GNU GPL":{label:t.t("licenseGPL"),link:"http://www.gnu.org/licenses/gpl-:version-standalone.html",linkVersions:{v3:"3.0",v2:"2.0",v1:"1.0"},versions:{default:"v3",v3:t.t("licenseV3"),v2:t.t("licenseV2"),v1:t.t("licenseV1")}},PD:{label:t.t("licensePD"),versions:{"CC0 1.0":{label:t.t("licenseCC010"),link:"https://creativecommons.org/publicdomain/zero/1.0/"},"CC PDM":{label:t.t("licensePDM"),link:"https://creativecommons.org/publicdomain/mark/1.0/"}}},"ODC PDDL":'<a href="http://opendatacommons.org/licenses/pddl/1.0/" target="_blank">Public Domain Dedication and Licence</a>',"CC PDM":{label:t.t("licensePDM"),link:"https://creativecommons.org/publicdomain/mark/1.0/"},C:t.t("licenseC")};try{var n=window.parent.H5P.externalDispatcher;n!==t.externalDispatcher&&t.externalDispatcher.on("*",(function(e){n.trigger.call(this,e)}))}catch(e){}if(t.preventInit||t.init(document.body),0!==t.instances.length&&!1!==H5PIntegration.saveFreq){var i=0,o=function(){var e=Date.now();if(e-i>250){i=e;for(var n=0;n<t.instances.length;n++){var o=t.instances[n];if(o.getCurrentState instanceof Function||"function"==typeof o.getCurrentState){var r=o.getCurrentState();void 0!==r&&t.setUserData(o.contentId,"state",r,{deleteOnChange:!0,async:!1})}}}};t.$window.one("beforeunload unload",(function(){t.$window.off("pagehide beforeunload unload"),o()})),t.$window.on("pagehide",o),window.document.addEventListener("visibilitychange",(function(){"hidden"===window.document.visibilityState&&o()}))}}))}(t.jQuery)})(),(e=window.H5P=window.H5P||{}).Event=function(e,t,n){this.type=e,this.data=t;var i=!1,o=!1,r=!1;void 0===n&&(n={}),!0===n.bubbles&&(i=!0),!0===n.external&&(o=!0),this.preventBubbling=function(){i=!1},this.getBubbles=function(){return i},this.scheduleForExternal=function(){return!(!o||r||(r=!0,0))}},e.EventDispatcher=function(){var t=this,n={};this.on=function(e,i,o){if("function"!=typeof i)throw TypeError("listener must be a function");t.trigger("newListener",{type:e,listener:i});var r={listener:i,thisArg:o};n[e]?n[e].push(r):n[e]=[r]},this.once=function(e,n,i){if(!(n instanceof Function))throw TypeError("listener must be a function");t.on(e,(function e(i){t.off(i.type,e),n.call(this,i)}),i)},this.off=function(e,i){if(void 0!==i&&!(i instanceof Function))throw TypeError("listener must be a function");if(void 0!==n[e]){if(void 0===i)return delete n[e],void t.trigger("removeListener",e);for(var o=0;o<n[e].length;o++)if(n[e][o].listener===i){n[e].splice(o,1),t.trigger("removeListener",e,{listener:i});break}n[e].length||delete n[e]}};var i=function(e,t){if(void 0!==n[e])for(var i=n[e].slice(),o=0;o<i.length;o++){var r=i[o],a=r.thisArg?r.thisArg:this;r.listener.call(a,t)}};this.trigger=function(n,o,r){if(void 0!==n){n instanceof String||"string"==typeof n?n=new e.Event(n,o,r):void 0!==o&&(n.data=o);var a=n.scheduleForExternal();i.call(this,n.type,n),i.call(this,"*",n),n.getBubbles()&&t.parent instanceof e.EventDispatcher&&(t.parent.trigger instanceof Function||"function"==typeof t.parent.trigger)&&t.parent.trigger(n),a&&e.externalDispatcher.trigger.call(this,n)}}},(t=window.H5P=window.H5P||{}).XAPIEvent=function(){t.Event.call(this,"xAPI",{statement:{}},{bubbles:!0,external:!0})},t.XAPIEvent.prototype=Object.create(t.Event.prototype),t.XAPIEvent.prototype.constructor=t.XAPIEvent,t.XAPIEvent.prototype.setScoredResult=function(e,t,n,i,o){if(this.data.statement.result={},void 0!==e&&(void 0===t?this.data.statement.result.score={raw:e}:(this.data.statement.result.score={min:0,max:t,raw:e},t>0&&(this.data.statement.result.score.scaled=Math.round(e/t*1e4)/1e4))),this.data.statement.result.completion=void 0===i?"completed"===this.getVerb()||"answered"===this.getVerb():i,void 0!==o&&(this.data.statement.result.success=o),n&&n.activityStartTime){var r=Math.round((Date.now()-n.activityStartTime)/10)/100;this.data.statement.result.duration="PT"+r+"S"}},t.XAPIEvent.prototype.setVerb=function(e){-1!==t.jQuery.inArray(e,t.XAPIEvent.allowedXAPIVerbs)?this.data.statement.verb={id:"http://adlnet.gov/expapi/verbs/"+e,display:{"en-US":e}}:void 0!==e.id&&(this.data.statement.verb=e)},t.XAPIEvent.prototype.getVerb=function(e){var t=this.data.statement;return"verb"in t?!0===e?t.verb:t.verb.id.slice(31):null},t.XAPIEvent.prototype.setObject=function(e){if(e.contentId)if(this.data.statement.object={id:this.getContentXAPIId(e),objectType:"Activity",definition:{extensions:{"http://h5p.org/x-api/h5p-local-content-id":e.contentId}}},e.subContentId)this.data.statement.object.definition.extensions["http://h5p.org/x-api/h5p-subContentId"]=e.subContentId,"function"==typeof e.getTitle&&(this.data.statement.object.definition.name={"en-US":e.getTitle()});else{var n=t.getContentForInstance(e.contentId);n&&n.metadata&&n.metadata.title&&(this.data.statement.object.definition.name={"en-US":t.createTitle(n.metadata.title)})}else this.data.statement.object={definition:{}}},t.XAPIEvent.prototype.setContext=function(e){e.parent&&(e.parent.contentId||e.parent.subContentId)&&(this.data.statement.context={contextActivities:{parent:[{id:this.getContentXAPIId(e.parent),objectType:"Activity"}]}}),e.libraryInfo&&(void 0===this.data.statement.context&&(this.data.statement.context={contextActivities:{}}),this.data.statement.context.contextActivities.category=[{id:"http://h5p.org/libraries/"+e.libraryInfo.versionedNameNoSpaces,objectType:"Activity"}])},t.XAPIEvent.prototype.setActor=function(){if(void 0!==H5PIntegration.user&&H5PIntegration.user.name&&H5PIntegration.user.mail)this.data.statement.actor={name:H5PIntegration.user.name,mbox:"mailto:"+H5PIntegration.user.mail,objectType:"Agent"};else{var e;try{localStorage.H5PUserUUID?e=localStorage.H5PUserUUID:(e=t.createUUID(),localStorage.H5PUserUUID=e)}catch(n){e="not-trackable-"+t.createUUID()}this.data.statement.actor={account:{name:e,homePage:H5PIntegration.siteUrl},objectType:"Agent"}}},t.XAPIEvent.prototype.getMaxScore=function(){return this.getVerifiedStatementValue(["result","score","max"])},t.XAPIEvent.prototype.getScore=function(){return this.getVerifiedStatementValue(["result","score","raw"])},t.XAPIEvent.prototype.getContentXAPIId=function(e){var t;return e.contentId&&H5PIntegration&&H5PIntegration.contents&&H5PIntegration.contents["cid-"+e.contentId]&&(t=H5PIntegration.contents["cid-"+e.contentId].url,e.subContentId&&(t+="?subContentId="+e.subContentId)),t},t.XAPIEvent.prototype.isFromChild=function(){var e=this.getVerifiedStatementValue(["context","contextActivities","parent",0,"id"]);return!e||-1===e.indexOf("subContentId")},t.XAPIEvent.prototype.getVerifiedStatementValue=function(e){for(var t=this.data.statement,n=0;n<e.length;n++){if(void 0===t[e[n]])return null;t=t[e[n]]}return t},t.XAPIEvent.allowedXAPIVerbs=["answered","asked","attempted","attended","commented","completed","exited","experienced","failed","imported","initialized","interacted","launched","mastered","passed","preferred","progressed","registered","responded","resumed","scored","shared","suspended","terminated","voided","downloaded","copied","accessed-reuse","accessed-embed","accessed-copyright","accessed-confusion"],(n=window.H5P=window.H5P||{}).externalDispatcher=new n.EventDispatcher,n.EventDispatcher.prototype.triggerXAPI=function(e,t){this.trigger(this.createXAPIEventTemplate(e,t))},n.EventDispatcher.prototype.createXAPIEventTemplate=function(e,t){var i=new n.XAPIEvent;if(i.setActor(),i.setVerb(e),void 0!==t)for(var o in t)i.data.statement[o]=t[o];return"object"in i.data.statement||i.setObject(this),"context"in i.data.statement||i.setContext(this),i},n.EventDispatcher.prototype.triggerXAPICompleted=function(e,t,n){this.triggerXAPIScored(e,t,"completed",!0,n)},n.EventDispatcher.prototype.triggerXAPIScored=function(e,t,n,i,o){var r=this.createXAPIEventTemplate(n);r.setScoredResult(e,t,this,i,o),this.trigger(r)},n.EventDispatcher.prototype.setActivityStarted=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(void 0===this.activityStartTime||e)&&(void 0!==this.contentId&&void 0!==H5PIntegration.contents&&void 0!==H5PIntegration.contents["cid-"+this.contentId]&&this.triggerXAPI("attempted"),this.activityStartTime=Date.now())},i=p(6203),o=p(9933),r=p(2093),function(e){"use strict";var t=window.H5P&&window.H5P.isFramed,n=window.H5PIntegration&&H5PIntegration.externalLRS&&H5PIntegration.externalLRS.enabled;if(t&&n){var a=window.H5PIntegration.externalLRS,s=window.H5PIntegration?H5PIntegration.csrfToken:e('meta[name="csrf-token"]').attr("content"),c=new i(s,a.excludedVerbs);H5P.externalDispatcher.on("xAPI",(function(e){if(!r((function(){return e.addedToLRSQueue})))try{r((function(){return e.data.statement}))&&(c.add(new o(e,a.anonymous)),e.addedToLRSQueue=!0)}catch(e){}}))}}(H5P.jQuery),H5P.ContentType=function(e){function t(){}return t.prototype=new H5P.EventDispatcher,t.prototype.isRoot=function(){return e},t.prototype.getLibraryFilePath=function(e){return H5P.getLibraryPath(this.libraryInfo.versionedNameNoSpaces)+"/"+e},t},H5P.ConfirmationDialog=function(e){"use strict";function t(t){e.call(this);var n=this;H5P.ConfirmationDialog.uniqueId+=1;var i=H5P.ConfirmationDialog.uniqueId;function o(e){n.hide(),n.trigger("confirmed"),e.preventDefault()}function r(e){n.hide(),n.trigger("canceled"),e.preventDefault()}function a(e,t){e.focus(),t.preventDefault()}(t=t||{}).headerText=t.headerText||H5P.t("confirmDialogHeader"),t.dialogText=t.dialogText||H5P.t("confirmDialogBody"),t.cancelText=t.cancelText||H5P.t("cancelLabel"),t.confirmText=t.confirmText||H5P.t("confirmLabel");var s=!1,c=document.createElement("div");c.classList.add("h5p-confirmation-dialog-background","hidden","hiding");var l=document.createElement("div");l.classList.add("h5p-confirmation-dialog-popup","hidden"),t.classes&&t.classes.forEach((function(e){l.classList.add(e)})),l.setAttribute("role","dialog"),l.setAttribute("aria-labelledby","h5p-confirmation-dialog-dialog-text-"+i),c.appendChild(l),l.addEventListener("keydown",(function(e){"Escape"===e.key&&r(e)}));var d=document.createElement("div");d.classList.add("h5p-confirmation-dialog-header"),l.appendChild(d);var u=document.createElement("div");u.classList.add("h5p-confirmation-dialog-header-text"),u.innerHTML=t.headerText,d.appendChild(u);var f=document.createElement("div");f.classList.add("h5p-confirmation-dialog-body"),l.appendChild(f);var p=document.createElement("div");p.classList.add("h5p-confirmation-dialog-text"),p.innerHTML=t.dialogText,p.id="h5p-confirmation-dialog-dialog-text-"+i,f.appendChild(p);var h=document.createElement("div");h.classList.add("h5p-confirmation-dialog-buttons"),f.appendChild(h);var v=document.createElement("button");v.classList.add("h5p-core-cancel-button"),v.textContent=t.cancelText;var g=document.createElement("button");g.classList.add("h5p-core-button"),g.classList.add("h5p-confirmation-dialog-confirm-button"),g.textContent=window.innerWidth>=576?t.confirmText:"",g.setAttribute("aria-label",t.confirmText);var m,b,y=document.createElement("button");y.classList.add("h5p-confirmation-dialog-exit"),y.tabIndex=-1,y.setAttribute("aria-label",t.cancelText),v.addEventListener("click",r),v.addEventListener("keydown",(function(e){" "===e.key?r(e):"Tab"===e.key&&e.shiftKey&&a(t.hideExit?g:y,e)})),t.hideCancel?h.classList.add("center"):h.appendChild(v),g.addEventListener("click",o),g.addEventListener("keydown",(function(e){if(" "===e.key)o(e);else if("Tab"===e.key&&!e.shiftKey){var n=g;t.hideExit?t.hideCancel||(n=v):n=y,a(n,e)}})),h.appendChild(g),y.addEventListener("click",r),y.addEventListener("keydown",(function(e){" "===e.key?r(e):"Tab"!==e.key||e.shiftKey||a(t.hideCancel?g:v,e)})),t.hideExit||l.appendChild(y);var w,P=[],H=[];this.appendTo=function(e){return m=e,this};var x=function(e){c.contains(e.target)||(e.preventDefault(),g.focus())},I=function(e){var t,n=[],i=e.parentNode.children;for(t=0;t<i.length;t+=1)n[t]=!!i[t].getAttribute("aria-hidden"),i[t]!==e&&i[t].setAttribute("aria-hidden",!0);return n},C=function(e,t){var n,i=e.parentNode.children;for(n=0;n<i.length;n+=1)i[n]===e||t[n]||i[n].removeAttribute("aria-hidden")};this.show=function(e){return w=document.activeElement,m.appendChild(c),(b=m.parentNode||m).addEventListener("focus",x,!0),P=I(m),H=I(c),c.classList.remove("hidden"),function(e){var t=parseInt(l.style.top,10);void 0!==e&&(t=e),t||(t=0),t+l.offsetHeight>m.offsetHeight&&(t=m.offsetHeight-l.offsetHeight-8),t-32<=0&&(t=40,s=!0),l.style.top=t+"px"}(e),setTimeout((function(){l.classList.remove("hidden"),c.classList.remove("hiding"),setTimeout((function(){if(g.focus(),s&&t.instance){var e=parseInt(l.offsetHeight,10)+32+16;n.setViewPortMinimumHeight(e),t.instance.trigger("resize"),s=!1}}),100)}),0),this},this.hide=function(){return c.classList.add("hiding"),l.classList.add("hidden"),b.removeAttribute("aria-hidden"),b.removeEventListener("focus",x,!0),t.skipRestoreFocus||w.focus(),C(m,P),C(c,H),setTimeout((function(){c.classList.add("hidden"),m.removeChild(c),n.setViewPortMinimumHeight(null)}),100),this},this.getElement=function(){return l},this.getPreviouslyFocused=function(){return w},this.setViewPortMinimumHeight=function(e){(document.querySelector(".h5p-container")||document.body).style.minHeight="number"==typeof e?e+"px":e}}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t}(H5P.EventDispatcher),H5P.ConfirmationDialog.uniqueId=-1,H5P.ActionBar=function(e,t){"use strict";function n(n,i){t.call(this);var o=this,r=!1,a=H5P.jQuery('<ul class="h5p-actions"></ul>'),s=function(e,t,n){var i=H5P.jQuery("<li/>",{class:"h5p-button h5p-noselect h5p-"+(t||e),appendTo:a}),s=H5P.jQuery("<button/>",{"aria-label":H5P.t(e+"Description"),html:H5P.t(e),click:function(){o.trigger(e)},appendTo:i});H5P.Tooltip(s.get(0),{position:null!=n?n:"top"}),r=!0};if(n.icon){var c=H5P.jQuery('<li class="h5p-button h5p-noselect h5p-logo"><a class="h5p-link" href="http://h5p.org" aria-label="'+H5P.t("h5pDescription")+'" target="_blank"></a></li>').appendTo(a);H5P.Tooltip(c.find(".h5p-link").get(0)),r=!0}if((n.export||n.copy)&&s("reuse","export"),n.copyright&&s("copyrights"),n.embed&&s("embed"),n.confusion&&(s("confusion",void 0,"left"),void 0!==H5PIntegration.user)){var l="confusion-tip-confirm";H5P.getUserData(0,l,(function(t,n){if(!n){var r=e("<div/>",{class:"h5p-confusion-tip",role:"alertdialog","aria-describedby":"h5p-confusion-tip-body",html:'<div id="h5p-confusion-tip-body">'+H5P.t("confusionTipText")+"</div>",appendTo:a});e("<button>",{class:"h5p-confusion-tip-close-button",type:"button",html:H5P.t("confusionTipCloseButtonLabel"),click:function(){r.one("transitionend",(function(){r.remove(),i.css("min-height",""),o.trigger("resize")})),r.removeClass("show"),H5P.setUserData(0,l,!0)},appendTo:r}),i.css("min-height",r.outerHeight()+30),o.trigger("resize");var s=function(){clearTimeout(c),r.addClass("show")},c=setTimeout(s,1e3);H5P.externalDispatcher.once("iframeResized",s)}}))}o.getDOMElement=function(){return a},o.hasActions=function(){return r}}return n.prototype=Object.create(t.prototype),n.prototype.constructor=n,n}(H5P.jQuery,H5P.EventDispatcher),H5P.AttemptsBar=function(e){function t(t,n,i){var o,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=this;e.call(this);var s=H5P.jQuery('<div class="h5p-attempts"></div>').insertBefore(t);s.attr("aria-live","polite");var c=H5P.jQuery('<div class="h5p-attempt-close" role="button" tabindex="0"></div>');c.attr("aria-label",H5P.t("attemptBarClose"));var l,d=H5P.jQuery('<button class="h5p-attempt-reset"><p>'+H5P.t("stateReset")+"</p></button>"),u=r,f=t.data("content-id");H5PIntegration.contents=H5PIntegration.contents||{};var p=H5PIntegration.contents["cid-"+f]||{},h=p.contentUserStatus.numAttempts,v=null!==(o=p.contentUserStatus.lastPercentageScore)&&void 0!==o?o:void 0;n.hasClass("h5p-interactive-book")||n.hasClass("h5p-cornell")||n.hasClass("h5p-branching-scenario")?s.addClass("fullscreen-on-top"):(n.hasClass("h5p-interactive-video")||n.hasClass("h5p-course-presentation"))&&s.addClass("fullscreen-cover"),a.hideBar=function(){s.hide()},a.close=function(){s.slideUp("fast",null),l&&(clearTimeout(l),l=!1),t.removeClass("has-attempt-bar")};var g=function(){delete p.contentUserData,d.detach()},m=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];s.html(e),t&&d.appendTo(s).click((function(){var e;(e=new H5P.ConfirmationDialog({headerText:H5P.t("stateResetDialogTitle"),dialogText:H5P.t("stateResetDialogDescription"),instance:i}).appendTo(document.body)).on("confirmed",(function(){g(),setTimeout((function(){H5P.trigger(i,"resetState")}),150)})),e.show()})),c.appendTo(s).click((function(e){a.close()})).keypress((function(e){32!==e.which&&13!==e.which||a.close()}))},b=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";s.removeClass("success"),s.removeClass("failed"),s.removeClass("submit"),""==!e&&s.addClass(e),s.is(":hidden")&&!u&&s.slideDown({duration:"fast",start:function(){s.css("display","")},complete:function(){H5P.trigger(i,"resize")}}),(n.hasClass("h5p-interactive-book")||n.hasClass("h5p-branching-scenario"))&&t.addClass("has-attempt-bar")};a.info=function(){var e=1===h?"attemptsInfo":"attemptsInfoPlural",t='<span class="h5p-attempt-text">'+H5P.t(e,{":num":'<span class="h5p-attempt-number">'+h.toString()+"</span>"})+"</span>",n=parseFloat(v);isNaN(n)||(t+='<span class="h5p-attempt-text"> '+H5P.t("attemptsLastScore",{":percentage":n})+"</span>");var i=!!p.contentUserData&&p.contentUserData&&!!p.contentUserData[0].state&&"RESET"!==p.contentUserData[0].state&&"ANSWERED"!==p.contentUserData[0].state&&!H5P.isEmpty(JSON.parse(p.contentUserData[0].state));m(t,i),b()},a.submit=function(){l&&(clearTimeout(l),l=!1);var e='<div class="h5p-attempt-submit"></div>'+H5P.t("attemptSubmitting");m(e),b("submit"),a.trigger("submit")},a.success=function(e,t){m(H5P.t("attemptSubmitted")),b("success"),h=e,v=null!=t?t:v,l=setTimeout((function(){g(),a.info(),H5P.trigger(i,"resize"),l=!1}),2e3)},a.showError=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:H5P.t("attemptFailConnect");m(e),b("failed")},a.savedState=function(){var e='<span class="h5p-attempt-text">'+H5P.t("stateRetored")+"</span>";m(e,!0),b()},a.getNumAttempts=function(){return h},a.setAttemptUrl=function(e){a.trigger("success",e)},a.detach=function(){s.detach()}}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t}(H5P.EventDispatcher),function(e){function t(){var t=e(this),n=e(t.data("h5p-visibility-subject-selector")),i=function(){n.toggle(t.is(":checked"))};t.change(i),i()}function n(){var t=e(this),n=e("#"+t.data("control"));if(n.data("value")){var i=!1,o=t.html();t.click((function(){i?(n.val(""),t.html(o),i=!1):(n.val(n.data("value")),t.html(t.data("hide")),i=!0)}))}else t.remove()}e(document).ready((function(){e(".h5p-visibility-toggler").each(t),e(".h5p-reveal-value").each(n)}))}(H5P.jQuery),(()=>{function e(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return t(e,n)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}H5P.Tooltip=function(){"use strict";var t={allowed:["top","bottom","left","right"],default:"top"};return function(n,i){var o;H5P.Tooltip.uniqueId+=1;var r="h5p-tooltip-"+H5P.Tooltip.uniqueId;(i=i||{}).classes=i.classes||[],i.ariaHidden=i.ariaHidden||!0,i.tooltipSource=i.tooltipSource||"aria-label",i.position=i.position&&t.allowed.includes(i.position)?i.position:t.default,i.classes.push("h5p-tooltip"),"left"!==i.position&&"right"!==i.position||i.classes.push("h5p-tooltip-narrow");var a,s,c,l=!1,d=!1,u=function(e){"Escape"===e.key&&f.classList.remove("h5p-tooltip-visible")},f=document.createElement("div");f.id=r,f.role="tooltip",f.innerHTML=i.text||n.getAttribute(i.tooltipSource)||"",f.setAttribute("aria-hidden",i.ariaHidden),(o=f.classList).add.apply(o,e(i.classes)),document.body.appendChild(f),i.ariaHidden||n.setAttribute("aria-describedby",r),new MutationObserver((function(e){var t=e[0].target.getAttribute(i.tooltipSource);null===f.parentNode&&n.appendChild(f),f.innerHTML=i.text||t,0===f.innerHTML.trim().length&&f.classList.contains("h5p-tooltip-visible")&&f.classList.remove("h5p-tooltip-visible")})).observe(n,{attributes:!0,attributeFilter:[i.tooltipSource,"class"]});var p=function e(t){if(!0!==(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])){if(0!==f.innerHTML.trim().length){"mouseenter"===t.type?l=!0:d=!0,f.style.left="",f.style.top="",f.classList.add("h5p-tooltip-visible"),document.body.addEventListener("keydown",u,!0),void 0===a&&(a=n.closest(".h5p-container"));var o=a?a.getBoundingClientRect():document.documentElement.getBoundingClientRect(),r=n.getBoundingClientRect(),c=f.getBoundingClientRect();if("top"===i.position)f.style.left=r.left+r.width/2-c.width/2+"px",f.style.top=r.top-c.height+"px";else if("bottom"===i.position)f.style.left=r.left+r.width/2-c.width/2+"px",f.style.top=r.bottom+"px";else{if("left"===i.position)return f.style.left=r.left-c.width+"px",void(f.style.top=r.top+(r.height-c.height)/2+"px");if("right"===i.position)return f.style.left=r.right+"px",void(f.style.top=r.top+(r.height-c.height)/2+"px")}(c=f.getBoundingClientRect()).left>=0&&c.top>=0&&c.right<=o.width&&c.bottom<=o.height||((c=f.getBoundingClientRect()).left<0?f.style.left=0:c.right>o.width&&(f.style.left="",f.style.right=0))}}else s=setTimeout((function(){e(t,!1)}),300)},h=function(e){var t=!1;"click"===e.type?t=!0:("mouseleave"===e.type?l=!1:d=!1,t=!l&&!d),t&&(clearTimeout(s),f.classList.remove("h5p-tooltip-visible"),document.body.removeEventListener("keydown",u,!0))};n.addEventListener("mouseenter",p),n.addEventListener("mouseleave",(function(e){c=setTimeout((function(){h(e)}),1)})),n.addEventListener("focusin",p),n.addEventListener("focusout",h),n.addEventListener("click",h),f.addEventListener("mouseenter",(function(){clearTimeout(c)})),f.addEventListener("mouseleave",h),f.addEventListener("click",(function(e){e.stopPropagation(),e.preventDefault(),h(e)})),this.setText=function(e){i.text=e,f.innerHTML=i.text||n.getAttribute(i.tooltipSource)||""},this.hide=function(){l=d=!1,f.classList.remove("h5p-tooltip-visible")},this.getElement=function(){return f}}}(),H5P.Tooltip.uniqueId=-1})(),H5P.RequestQueue=(a=H5P.jQuery,s=H5P.EventDispatcher,(c=function(e){s.call(this),this.processingQueue=!1,e=e||{},this.showToast=e.showToast,this.itemName="requestQueue",this.hasLocalStorage=!1;try{this.hasLocalStorage=void 0!==window.localStorage}catch(e){}}).prototype.add=function(e,t){if(!this.hasLocalStorage)return!1;var n=this.getStoredRequests();return n||(n=[]),n.push({url:e,data:t}),window.localStorage.setItem(this.itemName,JSON.stringify(n)),this.trigger("requestQueued",{storedStatements:n,processingQueue:this.processingQueue}),!0},c.prototype.getStoredRequests=function(){if(!this.hasLocalStorage)return!1;var e=window.localStorage.getItem(this.itemName);return e?JSON.parse(e):[]},c.prototype.clearQueue=function(){return!!this.hasLocalStorage&&(window.localStorage.removeItem(this.itemName),!0)},c.prototype.resumeQueue=function(){if(!H5PIntegration||!window.navigator||!this.hasLocalStorage)return!1;if(this.processingQueue)return!1;var e=this.getStoredRequests(),t=e.length;return this.clearQueue(),t?(this.processingQueue=!0,this.processQueue(e),!0):(this.trigger("emptiedQueue",e),!0)},c.prototype.processQueue=function(e){var t,n;if(e.length){this.trigger("processingQueue");var i=e.shift(),o=this,r=function(e){var t;if(i.data.xAPIResult&&H5P.attemptsBar)if(e.success)H5P.attemptsBar.success(e.numAttempts,null!==(t=e.lastPercentageScore)&&void 0!==t?t:void 0);else if("Gradebook failed"===e.message)H5P.attemptsBar.showError(H5P.t("attemptFailReceive"));else{var n,o=null!==(n=e.message)&&void 0!==n?n:H5P.t("attemptFailConnect");H5P.attemptsBar.showError(o)}},s=function(){i.data.xAPIResult&&H5P.attemptsBar&&H5P.attemptsBar.showError(),o.onQueuedRequestFail(i)},c=o.onQueuedRequestProcessed.bind(o,e);"embed"!==(null===(t=window)||void 0===t||null===(n=t.H5PIntegration)||void 0===n?void 0:n.context)&&window.parent&&window.parent.ltiWorker?window.parent.ltiWorker.postAttempt(i.url,i.data,r,s,c):a.post(i.url,i.data).done(r).fail(s).always(c)}},c.prototype.onQueuedRequestFail=function(e){window.navigator.onLine||this.add(e.url,e.data)},c.prototype.onQueuedRequestProcessed=function(e){if(e.length)this.processQueue(e);else{this.processingQueue=!1;var t=this.getStoredRequests();this.trigger("queueEmptied",t)}},c.prototype.displayToastMessage=function(e,t,n){if(this.showToast||t){var i=H5P.jQuery.extend(!0,{},{position:{horizontal:"centered",vertical:"centered",noOverflowX:!0}},n);H5P.attachToastTo(H5P.jQuery(".h5p-content:first")[0],e,i)}},c),H5P.OfflineRequestQueue=function(e,t){return function(n){var i=new e;i.clearQueue();var o=null,r=[10,20,40,60,120,300,600],a=-1,s=null,c=!1,l=!1,d=!1,u=n.instance,f=new t({headerText:H5P.t("offlineDialogHeader"),dialogText:H5P.t("offlineDialogBody"),confirmText:H5P.t("offlineDialogRetryButtonLabel"),hideCancel:!0,hideExit:!0,classes:["offline"],instance:u,skipRestoreFocus:!0}),p=f.getElement(),h=document.createElement("div");h.classList.add("count-down"),h.innerHTML=H5P.t("offlineDialogRetryMessage").replace(":num",'<span class="count-down-num">0</span>'),p.querySelector(".h5p-confirmation-dialog-text").appendChild(h);var v=h.querySelector(".count-down-num"),g=document.createElement("div");g.classList.add("throbber-wrapper");var m=document.createElement("div");m.classList.add("sending-requests-throbber"),g.appendChild(m),i.on("requestQueued",function(e){if(!e.data||!e.data.processingQueue){if(!c){var t=document.body.querySelector(".h5p-content");if(!t)return;f.appendTo(t),t.appendChild(g),c=!0}w()}}.bind(this)),i.on("queueEmptied",function(e){e.data&&e.data.length?w(!0):(clearInterval(s),b(!1),a=-1,l&&(f.hide(),l=!1),i.displayToastMessage(H5P.t("offlineSuccessfulSubmit"),!0,{position:{vertical:"top",offsetVertical:"100"}}))}.bind(this)),f.on("confirmed",function(){l=!1,setTimeout((function(){y()}),100)}.bind(this)),window.addEventListener("online",function(){y()}.bind(this)),window.addEventListener("message",function(e){window.parent===e.source&&"h5p"===e.data.context&&"queueRequest"===e.data.action&&this.add(e.data.url,e.data.data)}.bind(this));var b=function(e){d=!d,void 0!==e&&(d=e),d&&l&&(f.hide(),l=!1),d?g.classList.add("show"):g.classList.remove("show")},y=function(){clearInterval(s),b(!0),i.resumeQueue()},w=function(e){l||(b(!1),l||(e?setTimeout((function(){f.show(0)}),100):f.show(0)),l=!0,o=(new Date).getTime(),(a+=1)>=r.length&&(a=r.length-1),clearInterval(s),s=setInterval(P,100))},P=function(){var e=(new Date).getTime(),t=Math.floor((e-o)/1e3),n=r[a]-t;v.textContent=n.toString(),n<=0&&(l=!1,y())};this.add=function(e,t){if(window.navigator.onLine)return!1;i.add(e,t)}}}(H5P.RequestQueue,H5P.ConfirmationDialog),l=window,d=document,l.domReady=function(e){"complete"===d.readyState||"interactive"===d.readyState?e():d.addEventListener("DOMContentLoaded",e)},domReady((function(){var e=function(){for(var e in H5PIntegration.contents)return H5PIntegration.contents[e]}();if("lti"===H5PIntegration.context&&e&&e.maxWidth){var t=document.querySelector(".h5p-iframe-wrapper");if(!t)return;var n=document.querySelector(".content-actions-lti"),i="".concat(e.maxWidth,"px");t.style.maxWidth=i,n&&(n.style.maxWidth=i)}})),document.addEventListener("ms"===H5P.fullScreenBrowserPrefix?"MSFullscreenChange":H5P.fullScreenBrowserPrefix+"fullscreenchange",(function(){H5P.instances&&H5P.instances[0]&&setTimeout((function(){H5P.trigger(H5P.instances[0],"resize")}),100)})),function(){var e=window.H5PIntegration&&"lti"===H5PIntegration.context&&!(H5P.isFramed&&!1===H5P.externalEmbed);if(e?(H5P.isFramed=!1,(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled)&&void 0!==H5P.fullScreenBrowserPrefix||(H5P.fullScreenBrowserPrefix=void 0,window.innerWidth<function(){for(var e in H5PIntegration.contents)return H5PIntegration.contents[e].maxWidth||1090}()&&(H5P.fullscreenDisabled=!0))):!1===H5P.externalEmbed&&(H5P.fullscreenDisabled=window.parent.H5P.fullscreenDisabled),!1===H5P.isFramed&&void 0===H5P.externalEmbed&&null!==document.body&&e&&window.parent!==window){var t,n,i,o=function(){t||(t=setTimeout((function(){var e=r||window.H5P&&H5P.isFullscreen?0:50,o={subject:"lti.frameResize",height:document.body.clientHeight+e};if(!(i>document.body.clientHeight&&i-e<document.body.clientHeight))return o.height===n&&n!==i&&i>n?(o.height=i,window.parent.postMessage(JSON.stringify(o),"*"),void(t=null)):void(o.height!==i?(n=i,i=o.height,window.parent.postMessage(JSON.stringify(o),"*"),t=null):t=null);t=null}),40))},r=!1;window.addEventListener("message",(function(e){try{"lti.frameResizeOk"===JSON.parse(e.data).subject&&(r=!0,document.body.style.overflow="hidden")}catch(e){}}));var a=document.getElementsByClassName("h5p-editor-iframe");if(a[0])a[0].contentWindow.addEventListener("resize",o);else{var s=document.getElementsByClassName("h5p-iframe");H5P.externalDispatcher&&H5P.externalDispatcher.on("iframeResized",o),s[0]?(H5P.externalDispatcher.once("initialized",(function(){s[0].contentWindow.H5P&&s[0].contentWindow.H5P.instances&&s[0].contentWindow.H5P.instances[0]&&s[0].contentWindow.H5P.instances[0].on("resize",o),o()})),s[0].style.display="none",s[0].offsetHeight,s[0].style.display=""):window.H5P&&window.H5P.instances&&window.H5P.instances[0]?window.H5P.instances[0].on("resize",o):(window.addEventListener("resize",o),o())}}}(),function(e){function t(e,t){if(void 0!==e&&void 0!==t)for(var n=0;n<e.length;n++)if(e[n].contentId===t)return e[n]}function n(e){var n,i=null;if(e){if(!(i=t(H5P.instances,e))){n=document.getElementsByClassName("h5p-iframe");for(var o=0;o<n.length&&!(i=t(n[o].contentWindow.H5P.instances,e));o++);}}else(i=H5P.instances[0])||(i=(n=document.getElementsByClassName("h5p-iframe"))[0].contentWindow.H5P.instances[0]);return i}function i(){if(H5PIntegration&&H5PIntegration.csrfToken)return H5PIntegration.csrfToken;var e=document.head.querySelector('[name="csrf-token"]');return e||(e=window.parent.document.head.querySelector('[name="csrf-token"]')),e.content}function o(e){if(H5P.attemptsBar){if(e.success)H5P.attemptsBar.success(e.numAttempts,e.lastPercentageScore);else if("Gradebook failed"===e.message)H5P.attemptsBar.showError(H5P.t("attemptFailReceive"));else{var t,n=null!==(t=e.message)&&void 0!==t?t:H5P.t("attemptFailConnect");H5P.attemptsBar.showError(n)}e.attemptUrl&&H5P.attemptsBar.setAttemptUrl(e.attemptUrl)}}function r(e,n){if(H5P.attemptsBar&&H5P.attemptsBar.showError(),H5P.offlineRequestQueue)H5P.offlineRequestQueue.add(e,n);else{var i=function(e){var n;if(!e)return(n=document.getElementsByClassName("h5p-iframe"))[0];n=document.getElementsByClassName("h5p-iframe");for(var i=0;i<n.length;i++)if(n[i]&&n[i].contentWindow&&n[i].contentWindow&&t(n[i].contentWindow.H5P.instances,e))return n[i];return null}(contentId);i&&i.contentWindow.postMessage({url:H5PIntegration.ajax.xAPIResult,data:n,context:"h5p",action:"queueRequest"})}}e(document).ready((function(){if(window.H5P&&H5P.externalDispatcher)if(window.H5PIntegration&&H5PIntegration.ajax&&H5PIntegration.ajax.xAPIResult){if(window.document.querySelector(".h5p-content")){var t=null;H5P.externalDispatcher.on("xAPI",(function(a){if(a&&a.data&&a.data.statement){var s=a.data.statement;if(s.verb&&s.verb.display&&s.verb.display["en-US"]){var c="answered"===s.verb.display["en-US"]||"completed"===s.verb.display["en-US"],l=s.context&&s.context.contextActivities&&s.context.contextActivities.parent&&s.context.contextActivities.parent[0]&&s.context.contextActivities.parent[0].id,d=!1;if(a.getVerifiedStatementValue){var u=a.getVerifiedStatementValue(["object","definition","extensions","http://h5p.org/x-api/h5p-subContentId"]);u&&u.length&&(d=!0)}if(!l&&!d&&c){if(t)return;H5P.attemptsBar&&H5P.attemptsBar.submit(),t=setTimeout((function(){t=null}),1e3);try{!function(t,a){var s,c,l,d=n(t);l=d&&d.getXAPIData?d.getXAPIData():{statement:a.data.statement};var u=a.getScore(),f=a.getMaxScore(),p=H5PIntegration.ajax.xAPIResult.replace(":contentId",t),h={_token:i(),xAPIResult:JSON.stringify(l),score:u,maxScore:f};"embed"!==(null===(s=window)||void 0===s||null===(c=s.H5PIntegration)||void 0===c?void 0:c.context)&&window.parent&&window.parent.ltiWorker?window.parent.ltiWorker.postAttempt(p,h,o,r):e.post(p,h).done((function(e){o(e)})).fail((function(){r(p,h)}))}(this.contentId,a)}catch(e){console.error(e)}}}}}))}}else console.debug("No ajax path found");else console.debug("External dispatcher not found")}))}(H5P.jQuery),(()=>{function e(t){return e="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(t)}function t(t,n){for(var i=0;i<n.length;i++){var o=n[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(r=o.key,a=void 0,a=function(t,n){if("object"!==e(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,n||"default");if("object"!==e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(r,"string"),"symbol"===e(a)?a:String(a)),o)}var r,a}!function(e){var n=function(){function n(t,i,o){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n);this.$container=e("<div>",{class:"multiplayer-preview-switcher"}),e("<div>",{class:"preview-title-container",appendTo:this.$container}).append(e("<span>",{class:"preview-title",html:i.presenter_preview})).prepend(e("<i>",{class:"h5picon-presentation"}));var a=e("<a>",{class:"preview-link",href:o}).append(e("<i>",{class:"h5picon-side-by-side"})).append(e("<div>",{class:"preview-link-text-wrapper"}).append(e("<span>",{class:"preview-link-label-primary",html:i.side_by_side_preview_label})).append(e("<span>",{class:"preview-link-label-secondary",html:i.side_by_side_preview_secondary_label})));e("<div>",{class:"right-side",appendTo:this.$container}).append(a).append(e("<div>",{class:"preview-link-divider",html:"&nbsp;"})).append(e("<button>",{role:"button",class:"dismiss","aria-label":i.dismiss,click:function(){r.$container.remove()}}))}var i,o,r;return i=n,(o=[{key:"getDomElement",value:function(){return this.$container}}])&&t(i.prototype,o),r&&t(i,r),Object.defineProperty(i,"prototype",{writable:!1}),n}();e(document).ready((function(){var t=e(".h5p-content");if(0!==t.length){var i=H5P.getContentForInstance(t.data("content-id"));if(i.multiplayer&&"embed"!==H5PIntegration.context){var o=i.multiplayer.role,r=i.multiplayer.preview;if("student"!==o&&!r){var a=new n(o,H5PIntegration.l10n.multiplayerRoleSwitcher,i.multiplayer.previewUrl);t.prepend(a.getDomElement())}}}}))}(H5P.jQuery)})()})();