(()=>{var e={431:(e,t,n)=>{"use strict";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(this,arguments)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}n.d(t,{A:()=>s});var i=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.event={description:{"en-US":t},type:"http://adlnet.gov/expapi/activities/cmi.interaction",interactionType:"fill-in"}}var t,n;return t=e,(n=[{key:"generateXApi",value:function(e,t){var n=e.data.statement;return r(n,{result:{response:t}}),n.object&&r(n.object.definition,this.event),e}}])&&o(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function u(e){return u="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},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}var s=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(o,H5P.EventDispatcher);var e,t,n,r=(t=o,n=function(){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(){var e,r=a(t);if(n){var o=a(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return function(e,t){if(t&&("object"===u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function o(e){var t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),t=r.call(this);var u=e.question,c=void 0===u?"Do you like cake?":u,a=e.placeholderText,s=void 0===a?"":a,p=e.inputRows,l=void 0===p?1:p;return t.currentInput="",t.xApiGenerator=new i(c),t.createQuestion=function(e){var t=document.createElement("div");return t.className="h5p-open-ended-question-text",t.innerHTML=e,t},t.createInput=function(e,t){var n=document.createElement("textarea");return n.innerHTML=t||"",n.placeholder=n.innerText,n.textContent=this.currentInput,n.rows=e,n.style.resize="none",n},t.attach=function(e){var t=this,n=document.createElement("div");n.classList.add("h5p-open-ended-question");var r=document.createElement("div");r.classList.add("h5p-open-ended-question-question"),r.classList.add("h5p-subcontent-question");var o=this.createQuestion(c);r.appendChild(o);var i=document.createElement("div");i.classList.add("h5p-open-ended-question-content"),i.classList.add("h5p-subcontent-body");var u=this.createInput(l,s);u.className="h5p-open-ended-question-input",u.addEventListener("blur",(function(){var e=t.createXAPIEventTemplate("interacted"),n=t.xApiGenerator.generateXApi(e,u.value);t.currentInput=u.value,t.trigger(n)})),u.addEventListener("keydown",(function(){return t.trigger("changed")})),i.appendChild(u),n.appendChild(r),n.appendChild(i),e.get(0).appendChild(n),this.inputElement=u},t.resetTask=function(){this.currentInput="",this.inputElement&&(this.inputElement.value="")},t.getCurrentState=function(){return this.currentInput},t.restorePreviousState=function(){n.previousState&&(this.currentInput=n.previousState)},t.restorePreviousState(),t}return e=o,Object.defineProperty(e,"prototype",{writable:!1}),e}()}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),H5P.OpenEndedQuestion=n(431).A})();