/*! * This software is licensed under a BSD license; see the LICENSE file for details. * * - Version 1.0 * - Last Update: 2018, October 1 * - Major changes in version 1.0: * * Revised the optional definition of shuffleSequence (now runs in passed order if undefined) * * PennController now adds items to the items variable without being embedded * * Standard settings commands .after, .before, .center, .left and .right now update even after action .print * * Settings command .labels for Scale is now deprecated, use .labelsPosition instead * + Added duration for sliders (as comments) * + Added options "left" and "right" to the settings command .labelsPosition for Scale elements * + Added Setting commands .checkboxWarning, .inputWarning and .radioWarning to Html elements * + Added .settings.log as a default for printing (canvas, image and text) * + Added getScale(id).settings.label(index, value) to (re)set the label of the index'th option */!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=133)}([function(e,t,n){"use strict";n.d(t,"a",function(){return i});let r=[];var i={resources:{list:[],fetch:function(e,t,n){n=void 0==n|1==n;var r=i.resources.list.filter(t=>t.name==e&&t.controllers.indexOf(i.controllers.underConstruction.id)<0);if((r=r.length?r[0]:new class{constructor(e,t){this.name=e,this.value=e,this.creator=t,this.controllers=[],this.object=null,this.status="void"}create(){this.status="pending",this.creator.apply(this,[()=>this.resolve()])}resolve(){this.status="ready"}}(e,t)).controllers.push(i.controllers.underConstruction.id),i.controllers.underConstruction.resources.push(r),"void"!=r.status)return r;if(r.creator=t,r.create(),n)for(let t in i.URLs)r.create.apply($.extend({},r,{value:i.URLs[t]+e,resolve:function(){"ready"!=r.status&&(r.object=this.object,r.resolve())}}));return i.resources.list.push(r),r}},controllers:{list:[],running:null,underConstruction:null},elements:{list:[]},URLs:[],utils:{},Prerun:function(e){r.push(e)}};let s=window.ibex_controller_set_properties;window.ibex_controller_set_properties=function(e,t){if(s(e,t),"__SendResults__"==e)for(let e in r)r[e]instanceof Function&&r[e].call()}},function(e,t,n){"use strict";var r=n(6),i=n(48),s=n(15),o=n(114),a=n(11);function l(e){return e}function h(e,t){for(var n=0;n1;)try{return u.stringifyByChunk(e,r,n)}catch(e){n=Math.floor(n/2)}return u.stringifyByChar(e)}function f(e,t){for(var n=0;nnew l);var h=function(...e){let t=r.a.controllers.underConstruction;e.length&&"string"==typeof e[0]&&(t.useLabel=e[0]);let n=[];return function e(...t){for(let n in t)t[n]._promises?this.push(Object(i.c)(t[n]._promises)):t[n]instanceof Array&&e.apply(this,t[n])}.apply(n,e),t.sequence=Object(i.c)(n),r.a.controllers.underConstruction=new l,t};let u={};h.GetURLParameter=function(e){if(!Object.keys(u).length){let e=window.location.search.replace("?","").split("&");for(let t in e)u[e[t].split("=")[0]]=e[t].split("=")[1]}if(u.hasOwnProperty(e))return u[e]},h.AddHost=function(...e){for(let t in e)"string"==typeof e[t]&&e[t].match(/^https?:\/\//i)?r.a.URLs.push(e[t]):console.warn("URL #"+t+" is not a valid URL (PennController.AddHost).",e[t])},h.CheckPreloaded=function(...e){let t=new l;t.id="Preloader",t.runHeader=!1,t.runFooter=!1,r.a.controllers.list.pop(),t.sequence=(()=>new Promise(e=>e())),t.ignoreWhenCheckingPreload=!0,e.length&&Number(e[e.length-1])>0&&(t.preloadDelay=Number(e[e.length-1]),e.length>1&&e.pop());let n=[];if(e.length)for(let t in e){let r=e[t];"string"==typeof r&&(r=(n=>n==e[t])),r instanceof Function&&n.push(r)}else n=[anyType];let i=window.modifyRunningOrder;return window.modifyRunningOrder=function(e){i instanceof Function&&(e=i.call(this,e));for(let r=0;r{let t=!1;for(let r in n)t=t||n[r](e.type);t=(t=t&&"PennController"==e.controller)&&!e.options.ignoreWhenCheckingPreload});for(let e in i)t.resources=t.resources.concat(element[e].resources.filter(e=>t.resources.indexOf(e)<0))}return e},t},h.Header=function(...e){let t=r.a.controllers.underConstruction;t.id="Header",t.addToItems=!1,r.a.controllers.list.pop(),t.sequence=Object(i.c)(e.map(e=>Object(i.c)(e._promises)));for(let e in t.defaultCommands)for(let n in t.defaultCommands[e])t.defaultCommands[e][n].push("header");return o=t,r.a.controllers.underConstruction=new l,t},h.Footer=function(...e){let t=r.a.controllers.underConstruction;return t.id="Footer",t.addToItems=!1,r.a.controllers.list.pop(),t.sequence=Object(i.c)(e.map(e=>Object(i.c)(e._promises))),a=t,r.a.controllers.underConstruction=new l,t},define_ibex_controller({name:"PennController",jqueryWidget:{_init:function(){var e=this;r.a.controllers.running=e,e.cssPrefix=e.options._cssPrefix,e.utils=e.options._utils,e.finishedCallback=e.options._finishedCallback,e.id=e.options.id,e.runHeader=void 0==e.options.runHeader|e.options.runHeader,e.runFooter=void 0==e.options.runFooter|e.options.runFooter;let t=e.options.preloadDelay,n=[];e.save=function(t,r,i,s,o,...a){a.length||(a=["NULL"]);let l=[["PennElementType",t],["PennElementName",r],["Parameter",i],["Value",s],["EventTime",o]];if(e.options.appendResultLine instanceof Array)for(let t in e.options.appendResultLine){let n=e.options.appendResultLine[t];n instanceof Array&&2==n.length&&l.push(n)}l.push(["Comments",a.join(",")]),n.push(l)};for(let t in e.options.linesToSave)e.save(e.options.linesToSave[t]);e.runHeader&&o instanceof l&&(e.options.resources=e.options.resources.concat(o.resources.filter(t=>e.options.resources.indexOf(t)<0)),$.extend(e.options.elements,o.elements)),e.runFooter&&a instanceof l&&(e.options.resources=e.options.resources.concat(a.resources.filter(t=>e.options.resources.indexOf(t)<0)),$.extend(e.options.elements,a.elements));let s=!1,h=async function(){if(!s){s=!0,e.runFooter&&a instanceof l&&(e.save("PennController",e.id,"_Footer_","Start",Date.now(),"NULL"),await a.sequence(),e.save("PennController",e.id,"_Footer_","End",Date.now(),"NULL"));for(let t in e.options.elements)e.options.elements[t].end();e.save("PennController",e.id,"_Trial_","End",Date.now(),"NULL"),n.sort((e,t)=>e[4][1]>t[4][1]),n.map(e=>{for(let t in e)e[t][1]instanceof Function?e[t][1]=e[t][1]():e[t][1]&&"Var"==e[t][1].type&&(e[t][1]=e[t][1].value)}),e.finishedCallback(n)}};e.endTrial=h;let u=!1,c=async function(t){if(!u){if(u=!0,t)for(let t in e.options.resources.filter(e=>"ready"!=e.status))e.save("PennController",e.id,"_PreloadFailed_",csv_url_encode(e.options.resources[t].name),Date.now(),"NULL");e.save("PennController",e.id,"_Trial_","Start",Date.now(),"NULL"),e.runHeader&&o instanceof l&&(e.save("PennController",e.id,"_Header_","Start",Date.now(),"NULL"),await o.sequence(),e.save("PennController",e.id,"_Header_","End",Date.now(),"NULL")),f.remove(),e.options.sequence().then(h)}},f=$("

Please wait while the resources are preloading

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

");e.element.append(f);for(let t in e.options.resources){let n=e.options.resources[t],r=n.resolve;"ready"!=n.status&&(n.resolve=function(){r.apply(n),0==e.options.resources.filter(e=>"ready"!=e.status).length&&c()})}0==e.options.resources.filter(e=>"ready"!=e.status).length?c():setTimeout(function(){c(!0)},t)}},properties:{obligatory:[],countsForProgressBar:!0,htmlDescription:null}}),r.a.Prerun(()=>{let e=[];if(window.items)for(let t in window.items){let n=window.items[t];if(n.length>2)for(let t=2;tnew Promise(async function(t){for(let t in e)if(e[t]instanceof Function)var n=await e[t]();t(n)})}function i(e){let t=[];return new Uint8Array(e).forEach(e=>{t.push(e.toString(16))}),t.join("").toUpperCase()}function s(e){return e.match(/^00000[12]00/)?"image/x-icon":e.match(/424D/)?"image/bmp":e.match(/^89504E470D0A1A0A/)?"image/png":e.match(/^474946383[79]61/)?"image/gif":e.match(/^52494646........574542505650/)?"image/webp":e.match(/^FFD8FF/)?"image/jpeg":e.match(/^2E736E64/)?"audio/basic":e.match(/^464F524D........41494646/)?"audio/aiff":e.match(/^(fffb|494433)/)?"audio/mpeg":e.match(/^4F67675300/)?"application/ogg":e.match(/^4D546864......06/)?"audio/midi":e.match(/^52494646........41564920/)?"video/avi":e.match(/^52494646......(..)?57415645/)?"audio/wave":e.match(/^1A45DFA3/)?"video/webm":e.match(/^25504446/)?"application/pdf":!!e.match(/^504B0304/)&&"application/zip"}function o(e){let t=e/1e3%60,n=Math.trunc(e/6e4);return(n>0?n+"min":"")+(t>0?t+"s":"")}n.d(t,"c",function(){return r}),n.d(t,"b",function(){return i}),n.d(t,"a",function(){return s}),n.d(t,"d",function(){return o})},function(e,t,n){"use strict";function r(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}r.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 n=0;n "+e:e}},e.exports=r},function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var s={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var s=0;s=252?6:l>=248?5:l>=240?4:l>=224?3:l>=192?2:1;a[254]=a[254]=1;function h(){o.call(this,"utf-8 decode"),this.leftOver=null}function u(){o.call(this,"utf-8 encode")}t.utf8encode=function(e){return i.nodebuffer?s.newBufferFrom(e,"utf-8"):function(e){var t,n,r,s,o,a=e.length,l=0;for(s=0;s>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t}(e)},t.utf8decode=function(e){return i.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,i,s,o=e.length,l=new Array(2*o);for(n=0,t=0;t4)l[n++]=65533,t+=s-1;else{for(i&=2===s?31:3===s?15:7;s>1&&t1?l[n++]=65533:i<65536?l[n++]=i:(i-=65536,l[n++]=55296|i>>10&1023,l[n++]=56320|1023&i)}return l.length!==n&&(l.subarray?l=l.subarray(0,n):l.length=n),r.applyFromCharCode(l)}(e=r.transformTo(i.uint8array?"uint8array":"array",e))},r.inherits(h,o),h.prototype.processChunk=function(e){var n=r.transformTo(i.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var s=n;(n=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),n.set(s,this.leftOver.length)}else n=this.leftOver.concat(n);this.leftOver=null}var o=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0?t:0===n?t:n+a[e[n]]>t?n:t}(n),l=n;o!==n.length&&(i.uint8array?(l=n.subarray(0,o),this.leftOver=n.subarray(o,n.length)):(l=n.slice(0,o),this.leftOver=n.slice(o,n.length))),this.push({data:t.utf8decode(l),meta:e.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:t.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},t.Utf8DecodeWorker=h,r.inherits(u,o),u.prototype.processChunk=function(e){this.push({data:t.utf8encode(e.data),meta:e.meta})},t.Utf8EncodeWorker=u},function(e,t,n){"use strict";var r=null;r="undefined"!=typeof Promise?Promise:n(100),e.exports={Promise:r}},function(e,t,n){(function(e){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===n(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===n(e)},t.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,n(13).Buffer)},function(e,t,n){"use strict";(function(e){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ var r=n(128),i=n(127),s=n(55);function o(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().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 n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(r)return U(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,i);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,i){var s,o=1,a=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,n/=2}function h(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var u=-1;for(s=n;sa&&(n=a-l),s=n;s>=0;s--){for(var c=!0,f=0;fi&&(r=i):r=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o>8,i=n%256,s.push(i),s.push(r);return s}(t,e.length-n),e,n,r)}function C(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function x(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:h>223?3:h>191?2:1;if(i+c<=n)switch(c){case 1:h<128&&(u=h);break;case 2:128==(192&(s=e[i+1]))&&(l=(31&h)<<6|63&s)>127&&(u=l);break;case 3:s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&(l=(15&h)<<12|(63&s)<<6|63&o)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&h)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(u=l)}null===u?(u=65533,c=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=c}return function(e){var t=e.length;if(t<=S)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,n);case"utf8":case"utf-8":return x(this,t,n);case"ascii":return j(this,t,n);case"latin1":case"binary":return P(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},l.prototype.compare=function(e,t,n,r,i){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var s=i-r,o=n-t,a=Math.min(s,o),h=this.slice(r,i),u=e.slice(t,n),c=0;ci)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return _(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function j(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",s=t;sn)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,s){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 N(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function Q(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function I(e,t,n,r,i,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,s){return s||I(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,s){return s||I(e,0,n,8),i.write(e,t,n,r,52,8),n+8}l.prototype.slice=function(e,t){var n,r=this.length;if(e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},l.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||O(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||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=this[e],i=1,s=0;++s=(i*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=t,i=1,s=this[e+--r];r>0&&(i*=256);)s+=this[e+--r]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},l.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||O(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||O(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||O(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,s=0;for(this[t]=255&e;++s=0&&(s*=256);)this[t+i]=e/s&255;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||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,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||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):Q(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||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):Q(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s>0)-a&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||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,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||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):Q(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||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):Q(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return L(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(s<1e3||!l.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function F(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function M(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(8))},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";(function(t){e.exports={isNode:void 0!==t,newBufferFrom:function(e,n){return new t(e,n)},allocBuffer:function(e){return t.alloc?t.alloc(e):new t(e)},isBuffer:function(e){return t.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}}).call(this,n(13).Buffer)},function(e,t,n){var r=n(13),i=r.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=o),s(i,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";(function(t){!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,n,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var s,o,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,n)});case 3:return t.nextTick(function(){e.call(null,n,r)});case 4:return t.nextTick(function(){e.call(null,n,r,i)});default:for(s=new Array(a-1),o=0;o1)for(var n=1;n>>1:e>>>1;t[n]=e}return t}();e.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,n,r){var s=i,o=r+n;e^=-1;for(var a=r;a>>8^s[255&(e^t[a])];return-1^e}(0|t,e,e.length,0):function(e,t,n,r){var s=i,o=r+n;e^=-1;for(var a=r;a>>8^s[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length,0):0}},function(e,t,n){"use strict";var r=n(11),i=n(41),s=n(40),o=n(39);s=n(40);function a(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}a.prototype={getContentWorker:function(){var e=new i(r.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(r.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,n){return e.pipe(new o).pipe(new s("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new s("compressedSize")).withStreamInfo("compression",t)},e.exports=a},function(e,t,n){e.exports=!n(45)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){"use strict";(function(t,r,i){var s=n(17);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=v;var a,l=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?r:s.nextTick;v.WritableState=y;var h=n(12);h.inherits=n(9);var u={deprecate:n(120)},c=n(52),f=n(16).Buffer,d=i.Uint8Array||function(){};var p,m=n(51);function g(){}function y(e,t){a=a||n(7),e=e||{};var r=t instanceof a;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,h=e.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(h||0===h)?h:u,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(s.nextTick(i,r),s.nextTick(C,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(i(r),e._writableState.errorEmitted=!0,e.emit("error",r),C(e,t))}(e,n,r,t,i);else{var o=E(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||_(e,n),r?l(w,e,n,o,i):w(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function v(e){if(a=a||n(7),!(p.call(v,this)||this instanceof a))return new v(e);this._writableState=new y(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),c.call(this)}function b(e,t,n,r,i,s,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function w(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),C(e,t)}function _(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),s=t.corkedRequestsFree;s.entry=n;for(var a=0,l=!0;n;)i[a]=n,n.isBuf||(l=!1),n=n.next,a+=1;i.allBuffers=l,b(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var h=n.chunk,u=n.encoding,c=n.callback;if(b(e,t,!1,t.objectMode?1:h.length,h,u,c),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function E(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),C(e,t)})}function C(e,t){var n=E(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,s.nextTick(k,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}h.inherits(v,c),y.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(y.prototype,"buffer",{get:u.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(v,Symbol.hasInstance,{value:function(e){return!!p.call(this,e)||this===v&&(e&&e._writableState instanceof y)}})):p=function(e){return e instanceof this},v.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},v.prototype.write=function(e,t,n){var r,i=this._writableState,o=!1,a=!i.objectMode&&(r=e,f.isBuffer(r)||r instanceof d);return a&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=g),i.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),s.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),s.nextTick(r,o),i=!1),i}(this,i,e,n))&&(i.pendingcb++,o=function(e,t,n,r,i,s){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(v.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),v.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},v.prototype._writev=null,v.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,C(e,t),n&&(t.finished?s.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),v.prototype.destroy=m.destroy,v.prototype._undestroy=m.undestroy,v.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(18),n(122).setImmediate,n(8))},function(e,t,n){(t=e.exports=n(53)).Stream=t,t.Readable=t,t.Writable=n(24),t.Duplex=n(7),t.Transform=n(49),t.PassThrough=n(119)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,a,l,h;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}if(s(n=this._events[e]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),n.apply(this,a)}else if(i(n))for(a=Array.prototype.slice.call(arguments,1),o=(h=n.slice()).length,l=0;l0&&this._events[e].length>o&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},n.prototype.removeListener=function(e,t){var n,s,o,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(o=(n=this._events[e]).length,s=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(a=o;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){s=a;break}if(s<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(s,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";var r={};function i(){try{return new window.XMLHttpRequest}catch(e){}}r._getBinaryFromXHR=function(e){return e.response||e.responseText};var s=window.ActiveXObject?function(){return i()||function(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}()}:i;r.getBinaryContent=function(e,t){try{var n=s();n.open("GET",e,!0),"responseType"in n&&(n.responseType="arraybuffer"),n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.onreadystatechange=function(i){var s,o;if(4===n.readyState)if(200===n.status||0===n.status){s=null,o=null;try{s=r._getBinaryFromXHR(n)}catch(e){o=new Error(e)}t(o,s)}else t(new Error("Ajax error for "+e+" : "+this.status+" "+this.statusText),null)},n.send()}catch(e){t(new Error(e),null)}},e.exports=r},function(e,t,n){"use strict";var r=n(30);function i(e){r.call(this,e)}n(1).inherits(i,r),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},e.exports=i},function(e,t,n){"use strict";var r=n(1);function i(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.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))}},e.exports=i},function(e,t,n){"use strict";var r=n(29);function i(e){r.call(this,e);for(var t=0;t=0;--s)if(this.data[s]===t&&this.data[s+1]===n&&this.data[s+2]===r&&this.data[s+3]===i)return s-this.zero;return-1},i.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1),r=e.charCodeAt(2),i=e.charCodeAt(3),s=this.readData(4);return t===s[0]&&n===s[1]&&r===s[2]&&i===s[3]},i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},e.exports=i},function(e,t,n){"use strict";var r=n(1),i=n(6),s=n(30),o=n(80),a=n(79),l=n(28);e.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new a(e):i.uint8array?new l(r.transformTo("uint8array",e)):new s(r.transformTo("array",e)):new o(e)}},function(e,t,n){"use strict";t.LOCAL_FILE_HEADER="PK",t.CENTRAL_FILE_HEADER="PK",t.CENTRAL_DIRECTORY_END="PK",t.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",t.ZIP64_CENTRAL_DIRECTORY_END="PK",t.DATA_DESCRIPTOR="PK\b"},function(e,t,n){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(e,t,n){"use strict";e.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}},function(e,t,n){"use strict";var r=n(5),i=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new r.Buf8(256),a=0;a<256;a++)o[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function l(e,t){if(t<65537&&(e.subarray&&s||!e.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",o=0;o>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},t.buf2binstring=function(e){return l(e,e.length)},t.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n4)h[r++]=65533,n+=s-1;else{for(i&=2===s?31:3===s?15:7;s>1&&n1?h[r++]=65533:i<65536?h[r++]=i:(i-=65536,h[r++]=55296|i>>10&1023,h[r++]=56320|1023&i)}return l(h,r)},t.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0?t:0===n?t:n+o[e[n]]>t?n:t}},function(e,t,n){"use strict";var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();e.exports=function(e,t,n,i){var s=r,o=i+n;e^=-1;for(var a=i;a>>8^s[255&(e^t[a])];return-1^e}},function(e,t,n){"use strict";e.exports=function(e,t,n,r){for(var i=65535&e|0,s=e>>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{s=s+(i=i+t[r++]|0)|0}while(--o);i%=65521,s%=65521}return i|s<<16|0}},function(e,t,n){"use strict";var r=n(4);t.STORE={magic:"\0\0",compressWorker:function(e){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},t.DEFLATE=n(94)},function(e,t,n){"use strict";var r=n(4),i=n(20);function s(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n(1).inherits(s,r),s.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},e.exports=s},function(e,t,n){"use strict";var r=n(1),i=n(4);function s(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(s,i),s.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)},e.exports=s},function(e,t,n){"use strict";var r=n(1),i=n(4);function s(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=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(s,i),s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.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}})},e.exports=s},function(e,t,n){"use strict";t.base64=!1,t.binary=!1,t.dir=!1,t.createFolders=!0,t.date=null,t.compression=null,t.compressionOptions=null,t.comment=null,t.unixPermissions=null,t.dosPermissions=null},function(e,t,n){"use strict";(function(t){var r=n(1),i=n(98),s=n(4),o=n(48),a=n(6),l=n(11),h=null;if(a.nodestream)try{h=n(97)}catch(e){}function u(e,n){return new l.Promise(function(i,s){var a=[],l=e._internalType,h=e._outputType,u=e._mimeType;e.on("data",function(e,t){a.push(e),n&&n(t)}).on("error",function(e){a=[],s(e)}).on("end",function(){try{var e=function(e,t,n){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),n);case"base64":return o.encode(t);default:return r.transformTo(e,t)}}(h,function(e,n){var r,i=0,s=null,o=0;for(r=0;r>2,a=(3&t)<<4|n>>4,l=d>1?(15&n)<<2|i>>6:64,h=d>2?63&i:64,u.push(s.charAt(o)+s.charAt(a)+s.charAt(l)+s.charAt(h));return u.join("")},t.decode=function(e){var t,n,r,o,a,l,h=0,u=0;if("data:"===e.substr(0,"data:".length))throw new Error("Invalid base64 input, it looks like a data url.");var c,f=3*(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(e.charAt(e.length-1)===s.charAt(64)&&f--,e.charAt(e.length-2)===s.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(c=i.uint8array?new Uint8Array(0|f):new Array(0|f);h>4,n=(15&o)<<4|(a=s.indexOf(e.charAt(h++)))>>2,r=(3&a)<<6|(l=s.indexOf(e.charAt(h++))),c[u++]=t,64!==a&&(c[u++]=n),64!==l&&(c[u++]=r);return c}},function(e,t,n){"use strict";e.exports=s;var r=n(7),i=n(12);function s(e){if(!(this instanceof s))return new s(e);r.call(this,e),this._transformState={afterTransform:function(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function l(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function h(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function u(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(e.lastNeed=i-1),i;if(--r=0)return i>0&&(e.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";var r=n(17);function i(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||r.nextTick(i,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(r.nextTick(i,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,n){e.exports=n(26).EventEmitter},function(e,t,n){"use strict";(function(t,r){var i=n(17);e.exports=b;var s,o=n(55);b.ReadableState=v;n(26).EventEmitter;var a=function(e,t){return e.listeners(t).length},l=n(52),h=n(16).Buffer,u=t.Uint8Array||function(){};var c=n(12);c.inherits=n(9);var f=n(125),d=void 0;d=f&&f.debuglog?f.debuglog("stream"):function(){};var p,m=n(124),g=n(51);c.inherits(b,l);var y=["error","close","destroy","pause","resume"];function v(e,t){s=s||n(7),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(p||(p=n(50).StringDecoder),this.decoder=new p(e.encoding),this.encoding=e.encoding)}function b(e){if(s=s||n(7),!(this instanceof b))return new b(e);this._readableState=new v(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function w(e,t,n,r,i){var s,o=e._readableState;null===t?(o.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,C(e)}(e,o)):(i||(s=function(e,t){var n;r=t,h.isBuffer(r)||r instanceof u||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===h.prototype||(t=function(e){return h.from(e)}(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):_(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?_(e,o,t,!1):S(e,o)):_(e,o,t,!1))):r||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=E?e=E:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function C(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(x,e):x(e))}function x(e){d("emit readable"),e.emit("readable"),A(e)}function S(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(j,e,t))}function j(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;es.length?s.length:e;if(o===s.length?i+=s:i+=s.slice(0,e),0===(e-=o)){o===s.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(o));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=h.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var s=r.data,o=e>s.length?s.length:e;if(s.copy(n,n.length-e,0,o),0===(e-=o)){o===s.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=s.slice(o));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function R(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(N,t,e))}function N(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Q(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?R(this):C(this),null;if(0===(e=k(e,t))&&t.ended)return 0===t.length&&R(this),null;var r,i=t.needReadable;return d("need readable",i),(0===t.length||t.length-e0?O(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&R(this)),null!==r&&this.emit("data",r),r},b.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(e,t){var n=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,d("pipe count=%d opts=%j",s.pipesCount,t);var l=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?u:b;function h(t,r){d("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,d("cleanup"),e.removeListener("close",y),e.removeListener("finish",v),e.removeListener("drain",c),e.removeListener("error",g),e.removeListener("unpipe",h),n.removeListener("end",u),n.removeListener("end",b),n.removeListener("data",m),f=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function u(){d("onend"),e.end()}s.endEmitted?i.nextTick(l):n.once("end",l),e.on("unpipe",h);var c=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,A(e))}}(n);e.on("drain",c);var f=!1;var p=!1;function m(t){d("ondata"),p=!1,!1!==e.write(t)||p||((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==Q(s.pipes,e))&&!f&&(d("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function g(t){d("onerror",t),b(),e.removeListener("error",g),0===a(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",v),b()}function v(){d("onfinish"),e.removeListener("close",y),b()}function b(){d("unpipe"),n.unpipe(e)}return n.on("data",m),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",g),e.once("close",y),e.once("finish",v),e.emit("pipe",n),s.flowing||(d("pipe resume"),n.resume()),e},b.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s");a.attr({src:"https://www.youtube-nocookie.com/embed/"+r+"?enablejsapi=1&controls="+i,id:s,frameborder:0}).bind("load",()=>o=!0).css({display:"none",position:"absolute"}),$(document).ready(()=>$(document.body).append(a)),n.push(()=>{let e=!0,n=()=>this.player=new YT.Player(s,{playerVars:{controls:i},events:{onReady:e=>{a=e.target.cueVideoById(r),e.target.playVideo()},onStateChange:n=>{n.data!=YT.PlayerState.ENDED||e?n.data==YT.PlayerState.PLAYING?e?(n.target.pauseVideo(),n.target.seekTo(0),e=!1,t()):this.playing(n):n.data!=YT.PlayerState.PAUSED||e?n.data!=YT.PlayerState.BUFFERING||e||this.buffering(n):this.paused(n):this.ended(n)}}});o?n():a.bind("load",n)}),this.object=a},!1)},this.uponCreation=function(e){this.iframe=this.resource.object,this.player=this.resource.player,this.log=!1,this.hasPlayed=!1,this.events=[],this.onplay=(()=>this.events.push(["Play",this.player.getCurrentTime(),Date.now(),"NULL"])),this.onpause=(()=>this.events.push(["Pause",this.player.getCurrentTime(),Date.now(),"NULL"])),this.onbuffer=(()=>this.events.push(["Buffer",this.player.getCurrentTime(),Date.now(),"NULL"])),this.onend=(()=>{this.hasPlayed=!0,this.events.push(["End",this.player.getCurrentTime(),Date.now(),"NULL"])});let t=this,n=this.resource.ended;this.resource.ended=function(e){n.apply(this,e),t.onend()};let r=this.resource.playing;this.resource.playing=function(e){r.apply(this,e),t.onplay()};let i=this.resource.paused;this.resource.paused=function(e){i.apply(this,e),t.onpause()};let s=this.resource.buffering;this.resource.buffering=function(e){s.apply(this,e),t.onbuffer()},this.jQueryElement=$("
").css("display","inline-block"),this.visual={top:0,left:0,width:this.iframe.width(),height:this.iframe.height()},this.jQueryElement.css({width:this.visual.width,height:this.visual.height}),this.player.seekTo(0),this.disabled=!1,this.jQueryDisable=null,this.printDisable=(()=>{this.jQueryDisable instanceof jQuery&&this.jQueryDisable.remove(),this.jQueryDisable=$("
").css({position:"absolute",display:"inline-block","background-color":"gray",opacity:.5,width:this.jQueryElement.width(),height:this.jQueryElement.height()}),this.jQueryElement.before(this.jQueryDisable),this.jQueryElement.addClass("PennController-"+this.type+"-disabled")}),e()},this.end=function(){if(this.observer&&this.observer instanceof t&&this.observer.disconnect(),this.player&&this.player.getPlayerState()==YT.PlayerState.PLAYING&&this.player.pauseVideo(),this.iframe.css("display","none"),this.jQueryDisable&&this.jQueryDisable.remove(),this.log&&this.log instanceof Array)if(this.events.length)if(this.log.indexOf("all")>-1)for(let t in this.events)e.controllers.running.save(this.type,this.id,...this.events[t]);else{if(this.log.indexOf("play")>-1){let t=this.events.filter(e=>"Play"==e[0]);for(let n in t)e.controllers.running.save(this.type,this.id,...t[n])}if(this.log.indexOf("end")>-1){let t=this.events.filter(e=>"End"==e[0]);for(let n in t)e.controllers.running.save(this.type,this.id,...t[n])}if(this.log.indexOf("pause")>-1){let t=this.events.filter(e=>"Pause"==e[0]);for(let n in t)e.controllers.running.save(this.type,this.id,...t[n])}if(this.log.indexOf("buffer")>-1){let t=this.events.filter(e=>"Buffer"==e[0]);for(let n in t)e.controllers.running.save(this.type,this.id,...t[n])}}else e.controllers.running.save(this.type,this.id,"play","NA","Never","The video was never played during the trial")},this.value=function(){return this.hasPlayed},this.actions={play:function(e){this.player.playVideo(),e()},pause:function(e){this.player.pauseVideo(),e()},print:function(n,r){e.elements.standardCommands.actions.print.apply(this,[()=>{let e=this.jQueryElement.offset();this.iframe.css({position:"absolute",left:e.left,top:e.top,display:"inline-block"}),this.observer=new t(()=>{if(this.jQueryElement[0].offsetParent&&$.contains(document.body,this.jQueryElement[0])){this.iframe.css("display",this.jQueryElement.css("display"));let e=this.jQueryElement.width(),t=this.jQueryElement.height();e==this.visual.width&&t==this.visual.height||(this.iframe.css({width:e,height:t}),this.visual.width=e,this.visual.height=t);let n=this.jQueryElement.offset();n.left==this.visual.left&&n.top==this.visual.top||(this.iframe.css({left:n.left,top:n.top}),this.visual.left=n.left,this.visual.top=n.top),this.observer.disconnect(),this.observer.observe(this.jQueryElement.parent()[0],{childList:!0,attributes:!0,subtree:!0})}else this.iframe.css("display","none")}),this.observer.observe(this.jQueryElement.parent()[0],{childList:!0,attributes:!0,subtree:!0}),this.disabled&&this.printDisable(),n()},r])},remove:function(t){this.iframe.css("display","none"),e.elements.standardCommands.actions.remove.apply(this,[t])},stop:function(e){this.player.playVideo(),this.player.seekTo(0),e()},wait:function(e,t){if("first"==t&&this.hasPlayed)e();else{let n=!1,r=this.onend;this.onend=function(...i){r.apply(this,i),n||(t instanceof Object&&t._runPromises&&t.success?t._runPromises().then(t=>{"success"==t&&(n=!0,e())}):(n=!0,e()))}}}},this.settings={disable:function(e){this.printDisable(),this.disabled=!0,e()},enable:function(e){this.jQueryDisable instanceof jQuery&&(this.disabled=!1,this.jQueryDisable.remove(),this.jQueryDisable=null,this.jQueryElement.removeClass("PennController-"+this.type+"-disabled")),e()},once:function(e){if(this.hasPlayed)this.disabled=!0;else{let e=this.onend,t=this;this.onend=function(...n){e.apply(this,n),t.disabled=!0,t.printDisable()}}e()},log:function(e,...t){t.length?this.log=t:this.log=["play"],e()},size:function(t,n,r){e.elements.standardCommands.settings.size.apply(this,[()=>{this.iframe.css({width:n,height:r}),this.visual.width=n,this.visual.height=r,t()},n,r])}},this.test={hasPlayed:function(){return this.hasPlayed},playing:function(){return 1==this.player.getPlayerState()}}})},function(e,t){window.PennController._AddElementType("VoiceRecorder",function(e){let t,n,r,i=[],s="",o=!1;window.PennController.InitiateRecorder=function(i,a){i.match(/^http.+/i)||console.error("VoiceRecorder's save URL is incorrect",i),s=i,o=!0;let l=e.controllers.new();return l.id="InitiateRecorder",l.runHeader=!1,l.runFooter=!1,e.controllers.list.pop(),l.sequence=(()=>new Promise(i=>{let s=e.controllers.running;if(!navigator.mediaDevices)return s.element.append($("

Sorry, you cannot complete this experiment because your browser does not support voice recording.

"));a||(a="This experiment collects voice recording samples from its participants. Your browser should now be prompting a permission request to use your recording device (if applicable). By giving your authorization to record, and by participating in this experiment, you are giving permission to the designer(s) of this experiment to anonymously collect the voice samples recorded during this experiment. The output audio files will be uploaded to and hosted on a server designated by the experimenter(s). If you accept the request, a label will remain visible at the top of this window throughout the whole experiment, indicating whether you are being recorded."),s.element.append($("

"+a+"

"));let o=[];navigator.mediaDevices.getUserMedia({audio:!0}).then(function(e){(t=new MediaRecorder(e)).onstop=function(e){r.css({"font-weight":"normal",color:"black","background-color":"lightgray"}),r.html("Not recording"),n.filename="msr-"+(new Date).toISOString().replace(/:|\./g,"-")+".ogg",n.blob=new Blob(o,{type:"audio/ogg; codecs=opus"}),n.audioPlayer.src=URL.createObjectURL(n.blob),o=[],n=null},t.onstart=function(e){r.css({"font-weight":"bold",color:"white","background-color":"red"}),r.html("Recording...")},t.ondataavailable=function(e){o.push(e.data)},s.element.append($("By clicking this link I understand that I grant this experiment's script access to my recording device for the purpose of uploading voice recordings to the server designated by the experimenter(s).").addClass("Message-continue-link").click(i)),(r=$("
Not recording
")).css({position:"fixed",top:0,left:"50%",transform:"translateX(-50%)",padding:"2px","background-color":"lightgray"}),$("#bod").append(r)}).catch(function(e){s.element.append($("

The following error occurred: "+e+"

"))})})),l};let a=window.modifyRunningOrder;window.modifyRunningOrder=function(t){if(a instanceof Function&&(t=a.apply(this,[t])),!o)return t;let n=!1,r=[-1,-1];for(let e=0;e=0&&alert("WARNING: upload of voice archive set AFTER sending of results; check the 'items' and 'shuffleSequence' variables.")):"__SendResults__"==t[e][i].controller&&r[0]<0&&!n&&(r=[e,i]);if(!n){let n=e.controllers.new();n.id="UploadRecordings",n.runHeader=!1,n.runFooter=!1,n.sequence=(()=>new Promise(t=>{let n=e.controllers.running;n.element.append($("

Please wait while the archive is being uploaded to the server...

"));let r=new e.utils.JSZip;for(let e in i)r.file(i[e].name,i[e].data);r.generateAsync({compression:"DEFLATE",type:"blob"}).then(function(e){window.PennController.downloadVoiceRecordingsArchive=(()=>saveAs(e,"VoiceRecordingsArchive.zip"));let r="msr-"+(new Date).toISOString().replace(/:|\./g,"-")+".zip";var i=new File([e],r),o=new FormData;o.append("fileName",r),o.append("file",i),o.append("mimeType","application/zip");var a=new XMLHttpRequest;a.open("POST",s,!0),a.onreadystatechange=(()=>{4==a.readyState&&(n.save("PennController","UploadRecordings","Filename",r,Date.now(),"NULL"),200!=a.status||a.responseText.match(/problem|error/i)?(alert("There was an error uploading the recordings ("+a.responseText+")."),console.warn("Ajax post failed. ("+a.status+")",a.responseText),n.save("PennController","UploadRecordings","Status","Failed",Date.now(),"Error Text: "+a.responseText+"; Status: "+a.status)):n.save("PennController","UploadRecordings","Status","Success",Date.now(),"NULL"),t())}),a.send(o)})}));let o=new DynamicElement("PennController",n);r[0]>=0?t[r[0]].splice(r[1],0,o):t.push([o])}return t},this.immediate=function(e){},this.uponCreation=function(e){void 0===t&&console.error("recorder not initiated. Make sure the sequence of items contains an InitiateRecorder PennController."),this.log=!1,this.recordings=[],this.recording=!1,this.audioPlayer=document.createElement("audio"),this.jQueryElement=$("").addClass("PennController-"+this.type+"-ui");let r=$(""}},function(e,t){window.PennController._AddElementType("Video",function(e){this.immediate=function(t,n){let r=!n.match(/^http/i);this.resource=e.resources.fetch(n,function(e){this.object=document.createElement("video"),this.object.src=this.value,this.object.addEventListener("canplay",e)},r)},this.uponCreation=function(e){this.resource.object.controls=!0,this.video=this.resource.object,this.hasPlayed=!1,this.disabled=!1,this.resource.object.style=null,this.resource.object.currentTime=0,this.jQueryElement=$(this.video),this.jQueryDisable=null,this.playEvents=[],this.endEvents=[],this.pauseEvents=[],this.seekEvents=[],this.bufferEvents=[],this.whatToSave=[],this.resource.object.onplay=(()=>{this.playEvents.push(["play",this.video.currentTime,Date.now()])}),this.resource.object.onended=(()=>{this.hasPlayed=!0,this.endEvents.push(["end",this.video.currentTime,Date.now()])}),this.resource.object.onpause=(()=>{this.pauseEvents.push(["pause",this.video.currentTime,Date.now()])}),this.resource.object.onseeked=(()=>{this.seekEvents.push(["seek",this.video.currentTime,Date.now()])}),this.resource.object.waiting=(()=>{this.bufferEvents.push(["buffer",this.video.currentTime,Date.now()])}),this.printDisable=(()=>{this.jQueryDisable instanceof jQuery&&this.jQueryDisable.remove(),this.jQueryDisable=$("
").css({position:"absolute",display:"inline-block","background-color":"gray",opacity:.5,width:this.jQueryElement.width(),height:this.jQueryElement.height()}),this.jQueryElement.before(this.jQueryDisable),this.jQueryElement.addClass("PennController-"+this.type+"-disabled")}),e()},this.end=function(){if(this.whatToSave&&this.whatToSave.indexOf("play")>-1){this.playEvents.length||e.controllers.running.save(this.type,this.id,"play","NA","Never");for(let t in this.playEvents)e.controllers.running.save(this.type,this.id,...this.playEvents[t])}if(this.whatToSave&&this.whatToSave.indexOf("end")>-1){this.endEvents.length||e.controllers.running.save(this.type,this.id,"end","NA","Never");for(let t in this.endEvents)e.controllers.running.save(this.type,this.id,...this.endEvents[t])}if(this.whatToSave&&this.whatToSave.indexOf("pause")>-1){this.pauseEvents.length||e.controllers.running.save(this.type,this.id,"pause","NA","Never");for(let t in this.pauseEvents)e.controllers.running.save(this.type,this.id,...this.pauseEvents[t])}if(this.whatToSave&&this.whatToSave.indexOf("seek")>-1){this.seekEvents.length||e.controllers.running.save(this.type,this.id,"seek","NA","Never");for(let t in this.seekEvents)e.controllers.running.save(this.type,this.id,...this.seekEvents[t])}if(this.bufferEvents)for(let t in this.bufferEvents)e.controllers.running.save(this.type,this.id,...this.bufferEvents[t]);this.jQueryDisable&&this.jQueryDisable.remove()},this.value=function(){return this.endEvents.length?this.endEvents[this.endEvents.length-1][2]:0},this.actions={play:function(e){this.hasOwnProperty("video")&&this.video.nodeName&&"VIDEO"==this.video.nodeName?this.video.play():console.warn("No video to play for element ",this.id),e()},pause:function(e){this.video.pause(),e()},print:function(t,n){e.elements.standardCommands.actions.print.apply(this,[()=>{this.disabled&&this.printDisable(),t()},n])},stop:function(e){this.video.pause(),this.currentTime=0,e()},wait:function(e,t){if("first"==t&&this.hasPlayed)e();else{let n=!1,r=this.video.onended;this.video.onended=function(...i){r.apply(this,i),n||(t instanceof Object&&t._runPromises&&t.success?t._runPromises().then(t=>{"success"==t&&(n=!0,e())}):(n=!0,e()))}}}},this.settings={disable:function(e){this.printDisable(),this.disabled=!0,e()},enable:function(e){this.jQueryDisable instanceof jQuery&&(this.disabled=!1,this.jQueryDisable.remove(),this.jQueryDisable=null,this.jQueryElement.removeClass("PennController-"+this.type+"-disabled")),e()},once:function(e){if(this.hasPlayed)this.disabled=!0,e();else{let t=this.video.onended,n=this;this.video.onended=function(...r){t.apply(this,r),n.disabled=!0,e()}}},log:function(e,...t){1==t.length&&"string"==typeof t[0]?this.whatToSave.push(t):t.length>1?this.whatToSave=this.whatToSave.concat(t):this.whatToSave=["play","end","pause","seek"],e()}},this.test={hasPlayed:function(){return this.hasPlayed},playing:function(){return this.video.currentTime&&!this.video.paused}}})},function(e,t){!function(){var e=null;let t=window.PennController.ResetPrefix;window.PennController.ResetPrefix=function(n){t(n),e="string"==typeof e?window[n]:window},window.PennController._AddElementType("Var",function(t){this.immediate=function(n,r){let i=window.PennController.Elements.getVar,s=t.controllers.underConstruction;window.PennController.Elements.getVar=function(e){let r=t.controllers.underConstruction.elements[n];if(e!=n||r&&"Var"==r.type)return i(e);{let n=t.controllers.running,r=t.controllers.underConstruction;t.controllers.running=null,t.controllers.underConstruction=s;let o=i(e);return t.controllers.running=n,t.controllers.underConstruction=r,o}},e&&(e.getVar=window.PennController.Elements.getVar),this.initialValue=r,this.value=r,this.scope="local",this.evaluate=(()=>this.value&&"Var"===this.value.type?this.value.evaluate():this.value)},this.uponCreation=function(e){let n=t.controllers.running.options.elements[this.id];n&&"global"==n.scope&&n!=this?this.value=n.value:"local"==this.scope&&(this.value=this.initialValue),this.values=[],e()},this.end=function(){if(this.log&&this.log instanceof Array&&(this.log.indexOf("final")>-1&&t.controllers.running.save(this.type,this.id,"Final",this.value,Date.now(),"Value at the end of the trial"),this.log.indexOf("set")>-1)){for(let e in this.values)t.controllers.running.save(this.type,this.id,...this.values[e]);this.values.length||t.controllers.running.save(this.type,this.id,"Set","NA","Never","The Var element was never set during the trial")}},this.value=function(){return this.evaluate()},this.actions={set:function(e,t){"object"==typeof t&&t.hasOwnProperty("value")?this.value=t.value:t instanceof Function?this.value=t.apply(this,[this.value]):this.value=t,this.values.push(["Set",this.value,Date.now(),"NULL"]),e()}},this.settings={local:function(e){for(c in this.scope="local",t.controllers.list)t.controllers.list[c][this.id]==this&&(t.controllers.list[c][this.id]=null);e()},log:function(e,...t){t.length?this.log=t:this.log=["final"],e()},global:function(e){for(c in this.scope="global",t.controllers.list)t.controllers.list[c].elements[this.id]=this;e()}},this.test={is:function(e){return e instanceof RegExp?this.evaluate().match(e):e instanceof Function?e(this.evaluate()):this.evaluate()==e}}}),window.PennController._AddStandardCommands(function(e){this.actions={setVar:function(t,n){if("string"==typeof n){let t=e.controllers.running.options.elements[n];t.type&&"Var"==t.type?t.value=window.PennController.Elements["get"+this.type](this.id).value:console.warn("Invalid variable reference when trying to store "+this.id+"'s value in PennController #"+e.controllers.running.id,n)}else console.warn("Invalid variable reference when trying to store "+this.id+"'s value in PennController #"+e.controllers.running.id,n);t()}}})}()},function(e,t){window.PennController._AddElementType("Tooltip",function(e){function t(){this.jQueryElement.remove(),this.frame&&this.frame instanceof jQuery&&this.frame.remove()}this.immediate=function(e,t,n){this.initialText=t,this.initialLabel=n},this.uponCreation=function(e){this.text=this.initialText,"string"==typeof this.initialLabel&&this.initialLabel.length?this.label=this.initialLabel:this.label="OK",this.jQueryElement=$("
").html(this.text),this.jQueryLabel=$("").html(this.label),this.validations=[],this.frame=$("
").addClass("PennController-"+this.type+"-tooltip-frame"),this.jQueryElement.addClass("PennController-"+this.type+"-tooltip"),this.jQueryElement.css({background:"floralwhite",position:"relative"}),this.jQueryLabel.css({border:"dotted 1px gray",cursor:"pointer",position:"absolute",bottom:"2px",right:"2px"}),this.wasValidated=!1,this.disabled=!1,this.log=!1,this.validate=(()=>{this.disabled||(this.wasValidated=!0,this.validations.push(["Validate","Validate",Date.now(),"NULL"]),t.apply(this))}),e()},this.end=function(){if(this.jQueryElement&&this.jQueryElement instanceof jQuery&&t.apply(this),this.log)for(let t in this.validations)e.controllers.running.save(this.type,this.id,...this.validations[t])},this.value=function(){return this.wasValidated},this.actions={print:function(t,n){if(n&&n.hasOwnProperty("_element")&&n._element.jQueryElement instanceof jQuery&&(n=n._element.jQueryElement),this.jQueryElement.append(this.jQueryLabel),this.jQueryLabel.click(()=>{this.noClicks||this.validate()}),this.jQueryElement.css("text-align","left"),n instanceof jQuery){n.before(this.jQueryElement);let e=n.width(),r=n.height();this.jQueryElement.css({position:"absolute",display:"inline-block",overflow:"scroll","margin-top":r,"margin-left":e,"z-index":9999,padding:"1px"});let i=this.jQueryElement.width(),s=this.jQueryElement.height();"string"==typeof this.relativePosition&&(this.relativePosition.match(/top/i)?this.jQueryElement.css("margin-top",-1*s):this.relativePosition.match(/middle/i)&&this.jQueryElement.css("margin-top",.5*(r-s)),this.relativePosition.match(/left/i)?this.jQueryElement.css("margin-left",-1*i):this.relativePosition.match(/center/i)&&this.jQueryElement.css("margin-left",.5*(e-i))),this.frameParent&&n.before(this.frame.css({position:"absolute",display:"inline-block",width:e,height:r,border:this.frameParent,"z-index":100,"pointer-events":"none"}));let o=n.css("top"),a=n.css("left");"0px"==o&&(o="auto"),"0px"==a&&(a="auto"),this.jQueryElement.css({left:a,top:o}),this.frame.css({left:a,top:o}),this.jQueryElement.addClass("PennController-"+this.type),"none"!=this.jQueryLabel.css("display")&&this.jQueryElement.css("padding-bottom","20px"),t()}else this.jQueryElement.css({position:"relative",left:"",top:"",margin:0,display:"inline-block"}),"none"!=this.jQueryLabel.css("display")&&this.jQueryElement.css("padding-bottom","20px"),e.elements.standardCommands.actions.print.apply(this,[t,n])},remove:function(e){t.apply(this),e()},wait:function(e,t){if("first"==t&&this.wasValidated)e();else{let n=!1,r=this.validate;this.validate=(()=>{r.apply(this),n||(t instanceof Object&&t._runPromises&&t.success?t._runPromises().then(t=>{"success"==t&&(n=!0,e())}):(n=!0,e()))})}}},this.settings={disable:function(e){this.disabled=!0,this.jQueryElement.addClass("PennController-"+this.type+"-disabled"),e()},enable:function(e){this.disabled=!1,this.jQueryElement.removeClass("PennController-"+this.type+"-disabled"),e()},frame:function(e,t){"string"==typeof t&&t.length?this.frameParent=t:this.frameParent="dotted 1px gray",e()},key:function(t,n,r){Number(n)>0?e.controllers.running.safeBind($(document),"keydown",e=>{this.jQueryElement.parent().length&&e.which==n&&this.validate()}):"string"==typeof n&&e.controllers.running.safeBind($(document),"keydown",e=>{if(!this.jQueryElement.parent().length)return;let t={188:"44",109:"45",190:"46",191:"47",192:"96",220:"92",222:"39",221:"93",219:"91",173:"45",187:"61",186:"59",189:"45"},r={96:"~",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",48:")",45:"_",61:"+",91:"{",93:"}",92:"|",59:":",39:'"',44:"<",46:">",47:"?"},i=e.which;t.hasOwnProperty(i)&&(i=t[i]),!e.shiftKey&&i>=65&&i<=90?i=String.fromCharCode(i+32):e.shiftKey&&r.hasOwnProperty(i)&&(i=r[i]),n.toUpperCase().includes(String.fromCharCode(i).toUpperCase())&&this.validate()}),r&&(this.noClicks=!0,this.jQueryLabel.css("cursor",""),this.initialLabel||this.jQueryLabel.css("display","none")),t()},label:function(e,t){this.label=t,this.jQueryLabel.html(t),e()},log:function(e,...t){this.log=!0,e()},position:function(e,t){this.relativePosition=t,e()},text:function(e,t){this.text=t,this.jQueryElement.html(t),e()}}})},function(e,t){window.PennController._AddElementType("Timer",function(e){this.immediate=function(t,n){this.duration=0,Number(n)>0?this.duration=Number(n):console.warn("Invalid duration for timer "+t+" in PennController #"+e.controllers.underConstruction.id)},this.uponCreation=function(e){this.elapsed=!1,this.instance=void 0,this.events=[],this.log=!1,this.running=!1,this.start=(()=>{this.instance&&clearTimeout(this.instance),this.events.push(["Start","Start",Date.now(),"NULL"]),this.instance=setTimeout(()=>this.done(),this.duration),this.running=!0}),this.done=(()=>{this.events.push(["End","End",Date.now(),"NULL"]),this.elapsed=!0,this.running=!1}),e()},this.end=function(){if(this.instance&&(clearTimeout(this.instance),this.events.push(["End","NA","Never","Had to halt the timer at the end of the trial"])),this.log)for(let t in this.events)e.controllers.running.save(this.type,this.id,...this.events[t])},this.value=function(){return this.elapsed},this.actions={start:function(e){this.start(),e()},wait:function(e,t){if("first"==t&&this.elapsed)e();else{let n=!1,r=this.done;this.done=(()=>{r.apply(this),n||(t instanceof Object&&t._runPromises&&t.success?t._runPromises().then(t=>{"success"==t&&(n=!0,e())}):(n=!0,e()))})}}},this.settings={callback:function(e,...t){let n=this.done;this.done=async function(){n.apply(this);for(let e in t)await t[e]._runPromises()},e()},log:function(e){this.log=!0,e()}},this.test={ended:function(){return this.elapsed},running:function(){return this.running}}})},function(e,t){window.PennController._AddElementType("TextInput",function(e){this.immediate=function(e,t){this.initialText=t},this.uponCreation=function(e){this.text=this.initialText,this.jQueryElement=$("