/*! * PennController for IBEX * This software is licensed under a BSD license; see the LICENSE file for details. * * - Version 2.0 * - Last Update: 2021, July 26 * - Major changes in version 2.0: * * Fixed Controller element duplicating lines and not rerunning properly * * Fixed selector.shuffle and its order logging * * Improved handling of trial end for the MediaRecorder element * * Improved audio/video recording upload * * Fixed print/canvas.add coordinates format bug (introduced in 1.9) * * Can now pass opacity of 0 to audio.disable and video.disable * * Fixed all-digit strings passed to Key element * * Fixed MediaRecorder stop / end of trials * * Fixed problems with some special commands (eg. fullscreen) not being properly executed as callback * * Fixed: Controller elements no longer appear multiple times when printed onto a Canvas element * * Fixed: calling print() after print(x,y[, canvas]) no longer preserves old positioning * * Fixed: referencing PennController element in scale.label before printing it * * Fixed elusive flickering with scaling * * Fixed selector.shuffle with elements printed before/after other elements * * Replaced the EyeTracker test with a smoother one * * Resources are now preloading 4 at a time, following the running order (= less aggressive requests) * * Fixed audio and video preloading problems * * Fixed video.disable semi-opaque layer * + Added newTrial().noTrialLog("start","end") to skip the tria's Start and/or End lines in the results file * + Added controller.callback * + Added textinput.callback * + Added specialcommand jump to navigate the sequence * + Added element DragDrop * + Added support of flac audios in zip files * */!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=44)}([function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(1);let i=[],o={keypress:[]};class s{constructor(e,t,r){this.name=e,this.value=e,this.creator=t,this.controllers=[],this.object=null,this.status="void",this.useURLs=void 0===r||r,this.created_at=0}create(){this.status="pending",this.created_at=Date.now(),this.creator.call(this,()=>this.resolve())}resolve(){this.status="ready",a.debug.log("
Successfully preloaded resource "+this.name+"
")}}var a={resources:{list:[],fetch:function(e,t,r){var n=a.resources.list.filter(t=>t.name==e&&t.controllers.indexOf(a.controllers.underConstruction.id)<0);return(n=n.length?n[0]:new s(e,t,r)).controllers.push(a.controllers.underConstruction.id),a.controllers.underConstruction.resources.push(n),"void"!=n.status||(n.creator=t,a.resources.list.push(n)),n}},controllers:{list:[],running:null,underConstruction:null},elements:{list:[]},events:{keypress:e=>{let t=[e,a.controllers.running||a.controllers.underConstruction];if(o.keypress.push(t),a.controllers.running){let e=a.controllers._endTrial;a.controllers.running._endTrial=async function(){await e.apply(a.controllers.running),t[0]=()=>{}}}else{let e=a.controllers.underConstruction.sequence;a.controllers.underConstruction.sequence=Object(n.d)([e,e=>{t[0]=()=>{},e()}])}}},URLs:[],utils:{guidGenerator:n.b,parseCoordinates:n.h,printAndRefreshUntil:n.j,levensthein:n.e,upload:n.k,overToScale:n.g},tmpItems:[],tables:{},Prerun:function(e){i.push(e)}};let l=window.ibex_controller_set_properties;window.ibex_controller_set_properties=function(e,t){if(l(e,t),"__SendResults__"==e){document.addEventListener("keydown",e=>{if(!e.repeat&&a.controllers.running)for(let t=0;t{const e=t=>{a.runningOrder&&a.runningOrder.active?t():window.requestAnimationFrame(()=>e(t))};await new Promise(e);let t=[];a.runningOrder.active.forEach(e=>e.forEach(e=>{"PennController"==e.controller&&(t=[...t,...e.options.resources])}));let r=[];const n=()=>{if(r=r.filter(e=>"ready"!=e.status||e.created_at&&Date.now()-e.created_at>1e4),t.length>0&&r.length<4){let e=t.shift();for(;(void 0===e||"ready"==e.status)&&t.length;)e=t.shift();e&&"ready"!=e.status&&r.push(e)}0!=r.length&&(r.forEach(e=>{if(e instanceof s&&"void"==e.status&&(e.create(),e.useURLs))for(let t in a.URLs)e.create.apply($.extend({},e,{value:a.URLs[t]+e.name,resolve:function(){"ready"!=e.status&&(e.object=this.object,e.resolve())}}))}),window.requestAnimationFrame(n))};n()})},function(e,t,r){"use strict";function n(e){return()=>new Promise((async function(t){for(let t in e)if(e[t]instanceof Function)var r=await e[t]();t(r)}))}function i(e){const t=new Uint8Array(e);let r=[];return t.forEach(e=>{r.push(e.toString(16))}),r.join("").toUpperCase()}r.d(t,"d",(function(){return n})),r.d(t,"c",(function(){return i})),r.d(t,"g",(function(){return s})),r.d(t,"k",(function(){return a})),r.d(t,"a",(function(){return l})),r.d(t,"f",(function(){return u})),r.d(t,"b",(function(){return c})),r.d(t,"i",(function(){return d})),r.d(t,"h",(function(){return h})),r.d(t,"j",(function(){return p})),r.d(t,"e",(function(){return m}));const o=function(e){const t=this.css("transform").match(/matrix\(\s*(-?\d+(.\d+)?),[^,]+,[^,]+,\s*(-?\d+(.\d+)?),/);return t&&(e.x=e.x*Number(t[1]),e.y=e.y*Number(t[3])),e};function s(e,t){let r=this,n={x:1,y:1};for(;r;)o.call(r,n),r=r.parent(),r[0]===document&&(r=void 0);let i=this.offset(),s=this.width(),a=this.height(),l=s*n.x,u=a*n.y;return i.left<=e&&i.top<=t&&i.left+l>=e&&i.top+u>=t}async function a(e,t,r,n){let i;try{i=await new Promise((r,i)=>{const o=new XMLHttpRequest,s=e.match(/\?/)?"&":"?";o.open("GET",e+s+"filename="+encodeURIComponent(t)+"&mimetype="+encodeURIComponent(n),!0),o.setRequestHeader("Content-Type","application/json"),o.onerror=t=>i("Could not GET "+e+";"),o.onload=function(){let e=null;try{e=JSON.parse(this.responseText)}catch{e=this.responseText}console.log("response",e),r(e)},console.log("before sending xhr"),o.send(),console.log("after sending xhr")})}catch(e){return new Promise((t,r)=>r(e))}console.log("presignedPostData",i);const o=new FormData;return void 0===i||"string"==typeof i?(o.append("fileName",t),o.append("mimeType",n),o.append("file",r)):(Object.keys(i).forEach(t=>{"url"==t?e=i.url:o.append(t,i[t])}),o.append("file",r),i.key&&(t=i.key)),new Promise((r,n)=>{const i=new XMLHttpRequest;i.open("POST",e,!0),i.onload=()=>r(t),i.onerror=()=>n(i.responseText);try{i.send(o)}catch(t){return n("Could not POST to "+e+"; "+t)}})}function l(e,t){if(e.match(/^00000[12]00/i))return"image/x-icon";if(e.match(/424D/i))return"image/bmp";if(e.match(/^89504E470?D0?A1A0?A/i))return"image/png";if(e.match(/^474946383[79]61/i))return"image/gif";if(e.match(/^52494646........574542505650/i))return"image/webp";if(e.match(/^FFD8FF/i))return"image/jpeg";if(e.match(/^2E736E64/i))return"audio/basic";if(e.match(/^464F524D........41494646/i))return"audio/aiff";if(e.match(/^(fff[b3a2]|494433)/i))return"audio/mpeg";if(e.match(/^664C6143/i))return"audio/flac";if(e.match(/^4F67675300/i))return"application/ogg";if(e.match(/^4D546864......06/i))return"audio/midi";if(e.match(/^52494646........41564920/i))return"video/avi";if(e.match(/^52494646.{4,8}57415645/i))return"audio/wave";if(e.match(/^1A45DFA3/i))return"video/webm";if(e.match(/^25504446/i))return"application/pdf";if(e.match(/^504B0304/i))return"application/zip";{let e=t.match(/\.([^.]+)$/);if(!e)return"";switch(e[1].toLowerCase()){case"bmp":return"image/bmp";case"png":return"image/png";case"gif":return"image/gif";case"webp":return"image/webp";case"jpg":case"jpeg":return"image/jpeg";case"mp3":return"audio/mpeg";case"flac":return"audio/flac";case"ogg":case"oga":return"audio/ogg";case"midi":case"mid":return"audio/midi";case"wav":return"audio/wave";case"webm":return"video/webm";case"avi":return"video/avi";case"mp4":return"video/mp4";case"ogv":return"video/ogg";case"mov":return"video/quicktime";default:return""}}}function u(e){let t=e/1e3%60,r=Math.trunc(e/6e4);return(r>0?r+"min":"")+(t>0?t+"s":"")}function c(){var e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}function d(e){return e.map(e=>e instanceof Object&&e.hasOwnProperty("_promises")&&e.type&&e._element?e.type+":"+e._element.id:e)}function h(e,t){const r=this.css("transform").match(/matrix\(\s*(-?\d+(.\d+)?),[^,]+,[^,]+,\s*(-?\d+(.\d+)?),/),n=window.getComputedStyle(this[0]),i=Number(n.width.replace(/px$/,"")),o=Number(n.height.replace(/px$/,""));let s=i,a=o;r&&(s=Math.abs(s*r[1]),a=Math.abs(a*r[3]));let l=String(e).match(/^(.+)\s+at\s+(.+)$/i),u=String(t).match(/^(.+)\s+at\s+(.+)$/i);if(l&&(e=String(l[2])),u&&(t=String(u[2])),isNaN(e)||(e+="px"),isNaN(t)||(t+="px"),l){if(l[1].match(/top|bottom/i))throw"Passed Y coordinate in place of X";e=l[1].match(/center|middle/i)?`calc(${e} - ${i/2}px)`:l[1].match(/right/i)?`calc(${e} - ${s-(s-i)/2}px)`:`calc(${e} + ${(s-i)/2}px)`}else e=`calc(${e} + ${(s-i)/2}px)`;if(u){if(u[1].match(/left|right/i))throw"Passed X coordinate in place of Y";t=u[1].match(/center|middle/i)?`calc(${t} - ${o/2}px)`:u[1].match(/bottom/i)?`calc(${t} - ${a-(a-o)/2}px)`:`calc(${t} + ${(a-o)/2}px)`}else t=`calc(${t} + ${(a-o)/2}px)`;return{x:e,y:t}}function f(e,t,r,n,i){if(n instanceof Function&&n())return this.css(i);const o=h.call(this,e,t);this.css({position:"absolute",left:o.x,top:o.y}),window.requestAnimationFrame(()=>f.call(this,e,t,r,n,i))}function p(e,t,r,n){r=r||$("body");const i=this.parent()[0],o={display:this.css("display"),position:this.css("position"),left:this.css("left"),top:this.css("top")};void 0!==i&&i==r[0]||this.appendTo(r).css("display","inline-block"),f.call(this,e,t,r,n,o)}function m(e,t){let r=[];r[0]=("a"+t).split("").map((e,t)=>t);for(let n=1;n0)];for(let n=1;ne.toUpperCase());String.prototype.isSpecialKey=function(e){return e?g.indexOf(this)>-1:y.indexOf(this.toUpperCase())>-1},jQuery.fn.printed=function(){let e=this.parent();for(;e.length;){if(e[0]==document.body)return!0;e=e.parent()}return!1}},function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return c}));var n=r(0),i=r(1);let o=null,s=null,a=[];class l{constructor(){if(this.id=n.a.controllers.list.length,this.useLabel=!1,this.addToItems=!0,this.appendResultLine=[],this.linesToSave=[],this.resources=[],this.elements={},this.ambiguousElementNames=[],this.preloadDelay=6e4,n.a.controllers.list.push(this),this.defaultCommands={},this.headerDefaultCommands={},o&&o.defaultCommands)for(let e in o.defaultCommands)this.defaultCommands[e]=[].concat(o.defaultCommands[e])}_addElement(e){if(!e.hasOwnProperty("type")||!e.hasOwnProperty("id"))return n.a.debug.error("Attempted to create an invalid element");this.elements.hasOwnProperty(e.type)||(this.elements[e.type]={}),this.elements[e.type].hasOwnProperty(e.id)&&n.a.debug.warning("Overwrting another "+e.type+" element with the same name ("+e.id+")"),this.elements[e.type][e.id]=e}_getElement(e,t){if("string"!=typeof e||e.length<1||"string"!=typeof t||t.length<1)return n.a.debug.error("Attempted to get an invalid element",e,t);if(!this.elements.hasOwnProperty(t))return n.a.debug.error("Attempted to get an element of an invalid type ("+t+")",e);if(!this.elements[t].hasOwnProperty(e)){let r=[];for(let t in this.elements)this.elements[t].hasOwnProperty(e)&&r.push(t);return n.a.debug.error("No "+t+" element named ""+e+"" found",r.length?"Found ""+e+"" of type "+r.join(","):null)}return this.elements[t][e]}label(e){return this.useLabel=e,this}logAppend(e,t,r){return this.linesToSave.push(["PennController",this.id,e,t,Date.now(),r]),this}log(e,t){return null==t&&(t=e),void 0===e?(n.a.debug.warning("Used newTrial().log with no arguments"),this):(this.appendResultLine.push([csv_url_encode(e),t]),this)}noHeader(){return this.runHeader=!1,this}noFooter(){return this.runFooter=!1,this}setOption(e,t){return this[e]=t,this}noTrialLog(...e){return this.skipLog=e,this}}n.a.controllers.underConstruction=new l,n.a.controllers.new=()=>new l;const u=[];var c=function(...e){let t=n.a.controllers.underConstruction;if(window.items)for(let e in window.items)n.a.tmpItems.indexOf(window.items[e])<0&&n.a.tmpItems.push(window.items[e]);n.a.tmpItems.push(t),e.length&&"string"==typeof e[0]&&(t.useLabel=e[0]);let r=[];return function e(...t){for(let r in t)u.filter(e=>e instanceof Function&&e.call(null,t[r])),t[r]&&t[r]._promises?this.push(Object(i.d)(t[r]._promises)):t[r]&&t[r]instanceof Array&&e.apply(this,t[r])}.apply(r,e),t.sequence=Object(i.d)(r),n.a.controllers.underConstruction=new l,t};n.a.NewTrialArgumentCallback=e=>u.push(e),c.newTrial=c,c.Debug=function(e){n.a.debug.on=null==e||e},c.DebugOff=()=>c.Debug(!1),c.Sequence=function(...e){for(let t=0;t1&&"__SendResults__"==e[t]._item[1]){let r="sendResults-"+Object(i.b)();e[t].label(r),e[t]=r}window.shuffleSequence=window.seq(...e)};let d={};c.GetURLParameter=function(e){if(!Object.keys(d).length){let e=window.location.search.replace("?","").split("&");for(let t in e)d[e[t].split("=")[0]]=e[t].split("=")[1]}if(d.hasOwnProperty(e))return d[e]},c.AddHost=function(...e){for(let t in e)"string"==typeof e[t]&&e[t].match(/^https?:\/\//i)?n.a.URLs.push(e[t]):n.a.debug.warning("URL #"+t+" is not a valid URL (PennController.AddHost).",e[t])},c.CheckPreloaded=function(...e){let t=new l;t.id="Preloader-"+a.length,t.runHeader=!1,t.runFooter=!1,a.push(t),n.a.controllers.list.pop(),t.sequence=()=>new Promise(e=>e()),t.ignoreWhenCheckingPreload=!0,n.a.tmpItems.push(t),e.length&&Number(e[e.length-1])>0&&(t.preloadDelay=Number(e[e.length-1]),e.pop());let r=[];if(e.length)for(let t in e){let n=e[t];"string"==typeof n&&(n=r=>r==e[t]),n instanceof Function&&r.push(n)}else r=[e=>!0];return n.a.Prerun(()=>{let e=window.conf_modifyRunningOrder;window.conf_modifyRunningOrder=function(n){e instanceof Function&&(n=e.call(this,n));for(let e=0;e{let t=!1;for(let n=0;nt.resources.indexOf(e)<0))}return n}}),t};const h=window.JSON.stringify;window.JSON.stringify=function(...e){const t=h.apply(this,e);if(1==e.length&&e[0]instanceof Array&&6==e[0].length&&!1===e[0][0]&&e[0][1]==window.__counter_value_from_server__&&e[0][4]==(()=>{for(var e=(new Date).getTimezoneOffset()+":",t=["Java","QuickTime","DevalVR","Shockwave","Flash","Windows Media Player","Silverlight","VLC Player"],r=0;rnew Promise(e=>{const r=window.__server_py_script_name__;let i={_finishedCallback:()=>{window.__server_py_script_name__=r,e()},_cssPrefix:"",_utils:n.a.controllers.running.utils},o=window.$("

").addClass("PennController-SendResults");n.a.controllers.running.element.append(o),addSafeBindMethodPair("__SendResults__"),"string"==typeof t&&(window.__server_py_script_name__=t),o.__SendResults__(i)}),s={label:e=>(i[0]=e,s),setOption:(e,t)=>(r[e]=t,s)};s._item=i,s.type="__SendResults__",s._element={id:"SendResults"};const a=e=>{if(e==s){let e=window.items&&window.items.indexOf(i);e>=0&&window.items.splice(e,1),n.a.tmpItems=n.a.tmpItems.filter(e=>e!=i)}};return n.a.ArgumentCallback(a),n.a.NewTrialArgumentCallback(a),s._promises=[o],s._runPromises=o,window.items.push(i),s},c.SetCounter=function(...e){null==window.items&&(window.items=[]);let t="setCounter",r={};e.length&&(isNaN(Number(e[0]))?1==e.length?isNaN(Number(e[0]))?t=e[0]:r.set=Number(e[0]):2!=e.length||isNaN(Number(e[1]))?e.length>2&&!isNaN(Number(e[2]))?(t=e[0],e[1].match(/\s*inc\s*$/i)?r.inc=e[2]:r.set=e[2]):t=e[0]:e[0].match(/\s*inc\s*$/i)?r.inc=e[1]:(r.set=e[1],e[0].match(/\s*set\s*$/i)||(t=e[0])):r.set=Number(e[0]));let n=[t,"__SetCounter__",r];return r.label=e=>(n[0]=e,r),r.setOption=(e,t)=>(r[e]=t,r),window.items.push(n),r},c.Header=function(...e){let t=n.a.controllers.underConstruction;t.id="Header",t.addToItems=!1,n.a.controllers.list.pop(),t.sequence=Object(i.d)(e.map(e=>Object(i.d)(e._promises)));for(let e in t.defaultCommands)for(let r in t.defaultCommands[e])t.defaultCommands[e][r].push("header");return o?(o.resources=o.resources.concat(t.resources),$.extend(!0,o.elements,t.elements),o.headerDefaultCommands=t.headerDefaultCommands,o.sequence=Object(i.d)([o.sequence,t.sequence])):o=t,n.a.controllers.underConstruction=new l,o},c.Footer=function(...e){let t=n.a.controllers.underConstruction;return t.id="Footer",t.addToItems=!1,n.a.controllers.list.pop(),t.sequence=Object(i.d)(e.map(e=>Object(i.d)(e._promises))),s?(s.resources=s.resources.concat(t.resources),$.extend(!0,s.elements,t.elements),s.headerDefaultCommands=t.headerDefaultCommands,s.sequence=Object(i.d)([s.sequence,t.sequence])):s=t,n.a.controllers.underConstruction=new l,s},define_ibex_controller({name:"PennController",jqueryWidget:{_init:function(){var e=this;n.a.controllers.running=e,e.cssPrefix=e.options._cssPrefix,e.utils=e.options._utils,e.finishedCallback=e.options._finishedCallback,e.id=e.options.id,"string"==typeof e.id&&e.id.match(/^Preloader-/)?e.controller=a[Number(e.id.replace(/Preloader-/,""))]:"Header"==e.id?e.controller=o:"Footer"==e.id?e.controller=s:Number(e.id)>=0&&Number(e.id)e.controller.resources.indexOf(t)<0)),$.extend(!0,e.controller.elements,o.elements);for(let t=0;te.controller.resources.indexOf(t)<0)),$.extend(!0,e.controller.elements,s.elements);for(let t=0;t0&&0==s.skipLog.filter(e=>e.match(/start/i)).length)||e.save("PennController",e.id,"_Footer_","Start",Date.now(),"NULL"),s._getElement=(t,r)=>e.controller._getElement(t,r),await s.sequence(),s.skipLog instanceof Array&&!(s.skipLog.length>0&&0==s.skipLog.filter(e=>e.match(/end/i)).length)||e.save("PennController",e.id,"_Footer_","End",Date.now(),"NULL"));for(let t in e.controller.elements)for(let r in e.controller.elements[t])await e.controller.elements[t][r].end();e.controller.skipLog instanceof Array&&!(e.controller.skipLog.length>0&&0==e.controller.skipLog.filter(e=>e.match(/end/i)).length)||e.save("PennController",e.id,"_Trial_","End",Date.now(),"NULL"),r.sort((e,t)=>e[4][1]>t[4][1]),r.map(e=>{for(let t in e){e[t][1]instanceof Function&&(e[t][1]=e[t][1]());let r=[];for(;e[t][1].value&&e[t][1].value._element;)r.indexOf(e[t][1]._element)<0?(r.push(e[t][1]._element),e[t][1]=e[t][1].value):e[t][1]=e[t][1]._element.id;e[t][1]._element&&e[t][1]._element.id&&(e[t][1]=e[t][1]._element.value),e[t][1]=csv_url_encode(""+e[t][1])}}),e.finishedCallback(r)}};e.endTrial=c;let d=!1,h=async function(t){if(!d){if(e.element.css({display:"flex","flex-direction":"column",position:"absolute",left:0,width:"100vw"}),d=!0,t)for(let t in e.controller.resources.filter(e=>"ready"!=e.status))e.save("PennController",e.id,"_PreloadFailed_",csv_url_encode(e.controller.resources[t].name),Date.now(),"NULL");f.remove(),e.controller.skipLog instanceof Array&&!(e.controller.skipLog.length>0&&0==e.controller.skipLog.filter(e=>e.match(/start/i)).length)||e.save("PennController",e.id,"_Trial_","Start",Date.now(),"NULL"),e.runHeader&&o instanceof l&&(o.skipLog instanceof Array&&!(o.skipLog.length>0&&0==o.skipLog.filter(e=>e.match(/start/i)).length)||e.save("PennController",e.id,"_Header_","Start",Date.now(),"NULL"),await o.sequence(),o.skipLog instanceof Array&&!(o.skipLog.length>0&&0==o.skipLog.filter(e=>e.match(/end/i)).length)||e.save("PennController",e.id,"_Header_","End",Date.now(),"NULL")),e.controller.sequence().then(c)}},f=$("

Please wait while the resources are preloading

This may take up to "+Object(i.f)(t)+".

");e.element.append(f);for(let t in e.controller.resources){let r=e.controller.resources[t],n=r.resolve;"ready"!=r.status&&(r.resolve=function(){n.apply(r),0==e.controller.resources.filter(e=>"ready"!=e.status).length&&h()})}0==e.controller.resources.filter(e=>"ready"!=e.status).length?h():setTimeout((function(){h(!0)}),t)}},properties:{obligatory:[],countsForProgressBar:!0,htmlDescription:null}}),window.PennController=new Proxy(c,{get:(e,t)=>{if(t in e)return e[t];n.a.debug.error("Unknown global PennController command: ‘"+t+"’")}})},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n={};function i(){try{return new window.XMLHttpRequest}catch(e){}}n._getBinaryFromXHR=function(e){return e.response||e.responseText};var o=window.ActiveXObject?function(){return i()||function(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}()}:i;n.getBinaryContent=function(e,t){try{var r=o();r.open("GET",e,!0),"responseType"in r&&(r.responseType="arraybuffer"),r.overrideMimeType&&r.overrideMimeType("text/plain; charset=x-user-defined"),r.onreadystatechange=function(i){var o,s;if(4===r.readyState)if(200===r.status||0===r.status){o=null,s=null;try{o=n._getBinaryFromXHR(r)}catch(e){s=new Error(e)}t(s,o)}else t(new Error("Ajax error for "+e+" : "+this.status+" "+this.statusText),null)},r.send()}catch(e){t(new Error(e),null)}},e.exports=n},function(e,t,r){(function(r){var n,i,o;i=[],void 0===(o="function"==typeof(n=function(){"use strict";function t(e,t,r){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){s(n.response,t,r)},n.onerror=function(){console.error("could not download file")},n.send()}function n(e){var t=new XMLHttpRequest;return t.open("HEAD",e,!1),t.send(),200<=t.status&&299>=t.status}function i(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(r){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var o="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof r&&r.global===r?r:void 0,s=o.saveAs||"object"!=typeof window||window!==o?function(){}:"download"in HTMLAnchorElement.prototype?function(e,r,s){var a=o.URL||o.webkitURL,l=document.createElement("a");r=r||e.name||"download",l.download=r,l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?i(l):n(l.href)?t(e,r,s):i(l,l.target="_blank")):(l.href=a.createObjectURL(e),setTimeout((function(){a.revokeObjectURL(l.href)}),4e4),setTimeout((function(){i(l)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,r,o){if(r=r||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Depricated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}(e,o),r);else if(n(e))t(e,r,o);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout((function(){i(s)}))}}:function(e,r,n,i){if((i=i||open("","_blank"))&&(i.document.title=i.document.body.innerText="downloading..."),"string"==typeof e)return t(e,r,n);var s="application/octet-stream"===e.type,a=/constructor/i.test(o.HTMLElement)||o.safari,l=/CriOS\/[\d]+/.test(navigator.userAgent);if((l||s&&a)&&"object"==typeof FileReader){var u=new FileReader;u.onloadend=function(){var e=u.result;e=l?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),i?i.location.href=e:location=e,i=null},u.readAsDataURL(e)}else{var c=o.URL||o.webkitURL,d=c.createObjectURL(e);i?i.location=d:location.href=d,i=null,setTimeout((function(){c.revokeObjectURL(d)}),4e4)}};o.saveAs=s.saveAs=s,e.exports=s})?n.apply(t,i):n)||(e.exports=o)}).call(this,r(3))},function(e,t,r){"use strict";var n=r(0),i=r(1);$.prototype.left=function(){return Number(this.css("left").replace(/px/,""))},$.prototype.top=function(){return Number(this.css("top").replace(/px/,""))};n.a.Prerun(()=>{const e=window.location.pathname;if(!n.a.debug.on||null==="2.0".match(/beta/i)||window.localStorage&&window.localStorage.getItem(e))return;const t=new o("Beta Version",400,200,"calc(50vw - 200px)","calc(50vh - 100px)");t.container.find("div:nth-child(3)").remove(),t.content.html("

Please note that this project is using a beta version of PennController (2.0).

\n

Report new bugs at https://www.pcibex.net/bug-report/\n or at support@pcibex.net

"),t.popIn(),t.titleExpand.click().remove();const r=t.popOut;t.popOut=()=>{window.localStorage.setItem(e,!0),r.call(t)}});class o{constructor(e,t,r,n,i){let o=this;this.title=e,this.width=t,this.height=r,this.x=n,this.y=i,this.tabs=[],this.container=$("
").css({width:t,height:"3em",overflow:"hidden",position:"fixed","border-radius":"5px","background-color":"floralwhite","min-height":"3em","min-width":"3em","z-index":9999}),this.titleBar=$("
").css({width:"100%",height:"1.5em",margin:0,padding:0,"background-color":"gray",cursor:"move",color:"white","border-radius":"5px 5px 0px 0px"}),this.titleExpand=$("").css({display:"inline-block","line-height":"1.3em",padding:"2px","margin-right":"0.25em",cursor:"pointer"}).click(()=>{9656==this.titleExpand.html().charCodeAt(0)?(this.titleExpand.html("▾"),this.container.css({height:this.height,overflow:"unset"})):(this.titleExpand.html("▸"),this.container.css({height:"3em",overflow:"hidden"}))}),this.titleSpan=$(""+e+"").css({display:"inline-block",padding:"2px","line-height":"1.3em",overflow:"hidden"}),this.titleBar.append(this.titleSpan.prepend(this.titleExpand)).append($("X").css({width:"1.3em",height:"1.3em",margin:"0.1em","line-height":"1.3em","border-radius":"2px","text-align":"center",position:"absolute",right:0,cursor:"pointer",overflow:"hidden"}).click((function(){o.popOut()})).mouseenter((function(){$(this).css({border:"solid 1px lightgray","border-radius":"2px"})})).mouseleave((function(){$(this).css({border:"none"})}))).mousedown((function(e){o.updatePosition={x:e.clientX,y:e.clientY,left:o.container.left(),top:o.container.top()},e.preventDefault()})),this.tabBar=$("
").css({width:"calc(100% - 10px)",height:"1.5em","margin-bottom":"0px",overflow:"hidden",display:"flex","margin-left":"5px","margin-right":"5px"}),this.tabBar.append($("
").css({width:"100%","border-bottom":"solid 1px lightgray"})),this.newTab=(e,t)=>{e instanceof jQuery||(e=$("").append(e)),t instanceof jQuery||(t=$("
").append(t));let r={title:e,content:t,jQuery:$("
").append(e).css({border:"solid 1px lightgray","border-top-right-radius":"5px","border-top-left-radius":"5px","padding-left":"5px","padding-right":"5px",cursor:"pointer"}).click(()=>{this.content.children().detach(),this.content.append(r.content),this.tabBar.children().css({background:"linen",color:"darkgray","border-bottom":"solid 1px lightgray"}),r.jQuery.css({color:"black",background:"inherit","border-bottom":"none"}),a.activeTab=r}),remove:()=>this.jQuery.remove()};return this.tabs.push(r),this.tabBar.prepend(r.jQuery),r},this.container.append($("
").css({display:"inline-block",width:"1.3em",height:"1.3em",position:"absolute",bottom:0,right:0,cursor:"se-resize",background:"repeating-linear-gradient(135deg,rgba(255,255,255,.5),rgba(255,255,255,.5) 2px,#777 2px,#777 4px)","clip-path":"polygon(90% 0,90% 90%,0 90%)",opacity:"0.5"}).mousedown((function(e){o.updateSize=!0,o.offsetRight=e.clientX-(o.container.left()+o.container.width()),o.offsetBottom=e.clientY-(o.container.top()+o.container.height()),e.preventDefault()}))),this.content=$("
").css({border:"solid 1px lightgray","font-family":"monospace","font-size":"0.9em",margin:"0px 5px 5px 5px",padding:"2px",height:"calc(100% - 4.5em - 30px)",overflow:"auto","border-top":"none"}),this.container.append(this.titleBar),this.container.append($("
Use DebugOff() before publishing.
").css({height:"1.5em","overflow-x":"hidden"})),this.container.append(this.tabBar),this.container.append(this.content),this.container.css({left:n,top:i}),$(document).mousemove((function(e){o.updatePosition&&(o.x=o.updatePosition.left+(e.clientX-o.updatePosition.x),o.y=o.updatePosition.top+(e.clientY-o.updatePosition.y),o.container.css({left:o.x,top:o.y})),o.updateSize&&(o.width=e.clientX-o.container.left()-o.offsetRight,o.height=e.clientY-o.container.top()-o.offsetBottom,o.container.css({width:o.width,height:o.height}))})).mouseup((function(){o.updatePosition=void 0,o.updateSize=!1}))}popIn(){$(document.body).append(this.container)}popOut(){this.container.detach()}}let s=!1,a={popin:{},tablePopin:{},infoTab:null,runningOrder:null,runningIndex:-1,runningElement:-1,currentController:null,currentTable:null,activeTab:null};n.a.debug={on:!0,currentPromise:null,forceResolve:()=>{n.a.debug.currentPromise instanceof Function&&n.a.debug.currentPromise()},addToTab:(e,...t)=>{if(!n.a.debug.on)return;let r;r=n.a.controllers.running?n.a.controllers.list[n.a.controllers.running.id]:n.a.controllers.underConstruction,null==r&&(r={id:"NA"});let i=new Date;e.prepend($("
["+[i.getHours(),i.getMinutes(),i.getSeconds()].join(":")+"] "+t.join(";")+" (newTrial: "+r.id+(r.useLabel?"-"+r.useLabel:"")+")
").css({"border-bottom":"dotted 1px gray","margin-bottom":"1px","padding-bottom":"1px"}))},log:(...e)=>n.a.debug.addToTab(a.logTab.log,...e),warning:(...e)=>{n.a.debug.on&&(n.a.debug.addToTab(a.warningsTab.content,...e),a.warningsTab.title.css("color","orange"),a.warningsTab.content.find(".PennController-debug-nowarnings").css("display","none"),9656==a.popin.titleExpand.html().charCodeAt(0)&&a.popin.titleExpand.click(),a.warningsTab.jQuery.click())},error:(...e)=>{n.a.debug.on&&(n.a.debug.addToTab(a.errorsTab.content,...e),a.errorsTab.title.css("color","red"),a.errorsTab.content.find(".PennController-debug-noerrors").css("display","none"),9656==a.popin.titleExpand.html().charCodeAt(0)&&a.popin.titleExpand.click(),a.errorsTab.jQuery.click())}},a.popin=new o("Debug (PennController 2.0)",440,240,window.innerWidth-450,10),a.logTab=a.popin.newTab("Log"),a.logTab.controls=$("
").append($("").click(()=>{"PennController-"==a.currentController._cssPrefix?n.a.controllers.running.endTrial():a.currentController._finishedCallback()})).append($("").click(()=>n.a.debug.forceResolve())).css({background:"lightgray","border-bottom":"dotted 1px black"}).appendTo(a.logTab.content),a.logTab.log=$("
").appendTo(a.logTab.content),a.warningsTab=a.popin.newTab("Warnings"),a.warningsTab.content.prepend($("
No warnings
").css({"font-style":"italic","text-align":"center",margin:"5px"}).addClass("PennController-debug-nowarnings")),a.errorsTab=a.popin.newTab("Errors"),a.errorsTab.content.prepend($("
No errors found
").css({"font-style":"italic","text-align":"center",margin:"5px"}).addClass("PennController-debug-noerrors"));let l=()=>{a.currentTable&&a.currentTable.debug&&(a.currentTable.debug.content.find("tr").css("background-color","transparent"),$(a.currentTable.debug.content.find("tr")[a.currentRow+1]).css("background-color","pink"),a.tablePopin.titleSpan.after(u),a.currentTable.hasOwnProperty("group")&&a.currentTable.table[0].hasOwnProperty(a.currentTable.group)&&u.after(d))},u=$("").click((function(){a.currentTable.debug.jQuery.click();let e=$(a.currentTable.debug.content.find("tr")[a.currentRow+1]).position().top;a.currentTable.debug.content.children()[2].scrollTop+=e})).css({display:"inline-block",padding:"2px 5px","line-height":"1.3em",overflow:"hidden"}),c=!1,d=$("👁").click((function(){if(c)a.currentTable.debug.content.find("tr").css("display","table-row");else{let e=a.currentTable.table[a.currentRow][a.currentTable.group],t=a.currentTable.debug.content.find("tr");for(let r=0;r{let t=Object.keys(e.table[0]),r=$("").css({display:"table","table-layout":"fixed",height:"100%",width:70*(t.length+1)}),n=$("
").css({display:"table","table-layout":"fixed",height:"100%",width:70*(t.length+1)}),i=$("");i.append($("
").html("#").css({width:70,overflow:"hidden"}));for(let e=0;e").html(t[e]).css({width:70,overflow:"hidden"}));n.append(i);for(let n=0;n");i.append($("").html(""+Number(n+1)+".").css({width:70,overflow:"hidden"}));for(let r=0;r").html(e.table[n][t[r]]).css({width:70,overflow:"hidden"}));r.append(i)}let o=$("
").css({height:"calc(100% - 1.5em)",overflow:"auto"}).append(r),s=$("
").css({height:"1.5em",width:"100%"}),a=$("
").css({width:"100%",position:"absolute",left:0,top:0}).append(n);return o.scroll(()=>a.css("margin-left",-1*o[0].scrollLeft)),$("
").css({width:"100%",height:"100%","white-space":"nowrap",position:"relative",overflow:"hidden"}).append(a).append(s).append(o)},f=e=>{if(a.tablePopin.hasOwnProperty("container"))a.tablePopin.container.parent().length>0?a.tablePopin.tabs[e].jQuery.click():$(document.body).append(a.tablePopin.container);else{a.tablePopin=new o("Tables",window.innerWidth-320,190,10,window.innerHeight-200);let t=Object.keys(n.a.tables);for(let e=0;e{if(a.runningIndex<0&&(a.runningIndex=0),a.runningElement<0?a.runningElement=0:(a.runningElement++,a.runningElement>=a.runningOrder[a.runningIndex].length&&(a.runningElement=0,a.runningIndex++)),"__SendResults__"==a.runningOrder[a.runningIndex][a.runningElement].controller&&(s=!0),!n.a.debug.on)return void(window.items=void 0);if(w(),g(),u.detach(),d.detach(),a.currentTable=null,a.currentTableName="NA",a.currentRow=-1,a.currentController=a.runningOrder[a.runningIndex][a.runningElement].options,a.currentController.hasOwnProperty("_PennController")){a.currentTable=a.currentController._PennController.table;for(let e in n.a.tables)n.a.tables[e]==a.currentTable&&(a.currentTableName=e);a.currentRow=Number(a.currentController._PennController.row),l()}let e=a.runningOrder[a.runningIndex][a.runningElement];a.infoTab.content.empty(),a.infoTab.content.append($("
Trial in sequence "+Number(a.runningIndex+1)+" / "+a.runningOrder.length+"
")).append($("
Element in trial "+Number(a.runningElement+1)+" / "+a.runningOrder[a.runningIndex].length+"
")).append($("
Trial's label: "+e.type+"
")).append($("
Trial's type (controller): "+e.controller+"
")).append($("
Trial's index: "+e.itemNumber+" / "+window.items.length+"
")).append($("
From table: "+a.currentTableName+"
")),"PennController"==e.controller?$(a.logTab.controls.children()[1]).css("display","inline-block"):$(a.logTab.controls.children()[1]).css("display","none")};let m=window.dget;window.dget=(...e)=>{let t=m(...e);return e[1]&&"displayMode"==e[1]&&e[2]&&"overwrite"==e[2]&&p(),t};const g=()=>{if(window.conf_showProgressBar){let e=0,t=0;a.runningOrder.forEach((r,n)=>r.forEach((r,i)=>{const o=ibex_controller_get_property(r.controller,"countsForProgressBar");(void 0===o||o)&&(e++,(n table div.bar-container"),n=r.find(".bar"),i=5*e<300?5*e:300,o=t*i/e;r.css("width",i),n.css("width",Math.round(o)+"px")}},y=e=>{a.runningIndexy(e),1))},w=()=>{const e=$("
    ");for(let t=0;t").append(o);t<=a.runningIndex?s.css({color:"gray","background-color":t==a.runningIndex?"pink":"transparent"}):s.append($("").click(()=>y(t))),e.append(s)}a.sequenceTab.content.empty().append(e)};let b=window.$.ajax;window.$.ajax=(...e)=>(n.a.debug.on&&e[0]&&e[0].url&&e[0].url.match(/\?allchunks=1$/)&&a.popin.popIn(),b(...e)),n.a.Prerun(()=>{window.onbeforeunload=function(){if(!s)return"Your results have not been sent yet. Do you really want to leave the page?"};let e=!1;PennController.version="2.0";let t=window.assert;window.assert=function(...r){if(e||"There must be some items in the running order!"!=r[1])return t.apply(this,r);e=!0;let i=window.conf_modifyRunningOrder;return window.conf_modifyRunningOrder=function(e){a.runningOrder=i instanceof Function?i.call(this,e):e,n.a.runningOrder={active:a.runningOrder,original:[...a.runningOrder]};const t=n.a.runningOrder.active.push;let r=!1;return n.a.runningOrder.active.push=function(...e){const i=t.apply(this,e);return!r&&e[0]instanceof Array&&e[0][0]&&"__SendResults__"==e[0][0].controller&&(n.a.runningOrder.original=[...this],r=!0),i},Object.defineProperty(n.a.runningOrder,"runningIndex",{get:()=>a.runningIndex}),n.a.debug.on&&(()=>{let e=Object.keys(n.a.tables);if(e.length>0){let t=$("
      ");for(let r=0;r").html(e[r]).click(()=>f(r)).css("cursor","pointer"));a.popin.newTab("Tables",t)}a.sequenceTab=a.popin.newTab("Sequence"),a.infoTab=a.popin.newTab("Info"),w(),a.activeTab?a.activeTab.jQuery.click():a.errorsTab.jQuery.click(),$(window.document).bind("keyup keydown",(function(e){if(e.ctrlKey&&68==e.keyCode){let t=window.innerWidth-450,r=window.innerHeight-250;return $(window.document.body).append(a.popin.container),a.popin.x=t,a.popin.y=r,a.popin.container.css({top:r,left:t}),e.preventDefault(),e.stopPropagation(),!1}}))})(),p(),a.runningOrder},t.apply(this,r)}}),window.onerror=function(e,t,r){if(!t.match(/include=data$/))return;let o=e.match(/ReferenceError: (.+) is not defined/);if(o)if(o[1].match(/^(new|get|default)/)&&PennController.Elements[o[1]])n.a.debug.error("Tried to use ‘"+o[1]+"’ without a prefix on line "+r+"; did you forget to use PennController.ResetPrefix?");else{let e={score:1,command:""},t=Object.getOwnPropertyNames(PennController.Elements);for(let r=0;r"+e.command+"’?"):n.a.debug.error("Unrecognized expression ‘"+o[1]+"’ (line "+r+")")}else n.a.debug.error(e)};let _=window.ibex_controller_get_property;window.ibex_controller_get_property=(e,t)=>{let r=Object.getOwnPropertyNames($.ui);if(r.indexOf(e)>-1)return _(e,t);let o={score:1,controllerName:""};for(let t=0;t"+o.controllerName+"?"):n.a.debug.error("Invalid controller reference: ‘"+e+"’")}},function(e,t,r){"use strict";var n=r(1),i=r(2),o=r(0);i.b.Elements={};class s{constructor(){this._commands=[],this._currentType="action."}}Object.defineProperty(i.b.Elements,"self",{get:()=>{const e=new s,t=new Proxy(e,{get:(r,n)=>{if("_commands"==n||"_currentType"==n||"hasOwnProperty"==n)return e[n];if(console.log("Getting self's proxy, with",n),"settings"==n)e._currentType="settings.";else if("test"==n)e._currentType="test.";else{if("testNot"!=n){console.log("Action on self");let r={name:e._currentType.replace("action.","")+n};e._commands.push(r);const i=(...e)=>(r.args=e,console.log("Added args",e,"to",r),t);return e._currentType="action.",i}e._currentType="testNot."}return t}});return t}});const a=[];o.a.ArgumentCallback=e=>a.push(e);const l=async function(e){for(let t=0;tr instanceof Function&&r.call(null,e[t])),e[t]instanceof f&&"Var"==e[t].type&&0==e[t]._promises.length)e[t]._runPromises instanceof Function&&await e[t]._runPromises(),e[t]=e[t].value;else if(e[t]instanceof s){let r=new f(this,m[this.type]),n=r._proxy;const i=e[t]._commands;for(let e=0;e{let i=o.a.controllers.running;o.a.debug.currentPromise=n;await l.call(r,t),e.apply(r,[(...e)=>o.a.controllers.running!=i||n(...e)].concat(t))})}},c=function(e){let t=[],r=()=>new Promise(e=>e()),i=()=>new Promise(e=>e()),s=function(...n){let s=this;return new Promise((async function(a){let u=o.a.controllers.running;o.a.debug.currentPromise=a;let c=(...e)=>o.a.controllers.running!=u||a(...e);await l.call(s,n);let d=e.apply(s,n),h="and";for(let e=0;e{t.push("and"),t.push(e)},s.or=e=>{t.push("or"),t.push(e)},s.success=function(...e){r=Object(n.d)(e.map(e=>async()=>{const t=await l.call(this,[e]);t[0]&&t[0]._runPromises instanceof Function&&await t[0]._runPromises()}))},s.failure=function(...e){i=Object(n.d)(e.map(e=>async()=>{const t=await l.call(this,[e]);t[0]&&t[0]._runPromises instanceof Function&&await t[0]._runPromises()}))},s};class d{constructor(e,t,r){let n=$(""),i=n.css,s=[];n.css=(...e)=>{s.push(e),i.apply(n,e)};let a=!1;Object.defineProperty(this,"jQueryElement",{set:function(t){if(!(t instanceof jQuery))return o.a.debug.error("Tried to assign a non jQuery element to PennElement named "+e);if(a)return n=t;let r=n.data("events");r&&$.each(r,(function(){$.each(this,(function(){t.bind(this.type,this.handler)}))}));for(let e in s)t.css(...s[e]);n=t,a=!0},get:function(){return n}}),this.jQueryContainer=$("
      "),this.id=e,this.type=t,this.validate=()=>this.hasValidated=!0,this._printCallback=[],r.hasOwnProperty("end")&&(this.end=async function(){await r.end.apply(this)})}}o.a.PennElement=d;let h=(e,t,r,i)=>{let s="",a=e.replace(/^\.(settings|testNot|test)\./,"");Object(n.e)(a,"settings")/"settings".length<.5&&(s=" Did you mean to type ‘settings’?"),Object(n.e)(a,"test")/"test".length<.5&&(s=" Did you mean to type ‘test’?"),Object(n.e)(a,"testNot")/"testNot".length<.5&&(s=" Did you mean to type ‘testNot’?");let l={score:1,command:""};for(let e=0;e"+e.replace(a,l.command)+"?"),o.a.debug.error("Command ‘"+e+"’ unknown on "+t+" element ‘"+r+"’."+s)};class f{constructor(e,t){let r=new Proxy(this,{get:(e,n)=>{if(n in this)return e[n];{if("_runPromises"==n)return()=>this._runPromises.call(this);let e;try{e=this[n]}catch(e){return h(n,this.type,this._element.id,Object.getOwnPropertyNames(t.actions)),r}return void 0===e&&"string"==typeof n&&"nodeType"!=n&&h(n,this.type,this._element.id,Object.getOwnPropertyNames(t.actions)),e}}});if(this._proxy=r,e instanceof d)r._element=e;else if("string"==typeof e){let n;n=o.a.controllers.running?o.a.controllers.list[o.a.controllers.running.id]:o.a.controllers.underConstruction,Object.defineProperty(r,"_element",{get:()=>n._getElement(e,t.name)})}r.type=t.name,r._promises=[];for(let e in t.actions)r[e]=function(...i){let s=u((function(...i){o.a.debug.on&&o.a.debug.log("
      "+r._element.id+" ("+t.name+") Action command '"+e+"' running, params: "+JSON.stringify(Object(n.i)(i))+"
      "),t.actions[e].apply(this,i)}));return r._promises.push(()=>s.apply(r._element,i)),r};r.settings=new Proxy({},{get:(e,r)=>{if(r in e)return e[r];h(".settings."+r,this.type,this._element.id,Object.getOwnPropertyNames(t.settings))}});for(let e in t.settings)r.settings[e]=function(...i){let s=u((function(...i){o.a.debug.on&&o.a.debug.log("
      "+r._element.id+" ("+t.name+") Settings command '"+e+"' running, params: "+JSON.stringify(Object(n.i)(i))+"
      "),t.settings[e].apply(this,i)}));return r._promises.push(()=>s.apply(r._element,i)),r};r.test=new Proxy({},{get:(e,r)=>{if(r in e)return e[r];h(".test."+r,this.type,this._element.id,Object.getOwnPropertyNames(t.test))}}),r.testNot=new Proxy({},{get:(e,r)=>{if(r in e)return e[r];h(".testNot."+r,this.type,this._element.id,Object.getOwnPropertyNames(t.test))}});for(let e in t.test)r.test[e]=function(...i){let s=c((function(...i){return o.a.debug.on&&o.a.debug.log("
      "+r._element.id+" ("+t.name+") Test command '"+e+"' running, params: "+JSON.stringify(Object(n.i)(i))+"
      "),t.test[e].apply(this,i)}));return r._promises.push(()=>s.apply(r._element,i)),r.success=(...e)=>(s.success.apply(r._element,e),r),r.failure=(...e)=>(s.failure.apply(r._element,e),r),r.and=e=>(s.and.call(r._element,e),r),r.or=e=>(s.or.call(r._element,e),r),r},r.testNot[e]=function(...i){let s=c((function(...r){return o.a.debug.on&&o.a.debug.log(t.name+" testNot command "+e+" running, params: "+JSON.stringify(Object(n.i)(r))),!t.test[e].apply(this,r)}));return r._promises.push(()=>s.apply(r._element,i)),r.success=(...e)=>(s.success.apply(r._element,e),r),r.failure=(...e)=>(s.failure.apply(r._element,e),r),r.and=e=>(s.and.call(r._element,e),r),r.or=e=>(s.or.call(r._element,e),r),r};t.value&&Object.defineProperty(r,"value",{get:()=>t.value.apply(r._element)})}_runPromises(){return Object(n.d)(this._promises)()}}o.a.PennElementCommands=f;let p={actions:{scaling:function(e,t,r){let n=this.jQueryElement,i=0,s=0,a=0,l=0;const u=o.a.controllers.running,c=(e,t)=>{let r=0;if(!isNaN(Number(e)))return Number(e);if(e.match(/(\d+(.\d+)?)px/))r=Number(e.replace(/^[^\d]*(\d+(.\d+)?)px.*$/,"$1"));else{const t=$("
      ").css("width",e);r=t.appendTo(n.parent()).width(),t.remove()}return r/t},d=()=>{if(u!=o.a.controllers.running)return;this.jQueryContainer&&this.jQueryContainer instanceof jQuery&&this.jQueryContainer.parent().length&&(n=this.jQueryContainer);const e=n.width(),h=n.height(),f=$(window).width(),p=$(window).height();window.requestAnimationFrame(d),i=e,s=h,a=f,l=p;let m="";if(t.match(/page|screen/i)){m=a/lthis.jQueryElement.css(...e)),this.jQueryElement.addClass("PennController-"+this.type.replace(/[\s_]/g,"")),this.jQueryElement.addClass("PennController-"+this.id.replace(/[\s_]/g,""));let e=this.jQueryContainer;if(e.css("display","inherit"),"string"==typeof this.jQueryAlignment&&(this.jQueryAlignment.match(/left/i)?e.css("align-self","start"):this.jQueryAlignment.match(/center/i)?e.css("align-self","center"):this.jQueryAlignment.match(/right/i)&&e.css("align-self","end")),e.addClass("PennController-elementContainer").addClass("PennController-"+this.type.replace(/[\s_]+/g,"")+"-container").addClass("PennController-"+this.id.replace(/[\s_]+/g,"")+"-container").append(this.jQueryElement),t instanceof jQuery)t.append(e);else if(t instanceof f&&t._element.jQueryElement instanceof jQuery)t._element.jQueryElement.append(e);else if(void 0!==r){const i=o.a.controllers.running;n.j.call(e,t,r,$("body"),()=>i!=o.a.controllers.running||this._lastPrint!=a)}else o.a.controllers.running.element.append(e);this.cssContainer instanceof Array&&this.cssContainer.forEach(t=>e.css(...t));let i=$("
      ").css("display","inline-block").addClass("PennController-before"),s=$("
      ").css("display","inline-block").addClass("PennController-after");this.jQueryElement.before(i),this.jQueryElement.after(s);for(let e in this.jQueryBefore)this.jQueryBefore[e]&&this.jQueryBefore[e]._element&&await new Promise(t=>p.actions.print.call(this.jQueryBefore[e]._element,t,i));for(let e in this.jQueryAfter)this.jQueryAfter[e]&&this.jQueryAfter[e]._element&&await new Promise(t=>p.actions.print.call(this.jQueryAfter[e]._element,t,s))}else o.a.debug.warning("No jQuery instance to print for element "+this.id);this.printTime=Date.now();for(let e=0;e");t.before(r),i.b.Elements["get"+this.type](this.id).print(r)._runPromises().then(()=>{r.before(this.jQueryElement.parent()),r.remove(),e()})},remove:function(e){if(this.jQueryContainer instanceof jQuery&&this.jQueryContainer.detach(),this.jQueryElement instanceof jQuery?this.jQueryElement.detach():o.a.debug.error("No jQuery instance to remove for element "+this.id),this.jQueryBefore&&this.jQueryBefore.length)for(let e in this.jQueryBefore)this.jQueryBefore[e]._element&&this.jQueryBefore[e]._element.jQueryElement instanceof jQuery&&this.jQueryBefore[e]._element.jQueryElement.detach();if(this.jQueryAfter&&this.jQueryAfter.length)for(let e in this.jQueryAfter)this.jQueryAfter[e]._element&&this.jQueryAfter[e]._element.jQueryElement instanceof jQuery&&this.jQueryAfter[e]._element.jQueryElement.detach();e()},wait:function(e,t){if("first"==t&&this.hasValidated)e();else{let r=!1,n=this.validate;if(this.validate=()=>{if(n.apply(this),!r)if(t instanceof Object&&t._runPromises&&t.success){let n=this.disabled;this.jQueryElement.attr("disabled",!0),this.disabled="tmp",t._runPromises().then(t=>{"success"==t&&(r=!0,e()),"tmp"==this.disabled&&(this.disabled=n,this.jQueryElement.attr("disabled",n))})}else r=!0,e()},"number"==typeof t&&t>0){let e=Date.now(),t=()=>{Date.now()-e<=0?this.validate():window.requestAnimationFrame(t)};window.requestAnimationFrame(t)}}}},settings:{after:function(e,t){t._element&&t._element.jQueryElement instanceof jQuery?(t._element.jQueryAfter instanceof Array&&(t._element.jQueryAfter=t._element.jQueryAfter.filter(e=>e._element!=this)),this.jQueryElement instanceof jQuery&&this.jQueryElement.printed()&&(t=t.print(this.jQueryContainer.find(".PennController-after"))),t._runPromises().then(()=>{this.jQueryAfter.push(t),e()})):(o.a.debug.error("Tried to add an invalid element after element named "+this.id),e())},before:function(e,t){t._element&&t._element.jQueryElement instanceof jQuery?(t._element.jQueryBefore instanceof Array&&(t._element.jQueryBefore=t._element.jQueryBefore.filter(e=>e._element!=this)),this.jQueryElement instanceof jQuery&&this.jQueryElement.printed()&&t.print(this.jQueryContainer.find(".PennController-"+this.type+"-before")),t._runPromises().then(()=>{this.jQueryBefore.push(t),e()})):(o.a.debug.error("Tried to add an invalid element before element named "+this.id),e())},bold:function(e){this.jQueryElement instanceof jQuery?this.jQueryElement.css("font-weight","bold"):o.a.debug.error("Element named "+this.id+" has not jQuery element to render as bold"),e()},center:function(e){this.jQueryElement instanceof jQuery?(this.jQueryAlignment="center",this.jQueryElement.parent().length&&this.jQueryContainer.css("align-self","center")):o.a.debug.error("Element named "+this.id+" has not jQuery element to render as centered"),e()},color:function(e,t){this.jQueryElement&&"string"==typeof t?this.jQueryElement.css("color",t):o.a.debug.error("Element named "+this.id+" has not jQuery element to render as "+t),e()},cssContainer:function(e,...t){this.cssContainer||(this.cssContainer=[]),this.cssContainer.push(t),this.jQueryContainer.printed()&&this.jQueryContainer.css(...t),e()},css:function(e,...t){this.cssToApply||(this.cssToApply=[]),this.cssToApply.push(t),this.jQueryElement instanceof jQuery?this.jQueryElement.css(...t):o.a.debug.error("Element named "+this.id+" has not jQuery element on which to apply the CSS"),e()},disable:function(e){this.hasOwnProperty("jQueryElement")&&this.jQueryElement instanceof jQuery?this.jQueryElement.attr("disabled",!0).addClass("PennController-disabled"):o.a.debug.error("No jQuery instance to disable for element "+this.id),e()},enable:function(e){this.hasOwnProperty("jQueryElement")&&this.jQueryElement instanceof jQuery?this.jQueryElement.removeAttr("disabled").removeClass("PennController-disabled"):o.a.debug.error("No jQuery instance to enable for element "+this.id),e()},hidden:function(e){this.hasOwnProperty("jQueryElement")&&this.jQueryElement instanceof jQuery?this.jQueryElement.css({visibility:"hidden"}):o.a.debug.error("No jQuery instance to hide for element "+this.id),e()},italic:function(e){this.jQueryElement instanceof jQuery?this.jQueryElement.css("font-style","italic"):o.a.debug.error("Element named "+this.id+" has not jQuery element to render in italic"),e()},left:function(e){this.jQueryElement instanceof jQuery?(this.jQueryAlignment="left",this.jQueryElement.parent().length&&this.jQueryContainer.css("align-self","left")):o.a.debug.error("Element named "+this.id+" has not jQuery element to render as aligned to the left"),e()},log:function(e,t){this.log=void 0===t||t,e()},once:function(e){if(this.hasValidated)this.disabled=!0,this.jQueryElement.attr("disabled",!0);else{let e=this.validate;this.validate=()=>{e.apply(this),this.disabled=!0,this.jQueryElement.attr("disabled",!0)}}e()},right:function(e){this.jQueryElement instanceof jQuery?(this.jQueryAlignment="right",this.jQueryElement.parent().length&&this.jQueryContainer.css("align-self","right")):o.a.debug.error("Element named "+this.id+" has not jQuery element to render as aligned to the right"),e()},size:function(e,t,r){this.jQueryElement instanceof jQuery?(this.jQueryElement.width(t),this.jQueryElement.height(r),this.jQueryContainer instanceof jQuery&&("string"==typeof t&&t.match(/%$/)&&this.jQueryContainer.width("100%"),"string"==typeof r&&r.match(/%$/)&&this.jQueryContainer.height("100%"))):o.a.debug.error("Element named "+this.id+" has not jQuery element to render as aligned to the right"),e()},visible:function(e){this.hasOwnProperty("jQueryElement")&&this.jQueryElement instanceof jQuery?this.jQueryElement.css({visibility:"visible"}):o.a.debug.error("No jQuery instance to make visible for element "+this.id),e()}},test:{printed:function(){return!!(this.hasOwnProperty("jQueryElement")&&this.jQueryElement instanceof jQuery)&&this.jQueryElement.printed()}}};o.a.elements.standardCommands=p,i.b.Elements.jump=function(e){var t;"string"==typeof e&&(t=e,e=e=>e==t);let r=-1;const i=e=>o.a.runningOrder&&e()||setTimeout(()=>i(e),50);new Promise(e=>i(e)).then(()=>{console.log("ro",o.a.runningOrder);for(let t=0;tnew Promise(e=>{if(r<0)return e();o.a.runningOrder.active.splice(o.a.runningOrder.runningIndex+1,o.a.runningOrder.active.length,...o.a.runningOrder.original.slice(r,o.a.runningOrder.original.length)),e()});return{_promises:[s],_runPromises:()=>Object(n.d)([s])()}},i.b.Elements.fullscreen=function(){const e=()=>new Promise(e=>{if(document.documentElement.requestFullscreen)return document.documentElement.requestFullscreen().then(e).catch(e);document.documentElement.mozRequestFullScreen?document.documentElement.mozRequestFullScreen():document.documentElement.webkitRequestFullscreen?document.documentElement.webkitRequestFullscreen():document.documentElement.msRequestFullscreen&&document.documentElement.msRequestFullscreen(),e()});return{_promises:[e],_runPromises:()=>Object(n.d)([e])()}},i.b.Elements.exitFullscreen=function(){const e=()=>new Promise(e=>{if(document.exitFullscreen)return document.exitFullscreen().then(e).catch(e);document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen(),e()});return{_promises:[e],_runPromises:()=>Object(n.d)([e])()}},i.b.Elements.clear=function(){const e=()=>new Promise(async e=>{let t=o.a.controllers.list[o.a.controllers.running.id];for(let e in t.elements)for(let r in t.elements[e]){let n=t.elements[e][r],o=i.b.Elements["get"+n.type](n.id);await o.remove()._runPromises()}e()});return{_promises:[e],_runPromises:()=>Object(n.d)([e])()}},i.b.Elements.end=function(){const e=()=>new Promise(async e=>{await o.a.controllers.running.endTrial(),e()});return{_promises:[e],_runPromises:()=>Object(n.d)([e])()}};let m={};i.b._AddElementType=function(e,t){m.hasOwnProperty(e)&&o.a.debug.error("Element type "+e+" defined more than once"),m[e]=function(t){let r=new t(o.a);r.hasOwnProperty("actions")||(r.actions={}),r.hasOwnProperty("settings")||(r.settings={}),r.hasOwnProperty("test")||(r.test={});for(let e in p.actions)r.actions.hasOwnProperty(e)||(r.actions[e]=p.actions[e]);for(let e in p.settings)r.settings.hasOwnProperty(e)||(r.settings[e]=p.settings[e]);for(let e in p.test)r.test.hasOwnProperty(e)||(r.test[e]=p.test[e]);for(let e in r.settings)r.actions.hasOwnProperty(e)||(r.actions[e]=r.settings[e]);let n=r.uponCreation;r.uponCreation=function(e){this.jQueryAfter=[],this.jQueryBefore=[],this.jQueryElement&&this.jQueryElement instanceof jQuery&&this.jQueryElement.removeAttr("style"),this.jQuerycontainer&&this.jQueryContainer instanceof jQuery&&(this.jQuerycontainer=$("
      ")),n instanceof Function?n.apply(this,[e]):e()};let i=r.end;return r.end=async function(){this.jQueryElement instanceof jQuery&&this.jQueryElement.remove();for(let e in this.jQueryBefore)this.jQueryBefore[e]._element&&this.jQueryBefore[e]._element.jQueryElement instanceof jQuery&&this.jQueryBefore[e]._element.jQueryElement.remove();for(let e in this.jQueryAfter)this.jQueryAfter[e]._element&&this.jQueryAfter[e]._element.jQueryElement instanceof jQuery&&this.jQueryAfter[e]._element.jQueryElement.remove();this.jQueryContainer instanceof jQuery&&this.jQueryContainer.remove(),i instanceof Function&&await i.apply(this)},r.name=e,r}(t),i.b.Elements["new"+e]=function(...t){let r=m[e],n=o.a.controllers.underConstruction;o.a.controllers.running&&(n=o.a.controllers.list[o.a.controllers.running.id]);let i="unnamed-"+e;t.length<1?t=[i]:"string"==typeof t[0]&&t[0].length>0&&(i=t[0]);let s=new d(i,e,r);l.call(s,t),r.hasOwnProperty("immediate")&&r.immediate instanceof Function&&r.immediate.apply(s,t);let a=s.id;for(let t=2;n.elements.hasOwnProperty(e)&&n.elements[e].hasOwnProperty(s.id);t++)s.id=a+String(t);a!=s.id&&(o.a.debug.warning("Found an existing "+s.type+" element named “"+a+"”--using name “"+s.id+"” instead for new element"),n.ambiguousElementNames.push(a)),n._addElement(s);let u=new f(s,r);if(u=u._proxy,u._promises.push(()=>new Promise(e=>{s.printTime=0,s.log=!1,e()})),u._promises.push(()=>new Promise(e=>r.uponCreation.apply(s,[e]))),n.defaultCommands.hasOwnProperty(e))for(let t in n.defaultCommands[e]){let r=n.defaultCommands[e][t];u._promises.push(()=>new Promise(e=>{"header"==r[2]&&0==o.a.controllers.running.options.runHeader?e():r[0].apply(s,[e,...r[1]])}))}return u},i.b.Elements["get"+e]=function(t){let r=o.a.controllers.underConstruction;o.a.controllers.running&&(r=o.a.controllers.list[o.a.controllers.running.id]);let n=m[e];return r.ambiguousElementNames.indexOf(t)>=0&&o.a.debug.error("Ambiguous use of get"+e+"(“"+t+"”): more than one elements were created with that name-- get"+e+"(“"+t+"”) will refer to the first one"),new f(t,n)._proxy},Object.defineProperty(i.b.Elements,"default"+e,{get:function(){let t=m[e],r={},n=function(){o.a.controllers.underConstruction.hasOwnProperty("defaultCommands")||(o.a.controllers.underConstruction.defaultCommands={}),o.a.controllers.underConstruction.defaultCommands.hasOwnProperty(e)||(o.a.controllers.underConstruction.defaultCommands[e]=[])};for(let i in t.actions)r[i]=function(...s){return n(),o.a.controllers.underConstruction.defaultCommands[e].push([t.actions[i],s]),r};r.settings={};for(let i in t.settings)r.settings[i]=function(...s){return n(),o.a.controllers.underConstruction.defaultCommands[e].push([t.settings[i],s]),r};return r}})},i.b._AddStandardCommands=function(e){let t=new e(o.a);for(let e in t)if(e.match(/^(actions|settings|test)$/))for(let r in t[e]){let n=t[e][r];if(p[e].hasOwnProperty(r))o.a.debug.error("There already is a standard "+e+" command named "+r);else if(n instanceof Function){p[e][r]=n;for(let t in m)m[t][e].hasOwnProperty(r)||(m[t][e][r]=n),"settings"!=e||m[t].actions.hasOwnProperty(r)||(m[t].actions[r]=n)}else o.a.debug.error("Standard "+e+" command "+r+" should be a function")}else o.a.debug.error("Standard command type unknown",e)}},function(e,t,r){"use strict";var n=r(4),i=r(1),o=r(2),s=r(0),a=r(5),l=r(9);let u=[];s.a.utils.JSZip=l,s.a.utils.JSZip.getBinaryContent=n.getBinaryContent,s.a.utils.saveAs=a.saveAs,o.b.PreloadZip=function(){for(let e in arguments)u.push(arguments[e])},s.a.Prerun((function(){if(u.length){var e=function(e){function t(){let t=u.indexOf(e);t>=0&&u.splice(t,1)}var r=new l;Object(n.getBinaryContent)(e,(function(n,o){if(n)throw t(),s.a.debug.error("Error downloading "+e+":",n),n;r.loadAsync(o).then((function(){s.a.debug.log("Download of "+e+" complete");var n=0;r.forEach((function(e,o){o.async("arraybuffer").then((function(o){if(!e.match(/__MACOS.+\/\.[^\/]+$/)){let t=e.replace(/^.*?([^\/]+)$/,"$1"),r=Object(i.a)(Object(i.c)(o.slice(0,28)),t);if(r){let e=URL.createObjectURL(new Blob([o],{type:r}));console.log("Found a resource named",t,"of type",r,"with url",e);var a=!1;for(let r in s.a.resources.list){let n=s.a.resources.list[r];n.name==t&&"ready"!=n.status&&(console.log("Applying create to a copye of",t),n.create.apply($.extend({},n,{value:e,object:null,resolve:function(){console.log("Resolving",t,"current status",n.status),"ready"!=n.status&&(n.object=this.object,console.log("Set",t," object to",n.object,"calling resolve now"),n.resolve())}})),a=!0)}a||s.a.resources.list.push({name:t,value:e,controllers:[],object:null,status:"void",create:function(){this.status="pending"},resolve:function(){this.status="ready"}})}}++n>=Object.keys(r.files).length&&t()}))}))}))}))};for(let t in u){let r=u[t],n=r.match(/^https?:\/\/.+\.(zip)$/i);"string"==typeof r&&n?"zip"==n[1].toLowerCase()&&e(r):s.a.debug.warning("Preload: entry #"+t+" is not a valid URL, ignoring it")}}}))},function(e,t,r){(function(t,r,n){e.exports=function e(t,r,n){function i(s,a){if(!r[s]){if(!t[s]){if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[s]={exports:{}};t[s][0].call(u.exports,(function(e){return i(t[s][1][e]||e)}),u,u.exports,e,t,r,n)}return r[s].exports}for(var o=!1,s=0;s>2,a=(3&t)<<4|r>>4,l=1>6:64,u=2>4,r=(15&s)<<4|(a=o.indexOf(e.charAt(u++)))>>2,n=(3&a)<<6|(l=o.indexOf(e.charAt(u++))),d[c++]=t,64!==a&&(d[c++]=r),64!==l&&(d[c++]=n);return d}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var n=e("./external"),i=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),s=e("./stream/DataLengthProbe");function a(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i}a.prototype={getContentWorker:function(){var e=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,r){return e.pipe(new o).pipe(new s("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new s("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(e){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var n=e("./utils"),i=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==n.getTypeOf(e)?function(e,t,r){var n=i,o=0+r;e^=-1;for(var s=0;s>>8^n[255&(e^t[s])];return-1^e}(0|t,e,e.length):function(e,t,r){var n=i,o=0+r;e^=-1;for(var s=0;s>>8^n[255&(e^t.charCodeAt(s))];return-1^e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var n;n="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),o=e("./utils"),s=e("./stream/GenericWorker"),a=n?"uint8array":"array";function l(e,t){s.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic="\b\0",o.inherits(l,s),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(o.transformTo(a,e.data),!1)},l.prototype.flush=function(){s.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},r.compressWorker=function(e){return new l("Deflate",e)},r.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function n(e,t){var r,n="";for(r=0;r>>=8;return n}function i(e,t,r,i,s,c){var d,h,f=e.file,p=e.compression,m=c!==a.utf8encode,g=o.transformTo("string",c(f.name)),y=o.transformTo("string",a.utf8encode(f.name)),w=f.comment,b=o.transformTo("string",c(w)),_=o.transformTo("string",a.utf8encode(w)),v=y.length!==f.name.length,k=_.length!==w.length,x="",E="",C="",T=f.dir,P=f.date,S={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(S.crc32=e.crc32,S.compressedSize=e.compressedSize,S.uncompressedSize=e.uncompressedSize);var A=0;t&&(A|=8),m||!v&&!k||(A|=2048);var O,j=0,R=0;T&&(j|=16),"UNIX"===s?(R=798,j|=((O=f.unixPermissions)||(O=T?16893:33204),(65535&O)<<16)):(R=20,j|=63&(f.dosPermissions||0)),d=P.getUTCHours(),d<<=6,d|=P.getUTCMinutes(),d<<=5,d|=P.getUTCSeconds()/2,h=P.getUTCFullYear()-1980,h<<=4,h|=P.getUTCMonth()+1,h<<=5,h|=P.getUTCDate(),v&&(x+="up"+n((E=n(1,1)+n(l(g),4)+y).length,2)+E),k&&(x+="uc"+n((C=n(1,1)+n(l(b),4)+_).length,2)+C);var I="";return I+="\n\0",I+=n(A,2),I+=p.magic,I+=n(d,2),I+=n(h,2),I+=n(S.crc32,4),I+=n(S.compressedSize,4),I+=n(S.uncompressedSize,4),I+=n(g.length,2),I+=n(x.length,2),{fileRecord:u.LOCAL_FILE_HEADER+I+g+x,dirRecord:u.CENTRAL_FILE_HEADER+n(R,2)+I+n(b.length,2)+"\0\0\0\0"+n(j,4)+n(i,4)+g+x+b}}var o=e("../utils"),s=e("../stream/GenericWorker"),a=e("../utf8"),l=e("../crc32"),u=e("../signature");function c(e,t,r,n){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(c,s),c.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,s.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-n-1))/r:100}}))},c.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(e){this.accumulate=!1;var t,r=this.streamFiles&&!e.file.dir,o=i(e,r,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(o.dirRecord),r)this.push({data:(t=e,u.DATA_DESCRIPTOR+n(t.crc32,4)+n(t.compressedSize,4)+n(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:o.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return n.transformTo("string",this.readData(e))},readData:function(e){},lastIndexOfSignature:function(e){},readAndCheckSignature:function(e){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,r){"use strict";var n=e("./Uint8ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var n=e("./DataReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var n=e("./ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../support"),o=e("./ArrayReader"),s=e("./StringReader"),a=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=n.getTypeOf(e);return n.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new a(e):i.uint8array?new l(n.transformTo("uint8array",e)):new o(n.transformTo("array",e)):new s(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../utils");function o(e){n.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(o,n),o.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,n),o.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function o(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}n.inherits(o,i),o.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function o(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=n.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}n.inherits(o,i),o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function n(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r "+e:e}},t.exports=n},{}],29:[function(e,t,n){"use strict";var i=e("../utils"),o=e("./ConvertWorker"),s=e("./GenericWorker"),a=e("../base64"),l=e("../support"),u=e("../external"),c=null;if(l.nodestream)try{c=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function d(e,t,r){var n=t;switch(t){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=t,this._mimeType=r,i.checkSupport(n),this._worker=e.pipe(new o(n)),e.lock()}catch(e){this._worker=new s("error"),this._worker.error(e)}}d.prototype={accumulate:function(e){return t=this,n=e,new u.Promise((function(e,o){var s=[],l=t._internalType,u=t._outputType,c=t._mimeType;t.on("data",(function(e,t){s.push(e),n&&n(t)})).on("error",(function(e){s=[],o(e)})).on("end",(function(){try{var t=function(e,t,r){switch(e){case"blob":return i.newBlob(i.transformTo("arraybuffer",t),r);case"base64":return a.encode(t);default:return i.transformTo(e,t)}}(u,function(e,t){var n,i=0,o=null,s=0;for(n=0;n>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t}(e)},r.utf8decode=function(e){return i.nodebuffer?n.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,i,o,s=e.length,l=new Array(2*s);for(t=r=0;t>10&1023,l[r++]=56320|1023&i)}return l.length!==r&&(l.subarray?l=l.subarray(0,r):l.length=r),n.applyFromCharCode(l)}(e=n.transformTo(i.uint8array?"uint8array":"array",e))},n.inherits(u,s),u.prototype.processChunk=function(e){var t=n.transformTo(i.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var o=t;(t=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),t.set(o,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var s=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+a[e[r]]>t?r:t}(t),l=t;s!==t.length&&(i.uint8array?(l=t.subarray(0,s),this.leftOver=t.subarray(s,t.length)):(l=t.slice(0,s),this.leftOver=t.slice(s,t.length))),this.push({data:r.utf8decode(l),meta:e.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=u,n.inherits(c,s),c.prototype.processChunk=function(e){this.push({data:r.utf8encode(e.data),meta:e.meta})},r.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){"use strict";var n=e("./support"),i=e("./base64"),o=e("./nodejsUtils"),s=e("set-immediate-shim"),a=e("./external");function l(e){return e}function u(e,t){for(var r=0;r>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(e){if(this.extraFields[1]){var t=n(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(e){var t,r,n,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t},r.buf2binstring=function(e){return l(e,e.length)},r.binstring2buf=function(e){for(var t=new n.Buf8(e.length),r=0,i=t.length;r>10&1023,u[n++]=56320|1023&i)}return l(u,n)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+s[e[r]]>t?r:t}},{"./common":41}],43:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,s=0;0!==r;){for(r-=s=2e3>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,i){var o=n,s=i+r;e^=-1;for(var a=i;a>>8^o[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,r){"use strict";var n,i=e("../utils/common"),o=e("./trees"),s=e("./adler32"),a=e("./crc32"),l=e("./messages"),u=-2,c=258,d=262,h=113;function f(e,t){return e.msg=l[t],t}function p(e){return(e<<1)-(4e.avail_out&&(r=e.avail_out),0!==r&&(i.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function y(e,t){o._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,g(e.strm)}function w(e,t){e.pending_buf[e.pending++]=t}function b(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function _(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-d?e.strstart-(e.w_size-d):0,u=e.window,h=e.w_mask,f=e.prev,p=e.strstart+c,m=u[o+s-1],g=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]===g&&u[r+s-1]===m&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function v(e){var t,r,n,o,l,u,c,h,f,p,m=e.w_size;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-d)){for(i.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=r=e.hash_size;n=e.head[--t],e.head[t]=m<=n?n-m:0,--r;);for(t=r=m;n=e.prev[--t],e.prev[t]=m<=n?n-m:0,--r;);o+=m}if(0===e.strm.avail_in)break;if(u=e.strm,c=e.window,h=e.strstart+e.lookahead,p=void 0,(f=o)<(p=u.avail_in)&&(p=f),r=0===p?0:(u.avail_in-=p,i.arraySet(c,u.input,u.next_in,p,h),1===u.state.wrap?u.adler=s(u.adler,c,p,h):2===u.state.wrap&&(u.adler=a(u.adler,c,p,h)),u.next_in+=p,u.total_in+=p,p),e.lookahead+=r,e.lookahead+e.insert>=3)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<=3)if(n=o._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<=3&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-3,n=o._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(v(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,y(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-d&&(y(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(y(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(y(e,!1),e.strm.avail_out),1)})),new E(4,4,8,4,k),new E(4,5,16,8,k),new E(4,6,32,32,k),new E(4,4,16,16,x),new E(8,16,32,32,x),new E(8,16,128,128,x),new E(8,32,128,256,x),new E(32,128,258,1024,x),new E(32,258,258,4096,x)],r.deflateInit=function(e,t){return S(e,t,8,15,8,0)},r.deflateInit2=S,r.deflateReset=P,r.deflateResetKeep=T,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?u:(e.state.gzhead=t,0):u},r.deflate=function(e,t){var r,i,s,l;if(!e||!e.state||5>8&255),w(i,i.gzhead.time>>16&255),w(i,i.gzhead.time>>24&255),w(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),w(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(w(i,255&i.gzhead.extra.length),w(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=a(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(w(i,0),w(i,0),w(i,0),w(i,0),w(i,0),w(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),w(i,3),i.status=h);else{var d=8+(i.w_bits-8<<4)<<8;d|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(d|=32),d+=31-d%31,i.status=h,b(i,d),0!==i.strstart&&(b(i,e.adler>>>16),b(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(s=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),g(e),s=i.pending,i.pending!==i.pending_buf_size));)w(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),g(e),s=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindexs&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),0===l&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),g(e),s=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindexs&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),0===l&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&g(e),i.pending+2<=i.pending_buf_size&&(w(i,255&e.adler),w(i,e.adler>>8&255),e.adler=0,i.status=h)):i.status=h),0!==i.pending){if(g(e),0===e.avail_out)return i.last_flush=-1,0}else if(0===e.avail_in&&p(t)<=p(r)&&4!==t)return f(e,-5);if(666===i.status&&0!==e.avail_in)return f(e,-5);if(0!==e.avail_in||0!==i.lookahead||0!==t&&666!==i.status){var _=2===i.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(v(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(y(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(y(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(y(e,!1),0===e.strm.avail_out)?1:2}(i,t):3===i.strategy?function(e,t){for(var r,n,i,s,a=e.window;;){if(e.lookahead<=c){if(v(e),e.lookahead<=c&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=o._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(y(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(y(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(y(e,!1),0===e.strm.avail_out)?1:2}(i,t):n[i.level].func(i,t);if(3!==_&&4!==_||(i.status=666),1===_||3===_)return 0===e.avail_out&&(i.last_flush=-1),0;if(2===_&&(1===t?o._tr_align(i):5!==t&&(o._tr_stored_block(i,0,0,!1),3===t&&(m(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),g(e),0===e.avail_out))return i.last_flush=-1,0}return 4!==t?0:i.wrap<=0?1:(2===i.wrap?(w(i,255&e.adler),w(i,e.adler>>8&255),w(i,e.adler>>16&255),w(i,e.adler>>24&255),w(i,255&e.total_in),w(i,e.total_in>>8&255),w(i,e.total_in>>16&255),w(i,e.total_in>>24&255)):(b(i,e.adler>>>16),b(i,65535&e.adler)),g(e),0=r.w_size&&(0===a&&(m(r.head),r.strstart=0,r.block_start=0,r.insert=0),h=new i.Buf8(r.w_size),i.arraySet(h,t,f-r.w_size,r.w_size,0),t=h,f=r.w_size),l=e.avail_in,c=e.next_in,d=e.input,e.avail_in=f,e.next_in=0,e.input=t,v(r);r.lookahead>=3;){for(n=r.strstart,o=r.lookahead-2;r.ins_h=(r.ins_h<>>=_=b>>>24,p-=_,0==(_=b>>>16&255))T[o++]=65535&b;else{if(!(16&_)){if(0==(64&_)){b=m[(65535&b)+(f&(1<<_)-1)];continue t}if(32&_){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}v=65535&b,(_&=15)&&(p<_&&(f+=C[n++]<>>=_,p-=_),p<15&&(f+=C[n++]<>>=_=b>>>24,p-=_,!(16&(_=b>>>16&255))){if(0==(64&_)){b=g[(65535&b)+(f&(1<<_)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(k=65535&b,p<(_&=15)&&(f+=C[n++]<>>=_,p-=_,(_=o-s)>3,f&=(1<<(p-=v<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function c(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function d(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new n.Buf32(852),t.distcode=t.distdyn=new n.Buf32(592),t.sane=1,t.back=-1,0):l}function h(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,d(e)):l}function f(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=s.wsize?(n.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i<(o=s.wsize-s.wnext)&&(o=i),n.arraySet(s.window,t,r-i,o,s.wnext),(i-=o)?(n.arraySet(s.window,t,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=o,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=o(r.check,D,2,0),y=g=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&g)<<8)+(g>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&g)){e.msg="unknown compression method",r.mode=30;break}if(y-=4,j=8+(15&(g>>>=4)),0===r.wbits)r.wbits=j;else if(j>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(D[0]=255&g,D[1]=g>>>8&255,r.check=o(r.check,D,2,0)),y=g=0,r.mode=3;case 3:for(;y<32;){if(0===p)break e;p--,g+=c[h++]<>>8&255,D[2]=g>>>16&255,D[3]=g>>>24&255,r.check=o(r.check,D,4,0)),y=g=0,r.mode=4;case 4:for(;y<16;){if(0===p)break e;p--,g+=c[h++]<>8),512&r.flags&&(D[0]=255&g,D[1]=g>>>8&255,r.check=o(r.check,D,2,0)),y=g=0,r.mode=5;case 5:if(1024&r.flags){for(;y<16;){if(0===p)break e;p--,g+=c[h++]<>>8&255,r.check=o(r.check,D,2,0)),y=g=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(p<(k=r.length)&&(k=p),k&&(r.head&&(j=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,c,h,k,j)),512&r.flags&&(r.check=o(r.check,c,k,h)),p-=k,h+=k,r.length-=k),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===p)break e;for(k=0;j=c[h+k++],r.head&&j&&r.length<65536&&(r.head.name+=String.fromCharCode(j)),j&&k>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;y<32;){if(0===p)break e;p--,g+=c[h++]<>>=7&y,y-=7&y,r.mode=27;break}for(;y<3;){if(0===p)break e;p--,g+=c[h++]<>>=1)){case 0:r.mode=14;break;case 1:if(w(r),r.mode=20,6!==t)break;g>>>=2,y-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}g>>>=2,y-=2;break;case 14:for(g>>>=7&y,y-=7&y;y<32;){if(0===p)break e;p--,g+=c[h++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&g,y=g=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(k=r.length){if(p>>=5,y-=5,r.ndist=1+(31&g),g>>>=5,y-=5,r.ncode=4+(15&g),g>>>=4,y-=4,286>>=3,y-=3}for(;r.have<19;)r.lens[F[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,I={bits:r.lenbits},R=a(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,R){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,P=65535&B,!((C=B>>>24)<=y);){if(0===p)break e;p--,g+=c[h++]<>>=C,y-=C,r.lens[r.have++]=P;else{if(16===P){for(N=C+2;y>>=C,y-=C,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}j=r.lens[r.have-1],k=3+(3&g),g>>>=2,y-=2}else if(17===P){for(N=C+3;y>>=C)),g>>>=3,y-=3}else{for(N=C+7;y>>=C)),g>>>=7,y-=7}if(r.have+k>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;k--;)r.lens[r.have++]=j}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,I={bits:r.lenbits},R=a(1,r.lens,0,r.nlen,r.lencode,0,r.work,I),r.lenbits=I.bits,R){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},R=a(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,I),r.distbits=I.bits,R){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=p&&258<=m){e.next_out=f,e.avail_out=m,e.next_in=h,e.avail_in=p,r.hold=g,r.bits=y,s(e,v),f=e.next_out,d=e.output,m=e.avail_out,h=e.next_in,c=e.input,p=e.avail_in,g=r.hold,y=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;T=(B=r.lencode[g&(1<>>16&255,P=65535&B,!((C=B>>>24)<=y);){if(0===p)break e;p--,g+=c[h++]<>S)])>>>16&255,P=65535&B,!(S+(C=B>>>24)<=y);){if(0===p)break e;p--,g+=c[h++]<>>=S,y-=S,r.back+=S}if(g>>>=C,y-=C,r.back+=C,r.length=P,0===T){r.mode=26;break}if(32&T){r.back=-1,r.mode=12;break}if(64&T){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&T,r.mode=22;case 22:if(r.extra){for(N=r.extra;y>>=r.extra,y-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;T=(B=r.distcode[g&(1<>>16&255,P=65535&B,!((C=B>>>24)<=y);){if(0===p)break e;p--,g+=c[h++]<>S)])>>>16&255,P=65535&B,!(S+(C=B>>>24)<=y);){if(0===p)break e;p--,g+=c[h++]<>>=S,y-=S,r.back+=S}if(g>>>=C,y-=C,r.back+=C,64&T){e.msg="invalid distance code",r.mode=30;break}r.offset=P,r.extra=15&T,r.mode=24;case 24:if(r.extra){for(N=r.extra;y>>=r.extra,y-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===m)break e;if(k=v-m,r.offset>k){if((k=r.offset-k)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}x=k>r.wnext?(k-=r.wnext,r.wsize-k):r.wnext-k,k>r.length&&(k=r.length),E=r.window}else E=d,x=f-r.offset,k=r.length;for(mw?(_=F[z+d[E]],I[N+d[E]]):(_=96,0),f=1<>A)+(p-=f)]=b<<24|_<<16|v|0,0!==p;);for(f=1<>=1;if(0!==f?(R&=f-1,R+=f):R=0,E++,0==--B[x]){if(x===T)break;x=t[r+d[E]]}if(P>>7)]}function k(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function x(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function T(e,t,r){var n,i,s=new Array(16),a=0;for(n=1;n<=o;n++)s[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var l=e[2*i+1];0!==l&&(e[2*i]=C(s[l]++,l))}}function P(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function S(e){8>1;1<=r;r--)O(e,s,r);for(i=u;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],O(e,s,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,s[2*i]=s[2*r]+s[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,s[2*r+1]=s[2*n+1]=i,e.heap[1]=i++,O(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,s,a,l,u=t.dyn_tree,c=t.max_code,d=t.stat_desc.static_tree,h=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,m=t.stat_desc.max_length,g=0;for(s=0;s<=o;s++)e.bl_count[s]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)m<(s=u[2*u[2*(n=e.heap[r])+1]+1]+1)&&(s=m,g++),u[2*n+1]=s,c>=7;n<30;n++)for(w[n]=i<<7,e=0;e<1<>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),R(e,e.l_desc),R(e,e.d_desc),s=function(e){var t;for(I(e,e.dyn_ltree,e.l_desc.max_code),I(e,e.dyn_dtree,e.d_desc.max_code),R(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*u[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?D(e,t,r,n):4===e.strategy||o===i?(x(e,2+(n?1:0),3),j(e,c,d)):(x(e,4+(n?1:0),3),function(e,t,r,n){var i;for(x(e,t-257,5),x(e,r-1,5),x(e,n-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(f[r]+256+1)]++,e.dyn_dtree[2*v(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){var t;x(e,2,3),E(e,256,c),16===(t=e).bi_valid?(k(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){"use strict";t.exports="function"==typeof n?n:function(){var e=[].slice.apply(arguments);e.splice(1,0,0),setTimeout.apply(null,e)}},{}]},{},[10])(10)}))}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}))}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}))}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}))}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}))}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}).call(this,r(3),r(10).Buffer,r(14).setImmediate)},function(e,t,r){"use strict";(function(e){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ var n=r(11),i=r(12),o=r(13);function s(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(e).length;default:if(n)return U(e).length;t=(""+t).toLowerCase(),n=!0}}function m(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,r);case"utf8":case"utf-8":return T(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return S(this,t,r);case"base64":return C(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:w(e,t,r,n,i);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):w(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,r,n,i){var o,s=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=r;oa&&(r=a-l),o=r;o>=0;o--){for(var d=!0,h=0;hi&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function C(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function T(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+d<=r)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(l=(15&u)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},l.prototype.compare=function(e,t,r,n,i){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(n,i),c=e.slice(t,r),d=0;di)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":return v(this,e,t,r);case"latin1":case"binary":return k(this,e,t,r);case"base64":return x(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function P(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,r,n,i,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function I(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function N(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function B(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,o){return o||B(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function F(e,t,r,n,o){return o||B(e,0,r,8),i.write(e,t,r,n,52,8),r+8}l.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)n+=this[e+--t]*i;return n},l.prototype.readUInt8=function(e,t){return t||j(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||j(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||j(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||j(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){t||j(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||j(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||j(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||j(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||j(e,8,this.length),i.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||R(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},l.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):N(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);R(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);R(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):N(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(o<1e3||!l.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Q(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function M(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(3))},function(e,t,r){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=u(e),s=n[0],a=n[1],l=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),c=0,d=a>0?s-4:s;for(r=0;r>16&255,l[c++]=t>>8&255,l[c++]=255&t;2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,l[c++]=255&t);1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t);return l},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=0,a=r-i;sa?a:s+16383));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,r){for(var i,o,s=[],a=t;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<>1,c=-7,d=r?i-1:0,h=r?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-c)-1,f>>=-c,c+=a;c>0;o=256*o+e[t+d],d+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+e[t+d],d+=h,c-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),o-=u}return(f?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,l,u=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(s++,l/=2),s+d>=c?(a=0,s=c):s+d>=1?(a=(t*l-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[r+f]=255&a,f+=p,a/=256,i-=8);for(s=s<0;e[r+f]=255&s,f+=p,s/=256,u-=8);e[r+f-p]|=128*m}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){(function(e){var n=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(i.call(setTimeout,n,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,n,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(n,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},r(15),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(3))},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var n,i,o,s,a,l=1,u={},c=!1,d=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?((o=new MessageChannel).port1.onmessage=function(e){p(e.data)},n=function(e){o.port2.postMessage(e)}):d&&"onreadystatechange"in d.createElement("script")?(i=d.documentElement,n=function(e){var t=d.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):n=function(e){setTimeout(p,0,e)}:(s="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&p(+t.data.slice(s.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),n=function(t){e.postMessage(s+t,"*")}),h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r1)for(var r=1;ri[t]=r[e][n]),t.push(i)}}catch(e){t.push({})}try{let t=$.csv.toArrays(e,{separator:"\t"}),n=t[0];for(let e=1;ei[r]=t[e][n]),r.push(i)}}catch(e){r.push({})}return Object.keys(t[0]).length>Object.keys(r[0]).length?t:Object.keys(r[0]).length?r:i.a.debug.error("Format of table is invalid")}let d=[],h=window.$.ajax;window.$.ajax=function(...e){if(e[0]&&e[0].url&&e[0].url.match(/allchunks=1$/)){let t=e[0].success;e[0].success=e=>{if(0==d.length)return t(e);let r,i=[];for(let o=d.length-1;o>=0;o--)r=o==d.length-1?r=>{n.b.AddTable(d[o].name,r),t(e)}:e=>{n.b.AddTable(d[o].name,e),i[0]()},i.push(()=>$.ajax({url:d[o].table,cache:!1,dataType:"text",success:r}));i[0]()}}return h(...e)},n.b.AddTable=function(e,t){if("string"!=typeof e||"string"!=typeof t)return i.a.debug.error("Table "+e+" not added: tables and table names should be strings");if(i.a.tables.hasOwnProperty(e)&&i.a.debug.warning("A table named "+e+" already exists; overriding it"),t.match(/^http/))d.push({name:e,table:t});else{if(!(t=c(t)))return i.a.debug.error("Table "+e+" does not have the right format.");t=new l(t,e),i.a.tables[e]=t}},n.b.GetTable=function(e){return new u(e)};let f,p=[];n.b.Template=function(e,t){if(window.items)for(let e in window.items)i.a.tmpItems.indexOf(window.items[e])<0&&i.a.tmpItems.push(window.items[e]);let r={PennTemplate:[]};return i.a.tmpItems.push(r),p.push((function(){let n,c=i.a.tmpItems.length;if(e instanceof Function){t=e;let r=Object.keys(i.a.tables);if(!(r.length&&i.a.tables[r[0]]instanceof l))return i.a.debug.error("No valid table detected");n=i.a.tables[r[0]]}else if("string"==typeof e){if(!i.a.tables.hasOwnProperty(e)){let t=Object.keys(i.a.tables),r="";for(let n=0;n’?");return i.a.debug.error("No table found with name "+e+"."+r)}if(!(i.a.tables[e]instanceof l))return i.a.debug.error("Table "+e+" does not have the right format.");n=i.a.tables[e]}else{if(!(e instanceof u))return i.a.debug.error("Bad format for Template's first argument (should be a PennController table, table name or function from rows to Ibex elements)");if(Object.keys(i.a.tables).length<1)return i.a.debug.error("No table was defined");if(e.name==s)n=i.a.tables[Object.keys(i.a.tables)[0]];else{if(!e.name||!i.a.tables.hasOwnProperty(e.name)){let t=Object.keys(i.a.tables),r="";for(let n=0;n’?");return i.a.debug.error("No table named "+e.name+" was found."+r)}n=i.a.tables[e.name]}for(let t=0;t{let t=h.filter((t,r)=>t==e.groups[r]);h.indexOf(e.runningGroup)>-1&&t.length==e.groups.length&&t.length==h.length&&(d=e.runningGroup)}),void 0===d){let e=window.__counter_value_from_server__;"number"==typeof window.counterOverride&&(e=counterOverride),d=h[e%h.length]}a.push({runningGroup:d,groups:h})}let f=[];for(let e=0;e{if(r in n.table[e])return t[r];{let t=Object.keys(n.table[e]),s="";for(let e=0;e’?");i.a.debug.error("No column named ‘"+r+"’ found in table "+n.id+"."+s)}return""}});try{r=t.call(null,a)}catch(e){window.onerror(e.name+": "+e.message,"include=data","inside PennController.Template")}r instanceof Array?r.length%2&&"string"==typeof r[0]&&(s=r[0],r.splice(0,1)):(s=r.useLabel,r.addToItems=!1,r=["PennController",r]),s||(s=n.label&&n.table[e].hasOwnProperty(n.label)?n.table[e][n.label]:n.item&&n.table[e].hasOwnProperty(n.item)?"Item-"+n.table[e][n.item]:"Item-"+e);let l=[s];for(let t in r)r[t]instanceof Object&&(r[t]._PennController={table:n,row:e}),l.push(r[t]);f.push(l)}for(r.PennTemplate=f;i.a.tmpItems.length>c;)i.a.tmpItems.pop()})),window.items||(window.items=[]),{log:()=>i.a.debug.error("Tried to call .log command on Template(); .log commands should be called on newTrial()"),label:()=>i.a.debug.error("Tried to call .label command on Template(); .label commands should be called on newTrial()"),setOption:()=>i.a.debug.error("Tried to call .setOption command on Template(); .setOption commands should be called on newTrial()"),noHeader:()=>i.a.debug.error("Tried to call .noHeader command on Template(); .noHeader commands should be called on newTrial()"),noFooter:()=>i.a.debug.error("Tried to call .noFooter command on Template(); .noFooter commands should be called on newTrial()"),noTrialLog:()=>i.a.debug.error("Tried to call .noTrialLog command on Template(); .noTrialLog commands should be called on newTrial()")}},n.b.FeedItems=(e,t)=>n.b.Template(e,t),$(document).ready((function(){f=document.createElement("P"),f.style["text-align"]="center",f.innerHTML="Loading, please wait...",f.id="FirstLoadingMessage",document.body.appendChild(f)})),i.a.Prerun(()=>{for(let e in window.CHUNKS_DICT){if(e.match(/\.(html?|mp3)$/i))continue;let t=c(window.CHUNKS_DICT[e]);t?(t=new l(t,e),i.a.tables[e]=t):(t=$.csv.toObjects(window.CHUNKS_DICT[e],{separator:"\t"}),Object.keys(t[0]).length>1&&(t=new l(t,e),i.a.tables[e]=t))}for(let e=0;e=t.end&&(l=!0),t.state.rowNum++,t.state.colNum=1}function c(){if(void 0===t.onParseValue)o.push(a);else{var e=t.onParseValue(a,t.state);!1!==e&&o.push(e)}a="",s=0,t.state.colNum++}var d=RegExp.escape(r),h=RegExp.escape(n),f=/(D|S|\r\n|\n|\r|[^DS\r\n]+)/,p=f.source;return p=(p=p.replace(/S/g,d)).replace(/D/g,h),f=new RegExp(p,"gm"),e.replace(f,(function(e){if(!l)switch(s){case 0:if(e===r){a+="",c();break}if(e===n){s=1;break}if(/^(\r\n|\n|\r)$/.test(e)){c(),u();break}a+=e,s=3;break;case 1:if(e===n){s=2;break}a+=e,s=1;break;case 2:if(e===n){a+=e,s=1;break}if(e===r){c();break}if(/^(\r\n|\n|\r)$/.test(e)){c(),u();break}throw new Error("CSVDataError: Illegal State [Row:"+t.state.rowNum+"][Col:"+t.state.colNum+"]");case 3:if(e===r){c();break}if(/^(\r\n|\n|\r)$/.test(e)){c(),u();break}if(e===n)throw new Error("CSVDataError: Illegal Quote [Row:"+t.state.rowNum+"][Col:"+t.state.colNum+"]");throw new Error("CSVDataError: Illegal Data [Row:"+t.state.rowNum+"][Col:"+t.state.colNum+"]");default:throw new Error("CSVDataError: Unknown State [Row:"+t.state.rowNum+"][Col:"+t.state.colNum+"]")}})),0!==o.length&&(c(),u()),i},splitLines:function(e,r){if(e){var n=(r=r||{}).separator||t.csv.defaults.separator,i=r.delimiter||t.csv.defaults.delimiter;r.state=r.state||{},r.state.rowNum||(r.state.rowNum=1);var o=[],s=0,a="",l=!1,u=RegExp.escape(n),c=RegExp.escape(i),d=/(D|S|\n|\r|[^DS\r\n]+)/,h=d.source;return h=(h=h.replace(/S/g,u)).replace(/D/g,c),d=new RegExp(h,"gm"),e.replace(d,(function(e){if(!l)switch(s){case 0:if(e===n){a+=e,s=0;break}if(e===i){a+=e,s=1;break}if("\n"===e){f();break}if(/^\r$/.test(e))break;a+=e,s=3;break;case 1:if(e===i){a+=e,s=2;break}a+=e,s=1;break;case 2:var t=a.substr(a.length-1);if(e===i&&t===i){a+=e,s=1;break}if(e===n){a+=e,s=0;break}if("\n"===e){f();break}if("\r"===e)break;throw new Error("CSVDataError: Illegal state [Row:"+r.state.rowNum+"]");case 3:if(e===n){a+=e,s=0;break}if("\n"===e){f();break}if("\r"===e)break;if(e===i)throw new Error("CSVDataError: Illegal quote [Row:"+r.state.rowNum+"]");throw new Error("CSVDataError: Illegal state [Row:"+r.state.rowNum+"]");default:throw new Error("CSVDataError: Unknown state [Row:"+r.state.rowNum+"]")}})),""!==a&&f(),o}function f(){if(s=0,r.start&&r.state.rowNum=r.end&&(l=!0),r.state.rowNum++}},parseEntry:function(e,t){var r=t.separator,n=t.delimiter;t.state.rowNum||(t.state.rowNum=1),t.state.colNum||(t.state.colNum=1);var i=[],o=0,s="";function a(){if(void 0===t.onParseValue)i.push(s);else{var e=t.onParseValue(s,t.state);!1!==e&&i.push(e)}s="",o=0,t.state.colNum++}if(!t.match){var l=RegExp.escape(r),u=RegExp.escape(n),c=/(D|S|\n|\r|[^DS\r\n]+)/.source;c=(c=c.replace(/S/g,l)).replace(/D/g,u),t.match=new RegExp(c,"gm")}return e.replace(t.match,(function(e){switch(o){case 0:if(e===r){s+="",a();break}if(e===n){o=1;break}if("\n"===e||"\r"===e)break;s+=e,o=3;break;case 1:if(e===n){o=2;break}s+=e,o=1;break;case 2:if(e===n){s+=e,o=1;break}if(e===r){a();break}if("\n"===e||"\r"===e)break;throw new Error("CSVDataError: Illegal State [Row:"+t.state.rowNum+"][Col:"+t.state.colNum+"]");case 3:if(e===r){a();break}if("\n"===e||"\r"===e)break;if(e===n)throw new Error("CSVDataError: Illegal Quote [Row:"+t.state.rowNum+"][Col:"+t.state.colNum+"]");throw new Error("CSVDataError: Illegal Data [Row:"+t.state.rowNum+"][Col:"+t.state.colNum+"]");default:throw new Error("CSVDataError: Unknown State [Row:"+t.state.rowNum+"][Col:"+t.state.colNum+"]")}})),a(),i}},helpers:{collectPropertyNames:function(e){var t=[],r=[],n=[];for(t in e)for(r in e[t])e[t].hasOwnProperty(r)&&n.indexOf(r)<0&&"function"!=typeof e[t][r]&&n.push(r);return n}},toArray:function(e,r,n){r=void 0!==r?r:{};var i={};i.callback=void 0!==n&&"function"==typeof n&&n,i.separator="separator"in r?r.separator:t.csv.defaults.separator,i.delimiter="delimiter"in r?r.delimiter:t.csv.defaults.delimiter;var o=void 0!==r.state?r.state:{};r={delimiter:i.delimiter,separator:i.separator,onParseEntry:r.onParseEntry,onParseValue:r.onParseValue,state:o};var s=t.csv.parsers.parseEntry(e,r);if(!i.callback)return s;i.callback("",s)},toArrays:function(e,r,n){r=void 0!==r?r:{};var i={};i.callback=void 0!==n&&"function"==typeof n&&n,i.separator="separator"in r?r.separator:t.csv.defaults.separator,i.delimiter="delimiter"in r?r.delimiter:t.csv.defaults.delimiter;var o;if(void 0!==(r={delimiter:i.delimiter,separator:i.separator,onPreParse:r.onPreParse,onParseEntry:r.onParseEntry,onParseValue:r.onParseValue,onPostParse:r.onPostParse,start:r.start,end:r.end,state:{rowNum:1,colNum:1}}).onPreParse&&r.onPreParse(e,r.state),o=t.csv.parsers.parse(e,r),void 0!==r.onPostParse&&r.onPostParse(o,r.state),!i.callback)return o;i.callback("",o)},toObjects:function(e,r,n){r=void 0!==r?r:{};var i={};i.callback=void 0!==n&&"function"==typeof n&&n,i.separator="separator"in r?r.separator:t.csv.defaults.separator,i.delimiter="delimiter"in r?r.delimiter:t.csv.defaults.delimiter,i.headers="headers"in r?r.headers:t.csv.defaults.headers,r.start="start"in r?r.start:1,i.headers&&r.start++,r.end&&i.headers&&r.end++;var o,s=[];r={delimiter:i.delimiter,separator:i.separator,onPreParse:r.onPreParse,onParseEntry:r.onParseEntry,onParseValue:r.onParseValue,onPostParse:r.onPostParse,start:r.start,end:r.end,state:{rowNum:1,colNum:1},match:!1,transform:r.transform};var a={delimiter:i.delimiter,separator:i.separator,start:1,end:1,state:{rowNum:1,colNum:1}};void 0!==r.onPreParse&&r.onPreParse(e,r.state);var l=t.csv.parsers.splitLines(e,a),u=t.csv.toArray(l[0],r);o=t.csv.parsers.splitLines(e,r),r.state.colNum=1,r.state.rowNum=u?2:1;for(var c=0,d=o.length;c-1&&(c=c.replace(new RegExp(i.delimiter,"g"),i.delimiter+i.delimiter));var d="\n|\r|S|D";d=(d=d.replace("S",i.separator)).replace("D",i.delimiter),c.search(d)>-1&&(c=i.delimiter+c+i.delimiter),s.push(c)}u+=s.join(i.separator)+"\n"}if(!i.callback)return u;i.callback("",u)},fromObjects:function(e,r,n){r=void 0!==r?r:{};var i={};if(i.callback=void 0!==n&&"function"==typeof n&&n,i.separator="separator"in r?r.separator:t.csv.defaults.separator,i.delimiter="delimiter"in r?r.delimiter:t.csv.defaults.delimiter,i.headers="headers"in r?r.headers:t.csv.defaults.headers,i.sortOrder="sortOrder"in r?r.sortOrder:"declare",i.manualOrder="manualOrder"in r?r.manualOrder:[],i.transform=r.transform,"string"==typeof i.manualOrder&&(i.manualOrder=t.csv.toArray(i.manualOrder,i)),void 0!==i.transform){var o,s=e;for(e=[],o=0;o0){var h=[].concat(i.manualOrder);let e;for(e=0;e{let r=Object.getOwnPropertyDescriptors(t);for(let t in r){let n=r[t];n.value instanceof Function?e[t]=n.value:n.get instanceof Function&&Object.defineProperty(e,t,n)}};window.PennController.ResetPrefix=function(e){if("string"==typeof e){if(window[e])throw"ERROR: prefix string already used for another JS object";window[e]={};var t=window[e]}else t=window;r(t,window.PennController.Elements),r(t,window.PennController)}},function(e,t,r){"use strict";var n=r(0),i=r(2);n.a.Prerun(()=>{let e=[];function t(t){return t instanceof i.a?e.indexOf(t)<0&&t.addToItems?[t.useLabel||"unlabeled","PennController",t]:null:t}if(window.items instanceof Array)for(let t=0;t2)for(let r=2;r2)for(let r=2;re instanceof Array&&e.length>2),window.shuffleSequence||(window.conf_shuffleSequence=window.seq(window.anyType))})},,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";r.r(t);r(1),r(0),r(6),r(2),r(7),r(8),r(17),r(19),r(20)}]);