jspsych 8.2.1 → 8.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- var jsPsychModule=function(V){"use strict";var N=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function W(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}const Ke=r=>{const e=new Set;do for(const t of Reflect.ownKeys(r))e.add([r,t]);while((r=Reflect.getPrototypeOf(r))&&r!==Object.prototype);return e};var Ge=(r,{include:e,exclude:t}={})=>{const n=s=>{const u=l=>typeof l=="string"?s===l:l.test(s);return e?e.some(u):t?!t.some(u):!0};for(const[s,u]of Ke(r.constructor.prototype)){if(u==="constructor"||!n(u))continue;const l=Reflect.getOwnPropertyDescriptor(s,u);l&&typeof l.value=="function"&&(r[u]=r[u].bind(r))}return r},Y=W(Ge),Fe="8.2.1",fe=(r,e,t)=>new Promise((n,s)=>{var u=i=>{try{a(t.next(i))}catch(o){s(o)}},l=i=>{try{a(t.throw(i))}catch(o){s(o)}},a=i=>i.done?n(i.value):Promise.resolve(i.value).then(u,l);a((t=t.apply(r,e)).next())});class B{constructor(e,t){this.dependencies=e,this.extensionsConfiguration=t,this.extensions=Object.fromEntries(t.map(n=>[B.getExtensionNameByClass(n.type),this.dependencies.instantiateExtension(n.type)]))}static getExtensionNameByClass(e){return e.info.name}getExtensionInstanceByClass(e){return this.extensions[B.getExtensionNameByClass(e)]}initializeExtensions(){return fe(this,null,function*(){yield Promise.all(this.extensionsConfiguration.map(({type:e,params:t={}})=>{this.getExtensionInstanceByClass(e).initialize(t);const n=e.info;!("version"in n)&&!("data"in n)?console.warn(n.name,"is missing the 'version' and 'data' fields. Please update extension as 'version' and 'data' will be required in v9. See https://www.jspsych.org/latest/developers/extension-development/ for more details."):"version"in n?"data"in n||console.warn(n.name,"is missing the 'data' field. Please update extension as 'data' will be required in v9. See https://www.jspsych.org/latest/developers/extension-development/ for more details."):console.warn(n.name,"is missing the 'version' field. Please update extension as 'version' will be required in v9. See https://www.jspsych.org/latest/developers/extension-development/ for more details.")}))})}onStart(e=[]){var t;for(const{type:n,params:s}of e)(t=this.getExtensionInstanceByClass(n))==null||t.on_start(s)}onLoad(e=[]){var t;for(const{type:n,params:s}of e)(t=this.getExtensionInstanceByClass(n))==null||t.on_load(s)}onFinish(){return fe(this,arguments,function*(e=[]){const t=yield Promise.all(e.map(({type:s,params:u})=>{var l;return Promise.resolve((l=this.getExtensionInstanceByClass(s))==null?void 0:l.on_finish(u))})),n=e.length?{extension_type:e.map(({type:s})=>s.info.name),extension_version:e.map(({type:s})=>s.info.version)}:{};return t.unshift(n),Object.assign({},...t)})}}function U(r){return[...new Set(r)]}function j(r){if(!r)return r;let e;if(Array.isArray(r)){e=[];for(const t of r)e.push(j(t));return e}else if(typeof r=="object"&&r!==null){e={};for(const t in r)r.hasOwnProperty(t)&&(e[t]=j(r[t]));return e}else return r}function K(r,e){let t={};for(const n in r)r.hasOwnProperty(n)&&(typeof r[n]=="object"&&e.hasOwnProperty(n)?t[n]=K(r[n],e[n]):t[n]=r[n]);for(const n in e)e.hasOwnProperty(n)&&(t.hasOwnProperty(n)&&typeof e[n]=="object"?t[n]=K(t[n],e[n]):t[n]=e[n]);return t}var Je=Object.freeze({__proto__:null,deepCopy:j,deepMerge:K,unique:U});class X{constructor(e=[]){this.values=e}sum(){let e=0;for(const t of this.values)e+=t;return e}mean(){let e=0,t=0;for(const n of this.values)typeof n!="undefined"&&n!==null&&(e+=n,t++);if(t!==0)return e/t}median(){if(this.values.length===0)return;const e=this.values.slice(0).sort(function(n,s){return n-s}),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 n of this.values)t+=Math.pow(n-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)typeof e[t]=="undefined"?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 n of this.values)e(n)&&t.push(n);return new X(t)}}function We(r,e){const t=new Blob([r],{type:"text/plain"});let n="";typeof window.webkitURL!="undefined"?n=window.webkitURL.createObjectURL(t):n=window.URL.createObjectURL(t);const s=document.createElement("a");s.id="jspsych-download-as-text-link",s.style.display="none",s.download=e,s.href=n,s.click()}function Ye(r){const e=typeof r!="object"?JSON.parse(r):r;let t="",n="";const s=[];for(const u of e)for(const l in u){let a=l+"";a='"'+a.replace(/"/g,'""')+'",',s.includes(l)||(s.push(l),t+=a)}t=t.slice(0,-1),n+=t+`\r
2
- `;for(const u of e){t="";for(const l of s){let a=typeof u[l]=="undefined"?"":u[l];typeof a=="object"&&(a=JSON.stringify(a));const i=a+"";t+='"'+i.replace(/"/g,'""')+'",'}t=t.slice(0,-1),n+=t+`\r
3
- `}return n}function Xe(){const r=window.location.search.substr(1).split("&"),e={};for(let t=0;t<r.length;++t){const n=r[t].split("=",2);n.length==1?e[n[0]]="":e[n[0]]=decodeURIComponent(n[1].replace(/\+/g," "))}return e}class b{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 b([this.trials[this.trials.length-1]])}first(e=1){if(e<1)throw`You must query with a positive nonzero integer. Please use a
1
+ var jsPsychModule=function(V){"use strict";var N=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function W(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}const Fe=r=>{const e=new Set;do for(const t of Reflect.ownKeys(r))e.add([r,t]);while((r=Reflect.getPrototypeOf(r))&&r!==Object.prototype);return e};var Je=(r,{include:e,exclude:t}={})=>{const n=s=>{const l=u=>typeof u=="string"?s===u:u.test(s);return e?e.some(l):t?!t.some(l):!0};for(const[s,l]of Fe(r.constructor.prototype)){if(l==="constructor"||!n(l))continue;const u=Reflect.getOwnPropertyDescriptor(s,l);u&&typeof u.value=="function"&&(r[l]=r[l].bind(r))}return r},Y=W(Je),We="8.2.2",fe=(r,e,t)=>new Promise((n,s)=>{var l=i=>{try{a(t.next(i))}catch(o){s(o)}},u=i=>{try{a(t.throw(i))}catch(o){s(o)}},a=i=>i.done?n(i.value):Promise.resolve(i.value).then(l,u);a((t=t.apply(r,e)).next())});class B{constructor(e,t){this.dependencies=e,this.extensionsConfiguration=t,this.extensions=Object.fromEntries(t.map(n=>[B.getExtensionNameByClass(n.type),this.dependencies.instantiateExtension(n.type)]))}static getExtensionNameByClass(e){return e.info.name}getExtensionInstanceByClass(e){return this.extensions[B.getExtensionNameByClass(e)]}initializeExtensions(){return fe(this,null,function*(){yield Promise.all(this.extensionsConfiguration.map(({type:e,params:t={}})=>{this.getExtensionInstanceByClass(e).initialize(t);const n=e.info;!("version"in n)&&!("data"in n)?console.warn(n.name,"is missing the 'version' and 'data' fields. Please update extension as 'version' and 'data' will be required in v9. See https://www.jspsych.org/latest/developers/extension-development/ for more details."):"version"in n?"data"in n||console.warn(n.name,"is missing the 'data' field. Please update extension as 'data' will be required in v9. See https://www.jspsych.org/latest/developers/extension-development/ for more details."):console.warn(n.name,"is missing the 'version' field. Please update extension as 'version' will be required in v9. See https://www.jspsych.org/latest/developers/extension-development/ for more details.")}))})}onStart(e=[]){var t;for(const{type:n,params:s}of e)(t=this.getExtensionInstanceByClass(n))==null||t.on_start(s)}onLoad(e=[]){var t;for(const{type:n,params:s}of e)(t=this.getExtensionInstanceByClass(n))==null||t.on_load(s)}onFinish(){return fe(this,arguments,function*(e=[]){const t=yield Promise.all(e.map(({type:s,params:l})=>{var u;return Promise.resolve((u=this.getExtensionInstanceByClass(s))==null?void 0:u.on_finish(l))})),n=e.length?{extension_type:e.map(({type:s})=>s.info.name),extension_version:e.map(({type:s})=>s.info.version)}:{};return t.unshift(n),Object.assign({},...t)})}}function U(r){return[...new Set(r)]}function j(r){if(!r)return r;let e;if(Array.isArray(r)){e=[];for(const t of r)e.push(j(t));return e}else if(typeof r=="object"&&r!==null){e={};for(const t in r)r.hasOwnProperty(t)&&(e[t]=j(r[t]));return e}else return r}function K(r,e){let t={};for(const n in r)r.hasOwnProperty(n)&&(typeof r[n]=="object"&&e.hasOwnProperty(n)?t[n]=K(r[n],e[n]):t[n]=r[n]);for(const n in e)e.hasOwnProperty(n)&&(t.hasOwnProperty(n)&&typeof e[n]=="object"?t[n]=K(t[n],e[n]):t[n]=e[n]);return t}var Ye=Object.freeze({__proto__:null,deepCopy:j,deepMerge:K,unique:U});class X{constructor(e=[]){this.values=e}sum(){let e=0;for(const t of this.values)e+=t;return e}mean(){let e=0,t=0;for(const n of this.values)typeof n!="undefined"&&n!==null&&(e+=n,t++);if(t!==0)return e/t}median(){if(this.values.length===0)return;const e=this.values.slice(0).sort(function(n,s){return n-s}),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 n of this.values)t+=Math.pow(n-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)typeof e[t]=="undefined"?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 n of this.values)e(n)&&t.push(n);return new X(t)}}function Xe(r,e){const t=new Blob([r],{type:"text/plain"});let n="";typeof window.webkitURL!="undefined"?n=window.webkitURL.createObjectURL(t):n=window.URL.createObjectURL(t);const s=document.createElement("a");s.id="jspsych-download-as-text-link",s.style.display="none",s.download=e,s.href=n,s.click()}function He(r){const e=typeof r!="object"?JSON.parse(r):r;let t="",n="";const s=[];for(const l of e)for(const u in l){let a=u+"";a='"'+a.replace(/"/g,'""')+'",',s.includes(u)||(s.push(u),t+=a)}t=t.slice(0,-1),n+=t+`\r
2
+ `;for(const l of e){t="";for(const u of s){let a=typeof l[u]=="undefined"?"":l[u];typeof a=="object"&&(a=JSON.stringify(a));const i=a+"";t+='"'+i.replace(/"/g,'""')+'",'}t=t.slice(0,-1),n+=t+`\r
3
+ `}return n}function Qe(){const r=window.location.search.substr(1).split("&"),e={};for(let t=0;t<r.length;++t){const n=r[t].split("=",2);n.length==1?e[n[0]]="":e[n[0]]=decodeURIComponent(n[1].replace(/\+/g," "))}return e}class b{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 b([this.trials[this.trials.length-1]])}first(e=1){if(e<1)throw`You must query with a positive nonzero integer. Please use a
4
4
  different value for n.`;return this.trials.length===0?new b:(e>this.trials.length&&(e=this.trials.length),new b(this.trials.slice(0,e)))}last(e=1){if(e<1)throw`You must query with a positive nonzero integer. Please use a
5
- different value for n.`;return this.trials.length===0?new b:(e>this.trials.length&&(e=this.trials.length),new b(this.trials.slice(this.trials.length-e,this.trials.length)))}values(){return this.trials}count(){return this.trials.length}readOnly(){return new b(j(this.trials))}addToAll(e){for(const t of this.trials)Object.assign(t,e);return this}addToLast(e){return this.trials.length>0&&Object.assign(this.trials[this.trials.length-1],e),this}filter(e){let t;Array.isArray(e)?t=j(e):t=j([e]);const n=[];for(const s of this.trials){let u=!1;for(const l of t){let a=!0;for(const i of Object.keys(l))typeof s[i]!="undefined"&&s[i]===l[i]||(a=!1);if(a){u=!0;break}}u&&n.push(s)}return new b(n)}filterCustom(e){return new b(this.trials.filter(e))}filterColumns(e){return new b(this.trials.map(t=>Object.fromEntries(e.filter(n=>n in t).map(n=>[n,t[n]]))))}select(e){const t=[];for(const n of this.trials)typeof n[e]!="undefined"&&t.push(n[e]);return new X(t)}ignore(e){Array.isArray(e)||(e=[e]);const t=j(this.trials);for(const n of t)for(const s of e)delete n[s];return new b(t)}uniqueNames(){const e=[];for(const t of this.trials)for(const n of Object.keys(t))e.includes(n)||e.push(n);return e}csv(){return Ye(this.trials)}json(e=!1){return e?JSON.stringify(this.trials,null," "):JSON.stringify(this.trials)}localSave(e,t){e=e.toLowerCase();let n;if(e==="json")n=this.json();else if(e==="csv")n=this.csv();else throw new Error('Invalid format specified for localSave. Must be "json" or "csv".');We(n,t)}}var He=Object.defineProperty,me=Object.getOwnPropertySymbols,Qe=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable,ge=(r,e,t)=>e in r?He(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,et=(r,e)=>{for(var t in e||(e={}))Qe.call(e,t)&&ge(r,t,e[t]);if(me)for(var t of me(e))Ze.call(e,t)&&ge(r,t,e[t]);return r};class tt{constructor(e){this.dependencies=e,this.dataProperties={},this.interactionListeners={blur:()=>{this.addInteractionRecord("blur")},focus:()=>{this.addInteractionRecord("focus")},fullscreenchange:()=>{this.addInteractionRecord(document.isFullScreen||document.webkitIsFullScreen||document.mozIsFullScreen||document.fullscreenElement?"fullscreenenter":"fullscreenexit")}},this.reset()}reset(){this.results=new b,this.resultToTrialMap=new WeakMap,this.interactionRecords=new b}get(){return this.results}getInteractionData(){return this.interactionRecords}write(e){const t=e.getResult();Object.assign(t,this.dataProperties),this.results.push(t),this.resultToTrialMap.set(t,e)}addProperties(e){this.results.addToAll(e),this.dataProperties=Object.assign({},this.dataProperties,e)}addDataToLastTrial(e){this.results.addToLast(e)}getLastTrialData(){return this.results.top()}getLastTimelineData(){const e=this.getLastTrialData().values()[0];return new b(e?this.resultToTrialMap.get(e).parent.getResults():[])}displayData(e="json"){e=e.toLowerCase(),e!=="json"&&e!=="csv"&&(console.log("Invalid format declared for displayData function. Using json as default."),e="json");const t=document.createElement("pre");t.id="jspsych-data-display",t.textContent=e==="json"?this.results.json(!0):this.results.csv(),this.dependencies.getDisplayElement().replaceChildren(t)}urlVariables(){return typeof this.query_string=="undefined"&&(this.query_string=Xe()),this.query_string}getURLVariable(e){return this.urlVariables()[e]}addInteractionRecord(e){const t=et({event:e},this.dependencies.getProgress());this.interactionRecords.push(t),this.dependencies.onInteractionRecordAdded(t)}createInteractionListeners(){window.addEventListener("blur",this.interactionListeners.blur),window.addEventListener("focus",this.interactionListeners.focus),document.addEventListener("fullscreenchange",this.interactionListeners.fullscreenchange),document.addEventListener("mozfullscreenchange",this.interactionListeners.fullscreenchange),document.addEventListener("webkitfullscreenchange",this.interactionListeners.fullscreenchange)}removeInteractionListeners(){window.removeEventListener("blur",this.interactionListeners.blur),window.removeEventListener("focus",this.interactionListeners.focus),document.removeEventListener("fullscreenchange",this.interactionListeners.fullscreenchange),document.removeEventListener("mozfullscreenchange",this.interactionListeners.fullscreenchange),document.removeEventListener("webkitfullscreenchange",this.interactionListeners.fullscreenchange)}}class rt{constructor(e,t=!1,n=0){this.getRootElement=e,this.areResponsesCaseSensitive=t,this.minimumValidRt=n,this.listeners=new Set,this.heldKeys=new Set,this.areRootListenersRegistered=!1,Y(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[...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,n){return!t&&this.heldKeys.has(n)?!1:e==="ALL_KEYS"?!0:e==="NO_KEYS"?!1:e.includes(n)}getKeyboardResponse({callback_function:e,valid_responses:t="ALL_KEYS",rt_method:n="performance",persist:s,audio_context:u,audio_context_start_time:l,allow_held_key:a=!1,minimum_valid_rt:i=this.minimumValidRt}){n!=="performance"&&n!=="audio"&&(console.log('Invalid RT method specified in getKeyboardResponse. Defaulting to "performance" method.'),n="performance");const o=n==="performance"?performance.now():l*1e3;this.registerRootListeners(),!this.areResponsesCaseSensitive&&typeof t!="string"&&(t=t.map(c=>c.toLowerCase()));const d=c=>{const h=Math.round((n=="performance"?performance.now():u.currentTime*1e3)-o);if(h<i)return;const p=this.toLowerCaseIfInsensitive(c.key);this.isResponseValid(t,a,p)&&(c.preventDefault(),s||this.cancelKeyboardResponse(d),e({key:c.key,rt:h}))};return this.listeners.add(d),d}cancelKeyboardResponse(e){this.listeners.delete(e)}cancelAllKeyboardResponses(){this.listeners.clear()}compareKeys(e,t){if(typeof e!="string"&&e!==null||typeof t!="string"&&t!==null){console.error("Error in jsPsych.pluginAPI.compareKeys: arguments must be key strings or null.");return}return typeof e=="string"&&typeof t=="string"?this.areResponsesCaseSensitive?e===t:e.toLowerCase()===t.toLowerCase():e===null&&t===null}}var O=(r=>(r[r.BOOL=0]="BOOL",r[r.STRING=1]="STRING",r[r.INT=2]="INT",r[r.FLOAT=3]="FLOAT",r[r.FUNCTION=4]="FUNCTION",r[r.KEY=5]="KEY",r[r.KEYS=6]="KEYS",r[r.SELECT=7]="SELECT",r[r.HTML_STRING=8]="HTML_STRING",r[r.IMAGE=9]="IMAGE",r[r.AUDIO=10]="AUDIO",r[r.VIDEO=11]="VIDEO",r[r.OBJECT=12]="OBJECT",r[r.COMPLEX=13]="COMPLEX",r[r.TIMELINE=14]="TIMELINE",r))(O||{}),H=(r,e,t)=>new Promise((n,s)=>{var u=i=>{try{a(t.next(i))}catch(o){s(o)}},l=i=>{try{a(t.throw(i))}catch(o){s(o)}},a=i=>i.done?n(i.value):Promise.resolve(i.value).then(u,l);a((t=t.apply(r,e)).next())});class G{constructor(e,t={useWebAudio:!1}){this.src=e,this.useWebAudio=t.useWebAudio,this.audioContext=t.audioContext||null}load(){return H(this,null,function*(){this.useWebAudio?this.webAudioBuffer=yield this.preloadWebAudio(this.src):this.audio=yield this.preloadHTMLAudio(this.src)})}play(){this.audio instanceof HTMLAudioElement?this.audio.play():(this.audio||(this.audio=this.getAudioSourceNode(this.webAudioBuffer)),this.audio.start())}stop(){this.audio instanceof HTMLAudioElement?(this.audio.pause(),this.audio.currentTime=0):(this.audio.stop(),this.audio=this.getAudioSourceNode(this.webAudioBuffer))}addEventListener(e,t){!this.audio&&this.webAudioBuffer&&(this.audio=this.getAudioSourceNode(this.webAudioBuffer)),this.audio.addEventListener(e,t)}removeEventListener(e,t){!this.audio&&this.webAudioBuffer&&(this.audio=this.getAudioSourceNode(this.webAudioBuffer)),this.audio.removeEventListener(e,t)}getAudioSourceNode(e){const t=this.audioContext.createBufferSource();return t.buffer=e,t.connect(this.audioContext.destination),t}preloadWebAudio(e){return H(this,null,function*(){const t=yield(yield fetch(e)).arrayBuffer(),n=yield this.audioContext.decodeAudioData(t),s=this.audioContext.createBufferSource();return s.buffer=n,s.connect(this.audioContext.destination),n})}preloadHTMLAudio(e){return H(this,null,function*(){return new Promise((t,n)=>{const s=new Audio(e);s.addEventListener("canplaythrough",()=>{t(s)}),s.addEventListener("error",u=>{n(u)}),s.addEventListener("abort",u=>{n(u)})})})}}var nt=(r,e,t)=>new Promise((n,s)=>{var u=i=>{try{a(t.next(i))}catch(o){s(o)}},l=i=>{try{a(t.throw(i))}catch(o){s(o)}},a=i=>i.done?n(i.value):Promise.resolve(i.value).then(u,l);a((t=t.apply(r,e)).next())});const ye=[O.AUDIO,O.IMAGE,O.VIDEO];class it{constructor(e){this.useWebaudio=e,this.video_buffers={},this.context=null,this.audio_buffers=[],this.preload_requests=[],this.img_cache={},this.preloadMap=new Map,this.microphone_recorder=null,this.camera_stream=null,this.camera_recorder=null,this.useWebaudio&&typeof window!="undefined"&&typeof window.AudioContext!="undefined"&&(this.context=new AudioContext)}getVideoBuffer(e){return e.startsWith("blob:")&&(this.video_buffers[e]=e),this.video_buffers[e]}audioContext(){return this.context&&this.context.state!=="running"&&this.context.resume(),this.context}getAudioPlayer(e){return nt(this,null,function*(){return this.audio_buffers[e]instanceof G?this.audio_buffers[e]:(this.audio_buffers[e]=new G(e,{useWebAudio:this.useWebaudio,audioContext:this.context}),yield this.audio_buffers[e].load(),this.audio_buffers[e])})}preloadAudio(e,t=()=>{},n=u=>{},s=u=>{}){e=U(e.flat());let u=0;if(e.length==0){t();return}for(const l of e)this.audio_buffers[l]instanceof G?(u++,n(l),u==e.length&&t()):(this.audio_buffers[l]=new G(l,{useWebAudio:this.useWebaudio,audioContext:this.context}),this.audio_buffers[l].load().then(()=>{u++,n(l),u==e.length&&t()}).catch(a=>{s(a)}))}preloadImages(e,t=()=>{},n=u=>{},s=u=>{}){e=U(e.flat());var u=0;if(e.length===0){t();return}for(let l=0;l<e.length;l++){const a=new Image,i=e[l];a.onload=()=>{u++,n(i),u===e.length&&t()},a.onerror=o=>{s({source:i,error:o})},a.src=i,this.img_cache[i]=a,this.preload_requests.push(a)}}preloadVideo(e,t=()=>{},n=u=>{},s=u=>{}){e=U(e.flat());let u=0;if(e.length===0){t();return}for(const l of e){const a=this.video_buffers,i=new XMLHttpRequest;i.open("GET",l,!0),i.responseType="blob",i.onload=()=>{if(i.status===200||i.status===0){const o=i.response;a[l]=URL.createObjectURL(o),u++,n(l),u===e.length&&t()}},i.onerror=o=>{let d=o;i.status==404&&(d="404"),s({source:l,error:d})},i.onloadend=o=>{i.status==404&&s({source:l,error:"404"})},i.send(),this.preload_requests.push(i)}}getAutoPreloadList(e){const t=Object.fromEntries(ye.map(s=>[s,new Set])),n=(s,u)=>{var l,a,i,o;if(typeof s.timeline!="undefined")for(const d of s.timeline)n(d,(l=s.type)!=null?l:u);else if((i=(a=s.type)!=null?a:u)!=null&&i.info){const{name:d,parameters:c}=((o=s.type)!=null?o:u).info;this.preloadMap.has(d)||this.preloadMap.set(d,Object.fromEntries(Object.entries(c).filter(([h,{type:p,preload:f}])=>ye.includes(p)&&(f!=null?f:!0)).map(([h,{type:p}])=>[h,p])));for(const[h,p]of Object.entries(this.preloadMap.get(d))){const f=s[h],x=t[p];if(typeof f=="string")x.add(f);else if(Array.isArray(f))for(const k of f.flat())typeof k=="string"&&x.add(k)}}};return n({timeline:e}),{images:[...t[O.IMAGE]],audio:[...t[O.AUDIO]],video:[...t[O.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}initializeCameraRecorder(e,t){this.camera_stream=e;const n=new MediaRecorder(e,t);this.camera_recorder=n}getCameraStream(){return this.camera_stream}getCameraRecorder(){return this.camera_recorder}}var st=Object.defineProperty,ve=Object.getOwnPropertySymbols,at=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable,be=(r,e,t)=>e in r?st(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,we=(r,e)=>{for(var t in e||(e={}))at.call(e,t)&&be(r,t,e[t]);if(ve)for(var t of ve(e))ot.call(e,t)&&be(r,t,e[t]);return r};class lt{constructor(e,t){this.getDisplayContainerElement=e,this.setJsPsychTimeout=t}dispatchEvent(e){this.getDisplayContainerElement().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?this.setJsPsychTimeout(()=>{this.keyDown(e),this.keyUp(e)},t):(this.keyDown(e),this.keyUp(e))}clickTarget(e,t=0){t>0?this.setJsPsychTimeout(()=>{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,n=0){n>0?this.setJsPsychTimeout(()=>{e.value=t},n):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 n;if(e=="NO_KEYS")n=null;else if(e=="ALL_KEYS")n=t[Math.floor(Math.random()*t.length)];else{const s=e.flat();n=s[Math.floor(Math.random()*s.length)]}return n}mergeSimulationData(e,t){return we(we({},e),t==null?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&&e.choices=="NO_KEYS"&&(t.rt&&(t.rt=null),t.response&&(t.response=null)),e.allow_response_before_complete&&e.sequence_reps&&e.frame_time){const n=e.sequence_reps*e.frame_time*e.stimuli.length;t.rt<n&&(t.rt=null,t.response=null)}}}class ut{constructor(){this.timeout_handlers=[]}setTimeout(e,t){const n=window.setTimeout(e,t);return this.timeout_handlers.push(n),n}clearAllTimeouts(){for(const e of this.timeout_handlers)clearTimeout(e);this.timeout_handlers=[]}}function ct(r){const e=r.getInitSettings(),t=new rt(r.getDisplayContainerElement,e.case_sensitive_responses,e.minimum_valid_rt),n=new ut,s=new it(e.use_webaudio),u=new lt(r.getDisplayContainerElement,n.setTimeout.bind(n));return Object.assign({},...[t,n,s,u].map(l=>Y(l)))}var Q={exports:{}};Q.exports,function(r){(function(e,t,n){function s(i){var o=this,d=a();o.next=function(){var c=2091639*o.s0+o.c*23283064365386963e-26;return o.s0=o.s1,o.s1=o.s2,o.s2=c-(o.c=c|0)},o.c=1,o.s0=d(" "),o.s1=d(" "),o.s2=d(" "),o.s0-=d(i),o.s0<0&&(o.s0+=1),o.s1-=d(i),o.s1<0&&(o.s1+=1),o.s2-=d(i),o.s2<0&&(o.s2+=1),d=null}function u(i,o){return o.c=i.c,o.s0=i.s0,o.s1=i.s1,o.s2=i.s2,o}function l(i,o){var d=new s(i),c=o&&o.state,h=d.next;return h.int32=function(){return d.next()*4294967296|0},h.double=function(){return h()+(h()*2097152|0)*11102230246251565e-32},h.quick=h,c&&(typeof c=="object"&&u(c,d),h.state=function(){return u(d,{})}),h}function a(){var i=4022871197,o=function(d){d=String(d);for(var c=0;c<d.length;c++){i+=d.charCodeAt(c);var h=.02519603282416938*i;i=h>>>0,h-=i,h*=i,i=h>>>0,h-=i,i+=h*4294967296}return(i>>>0)*23283064365386963e-26};return o}t&&t.exports?t.exports=l:this.alea=l})(N,r)}(Q);var xe=Q.exports,ht=W(xe),Z={exports:{}};Z.exports,function(r){(function(e,t,n){function s(a){var i=this,o="";i.x=0,i.y=0,i.z=0,i.w=0,i.next=function(){var c=i.x^i.x<<11;return i.x=i.y,i.y=i.z,i.z=i.w,i.w^=i.w>>>19^c^c>>>8},a===(a|0)?i.x=a:o+=a;for(var d=0;d<o.length+64;d++)i.x^=o.charCodeAt(d)|0,i.next()}function u(a,i){return i.x=a.x,i.y=a.y,i.z=a.z,i.w=a.w,i}function l(a,i){var o=new s(a),d=i&&i.state,c=function(){return(o.next()>>>0)/4294967296};return c.double=function(){do var h=o.next()>>>11,p=(o.next()>>>0)/4294967296,f=(h+p)/(1<<21);while(f===0);return f},c.int32=o.next,c.quick=c,d&&(typeof d=="object"&&u(d,o),c.state=function(){return u(o,{})}),c}t&&t.exports?t.exports=l:this.xor128=l})(N,r)}(Z);var dt=Z.exports,ee={exports:{}};ee.exports,function(r){(function(e,t,n){function s(a){var i=this,o="";i.next=function(){var c=i.x^i.x>>>2;return i.x=i.y,i.y=i.z,i.z=i.w,i.w=i.v,(i.d=i.d+362437|0)+(i.v=i.v^i.v<<4^(c^c<<1))|0},i.x=0,i.y=0,i.z=0,i.w=0,i.v=0,a===(a|0)?i.x=a:o+=a;for(var d=0;d<o.length+64;d++)i.x^=o.charCodeAt(d)|0,d==o.length&&(i.d=i.x<<10^i.x>>>4),i.next()}function u(a,i){return i.x=a.x,i.y=a.y,i.z=a.z,i.w=a.w,i.v=a.v,i.d=a.d,i}function l(a,i){var o=new s(a),d=i&&i.state,c=function(){return(o.next()>>>0)/4294967296};return c.double=function(){do var h=o.next()>>>11,p=(o.next()>>>0)/4294967296,f=(h+p)/(1<<21);while(f===0);return f},c.int32=o.next,c.quick=c,d&&(typeof d=="object"&&u(d,o),c.state=function(){return u(o,{})}),c}t&&t.exports?t.exports=l:this.xorwow=l})(N,r)}(ee);var pt=ee.exports,te={exports:{}};te.exports,function(r){(function(e,t,n){function s(a){var i=this;i.next=function(){var d=i.x,c=i.i,h,p;return h=d[c],h^=h>>>7,p=h^h<<24,h=d[c+1&7],p^=h^h>>>10,h=d[c+3&7],p^=h^h>>>3,h=d[c+4&7],p^=h^h<<7,h=d[c+7&7],h=h^h<<13,p^=h^h<<9,d[c]=p,i.i=c+1&7,p};function o(d,c){var h,p=[];if(c===(c|0))p[0]=c;else for(c=""+c,h=0;h<c.length;++h)p[h&7]=p[h&7]<<15^c.charCodeAt(h)+p[h+1&7]<<13;for(;p.length<8;)p.push(0);for(h=0;h<8&&p[h]===0;++h);for(h==8?p[7]=-1:p[h],d.x=p,d.i=0,h=256;h>0;--h)d.next()}o(i,a)}function u(a,i){return i.x=a.x.slice(),i.i=a.i,i}function l(a,i){a==null&&(a=+new Date);var o=new s(a),d=i&&i.state,c=function(){return(o.next()>>>0)/4294967296};return c.double=function(){do var h=o.next()>>>11,p=(o.next()>>>0)/4294967296,f=(h+p)/(1<<21);while(f===0);return f},c.int32=o.next,c.quick=c,d&&(d.x&&u(d,o),c.state=function(){return u(o,{})}),c}t&&t.exports?t.exports=l:this.xorshift7=l})(N,r)}(te);var ft=te.exports,re={exports:{}};re.exports,function(r){(function(e,t,n){function s(a){var i=this;i.next=function(){var d=i.w,c=i.X,h=i.i,p,f;return i.w=d=d+1640531527|0,f=c[h+34&127],p=c[h=h+1&127],f^=f<<13,p^=p<<17,f^=f>>>15,p^=p>>>12,f=c[h]=f^p,i.i=h,f+(d^d>>>16)|0};function o(d,c){var h,p,f,x,k,A=[],z=128;for(c===(c|0)?(p=c,c=null):(c=c+"\0",p=0,z=Math.max(z,c.length)),f=0,x=-32;x<z;++x)c&&(p^=c.charCodeAt((x+32)%c.length)),x===0&&(k=p),p^=p<<10,p^=p>>>15,p^=p<<4,p^=p>>>13,x>=0&&(k=k+1640531527|0,h=A[x&127]^=p+k,f=h==0?f+1:0);for(f>=128&&(A[(c&&c.length||0)&127]=-1),f=127,x=512;x>0;--x)p=A[f+34&127],h=A[f=f+1&127],p^=p<<13,h^=h<<17,p^=p>>>15,h^=h>>>12,A[f]=p^h;d.w=k,d.X=A,d.i=f}o(i,a)}function u(a,i){return i.i=a.i,i.w=a.w,i.X=a.X.slice(),i}function l(a,i){a==null&&(a=+new Date);var o=new s(a),d=i&&i.state,c=function(){return(o.next()>>>0)/4294967296};return c.double=function(){do var h=o.next()>>>11,p=(o.next()>>>0)/4294967296,f=(h+p)/(1<<21);while(f===0);return f},c.int32=o.next,c.quick=c,d&&(d.X&&u(d,o),c.state=function(){return u(o,{})}),c}t&&t.exports?t.exports=l:this.xor4096=l})(N,r)}(re);var mt=re.exports,ne={exports:{}};ne.exports,function(r){(function(e,t,n){function s(a){var i=this,o="";i.next=function(){var c=i.b,h=i.c,p=i.d,f=i.a;return c=c<<25^c>>>7^h,h=h-p|0,p=p<<24^p>>>8^f,f=f-c|0,i.b=c=c<<20^c>>>12^h,i.c=h=h-p|0,i.d=p<<16^h>>>16^f,i.a=f-c|0},i.a=0,i.b=0,i.c=-1640531527,i.d=1367130551,a===Math.floor(a)?(i.a=a/4294967296|0,i.b=a|0):o+=a;for(var d=0;d<o.length+20;d++)i.b^=o.charCodeAt(d)|0,i.next()}function u(a,i){return i.a=a.a,i.b=a.b,i.c=a.c,i.d=a.d,i}function l(a,i){var o=new s(a),d=i&&i.state,c=function(){return(o.next()>>>0)/4294967296};return c.double=function(){do var h=o.next()>>>11,p=(o.next()>>>0)/4294967296,f=(h+p)/(1<<21);while(f===0);return f},c.int32=o.next,c.quick=c,d&&(typeof d=="object"&&u(d,o),c.state=function(){return u(o,{})}),c}t&&t.exports?t.exports=l:this.tychei=l})(N,r)}(ne);var gt=ne.exports,Pe={exports:{}};(function(r){(function(e,t,n){var s=256,u=6,l=52,a="random",i=n.pow(s,u),o=n.pow(2,l),d=o*2,c=s-1,h;function p(m,g,P){var v=[];g=g==!0?{entropy:!0}:g||{};var y=A(k(g.entropy?[m,$(t)]:m==null?z():m,3),v),E=new f(v),T=function(){for(var _=E.g(u),I=i,L=0;_<o;)_=(_+L)*s,I*=s,L=E.g(1);for(;_>=d;)_/=2,I/=2,L>>>=1;return(_+L)/I};return T.int32=function(){return E.g(4)|0},T.quick=function(){return E.g(4)/4294967296},T.double=T,A($(E.S),t),(g.pass||P||function(_,I,L,R){return R&&(R.S&&x(R,E),_.state=function(){return x(E,{})}),L?(n[a]=_,I):_})(T,y,"global"in g?g.global:this==n,g.state)}function f(m){var g,P=m.length,v=this,y=0,E=v.i=v.j=0,T=v.S=[];for(P||(m=[P++]);y<s;)T[y]=y++;for(y=0;y<s;y++)T[y]=T[E=c&E+m[y%P]+(g=T[y])],T[E]=g;(v.g=function(_){for(var I,L=0,R=v.i,J=v.j,q=v.S;_--;)I=q[R=c&R+1],L=L*s+q[c&(q[R]=q[J=c&J+I])+(q[J]=I)];return v.i=R,v.j=J,L})(s)}function x(m,g){return g.i=m.i,g.j=m.j,g.S=m.S.slice(),g}function k(m,g){var P=[],v=typeof m,y;if(g&&v=="object")for(y in m)try{P.push(k(m[y],g-1))}catch(E){}return P.length?P:v=="string"?m:m+"\0"}function A(m,g){for(var P=m+"",v,y=0;y<P.length;)g[c&y]=c&(v^=g[c&y]*19)+P.charCodeAt(y++);return $(g)}function z(){try{var m;return h&&(m=h.randomBytes)?m=m(s):(m=new Uint8Array(s),(e.crypto||e.msCrypto).getRandomValues(m)),$(m)}catch(v){var g=e.navigator,P=g&&g.plugins;return[+new Date,e,P,e.screen,$(t)]}}function $(m){return String.fromCharCode.apply(0,m)}if(A(n.random(),t),r.exports){r.exports=p;try{h=require("crypto")}catch(m){}}else n["seed"+a]=p})(typeof self!="undefined"?self:N,[],Math)})(Pe);var yt=Pe.exports,vt=xe,bt=dt,wt=pt,xt=ft,Pt=mt,Et=gt,D=yt;D.alea=vt,D.xor128=bt,D.xorwow=wt,D.xorshift7=xt,D.xor4096=Pt,D.tychei=Et;var _t=D,jt=_t,ie=["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 Ee(r){const e=r!=null&&r.seed?new jt(r.seed):null;function t(){return r&&r.maxLength>1?n():s()}function n(){for(var c=!1,h;!c;)h=s(),h.length<=r.maxLength&&(c=!0);return h}function s(){return ie[u(ie.length)]}function u(c){const h=e?e():Math.random();return Math.floor(h*c)}if(typeof r=="undefined")return t();typeof r=="number"&&(r={exactly:r}),r.exactly&&(r.min=r.exactly,r.max=r.exactly),typeof r.wordsPerString!="number"&&(r.wordsPerString=1),typeof r.formatter!="function"&&(r.formatter=c=>c),typeof r.separator!="string"&&(r.separator=" ");for(var l=r.min+u(r.max+1-r.min),a=[],i="",o=0,d=0;d<l*r.wordsPerString;d++)o===r.wordsPerString-1?i+=r.formatter(t(),o):i+=r.formatter(t(),o)+r.separator,o++,(d+1)%r.wordsPerString===0&&(a.push(i),i="",o=0);return typeof r.join=="string"&&(a=a.join(r.join)),a}var kt=Ee;Ee.wordList=ie;var Tt=W(kt),Ot=Object.defineProperty,At=Object.defineProperties,Lt=Object.getOwnPropertyDescriptors,_e=Object.getOwnPropertySymbols,It=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable,je=(r,e,t)=>e in r?Ot(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ct=(r,e)=>{for(var t in e||(e={}))It.call(e,t)&&je(r,t,e[t]);if(_e)for(var t of _e(e))St.call(e,t)&&je(r,t,e[t]);return r},Mt=(r,e)=>At(r,Lt(e));function Rt(r=Math.random().toString()){return Math.random=ht(r),r}function se(r,e,t=!1){const n=Array.isArray(r),s=Array.isArray(e);if(!n)s?(e=[e[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.")):(r=[r],e=[e]);else if(s){if(r.length!=e.length)if(console.warn("Unclear parameters given to randomization.repeat. Items and repetitions are unequal lengths. Behavior may not be as expected."),e.length<r.length){let a=[];for(let i=0;i<r.length;i++)a.push(e);e=a}else e=e.slice(0,r.length)}else{let a=[];for(let i=0;i<r.length;i++)a.push(e);e=a}let u=[];for(let a=0;a<r.length;a++)for(let i=0;i<e[a];i++)r[a]==null||typeof r[a]!="object"?u.push(r[a]):u.push(Object.assign({},r[a]));let l=S(u);return t&&(l=Kt(l)),l}function S(r){Array.isArray(r)||console.error("Argument to shuffle() must be an array.");const e=r.slice(0);let t=e.length,n,s;for(;t;)s=Math.floor(Math.random()*t--),n=e[t],e[t]=e[s],e[s]=n;return e}function Nt(r,e){Array.isArray(r)||console.error("First argument to shuffleNoRepeats() must be an array."),typeof e!="undefined"&&typeof e!="function"&&console.error("Second argument to shuffleNoRepeats() must be a function."),typeof e=="undefined"&&(e=function(n,s){return n===s});const t=S(r);for(let n=0;n<t.length-1;n++)if(e(t[n],t[n+1])){let s=Math.floor(Math.random()*(t.length-2))+1;for(;e(t[n+1],t[s])||e(t[n+1],t[s+1])||e(t[n+1],t[s-1])||e(t[n],t[s]);)s=Math.floor(Math.random()*(t.length-2))+1;const u=t[s];t[s]=t[n+1],t[n+1]=u}return t}function ke(r,e=!1){const t=r.length;if(t==1)return console.warn("shuffleAlternateGroups() was called with only one group. Defaulting to simple shuffle."),S(r[0]);let n=[];for(let a=0;a<t;a++)n.push(a);e&&(n=S(n));const s=[];let u=null;for(let a=0;a<t;a++)u=u===null?r[a].length:Math.min(u,r[a].length),s.push(S(r[a]));const l=[];for(let a=0;a<u;a++)for(let i=0;i<n.length;i++)l.push(s[n[i]][a]);return l}function Te(r,e){return Array.isArray(r)||console.error("First argument to sampleWithoutReplacement() must be an array"),e>r.length&&console.error("Cannot take a sample larger than the size of the set of items to sample."),S(r).slice(0,e)}function Oe(r,e,t){Array.isArray(r)||console.error("First argument to sampleWithReplacement() must be an array");const n=[];if(typeof t!="undefined"){t.length!==r.length&&console.error("The length of the weights array must equal the length of the array to be sampled from.");let l=0;for(const a of t)l+=a;for(const a of t)n.push(a/l)}else for(let l=0;l<r.length;l++)n.push(1/r.length);const s=[n[0]];for(let l=1;l<n.length;l++)s.push(n[l]+s[l-1]);const u=[];for(let l=0;l<e;l++){const a=Math.random();let i=0;for(;a>s[i];)i++;u.push(r[i])}return u}function Dt(r,e=1,t=!1){let n=[{}];for(const[s,u]of Object.entries(r)){const l=[];for(const a of u)for(const i of n)l.push(Mt(Ct({},i),{[s]:a}));n=l}return se(n,e,t)}function Vt(r=32){let e="";const t="0123456789abcdefghjklmnopqrstuvwxyz";for(let n=0;n<r;n++)e+=t[Math.floor(Math.random()*t.length)];return e}function zt(r,e){if(e<r)throw new Error("Upper boundary must be greater than or equal to lower boundary");return r+Math.floor(Math.random()*(e-r+1))}function $t(r){return Math.random()<=r?1:0}function ae(r,e){return Ut()*e+r}function oe(r){return-Math.log(Math.random())/r}function qt(r,e,t,n=!1){let s=ae(r,e)+oe(t);if(n)for(;s<=0;)s=ae(r,e)+oe(t);return s}function Bt(r){return Tt(r)}function Ut(){for(var r=0,e=0;r===0;)r=Math.random();for(;e===0;)e=Math.random();return Math.sqrt(-2*Math.log(r))*Math.cos(2*Math.PI*e)}function Kt(r){const e={};for(const t of r)for(const n of Object.keys(t))typeof e[n]=="undefined"&&(e[n]=[]),e[n].push(t[n]);return e}var Gt=Object.freeze({__proto__:null,factorial:Dt,randomID:Vt,randomInt:zt,randomWords:Bt,repeat:se,sampleBernoulli:$t,sampleExGaussian:qt,sampleExponential:oe,sampleNormal:ae,sampleWithReplacement:Oe,sampleWithoutReplacement:Te,setSeed:Rt,shuffle:S,shuffleAlternateGroups:ke,shuffleNoRepeats:Nt});function Ae(){const r={previewMode:!1,outsideTurk:!1,hitId:"INVALID_URL_PARAMETER",assignmentId:"INVALID_URL_PARAMETER",workerId:"INVALID_URL_PARAMETER",turkSubmitTo:"INVALID_URL_PARAMETER"},e=function(n,s){s=s.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");const u="[\\?&]"+s+"=([^&#]*)",l=new RegExp(u).exec(n);return l==null?"":l[1]},t=e(window.location.href,"assignmentId")?window.location.href:document.referrer;return["assignmentId","hitId","workerId","turkSubmitTo"].map(function(n){r[n]=unescape(e(t,n))}),r.previewMode=r.assignmentId=="ASSIGNMENT_ID_NOT_AVAILABLE",r.outsideTurk=!r.previewMode&&r.hitId===""&&r.assignmentId==""&&r.workerId=="",r}function Ft(r){const e=Ae(),t=e.assignmentId,n=e.turkSubmitTo;if(!t||!n)return;const s=document.createElement("form");s.method="POST",s.action=n+"/mturk/externalSubmit?assignmentId="+t;for(const u in r)if(r.hasOwnProperty(u)){const l=document.createElement("input");l.type="hidden",l.name=u,l.id=u,l.value=r[u],s.appendChild(l)}document.body.appendChild(s),s.submit()}var Jt=Object.freeze({__proto__:null,submitToTurk:Ft,turkInfo:Ae});class Wt{constructor(e,t){this.containerElement=e,this.message=t,this._progress=0,this.setupElements()}setupElements(){this.messageSpan=document.createElement("span"),this.innerDiv=document.createElement("div"),this.innerDiv.id="jspsych-progressbar-inner",this.update();const e=document.createElement("div");e.id="jspsych-progressbar-outer",e.appendChild(this.innerDiv),this.containerElement.appendChild(this.messageSpan),this.containerElement.appendChild(e)}update(){this.innerDiv.style.width=this._progress*100+"%",typeof this.message=="function"?this.messageSpan.innerHTML=this.message(this._progress):this.messageSpan.innerHTML=this.message}set progress(e){if(typeof e!="number"||e<0||e>1)throw new Error("jsPsych.progressBar.progress must be a number between 0 and 1");this._progress=e,this.update()}get progress(){return this._progress}}class le{constructor(e){this.name=e}}const Yt=["timeline","timeline_variables","name","repetitions","loop_function","conditional_function","randomize_order","sample","on_timeline_start","on_timeline_finish"];function Xt(r){return!ue(r)}function ue(r){return!!r.timeline||Array.isArray(r)}var w=(r=>(r[r.PENDING=0]="PENDING",r[r.RUNNING=1]="RUNNING",r[r.PAUSED=2]="PAUSED",r[r.COMPLETED=3]="COMPLETED",r[r.ABORTED=4]="ABORTED",r))(w||{});class Le{constructor(){this.reset()}reset(){this.promise=new Promise(e=>{this.resolvePromise=e})}get(){return this.promise}resolve(e){this.resolvePromise(e),this.reset()}}function Ht(r){return r&&typeof r.then=="function"}function Qt(r){return new Promise(e=>setTimeout(e,r))}function Ie([r,...e]){let t=r!=null?r:"";for(const n of e)t+=Number.isNaN(Number.parseInt(n))?`.${n}`:`[${n}]`;return t}function Zt(r){return typeof r=="object"&&r!==null}class ce{constructor(){this.cache=new Map}static lookupChild(e,t){let n=!1,s;return Number.isNaN(Number.parseInt(t))?Object.hasOwn(e,t)&&(n=!0,s=e[t]):Number.parseInt(t)<e.length&&(n=!0,s=e[t]),{doesPathExist:n,value:s}}get(e){return this.cache.get(e.join("."))}has(e){return this.cache.has(e.join("."))}initialize(e){this.rootObject=e,this.cache.set("",e)}reset(){this.cache.clear(),this.cache.set("",this.rootObject)}set(e,t){this.cache.set(e.join("."),t)}lookup(e){if(this.has(e))return{doesPathExist:!0,value:this.get(e)};const t=n=>{const s=n.slice(0,-1),u=n[n.length-1];if(!this.has(s)&&s.length>0&&!t(s).doesPathExist)return{doesPathExist:!1};const l=this.get(s);if(!Zt(l))return{doesPathExist:!1};const a=ce.lookupChild(l,u);return a.doesPathExist&&this.set(n,a.value),a};return t(e)}}var er=Object.defineProperty,Se=Object.getOwnPropertySymbols,tr=Object.prototype.hasOwnProperty,rr=Object.prototype.propertyIsEnumerable,Ce=(r,e,t)=>e in r?er(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Me=(r,e)=>{for(var t in e||(e={}))tr.call(e,t)&&Ce(r,t,e[t]);if(Se)for(var t of Se(e))rr.call(e,t)&&Ce(r,t,e[t]);return r};class Re{constructor(e){this.dependencies=e,this.status=w.PENDING,this.parameterValueCache=new ce}getStatus(){return this.status}initializeParameterValueCache(){this.parameterValueCache.initialize(this.description)}resetParameterValueCache(){var e;this.parameterValueCache.reset(),(e=this.parent)==null||e.resetParameterValueCache()}getParameterValue(e,t={}){const{evaluateFunctions:n=!0,recursive:s=!0,cacheResult:u=!0,replaceResult:l}=t;typeof e=="string"&&(e=[e]);let{doesPathExist:a,value:i}=this.parameterValueCache.lookup(e);return!a&&s&&this.parent&&(i=this.parent.getParameterValue(e,t)),typeof i=="function"&&n&&(i=i()),i instanceof le&&(i=this.evaluateTimelineVariable(i)),typeof l=="function"&&(i=l(i)),u&&this.parameterValueCache.set(e,i),i}getDataParameter(){var e;const t=this.getParameterValue("data",{recursive:!1});return Me(Me({},Object.fromEntries(typeof t=="object"?Object.keys(t).map(n=>[n,this.getParameterValue(["data",n])]):[])),(e=this.parent)==null?void 0:e.getDataParameter())}}var nr=Object.defineProperty,ir=Object.defineProperties,sr=Object.getOwnPropertyDescriptors,Ne=Object.getOwnPropertySymbols,ar=Object.prototype.hasOwnProperty,or=Object.prototype.propertyIsEnumerable,De=(r,e,t)=>e in r?nr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,he=(r,e)=>{for(var t in e||(e={}))ar.call(e,t)&&De(r,t,e[t]);if(Ne)for(var t of Ne(e))or.call(e,t)&&De(r,t,e[t]);return r},lr=(r,e)=>ir(r,sr(e)),de=(r,e,t)=>new Promise((n,s)=>{var u=i=>{try{a(t.next(i))}catch(o){s(o)}},l=i=>{try{a(t.throw(i))}catch(o){s(o)}},a=i=>i.done?n(i.value):Promise.resolve(i.value).then(u,l);a((t=t.apply(r,e)).next())});class F extends Re{constructor(e,t,n){var s;if(super(e),this.description=t,this.parent=n,this.onLoad=()=>{this.runParameterCallback("on_load"),this.dependencies.runOnLoadExtensionCallbacks(this.getParameterValue("extensions"))},this.initializeParameterValueCache(),this.trialObject=j(t),this.pluginClass=this.getParameterValue("type",{evaluateFunctions:!1}),this.pluginInfo=(s=this.pluginClass)==null?void 0:s.info,!this.pluginInfo)throw new Error("Plugin not recognized. Please provide a valid plugin using the 'type' parameter.");!("version"in this.pluginInfo)&&!("data"in this.pluginInfo)?console.warn(this.pluginInfo.name,"is missing the 'version' and 'data' fields. Please update plugin as 'version' and 'data' will be required in v9. See https://www.jspsych.org/latest/developers/plugin-development/ for more details."):"version"in this.pluginInfo?"data"in this.pluginInfo||console.warn(this.pluginInfo.name,"is missing the 'data' field. Please update plugin as 'data' will be required in v9. See https://www.jspsych.org/latest/developers/plugin-development/ for more details."):console.warn(this.pluginInfo.name,"is missing the 'version' field. Please update plugin as 'version' will be required in v9. See https://www.jspsych.org/latest/developers/plugin-development/ for more details.")}run(){return de(this,null,function*(){var e;this.status=w.RUNNING,this.processParameters(),this.onStart(),this.addCssClasses(),this.pluginInstance=this.dependencies.instantiatePlugin(this.pluginClass),this.result=this.processResult(yield this.executeTrial()),this.dependencies.onTrialResultAvailable(this),this.status=w.COMPLETED,yield this.onFinish(),this.removeCssClasses();const t=(e=this.getParameterValue("post_trial_gap"))!=null?e:this.dependencies.getDefaultIti();t!==0&&this.dependencies.getSimulationMode()!=="data-only"&&(yield Qt(t)),this.resetParameterValueCache()})}executeTrial(){return de(this,null,function*(){const e=this.dependencies.finishTrialPromise.get();let t=!1;e.then(()=>{t=!0});const{trialReturnValue:n,hasTrialBeenSimulated:s}=this.invokeTrialMethod();let u;return Ht(n)?(u=yield Promise.race([n,e]),t&&(u=yield e)):(s||this.onLoad(),u=yield e),this.cleanupTrial(),u})}invokeTrialMethod(){var e;const t=this.dependencies.getSimulationMode();if(t&&typeof this.pluginInstance.simulate=="function"){const n=this.getSimulationOptions();if(n.simulate!==!1)return{hasTrialBeenSimulated:!0,trialReturnValue:this.pluginInstance.simulate(this.trialObject,(e=n.mode)!=null?e:t,n,this.onLoad)}}return{hasTrialBeenSimulated:!1,trialReturnValue:this.pluginInstance.trial(this.dependencies.getDisplayElement(),this.trialObject,this.onLoad)}}cleanupTrial(){this.dependencies.clearAllTimeouts(),this.dependencies.getDisplayElement().innerHTML=""}addCssClasses(){const e=this.getParameterValue("css_classes"),t=this.dependencies.getDisplayElement().classList;typeof e=="string"?t.add(e):Array.isArray(e)&&t.add(...e)}removeCssClasses(){const e=this.getParameterValue("css_classes");e&&this.dependencies.getDisplayElement().classList.remove(...typeof e=="string"?[e]:e)}processResult(e){var t;e||(e={});for(const[s,u]of Object.entries((t=this.getParameterValue("save_trial_parameters"))!=null?t:{}))if(this.pluginInfo.parameters[s])if(u&&!Object.hasOwn(e,s)){let l=this.trialObject[s];typeof l=="function"&&(l=l.toString()),e[s]=l}else!u&&Object.hasOwn(e,s)&&delete e[s];else console.warn(`Non-existent parameter "${s}" specified in save_trial_parameters.`);e=lr(he(he({},this.getDataParameter()),e),{trial_type:this.pluginInfo.name,trial_index:this.index,plugin_version:this.pluginInfo.version?this.pluginInfo.version:null});const n=this.getParameterValue("save_timeline_variables");return n===!0?e.timeline_variables=he({},this.parent.getAllTimelineVariables()):Array.isArray(n)&&(e.timeline_variables=Object.fromEntries(Object.entries(this.parent.getAllTimelineVariables()).filter(([s,u])=>n.includes(s)))),e}runParameterCallback(e,...t){const n=this.getParameterValue(e,{evaluateFunctions:!1});if(n)return n(...t)}onStart(){this.dependencies.onTrialStart(this),this.runParameterCallback("on_start",this.trialObject),this.dependencies.runOnStartExtensionCallbacks(this.getParameterValue("extensions"))}onFinish(){return de(this,null,function*(){const e=yield this.dependencies.runOnFinishExtensionCallbacks(this.getParameterValue("extensions"));Object.assign(this.result,e),yield Promise.resolve(this.runParameterCallback("on_finish",this.getResult())),this.dependencies.onTrialFinished(this)})}evaluateTimelineVariable(e){var t;return(t=this.parent)==null?void 0:t.evaluateTimelineVariable(e)}getParameterValue(e,t={}){return Yt.includes(typeof e=="string"?e:e[0])&&(t.recursive=!1),super.getParameterValue(e,t)}getSimulationOptions(){const e=this.getParameterValue("simulation_options",{replaceResult:(t={})=>{var n,s;if(typeof t=="string"){const u=this.dependencies.getGlobalSimulationOptions();t=(s=(n=u[t])!=null?n:u.default)!=null?s:{}}return K(j(this.dependencies.getGlobalSimulationOptions().default),j(t))}});return typeof e=="undefined"?{}:(e.mode=this.getParameterValue(["simulation_options","mode"]),e.simulate=this.getParameterValue(["simulation_options","simulate"]),e.data=this.getParameterValue(["simulation_options","data"]),typeof e.data=="object"&&(e.data=Object.fromEntries(Object.keys(e.data).map(t=>[t,this.getParameterValue(["simulation_options","data",t])]))),e)}getResult(){return this.getParameterValue("record_data")===!1?void 0:this.result}getResults(){const e=this.getResult();return e?[e]:[]}processParameters(){const e=(n,s,u=[])=>{for(const[l,a]of Object.entries(s)){const i=[...u,l];let o=this.getParameterValue(i,{evaluateFunctions:a.type!==O.FUNCTION,replaceResult:d=>{if(typeof d=="undefined"){if(typeof a.default=="undefined")throw new Error(`You must specify a value for the "${Ie(i)}" parameter in the "${this.pluginInfo.name}" plugin.`);return a.default}else return d}});if(a.array&&!Array.isArray(o)){const d=Ie(i);throw new Error(`A non-array value (\`${o}\`) was provided for the array parameter "${d}" in the "${this.pluginInfo.name}" plugin. Please make sure that "${d}" is an array.`)}a.type===O.COMPLEX&&a.nested&&(a.array?o=o.map((d,c)=>{const h=[...i,c.toString()],p=this.getParameterValue(h);return e(p,a.nested,h),p}):e(o,a.nested,i)),n[l]=o}},t=j(this.description);e(t,this.pluginInfo.parameters),this.trialObject=t}getLatestNode(){return this}getActiveTimelineByName(e){}}var ur=Object.defineProperty,Ve=Object.getOwnPropertySymbols,cr=Object.prototype.hasOwnProperty,hr=Object.prototype.propertyIsEnumerable,ze=(r,e,t)=>e in r?ur(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$e=(r,e)=>{for(var t in e||(e={}))cr.call(e,t)&&ze(r,t,e[t]);if(Ve)for(var t of Ve(e))hr.call(e,t)&&ze(r,t,e[t]);return r},dr=(r,e,t)=>new Promise((n,s)=>{var u=i=>{try{a(t.next(i))}catch(o){s(o)}},l=i=>{try{a(t.throw(i))}catch(o){s(o)}},a=i=>i.done?n(i.value):Promise.resolve(i.value).then(u,l);a((t=t.apply(r,e)).next())});class C extends Re{constructor(e,t,n){super(e),this.parent=n,this.children=[],this.shouldAbort=!1,this.resumePromise=new Le,this.description=Array.isArray(t)?{timeline:t}:t,this.initializeParameterValueCache()}run(){return dr(this,null,function*(){typeof this.index=="undefined"&&(this.index=0),this.status=w.RUNNING;const{conditional_function:e,loop_function:t,repetitions:n=1}=this.description;let s=this.generateTimelineVariableOrder();this.setCurrentTimelineVariablesByIndex(s[0]);let u=!0,l;if(!e||e()){this.onStart();for(let a=0;a<n;a++)do{l=[],u?u=!1:s=this.generateTimelineVariableOrder();for(const i of s){this.setCurrentTimelineVariablesByIndex(i);for(const o of this.description.timeline){const d=this.instantiateChildNode(o),c=this.currentChild;if(this.currentChild=d,d.index=c?c.getLatestNode().index+1:this.index,yield d.run(),this.status===w.PAUSED&&(yield this.resumePromise.get()),this.shouldAbort){this.status=w.ABORTED;return}l.push(...this.currentChild.getResults())}}}while(t&&t(new b(l)));this.onFinish()}this.status=w.COMPLETED})}onStart(){this.description.on_timeline_start&&this.description.on_timeline_start()}onFinish(){this.description.on_timeline_finish&&this.description.on_timeline_finish()}pause(){this.currentChild instanceof C&&this.currentChild.pause(),this.status=w.PAUSED}resume(){this.status==w.PAUSED&&(this.currentChild instanceof C&&this.currentChild.resume(),this.status=w.RUNNING,this.resumePromise.resolve())}abort(){(this.status===w.RUNNING||this.status===w.PAUSED)&&(this.currentChild instanceof C&&this.currentChild.abort(),this.shouldAbort=!0,this.status===w.PAUSED&&this.resume())}instantiateChildNode(e){const t=ue(e)?new C(this.dependencies,e,this):new F(this.dependencies,e,this);return this.children.push(t),t}setCurrentTimelineVariablesByIndex(e){var t;this.currentTimelineVariables=$e($e({},(t=this.parent)==null?void 0:t.getAllTimelineVariables()),e===null?void 0:this.description.timeline_variables[e])}generateTimelineVariableOrder(){var e;const t=(e=this.description.timeline_variables)==null?void 0:e.length;if(!t)return[null];let n=[...Array(t).keys()];const s=this.description.sample;if(s)switch(s.type){case"custom":n=s.fn(n);break;case"with-replacement":n=Oe(n,s.size,s.weights);break;case"without-replacement":n=Te(n,s.size);break;case"fixed-repetitions":n=se(n,s.size);break;case"alternate-groups":n=ke(s.groups,s.randomize_group_order);break;default:throw new Error(`Invalid type "${s.type}" in timeline sample parameters. Valid options for type are "custom", "with-replacement", "without-replacement", "fixed-repetitions", and "alternate-groups"`)}return this.description.randomize_order&&(n=S(n)),n}getAllTimelineVariables(){return this.currentTimelineVariables}evaluateTimelineVariable(e){var t;if((t=this.currentTimelineVariables)!=null&&t.hasOwnProperty(e.name))return this.currentTimelineVariables[e.name];throw new Error(`Timeline variable ${e.name} not found.`)}getResults(){const e=[];for(const t of this.children)if(t instanceof F){const n=t.getResult();n&&e.push(n)}else t instanceof C&&e.push(...t.getResults());return e}getNaiveProgress(){if(this.status===w.PENDING)return 0;const e=this.getLatestNode();if(!e)return 1;let t=e.index;return e.getStatus()===w.COMPLETED&&t++,Math.min(t/this.getNaiveTrialCount(),1)}getNaiveTrialCount(){const e=t=>{var n,s,u;const l=a=>a.map(i=>e(i)).reduce((i,o)=>i+o);if(Array.isArray(t))return l(t);if(Xt(t))return 1;if(ue(t)){let a=((n=t.timeline_variables)==null?void 0:n.length)||1;switch((s=t.sample)==null?void 0:s.type){case"with-replacement":case"without-replacement":a=t.sample.size;break;case"fixed-repetitions":a*=t.sample.size;break;case"alternate-groups":a=t.sample.groups.map(i=>i.length).reduce((i,o)=>i+o,0);break}return l(t.timeline)*((u=t.repetitions)!=null?u:1)*a}return 0};return e(this.description)}getLatestNode(){var e,t;return(t=(e=this.currentChild)==null?void 0:e.getLatestNode())!=null?t:this}getActiveTimelineByName(e){var t;return this.description.name===e?this:(t=this.currentChild)==null?void 0:t.getActiveTimelineByName(e)}}var pr=Object.defineProperty,qe=Object.getOwnPropertySymbols,fr=Object.prototype.hasOwnProperty,mr=Object.prototype.propertyIsEnumerable,Be=(r,e,t)=>e in r?pr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gr=(r,e)=>{for(var t in e||(e={}))fr.call(e,t)&&Be(r,t,e[t]);if(qe)for(var t of qe(e))mr.call(e,t)&&Be(r,t,e[t]);return r},pe=(r,e,t)=>new Promise((n,s)=>{var u=i=>{try{a(t.next(i))}catch(o){s(o)}},l=i=>{try{a(t.throw(i))}catch(o){s(o)}},a=i=>i.done?n(i.value):Promise.resolve(i.value).then(u,l);a((t=t.apply(r,e)).next())});class Ue{constructor(e){this.turk=Jt,this.randomization=Gt,this.utils=Je,this.citation={apa:"de Leeuw, J. R., Gilbert, R. A., & Luchterhandt, B. (2023). jsPsych: Enabling an Open-Source Collaborative Ecosystem of Behavioral Experiments. Journal of Open Source Software, 8(85), 5351. https://doi.org/10.21105/joss.05351 ",bibtex:'@article{Leeuw2023jsPsych, author = {de Leeuw, Joshua R. and Gilbert, Rebecca A. and Luchterhandt, Bj{\\" o}rn}, journal = {Journal of Open Source Software}, doi = {10.21105/joss.05351}, issn = {2475-9066}, number = {85}, year = {2023}, month = {may 11}, pages = {5351}, publisher = {Open Journals}, title = {jsPsych: Enabling an {Open}-{Source} {Collaborative} {Ecosystem} of {Behavioral} {Experiments}}, url = {https://joss.theoj.org/papers/10.21105/joss.05351}, volume = {8}, } '},this.options={},this.isFileProtocolUsed=!1,this.finishTrialPromise=new Le,this.timelineDependencies={onTrialStart:t=>{this.options.on_trial_start(t.trialObject),this.getDisplayContainerElement().focus(),this.getDisplayElement().scrollTop=0},onTrialResultAvailable:t=>{const n=t.getResult();n&&(n.time_elapsed=this.getTotalTime(),this.data.write(t))},onTrialFinished:t=>{const n=t.getResult();this.options.on_trial_finish(n),n&&this.options.on_data_update(n),this.progressBar&&this.options.auto_update_progress_bar&&(this.progressBar.progress=this.timeline.getNaiveProgress())},runOnStartExtensionCallbacks:t=>this.extensionManager.onStart(t),runOnLoadExtensionCallbacks:t=>this.extensionManager.onLoad(t),runOnFinishExtensionCallbacks:t=>this.extensionManager.onFinish(t),getSimulationMode:()=>this.simulationMode,getGlobalSimulationOptions:()=>this.simulationOptions,instantiatePlugin:t=>new t(this),getDisplayElement:()=>this.getDisplayElement(),getDefaultIti:()=>this.getInitSettings().default_iti,finishTrialPromise:this.finishTrialPromise,clearAllTimeouts:()=>this.pluginAPI.clearAllTimeouts()},this.extensionManagerDependencies={instantiateExtension:t=>new t(this)},this.dataDependencies={getProgress:()=>{var t,n;return{time:this.getTotalTime(),trial:(n=(t=this.timeline)==null?void 0:t.getLatestNode().index)!=null?n:0}},onInteractionRecordAdded:t=>{this.options.on_interaction_data_update(t)},getDisplayElement:()=>this.getDisplayElement()},e=gr({display_element:void 0,on_finish:()=>{},on_trial_start:()=>{},on_trial_finish:()=>{},on_data_update:()=>{},on_interaction_data_update:()=>{},on_close:()=>{},use_webaudio:!0,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.options=e,Y(this),window.location.protocol=="file:"&&(e.override_safe_mode===!1||typeof e.override_safe_mode=="undefined")&&(e.use_webaudio=!1,this.isFileProtocolUsed=!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 tt(this.dataDependencies),this.pluginAPI=ct(this),this.extensionManager=new B(this.extensionManagerDependencies,e.extensions)}version(){return Fe}run(e){return pe(this,null,function*(){typeof e=="undefined"&&console.error("No timeline declared in jsPsych.run(). Cannot start experiment."),e.length===0&&console.error("No trials have been added to the timeline (the timeline is an empty array). Cannot start experiment."),this.timeline=new C(this.timelineDependencies,e),yield this.prepareDom(),yield this.extensionManager.initializeExtensions(),document.documentElement.setAttribute("jspsych","present"),this.experimentStartTime=new Date,yield this.timeline.run(),yield Promise.resolve(this.options.on_finish(this.data.get())),this.endMessage&&(this.getDisplayElement().innerHTML=this.endMessage),this.data.removeInteractionListeners()})}simulate(e){return pe(this,arguments,function*(t,n="data-only",s={}){this.simulationMode=n,this.simulationOptions=s,yield this.run(t)})}getProgress(){var e,t,n,s;return{total_trials:(e=this.timeline)==null?void 0:e.getNaiveTrialCount(),current_trial_global:(n=(t=this.timeline)==null?void 0:t.getLatestNode().index)!=null?n:0,percent_complete:((s=this.timeline)==null?void 0:s.getNaiveProgress())*100}}getStartTime(){return this.experimentStartTime}getTotalTime(){return this.experimentStartTime?new Date().getTime()-this.experimentStartTime.getTime():0}getDisplayElement(){return this.displayElement}getDisplayContainerElement(){return this.displayContainerElement}abortExperiment(e,t={}){this.endMessage=e,this.timeline.abort(),this.pluginAPI.cancelAllKeyboardResponses(),this.pluginAPI.clearAllTimeouts(),this.finishTrial(t)}abortCurrentTimeline(){var e;let t=(e=this.timeline)==null?void 0:e.getLatestNode();t instanceof F&&(t=t.parent),t instanceof C&&t.abort()}abortTimelineByName(e){var t;const n=(t=this.timeline)==null?void 0:t.getActiveTimelineByName(e);n&&n.abort()}getCurrentTrial(){var e;const t=(e=this.timeline)==null?void 0:e.getLatestNode();if(t instanceof F)return t.description}getInitSettings(){return this.options}timelineVariable(e){return new le(e)}evaluateTimelineVariable(e){var t,n;return(n=(t=this.timeline)==null?void 0:t.getLatestNode())==null?void 0:n.evaluateTimelineVariable(new le(e))}pauseExperiment(){var e;(e=this.timeline)==null||e.pause()}resumeExperiment(){var e;(e=this.timeline)==null||e.resume()}getSafeModeStatus(){return this.isFileProtocolUsed}getTimeline(){var e;return(e=this.timeline)==null?void 0:e.description.timeline}getCitations(e=[],t="apa"){const n=["apa","bibtex"];if(t=t.toLowerCase(),Array.isArray(e))if(n.includes(t)){const s=this.citation[t],u=new Set([s]);for(const l of e)try{const a=l.info.citations[t];u.add(a)}catch(a){console.error(`${l} does not have citation in ${t} format.`)}return Array.from(u).join(`
6
- `)}else throw new Error("Unsupported citation format");else throw new Error("Expected array of plugins/extensions")}get extensions(){var e,t;return(t=(e=this.extensionManager)==null?void 0:e.extensions)!=null?t:{}}prepareDom(){return pe(this,null,function*(){document.readyState!=="complete"&&(yield new Promise(s=>{window.addEventListener("load",s)}));const e=this.options;if(typeof e.display_element=="undefined"){let s=document.body;s||(s=document.createElement("body"),document.documentElement.appendChild(s)),document.querySelector("html").style.height="100%",s.style.margin="0px",s.style.height="100%",s.style.width="100%",e.display_element=s}else{const s=e.display_element instanceof Element?e.display_element:document.querySelector("#"+e.display_element);s===null?console.error("The display_element specified in initJsPsych() does not exist in the DOM."):e.display_element=s}const t=document.createElement("div");t.id="jspsych-content";const n=document.createElement("div");if(n.className="jspsych-content-wrapper",n.appendChild(t),this.displayContainerElement=e.display_element,this.displayContainerElement.appendChild(n),this.displayElement=t,e.experiment_width!==null&&(this.displayElement.style.width=e.experiment_width+"px"),e.display_element.tabIndex=0,this.displayContainerElement.classList.add("jspsych-display-element"),this.displayElement.classList.add("jspsych-content"),this.data.createInteractionListeners(),window.addEventListener("beforeunload",e.on_close),this.options.show_progress_bar){const s=document.createElement("div");s.id="jspsych-progressbar-container",this.progressBar=new Wt(s,this.options.message_progress_bar),this.getDisplayContainerElement().insertAdjacentElement("afterbegin",s)}})}finishTrial(e){this.finishTrialPromise.resolve(e)}}class M 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"}}window.jsPsych={get init(){throw new M("`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.")},get data(){throw new M},get randomization(){throw new M},get turk(){throw new M},get pluginAPI(){throw new M},get ALL_KEYS(){throw new M('jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.')},get NO_KEYS(){throw new M('jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.')}},typeof window!="undefined"&&window.hasOwnProperty("webkitAudioContext")&&!window.hasOwnProperty("AudioContext")&&(window.AudioContext=webkitAudioContext);function yr(r){const e=new Ue(r);return Object.defineProperties(e,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(([t,n])=>[t,{get(){throw new M(n)}}]))),e}return V.DataCollection=b,V.JsPsych=Ue,V.ParameterType=O,V.initJsPsych=yr,V}({}),initJsPsych=jsPsychModule.initJsPsych;
7
- //# sourceMappingURL=https://unpkg.com/jspsych@8.2.1/dist/index.browser.min.js.map
5
+ different value for n.`;return this.trials.length===0?new b:(e>this.trials.length&&(e=this.trials.length),new b(this.trials.slice(this.trials.length-e,this.trials.length)))}values(){return this.trials}count(){return this.trials.length}readOnly(){return new b(j(this.trials))}addToAll(e){for(const t of this.trials)Object.assign(t,e);return this}addToLast(e){return this.trials.length>0&&Object.assign(this.trials[this.trials.length-1],e),this}filter(e){let t;Array.isArray(e)?t=j(e):t=j([e]);const n=[];for(const s of this.trials){let l=!1;for(const u of t){let a=!0;for(const i of Object.keys(u))typeof s[i]!="undefined"&&s[i]===u[i]||(a=!1);if(a){l=!0;break}}l&&n.push(s)}return new b(n)}filterCustom(e){return new b(this.trials.filter(e))}filterColumns(e){return new b(this.trials.map(t=>Object.fromEntries(e.filter(n=>n in t).map(n=>[n,t[n]]))))}select(e){const t=[];for(const n of this.trials)typeof n[e]!="undefined"&&t.push(n[e]);return new X(t)}ignore(e){Array.isArray(e)||(e=[e]);const t=j(this.trials);for(const n of t)for(const s of e)delete n[s];return new b(t)}uniqueNames(){const e=[];for(const t of this.trials)for(const n of Object.keys(t))e.includes(n)||e.push(n);return e}csv(){return He(this.trials)}json(e=!1){return e?JSON.stringify(this.trials,null," "):JSON.stringify(this.trials)}localSave(e,t){e=e.toLowerCase();let n;if(e==="json")n=this.json();else if(e==="csv")n=this.csv();else throw new Error('Invalid format specified for localSave. Must be "json" or "csv".');Xe(n,t)}}var Ze=Object.defineProperty,me=Object.getOwnPropertySymbols,et=Object.prototype.hasOwnProperty,tt=Object.prototype.propertyIsEnumerable,ge=(r,e,t)=>e in r?Ze(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,rt=(r,e)=>{for(var t in e||(e={}))et.call(e,t)&&ge(r,t,e[t]);if(me)for(var t of me(e))tt.call(e,t)&&ge(r,t,e[t]);return r};class nt{constructor(e){this.dependencies=e,this.dataProperties={},this.interactionListeners={blur:()=>{this.addInteractionRecord("blur")},focus:()=>{this.addInteractionRecord("focus")},fullscreenchange:()=>{this.addInteractionRecord(document.isFullScreen||document.webkitIsFullScreen||document.mozIsFullScreen||document.fullscreenElement?"fullscreenenter":"fullscreenexit")}},this.reset()}reset(){this.results=new b,this.resultToTrialMap=new WeakMap,this.interactionRecords=new b}get(){return this.results}getInteractionData(){return this.interactionRecords}write(e){const t=e.getResult();Object.assign(t,this.dataProperties),this.results.push(t),this.resultToTrialMap.set(t,e)}addProperties(e){this.results.addToAll(e),this.dataProperties=Object.assign({},this.dataProperties,e)}addDataToLastTrial(e){this.results.addToLast(e)}getLastTrialData(){return this.results.top()}getLastTimelineData(){const e=this.getLastTrialData().values()[0];return new b(e?this.resultToTrialMap.get(e).parent.getResults():[])}displayData(e="json"){e=e.toLowerCase(),e!=="json"&&e!=="csv"&&(console.log("Invalid format declared for displayData function. Using json as default."),e="json");const t=document.createElement("pre");t.id="jspsych-data-display",t.textContent=e==="json"?this.results.json(!0):this.results.csv(),this.dependencies.getDisplayElement().replaceChildren(t)}urlVariables(){return typeof this.query_string=="undefined"&&(this.query_string=Qe()),this.query_string}getURLVariable(e){return this.urlVariables()[e]}addInteractionRecord(e){const t=rt({event:e},this.dependencies.getProgress());this.interactionRecords.push(t),this.dependencies.onInteractionRecordAdded(t)}createInteractionListeners(){window.addEventListener("blur",this.interactionListeners.blur),window.addEventListener("focus",this.interactionListeners.focus),document.addEventListener("fullscreenchange",this.interactionListeners.fullscreenchange),document.addEventListener("mozfullscreenchange",this.interactionListeners.fullscreenchange),document.addEventListener("webkitfullscreenchange",this.interactionListeners.fullscreenchange)}removeInteractionListeners(){window.removeEventListener("blur",this.interactionListeners.blur),window.removeEventListener("focus",this.interactionListeners.focus),document.removeEventListener("fullscreenchange",this.interactionListeners.fullscreenchange),document.removeEventListener("mozfullscreenchange",this.interactionListeners.fullscreenchange),document.removeEventListener("webkitfullscreenchange",this.interactionListeners.fullscreenchange)}}class it{constructor(e,t=!1,n=0){this.getRootElement=e,this.areResponsesCaseSensitive=t,this.minimumValidRt=n,this.listeners=new Set,this.heldKeys=new Set,this.areRootListenersRegistered=!1,Y(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[...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,n){return!t&&this.heldKeys.has(n)?!1:e==="ALL_KEYS"?!0:e==="NO_KEYS"?!1:e.includes(n)}getKeyboardResponse({callback_function:e,valid_responses:t="ALL_KEYS",rt_method:n="performance",persist:s,audio_context:l,audio_context_start_time:u,allow_held_key:a=!1,minimum_valid_rt:i=this.minimumValidRt}){n!=="performance"&&n!=="audio"&&(console.log('Invalid RT method specified in getKeyboardResponse. Defaulting to "performance" method.'),n="performance");const o=n==="performance"?performance.now():u*1e3;this.registerRootListeners(),!this.areResponsesCaseSensitive&&typeof t!="string"&&(t=t.map(c=>c.toLowerCase()));const d=c=>{const h=Math.round((n=="performance"?performance.now():l.currentTime*1e3)-o);if(h<i)return;const p=this.toLowerCaseIfInsensitive(c.key);this.isResponseValid(t,a,p)&&(c.preventDefault(),s||this.cancelKeyboardResponse(d),e({key:c.key,rt:h}))};return this.listeners.add(d),d}cancelKeyboardResponse(e){this.listeners.delete(e)}cancelAllKeyboardResponses(){this.listeners.clear()}compareKeys(e,t){if(typeof e!="string"&&e!==null||typeof t!="string"&&t!==null){console.error("Error in jsPsych.pluginAPI.compareKeys: arguments must be key strings or null.");return}return typeof e=="string"&&typeof t=="string"?this.areResponsesCaseSensitive?e===t:e.toLowerCase()===t.toLowerCase():e===null&&t===null}}var T=(r=>(r[r.BOOL=0]="BOOL",r[r.STRING=1]="STRING",r[r.INT=2]="INT",r[r.FLOAT=3]="FLOAT",r[r.FUNCTION=4]="FUNCTION",r[r.KEY=5]="KEY",r[r.KEYS=6]="KEYS",r[r.SELECT=7]="SELECT",r[r.HTML_STRING=8]="HTML_STRING",r[r.IMAGE=9]="IMAGE",r[r.AUDIO=10]="AUDIO",r[r.VIDEO=11]="VIDEO",r[r.OBJECT=12]="OBJECT",r[r.COMPLEX=13]="COMPLEX",r[r.TIMELINE=14]="TIMELINE",r))(T||{}),H=(r,e,t)=>new Promise((n,s)=>{var l=i=>{try{a(t.next(i))}catch(o){s(o)}},u=i=>{try{a(t.throw(i))}catch(o){s(o)}},a=i=>i.done?n(i.value):Promise.resolve(i.value).then(l,u);a((t=t.apply(r,e)).next())});class G{constructor(e,t={useWebAudio:!1}){this.src=e,this.useWebAudio=t.useWebAudio,this.audioContext=t.audioContext||null}load(){return H(this,null,function*(){this.useWebAudio?this.webAudioBuffer=yield this.preloadWebAudio(this.src):this.audio=yield this.preloadHTMLAudio(this.src)})}play(){this.audio instanceof HTMLAudioElement?this.audio.play():(this.audio||(this.audio=this.getAudioSourceNode(this.webAudioBuffer)),this.audio.start())}stop(){this.audio instanceof HTMLAudioElement?(this.audio.pause(),this.audio.currentTime=0):(this.audio.stop(),this.audio=this.getAudioSourceNode(this.webAudioBuffer))}addEventListener(e,t){!this.audio&&this.webAudioBuffer&&(this.audio=this.getAudioSourceNode(this.webAudioBuffer)),this.audio.addEventListener(e,t)}removeEventListener(e,t){!this.audio&&this.webAudioBuffer&&(this.audio=this.getAudioSourceNode(this.webAudioBuffer)),this.audio.removeEventListener(e,t)}getAudioSourceNode(e){const t=this.audioContext.createBufferSource();return t.buffer=e,t.connect(this.audioContext.destination),t}preloadWebAudio(e){return H(this,null,function*(){const t=yield(yield fetch(e)).arrayBuffer(),n=yield this.audioContext.decodeAudioData(t),s=this.audioContext.createBufferSource();return s.buffer=n,s.connect(this.audioContext.destination),n})}preloadHTMLAudio(e){return H(this,null,function*(){return new Promise((t,n)=>{const s=new Audio(e);s.addEventListener("canplaythrough",()=>{t(s)}),s.addEventListener("error",l=>{n(l)}),s.addEventListener("abort",l=>{n(l)})})})}}var st=Object.defineProperty,at=Object.defineProperties,ot=Object.getOwnPropertyDescriptors,ye=Object.getOwnPropertySymbols,lt=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable,ve=(r,e,t)=>e in r?st(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ct=(r,e)=>{for(var t in e||(e={}))lt.call(e,t)&&ve(r,t,e[t]);if(ye)for(var t of ye(e))ut.call(e,t)&&ve(r,t,e[t]);return r},ht=(r,e)=>at(r,ot(e)),dt=(r,e,t)=>new Promise((n,s)=>{var l=i=>{try{a(t.next(i))}catch(o){s(o)}},u=i=>{try{a(t.throw(i))}catch(o){s(o)}},a=i=>i.done?n(i.value):Promise.resolve(i.value).then(l,u);a((t=t.apply(r,e)).next())});const be=[T.AUDIO,T.IMAGE,T.VIDEO];class pt{constructor(e){this.useWebaudio=e,this.video_buffers={},this.context=null,this.audio_buffers=[],this.preload_requests=[],this.img_cache={},this.preloadMap=new Map,this.microphone_recorder=null,this.camera_stream=null,this.camera_recorder=null,this.useWebaudio&&typeof window!="undefined"&&typeof window.AudioContext!="undefined"&&(this.context=new AudioContext)}getVideoBuffer(e){return e.startsWith("blob:")&&(this.video_buffers[e]=e),this.video_buffers[e]}audioContext(){return this.context&&this.context.state!=="running"&&this.context.resume(),this.context}getAudioPlayer(e){return dt(this,null,function*(){return this.audio_buffers[e]instanceof G?this.audio_buffers[e]:(this.audio_buffers[e]=new G(e,{useWebAudio:this.useWebaudio,audioContext:this.context}),yield this.audio_buffers[e].load(),this.audio_buffers[e])})}preloadAudio(e,t=()=>{},n=l=>{},s=l=>{}){e=U(e.flat());let l=0;if(e.length==0){t();return}for(const u of e)this.audio_buffers[u]instanceof G?(l++,n(u),l==e.length&&t()):(this.audio_buffers[u]=new G(u,{useWebAudio:this.useWebaudio,audioContext:this.context}),this.audio_buffers[u].load().then(()=>{l++,n(u),l==e.length&&t()}).catch(a=>{s(a)}))}preloadImages(e,t=()=>{},n=l=>{},s=l=>{}){e=U(e.flat());var l=0;if(e.length===0){t();return}for(let u=0;u<e.length;u++){const a=new Image,i=e[u];a.onload=()=>{l++,n(i),l===e.length&&t()},a.onerror=o=>{s({source:i,error:o})},a.src=i,this.img_cache[i]=a,this.preload_requests.push(a)}}preloadVideo(e,t=()=>{},n=l=>{},s=l=>{}){e=U(e.flat());let l=0;if(e.length===0){t();return}for(const u of e){const a=this.video_buffers,i=new XMLHttpRequest;i.open("GET",u,!0),i.responseType="blob",i.onload=()=>{if(i.status===200||i.status===0){const o=i.response;a[u]=URL.createObjectURL(o),l++,n(u),l===e.length&&t()}},i.onerror=o=>{let d=o;i.status==404&&(d="404"),s({source:u,error:d})},i.onloadend=o=>{i.status==404&&s({source:u,error:"404"})},i.send(),this.preload_requests.push(i)}}getAutoPreloadList(e){const t=Object.fromEntries(be.map(s=>[s,new Set])),n=(s,l)=>{var u,a,i,o;if(typeof s.timeline!="undefined")for(const d of s.timeline)n(d,(u=s.type)!=null?u:l);else if((i=(a=s.type)!=null?a:l)!=null&&i.info){const{name:d,parameters:c}=((o=s.type)!=null?o:l).info;this.preloadMap.has(d)||this.preloadMap.set(d,Object.fromEntries(Object.entries(c).filter(([h,{type:p,preload:f}])=>be.includes(p)&&(f!=null?f:!0)).map(([h,{type:p}])=>[h,p])));for(const[h,p]of Object.entries(this.preloadMap.get(d))){const f=s[h],x=t[p];if(typeof f=="string")x.add(f);else if(Array.isArray(f))for(const k of f.flat())typeof k=="string"&&x.add(k)}}};return n({timeline:e}),{images:[...t[T.IMAGE]],audio:[...t[T.AUDIO]],video:[...t[T.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}initializeCameraRecorder(e,t){let n=this.getCompatibleMimeType()||"video/webm";const s=ht(ct({},t),{mimeType:n});this.camera_stream=e;const l=new MediaRecorder(e,s);this.camera_recorder=l}getCompatibleMimeType(){const e=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/mp4;codecs=avc1.42E01E,mp4a.40.2","video/mp4;codecs=h264,aac","video/mp4;codecs=hevc,aac"];for(const t of e)if(MediaRecorder.isTypeSupported(t))return t;return null}getCameraStream(){return this.camera_stream}getCameraRecorder(){return this.camera_recorder}}var ft=Object.defineProperty,we=Object.getOwnPropertySymbols,mt=Object.prototype.hasOwnProperty,gt=Object.prototype.propertyIsEnumerable,xe=(r,e,t)=>e in r?ft(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Pe=(r,e)=>{for(var t in e||(e={}))mt.call(e,t)&&xe(r,t,e[t]);if(we)for(var t of we(e))gt.call(e,t)&&xe(r,t,e[t]);return r};class yt{constructor(e,t){this.getDisplayContainerElement=e,this.setJsPsychTimeout=t}dispatchEvent(e){this.getDisplayContainerElement().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?this.setJsPsychTimeout(()=>{this.keyDown(e),this.keyUp(e)},t):(this.keyDown(e),this.keyUp(e))}clickTarget(e,t=0){t>0?this.setJsPsychTimeout(()=>{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,n=0){n>0?this.setJsPsychTimeout(()=>{e.value=t},n):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 n;if(e=="NO_KEYS")n=null;else if(e=="ALL_KEYS")n=t[Math.floor(Math.random()*t.length)];else{const s=e.flat();n=s[Math.floor(Math.random()*s.length)]}return n}mergeSimulationData(e,t){return Pe(Pe({},e),t==null?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&&e.choices=="NO_KEYS"&&(t.rt&&(t.rt=null),t.response&&(t.response=null)),e.allow_response_before_complete&&e.sequence_reps&&e.frame_time){const n=e.sequence_reps*e.frame_time*e.stimuli.length;t.rt<n&&(t.rt=null,t.response=null)}}}class vt{constructor(){this.timeout_handlers=[]}setTimeout(e,t){const n=window.setTimeout(e,t);return this.timeout_handlers.push(n),n}clearAllTimeouts(){for(const e of this.timeout_handlers)clearTimeout(e);this.timeout_handlers=[]}}function bt(r){const e=r.getInitSettings(),t=new it(r.getDisplayContainerElement,e.case_sensitive_responses,e.minimum_valid_rt),n=new vt,s=new pt(e.use_webaudio),l=new yt(r.getDisplayContainerElement,n.setTimeout.bind(n));return Object.assign({},...[t,n,s,l].map(u=>Y(u)))}var Q={exports:{}};Q.exports,function(r){(function(e,t,n){function s(i){var o=this,d=a();o.next=function(){var c=2091639*o.s0+o.c*23283064365386963e-26;return o.s0=o.s1,o.s1=o.s2,o.s2=c-(o.c=c|0)},o.c=1,o.s0=d(" "),o.s1=d(" "),o.s2=d(" "),o.s0-=d(i),o.s0<0&&(o.s0+=1),o.s1-=d(i),o.s1<0&&(o.s1+=1),o.s2-=d(i),o.s2<0&&(o.s2+=1),d=null}function l(i,o){return o.c=i.c,o.s0=i.s0,o.s1=i.s1,o.s2=i.s2,o}function u(i,o){var d=new s(i),c=o&&o.state,h=d.next;return h.int32=function(){return d.next()*4294967296|0},h.double=function(){return h()+(h()*2097152|0)*11102230246251565e-32},h.quick=h,c&&(typeof c=="object"&&l(c,d),h.state=function(){return l(d,{})}),h}function a(){var i=4022871197,o=function(d){d=String(d);for(var c=0;c<d.length;c++){i+=d.charCodeAt(c);var h=.02519603282416938*i;i=h>>>0,h-=i,h*=i,i=h>>>0,h-=i,i+=h*4294967296}return(i>>>0)*23283064365386963e-26};return o}t&&t.exports?t.exports=u:this.alea=u})(N,r)}(Q);var Ee=Q.exports,wt=W(Ee),Z={exports:{}};Z.exports,function(r){(function(e,t,n){function s(a){var i=this,o="";i.x=0,i.y=0,i.z=0,i.w=0,i.next=function(){var c=i.x^i.x<<11;return i.x=i.y,i.y=i.z,i.z=i.w,i.w^=i.w>>>19^c^c>>>8},a===(a|0)?i.x=a:o+=a;for(var d=0;d<o.length+64;d++)i.x^=o.charCodeAt(d)|0,i.next()}function l(a,i){return i.x=a.x,i.y=a.y,i.z=a.z,i.w=a.w,i}function u(a,i){var o=new s(a),d=i&&i.state,c=function(){return(o.next()>>>0)/4294967296};return c.double=function(){do var h=o.next()>>>11,p=(o.next()>>>0)/4294967296,f=(h+p)/(1<<21);while(f===0);return f},c.int32=o.next,c.quick=c,d&&(typeof d=="object"&&l(d,o),c.state=function(){return l(o,{})}),c}t&&t.exports?t.exports=u:this.xor128=u})(N,r)}(Z);var xt=Z.exports,ee={exports:{}};ee.exports,function(r){(function(e,t,n){function s(a){var i=this,o="";i.next=function(){var c=i.x^i.x>>>2;return i.x=i.y,i.y=i.z,i.z=i.w,i.w=i.v,(i.d=i.d+362437|0)+(i.v=i.v^i.v<<4^(c^c<<1))|0},i.x=0,i.y=0,i.z=0,i.w=0,i.v=0,a===(a|0)?i.x=a:o+=a;for(var d=0;d<o.length+64;d++)i.x^=o.charCodeAt(d)|0,d==o.length&&(i.d=i.x<<10^i.x>>>4),i.next()}function l(a,i){return i.x=a.x,i.y=a.y,i.z=a.z,i.w=a.w,i.v=a.v,i.d=a.d,i}function u(a,i){var o=new s(a),d=i&&i.state,c=function(){return(o.next()>>>0)/4294967296};return c.double=function(){do var h=o.next()>>>11,p=(o.next()>>>0)/4294967296,f=(h+p)/(1<<21);while(f===0);return f},c.int32=o.next,c.quick=c,d&&(typeof d=="object"&&l(d,o),c.state=function(){return l(o,{})}),c}t&&t.exports?t.exports=u:this.xorwow=u})(N,r)}(ee);var Pt=ee.exports,te={exports:{}};te.exports,function(r){(function(e,t,n){function s(a){var i=this;i.next=function(){var d=i.x,c=i.i,h,p;return h=d[c],h^=h>>>7,p=h^h<<24,h=d[c+1&7],p^=h^h>>>10,h=d[c+3&7],p^=h^h>>>3,h=d[c+4&7],p^=h^h<<7,h=d[c+7&7],h=h^h<<13,p^=h^h<<9,d[c]=p,i.i=c+1&7,p};function o(d,c){var h,p=[];if(c===(c|0))p[0]=c;else for(c=""+c,h=0;h<c.length;++h)p[h&7]=p[h&7]<<15^c.charCodeAt(h)+p[h+1&7]<<13;for(;p.length<8;)p.push(0);for(h=0;h<8&&p[h]===0;++h);for(h==8?p[7]=-1:p[h],d.x=p,d.i=0,h=256;h>0;--h)d.next()}o(i,a)}function l(a,i){return i.x=a.x.slice(),i.i=a.i,i}function u(a,i){a==null&&(a=+new Date);var o=new s(a),d=i&&i.state,c=function(){return(o.next()>>>0)/4294967296};return c.double=function(){do var h=o.next()>>>11,p=(o.next()>>>0)/4294967296,f=(h+p)/(1<<21);while(f===0);return f},c.int32=o.next,c.quick=c,d&&(d.x&&l(d,o),c.state=function(){return l(o,{})}),c}t&&t.exports?t.exports=u:this.xorshift7=u})(N,r)}(te);var Et=te.exports,re={exports:{}};re.exports,function(r){(function(e,t,n){function s(a){var i=this;i.next=function(){var d=i.w,c=i.X,h=i.i,p,f;return i.w=d=d+1640531527|0,f=c[h+34&127],p=c[h=h+1&127],f^=f<<13,p^=p<<17,f^=f>>>15,p^=p>>>12,f=c[h]=f^p,i.i=h,f+(d^d>>>16)|0};function o(d,c){var h,p,f,x,k,A=[],$=128;for(c===(c|0)?(p=c,c=null):(c=c+"\0",p=0,$=Math.max($,c.length)),f=0,x=-32;x<$;++x)c&&(p^=c.charCodeAt((x+32)%c.length)),x===0&&(k=p),p^=p<<10,p^=p>>>15,p^=p<<4,p^=p>>>13,x>=0&&(k=k+1640531527|0,h=A[x&127]^=p+k,f=h==0?f+1:0);for(f>=128&&(A[(c&&c.length||0)&127]=-1),f=127,x=512;x>0;--x)p=A[f+34&127],h=A[f=f+1&127],p^=p<<13,h^=h<<17,p^=p>>>15,h^=h>>>12,A[f]=p^h;d.w=k,d.X=A,d.i=f}o(i,a)}function l(a,i){return i.i=a.i,i.w=a.w,i.X=a.X.slice(),i}function u(a,i){a==null&&(a=+new Date);var o=new s(a),d=i&&i.state,c=function(){return(o.next()>>>0)/4294967296};return c.double=function(){do var h=o.next()>>>11,p=(o.next()>>>0)/4294967296,f=(h+p)/(1<<21);while(f===0);return f},c.int32=o.next,c.quick=c,d&&(d.X&&l(d,o),c.state=function(){return l(o,{})}),c}t&&t.exports?t.exports=u:this.xor4096=u})(N,r)}(re);var _t=re.exports,ne={exports:{}};ne.exports,function(r){(function(e,t,n){function s(a){var i=this,o="";i.next=function(){var c=i.b,h=i.c,p=i.d,f=i.a;return c=c<<25^c>>>7^h,h=h-p|0,p=p<<24^p>>>8^f,f=f-c|0,i.b=c=c<<20^c>>>12^h,i.c=h=h-p|0,i.d=p<<16^h>>>16^f,i.a=f-c|0},i.a=0,i.b=0,i.c=-1640531527,i.d=1367130551,a===Math.floor(a)?(i.a=a/4294967296|0,i.b=a|0):o+=a;for(var d=0;d<o.length+20;d++)i.b^=o.charCodeAt(d)|0,i.next()}function l(a,i){return i.a=a.a,i.b=a.b,i.c=a.c,i.d=a.d,i}function u(a,i){var o=new s(a),d=i&&i.state,c=function(){return(o.next()>>>0)/4294967296};return c.double=function(){do var h=o.next()>>>11,p=(o.next()>>>0)/4294967296,f=(h+p)/(1<<21);while(f===0);return f},c.int32=o.next,c.quick=c,d&&(typeof d=="object"&&l(d,o),c.state=function(){return l(o,{})}),c}t&&t.exports?t.exports=u:this.tychei=u})(N,r)}(ne);var jt=ne.exports,_e={exports:{}};(function(r){(function(e,t,n){var s=256,l=6,u=52,a="random",i=n.pow(s,l),o=n.pow(2,u),d=o*2,c=s-1,h;function p(m,g,P){var v=[];g=g==!0?{entropy:!0}:g||{};var y=A(k(g.entropy?[m,z(t)]:m==null?$():m,3),v),E=new f(v),O=function(){for(var _=E.g(l),S=i,C=0;_<o;)_=(_+C)*s,S*=s,C=E.g(1);for(;_>=d;)_/=2,S/=2,C>>>=1;return(_+C)/S};return O.int32=function(){return E.g(4)|0},O.quick=function(){return E.g(4)/4294967296},O.double=O,A(z(E.S),t),(g.pass||P||function(_,S,C,R){return R&&(R.S&&x(R,E),_.state=function(){return x(E,{})}),C?(n[a]=_,S):_})(O,y,"global"in g?g.global:this==n,g.state)}function f(m){var g,P=m.length,v=this,y=0,E=v.i=v.j=0,O=v.S=[];for(P||(m=[P++]);y<s;)O[y]=y++;for(y=0;y<s;y++)O[y]=O[E=c&E+m[y%P]+(g=O[y])],O[E]=g;(v.g=function(_){for(var S,C=0,R=v.i,J=v.j,q=v.S;_--;)S=q[R=c&R+1],C=C*s+q[c&(q[R]=q[J=c&J+S])+(q[J]=S)];return v.i=R,v.j=J,C})(s)}function x(m,g){return g.i=m.i,g.j=m.j,g.S=m.S.slice(),g}function k(m,g){var P=[],v=typeof m,y;if(g&&v=="object")for(y in m)try{P.push(k(m[y],g-1))}catch(E){}return P.length?P:v=="string"?m:m+"\0"}function A(m,g){for(var P=m+"",v,y=0;y<P.length;)g[c&y]=c&(v^=g[c&y]*19)+P.charCodeAt(y++);return z(g)}function $(){try{var m;return h&&(m=h.randomBytes)?m=m(s):(m=new Uint8Array(s),(e.crypto||e.msCrypto).getRandomValues(m)),z(m)}catch(v){var g=e.navigator,P=g&&g.plugins;return[+new Date,e,P,e.screen,z(t)]}}function z(m){return String.fromCharCode.apply(0,m)}if(A(n.random(),t),r.exports){r.exports=p;try{h=require("crypto")}catch(m){}}else n["seed"+a]=p})(typeof self!="undefined"?self:N,[],Math)})(_e);var kt=_e.exports,Ot=Ee,Tt=xt,At=Pt,Ct=Et,St=_t,It=jt,D=kt;D.alea=Ot,D.xor128=Tt,D.xorwow=At,D.xorshift7=Ct,D.xor4096=St,D.tychei=It;var Lt=D,Mt=Lt,ie=["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 je(r){const e=r!=null&&r.seed?new Mt(r.seed):null;function t(){return r&&r.maxLength>1?n():s()}function n(){for(var c=!1,h;!c;)h=s(),h.length<=r.maxLength&&(c=!0);return h}function s(){return ie[l(ie.length)]}function l(c){const h=e?e():Math.random();return Math.floor(h*c)}if(typeof r=="undefined")return t();typeof r=="number"&&(r={exactly:r}),r.exactly&&(r.min=r.exactly,r.max=r.exactly),typeof r.wordsPerString!="number"&&(r.wordsPerString=1),typeof r.formatter!="function"&&(r.formatter=c=>c),typeof r.separator!="string"&&(r.separator=" ");for(var u=r.min+l(r.max+1-r.min),a=[],i="",o=0,d=0;d<u*r.wordsPerString;d++)o===r.wordsPerString-1?i+=r.formatter(t(),o):i+=r.formatter(t(),o)+r.separator,o++,(d+1)%r.wordsPerString===0&&(a.push(i),i="",o=0);return typeof r.join=="string"&&(a=a.join(r.join)),a}var Rt=je;je.wordList=ie;var Nt=W(Rt),Dt=Object.defineProperty,Vt=Object.defineProperties,$t=Object.getOwnPropertyDescriptors,ke=Object.getOwnPropertySymbols,zt=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable,Oe=(r,e,t)=>e in r?Dt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Bt=(r,e)=>{for(var t in e||(e={}))zt.call(e,t)&&Oe(r,t,e[t]);if(ke)for(var t of ke(e))qt.call(e,t)&&Oe(r,t,e[t]);return r},Ut=(r,e)=>Vt(r,$t(e));function Kt(r=Math.random().toString()){return Math.random=wt(r),r}function se(r,e,t=!1){const n=Array.isArray(r),s=Array.isArray(e);if(!n)s?(e=[e[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.")):(r=[r],e=[e]);else if(s){if(r.length!=e.length)if(console.warn("Unclear parameters given to randomization.repeat. Items and repetitions are unequal lengths. Behavior may not be as expected."),e.length<r.length){let a=[];for(let i=0;i<r.length;i++)a.push(e);e=a}else e=e.slice(0,r.length)}else{let a=[];for(let i=0;i<r.length;i++)a.push(e);e=a}let l=[];for(let a=0;a<r.length;a++)for(let i=0;i<e[a];i++)r[a]==null||typeof r[a]!="object"?l.push(r[a]):l.push(Object.assign({},r[a]));let u=I(l);return t&&(u=Zt(u)),u}function I(r){Array.isArray(r)||console.error("Argument to shuffle() must be an array.");const e=r.slice(0);let t=e.length,n,s;for(;t;)s=Math.floor(Math.random()*t--),n=e[t],e[t]=e[s],e[s]=n;return e}function Gt(r,e){Array.isArray(r)||console.error("First argument to shuffleNoRepeats() must be an array."),typeof e!="undefined"&&typeof e!="function"&&console.error("Second argument to shuffleNoRepeats() must be a function."),typeof e=="undefined"&&(e=function(n,s){return n===s});const t=I(r);for(let n=0;n<t.length-1;n++)if(e(t[n],t[n+1])){let s=Math.floor(Math.random()*(t.length-2))+1;for(;e(t[n+1],t[s])||e(t[n+1],t[s+1])||e(t[n+1],t[s-1])||e(t[n],t[s]);)s=Math.floor(Math.random()*(t.length-2))+1;const l=t[s];t[s]=t[n+1],t[n+1]=l}return t}function Te(r,e=!1){const t=r.length;if(t==1)return console.warn("shuffleAlternateGroups() was called with only one group. Defaulting to simple shuffle."),I(r[0]);let n=[];for(let a=0;a<t;a++)n.push(a);e&&(n=I(n));const s=[];let l=null;for(let a=0;a<t;a++)l=l===null?r[a].length:Math.min(l,r[a].length),s.push(I(r[a]));const u=[];for(let a=0;a<l;a++)for(let i=0;i<n.length;i++)u.push(s[n[i]][a]);return u}function Ae(r,e){return Array.isArray(r)||console.error("First argument to sampleWithoutReplacement() must be an array"),e>r.length&&console.error("Cannot take a sample larger than the size of the set of items to sample."),I(r).slice(0,e)}function Ce(r,e,t){Array.isArray(r)||console.error("First argument to sampleWithReplacement() must be an array");const n=[];if(typeof t!="undefined"){t.length!==r.length&&console.error("The length of the weights array must equal the length of the array to be sampled from.");let u=0;for(const a of t)u+=a;for(const a of t)n.push(a/u)}else for(let u=0;u<r.length;u++)n.push(1/r.length);const s=[n[0]];for(let u=1;u<n.length;u++)s.push(n[u]+s[u-1]);const l=[];for(let u=0;u<e;u++){const a=Math.random();let i=0;for(;a>s[i];)i++;l.push(r[i])}return l}function Ft(r,e=1,t=!1){let n=[{}];for(const[s,l]of Object.entries(r)){const u=[];for(const a of l)for(const i of n)u.push(Ut(Bt({},i),{[s]:a}));n=u}return se(n,e,t)}function Jt(r=32){let e="";const t="0123456789abcdefghjklmnopqrstuvwxyz";for(let n=0;n<r;n++)e+=t[Math.floor(Math.random()*t.length)];return e}function Wt(r,e){if(e<r)throw new Error("Upper boundary must be greater than or equal to lower boundary");return r+Math.floor(Math.random()*(e-r+1))}function Yt(r){return Math.random()<=r?1:0}function ae(r,e){return Qt()*e+r}function oe(r){return-Math.log(Math.random())/r}function Xt(r,e,t,n=!1){let s=ae(r,e)+oe(t);if(n)for(;s<=0;)s=ae(r,e)+oe(t);return s}function Ht(r){return Nt(r)}function Qt(){for(var r=0,e=0;r===0;)r=Math.random();for(;e===0;)e=Math.random();return Math.sqrt(-2*Math.log(r))*Math.cos(2*Math.PI*e)}function Zt(r){const e={};for(const t of r)for(const n of Object.keys(t))typeof e[n]=="undefined"&&(e[n]=[]),e[n].push(t[n]);return e}var er=Object.freeze({__proto__:null,factorial:Ft,randomID:Jt,randomInt:Wt,randomWords:Ht,repeat:se,sampleBernoulli:Yt,sampleExGaussian:Xt,sampleExponential:oe,sampleNormal:ae,sampleWithReplacement:Ce,sampleWithoutReplacement:Ae,setSeed:Kt,shuffle:I,shuffleAlternateGroups:Te,shuffleNoRepeats:Gt});function Se(){const r={previewMode:!1,outsideTurk:!1,hitId:"INVALID_URL_PARAMETER",assignmentId:"INVALID_URL_PARAMETER",workerId:"INVALID_URL_PARAMETER",turkSubmitTo:"INVALID_URL_PARAMETER"},e=function(n,s){s=s.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");const l="[\\?&]"+s+"=([^&#]*)",u=new RegExp(l).exec(n);return u==null?"":u[1]},t=e(window.location.href,"assignmentId")?window.location.href:document.referrer;return["assignmentId","hitId","workerId","turkSubmitTo"].map(function(n){r[n]=unescape(e(t,n))}),r.previewMode=r.assignmentId=="ASSIGNMENT_ID_NOT_AVAILABLE",r.outsideTurk=!r.previewMode&&r.hitId===""&&r.assignmentId==""&&r.workerId=="",r}function tr(r){const e=Se(),t=e.assignmentId,n=e.turkSubmitTo;if(!t||!n)return;const s=document.createElement("form");s.method="POST",s.action=n+"/mturk/externalSubmit?assignmentId="+t;for(const l in r)if(r.hasOwnProperty(l)){const u=document.createElement("input");u.type="hidden",u.name=l,u.id=l,u.value=r[l],s.appendChild(u)}document.body.appendChild(s),s.submit()}var rr=Object.freeze({__proto__:null,submitToTurk:tr,turkInfo:Se});class nr{constructor(e,t){this.containerElement=e,this.message=t,this._progress=0,this.setupElements()}setupElements(){this.messageSpan=document.createElement("span"),this.innerDiv=document.createElement("div"),this.innerDiv.id="jspsych-progressbar-inner",this.update();const e=document.createElement("div");e.id="jspsych-progressbar-outer",e.appendChild(this.innerDiv),this.containerElement.appendChild(this.messageSpan),this.containerElement.appendChild(e)}update(){this.innerDiv.style.width=this._progress*100+"%",typeof this.message=="function"?this.messageSpan.innerHTML=this.message(this._progress):this.messageSpan.innerHTML=this.message}set progress(e){if(typeof e!="number"||e<0||e>1)throw new Error("jsPsych.progressBar.progress must be a number between 0 and 1");this._progress=e,this.update()}get progress(){return this._progress}}class le{constructor(e){this.name=e}}const ir=["timeline","timeline_variables","name","repetitions","loop_function","conditional_function","randomize_order","sample","on_timeline_start","on_timeline_finish"];function sr(r){return!ue(r)}function ue(r){return!!r.timeline||Array.isArray(r)}var w=(r=>(r[r.PENDING=0]="PENDING",r[r.RUNNING=1]="RUNNING",r[r.PAUSED=2]="PAUSED",r[r.COMPLETED=3]="COMPLETED",r[r.ABORTED=4]="ABORTED",r))(w||{});class Ie{constructor(){this.reset()}reset(){this.promise=new Promise(e=>{this.resolvePromise=e})}get(){return this.promise}resolve(e){this.resolvePromise(e),this.reset()}}function ar(r){return r&&typeof r.then=="function"}function or(r){return new Promise(e=>setTimeout(e,r))}function Le([r,...e]){let t=r!=null?r:"";for(const n of e)t+=Number.isNaN(Number.parseInt(n))?`.${n}`:`[${n}]`;return t}function lr(r){return typeof r=="object"&&r!==null}class ce{constructor(){this.cache=new Map}static lookupChild(e,t){let n=!1,s;return Number.isNaN(Number.parseInt(t))?Object.hasOwn(e,t)&&(n=!0,s=e[t]):Number.parseInt(t)<e.length&&(n=!0,s=e[t]),{doesPathExist:n,value:s}}get(e){return this.cache.get(e.join("."))}has(e){return this.cache.has(e.join("."))}initialize(e){this.rootObject=e,this.cache.set("",e)}reset(){this.cache.clear(),this.cache.set("",this.rootObject)}set(e,t){this.cache.set(e.join("."),t)}lookup(e){if(this.has(e))return{doesPathExist:!0,value:this.get(e)};const t=n=>{const s=n.slice(0,-1),l=n[n.length-1];if(!this.has(s)&&s.length>0&&!t(s).doesPathExist)return{doesPathExist:!1};const u=this.get(s);if(!lr(u))return{doesPathExist:!1};const a=ce.lookupChild(u,l);return a.doesPathExist&&this.set(n,a.value),a};return t(e)}}var ur=Object.defineProperty,Me=Object.getOwnPropertySymbols,cr=Object.prototype.hasOwnProperty,hr=Object.prototype.propertyIsEnumerable,Re=(r,e,t)=>e in r?ur(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ne=(r,e)=>{for(var t in e||(e={}))cr.call(e,t)&&Re(r,t,e[t]);if(Me)for(var t of Me(e))hr.call(e,t)&&Re(r,t,e[t]);return r};class De{constructor(e){this.dependencies=e,this.status=w.PENDING,this.parameterValueCache=new ce}getStatus(){return this.status}initializeParameterValueCache(){this.parameterValueCache.initialize(this.description)}resetParameterValueCache(){var e;this.parameterValueCache.reset(),(e=this.parent)==null||e.resetParameterValueCache()}getParameterValue(e,t={}){const{evaluateFunctions:n=!0,recursive:s=!0,cacheResult:l=!0,replaceResult:u}=t;typeof e=="string"&&(e=[e]);let{doesPathExist:a,value:i}=this.parameterValueCache.lookup(e);return!a&&s&&this.parent&&(i=this.parent.getParameterValue(e,t)),typeof i=="function"&&n&&(i=i()),i instanceof le&&(i=this.evaluateTimelineVariable(i)),typeof u=="function"&&(i=u(i)),l&&this.parameterValueCache.set(e,i),i}getDataParameter(){var e;const t=this.getParameterValue("data",{recursive:!1});return Ne(Ne({},Object.fromEntries(typeof t=="object"?Object.keys(t).map(n=>[n,this.getParameterValue(["data",n])]):[])),(e=this.parent)==null?void 0:e.getDataParameter())}}var dr=Object.defineProperty,pr=Object.defineProperties,fr=Object.getOwnPropertyDescriptors,Ve=Object.getOwnPropertySymbols,mr=Object.prototype.hasOwnProperty,gr=Object.prototype.propertyIsEnumerable,$e=(r,e,t)=>e in r?dr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,he=(r,e)=>{for(var t in e||(e={}))mr.call(e,t)&&$e(r,t,e[t]);if(Ve)for(var t of Ve(e))gr.call(e,t)&&$e(r,t,e[t]);return r},yr=(r,e)=>pr(r,fr(e)),de=(r,e,t)=>new Promise((n,s)=>{var l=i=>{try{a(t.next(i))}catch(o){s(o)}},u=i=>{try{a(t.throw(i))}catch(o){s(o)}},a=i=>i.done?n(i.value):Promise.resolve(i.value).then(l,u);a((t=t.apply(r,e)).next())});class F extends De{constructor(e,t,n){var s;if(super(e),this.description=t,this.parent=n,this.onLoad=()=>{this.runParameterCallback("on_load"),this.dependencies.runOnLoadExtensionCallbacks(this.getParameterValue("extensions"))},this.initializeParameterValueCache(),this.trialObject=j(t),this.pluginClass=this.getParameterValue("type",{evaluateFunctions:!1}),this.pluginInfo=(s=this.pluginClass)==null?void 0:s.info,!this.pluginInfo)throw new Error("Plugin not recognized. Please provide a valid plugin using the 'type' parameter.");!("version"in this.pluginInfo)&&!("data"in this.pluginInfo)?console.warn(this.pluginInfo.name,"is missing the 'version' and 'data' fields. Please update plugin as 'version' and 'data' will be required in v9. See https://www.jspsych.org/latest/developers/plugin-development/ for more details."):"version"in this.pluginInfo?"data"in this.pluginInfo||console.warn(this.pluginInfo.name,"is missing the 'data' field. Please update plugin as 'data' will be required in v9. See https://www.jspsych.org/latest/developers/plugin-development/ for more details."):console.warn(this.pluginInfo.name,"is missing the 'version' field. Please update plugin as 'version' will be required in v9. See https://www.jspsych.org/latest/developers/plugin-development/ for more details.")}run(){return de(this,null,function*(){var e;this.status=w.RUNNING,this.processParameters(),this.onStart(),this.addCssClasses(),this.pluginInstance=this.dependencies.instantiatePlugin(this.pluginClass),this.result=this.processResult(yield this.executeTrial()),this.dependencies.onTrialResultAvailable(this),this.status=w.COMPLETED,yield this.onFinish(),this.removeCssClasses();const t=(e=this.getParameterValue("post_trial_gap"))!=null?e:this.dependencies.getDefaultIti();t!==0&&this.dependencies.getSimulationMode()!=="data-only"&&(yield or(t)),this.resetParameterValueCache()})}executeTrial(){return de(this,null,function*(){const e=this.dependencies.finishTrialPromise.get();let t=!1;e.then(()=>{t=!0});const{trialReturnValue:n,hasTrialBeenSimulated:s}=this.invokeTrialMethod();let l;return ar(n)?(l=yield Promise.race([n,e]),t&&(l=yield e)):(s||this.onLoad(),l=yield e),this.cleanupTrial(),l})}invokeTrialMethod(){var e;const t=this.dependencies.getSimulationMode();if(t&&typeof this.pluginInstance.simulate=="function"){const n=this.getSimulationOptions();if(n.simulate!==!1)return{hasTrialBeenSimulated:!0,trialReturnValue:this.pluginInstance.simulate(this.trialObject,(e=n.mode)!=null?e:t,n,this.onLoad)}}return{hasTrialBeenSimulated:!1,trialReturnValue:this.pluginInstance.trial(this.dependencies.getDisplayElement(),this.trialObject,this.onLoad)}}cleanupTrial(){this.dependencies.clearAllTimeouts(),this.dependencies.getDisplayElement().innerHTML=""}addCssClasses(){const e=this.getParameterValue("css_classes"),t=this.dependencies.getDisplayElement().classList;typeof e=="string"?t.add(e):Array.isArray(e)&&t.add(...e)}removeCssClasses(){const e=this.getParameterValue("css_classes");e&&this.dependencies.getDisplayElement().classList.remove(...typeof e=="string"?[e]:e)}processResult(e){var t;e||(e={});for(const[s,l]of Object.entries((t=this.getParameterValue("save_trial_parameters"))!=null?t:{}))if(this.pluginInfo.parameters[s])if(l&&!Object.hasOwn(e,s)){let u=this.trialObject[s];typeof u=="function"&&(u=u.toString()),e[s]=u}else!l&&Object.hasOwn(e,s)&&delete e[s];else console.warn(`Non-existent parameter "${s}" specified in save_trial_parameters.`);e=yr(he(he({},this.getDataParameter()),e),{trial_type:this.pluginInfo.name,trial_index:this.index,plugin_version:this.pluginInfo.version?this.pluginInfo.version:null});const n=this.getParameterValue("save_timeline_variables");return n===!0?e.timeline_variables=he({},this.parent.getAllTimelineVariables()):Array.isArray(n)&&(e.timeline_variables=Object.fromEntries(Object.entries(this.parent.getAllTimelineVariables()).filter(([s,l])=>n.includes(s)))),e}runParameterCallback(e,...t){const n=this.getParameterValue(e,{evaluateFunctions:!1});if(n)return n(...t)}onStart(){this.dependencies.onTrialStart(this),this.runParameterCallback("on_start",this.trialObject),this.dependencies.runOnStartExtensionCallbacks(this.getParameterValue("extensions"))}onFinish(){return de(this,null,function*(){const e=yield this.dependencies.runOnFinishExtensionCallbacks(this.getParameterValue("extensions"));Object.assign(this.result,e),yield Promise.resolve(this.runParameterCallback("on_finish",this.getResult())),this.dependencies.onTrialFinished(this)})}evaluateTimelineVariable(e){var t;return(t=this.parent)==null?void 0:t.evaluateTimelineVariable(e)}getParameterValue(e,t={}){return ir.includes(typeof e=="string"?e:e[0])&&(t.recursive=!1),super.getParameterValue(e,t)}getSimulationOptions(){const e=this.getParameterValue("simulation_options",{replaceResult:(t={})=>{var n,s;if(typeof t=="string"){const l=this.dependencies.getGlobalSimulationOptions();t=(s=(n=l[t])!=null?n:l.default)!=null?s:{}}return K(j(this.dependencies.getGlobalSimulationOptions().default),j(t))}});return typeof e=="undefined"?{}:(e.mode=this.getParameterValue(["simulation_options","mode"]),e.simulate=this.getParameterValue(["simulation_options","simulate"]),e.data=this.getParameterValue(["simulation_options","data"]),typeof e.data=="object"&&(e.data=Object.fromEntries(Object.keys(e.data).map(t=>[t,this.getParameterValue(["simulation_options","data",t])]))),e)}getResult(){return this.getParameterValue("record_data")===!1?void 0:this.result}getResults(){const e=this.getResult();return e?[e]:[]}processParameters(){const e=(n,s,l=[])=>{for(const[u,a]of Object.entries(s)){const i=[...l,u];let o=this.getParameterValue(i,{evaluateFunctions:a.type!==T.FUNCTION,replaceResult:d=>{if(typeof d=="undefined"){if(typeof a.default=="undefined")throw new Error(`You must specify a value for the "${Le(i)}" parameter in the "${this.pluginInfo.name}" plugin.`);return a.default}else return d}});if(a.array&&!Array.isArray(o)){const d=Le(i);throw new Error(`A non-array value (\`${o}\`) was provided for the array parameter "${d}" in the "${this.pluginInfo.name}" plugin. Please make sure that "${d}" is an array.`)}a.type===T.COMPLEX&&a.nested&&(a.array?o=o.map((d,c)=>{const h=[...i,c.toString()],p=this.getParameterValue(h);return e(p,a.nested,h),p}):e(o,a.nested,i)),n[u]=o}},t=j(this.description);e(t,this.pluginInfo.parameters),this.trialObject=t}getLatestNode(){return this}getActiveTimelineByName(e){}}var vr=Object.defineProperty,ze=Object.getOwnPropertySymbols,br=Object.prototype.hasOwnProperty,wr=Object.prototype.propertyIsEnumerable,qe=(r,e,t)=>e in r?vr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Be=(r,e)=>{for(var t in e||(e={}))br.call(e,t)&&qe(r,t,e[t]);if(ze)for(var t of ze(e))wr.call(e,t)&&qe(r,t,e[t]);return r},xr=(r,e,t)=>new Promise((n,s)=>{var l=i=>{try{a(t.next(i))}catch(o){s(o)}},u=i=>{try{a(t.throw(i))}catch(o){s(o)}},a=i=>i.done?n(i.value):Promise.resolve(i.value).then(l,u);a((t=t.apply(r,e)).next())});class L extends De{constructor(e,t,n){super(e),this.parent=n,this.children=[],this.shouldAbort=!1,this.resumePromise=new Ie,this.description=Array.isArray(t)?{timeline:t}:t,this.initializeParameterValueCache()}run(){return xr(this,null,function*(){typeof this.index=="undefined"&&(this.index=0),this.status=w.RUNNING;const{conditional_function:e,loop_function:t,repetitions:n=1}=this.description;let s=this.generateTimelineVariableOrder();this.setCurrentTimelineVariablesByIndex(s[0]);let l=!0,u;if(!e||e()){this.onStart();for(let a=0;a<n;a++)do{u=[],l?l=!1:s=this.generateTimelineVariableOrder();for(const i of s){this.setCurrentTimelineVariablesByIndex(i);for(const o of this.description.timeline){const d=this.instantiateChildNode(o),c=this.currentChild;if(this.currentChild=d,d.index=c?c.getLatestNode().index+1:this.index,yield d.run(),this.status===w.PAUSED&&(yield this.resumePromise.get()),this.shouldAbort){this.status=w.ABORTED;return}u.push(...this.currentChild.getResults())}}}while(t&&t(new b(u)));this.onFinish()}this.status=w.COMPLETED})}onStart(){this.description.on_timeline_start&&this.description.on_timeline_start()}onFinish(){this.description.on_timeline_finish&&this.description.on_timeline_finish()}pause(){this.currentChild instanceof L&&this.currentChild.pause(),this.status=w.PAUSED}resume(){this.status==w.PAUSED&&(this.currentChild instanceof L&&this.currentChild.resume(),this.status=w.RUNNING,this.resumePromise.resolve())}abort(){(this.status===w.RUNNING||this.status===w.PAUSED)&&(this.currentChild instanceof L&&this.currentChild.abort(),this.shouldAbort=!0,this.status===w.PAUSED&&this.resume())}instantiateChildNode(e){const t=ue(e)?new L(this.dependencies,e,this):new F(this.dependencies,e,this);return this.children.push(t),t}setCurrentTimelineVariablesByIndex(e){var t;this.currentTimelineVariables=Be(Be({},(t=this.parent)==null?void 0:t.getAllTimelineVariables()),e===null?void 0:this.description.timeline_variables[e])}generateTimelineVariableOrder(){var e;const t=(e=this.description.timeline_variables)==null?void 0:e.length;if(!t)return[null];let n=[...Array(t).keys()];const s=this.description.sample;if(s)switch(s.type){case"custom":n=s.fn(n);break;case"with-replacement":n=Ce(n,s.size,s.weights);break;case"without-replacement":n=Ae(n,s.size);break;case"fixed-repetitions":n=se(n,s.size);break;case"alternate-groups":n=Te(s.groups,s.randomize_group_order);break;default:throw new Error(`Invalid type "${s.type}" in timeline sample parameters. Valid options for type are "custom", "with-replacement", "without-replacement", "fixed-repetitions", and "alternate-groups"`)}return this.description.randomize_order&&(n=I(n)),n}getAllTimelineVariables(){return this.currentTimelineVariables}evaluateTimelineVariable(e){var t;if((t=this.currentTimelineVariables)!=null&&t.hasOwnProperty(e.name))return this.currentTimelineVariables[e.name];throw new Error(`Timeline variable ${e.name} not found.`)}getResults(){const e=[];for(const t of this.children)if(t instanceof F){const n=t.getResult();n&&e.push(n)}else t instanceof L&&e.push(...t.getResults());return e}getNaiveProgress(){if(this.status===w.PENDING)return 0;const e=this.getLatestNode();if(!e)return 1;let t=e.index;return e.getStatus()===w.COMPLETED&&t++,Math.min(t/this.getNaiveTrialCount(),1)}getNaiveTrialCount(){const e=t=>{var n,s,l;const u=a=>a.map(i=>e(i)).reduce((i,o)=>i+o);if(Array.isArray(t))return u(t);if(sr(t))return 1;if(ue(t)){let a=((n=t.timeline_variables)==null?void 0:n.length)||1;switch((s=t.sample)==null?void 0:s.type){case"with-replacement":case"without-replacement":a=t.sample.size;break;case"fixed-repetitions":a*=t.sample.size;break;case"alternate-groups":a=t.sample.groups.map(i=>i.length).reduce((i,o)=>i+o,0);break}return u(t.timeline)*((l=t.repetitions)!=null?l:1)*a}return 0};return e(this.description)}getLatestNode(){var e,t;return(t=(e=this.currentChild)==null?void 0:e.getLatestNode())!=null?t:this}getActiveTimelineByName(e){var t;return this.description.name===e?this:(t=this.currentChild)==null?void 0:t.getActiveTimelineByName(e)}}var Pr=Object.defineProperty,Ue=Object.getOwnPropertySymbols,Er=Object.prototype.hasOwnProperty,_r=Object.prototype.propertyIsEnumerable,Ke=(r,e,t)=>e in r?Pr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,jr=(r,e)=>{for(var t in e||(e={}))Er.call(e,t)&&Ke(r,t,e[t]);if(Ue)for(var t of Ue(e))_r.call(e,t)&&Ke(r,t,e[t]);return r},pe=(r,e,t)=>new Promise((n,s)=>{var l=i=>{try{a(t.next(i))}catch(o){s(o)}},u=i=>{try{a(t.throw(i))}catch(o){s(o)}},a=i=>i.done?n(i.value):Promise.resolve(i.value).then(l,u);a((t=t.apply(r,e)).next())});class Ge{constructor(e){this.turk=rr,this.randomization=er,this.utils=Ye,this.citation={apa:"de Leeuw, J. R., Gilbert, R. A., & Luchterhandt, B. (2023). jsPsych: Enabling an Open-Source Collaborative Ecosystem of Behavioral Experiments. Journal of Open Source Software, 8(85), 5351. https://doi.org/10.21105/joss.05351 ",bibtex:'@article{Leeuw2023jsPsych, author = {de Leeuw, Joshua R. and Gilbert, Rebecca A. and Luchterhandt, Bj{\\" o}rn}, journal = {Journal of Open Source Software}, doi = {10.21105/joss.05351}, issn = {2475-9066}, number = {85}, year = {2023}, month = {may 11}, pages = {5351}, publisher = {Open Journals}, title = {jsPsych: Enabling an {Open}-{Source} {Collaborative} {Ecosystem} of {Behavioral} {Experiments}}, url = {https://joss.theoj.org/papers/10.21105/joss.05351}, volume = {8}, } '},this.options={},this.isFileProtocolUsed=!1,this.finishTrialPromise=new Ie,this.timelineDependencies={onTrialStart:t=>{this.options.on_trial_start(t.trialObject),this.getDisplayContainerElement().focus(),this.getDisplayElement().scrollTop=0},onTrialResultAvailable:t=>{const n=t.getResult();n&&(n.time_elapsed=this.getTotalTime(),this.data.write(t))},onTrialFinished:t=>{const n=t.getResult();this.options.on_trial_finish(n),n&&this.options.on_data_update(n),this.progressBar&&this.options.auto_update_progress_bar&&(this.progressBar.progress=this.timeline.getNaiveProgress())},runOnStartExtensionCallbacks:t=>this.extensionManager.onStart(t),runOnLoadExtensionCallbacks:t=>this.extensionManager.onLoad(t),runOnFinishExtensionCallbacks:t=>this.extensionManager.onFinish(t),getSimulationMode:()=>this.simulationMode,getGlobalSimulationOptions:()=>this.simulationOptions,instantiatePlugin:t=>new t(this),getDisplayElement:()=>this.getDisplayElement(),getDefaultIti:()=>this.getInitSettings().default_iti,finishTrialPromise:this.finishTrialPromise,clearAllTimeouts:()=>this.pluginAPI.clearAllTimeouts()},this.extensionManagerDependencies={instantiateExtension:t=>new t(this)},this.dataDependencies={getProgress:()=>{var t,n;return{time:this.getTotalTime(),trial:(n=(t=this.timeline)==null?void 0:t.getLatestNode().index)!=null?n:0}},onInteractionRecordAdded:t=>{this.options.on_interaction_data_update(t)},getDisplayElement:()=>this.getDisplayElement()},e=jr({display_element:void 0,on_finish:()=>{},on_trial_start:()=>{},on_trial_finish:()=>{},on_data_update:()=>{},on_interaction_data_update:()=>{},on_close:()=>{},use_webaudio:!0,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.options=e,Y(this),window.location.protocol=="file:"&&(e.override_safe_mode===!1||typeof e.override_safe_mode=="undefined")&&(e.use_webaudio=!1,this.isFileProtocolUsed=!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 nt(this.dataDependencies),this.pluginAPI=bt(this),this.extensionManager=new B(this.extensionManagerDependencies,e.extensions)}version(){return We}run(e){return pe(this,null,function*(){typeof e=="undefined"&&console.error("No timeline declared in jsPsych.run(). Cannot start experiment."),e.length===0&&console.error("No trials have been added to the timeline (the timeline is an empty array). Cannot start experiment."),this.timeline=new L(this.timelineDependencies,e),yield this.prepareDom(),yield this.extensionManager.initializeExtensions(),document.documentElement.setAttribute("jspsych","present"),this.experimentStartTime=new Date,yield this.timeline.run(),yield Promise.resolve(this.options.on_finish(this.data.get())),this.endMessage&&(this.getDisplayElement().innerHTML=this.endMessage),this.data.removeInteractionListeners()})}simulate(e){return pe(this,arguments,function*(t,n="data-only",s={}){this.simulationMode=n,this.simulationOptions=s,yield this.run(t)})}getProgress(){var e,t,n,s;return{total_trials:(e=this.timeline)==null?void 0:e.getNaiveTrialCount(),current_trial_global:(n=(t=this.timeline)==null?void 0:t.getLatestNode().index)!=null?n:0,percent_complete:((s=this.timeline)==null?void 0:s.getNaiveProgress())*100}}getStartTime(){return this.experimentStartTime}getTotalTime(){return this.experimentStartTime?new Date().getTime()-this.experimentStartTime.getTime():0}getDisplayElement(){return this.displayElement}getDisplayContainerElement(){return this.displayContainerElement}abortExperiment(e,t={}){this.endMessage=e,this.timeline.abort(),this.pluginAPI.cancelAllKeyboardResponses(),this.pluginAPI.clearAllTimeouts(),this.finishTrial(t)}abortCurrentTimeline(){var e;let t=(e=this.timeline)==null?void 0:e.getLatestNode();t instanceof F&&(t=t.parent),t instanceof L&&t.abort()}abortTimelineByName(e){var t;const n=(t=this.timeline)==null?void 0:t.getActiveTimelineByName(e);n&&n.abort()}getCurrentTrial(){var e;const t=(e=this.timeline)==null?void 0:e.getLatestNode();if(t instanceof F)return t.description}getInitSettings(){return this.options}timelineVariable(e){return new le(e)}evaluateTimelineVariable(e){var t,n;return(n=(t=this.timeline)==null?void 0:t.getLatestNode())==null?void 0:n.evaluateTimelineVariable(new le(e))}pauseExperiment(){var e;(e=this.timeline)==null||e.pause()}resumeExperiment(){var e;(e=this.timeline)==null||e.resume()}getSafeModeStatus(){return this.isFileProtocolUsed}getTimeline(){var e;return(e=this.timeline)==null?void 0:e.description.timeline}getCitations(e=[],t="apa"){const n=["apa","bibtex"];if(t=t.toLowerCase(),Array.isArray(e))if(n.includes(t)){const s=this.citation[t],l=new Set([s]);for(const u of e)try{const a=u.info.citations[t];l.add(a)}catch(a){console.error(`${u} does not have citation in ${t} format.`)}return Array.from(l).join(`
6
+ `)}else throw new Error("Unsupported citation format");else throw new Error("Expected array of plugins/extensions")}get extensions(){var e,t;return(t=(e=this.extensionManager)==null?void 0:e.extensions)!=null?t:{}}prepareDom(){return pe(this,null,function*(){document.readyState!=="complete"&&(yield new Promise(s=>{window.addEventListener("load",s)}));const e=this.options;if(typeof e.display_element=="undefined"){let s=document.body;s||(s=document.createElement("body"),document.documentElement.appendChild(s)),document.querySelector("html").style.height="100%",s.style.margin="0px",s.style.height="100%",s.style.width="100%",e.display_element=s}else{const s=e.display_element instanceof Element?e.display_element:document.querySelector("#"+e.display_element);s===null?console.error("The display_element specified in initJsPsych() does not exist in the DOM."):e.display_element=s}const t=document.createElement("div");t.id="jspsych-content";const n=document.createElement("div");if(n.className="jspsych-content-wrapper",n.appendChild(t),this.displayContainerElement=e.display_element,this.displayContainerElement.appendChild(n),this.displayElement=t,e.experiment_width!==null&&(this.displayElement.style.width=e.experiment_width+"px"),e.display_element.tabIndex=0,this.displayContainerElement.classList.add("jspsych-display-element"),this.displayElement.classList.add("jspsych-content"),this.data.createInteractionListeners(),window.addEventListener("beforeunload",e.on_close),this.options.show_progress_bar){const s=document.createElement("div");s.id="jspsych-progressbar-container",this.progressBar=new nr(s,this.options.message_progress_bar),this.getDisplayContainerElement().insertAdjacentElement("afterbegin",s)}})}finishTrial(e){this.finishTrialPromise.resolve(e)}}class M 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"}}window.jsPsych={get init(){throw new M("`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.")},get data(){throw new M},get randomization(){throw new M},get turk(){throw new M},get pluginAPI(){throw new M},get ALL_KEYS(){throw new M('jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.')},get NO_KEYS(){throw new M('jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.')}},typeof window!="undefined"&&window.hasOwnProperty("webkitAudioContext")&&!window.hasOwnProperty("AudioContext")&&(window.AudioContext=webkitAudioContext);function kr(r){const e=new Ge(r);return Object.defineProperties(e,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(([t,n])=>[t,{get(){throw new M(n)}}]))),e}return V.DataCollection=b,V.JsPsych=Ge,V.ParameterType=T,V.initJsPsych=kr,V}({}),initJsPsych=jsPsychModule.initJsPsych;
7
+ //# sourceMappingURL=https://unpkg.com/jspsych@8.2.2/dist/index.browser.min.js.map