jspsych 7.1.2 → 7.2.0
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.
- package/css/jspsych.css +322 -12
- package/dist/index.browser.js +993 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +993 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +989 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/data/DataCollection.d.ts +1 -0
- package/dist/modules/randomization.d.ts +7 -0
- package/package.json +21 -7
- package/src/JsPsych.ts +3 -1
- package/src/index.scss +209 -0
- package/src/modules/data/DataCollection.ts +8 -0
- package/src/modules/randomization.ts +16 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var jsPsychModule=function(e){"use strict";function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==i)return;var r,n,s=[],o=!0,a=!1;try{for(i=i.call(e);!(o=(r=i.next()).done)&&(s.push(r.value),!t||s.length!==t);o=!0);}catch(e){a=!0,n=e}finally{try{o||null==i.return||i.return()}finally{if(a)throw n}}return s}(e,t)||i(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 i(e,t){if(e){if("string"==typeof e)return r(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(e,t):void 0}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function n(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=i(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}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 o,a=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}function s(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))}var o=function(e){var t=new Set;do{var i,r=n(Reflect.ownKeys(e));try{for(r.s();!(i=r.n()).done;){var s=i.value;t.add([e,s])}}catch(e){r.e(e)}finally{r.f()}}while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t},a=function(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=r.include,a=r.exclude,l=function(e){var t=function(t){return"string"==typeof t?e===t:t.test(e)};return s?s.some(t):!a||!a.some(t)},c=n(o(e.constructor.prototype));try{for(c.s();!(i=c.n()).done;){var h=t(i.value,2),u=h[0],d=h[1];if("constructor"!==d&&l(d)){var p=Reflect.getOwnPropertyDescriptor(u,d);p&&"function"==typeof p.value&&(e[d]=e[d].bind(e))}}}catch(e){c.e(e)}finally{c.f()}return e};class l extends Error{constructor(e="The global `jsPsych` variable is no longer available in jsPsych v7."){super(`${e} Please follow the migration guide at https://www.jspsych.org/7.0/support/migration-v7/ to update your experiment.`),this.name="MigrationError"}}function c(e){return[...new Set(e)]}function h(e){if(!e)return e;let t;if(Array.isArray(e)){t=[];for(const i of e)t.push(h(i));return t}if("object"==typeof e&&null!==e){t={};for(const i in e)e.hasOwnProperty(i)&&(t[i]=h(e[i]));return t}return e}window.jsPsych={get init(){throw new l("`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.")},get data(){throw new l},get randomization(){throw new l},get turk(){throw new l},get pluginAPI(){throw new l},get ALL_KEYS(){throw new l('jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.')},get NO_KEYS(){throw new l('jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.')}};var u,d=Object.freeze({__proto__:null,unique:c,deepCopy:h});class p{constructor(e=[]){this.values=e}sum(){let e=0;for(const t of this.values)e+=t;return e}mean(){return this.sum()/this.count()}median(){if(0===this.values.length)return;const 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]}min(){return Math.min.apply(null,this.values)}max(){return Math.max.apply(null,this.values)}count(){return this.values.length}variance(){const e=this.mean();let t=0;for(const i of this.values)t+=Math.pow(i-e,2);return t/(this.values.length-1)}sd(){const e=this.variance();return Math.sqrt(e)}frequencies(){const e={};for(const t of this.values)void 0===e[t]?e[t]=1:e[t]++;return e}all(e){for(const t of this.values)if(!e(t))return!1;return!0}subset(e){const t=[];for(const i of this.values)e(i)&&t.push(i);return new p(t)}}class m{constructor(e=[]){this.trials=e}push(e){return this.trials.push(e),this}join(e){return this.trials=this.trials.concat(e.values()),this}top(){return this.trials.length<=1?this:new m([this.trials[this.trials.length-1]])}first(e=1){if(e<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new m:(e>this.trials.length&&(e=this.trials.length),new m(this.trials.slice(0,e)))}last(e=1){if(e<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new m:(e>this.trials.length&&(e=this.trials.length),new m(this.trials.slice(this.trials.length-e,this.trials.length)))}values(){return this.trials}count(){return this.trials.length}readOnly(){return new m(h(this.trials))}addToAll(e){for(const t of this.trials)Object.assign(t,e);return this}addToLast(e){return 0!=this.trials.length&&Object.assign(this.trials[this.trials.length-1],e),this}filter(e){let t;t=Array.isArray(e)?h(e):h([e]);const i=[];for(const e of this.trials){let r=!1;for(const i of t){let t=!0;for(const r of Object.keys(i))void 0!==e[r]&&e[r]===i[r]||(t=!1);if(t){r=!0;break}}r&&i.push(e)}return new m(i)}filterCustom(e){return new m(this.trials.filter(e))}select(e){const t=[];for(const i of this.trials)void 0!==i[e]&&t.push(i[e]);return new p(t)}ignore(e){Array.isArray(e)||(e=[e]);const t=h(this.trials);for(const i of t)for(const t of e)delete i[t];return new m(t)}uniqueNames(){const e=[];for(const t of this.trials)for(const i of Object.keys(t))e.includes(i)||e.push(i);return e}csv(){return function(e){const t="object"!=typeof e?JSON.parse(e):e;let i="",r="";const n=[];for(const e of t)for(const t in e){let e=t+"";e='"'+e.replace(/"/g,'""')+'",',n.includes(t)||(n.push(t),i+=e)}i=i.slice(0,-1),r+=i+"\r\n";for(const e of t){i="";for(const t of n){let r=void 0===e[t]?"":e[t];"object"==typeof r&&(r=JSON.stringify(r)),i+='"'+(r+"").replace(/"/g,'""')+'",'}i=i.slice(0,-1),r+=i+"\r\n"}return r}(this.trials)}json(e=!1){return e?JSON.stringify(this.trials,null,"\t"):JSON.stringify(this.trials)}localSave(e,t){let i;if("json"===(e=e.toLowerCase()))i=this.json();else{if("csv"!==e)throw new Error('Invalid format specified for localSave. Must be "json" or "csv".');i=this.csv()}!function(e,t){const i=new Blob([e],{type:"text/plain"});let r="";r=void 0!==window.webkitURL?window.webkitURL.createObjectURL(i):window.URL.createObjectURL(i);const n=document.createElement("a");n.id="jspsych-download-as-text-link",n.style.display="none",n.download=t,n.href=r,n.click()}(i,t)}}class f{constructor(e){this.jsPsych=e,this.dataProperties={},this.reset()}reset(){this.allData=new m,this.interactionData=new m}get(){return this.allData}getInteractionData(){return this.interactionData}write(e){const t=this.jsPsych.getProgress(),i=this.jsPsych.getCurrentTrial(),r={trial_type:i.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),i.data),r),this.dataProperties))}addProperties(e){this.allData.addToAll(e),this.dataProperties=Object.assign({},this.dataProperties,e)}addDataToLastTrial(e){this.allData.addToLast(e)}getDataByTimelineNode(e){return this.allData.filterCustom((t=>t.internal_node_id.slice(0,e.length)===e))}getLastTrialData(){return this.allData.top()}getLastTimelineData(){const e=this.getLastTrialData().select("internal_node_id").values[0];if(void 0===e)return new m;{const t=e.substr(0,e.lastIndexOf("-"));return this.getDataByTimelineNode(t)}}displayData(e="json"){"json"!=(e=e.toLowerCase())&&"csv"!=e&&(console.log("Invalid format declared for displayData function. Using json as default."),e="json");const t="json"===e?this.allData.json(!0):this.allData.csv();this.jsPsych.getDisplayElement().innerHTML='<pre id="jspsych-data-display"></pre>',document.getElementById("jspsych-data-display").textContent=t}urlVariables(){return void 0===this.query_string&&(this.query_string=function(){const e=window.location.search.substr(1).split("&"),t={};for(let i=0;i<e.length;++i){const r=e[i].split("=",2);1==r.length?t[r[0]]="":t[r[0]]=decodeURIComponent(r[1].replace(/\+/g," "))}return t}()),this.query_string}getURLVariable(e){return this.urlVariables()[e]}createInteractionListeners(){window.addEventListener("blur",(()=>{const e={event:"blur",trial:this.jsPsych.getProgress().current_trial_global,time:this.jsPsych.getTotalTime()};this.interactionData.push(e),this.jsPsych.getInitSettings().on_interaction_data_update(e)})),window.addEventListener("focus",(()=>{const e={event:"focus",trial:this.jsPsych.getProgress().current_trial_global,time:this.jsPsych.getTotalTime()};this.interactionData.push(e),this.jsPsych.getInitSettings().on_interaction_data_update(e)}));const e=()=>{const e={event:document.isFullScreen||document.webkitIsFullScreen||document.mozIsFullScreen||document.fullscreenElement?"fullscreenenter":"fullscreenexit",trial:this.jsPsych.getProgress().current_trial_global,time:this.jsPsych.getTotalTime()};this.interactionData.push(e),this.jsPsych.getInitSettings().on_interaction_data_update(e)};document.addEventListener("fullscreenchange",e),document.addEventListener("mozfullscreenchange",e),document.addEventListener("webkitfullscreenchange",e)}_customInsert(e){this.allData=new m(e)}_fullreset(){this.reset(),this.dataProperties={}}}class g{constructor(){this.hardwareConnected=!1,document.addEventListener("jspsych-activate",(e=>{this.hardwareConnected=!0}))}hardware(e){const t=new CustomEvent("jspsych",{detail:e});document.dispatchEvent(t)}}class y{constructor(e,t=!1,i=0){this.getRootElement=e,this.areResponsesCaseSensitive=t,this.minimumValidRt=i,this.listeners=new Set,this.heldKeys=new Set,this.areRootListenersRegistered=!1,a(this),this.registerRootListeners()}registerRootListeners(){if(!this.areRootListenersRegistered){const e=this.getRootElement();e&&(e.addEventListener("keydown",this.rootKeydownListener),e.addEventListener("keyup",this.rootKeyupListener),this.areRootListenersRegistered=!0)}}rootKeydownListener(e){for(const t of Array.from(this.listeners))t(e);this.heldKeys.add(this.toLowerCaseIfInsensitive(e.key))}toLowerCaseIfInsensitive(e){return this.areResponsesCaseSensitive?e:e.toLowerCase()}rootKeyupListener(e){this.heldKeys.delete(this.toLowerCaseIfInsensitive(e.key))}isResponseValid(e,t,i){return!(!t&&this.heldKeys.has(i))&&("ALL_KEYS"===e||"NO_KEYS"!==e&&e.includes(i))}getKeyboardResponse({callback_function:e,valid_responses:t="ALL_KEYS",rt_method:i="performance",persist:r,audio_context:n,audio_context_start_time:s,allow_held_key:o=!1,minimum_valid_rt:a=this.minimumValidRt}){"performance"!==i&&"audio"!==i&&(console.log('Invalid RT method specified in getKeyboardResponse. Defaulting to "performance" method.'),i="performance");const l="performance"===i?performance.now():1e3*s;this.registerRootListeners(),this.areResponsesCaseSensitive||"string"==typeof t||(t=t.map((e=>e.toLowerCase())));const c=s=>{const h=Math.round(("performance"==i?performance.now():1e3*n.currentTime)-l);if(h<a)return;const u=this.toLowerCaseIfInsensitive(s.key);this.isResponseValid(t,o,u)&&(s.preventDefault(),r||this.cancelKeyboardResponse(c),e({key:u,rt:h}))};return this.listeners.add(c),c}cancelKeyboardResponse(e){this.listeners.delete(e)}cancelAllKeyboardResponses(){this.listeners.clear()}compareKeys(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.ParameterType=void 0,(u=e.ParameterType||(e.ParameterType={}))[u.BOOL=0]="BOOL",u[u.STRING=1]="STRING",u[u.INT=2]="INT",u[u.FLOAT=3]="FLOAT",u[u.FUNCTION=4]="FUNCTION",u[u.KEY=5]="KEY",u[u.KEYS=6]="KEYS",u[u.SELECT=7]="SELECT",u[u.HTML_STRING=8]="HTML_STRING",u[u.IMAGE=9]="IMAGE",u[u.AUDIO=10]="AUDIO",u[u.VIDEO=11]="VIDEO",u[u.OBJECT=12]="OBJECT",u[u.COMPLEX=13]="COMPLEX",u[u.TIMELINE=14]="TIMELINE";const _={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}},b=[e.ParameterType.AUDIO,e.ParameterType.IMAGE,e.ParameterType.VIDEO];class v{constructor(e,t){this.useWebaudio=e,this.webaudioContext=t,this.video_buffers={},this.context=null,this.audio_buffers=[],this.preload_requests=[],this.img_cache={},this.preloadMap=new Map,this.microphone_recorder=null}getVideoBuffer(e){return this.video_buffers[e]}initAudio(){this.context=this.useWebaudio?this.webaudioContext:null}audioContext(){return null!==this.context&&"running"!==this.context.state&&this.context.resume(),this.context}getAudioBuffer(e){return new Promise(((t,i)=>{void 0===this.audio_buffers[e]||"tmp"==this.audio_buffers[e]?this.preloadAudio([e],(()=>{t(this.audio_buffers[e])}),(()=>{}),(e=>{i(e.error)})):t(this.audio_buffers[e])}))}preloadAudio(e,t=(()=>{}),i=(e=>{}),r=(e=>{})){e=c(e.flat());let n=0;if(0==e.length)return void t();const s=(s,o=1)=>{const a=new XMLHttpRequest;a.open("GET",s,!0),a.responseType="arraybuffer",a.onload=()=>{this.context.decodeAudioData(a.response,(r=>{this.audio_buffers[s]=r,n++,i(s),n==e.length&&t()}),(e=>{r({source:s,error:e})}))},a.onerror=function(e){let t=e;404==this.status&&(t="404"),r({source:s,error:t})},a.onloadend=function(e){404==this.status&&r({source:s,error:"404"})},a.send(),this.preload_requests.push(a)},o=(s,o=1)=>{const a=new Audio,l=()=>{this.audio_buffers[s]=a,n++,i(s),n==e.length&&t(),a.removeEventListener("canplaythrough",l)};a.addEventListener("canplaythrough",l),a.addEventListener("error",(function e(t){r({source:a.src,error:t}),a.removeEventListener("error",e)})),a.addEventListener("abort",(function e(t){r({source:a.src,error:t}),a.removeEventListener("abort",e)})),a.src=s,this.preload_requests.push(a)};for(const r of e)void 0!==this.audio_buffers[r]?(n++,i(r),n==e.length&&t()):(this.audio_buffers[r]="tmp",null!==this.audioContext()?s(r):o(r))}preloadImages(e,t=(()=>{}),i=(e=>{}),r=(e=>{})){e=c(e.flat());var n=0;if(0!==e.length)for(var s=0;s<e.length;s++){var o=new Image;o.onload=function(){n++,i(o.src),n===e.length&&t()},o.onerror=function(e){r({source:o.src,error:e})},o.src=e[s],this.img_cache[e[s]]=o,this.preload_requests.push(o)}else t()}preloadVideo(e,t=(()=>{}),i=(e=>{}),r=(e=>{})){e=c(e.flat());let n=0;if(0!==e.length)for(const s of e){const o=this.video_buffers,a=new XMLHttpRequest;a.open("GET",s,!0),a.responseType="blob",a.onload=function(){if(200===this.status||0===this.status){const r=this.response;o[s]=URL.createObjectURL(r),n++,i(s),n===e.length&&t()}},a.onerror=function(e){let t=e;404==this.status&&(t="404"),r({source:s,error:t})},a.onloadend=function(e){404==this.status&&r({source:s,error:"404"})},a.send(),this.preload_requests.push(a)}else t()}getAutoPreloadList(t){const i=Object.fromEntries(b.map((e=>[e,new Set]))),r=(e,t)=>{var n,s,o,a;if(void 0!==e.timeline)for(const i of e.timeline)r(i,null!==(n=e.type)&&void 0!==n?n:t);else if(null===(o=null!==(s=e.type)&&void 0!==s?s:t)||void 0===o?void 0:o.info){const{name:r,parameters:n}=(null!==(a=e.type)&&void 0!==a?a:t).info;this.preloadMap.has(r)||this.preloadMap.set(r,Object.fromEntries(Object.entries(n).filter((([e,{type:t,preload:i}])=>b.includes(t)&&(null==i||i))).map((([e,{type:t}])=>[e,t]))));for(const[t,n]of Object.entries(this.preloadMap.get(r))){const r=e[t],s=i[n];if("string"==typeof r)s.add(r);else if(Array.isArray(r))for(const e of r.flat())"string"==typeof e&&s.add(e)}}};return r({timeline:t}),{images:[...i[e.ParameterType.IMAGE]],audio:[...i[e.ParameterType.AUDIO]],video:[...i[e.ParameterType.VIDEO]]}}cancelPreloads(){for(const e of this.preload_requests)e.onload=()=>{},e.onerror=()=>{},e.oncanplaythrough=()=>{},e.onabort=()=>{};this.preload_requests=[]}initializeMicrophoneRecorder(e){const t=new MediaRecorder(e);this.microphone_recorder=t}getMicrophoneRecorder(){return this.microphone_recorder}}class w{dispatchEvent(e){document.body.dispatchEvent(e)}keyDown(e){this.dispatchEvent(new KeyboardEvent("keydown",{key:e}))}keyUp(e){this.dispatchEvent(new KeyboardEvent("keyup",{key:e}))}pressKey(e,t=0){t>0?setTimeout((()=>{this.keyDown(e),this.keyUp(e)}),t):(this.keyDown(e),this.keyUp(e))}clickTarget(e,t=0){t>0?setTimeout((()=>{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})))}fillTextInput(e,t,i=0){i>0?setTimeout((()=>{e.value=t}),i):e.value=t}getValidKey(e){const t=["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"," "];let i;if("NO_KEYS"==e)i=null;else if("ALL_KEYS"==e)i=t[Math.floor(Math.random()*t.length)];else{const t=e.flat();i=t[Math.floor(Math.random()*t.length)]}return i}mergeSimulationData(e,t){return Object.assign(Object.assign({},e),null==t?void 0:t.data)}ensureSimulationDataConsistency(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){const i=e.sequence_reps*e.frame_time*e.stimuli.length;t.rt<i&&(t.rt=null,t.response=null)}}}class T{constructor(){this.timeout_handlers=[]}setTimeout(e,t){const i=window.setTimeout(e,t);return this.timeout_handlers.push(i),i}clearAllTimeouts(){for(const e of this.timeout_handlers)clearTimeout(e);this.timeout_handlers=[]}}var k=["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 j(e){function t(){return e&&e.maxLength>1?function(){var t,r=!1;for(;!r;)(t=i()).length<=e.maxLength&&(r=!0);return t}():i()}function i(){return k[r(k.length)]}function r(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 n=e.min+r(e.max+1-e.min),s=[],o="",a=0,l=0;l<n*e.wordsPerString;l++)a===e.wordsPerString-1?o+=e.formatter(t(),a):o+=e.formatter(t(),a)+e.separator,a++,(l+1)%e.wordsPerString==0&&(s.push(o),o="",a=0);return"string"==typeof e.join&&(s=s.join(e.join)),s}var x=j;function P(e,t,i=!1){const r=Array.isArray(e),n=Array.isArray(t);if(r)if(n){if(e.length!=t.length)if(console.warn("Unclear parameters given to randomization.repeat. Items and repetitions are unequal lengths. Behavior may not be as expected."),t.length<e.length){let i=[];for(let r=0;r<e.length;r++)i.push(t);t=i}else t=t.slice(0,e.length)}else{let i=[];for(let r=0;r<e.length;r++)i.push(t);t=i}else n?(t=[t[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],t=[t]);let s=[];for(let i=0;i<e.length;i++)for(let r=0;r<t[i];r++)null==e[i]||"object"!=typeof e[i]?s.push(e[i]):s.push(Object.assign({},e[i]));let o=E(s);return i&&(o=function(e){const t={};for(const i of e)for(const e of Object.keys(i))void 0===t[e]&&(t[e]=[]),t[e].push(i[e]);return t}(o)),o}function E(e){Array.isArray(e)||console.error("Argument to shuffle() must be an array.");const t=e.slice(0);let i,r,n=t.length;for(;n;)r=Math.floor(Math.random()*n--),i=t[n],t[n]=t[r],t[r]=i;return t}function O(e,t=!1){const i=e.length;if(1==i)return console.warn("shuffleAlternateGroups() was called with only one group. Defaulting to simple shuffle."),E(e[0]);let r=[];for(let e=0;e<i;e++)r.push(e);t&&(r=E(r));const n=[];let s=null;for(let t=0;t<i;t++)s=null===s?e[t].length:Math.min(s,e[t].length),n.push(E(e[t]));const o=[];for(let e=0;e<s;e++)for(let t=0;t<r.length;t++)o.push(n[r[t]][e]);return o}function A(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."),E(e).slice(0,t)}function I(e,t,i){Array.isArray(e)||console.error("First argument to sampleWithReplacement() must be an array");const r=[];if(void 0!==i){i.length!==e.length&&console.error("The length of the weights array must equal the length of the array to be sampled from.");let t=0;for(const e of i)t+=e;for(const e of i)r.push(e/t)}else for(let t=0;t<e.length;t++)r.push(1/e.length);const n=[r[0]];for(let e=1;e<r.length;e++)n.push(r[e]+n[e-1]);const s=[];for(let i=0;i<t;i++){const t=Math.random();let i=0;for(;t>n[i];)i++;s.push(e[i])}return s}function L(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 M(e){return-Math.log(Math.random())/e}j.wordList=k;var S=Object.freeze({__proto__:null,repeat:P,shuffle:E,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});const i=E(e);for(let e=0;e<i.length-1;e++)if(t(i[e],i[e+1])){let r=Math.floor(Math.random()*(i.length-2))+1;for(;t(i[e+1],i[r])||t(i[e+1],i[r+1])||t(i[e+1],i[r-1]);)r=Math.floor(Math.random()*(i.length-2))+1;const n=i[r];i[r]=i[e+1],i[e+1]=n}return i},shuffleAlternateGroups:O,sampleWithoutReplacement:A,sampleWithReplacement:I,factorial:function(e,t=1,i=!1){let r=[{}];for(const[t,i]of Object.entries(e)){const e=[];for(const n of i)for(const i of r)e.push(Object.assign(Object.assign({},i),{[t]:n}));r=e}return P(r,t,i)},randomID:function(e=32){let t="";const i="0123456789abcdefghjklmnopqrstuvwxyz";for(let r=0;r<e;r++)t+=i[Math.floor(Math.random()*i.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:L,sampleExponential:M,sampleExGaussian:function(e,t,i,r=!1){let n=L(e,t)+M(i);if(r)for(;n<=0;)n=L(e,t)+M(i);return n},randomWords:function(e){return x(e)}});function D(){const 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(/[\]]/,"\\]");const i=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null==i?"":i[1]},i=t(window.location.href,"assignmentId")?window.location.href:document.referrer;return["assignmentId","hitId","workerId","turkSubmitTo"].map((function(r){e[r]=unescape(t(i,r))})),e.previewMode="ASSIGNMENT_ID_NOT_AVAILABLE"==e.assignmentId,e.outsideTurk=!e.previewMode&&""===e.hitId&&""==e.assignmentId&&""==e.workerId,e}var C=Object.freeze({__proto__:null,turkInfo:D,submitToTurk:function(e){const t=D(),i=t.assignmentId,r=t.turkSubmitTo;if(!i||!r)return;const n=document.createElement("form");n.method="POST",n.action=r+"/mturk/externalSubmit?assignmentId="+i;for(const t in e)if(e.hasOwnProperty(t)){const i=document.createElement("input");i.type="hidden",i.name=t,i.id=t,i.value=e[t],n.appendChild(i)}document.body.appendChild(n),n.submit()}});class N{constructor(e,t,i,r){if(this.jsPsych=e,this.progress={current_location:-1,current_variable_set:0,current_repetition:0,current_iteration:0,done:!1},this.parent_node=i,this.relative_id=void 0===i?0:r,void 0!==t.timeline){this.timeline_parameters={timeline:[],loop_function:t.loop_function,conditional_function:t.conditional_function,sample:t.sample,randomize_order:void 0!==t.randomize_order&&t.randomize_order,repetitions:void 0===t.repetitions?1:t.repetitions,timeline_variables:void 0===t.timeline_variables?[{}]:t.timeline_variables,on_timeline_finish:t.on_timeline_finish,on_timeline_start:t.on_timeline_start},this.setTimelineVariablesOrder();var n=Object.assign({},t);delete n.timeline,delete n.conditional_function,delete n.loop_function,delete n.randomize_order,delete n.repetitions,delete n.timeline_variables,delete n.sample,delete n.on_timeline_start,delete n.on_timeline_finish,this.node_trial_data=n;for(var s=0;s<t.timeline.length;s++){var o=Object.assign({},n,t.timeline[s]);if("object"==typeof n.data&&"object"==typeof t.timeline[s].data){var a=Object.assign({},n.data,t.timeline[s].data);o.data=a}this.timeline_parameters.timeline.push(new N(this.jsPsych,o,this,s))}}else void 0===t.type&&console.error('Trial level node is missing the "type" parameter. The parameters for the node are: '+JSON.stringify(t)),this.trial_parameters=Object.assign({},t)}trial(){return void 0===this.timeline_parameters?h(this.trial_parameters):this.progress.current_location>=this.timeline_parameters.timeline.length?null:this.timeline_parameters.timeline[this.progress.current_location].trial()}markCurrentTrialComplete(){void 0===this.timeline_parameters?this.progress.done=!0:this.timeline_parameters.timeline[this.progress.current_location].markCurrentTrialComplete()}nextRepetiton(){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()}setTimelineVariablesOrder(){const e=this.timeline_parameters;if(void 0!==e&&void 0!==e.timeline_variables){for(var t=[],i=0;i<e.timeline_variables.length;i++)t.push(i);void 0!==e.sample&&("custom"==e.sample.type?t=e.sample.fn(t):"with-replacement"==e.sample.type?t=I(t,e.sample.size,e.sample.weights):"without-replacement"==e.sample.type?t=A(t,e.sample.size):"fixed-repetitions"==e.sample.type?t=P(t,e.sample.size,!1):"alternate-groups"==e.sample.type?t=O(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=E(t)),this.progress.order=t}}nextSet(){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()}advance(){const e=this.progress,t=this.timeline_parameters,i=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){i.call_immediate=!0;var r=t.conditional_function();if(i.call_immediate=!1,0==r)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 n=!1;e.current_location<t.timeline.length&&0==n;){if(!t.timeline[e.current_location].advance())return n=!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?(i.call_immediate=!0,t.loop_function(this.generatedData())?(this.reset(),i.call_immediate=!1,this.parent_node.advance()):(e.done=!0,i.call_immediate=!1,!0)):(e.done=!0,!0))}}isComplete(){return this.progress.done}getTimelineVariableValue(e){if(void 0!==this.timeline_parameters)return this.timeline_parameters.timeline_variables[this.progress.order[this.progress.current_variable_set]][e]}findTimelineVariable(e){var t=this.getTimelineVariableValue(e);return void 0===t?void 0!==this.parent_node?this.parent_node.findTimelineVariable(e):void 0:t}timelineVariable(e){if(void 0===this.timeline_parameters)return this.findTimelineVariable(e);var t=Math.max(0,this.progress.current_location);return t==this.timeline_parameters.timeline.length&&(t-=1),this.timeline_parameters.timeline[t].timelineVariable(e)}allTimelineVariables(){for(var e=this.allTimelineVariablesNames(),t={},i=0;i<e.length;i++)t[e[i]]=this.timelineVariable(e[i]);return t}allTimelineVariablesNames(e=[]){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}length(){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}percentComplete(){for(var e=this.length(),t=0,i=0;i<this.timeline_parameters.timeline.length;i++)this.timeline_parameters.timeline[i].isComplete()&&(t+=this.timeline_parameters.timeline[i].length());return t/e*100}reset(){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()}end(){this.progress.done=!0}endActiveNode(){void 0===this.timeline_parameters?(this.end(),this.parent_node.end()):this.timeline_parameters.timeline[this.progress.current_location].endActiveNode()}ID(){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)}activeID(){return void 0===this.timeline_parameters?this.ID():this.timeline_parameters.timeline[this.progress.current_location].activeID()}generatedData(){return this.jsPsych.data.getDataByTimelineNode(this.ID())}trialsOfType(e){if(void 0===this.timeline_parameters)return this.trial_parameters.type==e?this.trial_parameters:[];for(var t=[],i=0;i<this.timeline_parameters.timeline.length;i++){var r=this.timeline_parameters.timeline[i].trialsOfType(e);t=t.concat(r)}return t}insert(e){void 0===this.timeline_parameters?console.error("Cannot add new trials to a trial-level node."):this.timeline_parameters.timeline.push(new N(this.jsPsych,Object.assign(Object.assign({},this.node_trial_data),e),this,this.timeline_parameters.timeline.length))}}function R(e){return new Promise((t=>setTimeout(t,e)))}class V{constructor(e){this.extensions={},this.turk=C,this.randomization=S,this.utils=d,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:()=>{},on_trial_start:()=>{},on_trial_finish:()=>{},on_data_update:()=>{},on_interaction_data_update:()=>{},on_close:()=>{},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,a(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 f(this),this.pluginAPI=function(e){const t=e.getInitSettings();return Object.assign({},...[new y(e.getDisplayContainerElement,t.case_sensitive_responses,t.minimum_valid_rt),new T,new v(t.use_webaudio,e.webaudio_context),new g,new w].map((e=>a(e))))}(this);for(const t of e.extensions)this.extensions[t.type.info.name]=new t.type(this);this.pluginAPI.initAudio()}version(){return"7.1.2"}run(e){return s(this,void 0,void 0,(function*(){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 N(this,{timeline:e}),yield this.prepareDom(),yield this.checkExclusions(this.opts.exclusions),yield this.loadExtensions(this.opts.extensions),document.documentElement.setAttribute("jspsych","present"),this.startExperiment(),yield this.finished}))}simulate(e,t="data-only",i={}){return s(this,void 0,void 0,(function*(){this.simulation_mode=t,this.simulation_options=i,yield this.run(e)}))}getProgress(){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()}}getStartTime(){return this.exp_start_time}getTotalTime(){return void 0===this.exp_start_time?0:(new Date).getTime()-this.exp_start_time.getTime()}getDisplayElement(){return this.DOM_target}getDisplayContainerElement(){return this.DOM_container}finishTrial(e={}){if(this.current_trial_finished)return;this.current_trial_finished=!0,void 0!==this.current_trial.css_classes&&Array.isArray(this.current_trial.css_classes)&&this.DOM_target.classList.remove(...this.current_trial.css_classes),this.data.write(e);const t=this.data.get().filter({trial_index:this.global_trial_index}).values()[0],i=this.current_trial;if("object"==typeof i.save_trial_parameters)for(const e of Object.keys(i.save_trial_parameters)){const r=i.save_trial_parameters[e];!0===r&&(void 0===i[e]?console.warn(`Invalid parameter specified in save_trial_parameters. Trial has no property called "${e}".`):"function"==typeof i[e]?t[e]=i[e].toString():t[e]=i[e]),!1===r&&"internal_node_id"!==e&&"trial_index"!==e&&delete t[e]}if(Array.isArray(i.extensions))for(const e of i.extensions){const i=this.extensions[e.type.info.name].on_finish(e.params);Object.assign(t,i)}this.internal.call_immediate=!0,"function"==typeof i.on_finish&&i.on_finish(t),this.opts.on_trial_finish(t),this.opts.on_data_update(t),this.internal.call_immediate=!1,null===typeof i.post_trial_gap||void 0===i.post_trial_gap?this.opts.default_iti>0?setTimeout(this.nextTrial,this.opts.default_iti):this.nextTrial():i.post_trial_gap>0?setTimeout(this.nextTrial,i.post_trial_gap):this.nextTrial()}endExperiment(e="",t={}){this.timeline.end_message=e,this.timeline.end(),this.pluginAPI.cancelAllKeyboardResponses(),this.pluginAPI.clearAllTimeouts(),this.finishTrial(t)}endCurrentTimeline(){this.timeline.endActiveNode()}getCurrentTrial(){return this.current_trial}getInitSettings(){return this.opts}getCurrentTimelineNodeID(){return this.timeline.activeID()}timelineVariable(e,t=!1){return this.internal.call_immediate||!0===t?this.timeline.timelineVariable(e):{timelineVariablePlaceholder:!0,timelineVariableFunction:()=>this.timeline.timelineVariable(e)}}getAllTimelineVariables(){return this.timeline.allTimelineVariables()}addNodeToEndOfTimeline(e,t){this.timeline.insert(e)}pauseExperiment(){this.paused=!0}resumeExperiment(){this.paused=!1,this.waiting&&(this.waiting=!1,this.nextTrial())}loadFail(e){e=e||"<p>The experiment failed to load.</p>",this.DOM_target.innerHTML=e}getSafeModeStatus(){return this.file_protocol}getTimeline(){return this.timelineDescription}prepareDom(){return s(this,void 0,void 0,(function*(){"complete"!==document.readyState&&(yield new Promise((e=>{window.addEventListener("load",e)})));const e=this.opts;if(void 0===e.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%",e.display_element=document.querySelector("body")}else{const t=e.display_element instanceof Element?e.display_element:document.querySelector("#"+e.display_element);null===t?console.error("The display_element specified in initJsPsych() does not exist in the DOM."):e.display_element=t}e.display_element.innerHTML='<div class="jspsych-content-wrapper"><div id="jspsych-content"></div></div>',this.DOM_container=e.display_element,this.DOM_target=document.querySelector("#jspsych-content"),null!==e.experiment_width&&(this.DOM_target.style.width=e.experiment_width+"px"),e.display_element.tabIndex=0,-1===e.display_element.className.indexOf("jspsych-display-element")&&(e.display_element.className+=" jspsych-display-element"),this.DOM_target.className+="jspsych-content",this.data.createInteractionListeners(),window.addEventListener("beforeunload",e.on_close)}))}loadExtensions(e){return s(this,void 0,void 0,(function*(){try{yield Promise.all(e.map((e=>this.extensions[e.type.info.name].initialize(e.params||{}))))}catch(e){throw console.error(e),new Error(e)}}))}startExperiment(){this.finished=new Promise((e=>{this.resolveFinishedPromise=e})),!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())}finishExperiment(){const e=this.opts.on_finish(this.data.get()),t=()=>{void 0!==this.timeline.end_message&&(this.DOM_target.innerHTML=this.timeline.end_message),this.resolveFinishedPromise()};e?Promise.resolve(e).then(t):t()}nextTrial(){if(this.paused)return void(this.waiting=!0);this.global_trial_index++,this.timeline.markCurrentTrialComplete();const 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())}doTrial(e){if(this.current_trial=e,this.current_trial_finished=!1,this.evaluateTimelineVariables(e),"string"==typeof e.type)throw new l("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({},a(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))for(const t of e.extensions)this.extensions[t.type.info.name].on_start(t.params);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)&&this.DOM_target.classList.add(...e.css_classes));const t=()=>{if("function"==typeof e.on_load&&e.on_load(),Array.isArray(e.extensions))for(const t of e.extensions)this.extensions[t.type.info.name].on_load(t.params)};let i;if(this.simulation_mode||(i=e.type.trial(this.DOM_target,e,t)),this.simulation_mode)if(e.type.simulate){let r;e.simulation_options||(r=this.simulation_options.default),e.simulation_options&&("string"==typeof e.simulation_options?this.simulation_options[e.simulation_options]?r=this.simulation_options[e.simulation_options]:this.simulation_options.default?(console.log(`No matching simulation options found for "${e.simulation_options}". Using "default" options.`),r=this.simulation_options.default):(console.log(`No matching simulation options found for "${e.simulation_options}" and no "default" options provided. Using the default values provided by the plugin.`),r={}):r=e.simulation_options),r=this.utils.deepCopy(r),r=this.replaceFunctionsWithValues(r,null),i=!1===(null==r?void 0:r.simulate)?e.type.trial(this.DOM_target,e,t):e.type.simulate(e,(null==r?void 0:r.mode)||this.simulation_mode,r,t)}else i=e.type.trial(this.DOM_target,e,t);i&&"function"==typeof i.then||this.simulation_mode||t(),this.internal.call_immediate=!1}evaluateTimelineVariables(e){for(const t of Object.keys(e))"object"==typeof e[t]&&null!==e[t]&&void 0!==e[t].timelineVariablePlaceholder&&(e[t]=e[t].timelineVariableFunction()),"object"==typeof e[t]&&null!==e[t]&&this.evaluateTimelineVariables(e[t])}evaluateFunctionParameters(t){this.internal.call_immediate=!0;for(const i of Object.keys(t))"type"!==i&&(void 0!==_[i]&&_[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}replaceFunctionsWithValues(t,i){if(null===t)return t;if(Array.isArray(t))for(let e=0;e<t.length;e++)t[e]=this.replaceFunctionsWithValues(t[e],i);else if("object"==typeof t)if(null!==i&&i.nested)for(const r of Object.keys(t))"object"==typeof i.nested[r]&&i.nested[r].type!==e.ParameterType.FUNCTION&&(t[r]=this.replaceFunctionsWithValues(t[r],i.nested[r]));else for(const e of Object.keys(t))"type"!==e&&(t[e]=this.replaceFunctionsWithValues(t[e],null));else if("function"==typeof t)return t();return t}setDefaultValues(t){for(const i in t.type.info.parameters)t.type.info.parameters[i].type===e.ParameterType.COMPLEX?!0===t.type.info.parameters[i].array&&t[i].forEach((function(e,r){for(const e in t.type.info.parameters[i].nested)void 0!==t[i][r][e]&&null!==t[i][r][e]||(void 0===t.type.info.parameters[i].nested[e].default?console.error("You must specify a value for the "+e+" parameter (nested in the "+i+" parameter) in the "+t.type+" plugin."):t[i][r][e]=t.type.info.parameters[i].nested[e].default)})):void 0!==t[i]&&null!==t[i]||(void 0===t.type.info.parameters[i].default?console.error("You must specify a value for the "+i+" parameter in the "+t.type.info.name+" plugin."):t[i]=t.type.info.parameters[i].default)}checkExclusions(e){return s(this,void 0,void 0,(function*(){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){const t=e.min_width||0,i=e.min_height||0;if(window.innerWidth<t||window.innerHeight<i){for(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 "+t+"px. Your current width is "+window.innerWidth+"px.</p><p>The minimum height is "+i+"px. Your current height is "+window.innerHeight+"px.</p>";window.innerWidth<t||window.innerHeight<i;)yield R(100);this.getDisplayElement().innerHTML=""}}if(void 0!==e.audio&&e.audio&&!window.hasOwnProperty("AudioContext")&&!window.hasOwnProperty("webkitAudioContext"))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}))}drawProgressBar(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>')}updateProgressBar(){this.setProgressBar(this.getProgress().percent_complete/100)}setProgressBar(e){e=Math.max(Math.min(1,e),0),document.querySelector("#jspsych-progressbar-inner").style.width=100*e+"%",this.progress_bar_amount=e}getProgressBarCompleted(){return this.progress_bar_amount}}return"undefined"!=typeof window&&window.hasOwnProperty("webkitAudioContext")&&!window.hasOwnProperty("AudioContext")&&(window.AudioContext=webkitAudioContext),e.JsPsych=V,e.initJsPsych=function(e){const t=new V(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((([e,t])=>[e,{get(){throw new l(t)}}])))),t},e.universalPluginParameters=_,Object.defineProperty(e,"__esModule",{value:!0}),e}({}),initJsPsych=jsPsychModule.initJsPsych;
|
|
1
|
+
var jsPsychModule=function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=r(t);function n(e){return n="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},n(e)}function s(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 i,n,s=[],o=!0,a=!1;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(s.push(i.value),!t||s.length!==t);o=!0);}catch(e){a=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(a)throw n}}return s}(e,t)||o(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 o(e,t){if(e){if("string"==typeof e)return a(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)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function l(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=o(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}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 s,a=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,s=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw s}}}}function c(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))}var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},h=function(e){var t=new Set;do{var r,i=l(Reflect.ownKeys(e));try{for(i.s();!(r=i.n()).done;){var n=r.value;t.add([e,n])}}catch(e){i.e(e)}finally{i.f()}}while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t},d=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.include,n=r.exclude,o=function(e){var t=function(t){return"string"==typeof t?e===t:t.test(e)};return i?i.some(t):!n||!n.some(t)},a=l(h(e.constructor.prototype));try{for(a.s();!(t=a.n()).done;){var c=s(t.value,2),u=c[0],d=c[1];if("constructor"!==d&&o(d)){var p=Reflect.getOwnPropertyDescriptor(u,d);p&&"function"==typeof p.value&&(e[d]=e[d].bind(e))}}}catch(e){a.e(e)}finally{a.f()}return e};class p extends Error{constructor(e="The global `jsPsych` variable is no longer available in jsPsych v7."){super(`${e} Please follow the migration guide at https://www.jspsych.org/7.0/support/migration-v7/ to update your experiment.`),this.name="MigrationError"}}function m(e){return[...new Set(e)]}function f(e){if(!e)return e;let t;if(Array.isArray(e)){t=[];for(const r of e)t.push(f(r));return t}if("object"==typeof e&&null!==e){t={};for(const r in e)e.hasOwnProperty(r)&&(t[r]=f(e[r]));return t}return e}window.jsPsych={get init(){throw new p("`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.")},get data(){throw new p},get randomization(){throw new p},get turk(){throw new p},get pluginAPI(){throw new p},get ALL_KEYS(){throw new p('jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.')},get NO_KEYS(){throw new p('jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.')}};var g,y=Object.freeze({__proto__:null,unique:m,deepCopy:f});class v{constructor(e=[]){this.values=e}sum(){let e=0;for(const t of this.values)e+=t;return e}mean(){return this.sum()/this.count()}median(){if(0===this.values.length)return;const 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]}min(){return Math.min.apply(null,this.values)}max(){return Math.max.apply(null,this.values)}count(){return this.values.length}variance(){const e=this.mean();let t=0;for(const r of this.values)t+=Math.pow(r-e,2);return t/(this.values.length-1)}sd(){const e=this.variance();return Math.sqrt(e)}frequencies(){const e={};for(const t of this.values)void 0===e[t]?e[t]=1:e[t]++;return e}all(e){for(const t of this.values)if(!e(t))return!1;return!0}subset(e){const t=[];for(const r of this.values)e(r)&&t.push(r);return new v(t)}}class w{constructor(e=[]){this.trials=e}push(e){return this.trials.push(e),this}join(e){return this.trials=this.trials.concat(e.values()),this}top(){return this.trials.length<=1?this:new w([this.trials[this.trials.length-1]])}first(e=1){if(e<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new w:(e>this.trials.length&&(e=this.trials.length),new w(this.trials.slice(0,e)))}last(e=1){if(e<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new w:(e>this.trials.length&&(e=this.trials.length),new w(this.trials.slice(this.trials.length-e,this.trials.length)))}values(){return this.trials}count(){return this.trials.length}readOnly(){return new w(f(this.trials))}addToAll(e){for(const t of this.trials)Object.assign(t,e);return this}addToLast(e){return 0!=this.trials.length&&Object.assign(this.trials[this.trials.length-1],e),this}filter(e){let t;t=Array.isArray(e)?f(e):f([e]);const r=[];for(const e of this.trials){let i=!1;for(const r of t){let t=!0;for(const i of Object.keys(r))void 0!==e[i]&&e[i]===r[i]||(t=!1);if(t){i=!0;break}}i&&r.push(e)}return new w(r)}filterCustom(e){return new w(this.trials.filter(e))}filterColumns(e){return new w(this.trials.map((t=>Object.fromEntries(e.filter((e=>e in t)).map((e=>[e,t[e]]))))))}select(e){const t=[];for(const r of this.trials)void 0!==r[e]&&t.push(r[e]);return new v(t)}ignore(e){Array.isArray(e)||(e=[e]);const t=f(this.trials);for(const r of t)for(const t of e)delete r[t];return new w(t)}uniqueNames(){const e=[];for(const t of this.trials)for(const r of Object.keys(t))e.includes(r)||e.push(r);return e}csv(){return function(e){const t="object"!=typeof e?JSON.parse(e):e;let r="",i="";const n=[];for(const e of t)for(const t in e){let e=t+"";e='"'+e.replace(/"/g,'""')+'",',n.includes(t)||(n.push(t),r+=e)}r=r.slice(0,-1),i+=r+"\r\n";for(const e of t){r="";for(const t of n){let i=void 0===e[t]?"":e[t];"object"==typeof i&&(i=JSON.stringify(i)),r+='"'+(i+"").replace(/"/g,'""')+'",'}r=r.slice(0,-1),i+=r+"\r\n"}return i}(this.trials)}json(e=!1){return e?JSON.stringify(this.trials,null,"\t"):JSON.stringify(this.trials)}localSave(e,t){let 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){const r=new Blob([e],{type:"text/plain"});let i="";i=void 0!==window.webkitURL?window.webkitURL.createObjectURL(r):window.URL.createObjectURL(r);const n=document.createElement("a");n.id="jspsych-download-as-text-link",n.style.display="none",n.download=t,n.href=i,n.click()}(r,t)}}class b{constructor(e){this.jsPsych=e,this.dataProperties={},this.reset()}reset(){this.allData=new w,this.interactionData=new w}get(){return this.allData}getInteractionData(){return this.interactionData}write(e){const t=this.jsPsych.getProgress(),r=this.jsPsych.getCurrentTrial(),i={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),i),this.dataProperties))}addProperties(e){this.allData.addToAll(e),this.dataProperties=Object.assign({},this.dataProperties,e)}addDataToLastTrial(e){this.allData.addToLast(e)}getDataByTimelineNode(e){return this.allData.filterCustom((t=>t.internal_node_id.slice(0,e.length)===e))}getLastTrialData(){return this.allData.top()}getLastTimelineData(){const e=this.getLastTrialData().select("internal_node_id").values[0];if(void 0===e)return new w;{const t=e.substr(0,e.lastIndexOf("-"));return this.getDataByTimelineNode(t)}}displayData(e="json"){"json"!=(e=e.toLowerCase())&&"csv"!=e&&(console.log("Invalid format declared for displayData function. Using json as default."),e="json");const t="json"===e?this.allData.json(!0):this.allData.csv();this.jsPsych.getDisplayElement().innerHTML='<pre id="jspsych-data-display"></pre>',document.getElementById("jspsych-data-display").textContent=t}urlVariables(){return void 0===this.query_string&&(this.query_string=function(){const e=window.location.search.substr(1).split("&"),t={};for(let r=0;r<e.length;++r){const i=e[r].split("=",2);1==i.length?t[i[0]]="":t[i[0]]=decodeURIComponent(i[1].replace(/\+/g," "))}return t}()),this.query_string}getURLVariable(e){return this.urlVariables()[e]}createInteractionListeners(){window.addEventListener("blur",(()=>{const e={event:"blur",trial:this.jsPsych.getProgress().current_trial_global,time:this.jsPsych.getTotalTime()};this.interactionData.push(e),this.jsPsych.getInitSettings().on_interaction_data_update(e)})),window.addEventListener("focus",(()=>{const e={event:"focus",trial:this.jsPsych.getProgress().current_trial_global,time:this.jsPsych.getTotalTime()};this.interactionData.push(e),this.jsPsych.getInitSettings().on_interaction_data_update(e)}));const e=()=>{const e={event:document.isFullScreen||document.webkitIsFullScreen||document.mozIsFullScreen||document.fullscreenElement?"fullscreenenter":"fullscreenexit",trial:this.jsPsych.getProgress().current_trial_global,time:this.jsPsych.getTotalTime()};this.interactionData.push(e),this.jsPsych.getInitSettings().on_interaction_data_update(e)};document.addEventListener("fullscreenchange",e),document.addEventListener("mozfullscreenchange",e),document.addEventListener("webkitfullscreenchange",e)}_customInsert(e){this.allData=new w(e)}_fullreset(){this.reset(),this.dataProperties={}}}class _{constructor(){this.hardwareConnected=!1,document.addEventListener("jspsych-activate",(e=>{this.hardwareConnected=!0}))}hardware(e){const t=new CustomEvent("jspsych",{detail:e});document.dispatchEvent(t)}}class x{constructor(e,t=!1,r=0){this.getRootElement=e,this.areResponsesCaseSensitive=t,this.minimumValidRt=r,this.listeners=new Set,this.heldKeys=new Set,this.areRootListenersRegistered=!1,d(this),this.registerRootListeners()}registerRootListeners(){if(!this.areRootListenersRegistered){const e=this.getRootElement();e&&(e.addEventListener("keydown",this.rootKeydownListener),e.addEventListener("keyup",this.rootKeyupListener),this.areRootListenersRegistered=!0)}}rootKeydownListener(e){for(const t of Array.from(this.listeners))t(e);this.heldKeys.add(this.toLowerCaseIfInsensitive(e.key))}toLowerCaseIfInsensitive(e){return this.areResponsesCaseSensitive?e:e.toLowerCase()}rootKeyupListener(e){this.heldKeys.delete(this.toLowerCaseIfInsensitive(e.key))}isResponseValid(e,t,r){return!(!t&&this.heldKeys.has(r))&&("ALL_KEYS"===e||"NO_KEYS"!==e&&e.includes(r))}getKeyboardResponse({callback_function:e,valid_responses:t="ALL_KEYS",rt_method:r="performance",persist:i,audio_context:n,audio_context_start_time:s,allow_held_key:o=!1,minimum_valid_rt:a=this.minimumValidRt}){"performance"!==r&&"audio"!==r&&(console.log('Invalid RT method specified in getKeyboardResponse. Defaulting to "performance" method.'),r="performance");const l="performance"===r?performance.now():1e3*s;this.registerRootListeners(),this.areResponsesCaseSensitive||"string"==typeof t||(t=t.map((e=>e.toLowerCase())));const c=s=>{const u=Math.round(("performance"==r?performance.now():1e3*n.currentTime)-l);if(u<a)return;const h=this.toLowerCaseIfInsensitive(s.key);this.isResponseValid(t,o,h)&&(s.preventDefault(),i||this.cancelKeyboardResponse(c),e({key:h,rt:u}))};return this.listeners.add(c),c}cancelKeyboardResponse(e){this.listeners.delete(e)}cancelAllKeyboardResponses(){this.listeners.clear()}compareKeys(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.ParameterType=void 0,(g=e.ParameterType||(e.ParameterType={}))[g.BOOL=0]="BOOL",g[g.STRING=1]="STRING",g[g.INT=2]="INT",g[g.FLOAT=3]="FLOAT",g[g.FUNCTION=4]="FUNCTION",g[g.KEY=5]="KEY",g[g.KEYS=6]="KEYS",g[g.SELECT=7]="SELECT",g[g.HTML_STRING=8]="HTML_STRING",g[g.IMAGE=9]="IMAGE",g[g.AUDIO=10]="AUDIO",g[g.VIDEO=11]="VIDEO",g[g.OBJECT=12]="OBJECT",g[g.COMPLEX=13]="COMPLEX",g[g.TIMELINE=14]="TIMELINE";const T={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}},k=[e.ParameterType.AUDIO,e.ParameterType.IMAGE,e.ParameterType.VIDEO];class j{constructor(e,t){this.useWebaudio=e,this.webaudioContext=t,this.video_buffers={},this.context=null,this.audio_buffers=[],this.preload_requests=[],this.img_cache={},this.preloadMap=new Map,this.microphone_recorder=null}getVideoBuffer(e){return this.video_buffers[e]}initAudio(){this.context=this.useWebaudio?this.webaudioContext:null}audioContext(){return null!==this.context&&"running"!==this.context.state&&this.context.resume(),this.context}getAudioBuffer(e){return new Promise(((t,r)=>{void 0===this.audio_buffers[e]||"tmp"==this.audio_buffers[e]?this.preloadAudio([e],(()=>{t(this.audio_buffers[e])}),(()=>{}),(e=>{r(e.error)})):t(this.audio_buffers[e])}))}preloadAudio(e,t=(()=>{}),r=(e=>{}),i=(e=>{})){e=m(e.flat());let n=0;if(0==e.length)return void t();const s=(s,o=1)=>{const a=new XMLHttpRequest;a.open("GET",s,!0),a.responseType="arraybuffer",a.onload=()=>{this.context.decodeAudioData(a.response,(i=>{this.audio_buffers[s]=i,n++,r(s),n==e.length&&t()}),(e=>{i({source:s,error:e})}))},a.onerror=function(e){let t=e;404==this.status&&(t="404"),i({source:s,error:t})},a.onloadend=function(e){404==this.status&&i({source:s,error:"404"})},a.send(),this.preload_requests.push(a)},o=(s,o=1)=>{const a=new Audio,l=()=>{this.audio_buffers[s]=a,n++,r(s),n==e.length&&t(),a.removeEventListener("canplaythrough",l)};a.addEventListener("canplaythrough",l),a.addEventListener("error",(function e(t){i({source:a.src,error:t}),a.removeEventListener("error",e)})),a.addEventListener("abort",(function e(t){i({source:a.src,error:t}),a.removeEventListener("abort",e)})),a.src=s,this.preload_requests.push(a)};for(const i of e)void 0!==this.audio_buffers[i]?(n++,r(i),n==e.length&&t()):(this.audio_buffers[i]="tmp",null!==this.audioContext()?s(i):o(i))}preloadImages(e,t=(()=>{}),r=(e=>{}),i=(e=>{})){e=m(e.flat());var n=0;if(0!==e.length)for(var s=0;s<e.length;s++){var o=new Image;o.onload=function(){n++,r(o.src),n===e.length&&t()},o.onerror=function(e){i({source:o.src,error:e})},o.src=e[s],this.img_cache[e[s]]=o,this.preload_requests.push(o)}else t()}preloadVideo(e,t=(()=>{}),r=(e=>{}),i=(e=>{})){e=m(e.flat());let n=0;if(0!==e.length)for(const s of e){const o=this.video_buffers,a=new XMLHttpRequest;a.open("GET",s,!0),a.responseType="blob",a.onload=function(){if(200===this.status||0===this.status){const i=this.response;o[s]=URL.createObjectURL(i),n++,r(s),n===e.length&&t()}},a.onerror=function(e){let t=e;404==this.status&&(t="404"),i({source:s,error:t})},a.onloadend=function(e){404==this.status&&i({source:s,error:"404"})},a.send(),this.preload_requests.push(a)}else t()}getAutoPreloadList(t){const r=Object.fromEntries(k.map((e=>[e,new Set]))),i=(e,t)=>{var n,s,o,a;if(void 0!==e.timeline)for(const r of e.timeline)i(r,null!==(n=e.type)&&void 0!==n?n:t);else if(null===(o=null!==(s=e.type)&&void 0!==s?s:t)||void 0===o?void 0:o.info){const{name:i,parameters:n}=(null!==(a=e.type)&&void 0!==a?a:t).info;this.preloadMap.has(i)||this.preloadMap.set(i,Object.fromEntries(Object.entries(n).filter((([e,{type:t,preload:r}])=>k.includes(t)&&(null==r||r))).map((([e,{type:t}])=>[e,t]))));for(const[t,n]of Object.entries(this.preloadMap.get(i))){const i=e[t],s=r[n];if("string"==typeof i)s.add(i);else if(Array.isArray(i))for(const e of i.flat())"string"==typeof e&&s.add(e)}}};return i({timeline:t}),{images:[...r[e.ParameterType.IMAGE]],audio:[...r[e.ParameterType.AUDIO]],video:[...r[e.ParameterType.VIDEO]]}}cancelPreloads(){for(const e of this.preload_requests)e.onload=()=>{},e.onerror=()=>{},e.oncanplaythrough=()=>{},e.onabort=()=>{};this.preload_requests=[]}initializeMicrophoneRecorder(e){const t=new MediaRecorder(e);this.microphone_recorder=t}getMicrophoneRecorder(){return this.microphone_recorder}}class P{dispatchEvent(e){document.body.dispatchEvent(e)}keyDown(e){this.dispatchEvent(new KeyboardEvent("keydown",{key:e}))}keyUp(e){this.dispatchEvent(new KeyboardEvent("keyup",{key:e}))}pressKey(e,t=0){t>0?setTimeout((()=>{this.keyDown(e),this.keyUp(e)}),t):(this.keyDown(e),this.keyUp(e))}clickTarget(e,t=0){t>0?setTimeout((()=>{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})))}fillTextInput(e,t,r=0){r>0?setTimeout((()=>{e.value=t}),r):e.value=t}getValidKey(e){const t=["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"," "];let r;if("NO_KEYS"==e)r=null;else if("ALL_KEYS"==e)r=t[Math.floor(Math.random()*t.length)];else{const t=e.flat();r=t[Math.floor(Math.random()*t.length)]}return r}mergeSimulationData(e,t){return Object.assign(Object.assign({},e),null==t?void 0:t.data)}ensureSimulationDataConsistency(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){const r=e.sequence_reps*e.frame_time*e.stimuli.length;t.rt<r&&(t.rt=null,t.response=null)}}}class E{constructor(){this.timeout_handlers=[]}setTimeout(e,t){const r=window.setTimeout(e,t);return this.timeout_handlers.push(r),r}clearAllTimeouts(){for(const e of this.timeout_handlers)clearTimeout(e);this.timeout_handlers=[]}}var O=["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 A(e){function t(){return e&&e.maxLength>1?function(){var t,i=!1;for(;!i;)(t=r()).length<=e.maxLength&&(i=!0);return t}():r()}function r(){return O[i(O.length)]}function i(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 n=e.min+i(e.max+1-e.min),s=[],o="",a=0,l=0;l<n*e.wordsPerString;l++)a===e.wordsPerString-1?o+=e.formatter(t(),a):o+=e.formatter(t(),a)+e.separator,a++,(l+1)%e.wordsPerString==0&&(s.push(o),o="",a=0);return"string"==typeof e.join&&(s=s.join(e.join)),s}var I=A;A.wordList=O;var S={exports:{}};(function(e,t,r){function i(e){var t,r=this,i=(t=4022871197,function(e){e=String(e);for(var r=0;r<e.length;r++){var i=.02519603282416938*(t+=e.charCodeAt(r));i-=t=i>>>0,t=(i*=t)>>>0,t+=4294967296*(i-=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=i(" "),r.s1=i(" "),r.s2=i(" "),r.s0-=i(e),r.s0<0&&(r.s0+=1),r.s1-=i(e),r.s1<0&&(r.s1+=1),r.s2-=i(e),r.s2<0&&(r.s2+=1),i=null}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function o(e,t){var r=new i(e),o=t&&t.state,a=r.next;return a.int32=function(){return 4294967296*r.next()|0},a.double=function(){return a()+11102230246251565e-32*(2097152*a()|0)},a.quick=a,o&&("object"==n(o)&&s(o,r),a.state=function(){return s(r,{})}),a}t&&t.exports?t.exports=o:r&&r.amd?r((function(){return o})):this.alea=o})(0,S,!1);var L={exports:{}};!function(e){!function(e,t,r){function i(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var i=0;i<r.length+64;i++)t.x^=0|r.charCodeAt(i),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function o(e,t){var r=new i(e),o=t&&t.state,a=function(){return(r.next()>>>0)/4294967296};return a.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},a.int32=r.next,a.quick=a,o&&("object"==n(o)&&s(o,r),a.state=function(){return s(r,{})}),a}t&&t.exports?t.exports=o:r&&r.amd?r((function(){return o})):this.xor128=o}(0,e,!1)}(L);var M={exports:{}};!function(e){!function(e,t,r){function i(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:r+=e;for(var i=0;i<r.length+64;i++)t.x^=0|r.charCodeAt(i),i==r.length&&(t.d=t.x<<10^t.x>>>4),t.next()}function s(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function o(e,t){var r=new i(e),o=t&&t.state,a=function(){return(r.next()>>>0)/4294967296};return a.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},a.int32=r.next,a.quick=a,o&&("object"==n(o)&&s(o,r),a.state=function(){return s(r,{})}),a}t&&t.exports?t.exports=o:r&&r.amd?r((function(){return o})):this.xorwow=o}(0,e,!1)}(M);var D={exports:{}};!function(e){!function(e,t,r){function i(e){var t=this;t.next=function(){var e,r,i=t.x,n=t.i;return e=i[n],r=(e^=e>>>7)^e<<24,r^=(e=i[n+1&7])^e>>>10,r^=(e=i[n+3&7])^e>>>3,r^=(e=i[n+4&7])^e<<7,e=i[n+7&7],r^=(e^=e<<13)^e<<9,i[n]=r,t.i=n+1&7,r},function(e,t){var r,i=[];if(t===(0|t))i[0]=t;else for(t=""+t,r=0;r<t.length;++r)i[7&r]=i[7&r]<<15^t.charCodeAt(r)+i[r+1&7]<<13;for(;i.length<8;)i.push(0);for(r=0;r<8&&0===i[r];++r);for(8==r&&(i[7]=-1),e.x=i,e.i=0,r=256;r>0;--r)e.next()}(t,e)}function n(e,t){return t.x=e.x.slice(),t.i=e.i,t}function s(e,t){null==e&&(e=+new Date);var r=new i(e),s=t&&t.state,o=function(){return(r.next()>>>0)/4294967296};return o.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=r.next,o.quick=o,s&&(s.x&&n(s,r),o.state=function(){return n(r,{})}),o}t&&t.exports?t.exports=s:r&&r.amd?r((function(){return s})):this.xorshift7=s}(0,e,!1)}(D);var C={exports:{}};!function(e){!function(e,t,r){function i(e){var t=this;t.next=function(){var e,r,i=t.w,n=t.X,s=t.i;return t.w=i=i+1640531527|0,r=n[s+34&127],e=n[s=s+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=n[s]=r^e,t.i=s,r+(i^i>>>16)|0},function(e,t){var r,i,n,s,o,a=[],l=128;for(t===(0|t)?(i=t,t=null):(t+="\0",i=0,l=Math.max(l,t.length)),n=0,s=-32;s<l;++s)t&&(i^=t.charCodeAt((s+32)%t.length)),0===s&&(o=i),i^=i<<10,i^=i>>>15,i^=i<<4,i^=i>>>13,s>=0&&(o=o+1640531527|0,n=0==(r=a[127&s]^=i+o)?n+1:0);for(n>=128&&(a[127&(t&&t.length||0)]=-1),n=127,s=512;s>0;--s)i=a[n+34&127],r=a[n=n+1&127],i^=i<<13,r^=r<<17,i^=i>>>15,r^=r>>>12,a[n]=i^r;e.w=o,e.X=a,e.i=n}(t,e)}function n(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function s(e,t){null==e&&(e=+new Date);var r=new i(e),s=t&&t.state,o=function(){return(r.next()>>>0)/4294967296};return o.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=r.next,o.quick=o,s&&(s.X&&n(s,r),o.state=function(){return n(r,{})}),o}t&&t.exports?t.exports=s:r&&r.amd?r((function(){return s})):this.xor4096=s}(0,e,!1)}(C);var N={exports:{}};!function(e){!function(e,t,r){function i(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,i=t.d,n=t.a;return e=e<<25^e>>>7^r,r=r-i|0,i=i<<24^i>>>8^n,n=n-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-i|0,t.d=i<<16^r>>>16^n,t.a=n-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):r+=e;for(var i=0;i<r.length+20;i++)t.b^=0|r.charCodeAt(i),t.next()}function s(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function o(e,t){var r=new i(e),o=t&&t.state,a=function(){return(r.next()>>>0)/4294967296};return a.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},a.int32=r.next,a.quick=a,o&&("object"==n(o)&&s(o,r),a.state=function(){return s(r,{})}),a}t&&t.exports?t.exports=o:r&&r.amd?r((function(){return o})):this.tychei=o}(0,e,!1)}(N);var R={exports:{}};!function(e){!function(t,r,s){var o,a=256,l=s.pow(a,6),c=s.pow(2,52),u=2*c,h=255;function d(e,i,n){var h=[],d=g(f((i=1==i?{entropy:!0}:i||{}).entropy?[e,y(r)]:null==e?function(){try{var e;return o&&(e=o.randomBytes)?e=e(a):(e=new Uint8Array(a),(t.crypto||t.msCrypto).getRandomValues(e)),y(e)}catch(e){var i=t.navigator,n=i&&i.plugins;return[+new Date,t,n,t.screen,y(r)]}}():e,3),h),v=new p(h),w=function(){for(var e=v.g(6),t=l,r=0;e<c;)e=(e+r)*a,t*=a,r=v.g(1);for(;e>=u;)e/=2,t/=2,r>>>=1;return(e+r)/t};return w.int32=function(){return 0|v.g(4)},w.quick=function(){return v.g(4)/4294967296},w.double=w,g(y(v.S),r),(i.pass||n||function(e,t,r,i){return i&&(i.S&&m(i,v),e.state=function(){return m(v,{})}),r?(s.random=e,t):e})(w,d,"global"in i?i.global:this==s,i.state)}function p(e){var t,r=e.length,i=this,n=0,s=i.i=i.j=0,o=i.S=[];for(r||(e=[r++]);n<a;)o[n]=n++;for(n=0;n<a;n++)o[n]=o[s=h&s+e[n%r]+(t=o[n])],o[s]=t;(i.g=function(e){for(var t,r=0,n=i.i,s=i.j,o=i.S;e--;)t=o[n=h&n+1],r=r*a+o[h&(o[n]=o[s=h&s+t])+(o[s]=t)];return i.i=n,i.j=s,r})(a)}function m(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function f(e,t){var r,i=[],s=n(e);if(t&&"object"==s)for(r in e)try{i.push(f(e[r],t-1))}catch(e){}return i.length?i:"string"==s?e:e+"\0"}function g(e,t){for(var r,i=e+"",n=0;n<i.length;)t[h&n]=h&(r^=19*t[h&n])+i.charCodeAt(n++);return y(t)}function y(e){return String.fromCharCode.apply(0,e)}if(g(s.random(),r),e.exports){e.exports=d;try{o=i.default}catch(e){}}else s.seedrandom=d}("undefined"!=typeof self?self:u,[],Math)}(R);var V=S.exports,q=L.exports,z=M.exports,K=D.exports,U=C.exports,F=N.exports,Y=R.exports;Y.alea=V,Y.xor128=q,Y.xorwow=z,Y.xorshift7=K,Y.xor4096=U,Y.tychei=F;var B=Y;function W(e,t,r=!1){const i=Array.isArray(e),n=Array.isArray(t);if(i)if(n){if(e.length!=t.length)if(console.warn("Unclear parameters given to randomization.repeat. Items and repetitions are unequal lengths. Behavior may not be as expected."),t.length<e.length){let r=[];for(let i=0;i<e.length;i++)r.push(t);t=r}else t=t.slice(0,e.length)}else{let r=[];for(let i=0;i<e.length;i++)r.push(t);t=r}else n?(t=[t[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],t=[t]);let s=[];for(let r=0;r<e.length;r++)for(let i=0;i<t[r];i++)null==e[r]||"object"!=typeof e[r]?s.push(e[r]):s.push(Object.assign({},e[r]));let o=J(s);return r&&(o=function(e){const t={};for(const r of e)for(const e of Object.keys(r))void 0===t[e]&&(t[e]=[]),t[e].push(r[e]);return t}(o)),o}function J(e){Array.isArray(e)||console.error("Argument to shuffle() must be an array.");const t=e.slice(0);let r,i,n=t.length;for(;n;)i=Math.floor(Math.random()*n--),r=t[n],t[n]=t[i],t[i]=r;return t}function G(e,t=!1){const r=e.length;if(1==r)return console.warn("shuffleAlternateGroups() was called with only one group. Defaulting to simple shuffle."),J(e[0]);let i=[];for(let e=0;e<r;e++)i.push(e);t&&(i=J(i));const n=[];let s=null;for(let t=0;t<r;t++)s=null===s?e[t].length:Math.min(s,e[t].length),n.push(J(e[t]));const o=[];for(let e=0;e<s;e++)for(let t=0;t<i.length;t++)o.push(n[i[t]][e]);return o}function H(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."),J(e).slice(0,t)}function X(e,t,r){Array.isArray(e)||console.error("First argument to sampleWithReplacement() must be an array");const i=[];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.");let t=0;for(const e of r)t+=e;for(const e of r)i.push(e/t)}else for(let t=0;t<e.length;t++)i.push(1/e.length);const n=[i[0]];for(let e=1;e<i.length;e++)n.push(i[e]+n[e-1]);const s=[];for(let r=0;r<t;r++){const t=Math.random();let r=0;for(;t>n[r];)r++;s.push(e[r])}return s}function $(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 Q(e){return-Math.log(Math.random())/e}var Z=Object.freeze({__proto__:null,setSeed:function(e){if(!e){e=B().int32().toString()}return B(e,{global:!0}),e},repeat:W,shuffle:J,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});const r=J(e);for(let e=0;e<r.length-1;e++)if(t(r[e],r[e+1])){let i=Math.floor(Math.random()*(r.length-2))+1;for(;t(r[e+1],r[i])||t(r[e+1],r[i+1])||t(r[e+1],r[i-1]);)i=Math.floor(Math.random()*(r.length-2))+1;const n=r[i];r[i]=r[e+1],r[e+1]=n}return r},shuffleAlternateGroups:G,sampleWithoutReplacement:H,sampleWithReplacement:X,factorial:function(e,t=1,r=!1){let i=[{}];for(const[t,r]of Object.entries(e)){const e=[];for(const n of r)for(const r of i)e.push(Object.assign(Object.assign({},r),{[t]:n}));i=e}return W(i,t,r)},randomID:function(e=32){let t="";const r="0123456789abcdefghjklmnopqrstuvwxyz";for(let i=0;i<e;i++)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:$,sampleExponential:Q,sampleExGaussian:function(e,t,r,i=!1){let n=$(e,t)+Q(r);if(i)for(;n<=0;)n=$(e,t)+Q(r);return n},randomWords:function(e){return I(e)}});function ee(){const 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(/[\]]/,"\\]");const 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(i){e[i]=unescape(t(r,i))})),e.previewMode="ASSIGNMENT_ID_NOT_AVAILABLE"==e.assignmentId,e.outsideTurk=!e.previewMode&&""===e.hitId&&""==e.assignmentId&&""==e.workerId,e}var te=Object.freeze({__proto__:null,turkInfo:ee,submitToTurk:function(e){const t=ee(),r=t.assignmentId,i=t.turkSubmitTo;if(!r||!i)return;const n=document.createElement("form");n.method="POST",n.action=i+"/mturk/externalSubmit?assignmentId="+r;for(const t in e)if(e.hasOwnProperty(t)){const r=document.createElement("input");r.type="hidden",r.name=t,r.id=t,r.value=e[t],n.appendChild(r)}document.body.appendChild(n),n.submit()}});class re{constructor(e,t,r,i){if(this.jsPsych=e,this.progress={current_location:-1,current_variable_set:0,current_repetition:0,current_iteration:0,done:!1},this.parent_node=r,this.relative_id=void 0===r?0:i,void 0!==t.timeline){this.timeline_parameters={timeline:[],loop_function:t.loop_function,conditional_function:t.conditional_function,sample:t.sample,randomize_order:void 0!==t.randomize_order&&t.randomize_order,repetitions:void 0===t.repetitions?1:t.repetitions,timeline_variables:void 0===t.timeline_variables?[{}]:t.timeline_variables,on_timeline_finish:t.on_timeline_finish,on_timeline_start:t.on_timeline_start},this.setTimelineVariablesOrder();var n=Object.assign({},t);delete n.timeline,delete n.conditional_function,delete n.loop_function,delete n.randomize_order,delete n.repetitions,delete n.timeline_variables,delete n.sample,delete n.on_timeline_start,delete n.on_timeline_finish,this.node_trial_data=n;for(var s=0;s<t.timeline.length;s++){var o=Object.assign({},n,t.timeline[s]);if("object"==typeof n.data&&"object"==typeof t.timeline[s].data){var a=Object.assign({},n.data,t.timeline[s].data);o.data=a}this.timeline_parameters.timeline.push(new re(this.jsPsych,o,this,s))}}else void 0===t.type&&console.error('Trial level node is missing the "type" parameter. The parameters for the node are: '+JSON.stringify(t)),this.trial_parameters=Object.assign({},t)}trial(){return void 0===this.timeline_parameters?f(this.trial_parameters):this.progress.current_location>=this.timeline_parameters.timeline.length?null:this.timeline_parameters.timeline[this.progress.current_location].trial()}markCurrentTrialComplete(){void 0===this.timeline_parameters?this.progress.done=!0:this.timeline_parameters.timeline[this.progress.current_location].markCurrentTrialComplete()}nextRepetiton(){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()}setTimelineVariablesOrder(){const 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=X(t,e.sample.size,e.sample.weights):"without-replacement"==e.sample.type?t=H(t,e.sample.size):"fixed-repetitions"==e.sample.type?t=W(t,e.sample.size,!1):"alternate-groups"==e.sample.type?t=G(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=J(t)),this.progress.order=t}}nextSet(){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()}advance(){const 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 i=t.conditional_function();if(r.call_immediate=!1,0==i)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 n=!1;e.current_location<t.timeline.length&&0==n;){if(!t.timeline[e.current_location].advance())return n=!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))}}isComplete(){return this.progress.done}getTimelineVariableValue(e){if(void 0!==this.timeline_parameters)return this.timeline_parameters.timeline_variables[this.progress.order[this.progress.current_variable_set]][e]}findTimelineVariable(e){var t=this.getTimelineVariableValue(e);return void 0===t?void 0!==this.parent_node?this.parent_node.findTimelineVariable(e):void 0:t}timelineVariable(e){if(void 0===this.timeline_parameters)return this.findTimelineVariable(e);var t=Math.max(0,this.progress.current_location);return t==this.timeline_parameters.timeline.length&&(t-=1),this.timeline_parameters.timeline[t].timelineVariable(e)}allTimelineVariables(){for(var e=this.allTimelineVariablesNames(),t={},r=0;r<e.length;r++)t[e[r]]=this.timelineVariable(e[r]);return t}allTimelineVariablesNames(e=[]){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}length(){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}percentComplete(){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}reset(){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()}end(){this.progress.done=!0}endActiveNode(){void 0===this.timeline_parameters?(this.end(),this.parent_node.end()):this.timeline_parameters.timeline[this.progress.current_location].endActiveNode()}ID(){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)}activeID(){return void 0===this.timeline_parameters?this.ID():this.timeline_parameters.timeline[this.progress.current_location].activeID()}generatedData(){return this.jsPsych.data.getDataByTimelineNode(this.ID())}trialsOfType(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 i=this.timeline_parameters.timeline[r].trialsOfType(e);t=t.concat(i)}return t}insert(e){void 0===this.timeline_parameters?console.error("Cannot add new trials to a trial-level node."):this.timeline_parameters.timeline.push(new re(this.jsPsych,Object.assign(Object.assign({},this.node_trial_data),e),this,this.timeline_parameters.timeline.length))}}function ie(e){return new Promise((t=>setTimeout(t,e)))}class ne{constructor(e){this.extensions={},this.turk=te,this.randomization=Z,this.utils=y,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:()=>{},on_trial_start:()=>{},on_trial_finish:()=>{},on_data_update:()=>{},on_interaction_data_update:()=>{},on_close:()=>{},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,d(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 b(this),this.pluginAPI=function(e){const t=e.getInitSettings();return Object.assign({},...[new x(e.getDisplayContainerElement,t.case_sensitive_responses,t.minimum_valid_rt),new E,new j(t.use_webaudio,e.webaudio_context),new _,new P].map((e=>d(e))))}(this);for(const t of e.extensions)this.extensions[t.type.info.name]=new t.type(this);this.pluginAPI.initAudio()}version(){return"7.2.0"}run(e){return c(this,void 0,void 0,(function*(){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 re(this,{timeline:e}),yield this.prepareDom(),yield this.checkExclusions(this.opts.exclusions),yield this.loadExtensions(this.opts.extensions),document.documentElement.setAttribute("jspsych","present"),this.startExperiment(),yield this.finished}))}simulate(e,t="data-only",r={}){return c(this,void 0,void 0,(function*(){this.simulation_mode=t,this.simulation_options=r,yield this.run(e)}))}getProgress(){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()}}getStartTime(){return this.exp_start_time}getTotalTime(){return void 0===this.exp_start_time?0:(new Date).getTime()-this.exp_start_time.getTime()}getDisplayElement(){return this.DOM_target}getDisplayContainerElement(){return this.DOM_container}finishTrial(e={}){if(this.current_trial_finished)return;this.current_trial_finished=!0,void 0!==this.current_trial.css_classes&&Array.isArray(this.current_trial.css_classes)&&this.DOM_target.classList.remove(...this.current_trial.css_classes),this.data.write(e);const t=this.data.get().filter({trial_index:this.global_trial_index}).values()[0],r=this.current_trial;if("object"==typeof r.save_trial_parameters)for(const e of Object.keys(r.save_trial_parameters)){const i=r.save_trial_parameters[e];!0===i&&(void 0===r[e]?console.warn(`Invalid parameter specified in save_trial_parameters. Trial has no property called "${e}".`):"function"==typeof r[e]?t[e]=r[e].toString():t[e]=r[e]),!1===i&&"internal_node_id"!==e&&"trial_index"!==e&&delete t[e]}if(Array.isArray(r.extensions))for(const e of r.extensions){const r=this.extensions[e.type.info.name].on_finish(e.params);Object.assign(t,r)}this.internal.call_immediate=!0,"function"==typeof r.on_finish&&r.on_finish(t),this.opts.on_trial_finish(t),this.opts.on_data_update(t),this.internal.call_immediate=!1,"data-only"===this.simulation_mode?this.nextTrial():null===typeof r.post_trial_gap||void 0===r.post_trial_gap?this.opts.default_iti>0?setTimeout(this.nextTrial,this.opts.default_iti):this.nextTrial():r.post_trial_gap>0?setTimeout(this.nextTrial,r.post_trial_gap):this.nextTrial()}endExperiment(e="",t={}){this.timeline.end_message=e,this.timeline.end(),this.pluginAPI.cancelAllKeyboardResponses(),this.pluginAPI.clearAllTimeouts(),this.finishTrial(t)}endCurrentTimeline(){this.timeline.endActiveNode()}getCurrentTrial(){return this.current_trial}getInitSettings(){return this.opts}getCurrentTimelineNodeID(){return this.timeline.activeID()}timelineVariable(e,t=!1){return this.internal.call_immediate||!0===t?this.timeline.timelineVariable(e):{timelineVariablePlaceholder:!0,timelineVariableFunction:()=>this.timeline.timelineVariable(e)}}getAllTimelineVariables(){return this.timeline.allTimelineVariables()}addNodeToEndOfTimeline(e,t){this.timeline.insert(e)}pauseExperiment(){this.paused=!0}resumeExperiment(){this.paused=!1,this.waiting&&(this.waiting=!1,this.nextTrial())}loadFail(e){e=e||"<p>The experiment failed to load.</p>",this.DOM_target.innerHTML=e}getSafeModeStatus(){return this.file_protocol}getTimeline(){return this.timelineDescription}prepareDom(){return c(this,void 0,void 0,(function*(){"complete"!==document.readyState&&(yield new Promise((e=>{window.addEventListener("load",e)})));const e=this.opts;if(void 0===e.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%",e.display_element=document.querySelector("body")}else{const t=e.display_element instanceof Element?e.display_element:document.querySelector("#"+e.display_element);null===t?console.error("The display_element specified in initJsPsych() does not exist in the DOM."):e.display_element=t}e.display_element.innerHTML='<div class="jspsych-content-wrapper"><div id="jspsych-content"></div></div>',this.DOM_container=e.display_element,this.DOM_target=document.querySelector("#jspsych-content"),null!==e.experiment_width&&(this.DOM_target.style.width=e.experiment_width+"px"),e.display_element.tabIndex=0,-1===e.display_element.className.indexOf("jspsych-display-element")&&(e.display_element.className+=" jspsych-display-element"),this.DOM_target.className+="jspsych-content",this.data.createInteractionListeners(),window.addEventListener("beforeunload",e.on_close)}))}loadExtensions(e){return c(this,void 0,void 0,(function*(){try{yield Promise.all(e.map((e=>this.extensions[e.type.info.name].initialize(e.params||{}))))}catch(e){throw console.error(e),new Error(e)}}))}startExperiment(){this.finished=new Promise((e=>{this.resolveFinishedPromise=e})),!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())}finishExperiment(){const e=this.opts.on_finish(this.data.get()),t=()=>{void 0!==this.timeline.end_message&&(this.DOM_target.innerHTML=this.timeline.end_message),this.resolveFinishedPromise()};e?Promise.resolve(e).then(t):t()}nextTrial(){if(this.paused)return void(this.waiting=!0);this.global_trial_index++,this.timeline.markCurrentTrialComplete();const 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())}doTrial(e){if(this.current_trial=e,this.current_trial_finished=!1,this.evaluateTimelineVariables(e),"string"==typeof e.type)throw new p("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({},d(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))for(const t of e.extensions)this.extensions[t.type.info.name].on_start(t.params);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)&&this.DOM_target.classList.add(...e.css_classes));const t=()=>{if("function"==typeof e.on_load&&e.on_load(),Array.isArray(e.extensions))for(const t of e.extensions)this.extensions[t.type.info.name].on_load(t.params)};let r;if(this.simulation_mode||(r=e.type.trial(this.DOM_target,e,t)),this.simulation_mode)if(e.type.simulate){let i;e.simulation_options||(i=this.simulation_options.default),e.simulation_options&&("string"==typeof e.simulation_options?this.simulation_options[e.simulation_options]?i=this.simulation_options[e.simulation_options]:this.simulation_options.default?(console.log(`No matching simulation options found for "${e.simulation_options}". Using "default" options.`),i=this.simulation_options.default):(console.log(`No matching simulation options found for "${e.simulation_options}" and no "default" options provided. Using the default values provided by the plugin.`),i={}):i=e.simulation_options),i=this.utils.deepCopy(i),i=this.replaceFunctionsWithValues(i,null),r=!1===(null==i?void 0:i.simulate)?e.type.trial(this.DOM_target,e,t):e.type.simulate(e,(null==i?void 0:i.mode)||this.simulation_mode,i,t)}else r=e.type.trial(this.DOM_target,e,t);r&&"function"==typeof r.then||this.simulation_mode||t(),this.internal.call_immediate=!1}evaluateTimelineVariables(e){for(const t of Object.keys(e))"object"==typeof e[t]&&null!==e[t]&&void 0!==e[t].timelineVariablePlaceholder&&(e[t]=e[t].timelineVariableFunction()),"object"==typeof e[t]&&null!==e[t]&&this.evaluateTimelineVariables(e[t])}evaluateFunctionParameters(t){this.internal.call_immediate=!0;for(const r of Object.keys(t))"type"!==r&&(void 0!==T[r]&&T[r].type!==e.ParameterType.FUNCTION&&(t[r]=this.replaceFunctionsWithValues(t[r],null)),void 0!==t.type.info.parameters[r]&&t.type.info.parameters[r].type!==e.ParameterType.FUNCTION&&(t[r]=this.replaceFunctionsWithValues(t[r],t.type.info.parameters[r])));this.internal.call_immediate=!1}replaceFunctionsWithValues(t,r){if(null===t)return t;if(Array.isArray(t))for(let e=0;e<t.length;e++)t[e]=this.replaceFunctionsWithValues(t[e],r);else if("object"==typeof t)if(null!==r&&r.nested)for(const i of Object.keys(t))"object"==typeof r.nested[i]&&r.nested[i].type!==e.ParameterType.FUNCTION&&(t[i]=this.replaceFunctionsWithValues(t[i],r.nested[i]));else for(const e of Object.keys(t))"type"!==e&&(t[e]=this.replaceFunctionsWithValues(t[e],null));else if("function"==typeof t)return t();return t}setDefaultValues(t){for(const r in t.type.info.parameters)t.type.info.parameters[r].type===e.ParameterType.COMPLEX?!0===t.type.info.parameters[r].array&&t[r].forEach((function(e,i){for(const e in t.type.info.parameters[r].nested)void 0!==t[r][i][e]&&null!==t[r][i][e]||(void 0===t.type.info.parameters[r].nested[e].default?console.error("You must specify a value for the "+e+" parameter (nested in the "+r+" parameter) in the "+t.type+" plugin."):t[r][i][e]=t.type.info.parameters[r].nested[e].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)}checkExclusions(e){return c(this,void 0,void 0,(function*(){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){const t=e.min_width||0,r=e.min_height||0;if(window.innerWidth<t||window.innerHeight<r){for(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 "+t+"px. Your current width is "+window.innerWidth+"px.</p><p>The minimum height is "+r+"px. Your current height is "+window.innerHeight+"px.</p>";window.innerWidth<t||window.innerHeight<r;)yield ie(100);this.getDisplayElement().innerHTML=""}}if(void 0!==e.audio&&e.audio&&!window.hasOwnProperty("AudioContext")&&!window.hasOwnProperty("webkitAudioContext"))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}))}drawProgressBar(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>')}updateProgressBar(){this.setProgressBar(this.getProgress().percent_complete/100)}setProgressBar(e){e=Math.max(Math.min(1,e),0),document.querySelector("#jspsych-progressbar-inner").style.width=100*e+"%",this.progress_bar_amount=e}getProgressBarCompleted(){return this.progress_bar_amount}}return"undefined"!=typeof window&&window.hasOwnProperty("webkitAudioContext")&&!window.hasOwnProperty("AudioContext")&&(window.AudioContext=webkitAudioContext),e.JsPsych=ne,e.initJsPsych=function(e){const t=new ne(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((([e,t])=>[e,{get(){throw new p(t)}}])))),t},e.universalPluginParameters=T,Object.defineProperty(e,"__esModule",{value:!0}),e}({},require$$0),initJsPsych=jsPsychModule.initJsPsych;
|
|
2
2
|
//# sourceMappingURL=index.browser.min.js.map
|