jspsych 7.3.1 → 7.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- var jsPsychModule=function(e){"use strict";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 r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function l(){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 u(e,t,r){return u=l()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&s(i,r.prototype),i},u.apply(null,arguments)}function c(e){var t="function"==typeof Map?new Map:void 0;return c=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return u(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)},c(e)}function h(e,t){if(t&&("object"==typeof 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)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}(e,t)||p(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||p(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 p(e,t){if(e){if("string"==typeof e)return m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=p(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function v(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))}!function(e){var r=function(e){var r,n=Object.prototype,i=n.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i=t&&t.prototype instanceof v?t:v,a=Object.create(i.prototype),o=new L(n||[]);return a._invoke=function(e,t,r){var n=d;return function(i,a){if(n===p)throw new Error("Generator is already running");if(n===m){if("throw"===i)throw a;return I()}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=P(o,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===d)throw n=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var l=h(e,t,r);if("normal"===l.type){if(n=r.done?m:f,l.arg===y)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n=m,r.method="throw",r.arg=l.arg)}}}(e,r,o),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d="suspendedStart",f="suspendedYield",p="executing",m="completed",y={};function v(){}function g(){}function b(){}var w={};u(w,o,(function(){return this}));var _=Object.getPrototypeOf,k=_&&_(_(A([])));k&&k!==n&&i.call(k,o)&&(w=k);var x=b.prototype=v.prototype=Object.create(w);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function j(e,r){function n(a,o,s,l){var u=h(e[a],e,o);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"===t(d)&&i.call(d,"__await")?r.resolve(d.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):r.resolve(d).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,l)}))}l(u.arg)}var a;this._invoke=function(e,t){function i(){return new r((function(r,i){n(e,t,r,i)}))}return a=a?a.then(i,i):i()}}function P(e,t){var n=e.iterator[t.method];if(n===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=r,P(e,t),"throw"===t.method))return y;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=h(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,y;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,y):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function A(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(i.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=r,t.done=!0,t};return a.next=a}}return{next:I}}function I(){return{value:r,done:!0}}return g.prototype=b,u(x,"constructor",b),u(b,"constructor",g),g.displayName=u(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,u(e,l,"GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},T(j.prototype),u(j.prototype,s,(function(){return this})),e.AsyncIterator=j,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new j(c(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},T(x),u(x,l,"Generator"),u(x,o,(function(){return this})),u(x,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=A,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=r)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return s.type="throw",s.arg=e,t.next=n,i&&(t.method="next",t.arg=r),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var l=i.call(o,"catchLoc"),u=i.call(o,"finallyLoc");if(l&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),O(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;O(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:A(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),y}},e}(e.exports);try{regeneratorRuntime=r}catch(e){"object"===("undefined"==typeof globalThis?"undefined":t(globalThis))?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}({exports:{}});var g=function(e){var t=new Set;do{var r,n=y(Reflect.ownKeys(e));try{for(n.s();!(r=n.n()).done;){var i=r.value;t.add([e,i])}}catch(e){n.e(e)}finally{n.f()}}while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t},b=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.include,i=r.exclude,a=function(e){var t=function(t){return"string"==typeof t?e===t:t.test(e)};return n?n.some(t):!i||!i.some(t)},o=y(g(e.constructor.prototype));try{for(o.s();!(t=o.n()).done;){var s=d(t.value,2),l=s[0],u=s[1];if("constructor"!==u&&a(u)){var c=Reflect.getOwnPropertyDescriptor(l,u);c&&"function"==typeof c.value&&(e[u]=e[u].bind(e))}}}catch(e){o.e(e)}finally{o.f()}return e},w=function(e){!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&&s(e,t)}(u,e);var t,n,a=(t=u,n=l(),function(){var e,r=o(t);if(n){var i=o(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return h(this,e)});function u(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"The global `jsPsych` variable is no longer available in jsPsych v7.";return r(this,u),(e=a.call(this,"".concat(t," Please follow the migration guide at https://www.jspsych.org/7.0/support/migration-v7/ to update your experiment."))).name="MigrationError",e}return i(u)}(c(Error));function _(e){return f(new Set(e))}function k(e){if(!e)return e;var r;if(Array.isArray(e)){r=[];var n,i=y(e);try{for(i.s();!(n=i.n()).done;){var a=n.value;r.push(k(a))}}catch(e){i.e(e)}finally{i.f()}return r}if("object"===t(e)&&null!==e){for(var o in r={},e)e.hasOwnProperty(o)&&(r[o]=k(e[o]));return r}return e}window.jsPsych={get init(){throw new w("`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.")},get data(){throw new w},get randomization(){throw new w},get turk(){throw new w},get pluginAPI(){throw new w},get ALL_KEYS(){throw new w('jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.')},get NO_KEYS(){throw new w('jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.')}};var x=Object.freeze({__proto__:null,unique:_,deepCopy:k}),T=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];r(this,e),this.values=t}return i(e,[{key:"sum",value:function(){var e,t=0,r=y(this.values);try{for(r.s();!(e=r.n()).done;){t+=e.value}}catch(e){r.e(e)}finally{r.f()}return t}},{key:"mean",value:function(){return this.sum()/this.count()}},{key:"median",value:function(){if(0!==this.values.length){var e=this.values.slice(0).sort((function(e,t){return e-t})),t=Math.floor(e.length/2);return e.length%2==0?(e[t]+e[t-1])/2:e[t]}}},{key:"min",value:function(){return Math.min.apply(null,this.values)}},{key:"max",value:function(){return Math.max.apply(null,this.values)}},{key:"count",value:function(){return this.values.length}},{key:"variance",value:function(){var e,t=this.mean(),r=0,n=y(this.values);try{for(n.s();!(e=n.n()).done;){var i=e.value;r+=Math.pow(i-t,2)}}catch(e){n.e(e)}finally{n.f()}return r/(this.values.length-1)}},{key:"sd",value:function(){var e=this.variance();return Math.sqrt(e)}},{key:"frequencies",value:function(){var e,t={},r=y(this.values);try{for(r.s();!(e=r.n()).done;){var n=e.value;void 0===t[n]?t[n]=1:t[n]++}}catch(e){r.e(e)}finally{r.f()}return t}},{key:"all",value:function(e){var t,r=y(this.values);try{for(r.s();!(t=r.n()).done;){if(!e(t.value))return!1}}catch(e){r.e(e)}finally{r.f()}return!0}},{key:"subset",value:function(t){var r,n=[],i=y(this.values);try{for(i.s();!(r=i.n()).done;){var a=r.value;t(a)&&n.push(a)}}catch(e){i.e(e)}finally{i.f()}return new e(n)}}]),e}();var j,P=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];r(this,e),this.trials=t}return i(e,[{key:"push",value:function(e){return this.trials.push(e),this}},{key:"join",value:function(e){return this.trials=this.trials.concat(e.values()),this}},{key:"top",value:function(){return this.trials.length<=1?this:new e([this.trials[this.trials.length-1]])}},{key:"first",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(t<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new e:(t>this.trials.length&&(t=this.trials.length),new e(this.trials.slice(0,t)))}},{key:"last",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(t<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new e:(t>this.trials.length&&(t=this.trials.length),new e(this.trials.slice(this.trials.length-t,this.trials.length)))}},{key:"values",value:function(){return this.trials}},{key:"count",value:function(){return this.trials.length}},{key:"readOnly",value:function(){return new e(k(this.trials))}},{key:"addToAll",value:function(e){var t,r=y(this.trials);try{for(r.s();!(t=r.n()).done;){var n=t.value;Object.assign(n,e)}}catch(e){r.e(e)}finally{r.f()}return this}},{key:"addToLast",value:function(e){return 0!=this.trials.length&&Object.assign(this.trials[this.trials.length-1],e),this}},{key:"filter",value:function(t){var r;r=Array.isArray(t)?k(t):k([t]);var n,i=[],a=y(this.trials);try{for(a.s();!(n=a.n()).done;){var o,s=n.value,l=!1,u=y(r);try{for(u.s();!(o=u.n()).done;){for(var c=o.value,h=!0,d=0,f=Object.keys(c);d<f.length;d++){var p=f[d];void 0!==s[p]&&s[p]===c[p]||(h=!1)}if(h){l=!0;break}}}catch(e){u.e(e)}finally{u.f()}l&&i.push(s)}}catch(e){a.e(e)}finally{a.f()}return new e(i)}},{key:"filterCustom",value:function(t){return new e(this.trials.filter(t))}},{key:"filterColumns",value:function(t){return new e(this.trials.map((function(e){return Object.fromEntries(t.filter((function(t){return t in e})).map((function(t){return[t,e[t]]})))})))}},{key:"select",value:function(e){var t,r=[],n=y(this.trials);try{for(n.s();!(t=n.n()).done;){var i=t.value;void 0!==i[e]&&r.push(i[e])}}catch(e){n.e(e)}finally{n.f()}return new T(r)}},{key:"ignore",value:function(t){Array.isArray(t)||(t=[t]);var r,n=k(this.trials),i=y(n);try{for(i.s();!(r=i.n()).done;){var a,o=r.value,s=y(t);try{for(s.s();!(a=s.n()).done;){delete o[a.value]}}catch(e){s.e(e)}finally{s.f()}}}catch(e){i.e(e)}finally{i.f()}return new e(n)}},{key:"uniqueNames",value:function(){var e,t=[],r=y(this.trials);try{for(r.s();!(e=r.n()).done;)for(var n=e.value,i=0,a=Object.keys(n);i<a.length;i++){var o=a[i];t.includes(o)||t.push(o)}}catch(e){r.e(e)}finally{r.f()}return t}},{key:"csv",value:function(){return function(e){var r,n="object"!=t(e)?JSON.parse(e):e,i="",a="",o=[],s=y(n);try{for(s.s();!(r=s.n()).done;){var l=r.value;for(var u in l){var c=u+"";c='"'+c.replace(/"/g,'""')+'",',o.includes(u)||(o.push(u),i+=c)}}}catch(e){s.e(e)}finally{s.f()}a+=(i=i.slice(0,-1))+"\r\n";var h,d=y(n);try{for(d.s();!(h=d.n()).done;){var f=h.value;i="";var p,m=y(o);try{for(m.s();!(p=m.n()).done;){var v=p.value,g=void 0===f[v]?"":f[v];"object"==t(g)&&(g=JSON.stringify(g)),i+='"'+(g+"").replace(/"/g,'""')+'",'}}catch(e){m.e(e)}finally{m.f()}a+=(i=i.slice(0,-1))+"\r\n"}}catch(e){d.e(e)}finally{d.f()}return a}(this.trials)}},{key:"json",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?JSON.stringify(this.trials,null,"\t"):JSON.stringify(this.trials)}},{key:"localSave",value:function(e,t){var r;if("json"===(e=e.toLowerCase()))r=this.json();else{if("csv"!==e)throw new Error('Invalid format specified for localSave. Must be "json" or "csv".');r=this.csv()}!function(e,t){var r=new Blob([e],{type:"text/plain"}),n="";n=void 0!==window.webkitURL?window.webkitURL.createObjectURL(r):window.URL.createObjectURL(r);var i=document.createElement("a");i.id="jspsych-download-as-text-link",i.style.display="none",i.download=t,i.href=n,i.click()}(r,t)}}]),e}(),E=function(){function e(t){r(this,e),this.jsPsych=t,this.dataProperties={},this.reset()}return i(e,[{key:"reset",value:function(){this.allData=new P,this.interactionData=new P}},{key:"get",value:function(){return this.allData}},{key:"getInteractionData",value:function(){return this.interactionData}},{key:"write",value:function(e){var t=this.jsPsych.getProgress(),r=this.jsPsych.getCurrentTrial(),n={trial_type:r.type.info.name,trial_index:t.current_trial_global,time_elapsed:this.jsPsych.getTotalTime(),internal_node_id:this.jsPsych.getCurrentTimelineNodeID()};this.allData.push(Object.assign(Object.assign(Object.assign(Object.assign({},e),r.data),n),this.dataProperties))}},{key:"addProperties",value:function(e){this.allData.addToAll(e),this.dataProperties=Object.assign({},this.dataProperties,e)}},{key:"addDataToLastTrial",value:function(e){this.allData.addToLast(e)}},{key:"getDataByTimelineNode",value:function(e){return this.allData.filterCustom((function(t){return t.internal_node_id.slice(0,e.length)===e}))}},{key:"getLastTrialData",value:function(){return this.allData.top()}},{key:"getLastTimelineData",value:function(){var e=this.getLastTrialData().select("internal_node_id").values[0];if(void 0===e)return new P;var t=e.substr(0,e.lastIndexOf("-"));return this.getDataByTimelineNode(t)}},{key:"displayData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"json";"json"!=(e=e.toLowerCase())&&"csv"!=e&&(console.log("Invalid format declared for displayData function. Using json as default."),e="json");var t="json"===e?this.allData.json(!0):this.allData.csv(),r=this.jsPsych.getDisplayElement();r.innerHTML='<pre id="jspsych-data-display"></pre>',document.getElementById("jspsych-data-display").textContent=t}},{key:"urlVariables",value:function(){return void 0===this.query_string&&(this.query_string=function(){for(var e=window.location.search.substr(1).split("&"),t={},r=0;r<e.length;++r){var n=e[r].split("=",2);1==n.length?t[n[0]]="":t[n[0]]=decodeURIComponent(n[1].replace(/\+/g," "))}return t}()),this.query_string}},{key:"getURLVariable",value:function(e){return this.urlVariables()[e]}},{key:"createInteractionListeners",value:function(){var e=this;window.addEventListener("blur",(function(){var t={event:"blur",trial:e.jsPsych.getProgress().current_trial_global,time:e.jsPsych.getTotalTime()};e.interactionData.push(t),e.jsPsych.getInitSettings().on_interaction_data_update(t)})),window.addEventListener("focus",(function(){var t={event:"focus",trial:e.jsPsych.getProgress().current_trial_global,time:e.jsPsych.getTotalTime()};e.interactionData.push(t),e.jsPsych.getInitSettings().on_interaction_data_update(t)}));var t=function(){var t={event:document.isFullScreen||document.webkitIsFullScreen||document.mozIsFullScreen||document.fullscreenElement?"fullscreenenter":"fullscreenexit",trial:e.jsPsych.getProgress().current_trial_global,time:e.jsPsych.getTotalTime()};e.interactionData.push(t),e.jsPsych.getInitSettings().on_interaction_data_update(t)};document.addEventListener("fullscreenchange",t),document.addEventListener("mozfullscreenchange",t),document.addEventListener("webkitfullscreenchange",t)}},{key:"_customInsert",value:function(e){this.allData=new P(e)}},{key:"_fullreset",value:function(){this.reset(),this.dataProperties={}}}]),e}(),O=function(){function e(){var t=this;r(this,e),this.hardwareConnected=!1,document.addEventListener("jspsych-activate",(function(e){t.hardwareConnected=!0}))}return i(e,[{key:"hardware",value:function(e){var t=new CustomEvent("jspsych",{detail:e});document.dispatchEvent(t)}}]),e}(),L=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;r(this,e),this.getRootElement=t,this.areResponsesCaseSensitive=n,this.minimumValidRt=i,this.listeners=new Set,this.heldKeys=new Set,this.areRootListenersRegistered=!1,b(this),this.registerRootListeners()}return i(e,[{key:"registerRootListeners",value:function(){if(!this.areRootListenersRegistered){var e=this.getRootElement();e&&(e.addEventListener("keydown",this.rootKeydownListener),e.addEventListener("keyup",this.rootKeyupListener),this.areRootListenersRegistered=!0)}}},{key:"rootKeydownListener",value:function(e){for(var t=0,r=Array.from(this.listeners);t<r.length;t++){(0,r[t])(e)}this.heldKeys.add(this.toLowerCaseIfInsensitive(e.key))}},{key:"toLowerCaseIfInsensitive",value:function(e){return this.areResponsesCaseSensitive?e:e.toLowerCase()}},{key:"rootKeyupListener",value:function(e){this.heldKeys.delete(this.toLowerCaseIfInsensitive(e.key))}},{key:"isResponseValid",value:function(e,t,r){return!(!t&&this.heldKeys.has(r))&&("ALL_KEYS"===e||"NO_KEYS"!==e&&e.includes(r))}},{key:"getKeyboardResponse",value:function(e){var t=this,r=e.callback_function,n=e.valid_responses,i=void 0===n?"ALL_KEYS":n,a=e.rt_method,o=void 0===a?"performance":a,s=e.persist,l=e.audio_context,u=e.audio_context_start_time,c=e.allow_held_key,h=void 0!==c&&c,d=e.minimum_valid_rt,f=void 0===d?this.minimumValidRt:d;"performance"!==o&&"audio"!==o&&(console.log('Invalid RT method specified in getKeyboardResponse. Defaulting to "performance" method.'),o="performance");var p="performance"===o?performance.now():1e3*u;this.registerRootListeners(),this.areResponsesCaseSensitive||"string"==typeof i||(i=i.map((function(e){return e.toLowerCase()})));var m=function e(n){var a=Math.round(("performance"==o?performance.now():1e3*l.currentTime)-p);if(!(a<f)){var u=t.toLowerCaseIfInsensitive(n.key);t.isResponseValid(i,h,u)&&(n.preventDefault(),s||t.cancelKeyboardResponse(e),r({key:u,rt:a}))}};return this.listeners.add(m),m}},{key:"cancelKeyboardResponse",value:function(e){this.listeners.delete(e)}},{key:"cancelAllKeyboardResponses",value:function(){this.listeners.clear()}},{key:"compareKeys",value:function(e,t){if(!("string"!=typeof e&&null!==e||"string"!=typeof t&&null!==t))return"string"==typeof e&&"string"==typeof t?this.areResponsesCaseSensitive?e===t:e.toLowerCase()===t.toLowerCase():null===e&&null===t;console.error("Error in jsPsych.pluginAPI.compareKeys: arguments must be key strings or null.")}}]),e}();e.ParameterType=void 0,(j=e.ParameterType||(e.ParameterType={}))[j.BOOL=0]="BOOL",j[j.STRING=1]="STRING",j[j.INT=2]="INT",j[j.FLOAT=3]="FLOAT",j[j.FUNCTION=4]="FUNCTION",j[j.KEY=5]="KEY",j[j.KEYS=6]="KEYS",j[j.SELECT=7]="SELECT",j[j.HTML_STRING=8]="HTML_STRING",j[j.IMAGE=9]="IMAGE",j[j.AUDIO=10]="AUDIO",j[j.VIDEO=11]="VIDEO",j[j.OBJECT=12]="OBJECT",j[j.COMPLEX=13]="COMPLEX",j[j.TIMELINE=14]="TIMELINE";var A={data:{type:e.ParameterType.OBJECT,pretty_name:"Data",default:{}},on_start:{type:e.ParameterType.FUNCTION,pretty_name:"On start",default:function(){}},on_finish:{type:e.ParameterType.FUNCTION,pretty_name:"On finish",default:function(){}},on_load:{type:e.ParameterType.FUNCTION,pretty_name:"On load",default:function(){}},post_trial_gap:{type:e.ParameterType.INT,pretty_name:"Post trial gap",default:null},css_classes:{type:e.ParameterType.STRING,pretty_name:"Custom CSS classes",default:null},simulation_options:{type:e.ParameterType.COMPLEX,default:null}},I=[e.ParameterType.AUDIO,e.ParameterType.IMAGE,e.ParameterType.VIDEO],S=function(){function t(e,n){r(this,t),this.useWebaudio=e,this.webaudioContext=n,this.video_buffers={},this.context=null,this.audio_buffers=[],this.preload_requests=[],this.img_cache={},this.preloadMap=new Map,this.microphone_recorder=null,this.camera_stream=null,this.camera_recorder=null}return i(t,[{key:"getVideoBuffer",value:function(e){return e.startsWith("blob:")&&(this.video_buffers[e]=e),this.video_buffers[e]}},{key:"initAudio",value:function(){this.context=this.useWebaudio?this.webaudioContext:null}},{key:"audioContext",value:function(){return null!==this.context&&"running"!==this.context.state&&this.context.resume(),this.context}},{key:"getAudioBuffer",value:function(e){var t=this;return new Promise((function(r,n){void 0===t.audio_buffers[e]||"tmp"==t.audio_buffers[e]?t.preloadAudio([e],(function(){r(t.audio_buffers[e])}),(function(){}),(function(e){n(e.error)})):r(t.audio_buffers[e])}))}},{key:"preloadAudio",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){};e=_(e.flat());var a=0;if(0!=e.length){var o,s=function(o){var s=new XMLHttpRequest;s.open("GET",o,!0),s.responseType="arraybuffer",s.onload=function(){t.context.decodeAudioData(s.response,(function(i){t.audio_buffers[o]=i,a++,n(o),a==e.length&&r()}),(function(e){i({source:o,error:e})}))},s.onerror=function(e){var t=e;404==s.status&&(t="404"),i({source:o,error:t})},s.onloadend=function(e){404==s.status&&i({source:o,error:"404"})},s.send(),t.preload_requests.push(s)},l=function(o){var s=new Audio;s.addEventListener("canplaythrough",(function i(){t.audio_buffers[o]=s,a++,n(o),a==e.length&&r(),s.removeEventListener("canplaythrough",i)})),s.addEventListener("error",(function e(t){i({source:s.src,error:t}),s.removeEventListener("error",e)})),s.addEventListener("abort",(function e(t){i({source:s.src,error:t}),s.removeEventListener("abort",e)})),s.src=o,t.preload_requests.push(s)},u=y(e);try{for(u.s();!(o=u.n()).done;){var c=o.value;void 0!==this.audio_buffers[c]?(a++,n(c),a==e.length&&r()):(this.audio_buffers[c]="tmp",null!==this.audioContext()?s(c):l(c))}}catch(e){u.e(e)}finally{u.f()}}else r()}},{key:"preloadImages",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){};e=_(e.flat());var a=0;if(0!==e.length)for(var o=function(o){var s=new Image,l=e[o];s.onload=function(){a++,n(l),a===e.length&&r()},s.onerror=function(e){i({source:l,error:e})},s.src=l,t.img_cache[l]=s,t.preload_requests.push(s)},s=0;s<e.length;s++)o(s);else r()}},{key:"preloadVideo",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){};e=_(e.flat());var a=0;if(0!==e.length){var o,s=y(e);try{var l=function(){var s=o.value,l=t.video_buffers,u=new XMLHttpRequest;u.open("GET",s,!0),u.responseType="blob",u.onload=function(){if(200===u.status||0===u.status){var t=u.response;l[s]=URL.createObjectURL(t),a++,n(s),a===e.length&&r()}},u.onerror=function(e){var t=e;404==u.status&&(t="404"),i({source:s,error:t})},u.onloadend=function(e){404==u.status&&i({source:s,error:"404"})},u.send(),t.preload_requests.push(u)};for(s.s();!(o=s.n()).done;)l()}catch(e){s.e(e)}finally{s.f()}}else r()}},{key:"getAutoPreloadList",value:function(t){var r=this,n=Object.fromEntries(I.map((function(e){return[e,new Set]})));return function e(t,i){var a,o,s,l;if(void 0!==t.timeline){var u,c=y(t.timeline);try{for(c.s();!(u=c.n()).done;){e(u.value,null!==(a=t.type)&&void 0!==a?a:i)}}catch(e){c.e(e)}finally{c.f()}}else if(null===(s=null!==(o=t.type)&&void 0!==o?o:i)||void 0===s?void 0:s.info){var h=(null!==(l=t.type)&&void 0!==l?l:i).info,f=h.name,p=h.parameters;r.preloadMap.has(f)||r.preloadMap.set(f,Object.fromEntries(Object.entries(p).filter((function(e){var t=d(e,2);t[0];var r=t[1],n=r.type,i=r.preload;return I.includes(n)&&(null==i||i)})).map((function(e){var t=d(e,2);return[t[0],t[1].type]}))));for(var m=0,v=Object.entries(r.preloadMap.get(f));m<v.length;m++){var g=d(v[m],2),b=g[0],w=g[1],_=t[b],k=n[w];if("string"==typeof _)k.add(_);else if(Array.isArray(_)){var x,T=y(_.flat());try{for(T.s();!(x=T.n()).done;){var j=x.value;"string"==typeof j&&k.add(j)}}catch(e){T.e(e)}finally{T.f()}}}}}({timeline:t}),{images:f(n[e.ParameterType.IMAGE]),audio:f(n[e.ParameterType.AUDIO]),video:f(n[e.ParameterType.VIDEO])}}},{key:"cancelPreloads",value:function(){var e,t=y(this.preload_requests);try{for(t.s();!(e=t.n()).done;){var r=e.value;r.onload=function(){},r.onerror=function(){},r.oncanplaythrough=function(){},r.onabort=function(){}}}catch(e){t.e(e)}finally{t.f()}this.preload_requests=[]}},{key:"initializeMicrophoneRecorder",value:function(e){var t=new MediaRecorder(e);this.microphone_recorder=t}},{key:"getMicrophoneRecorder",value:function(){return this.microphone_recorder}},{key:"initializeCameraRecorder",value:function(e,t){this.camera_stream=e;var r=new MediaRecorder(e,t);this.camera_recorder=r}},{key:"getCameraStream",value:function(){return this.camera_stream}},{key:"getCameraRecorder",value:function(){return this.camera_recorder}}]),t}(),M=function(){function e(){r(this,e)}return i(e,[{key:"dispatchEvent",value:function(e){document.body.dispatchEvent(e)}},{key:"keyDown",value:function(e){this.dispatchEvent(new KeyboardEvent("keydown",{key:e}))}},{key:"keyUp",value:function(e){this.dispatchEvent(new KeyboardEvent("keyup",{key:e}))}},{key:"pressKey",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;r>0?setTimeout((function(){t.keyDown(e),t.keyUp(e)}),r):(this.keyDown(e),this.keyUp(e))}},{key:"clickTarget",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t>0?setTimeout((function(){e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0})),e.dispatchEvent(new MouseEvent("click",{bubbles:!0}))}),t):(e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0})),e.dispatchEvent(new MouseEvent("click",{bubbles:!0})))}},{key:"fillTextInput",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;r>0?setTimeout((function(){e.value=t}),r):e.value=t}},{key:"getValidKey",value:function(e){var t,r=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"," "];if("NO_KEYS"==e)t=null;else if("ALL_KEYS"==e)t=r[Math.floor(Math.random()*r.length)];else{var n=e.flat();t=n[Math.floor(Math.random()*n.length)]}return t}},{key:"mergeSimulationData",value:function(e,t){return Object.assign(Object.assign({},e),null==t?void 0:t.data)}},{key:"ensureSimulationDataConsistency",value:function(e,t){if(t.rt&&(t.rt=Math.round(t.rt)),e.trial_duration&&t.rt&&t.rt>e.trial_duration&&(t.rt=null,t.response&&(t.response=null),t.correct&&(t.correct=!1)),e.choices&&"NO_KEYS"==e.choices&&(t.rt&&(t.rt=null),t.response&&(t.response=null)),e.allow_response_before_complete&&e.sequence_reps&&e.frame_time){var r=e.sequence_reps*e.frame_time*e.stimuli.length;t.rt<r&&(t.rt=null,t.response=null)}}}]),e}(),D=function(){function e(){r(this,e),this.timeout_handlers=[]}return i(e,[{key:"setTimeout",value:function(e,t){var r=window.setTimeout(e,t);return this.timeout_handlers.push(r),r}},{key:"clearAllTimeouts",value:function(){var e,t=y(this.timeout_handlers);try{for(t.s();!(e=t.n()).done;){var r=e.value;clearTimeout(r)}}catch(e){t.e(e)}finally{t.f()}this.timeout_handlers=[]}}]),e}();var R=["ability","able","aboard","about","above","accept","accident","according","account","accurate","acres","across","act","action","active","activity","actual","actually","add","addition","additional","adjective","adult","adventure","advice","affect","afraid","after","afternoon","again","against","age","ago","agree","ahead","aid","air","airplane","alike","alive","all","allow","almost","alone","along","aloud","alphabet","already","also","although","am","among","amount","ancient","angle","angry","animal","announced","another","answer","ants","any","anybody","anyone","anything","anyway","anywhere","apart","apartment","appearance","apple","applied","appropriate","are","area","arm","army","around","arrange","arrangement","arrive","arrow","art","article","as","aside","ask","asleep","at","ate","atmosphere","atom","atomic","attached","attack","attempt","attention","audience","author","automobile","available","average","avoid","aware","away","baby","back","bad","badly","bag","balance","ball","balloon","band","bank","bar","bare","bark","barn","base","baseball","basic","basis","basket","bat","battle","be","bean","bear","beat","beautiful","beauty","became","because","become","becoming","bee","been","before","began","beginning","begun","behavior","behind","being","believed","bell","belong","below","belt","bend","beneath","bent","beside","best","bet","better","between","beyond","bicycle","bigger","biggest","bill","birds","birth","birthday","bit","bite","black","blank","blanket","blew","blind","block","blood","blow","blue","board","boat","body","bone","book","border","born","both","bottle","bottom","bound","bow","bowl","box","boy","brain","branch","brass","brave","bread","break","breakfast","breath","breathe","breathing","breeze","brick","bridge","brief","bright","bring","broad","broke","broken","brother","brought","brown","brush","buffalo","build","building","built","buried","burn","burst","bus","bush","business","busy","but","butter","buy","by","cabin","cage","cake","call","calm","came","camera","camp","can","canal","cannot","cap","capital","captain","captured","car","carbon","card","care","careful","carefully","carried","carry","case","cast","castle","cat","catch","cattle","caught","cause","cave","cell","cent","center","central","century","certain","certainly","chain","chair","chamber","chance","change","changing","chapter","character","characteristic","charge","chart","check","cheese","chemical","chest","chicken","chief","child","children","choice","choose","chose","chosen","church","circle","circus","citizen","city","class","classroom","claws","clay","clean","clear","clearly","climate","climb","clock","close","closely","closer","cloth","clothes","clothing","cloud","club","coach","coal","coast","coat","coffee","cold","collect","college","colony","color","column","combination","combine","come","comfortable","coming","command","common","community","company","compare","compass","complete","completely","complex","composed","composition","compound","concerned","condition","congress","connected","consider","consist","consonant","constantly","construction","contain","continent","continued","contrast","control","conversation","cook","cookies","cool","copper","copy","corn","corner","correct","correctly","cost","cotton","could","count","country","couple","courage","course","court","cover","cow","cowboy","crack","cream","create","creature","crew","crop","cross","crowd","cry","cup","curious","current","curve","customs","cut","cutting","daily","damage","dance","danger","dangerous","dark","darkness","date","daughter","dawn","day","dead","deal","dear","death","decide","declared","deep","deeply","deer","definition","degree","depend","depth","describe","desert","design","desk","detail","determine","develop","development","diagram","diameter","did","die","differ","difference","different","difficult","difficulty","dig","dinner","direct","direction","directly","dirt","dirty","disappear","discover","discovery","discuss","discussion","disease","dish","distance","distant","divide","division","do","doctor","does","dog","doing","doll","dollar","done","donkey","door","dot","double","doubt","down","dozen","draw","drawn","dream","dress","drew","dried","drink","drive","driven","driver","driving","drop","dropped","drove","dry","duck","due","dug","dull","during","dust","duty","each","eager","ear","earlier","early","earn","earth","easier","easily","east","easy","eat","eaten","edge","education","effect","effort","egg","eight","either","electric","electricity","element","elephant","eleven","else","empty","end","enemy","energy","engine","engineer","enjoy","enough","enter","entire","entirely","environment","equal","equally","equator","equipment","escape","especially","essential","establish","even","evening","event","eventually","ever","every","everybody","everyone","everything","everywhere","evidence","exact","exactly","examine","example","excellent","except","exchange","excited","excitement","exciting","exclaimed","exercise","exist","expect","experience","experiment","explain","explanation","explore","express","expression","extra","eye","face","facing","fact","factor","factory","failed","fair","fairly","fall","fallen","familiar","family","famous","far","farm","farmer","farther","fast","fastened","faster","fat","father","favorite","fear","feathers","feature","fed","feed","feel","feet","fell","fellow","felt","fence","few","fewer","field","fierce","fifteen","fifth","fifty","fight","fighting","figure","fill","film","final","finally","find","fine","finest","finger","finish","fire","fireplace","firm","first","fish","five","fix","flag","flame","flat","flew","flies","flight","floating","floor","flow","flower","fly","fog","folks","follow","food","foot","football","for","force","foreign","forest","forget","forgot","forgotten","form","former","fort","forth","forty","forward","fought","found","four","fourth","fox","frame","free","freedom","frequently","fresh","friend","friendly","frighten","frog","from","front","frozen","fruit","fuel","full","fully","fun","function","funny","fur","furniture","further","future","gain","game","garage","garden","gas","gasoline","gate","gather","gave","general","generally","gentle","gently","get","getting","giant","gift","girl","give","given","giving","glad","glass","globe","go","goes","gold","golden","gone","good","goose","got","government","grabbed","grade","gradually","grain","grandfather","grandmother","graph","grass","gravity","gray","great","greater","greatest","greatly","green","grew","ground","group","grow","grown","growth","guard","guess","guide","gulf","gun","habit","had","hair","half","halfway","hall","hand","handle","handsome","hang","happen","happened","happily","happy","harbor","hard","harder","hardly","has","hat","have","having","hay","he","headed","heading","health","heard","hearing","heart","heat","heavy","height","held","hello","help","helpful","her","herd","here","herself","hidden","hide","high","higher","highest","highway","hill","him","himself","his","history","hit","hold","hole","hollow","home","honor","hope","horn","horse","hospital","hot","hour","house","how","however","huge","human","hundred","hung","hungry","hunt","hunter","hurried","hurry","hurt","husband","ice","idea","identity","if","ill","image","imagine","immediately","importance","important","impossible","improve","in","inch","include","including","income","increase","indeed","independent","indicate","individual","industrial","industry","influence","information","inside","instance","instant","instead","instrument","interest","interior","into","introduced","invented","involved","iron","is","island","it","its","itself","jack","jar","jet","job","join","joined","journey","joy","judge","jump","jungle","just","keep","kept","key","kids","kill","kind","kitchen","knew","knife","know","knowledge","known","label","labor","lack","lady","laid","lake","lamp","land","language","large","larger","largest","last","late","later","laugh","law","lay","layers","lead","leader","leaf","learn","least","leather","leave","leaving","led","left","leg","length","lesson","let","letter","level","library","lie","life","lift","light","like","likely","limited","line","lion","lips","liquid","list","listen","little","live","living","load","local","locate","location","log","lonely","long","longer","look","loose","lose","loss","lost","lot","loud","love","lovely","low","lower","luck","lucky","lunch","lungs","lying","machine","machinery","mad","made","magic","magnet","mail","main","mainly","major","make","making","man","managed","manner","manufacturing","many","map","mark","market","married","mass","massage","master","material","mathematics","matter","may","maybe","me","meal","mean","means","meant","measure","meat","medicine","meet","melted","member","memory","men","mental","merely","met","metal","method","mice","middle","might","mighty","mile","military","milk","mill","mind","mine","minerals","minute","mirror","missing","mission","mistake","mix","mixture","model","modern","molecular","moment","money","monkey","month","mood","moon","more","morning","most","mostly","mother","motion","motor","mountain","mouse","mouth","move","movement","movie","moving","mud","muscle","music","musical","must","my","myself","mysterious","nails","name","nation","national","native","natural","naturally","nature","near","nearby","nearer","nearest","nearly","necessary","neck","needed","needle","needs","negative","neighbor","neighborhood","nervous","nest","never","new","news","newspaper","next","nice","night","nine","no","nobody","nodded","noise","none","noon","nor","north","nose","not","note","noted","nothing","notice","noun","now","number","numeral","nuts","object","observe","obtain","occasionally","occur","ocean","of","off","offer","office","officer","official","oil","old","older","oldest","on","once","one","only","onto","open","operation","opinion","opportunity","opposite","or","orange","orbit","order","ordinary","organization","organized","origin","original","other","ought","our","ourselves","out","outer","outline","outside","over","own","owner","oxygen","pack","package","page","paid","pain","paint","pair","palace","pale","pan","paper","paragraph","parallel","parent","park","part","particles","particular","particularly","partly","parts","party","pass","passage","past","path","pattern","pay","peace","pen","pencil","people","per","percent","perfect","perfectly","perhaps","period","person","personal","pet","phrase","physical","piano","pick","picture","pictured","pie","piece","pig","pile","pilot","pine","pink","pipe","pitch","place","plain","plan","plane","planet","planned","planning","plant","plastic","plate","plates","play","pleasant","please","pleasure","plenty","plural","plus","pocket","poem","poet","poetry","point","pole","police","policeman","political","pond","pony","pool","poor","popular","population","porch","port","position","positive","possible","possibly","post","pot","potatoes","pound","pour","powder","power","powerful","practical","practice","prepare","present","president","press","pressure","pretty","prevent","previous","price","pride","primitive","principal","principle","printed","private","prize","probably","problem","process","produce","product","production","program","progress","promised","proper","properly","property","protection","proud","prove","provide","public","pull","pupil","pure","purple","purpose","push","put","putting","quarter","queen","question","quick","quickly","quiet","quietly","quite","rabbit","race","radio","railroad","rain","raise","ran","ranch","range","rapidly","rate","rather","raw","rays","reach","read","reader","ready","real","realize","rear","reason","recall","receive","recent","recently","recognize","record","red","refer","refused","region","regular","related","relationship","religious","remain","remarkable","remember","remove","repeat","replace","replied","report","represent","require","research","respect","rest","result","return","review","rhyme","rhythm","rice","rich","ride","riding","right","ring","rise","rising","river","road","roar","rock","rocket","rocky","rod","roll","roof","room","root","rope","rose","rough","round","route","row","rubbed","rubber","rule","ruler","run","running","rush","sad","saddle","safe","safety","said","sail","sale","salmon","salt","same","sand","sang","sat","satellites","satisfied","save","saved","saw","say","scale","scared","scene","school","science","scientific","scientist","score","screen","sea","search","season","seat","second","secret","section","see","seed","seeing","seems","seen","seldom","select","selection","sell","send","sense","sent","sentence","separate","series","serious","serve","service","sets","setting","settle","settlers","seven","several","shade","shadow","shake","shaking","shall","shallow","shape","share","sharp","she","sheep","sheet","shelf","shells","shelter","shine","shinning","ship","shirt","shoe","shoot","shop","shore","short","shorter","shot","should","shoulder","shout","show","shown","shut","sick","sides","sight","sign","signal","silence","silent","silk","silly","silver","similar","simple","simplest","simply","since","sing","single","sink","sister","sit","sitting","situation","six","size","skill","skin","sky","slabs","slave","sleep","slept","slide","slight","slightly","slip","slipped","slope","slow","slowly","small","smaller","smallest","smell","smile","smoke","smooth","snake","snow","so","soap","social","society","soft","softly","soil","solar","sold","soldier","solid","solution","solve","some","somebody","somehow","someone","something","sometime","somewhere","son","song","soon","sort","sound","source","south","southern","space","speak","special","species","specific","speech","speed","spell","spend","spent","spider","spin","spirit","spite","split","spoken","sport","spread","spring","square","stage","stairs","stand","standard","star","stared","start","state","statement","station","stay","steady","steam","steel","steep","stems","step","stepped","stick","stiff","still","stock","stomach","stone","stood","stop","stopped","store","storm","story","stove","straight","strange","stranger","straw","stream","street","strength","stretch","strike","string","strip","strong","stronger","struck","structure","struggle","stuck","student","studied","studying","subject","substance","success","successful","such","sudden","suddenly","sugar","suggest","suit","sum","summer","sun","sunlight","supper","supply","support","suppose","sure","surface","surprise","surrounded","swam","sweet","swept","swim","swimming","swing","swung","syllable","symbol","system","table","tail","take","taken","tales","talk","tall","tank","tape","task","taste","taught","tax","tea","teach","teacher","team","tears","teeth","telephone","television","tell","temperature","ten","tent","term","terrible","test","than","thank","that","thee","them","themselves","then","theory","there","therefore","these","they","thick","thin","thing","think","third","thirty","this","those","thou","though","thought","thousand","thread","three","threw","throat","through","throughout","throw","thrown","thumb","thus","thy","tide","tie","tight","tightly","till","time","tin","tiny","tip","tired","title","to","tobacco","today","together","told","tomorrow","tone","tongue","tonight","too","took","tool","top","topic","torn","total","touch","toward","tower","town","toy","trace","track","trade","traffic","trail","train","transportation","trap","travel","treated","tree","triangle","tribe","trick","tried","trip","troops","tropical","trouble","truck","trunk","truth","try","tube","tune","turn","twelve","twenty","twice","two","type","typical","uncle","under","underline","understanding","unhappy","union","unit","universe","unknown","unless","until","unusual","up","upon","upper","upward","us","use","useful","using","usual","usually","valley","valuable","value","vapor","variety","various","vast","vegetable","verb","vertical","very","vessels","victory","view","village","visit","visitor","voice","volume","vote","vowel","voyage","wagon","wait","walk","wall","want","war","warm","warn","was","wash","waste","watch","water","wave","way","we","weak","wealth","wear","weather","week","weigh","weight","welcome","well","went","were","west","western","wet","whale","what","whatever","wheat","wheel","when","whenever","where","wherever","whether","which","while","whispered","whistle","white","who","whole","whom","whose","why","wide","widely","wife","wild","will","willing","win","wind","window","wing","winter","wire","wise","wish","with","within","without","wolf","women","won","wonder","wonderful","wood","wooden","wool","word","wore","work","worker","world","worried","worry","worse","worth","would","wrapped","write","writer","writing","written","wrong","wrote","yard","year","yellow","yes","yesterday","yet","you","young","younger","your","yourself","youth","zero","zebra","zipper","zoo","zulu"];function C(e){function t(){return e&&e.maxLength>1?function(){var t,n=!1;for(;!n;)(t=r()).length<=e.maxLength&&(n=!0);return t}():r()}function r(){return R[n(R.length)]}function n(e){return Math.floor(Math.random()*e)}if(void 0===e)return t();"number"==typeof e&&(e={exactly:e}),e.exactly&&(e.min=e.exactly,e.max=e.exactly),"number"!=typeof e.wordsPerString&&(e.wordsPerString=1),"function"!=typeof e.formatter&&(e.formatter=function(e){return e}),"string"!=typeof e.separator&&(e.separator=" ");for(var i=e.min+n(e.max+1-e.min),a=[],o="",s=0,l=0;l<i*e.wordsPerString;l++)s===e.wordsPerString-1?o+=e.formatter(t(),s):o+=e.formatter(t(),s)+e.separator,s++,(l+1)%e.wordsPerString==0&&(a.push(o),o="",s=0);return"string"==typeof e.join&&(a=a.join(e.join)),a}var N=C;C.wordList=R;var V={exports:{}};(function(e,r,n){function i(e){var t,r=this,n=(t=4022871197,function(e){e=String(e);for(var r=0;r<e.length;r++){var n=.02519603282416938*(t+=e.charCodeAt(r));n-=t=n>>>0,t=(n*=t)>>>0,t+=4294967296*(n-=t)}return 2.3283064365386963e-10*(t>>>0)});r.next=function(){var e=2091639*r.s0+2.3283064365386963e-10*r.c;return r.s0=r.s1,r.s1=r.s2,r.s2=e-(r.c=0|e)},r.c=1,r.s0=n(" "),r.s1=n(" "),r.s2=n(" "),r.s0-=n(e),r.s0<0&&(r.s0+=1),r.s1-=n(e),r.s1<0&&(r.s1+=1),r.s2-=n(e),r.s2<0&&(r.s2+=1),n=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function o(e,r){var n=new i(e),o=r&&r.state,s=n.next;return s.int32=function(){return 4294967296*n.next()|0},s.double=function(){return s()+11102230246251565e-32*(2097152*s()|0)},s.quick=s,o&&("object"==t(o)&&a(o,n),s.state=function(){return a(n,{})}),s}r&&r.exports?r.exports=o:n&&n.amd?n((function(){return o})):this.alea=o})(0,V,!1);var q=V.exports;function z(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=Array.isArray(e),a=Array.isArray(r);if(i)if(a){if(e.length!=r.length)if(console.warn("Unclear parameters given to randomization.repeat. Items and repetitions are unequal lengths. Behavior may not be as expected."),r.length<e.length){for(var o=[],s=0;s<e.length;s++)o.push(r);r=o}else r=r.slice(0,e.length)}else{for(var l=[],u=0;u<e.length;u++)l.push(r);r=l}else a?(r=[r[0]],console.log("Unclear parameters given to randomization.repeat. Multiple set sizes specified, but only one item exists to sample. Proceeding using the first set size.")):(e=[e],r=[r]);for(var c=[],h=0;h<e.length;h++)for(var d=0;d<r[h];d++)null==e[h]||"object"!=t(e[h])?c.push(e[h]):c.push(Object.assign({},e[h]));var f=K(c);return n&&(f=W(f)),f}function K(e){Array.isArray(e)||console.error("Argument to shuffle() must be an array.");for(var t,r,n=e.slice(0),i=n.length;i;)r=Math.floor(Math.random()*i--),t=n[i],n[i]=n[r],n[r]=t;return n}function F(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.length;if(1==r)return console.warn("shuffleAlternateGroups() was called with only one group. Defaulting to simple shuffle."),K(e[0]);for(var n=[],i=0;i<r;i++)n.push(i);t&&(n=K(n));for(var a=[],o=null,s=0;s<r;s++)o=null===o?e[s].length:Math.min(o,e[s].length),a.push(K(e[s]));for(var l=[],u=0;u<o;u++)for(var c=0;c<n.length;c++)l.push(a[n[c]][u]);return l}function U(e,t){return Array.isArray(e)||console.error("First argument to sampleWithoutReplacement() must be an array"),t>e.length&&console.error("Cannot take a sample larger than the size of the set of items to sample."),K(e).slice(0,t)}function Y(e,t,r){Array.isArray(e)||console.error("First argument to sampleWithReplacement() must be an array");var n=[];if(void 0!==r){r.length!==e.length&&console.error("The length of the weights array must equal the length of the array to be sampled from.");var i,a=0,o=y(r);try{for(o.s();!(i=o.n()).done;){a+=i.value}}catch(e){o.e(e)}finally{o.f()}var s,l=y(r);try{for(l.s();!(s=l.n()).done;){var u=s.value;n.push(u/a)}}catch(e){l.e(e)}finally{l.f()}}else for(var c=0;c<e.length;c++)n.push(1/e.length);for(var h=[n[0]],d=1;d<n.length;d++)h.push(n[d]+h[d-1]);for(var f=[],p=0;p<t;p++){for(var m=Math.random(),v=0;m>h[v];)v++;f.push(e[v])}return f}function B(e,t){return function(){var e=0,t=0;for(;0===e;)e=Math.random();for(;0===t;)t=Math.random();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*t)}()*t+e}function G(e){return-Math.log(Math.random())/e}function W(e){var t,r={},n=y(e);try{for(n.s();!(t=n.n()).done;)for(var i=t.value,a=0,o=Object.keys(i);a<o.length;a++){var s=o[a];void 0===r[s]&&(r[s]=[]),r[s].push(i[s])}}catch(e){n.e(e)}finally{n.f()}return r}var J=Object.freeze({__proto__:null,setSeed:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Math.random().toString();return Math.random=q(e),e},repeat:z,shuffle:K,shuffleNoRepeats:function(e,t){Array.isArray(e)||console.error("First argument to shuffleNoRepeats() must be an array."),void 0!==t&&"function"!=typeof t&&console.error("Second argument to shuffleNoRepeats() must be a function."),void 0===t&&(t=function(e,t){return e===t});for(var r=K(e),n=0;n<r.length-1;n++)if(t(r[n],r[n+1])){for(var i=Math.floor(Math.random()*(r.length-2))+1;t(r[n+1],r[i])||t(r[n+1],r[i+1])||t(r[n+1],r[i-1])||t(r[n],r[i]);)i=Math.floor(Math.random()*(r.length-2))+1;var a=r[i];r[i]=r[n+1],r[n+1]=a}return r},shuffleAlternateGroups:F,sampleWithoutReplacement:U,sampleWithReplacement:Y,factorial:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=[{}],i=0,o=Object.entries(e);i<o.length;i++){var s,l=d(o[i],2),u=l[0],c=l[1],h=[],f=y(c);try{for(f.s();!(s=f.n()).done;){var p,m=s.value,v=y(n);try{for(v.s();!(p=v.n()).done;){var g=p.value;h.push(Object.assign(Object.assign({},g),a({},u,m)))}}catch(e){v.e(e)}finally{v.f()}}}catch(e){f.e(e)}finally{f.f()}n=h}return z(n,t,r)},randomID:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32,t="",r="0123456789abcdefghjklmnopqrstuvwxyz",n=0;n<e;n++)t+=r[Math.floor(Math.random()*r.length)];return t},randomInt:function(e,t){if(t<e)throw new Error("Upper boundary must be less than or equal to lower boundary");return e+Math.floor(Math.random()*(t-e+1))},sampleBernoulli:function(e){return Math.random()<=e?1:0},sampleNormal:B,sampleExponential:G,sampleExGaussian:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=B(e,t)+G(r);if(n)for(;i<=0;)i=B(e,t)+G(r);return i},randomWords:function(e){return N(e)}});function H(){var e={previewMode:!1,outsideTurk:!1,hitId:"INVALID_URL_PARAMETER",assignmentId:"INVALID_URL_PARAMETER",workerId:"INVALID_URL_PARAMETER",turkSubmitTo:"INVALID_URL_PARAMETER"},t=function(e,t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var r=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null==r?"":r[1]},r=t(window.location.href,"assignmentId")?window.location.href:document.referrer;return["assignmentId","hitId","workerId","turkSubmitTo"].map((function(n){e[n]=unescape(t(r,n))})),e.previewMode="ASSIGNMENT_ID_NOT_AVAILABLE"==e.assignmentId,e.outsideTurk=!e.previewMode&&""===e.hitId&&""==e.assignmentId&&""==e.workerId,e}var X=Object.freeze({__proto__:null,turkInfo:H,submitToTurk:function(e){var t=H(),r=t.assignmentId,n=t.turkSubmitTo;if(r&&n){var i=document.createElement("form");for(var a in i.method="POST",i.action=n+"/mturk/externalSubmit?assignmentId="+r,e)if(e.hasOwnProperty(a)){var o=document.createElement("input");o.type="hidden",o.name=a,o.id=a,o.value=e[a],i.appendChild(o)}document.body.appendChild(i),i.submit()}}}),$=function(){function e(n,i,a,o){if(r(this,e),this.jsPsych=n,this.progress={current_location:-1,current_variable_set:0,current_repetition:0,current_iteration:0,done:!1},this.parent_node=a,this.relative_id=void 0===a?0:o,void 0!==i.timeline){this.timeline_parameters={timeline:[],loop_function:i.loop_function,conditional_function:i.conditional_function,sample:i.sample,randomize_order:void 0!==i.randomize_order&&i.randomize_order,repetitions:void 0===i.repetitions?1:i.repetitions,timeline_variables:void 0===i.timeline_variables?[{}]:i.timeline_variables,on_timeline_finish:i.on_timeline_finish,on_timeline_start:i.on_timeline_start},this.setTimelineVariablesOrder();var s=Object.assign({},i);delete s.timeline,delete s.conditional_function,delete s.loop_function,delete s.randomize_order,delete s.repetitions,delete s.timeline_variables,delete s.sample,delete s.on_timeline_start,delete s.on_timeline_finish,this.node_trial_data=s;for(var l=0;l<i.timeline.length;l++){var u=Object.assign({},s,i.timeline[l]);if("object"==t(s.data)&&"object"==t(i.timeline[l].data)){var c=Object.assign({},s.data,i.timeline[l].data);u.data=c}this.timeline_parameters.timeline.push(new e(this.jsPsych,u,this,l))}}else void 0===i.type&&console.error('Trial level node is missing the "type" parameter. The parameters for the node are: '+JSON.stringify(i)),this.trial_parameters=Object.assign({},i)}return i(e,[{key:"trial",value:function(){return void 0===this.timeline_parameters?k(this.trial_parameters):this.progress.current_location>=this.timeline_parameters.timeline.length?null:this.timeline_parameters.timeline[this.progress.current_location].trial()}},{key:"markCurrentTrialComplete",value:function(){void 0===this.timeline_parameters?this.progress.done=!0:this.timeline_parameters.timeline[this.progress.current_location].markCurrentTrialComplete()}},{key:"nextRepetiton",value:function(){this.setTimelineVariablesOrder(),this.progress.current_location=-1,this.progress.current_variable_set=0,this.progress.current_repetition++;for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}},{key:"setTimelineVariablesOrder",value:function(){var e=this.timeline_parameters;if(void 0!==e&&void 0!==e.timeline_variables){for(var t=[],r=0;r<e.timeline_variables.length;r++)t.push(r);void 0!==e.sample&&("custom"==e.sample.type?t=e.sample.fn(t):"with-replacement"==e.sample.type?t=Y(t,e.sample.size,e.sample.weights):"without-replacement"==e.sample.type?t=U(t,e.sample.size):"fixed-repetitions"==e.sample.type?t=z(t,e.sample.size,!1):"alternate-groups"==e.sample.type?t=F(e.sample.groups,e.sample.randomize_group_order):console.error('Invalid type in timeline sample parameters. Valid options for type are "custom", "with-replacement", "without-replacement", "fixed-repetitions", and "alternate-groups"')),e.randomize_order&&(t=K(t)),this.progress.order=t}}},{key:"nextSet",value:function(){this.progress.current_location=-1,this.progress.current_variable_set++;for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}},{key:"advance",value:function(){var e=this.progress,t=this.timeline_parameters,r=this.jsPsych.internal;if(e.done)return!0;if(-1==e.current_location){if(void 0!==t){if(void 0!==t.conditional_function&&0==e.current_repetition&&0==e.current_variable_set){r.call_immediate=!0;var n=t.conditional_function();if(r.call_immediate=!1,0==n)return e.done=!0,!0}void 0!==t.on_timeline_start&&0==e.current_variable_set&&t.on_timeline_start()}return e.current_location=0,this.advance()}if(void 0!==t){for(var i=!1;e.current_location<t.timeline.length&&0==i;){if(!t.timeline[e.current_location].advance())return i=!0,!1;e.current_location++}return e.current_variable_set<e.order.length-1?(this.nextSet(),this.advance()):e.current_repetition<t.repetitions-1?(this.nextRepetiton(),void 0!==t.on_timeline_finish&&t.on_timeline_finish(),this.advance()):(void 0!==t.on_timeline_finish&&t.on_timeline_finish(),void 0!==t.loop_function?(r.call_immediate=!0,t.loop_function(this.generatedData())?(this.reset(),r.call_immediate=!1,this.parent_node.advance()):(e.done=!0,r.call_immediate=!1,!0)):(e.done=!0,!0))}}},{key:"isComplete",value:function(){return this.progress.done}},{key:"getTimelineVariableValue",value:function(e){if(void 0!==this.timeline_parameters)return this.timeline_parameters.timeline_variables[this.progress.order[this.progress.current_variable_set]][e]}},{key:"findTimelineVariable",value:function(e){var t=this.getTimelineVariableValue(e);return void 0===t?void 0!==this.parent_node?this.parent_node.findTimelineVariable(e):void 0:t}},{key:"timelineVariable",value:function(e){if(void 0===this.timeline_parameters){var t=this.findTimelineVariable(e);return void 0===t&&console.warn("Timeline variable "+e+" not found."),t}var r=Math.max(0,this.progress.current_location);r==this.timeline_parameters.timeline.length&&(r-=1);var n=this.timeline_parameters.timeline[r].timelineVariable(e);return void 0===n&&console.warn("Timeline variable "+e+" not found."),n}},{key:"allTimelineVariables",value:function(){for(var e=this.allTimelineVariablesNames(),t={},r=0;r<e.length;r++)t[e[r]]=this.timelineVariable(e[r]);return t}},{key:"allTimelineVariablesNames",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(void 0!==this.timeline_parameters){e=e.concat(Object.keys(this.timeline_parameters.timeline_variables[this.progress.order[this.progress.current_variable_set]]));var t=Math.max(0,this.progress.current_location);return t==this.timeline_parameters.timeline.length&&(t-=1),this.timeline_parameters.timeline[t].allTimelineVariablesNames(e)}if(void 0===this.timeline_parameters)return e}},{key:"length",value:function(){var e=0;if(void 0===this.timeline_parameters)return 1;for(var t=0;t<this.timeline_parameters.timeline.length;t++)e+=this.timeline_parameters.timeline[t].length();return e}},{key:"percentComplete",value:function(){for(var e=this.length(),t=0,r=0;r<this.timeline_parameters.timeline.length;r++)this.timeline_parameters.timeline[r].isComplete()&&(t+=this.timeline_parameters.timeline[r].length());return t/e*100}},{key:"reset",value:function(){if(this.progress.current_location=-1,this.progress.current_repetition=0,this.progress.current_variable_set=0,this.progress.current_iteration++,this.progress.done=!1,this.setTimelineVariablesOrder(),void 0!==this.timeline_parameters)for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}},{key:"end",value:function(){this.progress.done=!0}},{key:"endActiveNode",value:function(){void 0===this.timeline_parameters?(this.end(),this.parent_node.end()):this.timeline_parameters.timeline[this.progress.current_location].endActiveNode()}},{key:"ID",value:function(){var e="";return void 0===this.parent_node?"0."+this.progress.current_iteration:(e+=this.parent_node.ID()+"-",e+=this.relative_id+"."+this.progress.current_iteration)}},{key:"activeID",value:function(){return void 0===this.timeline_parameters?this.ID():this.timeline_parameters.timeline[this.progress.current_location].activeID()}},{key:"generatedData",value:function(){return this.jsPsych.data.getDataByTimelineNode(this.ID())}},{key:"trialsOfType",value:function(e){if(void 0===this.timeline_parameters)return this.trial_parameters.type==e?this.trial_parameters:[];for(var t=[],r=0;r<this.timeline_parameters.timeline.length;r++){var n=this.timeline_parameters.timeline[r].trialsOfType(e);t=t.concat(n)}return t}},{key:"insert",value:function(t){void 0===this.timeline_parameters?console.error("Cannot add new trials to a trial-level node."):this.timeline_parameters.timeline.push(new e(this.jsPsych,Object.assign(Object.assign({},this.node_trial_data),t),this,this.timeline_parameters.timeline.length))}}]),e}();function Q(e){return new Promise((function(t){return setTimeout(t,e)}))}var Z=function(){function n(e){var t,i;r(this,n),this.extensions={},this.turk=X,this.randomization=J,this.utils=x,this.opts={},this.global_trial_index=0,this.current_trial={},this.current_trial_finished=!1,this.paused=!1,this.waiting=!1,this.file_protocol=!1,this.simulation_mode=null,this.webaudio_context=null,this.internal={call_immediate:!1},this.progress_bar_amount=0,e=Object.assign({display_element:void 0,on_finish:function(){},on_trial_start:function(){},on_trial_finish:function(){},on_data_update:function(){},on_interaction_data_update:function(){},on_close:function(){},use_webaudio:!0,exclusions:{},show_progress_bar:!1,message_progress_bar:"Completion Progress",auto_update_progress_bar:!0,default_iti:0,minimum_valid_rt:0,experiment_width:null,override_safe_mode:!1,case_sensitive_responses:!1,extensions:[]},e),this.opts=e,b(this),this.webaudio_context="undefined"!=typeof window&&void 0!==window.AudioContext?new AudioContext:null,"file:"!=window.location.protocol||!1!==e.override_safe_mode&&void 0!==e.override_safe_mode||(e.use_webaudio=!1,this.file_protocol=!0,console.warn("jsPsych detected that it is running via the file:// protocol and not on a web server. To prevent issues with cross-origin requests, Web Audio and video preloading have been disabled. If you would like to override this setting, you can set 'override_safe_mode' to 'true' in initJsPsych. For more information, see: https://www.jspsych.org/overview/running-experiments")),this.data=new E(this),this.pluginAPI=(i=(t=this).getInitSettings(),Object.assign.apply(Object,[{}].concat(f([new L(t.getDisplayContainerElement,i.case_sensitive_responses,i.minimum_valid_rt),new D,new S(i.use_webaudio,t.webaudio_context),new O,new M].map((function(e){return b(e)}))))));var a,o=y(e.extensions);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.extensions[s.type.info.name]=new s.type(this)}}catch(e){o.e(e)}finally{o.f()}this.pluginAPI.initAudio()}return i(n,[{key:"version",value:function(){return"7.3.1"}},{key:"run",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&console.error("No timeline declared in jsPsych.run. Cannot start experiment."),0===e.length&&console.error("No trials have been added to the timeline (the timeline is an empty array). Cannot start experiment."),this.timelineDescription=e,this.timeline=new $(this,{timeline:e}),t.next=6,this.prepareDom();case 6:return t.next=8,this.checkExclusions(this.opts.exclusions);case 8:return t.next=10,this.loadExtensions(this.opts.extensions);case 10:return document.documentElement.setAttribute("jspsych","present"),this.startExperiment(),t.next=14,this.finished;case 14:case"end":return t.stop()}}),t,this)})))}},{key:"simulate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"data-only",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return v(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.simulation_mode=t,this.simulation_options=r,n.next=4,this.run(e);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"getProgress",value:function(){return{total_trials:void 0===this.timeline?void 0:this.timeline.length(),current_trial_global:this.global_trial_index,percent_complete:void 0===this.timeline?0:this.timeline.percentComplete()}}},{key:"getStartTime",value:function(){return this.exp_start_time}},{key:"getTotalTime",value:function(){return void 0===this.exp_start_time?0:(new Date).getTime()-this.exp_start_time.getTime()}},{key:"getDisplayElement",value:function(){return this.DOM_target}},{key:"getDisplayContainerElement",value:function(){return this.DOM_container}},{key:"finishTrial",value:function(){var e,r=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.current_trial_finished){var i;if(this.current_trial_finished=!0,void 0!==this.current_trial.css_classes&&Array.isArray(this.current_trial.css_classes))(i=this.DOM_target.classList).remove.apply(i,f(this.current_trial.css_classes));this.data.write(n);var a=this.data.getLastTrialData(),o=a.values()[0],s=this.current_trial;if("object"===t(s.save_trial_parameters))for(var l=0,u=Object.keys(s.save_trial_parameters);l<u.length;l++){var c=u[l],h=s.save_trial_parameters[c];!0===h&&(void 0===s[c]?console.warn('Invalid parameter specified in save_trial_parameters. Trial has no property called "'.concat(c,'".')):"function"==typeof s[c]?o[c]=s[c].toString():o[c]=s[c]),!1===h&&"internal_node_id"!==c&&"trial_index"!==c&&delete o[c]}var d=(null!==(e=s.extensions)&&void 0!==e?e:[]).map((function(e){return r.extensions[e.type.info.name].on_finish(e.params)})),p=function(){r.internal.call_immediate=!0,"function"==typeof s.on_finish&&s.on_finish(o),r.opts.on_trial_finish(o),r.opts.on_data_update(o),r.internal.call_immediate=!1,"data-only"===r.simulation_mode?r.nextTrial():null===typeof s.post_trial_gap||void 0===s.post_trial_gap?r.opts.default_iti>0?setTimeout(r.nextTrial,r.opts.default_iti):r.nextTrial():s.post_trial_gap>0?setTimeout(r.nextTrial,s.post_trial_gap):r.nextTrial()};if(d.some((function(e){return"function"==typeof e.then})))Promise.all(d.map((function(e){return Promise.resolve(e).then((function(e){Object.assign(o,e)}))}))).then(p);else{var m,v=y(d);try{for(v.s();!(m=v.n()).done;){var g=m.value;Object.assign(o,g)}}catch(e){v.e(e)}finally{v.f()}p()}}}},{key:"endExperiment",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.timeline.end_message=e,this.timeline.end(),this.pluginAPI.cancelAllKeyboardResponses(),this.pluginAPI.clearAllTimeouts(),this.finishTrial(t)}},{key:"endCurrentTimeline",value:function(){this.timeline.endActiveNode()}},{key:"getCurrentTrial",value:function(){return this.current_trial}},{key:"getInitSettings",value:function(){return this.opts}},{key:"getCurrentTimelineNodeID",value:function(){return this.timeline.activeID()}},{key:"timelineVariable",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.internal.call_immediate||!0===r?this.timeline.timelineVariable(e):{timelineVariablePlaceholder:!0,timelineVariableFunction:function(){return t.timeline.timelineVariable(e)}}}},{key:"getAllTimelineVariables",value:function(){return this.timeline.allTimelineVariables()}},{key:"addNodeToEndOfTimeline",value:function(e,t){this.timeline.insert(e)}},{key:"pauseExperiment",value:function(){this.paused=!0}},{key:"resumeExperiment",value:function(){this.paused=!1,this.waiting&&(this.waiting=!1,this.nextTrial())}},{key:"loadFail",value:function(e){e=e||"<p>The experiment failed to load.</p>",this.DOM_target.innerHTML=e}},{key:"getSafeModeStatus",value:function(){return this.file_protocol}},{key:"getTimeline",value:function(){return this.timelineDescription}},{key:"prepareDom",value:function(){return v(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("complete"===document.readyState){e.next=3;break}return e.next=3,new Promise((function(e){window.addEventListener("load",e)}));case 3:void 0===(t=this.opts).display_element?(null===document.querySelector("body")&&document.documentElement.appendChild(document.createElement("body")),document.querySelector("html").style.height="100%",document.querySelector("body").style.margin="0px",document.querySelector("body").style.height="100%",document.querySelector("body").style.width="100%",t.display_element=document.querySelector("body")):null===(r=t.display_element instanceof Element?t.display_element:document.querySelector("#"+t.display_element))?console.error("The display_element specified in initJsPsych() does not exist in the DOM."):t.display_element=r,t.display_element.innerHTML='<div class="jspsych-content-wrapper"><div id="jspsych-content"></div></div>',this.DOM_container=t.display_element,this.DOM_target=document.querySelector("#jspsych-content"),null!==t.experiment_width&&(this.DOM_target.style.width=t.experiment_width+"px"),t.display_element.tabIndex=0,-1===t.display_element.className.indexOf("jspsych-display-element")&&(t.display_element.className+=" jspsych-display-element"),this.DOM_target.className+="jspsych-content",this.data.createInteractionListeners(),window.addEventListener("beforeunload",t.on_close);case 14:case"end":return e.stop()}}),e,this)})))}},{key:"loadExtensions",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Promise.all(e.map((function(e){return r.extensions[e.type.info.name].initialize(e.params||{})})));case 3:t.next=9;break;case 5:throw t.prev=5,t.t0=t.catch(0),console.error(t.t0),new Error(t.t0);case 9:case"end":return t.stop()}}),t,null,[[0,5]])})))}},{key:"startExperiment",value:function(){var e=this;this.finished=new Promise((function(t){e.resolveFinishedPromise=t})),!0===this.opts.show_progress_bar&&this.drawProgressBar(this.opts.message_progress_bar),this.exp_start_time=new Date,this.timeline.advance(),this.doTrial(this.timeline.trial())}},{key:"finishExperiment",value:function(){var e=this,t=this.opts.on_finish(this.data.get()),r=function(){void 0!==e.timeline.end_message&&(e.DOM_target.innerHTML=e.timeline.end_message),e.resolveFinishedPromise()};t?Promise.resolve(t).then(r):r()}},{key:"nextTrial",value:function(){if(this.paused)this.waiting=!0;else{this.global_trial_index++,this.timeline.markCurrentTrialComplete();var e=this.timeline.advance();!0===this.opts.show_progress_bar&&!0===this.opts.auto_update_progress_bar&&this.updateProgressBar(),e?this.finishExperiment():this.doTrial(this.timeline.trial())}}},{key:"doTrial",value:function(e){var t,r=this;if(this.current_trial=e,this.current_trial_finished=!1,this.evaluateTimelineVariables(e),"string"==typeof e.type)throw new w("A string was provided as the trial's `type` parameter. Since jsPsych v7, the `type` parameter needs to be a plugin object.");if(e.type=Object.assign(Object.assign({},b(new e.type(this))),{info:e.type.info}),this.evaluateFunctionParameters(e),this.setDefaultValues(e),this.internal.call_immediate=!0,this.opts.on_trial_start(e),"function"==typeof e.on_start&&e.on_start(e),Array.isArray(e.extensions)){var n,i=y(e.extensions);try{for(i.s();!(n=i.n()).done;){var a=n.value;this.extensions[a.type.info.name].on_start(a.params)}}catch(e){i.e(e)}finally{i.f()}}(this.DOM_container.focus(),this.DOM_target.scrollTop=0,void 0!==e.css_classes)&&(Array.isArray(e.css_classes)||"string"!=typeof e.css_classes||(e.css_classes=[e.css_classes]),Array.isArray(e.css_classes)&&(t=this.DOM_target.classList).add.apply(t,f(e.css_classes)));var o,s,l=function(){if("function"==typeof e.on_load&&e.on_load(),Array.isArray(e.extensions)){var t,n=y(e.extensions);try{for(n.s();!(t=n.n()).done;){var i=t.value;r.extensions[i.type.info.name].on_load(i.params)}}catch(e){n.e(e)}finally{n.f()}}};(this.simulation_mode||(o=e.type.trial(this.DOM_target,e,l)),this.simulation_mode)&&(e.type.simulate?(e.simulation_options||(s=this.simulation_options.default),e.simulation_options&&("string"==typeof e.simulation_options?this.simulation_options[e.simulation_options]?s=this.simulation_options[e.simulation_options]:this.simulation_options.default?(console.log('No matching simulation options found for "'.concat(e.simulation_options,'". Using "default" options.')),s=this.simulation_options.default):(console.log('No matching simulation options found for "'.concat(e.simulation_options,'" and no "default" options provided. Using the default values provided by the plugin.')),s={}):s=e.simulation_options),s=this.utils.deepCopy(s),o=!1===(null==(s=this.replaceFunctionsWithValues(s,null))?void 0:s.simulate)?e.type.trial(this.DOM_target,e,l):e.type.simulate(e,(null==s?void 0:s.mode)||this.simulation_mode,s,l)):o=e.type.trial(this.DOM_target,e,l));o&&"function"==typeof o.then||this.simulation_mode||l(),this.internal.call_immediate=!1}},{key:"evaluateTimelineVariables",value:function(e){for(var r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];"object"===t(e[i])&&null!==e[i]&&void 0!==e[i].timelineVariablePlaceholder&&(e[i]=e[i].timelineVariableFunction()),"object"===t(e[i])&&null!==e[i]&&"timeline"!==i&&"timeline_variables"!==i&&this.evaluateTimelineVariables(e[i])}}},{key:"evaluateFunctionParameters",value:function(t){this.internal.call_immediate=!0;for(var r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];"type"!==i&&(void 0!==A[i]&&A[i].type!==e.ParameterType.FUNCTION&&(t[i]=this.replaceFunctionsWithValues(t[i],null)),void 0!==t.type.info.parameters[i]&&t.type.info.parameters[i].type!==e.ParameterType.FUNCTION&&(t[i]=this.replaceFunctionsWithValues(t[i],t.type.info.parameters[i])))}this.internal.call_immediate=!1}},{key:"replaceFunctionsWithValues",value:function(r,n){if(null===r)return r;if(Array.isArray(r))for(var i=0;i<r.length;i++)r[i]=this.replaceFunctionsWithValues(r[i],n);else if("object"===t(r))if(null!==n&&n.nested)for(var a=0,o=Object.keys(r);a<o.length;a++){var s=o[a];"object"===t(n.nested[s])&&n.nested[s].type!==e.ParameterType.FUNCTION&&(r[s]=this.replaceFunctionsWithValues(r[s],n.nested[s]))}else for(var l=0,u=Object.keys(r);l<u.length;l++){var c=u[l];"type"!==c&&"timeline"!==c&&"timeline_variables"!==c&&(r[c]=this.replaceFunctionsWithValues(r[c],null))}else if("function"==typeof r)return r();return r}},{key:"setDefaultValues",value:function(t){var r=function(r){t.type.info.parameters[r].type===e.ParameterType.COMPLEX?!0===t.type.info.parameters[r].array&&t[r].forEach((function(e,n){for(var i in t.type.info.parameters[r].nested)void 0!==t[r][n][i]&&null!==t[r][n][i]||(void 0===t.type.info.parameters[r].nested[i].default?console.error("You must specify a value for the "+i+" parameter (nested in the "+r+" parameter) in the "+t.type+" plugin."):t[r][n][i]=t.type.info.parameters[r].nested[i].default)})):void 0!==t[r]&&null!==t[r]||(void 0===t.type.info.parameters[r].default?console.error("You must specify a value for the "+r+" parameter in the "+t.type.info.name+" plugin."):t[r]=t.type.info.parameters[r].default)};for(var n in t.type.info.parameters)r(n)}},{key:"checkExclusions",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r,n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e.min_width||e.min_height||e.audio)&&console.warn("The exclusions option in `initJsPsych()` is deprecated and will be removed in a future version. We recommend using the browser-check plugin instead. See https://www.jspsych.org/latest/plugins/browser-check/."),!e.min_width&&!e.min_height){t.next=12;break}if(r=e.min_width||0,n=e.min_height||0,!(window.innerWidth<r||window.innerHeight<n)){t.next=12;break}this.getDisplayElement().innerHTML="<p>Your browser window is too small to complete this experiment. Please maximize the size of your browser window. If your browser window is already maximized, you will not be able to complete this experiment.</p><p>The minimum width is "+r+"px. Your current width is "+window.innerWidth+"px.</p><p>The minimum height is "+n+"px. Your current height is "+window.innerHeight+"px.</p>";case 6:if(!(window.innerWidth<r||window.innerHeight<n)){t.next=11;break}return t.next=9,Q(100);case 9:t.next=6;break;case 11:this.getDisplayElement().innerHTML="";case 12:if(void 0===e.audio||!e.audio){t.next=16;break}if(window.hasOwnProperty("AudioContext")||window.hasOwnProperty("webkitAudioContext")){t.next=16;break}throw this.getDisplayElement().innerHTML="<p>Your browser does not support the WebAudio API, which means that you will not be able to complete the experiment.</p><p>Browsers that support the WebAudio API include Chrome, Firefox, Safari, and Edge.</p>",new Error;case 16:case"end":return t.stop()}}),t,this)})))}},{key:"drawProgressBar",value:function(e){document.querySelector(".jspsych-display-element").insertAdjacentHTML("afterbegin",'<div id="jspsych-progressbar-container"><span>'+e+'</span><div id="jspsych-progressbar-outer"><div id="jspsych-progressbar-inner"></div></div></div>')}},{key:"updateProgressBar",value:function(){this.setProgressBar(this.getProgress().percent_complete/100)}},{key:"setProgressBar",value:function(e){e=Math.max(Math.min(1,e),0),document.querySelector("#jspsych-progressbar-inner").style.width=100*e+"%",this.progress_bar_amount=e}},{key:"getProgressBarCompleted",value:function(){return this.progress_bar_amount}}]),n}();return"undefined"!=typeof window&&window.hasOwnProperty("webkitAudioContext")&&!window.hasOwnProperty("AudioContext")&&(window.AudioContext=webkitAudioContext),e.JsPsych=Z,e.initJsPsych=function(e){var t=new Z(e);return Object.defineProperties(t,Object.fromEntries(Object.entries({init:"`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.",ALL_KEYS:'jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.',NO_KEYS:'jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.',currentTimelineNodeID:"`currentTimelineNodeID()` was renamed to `getCurrentTimelineNodeID()` in jsPsych v7.",progress:"`progress()` was renamed to `getProgress()` in jsPsych v7.",startTime:"`startTime()` was renamed to `getStartTime()` in jsPsych v7.",totalTime:"`totalTime()` was renamed to `getTotalTime()` in jsPsych v7.",currentTrial:"`currentTrial()` was renamed to `getCurrentTrial()` in jsPsych v7.",initSettings:"`initSettings()` was renamed to `getInitSettings()` in jsPsych v7.",allTimelineVariables:"`allTimelineVariables()` was renamed to `getAllTimelineVariables()` in jsPsych v7."}).map((function(e){var t=d(e,2),r=t[0],n=t[1];return[r,{get:function(){throw new w(n)}}]})))),t},e.universalPluginParameters=A,Object.defineProperty(e,"__esModule",{value:!0}),e}({}),initJsPsych=jsPsychModule.initJsPsych;
1
+ var jsPsychModule=function(e){"use strict";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 r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function l(){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 u(e,t,r){return u=l()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&s(i,r.prototype),i},u.apply(null,arguments)}function c(e){var t="function"==typeof Map?new Map:void 0;return c=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return u(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)},c(e)}function h(e,t){if(t&&("object"==typeof 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)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}(e,t)||p(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||p(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 p(e,t){if(e){if("string"==typeof e)return m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=p(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function v(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))}!function(e){var r=function(e){var r,n=Object.prototype,i=n.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i=t&&t.prototype instanceof v?t:v,a=Object.create(i.prototype),o=new L(n||[]);return a._invoke=function(e,t,r){var n=d;return function(i,a){if(n===p)throw new Error("Generator is already running");if(n===m){if("throw"===i)throw a;return I()}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=P(o,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===d)throw n=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var l=h(e,t,r);if("normal"===l.type){if(n=r.done?m:f,l.arg===y)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n=m,r.method="throw",r.arg=l.arg)}}}(e,r,o),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d="suspendedStart",f="suspendedYield",p="executing",m="completed",y={};function v(){}function g(){}function b(){}var w={};u(w,o,(function(){return this}));var _=Object.getPrototypeOf,k=_&&_(_(A([])));k&&k!==n&&i.call(k,o)&&(w=k);var x=b.prototype=v.prototype=Object.create(w);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function j(e,r){function n(a,o,s,l){var u=h(e[a],e,o);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"===t(d)&&i.call(d,"__await")?r.resolve(d.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):r.resolve(d).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,l)}))}l(u.arg)}var a;this._invoke=function(e,t){function i(){return new r((function(r,i){n(e,t,r,i)}))}return a=a?a.then(i,i):i()}}function P(e,t){var n=e.iterator[t.method];if(n===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=r,P(e,t),"throw"===t.method))return y;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=h(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,y;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,y):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function A(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(i.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=r,t.done=!0,t};return a.next=a}}return{next:I}}function I(){return{value:r,done:!0}}return g.prototype=b,u(x,"constructor",b),u(b,"constructor",g),g.displayName=u(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,u(e,l,"GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},T(j.prototype),u(j.prototype,s,(function(){return this})),e.AsyncIterator=j,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new j(c(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},T(x),u(x,l,"Generator"),u(x,o,(function(){return this})),u(x,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=A,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=r)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return s.type="throw",s.arg=e,t.next=n,i&&(t.method="next",t.arg=r),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var l=i.call(o,"catchLoc"),u=i.call(o,"finallyLoc");if(l&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),O(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;O(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:A(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),y}},e}(e.exports);try{regeneratorRuntime=r}catch(e){"object"===("undefined"==typeof globalThis?"undefined":t(globalThis))?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}({exports:{}});var g=function(e){var t=new Set;do{var r,n=y(Reflect.ownKeys(e));try{for(n.s();!(r=n.n()).done;){var i=r.value;t.add([e,i])}}catch(e){n.e(e)}finally{n.f()}}while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t},b=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.include,i=r.exclude,a=function(e){var t=function(t){return"string"==typeof t?e===t:t.test(e)};return n?n.some(t):!i||!i.some(t)},o=y(g(e.constructor.prototype));try{for(o.s();!(t=o.n()).done;){var s=d(t.value,2),l=s[0],u=s[1];if("constructor"!==u&&a(u)){var c=Reflect.getOwnPropertyDescriptor(l,u);c&&"function"==typeof c.value&&(e[u]=e[u].bind(e))}}}catch(e){o.e(e)}finally{o.f()}return e},w=function(e){!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&&s(e,t)}(u,e);var t,n,a=(t=u,n=l(),function(){var e,r=o(t);if(n){var i=o(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return h(this,e)});function u(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"The global `jsPsych` variable is no longer available in jsPsych v7.";return r(this,u),(e=a.call(this,"".concat(t," Please follow the migration guide at https://www.jspsych.org/7.0/support/migration-v7/ to update your experiment."))).name="MigrationError",e}return i(u)}(c(Error));function _(e){return f(new Set(e))}function k(e){if(!e)return e;var r;if(Array.isArray(e)){r=[];var n,i=y(e);try{for(i.s();!(n=i.n()).done;){var a=n.value;r.push(k(a))}}catch(e){i.e(e)}finally{i.f()}return r}if("object"===t(e)&&null!==e){for(var o in r={},e)e.hasOwnProperty(o)&&(r[o]=k(e[o]));return r}return e}window.jsPsych={get init(){throw new w("`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.")},get data(){throw new w},get randomization(){throw new w},get turk(){throw new w},get pluginAPI(){throw new w},get ALL_KEYS(){throw new w('jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.')},get NO_KEYS(){throw new w('jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.')}};var x=Object.freeze({__proto__:null,unique:_,deepCopy:k}),T=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];r(this,e),this.values=t}return i(e,[{key:"sum",value:function(){var e,t=0,r=y(this.values);try{for(r.s();!(e=r.n()).done;){t+=e.value}}catch(e){r.e(e)}finally{r.f()}return t}},{key:"mean",value:function(){return this.sum()/this.count()}},{key:"median",value:function(){if(0!==this.values.length){var e=this.values.slice(0).sort((function(e,t){return e-t})),t=Math.floor(e.length/2);return e.length%2==0?(e[t]+e[t-1])/2:e[t]}}},{key:"min",value:function(){return Math.min.apply(null,this.values)}},{key:"max",value:function(){return Math.max.apply(null,this.values)}},{key:"count",value:function(){return this.values.length}},{key:"variance",value:function(){var e,t=this.mean(),r=0,n=y(this.values);try{for(n.s();!(e=n.n()).done;){var i=e.value;r+=Math.pow(i-t,2)}}catch(e){n.e(e)}finally{n.f()}return r/(this.values.length-1)}},{key:"sd",value:function(){var e=this.variance();return Math.sqrt(e)}},{key:"frequencies",value:function(){var e,t={},r=y(this.values);try{for(r.s();!(e=r.n()).done;){var n=e.value;void 0===t[n]?t[n]=1:t[n]++}}catch(e){r.e(e)}finally{r.f()}return t}},{key:"all",value:function(e){var t,r=y(this.values);try{for(r.s();!(t=r.n()).done;){if(!e(t.value))return!1}}catch(e){r.e(e)}finally{r.f()}return!0}},{key:"subset",value:function(t){var r,n=[],i=y(this.values);try{for(i.s();!(r=i.n()).done;){var a=r.value;t(a)&&n.push(a)}}catch(e){i.e(e)}finally{i.f()}return new e(n)}}]),e}();var j,P=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];r(this,e),this.trials=t}return i(e,[{key:"push",value:function(e){return this.trials.push(e),this}},{key:"join",value:function(e){return this.trials=this.trials.concat(e.values()),this}},{key:"top",value:function(){return this.trials.length<=1?this:new e([this.trials[this.trials.length-1]])}},{key:"first",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(t<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new e:(t>this.trials.length&&(t=this.trials.length),new e(this.trials.slice(0,t)))}},{key:"last",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(t<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new e:(t>this.trials.length&&(t=this.trials.length),new e(this.trials.slice(this.trials.length-t,this.trials.length)))}},{key:"values",value:function(){return this.trials}},{key:"count",value:function(){return this.trials.length}},{key:"readOnly",value:function(){return new e(k(this.trials))}},{key:"addToAll",value:function(e){var t,r=y(this.trials);try{for(r.s();!(t=r.n()).done;){var n=t.value;Object.assign(n,e)}}catch(e){r.e(e)}finally{r.f()}return this}},{key:"addToLast",value:function(e){return 0!=this.trials.length&&Object.assign(this.trials[this.trials.length-1],e),this}},{key:"filter",value:function(t){var r;r=Array.isArray(t)?k(t):k([t]);var n,i=[],a=y(this.trials);try{for(a.s();!(n=a.n()).done;){var o,s=n.value,l=!1,u=y(r);try{for(u.s();!(o=u.n()).done;){for(var c=o.value,h=!0,d=0,f=Object.keys(c);d<f.length;d++){var p=f[d];void 0!==s[p]&&s[p]===c[p]||(h=!1)}if(h){l=!0;break}}}catch(e){u.e(e)}finally{u.f()}l&&i.push(s)}}catch(e){a.e(e)}finally{a.f()}return new e(i)}},{key:"filterCustom",value:function(t){return new e(this.trials.filter(t))}},{key:"filterColumns",value:function(t){return new e(this.trials.map((function(e){return Object.fromEntries(t.filter((function(t){return t in e})).map((function(t){return[t,e[t]]})))})))}},{key:"select",value:function(e){var t,r=[],n=y(this.trials);try{for(n.s();!(t=n.n()).done;){var i=t.value;void 0!==i[e]&&r.push(i[e])}}catch(e){n.e(e)}finally{n.f()}return new T(r)}},{key:"ignore",value:function(t){Array.isArray(t)||(t=[t]);var r,n=k(this.trials),i=y(n);try{for(i.s();!(r=i.n()).done;){var a,o=r.value,s=y(t);try{for(s.s();!(a=s.n()).done;){delete o[a.value]}}catch(e){s.e(e)}finally{s.f()}}}catch(e){i.e(e)}finally{i.f()}return new e(n)}},{key:"uniqueNames",value:function(){var e,t=[],r=y(this.trials);try{for(r.s();!(e=r.n()).done;)for(var n=e.value,i=0,a=Object.keys(n);i<a.length;i++){var o=a[i];t.includes(o)||t.push(o)}}catch(e){r.e(e)}finally{r.f()}return t}},{key:"csv",value:function(){return function(e){var r,n="object"!=t(e)?JSON.parse(e):e,i="",a="",o=[],s=y(n);try{for(s.s();!(r=s.n()).done;){var l=r.value;for(var u in l){var c=u+"";c='"'+c.replace(/"/g,'""')+'",',o.includes(u)||(o.push(u),i+=c)}}}catch(e){s.e(e)}finally{s.f()}a+=(i=i.slice(0,-1))+"\r\n";var h,d=y(n);try{for(d.s();!(h=d.n()).done;){var f=h.value;i="";var p,m=y(o);try{for(m.s();!(p=m.n()).done;){var v=p.value,g=void 0===f[v]?"":f[v];"object"==t(g)&&(g=JSON.stringify(g)),i+='"'+(g+"").replace(/"/g,'""')+'",'}}catch(e){m.e(e)}finally{m.f()}a+=(i=i.slice(0,-1))+"\r\n"}}catch(e){d.e(e)}finally{d.f()}return a}(this.trials)}},{key:"json",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?JSON.stringify(this.trials,null,"\t"):JSON.stringify(this.trials)}},{key:"localSave",value:function(e,t){var r;if("json"===(e=e.toLowerCase()))r=this.json();else{if("csv"!==e)throw new Error('Invalid format specified for localSave. Must be "json" or "csv".');r=this.csv()}!function(e,t){var r=new Blob([e],{type:"text/plain"}),n="";n=void 0!==window.webkitURL?window.webkitURL.createObjectURL(r):window.URL.createObjectURL(r);var i=document.createElement("a");i.id="jspsych-download-as-text-link",i.style.display="none",i.download=t,i.href=n,i.click()}(r,t)}}]),e}(),E=function(){function e(t){r(this,e),this.jsPsych=t,this.dataProperties={},this.reset()}return i(e,[{key:"reset",value:function(){this.allData=new P,this.interactionData=new P}},{key:"get",value:function(){return this.allData}},{key:"getInteractionData",value:function(){return this.interactionData}},{key:"write",value:function(e){var t=this.jsPsych.getProgress(),r=this.jsPsych.getCurrentTrial(),n={trial_type:r.type.info.name,trial_index:t.current_trial_global,time_elapsed:this.jsPsych.getTotalTime(),internal_node_id:this.jsPsych.getCurrentTimelineNodeID()};this.allData.push(Object.assign(Object.assign(Object.assign(Object.assign({},e),r.data),n),this.dataProperties))}},{key:"addProperties",value:function(e){this.allData.addToAll(e),this.dataProperties=Object.assign({},this.dataProperties,e)}},{key:"addDataToLastTrial",value:function(e){this.allData.addToLast(e)}},{key:"getDataByTimelineNode",value:function(e){return this.allData.filterCustom((function(t){return t.internal_node_id.slice(0,e.length)===e}))}},{key:"getLastTrialData",value:function(){return this.allData.top()}},{key:"getLastTimelineData",value:function(){var e=this.getLastTrialData().select("internal_node_id").values[0];if(void 0===e)return new P;var t=e.substr(0,e.lastIndexOf("-"));return this.getDataByTimelineNode(t)}},{key:"displayData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"json";"json"!=(e=e.toLowerCase())&&"csv"!=e&&(console.log("Invalid format declared for displayData function. Using json as default."),e="json");var t="json"===e?this.allData.json(!0):this.allData.csv(),r=this.jsPsych.getDisplayElement();r.innerHTML='<pre id="jspsych-data-display"></pre>',document.getElementById("jspsych-data-display").textContent=t}},{key:"urlVariables",value:function(){return void 0===this.query_string&&(this.query_string=function(){for(var e=window.location.search.substr(1).split("&"),t={},r=0;r<e.length;++r){var n=e[r].split("=",2);1==n.length?t[n[0]]="":t[n[0]]=decodeURIComponent(n[1].replace(/\+/g," "))}return t}()),this.query_string}},{key:"getURLVariable",value:function(e){return this.urlVariables()[e]}},{key:"createInteractionListeners",value:function(){var e=this;window.addEventListener("blur",(function(){var t={event:"blur",trial:e.jsPsych.getProgress().current_trial_global,time:e.jsPsych.getTotalTime()};e.interactionData.push(t),e.jsPsych.getInitSettings().on_interaction_data_update(t)})),window.addEventListener("focus",(function(){var t={event:"focus",trial:e.jsPsych.getProgress().current_trial_global,time:e.jsPsych.getTotalTime()};e.interactionData.push(t),e.jsPsych.getInitSettings().on_interaction_data_update(t)}));var t=function(){var t={event:document.isFullScreen||document.webkitIsFullScreen||document.mozIsFullScreen||document.fullscreenElement?"fullscreenenter":"fullscreenexit",trial:e.jsPsych.getProgress().current_trial_global,time:e.jsPsych.getTotalTime()};e.interactionData.push(t),e.jsPsych.getInitSettings().on_interaction_data_update(t)};document.addEventListener("fullscreenchange",t),document.addEventListener("mozfullscreenchange",t),document.addEventListener("webkitfullscreenchange",t)}},{key:"_customInsert",value:function(e){this.allData=new P(e)}},{key:"_fullreset",value:function(){this.reset(),this.dataProperties={}}}]),e}(),O=function(){function e(){var t=this;r(this,e),this.hardwareConnected=!1,document.addEventListener("jspsych-activate",(function(e){t.hardwareConnected=!0}))}return i(e,[{key:"hardware",value:function(e){var t=new CustomEvent("jspsych",{detail:e});document.dispatchEvent(t)}}]),e}(),L=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;r(this,e),this.getRootElement=t,this.areResponsesCaseSensitive=n,this.minimumValidRt=i,this.listeners=new Set,this.heldKeys=new Set,this.areRootListenersRegistered=!1,b(this),this.registerRootListeners()}return i(e,[{key:"registerRootListeners",value:function(){if(!this.areRootListenersRegistered){var e=this.getRootElement();e&&(e.addEventListener("keydown",this.rootKeydownListener),e.addEventListener("keyup",this.rootKeyupListener),this.areRootListenersRegistered=!0)}}},{key:"rootKeydownListener",value:function(e){for(var t=0,r=Array.from(this.listeners);t<r.length;t++){(0,r[t])(e)}this.heldKeys.add(this.toLowerCaseIfInsensitive(e.key))}},{key:"toLowerCaseIfInsensitive",value:function(e){return this.areResponsesCaseSensitive?e:e.toLowerCase()}},{key:"rootKeyupListener",value:function(e){this.heldKeys.delete(this.toLowerCaseIfInsensitive(e.key))}},{key:"isResponseValid",value:function(e,t,r){return!(!t&&this.heldKeys.has(r))&&("ALL_KEYS"===e||"NO_KEYS"!==e&&e.includes(r))}},{key:"getKeyboardResponse",value:function(e){var t=this,r=e.callback_function,n=e.valid_responses,i=void 0===n?"ALL_KEYS":n,a=e.rt_method,o=void 0===a?"performance":a,s=e.persist,l=e.audio_context,u=e.audio_context_start_time,c=e.allow_held_key,h=void 0!==c&&c,d=e.minimum_valid_rt,f=void 0===d?this.minimumValidRt:d;"performance"!==o&&"audio"!==o&&(console.log('Invalid RT method specified in getKeyboardResponse. Defaulting to "performance" method.'),o="performance");var p="performance"===o?performance.now():1e3*u;this.registerRootListeners(),this.areResponsesCaseSensitive||"string"==typeof i||(i=i.map((function(e){return e.toLowerCase()})));var m=function e(n){var a=Math.round(("performance"==o?performance.now():1e3*l.currentTime)-p);if(!(a<f)){var u=t.toLowerCaseIfInsensitive(n.key);t.isResponseValid(i,h,u)&&(n.preventDefault(),s||t.cancelKeyboardResponse(e),r({key:u,rt:a}))}};return this.listeners.add(m),m}},{key:"cancelKeyboardResponse",value:function(e){this.listeners.delete(e)}},{key:"cancelAllKeyboardResponses",value:function(){this.listeners.clear()}},{key:"compareKeys",value:function(e,t){if(!("string"!=typeof e&&null!==e||"string"!=typeof t&&null!==t))return"string"==typeof e&&"string"==typeof t?this.areResponsesCaseSensitive?e===t:e.toLowerCase()===t.toLowerCase():null===e&&null===t;console.error("Error in jsPsych.pluginAPI.compareKeys: arguments must be key strings or null.")}}]),e}();e.ParameterType=void 0,(j=e.ParameterType||(e.ParameterType={}))[j.BOOL=0]="BOOL",j[j.STRING=1]="STRING",j[j.INT=2]="INT",j[j.FLOAT=3]="FLOAT",j[j.FUNCTION=4]="FUNCTION",j[j.KEY=5]="KEY",j[j.KEYS=6]="KEYS",j[j.SELECT=7]="SELECT",j[j.HTML_STRING=8]="HTML_STRING",j[j.IMAGE=9]="IMAGE",j[j.AUDIO=10]="AUDIO",j[j.VIDEO=11]="VIDEO",j[j.OBJECT=12]="OBJECT",j[j.COMPLEX=13]="COMPLEX",j[j.TIMELINE=14]="TIMELINE";var A={data:{type:e.ParameterType.OBJECT,pretty_name:"Data",default:{}},on_start:{type:e.ParameterType.FUNCTION,pretty_name:"On start",default:function(){}},on_finish:{type:e.ParameterType.FUNCTION,pretty_name:"On finish",default:function(){}},on_load:{type:e.ParameterType.FUNCTION,pretty_name:"On load",default:function(){}},post_trial_gap:{type:e.ParameterType.INT,pretty_name:"Post trial gap",default:null},css_classes:{type:e.ParameterType.STRING,pretty_name:"Custom CSS classes",default:null},simulation_options:{type:e.ParameterType.COMPLEX,default:null}},I=[e.ParameterType.AUDIO,e.ParameterType.IMAGE,e.ParameterType.VIDEO],S=function(){function t(e,n){r(this,t),this.useWebaudio=e,this.webaudioContext=n,this.video_buffers={},this.context=null,this.audio_buffers=[],this.preload_requests=[],this.img_cache={},this.preloadMap=new Map,this.microphone_recorder=null,this.camera_stream=null,this.camera_recorder=null}return i(t,[{key:"getVideoBuffer",value:function(e){return e.startsWith("blob:")&&(this.video_buffers[e]=e),this.video_buffers[e]}},{key:"initAudio",value:function(){this.context=this.useWebaudio?this.webaudioContext:null}},{key:"audioContext",value:function(){return null!==this.context&&"running"!==this.context.state&&this.context.resume(),this.context}},{key:"getAudioBuffer",value:function(e){var t=this;return new Promise((function(r,n){void 0===t.audio_buffers[e]||"tmp"==t.audio_buffers[e]?t.preloadAudio([e],(function(){r(t.audio_buffers[e])}),(function(){}),(function(e){n(e.error)})):r(t.audio_buffers[e])}))}},{key:"preloadAudio",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){};e=_(e.flat());var a=0;if(0!=e.length){var o,s=function(o){var s=new XMLHttpRequest;s.open("GET",o,!0),s.responseType="arraybuffer",s.onload=function(){t.context.decodeAudioData(s.response,(function(i){t.audio_buffers[o]=i,a++,n(o),a==e.length&&r()}),(function(e){i({source:o,error:e})}))},s.onerror=function(e){var t=e;404==s.status&&(t="404"),i({source:o,error:t})},s.onloadend=function(e){404==s.status&&i({source:o,error:"404"})},s.send(),t.preload_requests.push(s)},l=function(o){var s=new Audio;s.addEventListener("canplaythrough",(function i(){t.audio_buffers[o]=s,a++,n(o),a==e.length&&r(),s.removeEventListener("canplaythrough",i)})),s.addEventListener("error",(function e(t){i({source:s.src,error:t}),s.removeEventListener("error",e)})),s.addEventListener("abort",(function e(t){i({source:s.src,error:t}),s.removeEventListener("abort",e)})),s.src=o,t.preload_requests.push(s)},u=y(e);try{for(u.s();!(o=u.n()).done;){var c=o.value;void 0!==this.audio_buffers[c]?(a++,n(c),a==e.length&&r()):(this.audio_buffers[c]="tmp",null!==this.audioContext()?s(c):l(c))}}catch(e){u.e(e)}finally{u.f()}}else r()}},{key:"preloadImages",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){};e=_(e.flat());var a=0;if(0!==e.length)for(var o=function(o){var s=new Image,l=e[o];s.onload=function(){a++,n(l),a===e.length&&r()},s.onerror=function(e){i({source:l,error:e})},s.src=l,t.img_cache[l]=s,t.preload_requests.push(s)},s=0;s<e.length;s++)o(s);else r()}},{key:"preloadVideo",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){};e=_(e.flat());var a=0;if(0!==e.length){var o,s=y(e);try{var l=function(){var s=o.value,l=t.video_buffers,u=new XMLHttpRequest;u.open("GET",s,!0),u.responseType="blob",u.onload=function(){if(200===u.status||0===u.status){var t=u.response;l[s]=URL.createObjectURL(t),a++,n(s),a===e.length&&r()}},u.onerror=function(e){var t=e;404==u.status&&(t="404"),i({source:s,error:t})},u.onloadend=function(e){404==u.status&&i({source:s,error:"404"})},u.send(),t.preload_requests.push(u)};for(s.s();!(o=s.n()).done;)l()}catch(e){s.e(e)}finally{s.f()}}else r()}},{key:"getAutoPreloadList",value:function(t){var r=this,n=Object.fromEntries(I.map((function(e){return[e,new Set]})));return function e(t,i){var a,o,s,l;if(void 0!==t.timeline){var u,c=y(t.timeline);try{for(c.s();!(u=c.n()).done;){e(u.value,null!==(a=t.type)&&void 0!==a?a:i)}}catch(e){c.e(e)}finally{c.f()}}else if(null===(s=null!==(o=t.type)&&void 0!==o?o:i)||void 0===s?void 0:s.info){var h=(null!==(l=t.type)&&void 0!==l?l:i).info,f=h.name,p=h.parameters;r.preloadMap.has(f)||r.preloadMap.set(f,Object.fromEntries(Object.entries(p).filter((function(e){var t=d(e,2);t[0];var r=t[1],n=r.type,i=r.preload;return I.includes(n)&&(null==i||i)})).map((function(e){var t=d(e,2);return[t[0],t[1].type]}))));for(var m=0,v=Object.entries(r.preloadMap.get(f));m<v.length;m++){var g=d(v[m],2),b=g[0],w=g[1],_=t[b],k=n[w];if("string"==typeof _)k.add(_);else if(Array.isArray(_)){var x,T=y(_.flat());try{for(T.s();!(x=T.n()).done;){var j=x.value;"string"==typeof j&&k.add(j)}}catch(e){T.e(e)}finally{T.f()}}}}}({timeline:t}),{images:f(n[e.ParameterType.IMAGE]),audio:f(n[e.ParameterType.AUDIO]),video:f(n[e.ParameterType.VIDEO])}}},{key:"cancelPreloads",value:function(){var e,t=y(this.preload_requests);try{for(t.s();!(e=t.n()).done;){var r=e.value;r.onload=function(){},r.onerror=function(){},r.oncanplaythrough=function(){},r.onabort=function(){}}}catch(e){t.e(e)}finally{t.f()}this.preload_requests=[]}},{key:"initializeMicrophoneRecorder",value:function(e){var t=new MediaRecorder(e);this.microphone_recorder=t}},{key:"getMicrophoneRecorder",value:function(){return this.microphone_recorder}},{key:"initializeCameraRecorder",value:function(e,t){this.camera_stream=e;var r=new MediaRecorder(e,t);this.camera_recorder=r}},{key:"getCameraStream",value:function(){return this.camera_stream}},{key:"getCameraRecorder",value:function(){return this.camera_recorder}}]),t}(),M=function(){function e(){r(this,e)}return i(e,[{key:"dispatchEvent",value:function(e){document.body.dispatchEvent(e)}},{key:"keyDown",value:function(e){this.dispatchEvent(new KeyboardEvent("keydown",{key:e}))}},{key:"keyUp",value:function(e){this.dispatchEvent(new KeyboardEvent("keyup",{key:e}))}},{key:"pressKey",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;r>0?setTimeout((function(){t.keyDown(e),t.keyUp(e)}),r):(this.keyDown(e),this.keyUp(e))}},{key:"clickTarget",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t>0?setTimeout((function(){e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0})),e.dispatchEvent(new MouseEvent("click",{bubbles:!0}))}),t):(e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0})),e.dispatchEvent(new MouseEvent("click",{bubbles:!0})))}},{key:"fillTextInput",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;r>0?setTimeout((function(){e.value=t}),r):e.value=t}},{key:"getValidKey",value:function(e){var t,r=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"," "];if("NO_KEYS"==e)t=null;else if("ALL_KEYS"==e)t=r[Math.floor(Math.random()*r.length)];else{var n=e.flat();t=n[Math.floor(Math.random()*n.length)]}return t}},{key:"mergeSimulationData",value:function(e,t){return Object.assign(Object.assign({},e),null==t?void 0:t.data)}},{key:"ensureSimulationDataConsistency",value:function(e,t){if(t.rt&&(t.rt=Math.round(t.rt)),e.trial_duration&&t.rt&&t.rt>e.trial_duration&&(t.rt=null,t.response&&(t.response=null),t.correct&&(t.correct=!1)),e.choices&&"NO_KEYS"==e.choices&&(t.rt&&(t.rt=null),t.response&&(t.response=null)),e.allow_response_before_complete&&e.sequence_reps&&e.frame_time){var r=e.sequence_reps*e.frame_time*e.stimuli.length;t.rt<r&&(t.rt=null,t.response=null)}}}]),e}(),D=function(){function e(){r(this,e),this.timeout_handlers=[]}return i(e,[{key:"setTimeout",value:function(e,t){var r=window.setTimeout(e,t);return this.timeout_handlers.push(r),r}},{key:"clearAllTimeouts",value:function(){var e,t=y(this.timeout_handlers);try{for(t.s();!(e=t.n()).done;){var r=e.value;clearTimeout(r)}}catch(e){t.e(e)}finally{t.f()}this.timeout_handlers=[]}}]),e}();var R=["ability","able","aboard","about","above","accept","accident","according","account","accurate","acres","across","act","action","active","activity","actual","actually","add","addition","additional","adjective","adult","adventure","advice","affect","afraid","after","afternoon","again","against","age","ago","agree","ahead","aid","air","airplane","alike","alive","all","allow","almost","alone","along","aloud","alphabet","already","also","although","am","among","amount","ancient","angle","angry","animal","announced","another","answer","ants","any","anybody","anyone","anything","anyway","anywhere","apart","apartment","appearance","apple","applied","appropriate","are","area","arm","army","around","arrange","arrangement","arrive","arrow","art","article","as","aside","ask","asleep","at","ate","atmosphere","atom","atomic","attached","attack","attempt","attention","audience","author","automobile","available","average","avoid","aware","away","baby","back","bad","badly","bag","balance","ball","balloon","band","bank","bar","bare","bark","barn","base","baseball","basic","basis","basket","bat","battle","be","bean","bear","beat","beautiful","beauty","became","because","become","becoming","bee","been","before","began","beginning","begun","behavior","behind","being","believed","bell","belong","below","belt","bend","beneath","bent","beside","best","bet","better","between","beyond","bicycle","bigger","biggest","bill","birds","birth","birthday","bit","bite","black","blank","blanket","blew","blind","block","blood","blow","blue","board","boat","body","bone","book","border","born","both","bottle","bottom","bound","bow","bowl","box","boy","brain","branch","brass","brave","bread","break","breakfast","breath","breathe","breathing","breeze","brick","bridge","brief","bright","bring","broad","broke","broken","brother","brought","brown","brush","buffalo","build","building","built","buried","burn","burst","bus","bush","business","busy","but","butter","buy","by","cabin","cage","cake","call","calm","came","camera","camp","can","canal","cannot","cap","capital","captain","captured","car","carbon","card","care","careful","carefully","carried","carry","case","cast","castle","cat","catch","cattle","caught","cause","cave","cell","cent","center","central","century","certain","certainly","chain","chair","chamber","chance","change","changing","chapter","character","characteristic","charge","chart","check","cheese","chemical","chest","chicken","chief","child","children","choice","choose","chose","chosen","church","circle","circus","citizen","city","class","classroom","claws","clay","clean","clear","clearly","climate","climb","clock","close","closely","closer","cloth","clothes","clothing","cloud","club","coach","coal","coast","coat","coffee","cold","collect","college","colony","color","column","combination","combine","come","comfortable","coming","command","common","community","company","compare","compass","complete","completely","complex","composed","composition","compound","concerned","condition","congress","connected","consider","consist","consonant","constantly","construction","contain","continent","continued","contrast","control","conversation","cook","cookies","cool","copper","copy","corn","corner","correct","correctly","cost","cotton","could","count","country","couple","courage","course","court","cover","cow","cowboy","crack","cream","create","creature","crew","crop","cross","crowd","cry","cup","curious","current","curve","customs","cut","cutting","daily","damage","dance","danger","dangerous","dark","darkness","date","daughter","dawn","day","dead","deal","dear","death","decide","declared","deep","deeply","deer","definition","degree","depend","depth","describe","desert","design","desk","detail","determine","develop","development","diagram","diameter","did","die","differ","difference","different","difficult","difficulty","dig","dinner","direct","direction","directly","dirt","dirty","disappear","discover","discovery","discuss","discussion","disease","dish","distance","distant","divide","division","do","doctor","does","dog","doing","doll","dollar","done","donkey","door","dot","double","doubt","down","dozen","draw","drawn","dream","dress","drew","dried","drink","drive","driven","driver","driving","drop","dropped","drove","dry","duck","due","dug","dull","during","dust","duty","each","eager","ear","earlier","early","earn","earth","easier","easily","east","easy","eat","eaten","edge","education","effect","effort","egg","eight","either","electric","electricity","element","elephant","eleven","else","empty","end","enemy","energy","engine","engineer","enjoy","enough","enter","entire","entirely","environment","equal","equally","equator","equipment","escape","especially","essential","establish","even","evening","event","eventually","ever","every","everybody","everyone","everything","everywhere","evidence","exact","exactly","examine","example","excellent","except","exchange","excited","excitement","exciting","exclaimed","exercise","exist","expect","experience","experiment","explain","explanation","explore","express","expression","extra","eye","face","facing","fact","factor","factory","failed","fair","fairly","fall","fallen","familiar","family","famous","far","farm","farmer","farther","fast","fastened","faster","fat","father","favorite","fear","feathers","feature","fed","feed","feel","feet","fell","fellow","felt","fence","few","fewer","field","fierce","fifteen","fifth","fifty","fight","fighting","figure","fill","film","final","finally","find","fine","finest","finger","finish","fire","fireplace","firm","first","fish","five","fix","flag","flame","flat","flew","flies","flight","floating","floor","flow","flower","fly","fog","folks","follow","food","foot","football","for","force","foreign","forest","forget","forgot","forgotten","form","former","fort","forth","forty","forward","fought","found","four","fourth","fox","frame","free","freedom","frequently","fresh","friend","friendly","frighten","frog","from","front","frozen","fruit","fuel","full","fully","fun","function","funny","fur","furniture","further","future","gain","game","garage","garden","gas","gasoline","gate","gather","gave","general","generally","gentle","gently","get","getting","giant","gift","girl","give","given","giving","glad","glass","globe","go","goes","gold","golden","gone","good","goose","got","government","grabbed","grade","gradually","grain","grandfather","grandmother","graph","grass","gravity","gray","great","greater","greatest","greatly","green","grew","ground","group","grow","grown","growth","guard","guess","guide","gulf","gun","habit","had","hair","half","halfway","hall","hand","handle","handsome","hang","happen","happened","happily","happy","harbor","hard","harder","hardly","has","hat","have","having","hay","he","headed","heading","health","heard","hearing","heart","heat","heavy","height","held","hello","help","helpful","her","herd","here","herself","hidden","hide","high","higher","highest","highway","hill","him","himself","his","history","hit","hold","hole","hollow","home","honor","hope","horn","horse","hospital","hot","hour","house","how","however","huge","human","hundred","hung","hungry","hunt","hunter","hurried","hurry","hurt","husband","ice","idea","identity","if","ill","image","imagine","immediately","importance","important","impossible","improve","in","inch","include","including","income","increase","indeed","independent","indicate","individual","industrial","industry","influence","information","inside","instance","instant","instead","instrument","interest","interior","into","introduced","invented","involved","iron","is","island","it","its","itself","jack","jar","jet","job","join","joined","journey","joy","judge","jump","jungle","just","keep","kept","key","kids","kill","kind","kitchen","knew","knife","know","knowledge","known","label","labor","lack","lady","laid","lake","lamp","land","language","large","larger","largest","last","late","later","laugh","law","lay","layers","lead","leader","leaf","learn","least","leather","leave","leaving","led","left","leg","length","lesson","let","letter","level","library","lie","life","lift","light","like","likely","limited","line","lion","lips","liquid","list","listen","little","live","living","load","local","locate","location","log","lonely","long","longer","look","loose","lose","loss","lost","lot","loud","love","lovely","low","lower","luck","lucky","lunch","lungs","lying","machine","machinery","mad","made","magic","magnet","mail","main","mainly","major","make","making","man","managed","manner","manufacturing","many","map","mark","market","married","mass","massage","master","material","mathematics","matter","may","maybe","me","meal","mean","means","meant","measure","meat","medicine","meet","melted","member","memory","men","mental","merely","met","metal","method","mice","middle","might","mighty","mile","military","milk","mill","mind","mine","minerals","minute","mirror","missing","mission","mistake","mix","mixture","model","modern","molecular","moment","money","monkey","month","mood","moon","more","morning","most","mostly","mother","motion","motor","mountain","mouse","mouth","move","movement","movie","moving","mud","muscle","music","musical","must","my","myself","mysterious","nails","name","nation","national","native","natural","naturally","nature","near","nearby","nearer","nearest","nearly","necessary","neck","needed","needle","needs","negative","neighbor","neighborhood","nervous","nest","never","new","news","newspaper","next","nice","night","nine","no","nobody","nodded","noise","none","noon","nor","north","nose","not","note","noted","nothing","notice","noun","now","number","numeral","nuts","object","observe","obtain","occasionally","occur","ocean","of","off","offer","office","officer","official","oil","old","older","oldest","on","once","one","only","onto","open","operation","opinion","opportunity","opposite","or","orange","orbit","order","ordinary","organization","organized","origin","original","other","ought","our","ourselves","out","outer","outline","outside","over","own","owner","oxygen","pack","package","page","paid","pain","paint","pair","palace","pale","pan","paper","paragraph","parallel","parent","park","part","particles","particular","particularly","partly","parts","party","pass","passage","past","path","pattern","pay","peace","pen","pencil","people","per","percent","perfect","perfectly","perhaps","period","person","personal","pet","phrase","physical","piano","pick","picture","pictured","pie","piece","pig","pile","pilot","pine","pink","pipe","pitch","place","plain","plan","plane","planet","planned","planning","plant","plastic","plate","plates","play","pleasant","please","pleasure","plenty","plural","plus","pocket","poem","poet","poetry","point","pole","police","policeman","political","pond","pony","pool","poor","popular","population","porch","port","position","positive","possible","possibly","post","pot","potatoes","pound","pour","powder","power","powerful","practical","practice","prepare","present","president","press","pressure","pretty","prevent","previous","price","pride","primitive","principal","principle","printed","private","prize","probably","problem","process","produce","product","production","program","progress","promised","proper","properly","property","protection","proud","prove","provide","public","pull","pupil","pure","purple","purpose","push","put","putting","quarter","queen","question","quick","quickly","quiet","quietly","quite","rabbit","race","radio","railroad","rain","raise","ran","ranch","range","rapidly","rate","rather","raw","rays","reach","read","reader","ready","real","realize","rear","reason","recall","receive","recent","recently","recognize","record","red","refer","refused","region","regular","related","relationship","religious","remain","remarkable","remember","remove","repeat","replace","replied","report","represent","require","research","respect","rest","result","return","review","rhyme","rhythm","rice","rich","ride","riding","right","ring","rise","rising","river","road","roar","rock","rocket","rocky","rod","roll","roof","room","root","rope","rose","rough","round","route","row","rubbed","rubber","rule","ruler","run","running","rush","sad","saddle","safe","safety","said","sail","sale","salmon","salt","same","sand","sang","sat","satellites","satisfied","save","saved","saw","say","scale","scared","scene","school","science","scientific","scientist","score","screen","sea","search","season","seat","second","secret","section","see","seed","seeing","seems","seen","seldom","select","selection","sell","send","sense","sent","sentence","separate","series","serious","serve","service","sets","setting","settle","settlers","seven","several","shade","shadow","shake","shaking","shall","shallow","shape","share","sharp","she","sheep","sheet","shelf","shells","shelter","shine","shinning","ship","shirt","shoe","shoot","shop","shore","short","shorter","shot","should","shoulder","shout","show","shown","shut","sick","sides","sight","sign","signal","silence","silent","silk","silly","silver","similar","simple","simplest","simply","since","sing","single","sink","sister","sit","sitting","situation","six","size","skill","skin","sky","slabs","slave","sleep","slept","slide","slight","slightly","slip","slipped","slope","slow","slowly","small","smaller","smallest","smell","smile","smoke","smooth","snake","snow","so","soap","social","society","soft","softly","soil","solar","sold","soldier","solid","solution","solve","some","somebody","somehow","someone","something","sometime","somewhere","son","song","soon","sort","sound","source","south","southern","space","speak","special","species","specific","speech","speed","spell","spend","spent","spider","spin","spirit","spite","split","spoken","sport","spread","spring","square","stage","stairs","stand","standard","star","stared","start","state","statement","station","stay","steady","steam","steel","steep","stems","step","stepped","stick","stiff","still","stock","stomach","stone","stood","stop","stopped","store","storm","story","stove","straight","strange","stranger","straw","stream","street","strength","stretch","strike","string","strip","strong","stronger","struck","structure","struggle","stuck","student","studied","studying","subject","substance","success","successful","such","sudden","suddenly","sugar","suggest","suit","sum","summer","sun","sunlight","supper","supply","support","suppose","sure","surface","surprise","surrounded","swam","sweet","swept","swim","swimming","swing","swung","syllable","symbol","system","table","tail","take","taken","tales","talk","tall","tank","tape","task","taste","taught","tax","tea","teach","teacher","team","tears","teeth","telephone","television","tell","temperature","ten","tent","term","terrible","test","than","thank","that","thee","them","themselves","then","theory","there","therefore","these","they","thick","thin","thing","think","third","thirty","this","those","thou","though","thought","thousand","thread","three","threw","throat","through","throughout","throw","thrown","thumb","thus","thy","tide","tie","tight","tightly","till","time","tin","tiny","tip","tired","title","to","tobacco","today","together","told","tomorrow","tone","tongue","tonight","too","took","tool","top","topic","torn","total","touch","toward","tower","town","toy","trace","track","trade","traffic","trail","train","transportation","trap","travel","treated","tree","triangle","tribe","trick","tried","trip","troops","tropical","trouble","truck","trunk","truth","try","tube","tune","turn","twelve","twenty","twice","two","type","typical","uncle","under","underline","understanding","unhappy","union","unit","universe","unknown","unless","until","unusual","up","upon","upper","upward","us","use","useful","using","usual","usually","valley","valuable","value","vapor","variety","various","vast","vegetable","verb","vertical","very","vessels","victory","view","village","visit","visitor","voice","volume","vote","vowel","voyage","wagon","wait","walk","wall","want","war","warm","warn","was","wash","waste","watch","water","wave","way","we","weak","wealth","wear","weather","week","weigh","weight","welcome","well","went","were","west","western","wet","whale","what","whatever","wheat","wheel","when","whenever","where","wherever","whether","which","while","whispered","whistle","white","who","whole","whom","whose","why","wide","widely","wife","wild","will","willing","win","wind","window","wing","winter","wire","wise","wish","with","within","without","wolf","women","won","wonder","wonderful","wood","wooden","wool","word","wore","work","worker","world","worried","worry","worse","worth","would","wrapped","write","writer","writing","written","wrong","wrote","yard","year","yellow","yes","yesterday","yet","you","young","younger","your","yourself","youth","zero","zebra","zipper","zoo","zulu"];function C(e){function t(){return e&&e.maxLength>1?function(){var t,n=!1;for(;!n;)(t=r()).length<=e.maxLength&&(n=!0);return t}():r()}function r(){return R[n(R.length)]}function n(e){return Math.floor(Math.random()*e)}if(void 0===e)return t();"number"==typeof e&&(e={exactly:e}),e.exactly&&(e.min=e.exactly,e.max=e.exactly),"number"!=typeof e.wordsPerString&&(e.wordsPerString=1),"function"!=typeof e.formatter&&(e.formatter=function(e){return e}),"string"!=typeof e.separator&&(e.separator=" ");for(var i=e.min+n(e.max+1-e.min),a=[],o="",s=0,l=0;l<i*e.wordsPerString;l++)s===e.wordsPerString-1?o+=e.formatter(t(),s):o+=e.formatter(t(),s)+e.separator,s++,(l+1)%e.wordsPerString==0&&(a.push(o),o="",s=0);return"string"==typeof e.join&&(a=a.join(e.join)),a}var N=C;C.wordList=R;var V={exports:{}};(function(e,r,n){function i(e){var t,r=this,n=(t=4022871197,function(e){e=String(e);for(var r=0;r<e.length;r++){var n=.02519603282416938*(t+=e.charCodeAt(r));n-=t=n>>>0,t=(n*=t)>>>0,t+=4294967296*(n-=t)}return 2.3283064365386963e-10*(t>>>0)});r.next=function(){var e=2091639*r.s0+2.3283064365386963e-10*r.c;return r.s0=r.s1,r.s1=r.s2,r.s2=e-(r.c=0|e)},r.c=1,r.s0=n(" "),r.s1=n(" "),r.s2=n(" "),r.s0-=n(e),r.s0<0&&(r.s0+=1),r.s1-=n(e),r.s1<0&&(r.s1+=1),r.s2-=n(e),r.s2<0&&(r.s2+=1),n=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function o(e,r){var n=new i(e),o=r&&r.state,s=n.next;return s.int32=function(){return 4294967296*n.next()|0},s.double=function(){return s()+11102230246251565e-32*(2097152*s()|0)},s.quick=s,o&&("object"==t(o)&&a(o,n),s.state=function(){return a(n,{})}),s}r&&r.exports?r.exports=o:n&&n.amd?n((function(){return o})):this.alea=o})(0,V,!1);var q=V.exports;function z(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=Array.isArray(e),a=Array.isArray(r);if(i)if(a){if(e.length!=r.length)if(console.warn("Unclear parameters given to randomization.repeat. Items and repetitions are unequal lengths. Behavior may not be as expected."),r.length<e.length){for(var o=[],s=0;s<e.length;s++)o.push(r);r=o}else r=r.slice(0,e.length)}else{for(var l=[],u=0;u<e.length;u++)l.push(r);r=l}else a?(r=[r[0]],console.log("Unclear parameters given to randomization.repeat. Multiple set sizes specified, but only one item exists to sample. Proceeding using the first set size.")):(e=[e],r=[r]);for(var c=[],h=0;h<e.length;h++)for(var d=0;d<r[h];d++)null==e[h]||"object"!=t(e[h])?c.push(e[h]):c.push(Object.assign({},e[h]));var f=K(c);return n&&(f=W(f)),f}function K(e){Array.isArray(e)||console.error("Argument to shuffle() must be an array.");for(var t,r,n=e.slice(0),i=n.length;i;)r=Math.floor(Math.random()*i--),t=n[i],n[i]=n[r],n[r]=t;return n}function F(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.length;if(1==r)return console.warn("shuffleAlternateGroups() was called with only one group. Defaulting to simple shuffle."),K(e[0]);for(var n=[],i=0;i<r;i++)n.push(i);t&&(n=K(n));for(var a=[],o=null,s=0;s<r;s++)o=null===o?e[s].length:Math.min(o,e[s].length),a.push(K(e[s]));for(var l=[],u=0;u<o;u++)for(var c=0;c<n.length;c++)l.push(a[n[c]][u]);return l}function U(e,t){return Array.isArray(e)||console.error("First argument to sampleWithoutReplacement() must be an array"),t>e.length&&console.error("Cannot take a sample larger than the size of the set of items to sample."),K(e).slice(0,t)}function Y(e,t,r){Array.isArray(e)||console.error("First argument to sampleWithReplacement() must be an array");var n=[];if(void 0!==r){r.length!==e.length&&console.error("The length of the weights array must equal the length of the array to be sampled from.");var i,a=0,o=y(r);try{for(o.s();!(i=o.n()).done;){a+=i.value}}catch(e){o.e(e)}finally{o.f()}var s,l=y(r);try{for(l.s();!(s=l.n()).done;){var u=s.value;n.push(u/a)}}catch(e){l.e(e)}finally{l.f()}}else for(var c=0;c<e.length;c++)n.push(1/e.length);for(var h=[n[0]],d=1;d<n.length;d++)h.push(n[d]+h[d-1]);for(var f=[],p=0;p<t;p++){for(var m=Math.random(),v=0;m>h[v];)v++;f.push(e[v])}return f}function B(e,t){return function(){var e=0,t=0;for(;0===e;)e=Math.random();for(;0===t;)t=Math.random();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*t)}()*t+e}function G(e){return-Math.log(Math.random())/e}function W(e){var t,r={},n=y(e);try{for(n.s();!(t=n.n()).done;)for(var i=t.value,a=0,o=Object.keys(i);a<o.length;a++){var s=o[a];void 0===r[s]&&(r[s]=[]),r[s].push(i[s])}}catch(e){n.e(e)}finally{n.f()}return r}var J=Object.freeze({__proto__:null,setSeed:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Math.random().toString();return Math.random=q(e),e},repeat:z,shuffle:K,shuffleNoRepeats:function(e,t){Array.isArray(e)||console.error("First argument to shuffleNoRepeats() must be an array."),void 0!==t&&"function"!=typeof t&&console.error("Second argument to shuffleNoRepeats() must be a function."),void 0===t&&(t=function(e,t){return e===t});for(var r=K(e),n=0;n<r.length-1;n++)if(t(r[n],r[n+1])){for(var i=Math.floor(Math.random()*(r.length-2))+1;t(r[n+1],r[i])||t(r[n+1],r[i+1])||t(r[n+1],r[i-1])||t(r[n],r[i]);)i=Math.floor(Math.random()*(r.length-2))+1;var a=r[i];r[i]=r[n+1],r[n+1]=a}return r},shuffleAlternateGroups:F,sampleWithoutReplacement:U,sampleWithReplacement:Y,factorial:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=[{}],i=0,o=Object.entries(e);i<o.length;i++){var s,l=d(o[i],2),u=l[0],c=l[1],h=[],f=y(c);try{for(f.s();!(s=f.n()).done;){var p,m=s.value,v=y(n);try{for(v.s();!(p=v.n()).done;){var g=p.value;h.push(Object.assign(Object.assign({},g),a({},u,m)))}}catch(e){v.e(e)}finally{v.f()}}}catch(e){f.e(e)}finally{f.f()}n=h}return z(n,t,r)},randomID:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32,t="",r="0123456789abcdefghjklmnopqrstuvwxyz",n=0;n<e;n++)t+=r[Math.floor(Math.random()*r.length)];return t},randomInt:function(e,t){if(t<e)throw new Error("Upper boundary must be less than or equal to lower boundary");return e+Math.floor(Math.random()*(t-e+1))},sampleBernoulli:function(e){return Math.random()<=e?1:0},sampleNormal:B,sampleExponential:G,sampleExGaussian:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=B(e,t)+G(r);if(n)for(;i<=0;)i=B(e,t)+G(r);return i},randomWords:function(e){return N(e)}});function H(){var e={previewMode:!1,outsideTurk:!1,hitId:"INVALID_URL_PARAMETER",assignmentId:"INVALID_URL_PARAMETER",workerId:"INVALID_URL_PARAMETER",turkSubmitTo:"INVALID_URL_PARAMETER"},t=function(e,t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var r=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null==r?"":r[1]},r=t(window.location.href,"assignmentId")?window.location.href:document.referrer;return["assignmentId","hitId","workerId","turkSubmitTo"].map((function(n){e[n]=unescape(t(r,n))})),e.previewMode="ASSIGNMENT_ID_NOT_AVAILABLE"==e.assignmentId,e.outsideTurk=!e.previewMode&&""===e.hitId&&""==e.assignmentId&&""==e.workerId,e}var X=Object.freeze({__proto__:null,turkInfo:H,submitToTurk:function(e){var t=H(),r=t.assignmentId,n=t.turkSubmitTo;if(r&&n){var i=document.createElement("form");for(var a in i.method="POST",i.action=n+"/mturk/externalSubmit?assignmentId="+r,e)if(e.hasOwnProperty(a)){var o=document.createElement("input");o.type="hidden",o.name=a,o.id=a,o.value=e[a],i.appendChild(o)}document.body.appendChild(i),i.submit()}}}),$=function(){function e(n,i,a,o){if(r(this,e),this.jsPsych=n,this.progress={current_location:-1,current_variable_set:0,current_repetition:0,current_iteration:0,done:!1},this.parent_node=a,this.relative_id=void 0===a?0:o,void 0!==i.timeline){this.timeline_parameters={timeline:[],loop_function:i.loop_function,conditional_function:i.conditional_function,sample:i.sample,randomize_order:void 0!==i.randomize_order&&i.randomize_order,repetitions:void 0===i.repetitions?1:i.repetitions,timeline_variables:void 0===i.timeline_variables?[{}]:i.timeline_variables,on_timeline_finish:i.on_timeline_finish,on_timeline_start:i.on_timeline_start},this.setTimelineVariablesOrder();var s=Object.assign({},i);delete s.timeline,delete s.conditional_function,delete s.loop_function,delete s.randomize_order,delete s.repetitions,delete s.timeline_variables,delete s.sample,delete s.on_timeline_start,delete s.on_timeline_finish,this.node_trial_data=s;for(var l=0;l<i.timeline.length;l++){var u=Object.assign({},s,i.timeline[l]);if("object"==t(s.data)&&"object"==t(i.timeline[l].data)){var c=Object.assign({},s.data,i.timeline[l].data);u.data=c}this.timeline_parameters.timeline.push(new e(this.jsPsych,u,this,l))}}else void 0===i.type&&console.error('Trial level node is missing the "type" parameter. The parameters for the node are: '+JSON.stringify(i)),this.trial_parameters=Object.assign({},i)}return i(e,[{key:"trial",value:function(){return void 0===this.timeline_parameters?k(this.trial_parameters):this.progress.current_location>=this.timeline_parameters.timeline.length?null:this.timeline_parameters.timeline[this.progress.current_location].trial()}},{key:"markCurrentTrialComplete",value:function(){void 0===this.timeline_parameters?this.progress.done=!0:this.timeline_parameters.timeline[this.progress.current_location].markCurrentTrialComplete()}},{key:"nextRepetiton",value:function(){this.setTimelineVariablesOrder(),this.progress.current_location=-1,this.progress.current_variable_set=0,this.progress.current_repetition++;for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}},{key:"setTimelineVariablesOrder",value:function(){var e=this.timeline_parameters;if(void 0!==e&&void 0!==e.timeline_variables){for(var t=[],r=0;r<e.timeline_variables.length;r++)t.push(r);void 0!==e.sample&&("custom"==e.sample.type?t=e.sample.fn(t):"with-replacement"==e.sample.type?t=Y(t,e.sample.size,e.sample.weights):"without-replacement"==e.sample.type?t=U(t,e.sample.size):"fixed-repetitions"==e.sample.type?t=z(t,e.sample.size,!1):"alternate-groups"==e.sample.type?t=F(e.sample.groups,e.sample.randomize_group_order):console.error('Invalid type in timeline sample parameters. Valid options for type are "custom", "with-replacement", "without-replacement", "fixed-repetitions", and "alternate-groups"')),e.randomize_order&&(t=K(t)),this.progress.order=t}}},{key:"nextSet",value:function(){this.progress.current_location=-1,this.progress.current_variable_set++;for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}},{key:"advance",value:function(){var e=this.progress,t=this.timeline_parameters,r=this.jsPsych.internal;if(e.done)return!0;if(-1==e.current_location){if(void 0!==t){if(void 0!==t.conditional_function&&0==e.current_repetition&&0==e.current_variable_set){r.call_immediate=!0;var n=t.conditional_function();if(r.call_immediate=!1,0==n)return e.done=!0,!0}void 0!==t.on_timeline_start&&0==e.current_variable_set&&t.on_timeline_start()}return e.current_location=0,this.advance()}if(void 0!==t){for(var i=!1;e.current_location<t.timeline.length&&0==i;){if(!t.timeline[e.current_location].advance())return i=!0,!1;e.current_location++}return e.current_variable_set<e.order.length-1?(this.nextSet(),this.advance()):e.current_repetition<t.repetitions-1?(this.nextRepetiton(),void 0!==t.on_timeline_finish&&t.on_timeline_finish(),this.advance()):(void 0!==t.on_timeline_finish&&t.on_timeline_finish(),void 0!==t.loop_function?(r.call_immediate=!0,t.loop_function(this.generatedData())?(this.reset(),r.call_immediate=!1,this.parent_node.advance()):(e.done=!0,r.call_immediate=!1,!0)):(e.done=!0,!0))}}},{key:"isComplete",value:function(){return this.progress.done}},{key:"getTimelineVariableValue",value:function(e){if(void 0!==this.timeline_parameters)return this.timeline_parameters.timeline_variables[this.progress.order[this.progress.current_variable_set]][e]}},{key:"findTimelineVariable",value:function(e){var t=this.getTimelineVariableValue(e);return void 0===t?void 0!==this.parent_node?this.parent_node.findTimelineVariable(e):void 0:t}},{key:"timelineVariable",value:function(e){if(void 0===this.timeline_parameters){var t=this.findTimelineVariable(e);return void 0===t&&console.warn("Timeline variable "+e+" not found."),t}var r=Math.max(0,this.progress.current_location);r==this.timeline_parameters.timeline.length&&(r-=1);var n=this.timeline_parameters.timeline[r].timelineVariable(e);return void 0===n&&console.warn("Timeline variable "+e+" not found."),n}},{key:"allTimelineVariables",value:function(){for(var e=this.allTimelineVariablesNames(),t={},r=0;r<e.length;r++)t[e[r]]=this.timelineVariable(e[r]);return t}},{key:"allTimelineVariablesNames",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(void 0!==this.timeline_parameters){e=e.concat(Object.keys(this.timeline_parameters.timeline_variables[this.progress.order[this.progress.current_variable_set]]));var t=Math.max(0,this.progress.current_location);return t==this.timeline_parameters.timeline.length&&(t-=1),this.timeline_parameters.timeline[t].allTimelineVariablesNames(e)}if(void 0===this.timeline_parameters)return e}},{key:"length",value:function(){var e=0;if(void 0===this.timeline_parameters)return 1;for(var t=0;t<this.timeline_parameters.timeline.length;t++)e+=this.timeline_parameters.timeline[t].length();return e}},{key:"percentComplete",value:function(){for(var e=this.length(),t=0,r=0;r<this.timeline_parameters.timeline.length;r++)this.timeline_parameters.timeline[r].isComplete()&&(t+=this.timeline_parameters.timeline[r].length());return t/e*100}},{key:"reset",value:function(){if(this.progress.current_location=-1,this.progress.current_repetition=0,this.progress.current_variable_set=0,this.progress.current_iteration++,this.progress.done=!1,this.setTimelineVariablesOrder(),void 0!==this.timeline_parameters)for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}},{key:"end",value:function(){this.progress.done=!0}},{key:"endActiveNode",value:function(){void 0===this.timeline_parameters?(this.end(),this.parent_node.end()):this.timeline_parameters.timeline[this.progress.current_location].endActiveNode()}},{key:"ID",value:function(){var e="";return void 0===this.parent_node?"0."+this.progress.current_iteration:(e+=this.parent_node.ID()+"-",e+=this.relative_id+"."+this.progress.current_iteration)}},{key:"activeID",value:function(){return void 0===this.timeline_parameters?this.ID():this.timeline_parameters.timeline[this.progress.current_location].activeID()}},{key:"generatedData",value:function(){return this.jsPsych.data.getDataByTimelineNode(this.ID())}},{key:"trialsOfType",value:function(e){if(void 0===this.timeline_parameters)return this.trial_parameters.type==e?this.trial_parameters:[];for(var t=[],r=0;r<this.timeline_parameters.timeline.length;r++){var n=this.timeline_parameters.timeline[r].trialsOfType(e);t=t.concat(n)}return t}},{key:"insert",value:function(t){void 0===this.timeline_parameters?console.error("Cannot add new trials to a trial-level node."):this.timeline_parameters.timeline.push(new e(this.jsPsych,Object.assign(Object.assign({},this.node_trial_data),t),this,this.timeline_parameters.timeline.length))}}]),e}();function Q(e){return new Promise((function(t){return setTimeout(t,e)}))}var Z=function(){function n(e){var t,i;r(this,n),this.extensions={},this.turk=X,this.randomization=J,this.utils=x,this.opts={},this.global_trial_index=0,this.current_trial={},this.current_trial_finished=!1,this.paused=!1,this.waiting=!1,this.file_protocol=!1,this.simulation_mode=null,this.webaudio_context=null,this.internal={call_immediate:!1},this.progress_bar_amount=0,e=Object.assign({display_element:void 0,on_finish:function(){},on_trial_start:function(){},on_trial_finish:function(){},on_data_update:function(){},on_interaction_data_update:function(){},on_close:function(){},use_webaudio:!0,exclusions:{},show_progress_bar:!1,message_progress_bar:"Completion Progress",auto_update_progress_bar:!0,default_iti:0,minimum_valid_rt:0,experiment_width:null,override_safe_mode:!1,case_sensitive_responses:!1,extensions:[]},e),this.opts=e,b(this),this.webaudio_context="undefined"!=typeof window&&void 0!==window.AudioContext?new AudioContext:null,"file:"!=window.location.protocol||!1!==e.override_safe_mode&&void 0!==e.override_safe_mode||(e.use_webaudio=!1,this.file_protocol=!0,console.warn("jsPsych detected that it is running via the file:// protocol and not on a web server. To prevent issues with cross-origin requests, Web Audio and video preloading have been disabled. If you would like to override this setting, you can set 'override_safe_mode' to 'true' in initJsPsych. For more information, see: https://www.jspsych.org/overview/running-experiments")),this.data=new E(this),this.pluginAPI=(i=(t=this).getInitSettings(),Object.assign.apply(Object,[{}].concat(f([new L(t.getDisplayContainerElement,i.case_sensitive_responses,i.minimum_valid_rt),new D,new S(i.use_webaudio,t.webaudio_context),new O,new M].map((function(e){return b(e)}))))));var a,o=y(e.extensions);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.extensions[s.type.info.name]=new s.type(this)}}catch(e){o.e(e)}finally{o.f()}this.pluginAPI.initAudio()}return i(n,[{key:"version",value:function(){return"7.3.2"}},{key:"run",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&console.error("No timeline declared in jsPsych.run. Cannot start experiment."),0===e.length&&console.error("No trials have been added to the timeline (the timeline is an empty array). Cannot start experiment."),this.timelineDescription=e,this.timeline=new $(this,{timeline:e}),t.next=6,this.prepareDom();case 6:return t.next=8,this.checkExclusions(this.opts.exclusions);case 8:return t.next=10,this.loadExtensions(this.opts.extensions);case 10:return document.documentElement.setAttribute("jspsych","present"),this.startExperiment(),t.next=14,this.finished;case 14:case"end":return t.stop()}}),t,this)})))}},{key:"simulate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"data-only",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return v(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.simulation_mode=t,this.simulation_options=r,n.next=4,this.run(e);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"getProgress",value:function(){return{total_trials:void 0===this.timeline?void 0:this.timeline.length(),current_trial_global:this.global_trial_index,percent_complete:void 0===this.timeline?0:this.timeline.percentComplete()}}},{key:"getStartTime",value:function(){return this.exp_start_time}},{key:"getTotalTime",value:function(){return void 0===this.exp_start_time?0:(new Date).getTime()-this.exp_start_time.getTime()}},{key:"getDisplayElement",value:function(){return this.DOM_target}},{key:"getDisplayContainerElement",value:function(){return this.DOM_container}},{key:"finishTrial",value:function(){var e,r=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.current_trial_finished){var i;if(this.current_trial_finished=!0,void 0!==this.current_trial.css_classes&&Array.isArray(this.current_trial.css_classes))(i=this.DOM_target.classList).remove.apply(i,f(this.current_trial.css_classes));this.data.write(n);var a=this.data.getLastTrialData(),o=a.values()[0],s=this.current_trial;if("object"===t(s.save_trial_parameters))for(var l=0,u=Object.keys(s.save_trial_parameters);l<u.length;l++){var c=u[l],h=s.save_trial_parameters[c];!0===h&&(void 0===s[c]?console.warn('Invalid parameter specified in save_trial_parameters. Trial has no property called "'.concat(c,'".')):"function"==typeof s[c]?o[c]=s[c].toString():o[c]=s[c]),!1===h&&"internal_node_id"!==c&&"trial_index"!==c&&delete o[c]}var d=(null!==(e=s.extensions)&&void 0!==e?e:[]).map((function(e){return r.extensions[e.type.info.name].on_finish(e.params)})),p=function(){r.internal.call_immediate=!0,"function"==typeof s.on_finish&&s.on_finish(o),r.opts.on_trial_finish(o),r.opts.on_data_update(o),r.internal.call_immediate=!1,"data-only"===r.simulation_mode?r.nextTrial():null===typeof s.post_trial_gap||void 0===s.post_trial_gap?r.opts.default_iti>0?setTimeout(r.nextTrial,r.opts.default_iti):r.nextTrial():s.post_trial_gap>0?setTimeout(r.nextTrial,s.post_trial_gap):r.nextTrial()};if(d.some((function(e){return"function"==typeof e.then})))Promise.all(d.map((function(e){return Promise.resolve(e).then((function(e){Object.assign(o,e)}))}))).then(p);else{var m,v=y(d);try{for(v.s();!(m=v.n()).done;){var g=m.value;Object.assign(o,g)}}catch(e){v.e(e)}finally{v.f()}p()}}}},{key:"endExperiment",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.timeline.end_message=e,this.timeline.end(),this.pluginAPI.cancelAllKeyboardResponses(),this.pluginAPI.clearAllTimeouts(),this.finishTrial(t)}},{key:"endCurrentTimeline",value:function(){this.timeline.endActiveNode()}},{key:"getCurrentTrial",value:function(){return this.current_trial}},{key:"getInitSettings",value:function(){return this.opts}},{key:"getCurrentTimelineNodeID",value:function(){return this.timeline.activeID()}},{key:"timelineVariable",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.internal.call_immediate||!0===r?this.timeline.timelineVariable(e):{timelineVariablePlaceholder:!0,timelineVariableFunction:function(){return t.timeline.timelineVariable(e)}}}},{key:"getAllTimelineVariables",value:function(){return this.timeline.allTimelineVariables()}},{key:"addNodeToEndOfTimeline",value:function(e,t){this.timeline.insert(e)}},{key:"pauseExperiment",value:function(){this.paused=!0}},{key:"resumeExperiment",value:function(){this.paused=!1,this.waiting&&(this.waiting=!1,this.nextTrial())}},{key:"loadFail",value:function(e){e=e||"<p>The experiment failed to load.</p>",this.DOM_target.innerHTML=e}},{key:"getSafeModeStatus",value:function(){return this.file_protocol}},{key:"getTimeline",value:function(){return this.timelineDescription}},{key:"prepareDom",value:function(){return v(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("complete"===document.readyState){e.next=3;break}return e.next=3,new Promise((function(e){window.addEventListener("load",e)}));case 3:void 0===(t=this.opts).display_element?(null===document.querySelector("body")&&document.documentElement.appendChild(document.createElement("body")),document.querySelector("html").style.height="100%",document.querySelector("body").style.margin="0px",document.querySelector("body").style.height="100%",document.querySelector("body").style.width="100%",t.display_element=document.querySelector("body")):null===(r=t.display_element instanceof Element?t.display_element:document.querySelector("#"+t.display_element))?console.error("The display_element specified in initJsPsych() does not exist in the DOM."):t.display_element=r,t.display_element.innerHTML='<div class="jspsych-content-wrapper"><div id="jspsych-content"></div></div>',this.DOM_container=t.display_element,this.DOM_target=document.querySelector("#jspsych-content"),null!==t.experiment_width&&(this.DOM_target.style.width=t.experiment_width+"px"),t.display_element.tabIndex=0,-1===t.display_element.className.indexOf("jspsych-display-element")&&(t.display_element.className+=" jspsych-display-element"),this.DOM_target.className+="jspsych-content",this.data.createInteractionListeners(),window.addEventListener("beforeunload",t.on_close);case 14:case"end":return e.stop()}}),e,this)})))}},{key:"loadExtensions",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Promise.all(e.map((function(e){return r.extensions[e.type.info.name].initialize(e.params||{})})));case 3:t.next=9;break;case 5:throw t.prev=5,t.t0=t.catch(0),console.error(t.t0),new Error(t.t0);case 9:case"end":return t.stop()}}),t,null,[[0,5]])})))}},{key:"startExperiment",value:function(){var e=this;this.finished=new Promise((function(t){e.resolveFinishedPromise=t})),!0===this.opts.show_progress_bar&&this.drawProgressBar(this.opts.message_progress_bar),this.exp_start_time=new Date,this.timeline.advance(),this.doTrial(this.timeline.trial())}},{key:"finishExperiment",value:function(){var e=this,t=this.opts.on_finish(this.data.get()),r=function(){void 0!==e.timeline.end_message&&(e.DOM_target.innerHTML=e.timeline.end_message),e.resolveFinishedPromise()};t?Promise.resolve(t).then(r):r()}},{key:"nextTrial",value:function(){if(this.paused)this.waiting=!0;else{this.global_trial_index++,this.timeline.markCurrentTrialComplete();var e=this.timeline.advance();!0===this.opts.show_progress_bar&&!0===this.opts.auto_update_progress_bar&&this.updateProgressBar(),e?this.finishExperiment():this.doTrial(this.timeline.trial())}}},{key:"doTrial",value:function(e){var t,r=this;if(this.current_trial=e,this.current_trial_finished=!1,this.evaluateTimelineVariables(e),"string"==typeof e.type)throw new w("A string was provided as the trial's `type` parameter. Since jsPsych v7, the `type` parameter needs to be a plugin object.");if(e.type=Object.assign(Object.assign({},b(new e.type(this))),{info:e.type.info}),this.evaluateFunctionParameters(e),this.setDefaultValues(e),this.internal.call_immediate=!0,this.opts.on_trial_start(e),"function"==typeof e.on_start&&e.on_start(e),Array.isArray(e.extensions)){var n,i=y(e.extensions);try{for(i.s();!(n=i.n()).done;){var a=n.value;this.extensions[a.type.info.name].on_start(a.params)}}catch(e){i.e(e)}finally{i.f()}}(this.DOM_container.focus(),this.DOM_target.scrollTop=0,void 0!==e.css_classes)&&(Array.isArray(e.css_classes)||"string"!=typeof e.css_classes||(e.css_classes=[e.css_classes]),Array.isArray(e.css_classes)&&(t=this.DOM_target.classList).add.apply(t,f(e.css_classes)));var o,s,l=function(){if("function"==typeof e.on_load&&e.on_load(),Array.isArray(e.extensions)){var t,n=y(e.extensions);try{for(n.s();!(t=n.n()).done;){var i=t.value;r.extensions[i.type.info.name].on_load(i.params)}}catch(e){n.e(e)}finally{n.f()}}};(this.simulation_mode||(o=e.type.trial(this.DOM_target,e,l)),this.simulation_mode)&&(e.type.simulate?(e.simulation_options||(s=this.simulation_options.default),e.simulation_options&&("string"==typeof e.simulation_options?this.simulation_options[e.simulation_options]?s=this.simulation_options[e.simulation_options]:this.simulation_options.default?(console.log('No matching simulation options found for "'.concat(e.simulation_options,'". Using "default" options.')),s=this.simulation_options.default):(console.log('No matching simulation options found for "'.concat(e.simulation_options,'" and no "default" options provided. Using the default values provided by the plugin.')),s={}):s=e.simulation_options),s=this.utils.deepCopy(s),o=!1===(null==(s=this.replaceFunctionsWithValues(s,null))?void 0:s.simulate)?e.type.trial(this.DOM_target,e,l):e.type.simulate(e,(null==s?void 0:s.mode)||this.simulation_mode,s,l)):o=e.type.trial(this.DOM_target,e,l));o&&"function"==typeof o.then||this.simulation_mode||l(),this.internal.call_immediate=!1}},{key:"evaluateTimelineVariables",value:function(e){for(var r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];"object"===t(e[i])&&null!==e[i]&&void 0!==e[i].timelineVariablePlaceholder&&(e[i]=e[i].timelineVariableFunction()),"object"===t(e[i])&&null!==e[i]&&"timeline"!==i&&"timeline_variables"!==i&&this.evaluateTimelineVariables(e[i])}}},{key:"evaluateFunctionParameters",value:function(t){this.internal.call_immediate=!0;for(var r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];"type"!==i&&(void 0!==A[i]&&A[i].type!==e.ParameterType.FUNCTION&&(t[i]=this.replaceFunctionsWithValues(t[i],null)),void 0!==t.type.info.parameters[i]&&t.type.info.parameters[i].type!==e.ParameterType.FUNCTION&&(t[i]=this.replaceFunctionsWithValues(t[i],t.type.info.parameters[i])))}this.internal.call_immediate=!1}},{key:"replaceFunctionsWithValues",value:function(r,n){if(null===r)return r;if(Array.isArray(r))for(var i=0;i<r.length;i++)r[i]=this.replaceFunctionsWithValues(r[i],n);else if("object"===t(r))if(null!==n&&n.nested)for(var a=0,o=Object.keys(r);a<o.length;a++){var s=o[a];"object"===t(n.nested[s])&&n.nested[s].type!==e.ParameterType.FUNCTION&&(r[s]=this.replaceFunctionsWithValues(r[s],n.nested[s]))}else for(var l=0,u=Object.keys(r);l<u.length;l++){var c=u[l];"type"!==c&&"timeline"!==c&&"timeline_variables"!==c&&(r[c]=this.replaceFunctionsWithValues(r[c],null))}else if("function"==typeof r)return r();return r}},{key:"setDefaultValues",value:function(t){var r=function(r){t.type.info.parameters[r].type===e.ParameterType.COMPLEX?(void 0===t[r]&&t.type.info.parameters[r].default&&(t[r]=t.type.info.parameters[r].default),!0===t.type.info.parameters[r].array&&Array.isArray(t[r])&&t[r].forEach((function(e,n){for(var i in t.type.info.parameters[r].nested)void 0!==t[r][n][i]&&null!==t[r][n][i]||(void 0===t.type.info.parameters[r].nested[i].default?console.error("You must specify a value for the ".concat(i," parameter (nested in the ").concat(r," parameter) in the ").concat(t.type.info.name," plugin.")):t[r][n][i]=t.type.info.parameters[r].nested[i].default)}))):void 0!==t[r]&&null!==t[r]||(void 0===t.type.info.parameters[r].default?console.error("You must specify a value for the ".concat(r," parameter in the ").concat(t.type.info.name," plugin.")):t[r]=t.type.info.parameters[r].default)};for(var n in t.type.info.parameters)r(n)}},{key:"checkExclusions",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var r,n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e.min_width||e.min_height||e.audio)&&console.warn("The exclusions option in `initJsPsych()` is deprecated and will be removed in a future version. We recommend using the browser-check plugin instead. See https://www.jspsych.org/latest/plugins/browser-check/."),!e.min_width&&!e.min_height){t.next=12;break}if(r=e.min_width||0,n=e.min_height||0,!(window.innerWidth<r||window.innerHeight<n)){t.next=12;break}this.getDisplayElement().innerHTML="<p>Your browser window is too small to complete this experiment. Please maximize the size of your browser window. If your browser window is already maximized, you will not be able to complete this experiment.</p><p>The minimum width is "+r+"px. Your current width is "+window.innerWidth+"px.</p><p>The minimum height is "+n+"px. Your current height is "+window.innerHeight+"px.</p>";case 6:if(!(window.innerWidth<r||window.innerHeight<n)){t.next=11;break}return t.next=9,Q(100);case 9:t.next=6;break;case 11:this.getDisplayElement().innerHTML="";case 12:if(void 0===e.audio||!e.audio){t.next=16;break}if(window.hasOwnProperty("AudioContext")||window.hasOwnProperty("webkitAudioContext")){t.next=16;break}throw this.getDisplayElement().innerHTML="<p>Your browser does not support the WebAudio API, which means that you will not be able to complete the experiment.</p><p>Browsers that support the WebAudio API include Chrome, Firefox, Safari, and Edge.</p>",new Error;case 16:case"end":return t.stop()}}),t,this)})))}},{key:"drawProgressBar",value:function(e){document.querySelector(".jspsych-display-element").insertAdjacentHTML("afterbegin",'<div id="jspsych-progressbar-container"><span>'+e+'</span><div id="jspsych-progressbar-outer"><div id="jspsych-progressbar-inner"></div></div></div>')}},{key:"updateProgressBar",value:function(){this.setProgressBar(this.getProgress().percent_complete/100)}},{key:"setProgressBar",value:function(e){e=Math.max(Math.min(1,e),0),document.querySelector("#jspsych-progressbar-inner").style.width=100*e+"%",this.progress_bar_amount=e}},{key:"getProgressBarCompleted",value:function(){return this.progress_bar_amount}}]),n}();return"undefined"!=typeof window&&window.hasOwnProperty("webkitAudioContext")&&!window.hasOwnProperty("AudioContext")&&(window.AudioContext=webkitAudioContext),e.JsPsych=Z,e.initJsPsych=function(e){var t=new Z(e);return Object.defineProperties(t,Object.fromEntries(Object.entries({init:"`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.",ALL_KEYS:'jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.',NO_KEYS:'jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.',currentTimelineNodeID:"`currentTimelineNodeID()` was renamed to `getCurrentTimelineNodeID()` in jsPsych v7.",progress:"`progress()` was renamed to `getProgress()` in jsPsych v7.",startTime:"`startTime()` was renamed to `getStartTime()` in jsPsych v7.",totalTime:"`totalTime()` was renamed to `getTotalTime()` in jsPsych v7.",currentTrial:"`currentTrial()` was renamed to `getCurrentTrial()` in jsPsych v7.",initSettings:"`initSettings()` was renamed to `getInitSettings()` in jsPsych v7.",allTimelineVariables:"`allTimelineVariables()` was renamed to `getAllTimelineVariables()` in jsPsych v7."}).map((function(e){var t=d(e,2),r=t[0],n=t[1];return[r,{get:function(){throw new w(n)}}]})))),t},e.universalPluginParameters=A,Object.defineProperty(e,"__esModule",{value:!0}),e}({}),initJsPsych=jsPsychModule.initJsPsych;
2
2
  //# sourceMappingURL=index.browser.min.js.map