!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Uppy=e()}}(function(){var define,module,exports,createModuleFactory=function(e){var t;return function(r){return t||e(t={exports:{},parent:r},t.exports),t.exports}},_$lib_59=createModuleFactory(function(e,t){var r=_$browser_65("socket.io-client");e.exports=t=i;var n=t.managers={};function i(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var i,o=_$url_63(e),s=o.source,a=o.id,u=o.path,l=n[a]&&u in n[a].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||l?(r("ignoring socket cache for %s",s),i=_$manager_60(s,t)):(n[a]||(r("new io instance for %s",s),n[a]=_$manager_60(s,t)),i=n[a]),o.query&&!t.query&&(t.query=o.query),i.socket(o.path,t)}t.protocol=_$socketIoParser_69.protocol,t.connect=i,t.Manager=_$manager_60,t.Socket=_$socket_62}),_$empty_7=createModuleFactory(function(e,t){}),_$buffer_8=createModuleFactory(function(e,t){(function(e){"use strict";t.Buffer=e,t.INSPECT_MAX_BYTES=50;var r=2147483647;function n(t){if(t>r)throw new RangeError('The value "'+t+'" is invalid for option "size"');var n=new Uint8Array(t);return n.__proto__=e.prototype,n}function e(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return s(e)}return i(e,t,r)}function i(t,r,i){if("string"==typeof t)return function(t,r){if("string"==typeof r&&""!==r||(r="utf8"),!e.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var i=0|l(t,r),o=n(i),s=o.write(t,r);return s!==i&&(o=o.slice(0,s)),o}(t,r);if(ArrayBuffer.isView(t))return a(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(I(t,ArrayBuffer)||t&&I(t.buffer,ArrayBuffer))return function(t,r,n){if(r<0||t.byteLength=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function l(t,r){if(e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||I(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var o=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return x(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return R(t).length;default:if(o)return i?-1:x(t).length;r=(""+r).toLowerCase(),o=!0}}function c(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function p(t,r,n,i,o){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),B(n=+n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=e.from(r,i)),e.isBuffer(r))return 0===r.length?-1:d(t,r,n,i,o);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):d(t,[r],n,i,o);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){var o,s=1,a=e.length,u=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,u/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var p=!0,d=0;di&&(n=i):n=i;var o=t.length;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 v(e,t,r){return 0===t&&r===e.length?_$base64Js_5.fromByteArray(e):_$base64Js_5.fromByteArray(e.slice(t,r))}function b(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+p<=r)switch(p){case 1:l<128&&(c=l);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&l)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,p=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=p}return function(e){var t=e.length;if(t<=w)return String.fromCharCode.apply(String,e);for(var r="",n=0;nthis.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 E(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return S(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return v(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},e.prototype.toLocaleString=e.prototype.toString,e.prototype.equals=function(t){if(!e.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===e.compare(this,t)},e.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),""},e.prototype.compare=function(t,r,n,i,o){if(I(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),!e.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(this===t)return 0;for(var s=(o>>>=0)-(i>>>=0),a=(n>>>=0)-(r>>>=0),u=Math.min(s,a),l=this.slice(i,o),c=t.slice(r,n),p=0;p>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(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 h(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":return f(this,e,t,r);case"latin1":case"binary":return g(this,e,t,r);case"base64":return y(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var w=4096;function S(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;ii)&&(r=i);for(var o="",s=t;sr)throw new RangeError("Trying to access beyond buffer length")}function A(t,r,n,i,o,s){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||rt.length)throw new RangeError("Index out of range")}function T(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 F(e,t,r,n,i){return t=+t,r>>>=0,i||T(e,0,r,4),_$ieee754_40.write(e,t,r,n,23,4),r+4}function $(e,t,r,n,i){return t=+t,r>>>=0,i||T(e,0,r,8),_$ieee754_40.write(e,t,r,n,52,8),r+8}e.prototype.slice=function(t,r){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r>>=0,t>>>=0,r||C(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||C(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},e.prototype.readUInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),this[e]},e.prototype.readUInt16LE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]|this[e+1]<<8},e.prototype.readUInt16BE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]<<8|this[e+1]},e.prototype.readUInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},e.prototype.readUInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},e.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},e.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(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},e.prototype.readInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},e.prototype.readInt16LE=function(e,t){e>>>=0,t||C(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(e,t){e>>>=0,t||C(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},e.prototype.readInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},e.prototype.readFloatLE=function(e,t){return e>>>=0,t||C(e,4,this.length),_$ieee754_40.read(this,e,!0,23,4)},e.prototype.readFloatBE=function(e,t){return e>>>=0,t||C(e,4,this.length),_$ieee754_40.read(this,e,!1,23,4)},e.prototype.readDoubleLE=function(e,t){return e>>>=0,t||C(e,8,this.length),_$ieee754_40.read(this,e,!0,52,8)},e.prototype.readDoubleBE=function(e,t){return e>>>=0,t||C(e,8,this.length),_$ieee754_40.read(this,e,!1,52,8)},e.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||A(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||A(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},e.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,1,255,0),this[t]=255&e,t+1},e.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},e.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},e.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},e.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},e.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);A(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},e.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);A(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},e.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},e.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},e.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},e.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},e.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},e.prototype.writeFloatLE=function(e,t,r){return F(this,e,t,!0,r)},e.prototype.writeFloatBE=function(e,t,r){return F(this,e,t,!1,r)},e.prototype.writeDoubleLE=function(e,t,r){return $(this,e,t,!0,r)},e.prototype.writeDoubleBE=function(e,t,r){return $(this,e,t,!1,r)},e.prototype.copy=function(t,r,n,i){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r=0;--s)t[s+r]=this[s+n];else Uint8Array.prototype.set.call(t,this.subarray(n,i),r);return o},e.prototype.fill=function(t,r,n,i){if("string"==typeof t){if("string"==typeof r?(i=r,r=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!e.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var o=t.charCodeAt(0);("utf8"===i&&o<128||"latin1"===i)&&(t=o)}}else"number"==typeof t&&(t&=255);if(r<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=r;s55295&&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 R(e){return _$base64Js_5.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(O,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function U(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function I(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function B(e){return e!=e}}).call(this,_$buffer_8({}).Buffer)}),_$browser_54={},cachedSetTimeout,cachedClearTimeout,process=_$browser_54={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(t){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex1)for(var r=1;r-1};function i(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function o(e){return"string"!=typeof e&&(e=String(e)),e}function s(e){var r={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t.iterable&&(r[Symbol.iterator]=function(){return r}),r}function a(e){this.map={},e instanceof a?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function u(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function l(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function c(e){var t=new FileReader,r=l(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(e){var r;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:t.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:t.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():t.arrayBuffer&&t.blob&&(r=e)&&DataView.prototype.isPrototypeOf(r)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):t.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||n(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},t.blob&&(this.blob=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(c)}),this.text=function(){var e,t,r,n=u(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,r=l(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function f(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(i))}}),t}function g(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new a(t.headers),this.url=t.url||"",this._initBody(e)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},d.call(_.prototype),d.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new a(this.headers),url:this.url})},g.error=function(){var e=new g(null,{status:0,statusText:""});return e.type="error",e};var y=[301,302,303,307,308];g.redirect=function(e,t){if(-1===y.indexOf(t))throw new RangeError("Invalid status code");return new g(null,{status:t,headers:{location:e}})},e.DOMException=self.DOMException;try{new e.DOMException}catch(err){e.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function m(r,n){return new Promise(function(i,o){var s=new _(r,n);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function l(){u.abort()}u.onload=function(){var e,t,r={status:u.status,statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",t=new a,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var r=e.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();t.append(n,i)}}),t)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var n="response"in u?u.response:u.responseText;i(new g(n,r))},u.onerror=function(){o(new TypeError("Network request failed"))},u.ontimeout=function(){o(new TypeError("Network request failed"))},u.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},u.open(s.method,s.url,!0),"include"===s.credentials?u.withCredentials=!0:"omit"===s.credentials&&(u.withCredentials=!1),"responseType"in u&&t.blob&&(u.responseType="blob"),s.headers.forEach(function(e,t){u.setRequestHeader(t,e)}),s.signal&&(s.signal.addEventListener("abort",l),u.onreadystatechange=function(){4===u.readyState&&s.signal.removeEventListener("abort",l)}),u.send(void 0===s._bodyInit?null:s._bodyInit)})}m.polyfill=!0,self.fetch||(self.fetch=m,self.Headers=a,self.Request=_,self.Response=g),e.Headers=a,e.Request=_,e.Response=g,e.fetch=m,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof _$fetchUmd_89.exports?factory(_$fetchUmd_89.exports):"function"==typeof define&&define.amd?define(["exports"],factory):factory(__global_89.WHATWGFetch={}),_$fetchUmd_89=_$fetchUmd_89.exports;var _$hasProperty_211=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t=7&&t<=10},cuid.fingerprint=_$fingerprintBrowser_14,_$cuid_13=cuid;var _$lodashThrottle_45={};(function(e){var t="Expected a function",r=NaN,n="[object Symbol]",i=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,u=parseInt,l="object"==typeof e&&e&&e.Object===Object&&e,c="object"==typeof self&&self&&self.Object===Object&&self,p=l||c||Function("return this")(),d=Object.prototype.toString,h=Math.max,_=Math.min,f=function(){return p.Date.now()};function g(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function y(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&d.call(e)==n}(e))return r;if(g(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=g(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var l=s.test(e);return l||a.test(e)?u(e.slice(2),l?2:8):o.test(e)?r:+e}_$lodashThrottle_45=function(e,r,n){var i=!0,o=!0;if("function"!=typeof e)throw new TypeError(t);return g(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),function(e,r,n){var i,o,s,a,u,l,c=0,p=!1,d=!1,m=!0;if("function"!=typeof e)throw new TypeError(t);function v(t){var r=i,n=o;return i=o=void 0,c=t,a=e.apply(n,r)}function b(e){var t=e-l;return void 0===l||t>=r||t<0||d&&e-c>=s}function w(){var e=f();if(b(e))return S(e);u=setTimeout(w,function(e){var t=r-(e-l);return d?_(t,s-(e-c)):t}(e))}function S(e){return u=void 0,m&&i?v(e):(i=o=void 0,a)}function k(){var e=f(),t=b(e);if(i=arguments,o=this,l=e,t){if(void 0===u)return function(e){return c=e,u=setTimeout(w,r),p?v(e):a}(l);if(d)return u=setTimeout(w,r),v(l)}return void 0===u&&(u=setTimeout(w,r)),a}return r=y(r)||0,g(n)&&(p=!!n.leading,s=(d="maxWait"in n)?h(y(n.maxWait)||0,r):s,m="trailing"in n?!!n.trailing:m),k.cancel=function(){void 0!==u&&clearTimeout(u),c=0,i=l=o=u=void 0},k.flush=function(){return void 0===u?a:S(f())},k}(e,r,{leading:i,maxWait:r,trailing:o})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$prettierBytes_106=function(e){if("number"!=typeof e||isNaN(e))throw new TypeError("Expected a number, got "+typeof e);var t=e<0,r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return(t?"-":"")+e+" B";var n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),r.length-1);e=Number(e/Math.pow(1024,n));var i=r[n];return e>=10||e%1==0?(t?"-":"")+e.toFixed(0)+" "+i:(t?"-":"")+e.toFixed(1)+" "+i},_$wildcard_90={};function WildcardMatcher(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}WildcardMatcher.prototype.match=function(e){var t,r,n=!0,i=this.parts,o=i.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(r=(e||"").split(this.separator),t=0;n&&t=2}return t?r(t.split(";")[0]):r},_$lib_172={};function ___extends_172(){return(___extends_172=Object.assign||function(e){for(var t=1;t18||18===n&&i>=18218};function __pad_210(e){return 2!==e.length?0+e:e}var _$getTimeStamp_210=function(){var e=new Date;return __pad_210(e.getHours().toString())+":"+__pad_210(e.getMinutes().toString())+":"+__pad_210(e.getSeconds().toString())},justErrorsLogger={debug:function(){},warn:function(){},error:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n2;)w.push(arguments[s]);for(r&&null!=r.children&&(w.length||w.push(r.children),delete r.children);w.length;)if((i=w.pop())&&void 0!==i.pop)for(s=i.length;s--;)w.push(i[s]);else"boolean"==typeof i&&(i=null),(o="function"!=typeof t)&&(null==i?i="":"number"==typeof i?i=String(i):"string"!=typeof i&&(o=!1)),o&&n?a[a.length-1]+=i:a===S?a=[i]:a.push(i),n=o;var u=new e;return u.nodeName=t,u.children=a,u.attributes=null==r?void 0:r,u.key=null==r?void 0:r.key,void 0!==b.vnode&&b.vnode(u),u}function r(e,t){for(var r in t)e[r]=t[r];return e}function n(e){!e.__d&&(e.__d=!0)&&1==P.push(e)&&(b.debounceRendering||k)(i)}function i(){var e,t=P;for(P=[];e=t.pop();)e.__d&&y(e)}function o(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function s(e){var t=r({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var i in n)void 0===t[i]&&(t[i]=n[i]);return t}function a(e){var t=e.parentNode;t&&t.removeChild(e)}function u(e,t,r,n,i){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)r&&r(null),n&&n(e);else if("class"!==t||i)if("style"===t){if(n&&"string"!=typeof n&&"string"!=typeof r||(e.style.cssText=n||""),n&&"object"==typeof n){if("string"!=typeof r)for(var o in r)o in n||(e.style[o]="");for(var o in n)e.style[o]="number"==typeof n[o]&&!1===E.test(o)?n[o]+"px":n[o]}}else if("dangerouslySetInnerHTML"===t)n&&(e.innerHTML=n.__html||"");else if("o"==t[0]&&"n"==t[1]){var s=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),n?r||e.addEventListener(t,l,s):e.removeEventListener(t,l,s),(e.__l||(e.__l={}))[t]=n}else if("list"!==t&&"type"!==t&&!i&&t in e)!function(e,t,r){try{e[t]=r}catch(n){}}(e,t,null==n?"":n),null!=n&&!1!==n||e.removeAttribute(t);else{var a=i&&t!==(t=t.replace(/^xlink:?/,""));null==n||!1===n?a?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof n&&(a?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),n):e.setAttribute(t,n))}else e.className=n||""}function l(e){return this.__l[e.type](b.event&&b.event(e)||e)}function c(){for(var e;e=C.pop();)b.afterMount&&b.afterMount(e),e.componentDidMount&&e.componentDidMount()}function p(e,t,r,n,i,l){A++||(T=null!=i&&void 0!==i.ownerSVGElement,F=null!=e&&!("__preactattr_"in e));var p=function e(t,r,n,i,l){var c=t,p=T;if(null!=r&&"boolean"!=typeof r||(r=""),"string"==typeof r||"number"==typeof r)return t&&void 0!==t.splitText&&t.parentNode&&(!t._component||l)?t.nodeValue!=r&&(t.nodeValue=r):(c=document.createTextNode(r),t&&(t.parentNode&&t.parentNode.replaceChild(c,t),d(t,!0))),c.__preactattr_=!0,c;var h,f,y=r.nodeName;if("function"==typeof y)return function(e,t,r,n){for(var i=e&&e._component,o=i,a=e,u=i&&e._componentConstructor===t.nodeName,l=u,c=s(t);i&&!l&&(i=i.__u);)l=i.constructor===t.nodeName;return i&&l&&(!n||i._component)?(g(i,c,3,r,n),e=i.base):(o&&!u&&(m(o),e=a=null),i=_(t.nodeName,c,r),e&&!i.__b&&(i.__b=e,a=null),g(i,c,1,r,n),e=i.base,a&&e!==a&&(a._component=null,d(a,!1))),e}(t,r,n,i);if(T="svg"===y||"foreignObject"!==y&&T,y=String(y),(!t||!o(t,y))&&(h=y,(f=T?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h)).__n=h,c=f,t)){for(;t.firstChild;)c.appendChild(t.firstChild);t.parentNode&&t.parentNode.replaceChild(c,t),d(t,!0)}var v=c.firstChild,b=c.__preactattr_,w=r.children;if(null==b){b=c.__preactattr_={};for(var S=c.attributes,k=S.length;k--;)b[S[k].name]=S[k].value}return!F&&w&&1===w.length&&"string"==typeof w[0]&&null!=v&&void 0!==v.splitText&&null==v.nextSibling?v.nodeValue!=w[0]&&(v.nodeValue=w[0]):(w&&w.length||null!=v)&&function(t,r,n,i,s){var u,l,c,p,h,_,f,g,y=t.childNodes,m=[],v={},b=0,w=0,S=y.length,k=0,E=r?r.length:0;if(0!==S)for(var P=0;P2?[].slice.call(arguments,2):e.children)},Component:v,render:function(e,t,r){return p(r,e,{},!1,t,!1)},rerender:i,options:b};_$preact_53.exports=O}(),_$preact_53=_$preact_53.exports;var _$isDOMElement_212=function(e){return e&&"object"==typeof e&&e.nodeType===Node.ELEMENT_NODE},_$findDOMElement_197=function(e,t){return void 0===t&&(t=document),"string"==typeof e?t.querySelector(e):_$isDOMElement_212(e)?e:void 0};function ___extends_102(){return(___extends_102=Object.assign||function(e){for(var t=1;t tag initializing Uppy is right before the closing tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.")},t.render=function(e){throw new Error("Extend the render method to add your plugin to a DOM element")},t.addTarget=function(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")},t.unmount=function(){this.isTargetDOMEl&&this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},t.install=function(){},t.uninstall=function(){this.unmount()},e}(),_$lib_103={};function ___extends_103(){return(___extends_103=Object.assign||function(e){for(var t=1;ti)throw new RestrictionError(""+this.i18n("youCanOnlyUploadX",{smart_count:i}));if(o&&!o.some(function(e){return e.indexOf("/")>-1?!!t.type&&_$mimeMatch_48(t.type.replace(/;.*?$/,""),e):"."===e[0]&&t.extension.toLowerCase()===e.substr(1).toLowerCase()})){var s=o.join(", ");throw new RestrictionError(this.i18n("youCanOnlyUploadFileTypes",{types:s}))}if(n&&null!=t.data.size&&t.data.size>n)throw new RestrictionError(this.i18n("exceedsSize2",{backwardsCompat:this.i18n("exceedsSize"),size:_$prettierBytes_106(n)}))},n._showOrLogErrorAndThrow=function(e,t){var r=void 0===t?{}:t,n=r.showInformer,i=void 0===n||n,o=r.file,s=void 0===o?null:o,a=r.throwErr,u=void 0===a||a,l="object"==typeof e?e.message:e,c="object"==typeof e&&e.details?e.details:"",p=l;if(c&&(p+=" "+c),e.isRestriction?(this.log(p),this.emit("restriction-failed",s,e)):this.log(p,"error"),i&&this.info({message:l,details:c},"error",5e3),u)throw"object"==typeof e?e:new Error(e)},n._assertNewUploadAllowed=function(e){!1===this.getState().allowNewUpload&&this._showOrLogErrorAndThrow(new RestrictionError(this.i18n("noNewAlreadyUploading")),{file:e})},n._checkAndCreateFileStateObject=function(e,t){var r=_$getFileType_206(t);t.type=r;var n,i=this.opts.onBeforeFileAdded(t,e);!1===i&&this._showOrLogErrorAndThrow(new RestrictionError("Cannot add the file because onBeforeFileAdded returned false."),{showInformer:!1,file:t}),"object"==typeof i&&i&&(t=i),n=t.name?t.name:"image"===r.split("/")[0]?r.split("/")[0]+"."+r.split("/")[1]:"noname";var o=_$getFileNameAndExtension_205(n).extension,s=t.isRemote||!1,a=_$generateFileID_198(t);e[a]&&this._showOrLogErrorAndThrow(new RestrictionError(this.i18n("noDuplicates",{fileName:n})),{file:t});var u=t.meta||{};u.name=n,u.type=r;var l=isFinite(t.data.size)?t.data.size:null,c={source:t.source||"",id:a,name:n,extension:o||"",meta:___extends_103({},this.getState().meta,{},u),type:r,data:t.data,progress:{percentage:0,bytesUploaded:0,bytesTotal:l,uploadComplete:!1,uploadStarted:null},size:l,isRemote:s,remote:t.remote||"",preview:t.preview};try{this._checkRestrictions(e,c)}catch(err){this._showOrLogErrorAndThrow(err,{file:c})}return c},n._startIfAutoProceed=function(){var e=this;this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(function(){e.scheduledAutoProceed=null,e.upload().catch(function(t){t.isRestriction||e.log(t.stack||t.message||t)})},4))},n.addFile=function(e){var t;this._assertNewUploadAllowed(e);var r=this.getState().files,n=this._checkAndCreateFileStateObject(r,e);return this.setState({files:___extends_103({},r,(t={},t[n.id]=n,t))}),this.emit("file-added",n),this.log("Added file: "+n.name+", "+n.id+", mime type: "+n.type),this._startIfAutoProceed(),n.id},n.addFiles=function(e){var t=this;this._assertNewUploadAllowed();for(var r=___extends_103({},this.getState().files),n=[],i=[],o=0;o5?this.log("Added batch of "+n.length+" files"):Object.keys(n).forEach(function(e){t.log("Added file: "+n[e].name+"\n id: "+n[e].id+"\n type: "+n[e].type)}),n.length>0&&this._startIfAutoProceed(),i.length>0){var a="Multiple errors occurred while adding files:\n";i.forEach(function(e){a+="\n * "+e.message}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:i.length}),details:a},"error",5e3);var u=new Error(a);throw u.errors=i,u}},n.removeFiles=function(e){var t=this,r=this.getState(),n=r.files,i=r.currentUploads,o=___extends_103({},n),s=___extends_103({},i),a=Object.create(null);function u(e){return void 0===a[e]}e.forEach(function(e){n[e]&&(a[e]=n[e],delete o[e])});var l=[];Object.keys(s).forEach(function(e){var t=i[e].fileIDs.filter(u);0!==t.length?s[e]=___extends_103({},i[e],{fileIDs:t}):l.push(e)}),l.forEach(function(e){delete s[e]});var c={currentUploads:s,files:o};0===Object.keys(o).length&&(c.allowNewUpload=!0,c.error=null),this.setState(c),this._calculateTotalProgress();var p=Object.keys(a);p.forEach(function(e){t.emit("file-removed",a[e])}),p.length>5?this.log("Removed "+p.length+" files"):this.log("Removed files: "+p.join(", "))},n.removeFile=function(e){this.removeFiles([e])},n.pauseResume=function(e){if(this.getState().capabilities.resumableUploads&&!this.getFile(e).uploadComplete){var t=!this.getFile(e).isPaused;return this.setFileState(e,{isPaused:t}),this.emit("upload-pause",e,t),t}},n.pauseAll=function(){var e=___extends_103({},this.getState().files);Object.keys(e).filter(function(t){return!e[t].progress.uploadComplete&&e[t].progress.uploadStarted}).forEach(function(t){var r=___extends_103({},e[t],{isPaused:!0});e[t]=r}),this.setState({files:e}),this.emit("pause-all")},n.resumeAll=function(){var e=___extends_103({},this.getState().files);Object.keys(e).filter(function(t){return!e[t].progress.uploadComplete&&e[t].progress.uploadStarted}).forEach(function(t){var r=___extends_103({},e[t],{isPaused:!1,error:null});e[t]=r}),this.setState({files:e}),this.emit("resume-all")},n.retryAll=function(){var e=___extends_103({},this.getState().files),t=Object.keys(e).filter(function(t){return e[t].error});t.forEach(function(t){var r=___extends_103({},e[t],{isPaused:!1,error:null});e[t]=r}),this.setState({files:e,error:null}),this.emit("retry-all",t);var r=this._createUpload(t,{forceAllowNewUpload:!0});return this._runUpload(r)},n.cancelAll=function(){this.emit("cancel-all");var e=this.getState().files,t=Object.keys(e);t.length&&this.removeFiles(t),this.setState({totalProgress:0,error:null})},n.retryUpload=function(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",e);var t=this._createUpload([e],{forceAllowNewUpload:!0});return this._runUpload(t)},n.reset=function(){this.cancelAll()},n._calculateProgress=function(e,t){if(this.getFile(e.id)){var r=isFinite(t.bytesTotal)&&t.bytesTotal>0;this.setFileState(e.id,{progress:___extends_103({},this.getFile(e.id).progress,{bytesUploaded:t.bytesUploaded,bytesTotal:t.bytesTotal,percentage:r?Math.round(t.bytesUploaded/t.bytesTotal*100):0})}),this._calculateTotalProgress()}else this.log("Not setting progress for a file that has been removed: "+e.id)},n._calculateTotalProgress=function(){var e=this.getFiles().filter(function(e){return e.progress.uploadStarted||e.progress.preprocess||e.progress.postprocess});if(0===e.length)return this.emit("progress",0),void this.setState({totalProgress:0});var t=e.filter(function(e){return null!=e.progress.bytesTotal}),r=e.filter(function(e){return null==e.progress.bytesTotal});if(0!==t.length){var n=t.reduce(function(e,t){return e+t.progress.bytesTotal},0),i=n/t.length;n+=i*r.length;var o=0;t.forEach(function(e){o+=e.progress.bytesUploaded}),r.forEach(function(e){o+=i*(e.progress.percentage||0)/100});var s=0===n?0:Math.round(o/n*100);s>100&&(s=100),this.setState({totalProgress:s}),this.emit("progress",s)}else{var a=100*e.length,u=r.reduce(function(e,t){return e+t.progress.percentage},0),l=Math.round(u/a*100);this.setState({totalProgress:l})}},n._addListeners=function(){var e=this;this.on("error",function(t){var r="Unknown error";t.message&&(r=t.message),t.details&&(r+=" "+t.details),e.setState({error:r})}),this.on("upload-error",function(t,r,n){var i="Unknown error";if(r.message&&(i=r.message),r.details&&(i+=" "+r.details),e.setFileState(t.id,{error:i,response:n}),e.setState({error:r.message}),"object"==typeof r&&r.message){var o=new Error(r.message);o.details=r.message,r.details&&(o.details+=" "+r.details),o.message=e.i18n("failedToUpload",{file:t.name}),e._showOrLogErrorAndThrow(o,{throwErr:!1})}else e._showOrLogErrorAndThrow(r,{throwErr:!1})}),this.on("upload",function(){e.setState({error:null})}),this.on("upload-started",function(t,r){e.getFile(t.id)?e.setFileState(t.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:t.size}}):e.log("Not setting progress for a file that has been removed: "+t.id)}),this.on("upload-progress",this._calculateProgress),this.on("upload-success",function(t,r){if(e.getFile(t.id)){var n=e.getFile(t.id).progress;e.setFileState(t.id,{progress:___extends_103({},n,{uploadComplete:!0,percentage:100,bytesUploaded:n.bytesTotal}),response:r,uploadURL:r.uploadURL,isPaused:!1}),e._calculateTotalProgress()}else e.log("Not setting progress for a file that has been removed: "+t.id)}),this.on("preprocess-progress",function(t,r){e.getFile(t.id)?e.setFileState(t.id,{progress:___extends_103({},e.getFile(t.id).progress,{preprocess:r})}):e.log("Not setting progress for a file that has been removed: "+t.id)}),this.on("preprocess-complete",function(t){if(e.getFile(t.id)){var r=___extends_103({},e.getState().files);r[t.id]=___extends_103({},r[t.id],{progress:___extends_103({},r[t.id].progress)}),delete r[t.id].progress.preprocess,e.setState({files:r})}else e.log("Not setting progress for a file that has been removed: "+t.id)}),this.on("postprocess-progress",function(t,r){e.getFile(t.id)?e.setFileState(t.id,{progress:___extends_103({},e.getState().files[t.id].progress,{postprocess:r})}):e.log("Not setting progress for a file that has been removed: "+t.id)}),this.on("postprocess-complete",function(t){if(e.getFile(t.id)){var r=___extends_103({},e.getState().files);r[t.id]=___extends_103({},r[t.id],{progress:___extends_103({},r[t.id].progress)}),delete r[t.id].progress.postprocess,e.setState({files:r})}else e.log("Not setting progress for a file that has been removed: "+t.id)}),this.on("restored",function(){e._calculateTotalProgress()}),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",function(){return e.updateOnlineStatus()}),window.addEventListener("offline",function(){return e.updateOnlineStatus()}),setTimeout(function(){return e.updateOnlineStatus()},3e3))},n.updateOnlineStatus=function(){void 0===window.navigator.onLine||window.navigator.onLine?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)},n.getID=function(){return this.opts.id},n.use=function(e,t){if("function"!=typeof e)throw new TypeError("Expected a plugin class, but got "+(null===e?"null":typeof e)+". Please verify that the plugin was imported and spelled correctly.");var r=new e(this,t),n=r.id;if(this.plugins[r.type]=this.plugins[r.type]||[],!n)throw new Error("Your plugin must have an id");if(!r.type)throw new Error("Your plugin must have a type");var i=this.getPlugin(n);if(i){var o="Already found a plugin named '"+i.id+"'. Tried to use: '"+n+"'.\nUppy plugins must have unique `id` options. See https://uppy.io/docs/plugins/#id.";throw new Error(o)}return e.VERSION&&this.log("Using "+n+" v"+e.VERSION),this.plugins[r.type].push(r),r.install(),this},n.getPlugin=function(e){var t=null;return this.iteratePlugins(function(r){if(r.id===e)return t=r,!1}),t},n.iteratePlugins=function(e){var t=this;Object.keys(this.plugins).forEach(function(r){t.plugins[r].forEach(e)})},n.removePlugin=function(e){this.log("Removing plugin "+e.id),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();var t=this.plugins[e.type].slice(),r=t.indexOf(e);-1!==r&&(t.splice(r,1),this.plugins[e.type]=t);var n=this.getState();delete n.plugins[e.id],this.setState(n)},n.close=function(){var e=this;this.log("Closing Uppy instance "+this.opts.id+": removing all files and uninstalling plugins"),this.reset(),this._storeUnsubscribe(),this.iteratePlugins(function(t){e.removePlugin(t)})},n.info=function(e,t,r){void 0===t&&(t="info"),void 0===r&&(r=3e3);var n="object"==typeof e;this.setState({info:{isHidden:!1,type:t,message:n?e.message:e,details:n?e.details:null}}),this.emit("info-visible"),clearTimeout(this.infoTimeoutID),this.infoTimeoutID=0!==r?setTimeout(this.hideInfo,r):void 0},n.hideInfo=function(){var e=___extends_103({},this.getState().info,{isHidden:!0});this.setState({info:e}),this.emit("info-hidden")},n.log=function(e,t){var r=this.opts.logger;switch(t){case"error":r.error(e);break;case"warning":r.warn(e);break;default:r.debug(e)}},n.run=function(){return this.log("Calling run() is no longer necessary.","warning"),this},n.restore=function(e){return this.log('Core: attempting to restore upload "'+e+'"'),this.getState().currentUploads[e]?this._runUpload(e):(this._removeUpload(e),Promise.reject(new Error("Nonexistent upload")))},n._createUpload=function(e,t){var r;void 0===t&&(t={});var n=t.forceAllowNewUpload,i=void 0!==n&&n,o=this.getState(),s=o.allowNewUpload,a=o.currentUploads;if(!s&&!i)throw new Error("Cannot create a new upload: already uploading.");var u=_$cuid_13();return this.emit("upload",{id:u,fileIDs:e}),this.setState({allowNewUpload:!1!==this.opts.allowMultipleUploads,currentUploads:___extends_103({},a,(r={},r[u]={fileIDs:e,step:0,result:{}},r))}),u},n._getUpload=function(e){return this.getState().currentUploads[e]},n.addResultData=function(e,t){var r;if(this._getUpload(e)){var n=this.getState().currentUploads,i=___extends_103({},n[e],{result:___extends_103({},n[e].result,t)});this.setState({currentUploads:___extends_103({},n,(r={},r[e]=i,r))})}else this.log("Not setting result for an upload that has been removed: "+e)},n._removeUpload=function(e){var t=___extends_103({},this.getState().currentUploads);delete t[e],this.setState({currentUploads:t})},n._runUpload=function(e){var t=this,r=this.getState().currentUploads[e].step,n=[].concat(this.preProcessors,this.uploaders,this.postProcessors),i=Promise.resolve();return n.forEach(function(n,o){o300){var t="Failed request with status: "+e.status+". "+e.statusText;return e.json().then(function(e){throw t=e.message?t+" message: "+e.message:t,t=e.requestId?t+" request-Id: "+e.requestId:t,new Error(t)}).catch(function(){throw new Error(t)})}return e.json()},n.preflight=function(e){var t=this;return new Promise(function(r,n){if(t.preflightDone)return r(t.allowedHeaders.slice());fetch(t._getUrl(e),{method:"OPTIONS"}).then(function(e){e.headers.has("access-control-allow-headers")&&(t.allowedHeaders=e.headers.get("access-control-allow-headers").split(",").map(function(e){return e.trim().toLowerCase()})),t.preflightDone=!0,r(t.allowedHeaders.slice())}).catch(function(e){t.uppy.log("[CompanionClient] unable to make preflight request "+e,"warning"),t.preflightDone=!0,r(t.allowedHeaders.slice())})})},n.preflightAndHeaders=function(e){var t=this;return Promise.all([this.preflight(e),this.headers()]).then(function(e){var r=e[0],n=e[1];return Object.keys(n).forEach(function(e){-1===r.indexOf(e.toLowerCase())&&(t.uppy.log("[CompanionClient] excluding unallowed header "+e),delete n[e])}),n})},n.get=function(e,t){var r=this;return new Promise(function(n,i){r.preflightAndHeaders(e).then(function(o){fetch(r._getUrl(e),{method:"get",headers:o,credentials:"same-origin"}).catch(function(e){throw"AbortError"===e.name?e:new _$NetworkError_189(e)}).then(r._getPostResponseFunc(t)).then(function(e){return r._json(e).then(n)}).catch(function(t){t=t.isAuthError?t:new Error("Could not get "+r._getUrl(e)+". "+t),i(t)})}).catch(i)})},n.post=function(e,t,r){var n=this;return new Promise(function(i,o){n.preflightAndHeaders(e).then(function(s){fetch(n._getUrl(e),{method:"post",headers:s,credentials:"same-origin",body:JSON.stringify(t)}).catch(function(e){throw"AbortError"===e.name?e:new _$NetworkError_189(e)}).then(n._getPostResponseFunc(r)).then(function(e){return n._json(e).then(i)}).catch(function(t){t=t.isAuthError?t:new Error("Could not post "+n._getUrl(e)+". "+t),o(t)})}).catch(o)})},n.delete=function(e,t,r){var n=this;return new Promise(function(i,o){n.preflightAndHeaders(e).then(function(s){fetch(n.hostname+"/"+e,{method:"delete",headers:s,credentials:"same-origin",body:t?JSON.stringify(t):null}).catch(function(e){throw"AbortError"===e.name?e:new _$NetworkError_189(e)}).then(n._getPostResponseFunc(r)).then(function(e){return n._json(e).then(i)}).catch(function(t){t=t.isAuthError?t:new Error("Could not delete "+n._getUrl(e)+". "+t),o(t)})}).catch(o)})},t=e,(r=[{key:"hostname",get:function(){var e=this.uppy.getState().companion,t=this.opts.companionUrl;return(e&&e[t]?e[t]:t).replace(/\/$/,"")}},{key:"defaultHeaders",get:function(){return{Accept:"application/json","Content-Type":"application/json","Uppy-Versions":"@uppy/companion-client="+e.VERSION}}}])&&___defineProperties_98(t.prototype,r),e}(),_class.VERSION="1.4.5",_temp),_$tokenStorage_101={};function ___extends_97(){return(___extends_97=Object.assign||function(e){for(var t=1;t0&&e.isOpen;){var r=e._queued[0];e.send(r.action,r.payload),e._queued=e._queued.slice(1)}},this.socket.onclose=function(t){e.isOpen=!1},this.socket.onmessage=this._handleMessage},t.close=function(){this.socket&&this.socket.close()},t.send=function(e,t){this.isOpen?this.socket.send(JSON.stringify({action:e,payload:t})):this._queued.push({action:e,payload:t})},t.on=function(e,t){this.emitter.on(e,t)},t.emit=function(e,t){this.emitter.emit(e,t)},t.once=function(e,t){this.emitter.once(e,t)},t._handleMessage=function(e){try{var t=JSON.parse(e.data);this.emit(t.action,t.payload)}catch(err){console.log(err)}},e}(),_$lib_100={RequestClient:_$RequestClient_98,Provider:_$Provider_97,Socket:_$Socket_99},h=_$preact_53.h,AuthView=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.prototype.render=function(){var e=h("span",{class:"uppy-Provider-authTitleName"},this.props.pluginName,h("br",null));return h("div",{class:"uppy-Provider-auth"},h("div",{class:"uppy-Provider-authIcon"},this.props.pluginIcon()),h("div",{class:"uppy-Provider-authTitle"},this.props.i18nArray("authenticateWithTitle",{pluginName:e})),h("button",{type:"button",class:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn",onclick:this.props.handleAuth,"data-uppy-super-focusable":!0},this.props.i18nArray("authenticateWith",{pluginName:this.props.pluginName})))},n}(_$preact_53.Component),_$AuthView_148=AuthView,_$classnames_9={exports:{}};!function(){"use strict";var e={}.hasOwnProperty;function t(){for(var r=[],n=0;n0&&__h_150(_$FooterActions_152,___extends_150({selected:n},e)))},__h_158=_$preact_53.h,_$Loader_158=function(e){return __h_158("div",{class:"uppy-Provider-loading"},__h_158("span",null,e.i18n("loading")))},_$isPreviewSupported_216=function(e){if(!e)return!1;var t=e.split("/")[1];return!!/^(jpe?g|gif|png|svg|svg\+xml|bmp|webp)$/.test(t)},___class_159,___temp_159;function ___extends_159(){return(___extends_159=Object.assign||function(e){for(var t=1;ti?-1:ri?1:ri?-1:ri?1:ri?-1:ni?1:n=10||e%1==0?(t?"-":"")+e.toFixed(0)+" "+i:(t?"-":"")+e.toFixed(1)+" "+i},_$truncateString_130=function(e,t){if(e.length<=t)return e;if(t<="...".length)return e.substr(0,t);var r=t-"...".length,n=Math.ceil(r/2),i=Math.floor(r/2);return e.substr(0,n)+"..."+e.substr(e.length-i)},__h_112=_$preact_53.h,renderFileSource=function(e){return e.file.source&&e.file.source!==e.id&&__h_112("div",{class:"uppy-DashboardItem-sourceIcon"},e.acquirers.map(function(t){if(t.id===e.file.source)return function(e,t){return __h_112("span",{title:t.i18n("fileSource",{name:e.name})},e.icon())}(t,e)}))},_$FileInfo_112=function(e){return __h_112("div",{class:"uppy-DashboardItem-fileInfo","data-uppy-file-source":e.file.source},function(e){var t;return t=e.containerWidth<=352?35:e.containerWidth<=576?60:30,__h_112("div",{class:"uppy-DashboardItem-name",title:e.file.meta.name},_$truncateString_130(e.file.meta.name,t))}(e),__h_112("div",{class:"uppy-DashboardItem-status"},function(e){return e.file.data.size&&__h_112("div",{class:"uppy-DashboardItem-statusSize"},_$prettierBytes_131(e.file.data.size))}(e),renderFileSource(e)))},_$copyToClipboard_124=function(e,t){return t=t||"Copy the URL below",new Promise(function(r){var n=document.createElement("textarea");n.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),n.value=e,document.body.appendChild(n),n.select();var i=function(){document.body.removeChild(n),window.prompt(t,e),r()};try{return document.execCommand("copy")?(document.body.removeChild(n),r()):i()}catch(err){return document.body.removeChild(n),i()}})},__h_111=_$preact_53.h,iconPencil=_$icons_122.iconPencil,iconCross=_$icons_122.iconCross,iconCopyLink=_$icons_122.iconCopyLink;function EditButton(e){var t=e.file,r=e.uploadInProgressOrComplete,n=e.metaFields,i=e.i18n,o=e.onClick;return!r&&n&&n.length>0?__h_111("button",{class:"uppy-u-reset uppy-DashboardItem-action uppy-DashboardItem-action--edit",type:"button","aria-label":i("editFile")+" "+t.meta.name,title:i("editFile"),onclick:function(){return o()}},iconPencil()):null}function RemoveButton(e){var t=e.i18n,r=e.onClick;return __h_111("button",{class:"uppy-u-reset uppy-DashboardItem-action uppy-DashboardItem-action--remove",type:"button","aria-label":t("removeFile"),title:t("removeFile"),onclick:function(){return r()}},iconCross())}var copyLinkToClipboard=function(e,t){_$copyToClipboard_124(t.file.uploadURL,t.i18n("copyLinkToClipboardFallback")).then(function(){t.log("Link copied to clipboard."),t.info(t.i18n("copyLinkToClipboardSuccess"),"info",3e3)}).catch(t.log).then(function(){return e.target.focus({preventScroll:!0})})};function CopyLinkButton(e){return __h_111("button",{class:"uppy-u-reset uppy-DashboardItem-action uppy-DashboardItem-action--copyLink",type:"button","aria-label":e.i18n("copyLink"),title:e.i18n("copyLink"),onclick:function(t){return copyLinkToClipboard(t,e)}},iconCopyLink())}function ErrorButton(e){var t=e.file,r=e.onClick;return t.error?__h_111("span",{class:"uppy-DashboardItem-errorDetails","aria-label":t.error,"data-microtip-position":"bottom-left","data-microtip-size":"medium",role:"tooltip",onclick:r},"?"):null}var _$Buttons_111=function(e){var t=e.file,r=e.uploadInProgressOrComplete,n=e.metaFields,i=e.showLinkToFileUploadResult,o=e.showRemoveButton,s=e.i18n,a=e.removeFile,u=e.toggleFileCard,l=e.log,c=e.info;return __h_111("div",{className:"uppy-DashboardItem-actionWrapper"},__h_111(ErrorButton,{file:t,onClick:function(){alert(t.error)}}),__h_111(EditButton,{i18n:s,file:t,uploadInProgressOrComplete:r,metaFields:n,onClick:function(){return u(t.id)}}),i&&t.uploadURL?__h_111(CopyLinkButton,{file:t,i18n:s,info:c,log:l}):null,o?__h_111(RemoveButton,{i18n:s,info:e.info,log:e.log,onClick:function(){return a(t.id)}}):null)},__h_116=_$preact_53.h,__Component_116=_$preact_53.Component,_$FileItem_116=function(e){var t,r;function n(){return e.apply(this,arguments)||this}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.shouldComponentUpdate=function(e){return!_$isShallowEqual_42(this.props,e)},i.componentDidMount=function(){var e=this.props.file;e.preview||this.props.handleRequestThumbnail(e)},i.componentWillUnmount=function(){var e=this.props.file;e.preview||this.props.handleCancelThumbnail(e)},i.render=function(){var e=this.props.file,t=e.progress.preprocess||e.progress.postprocess,r=e.progress.uploadComplete&&!t&&!e.error,n=e.progress.uploadStarted||t,i=e.progress.uploadStarted&&!e.progress.uploadComplete||t,o=e.isPaused||!1,s=e.error||!1,a=this.props.individualCancellation?!r:!i&&!r;r&&this.props.showRemoveButtonAfterComplete&&(a=!0);var u=_$classnames_9({"uppy-u-reset":!0,"uppy-DashboardItem":!0,"is-inprogress":i,"is-processing":t,"is-complete":r,"is-paused":o,"is-error":!!s,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation});return __h_116("div",{class:u,id:"uppy_"+e.id,role:this.props.role},__h_116("div",{class:"uppy-DashboardItem-preview"},__h_116(_$FilePreviewAndLink_113,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult}),__h_116(_$FileProgress_115,{file:e,error:s,isUploaded:r,hideRetryButton:this.props.hideRetryButton,hidePauseResumeCancelButtons:this.props.hidePauseResumeCancelButtons,showRemoveButtonAfterComplete:this.props.showRemoveButtonAfterComplete,resumableUploads:this.props.resumableUploads,individualCancellation:this.props.individualCancellation,pauseUpload:this.props.pauseUpload,cancelUpload:this.props.cancelUpload,retryUpload:this.props.retryUpload,i18n:this.props.i18n})),__h_116("div",{class:"uppy-DashboardItem-fileInfoAndButtons"},__h_116(_$FileInfo_112,{file:e,id:this.props.id,acquirers:this.props.acquirers,containerWidth:this.props.containerWidth,i18n:this.props.i18n}),__h_116(_$Buttons_111,{file:e,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:a,uploadInProgressOrComplete:n,removeFile:this.props.removeFile,toggleFileCard:this.props.toggleFileCard,i18n:this.props.i18n,log:this.props.log,info:this.props.info})))},n}(__Component_116);function ___extends_121(){return(___extends_121=Object.assign||function(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,["data","rowHeight","renderRow","overscanCount","sync"])),a=this.state,u=a.offset,l=a.height,c=Math.floor(u/r),p=Math.floor(l/r);o&&(c=Math.max(0,c-c%o),p+=o);var d=c+p+4,h=t.slice(c,d),_=___extends_121({},STYLE_INNER,{height:t.length*r}),f=___extends_121({},STYLE_CONTENT,{top:c*r});return __h_121("div",___extends_121({onScroll:this.handleScroll},s),__h_121("div",{role:"presentation",style:_},__h_121("div",{role:"presentation",style:f},h.map(n))))},n}(__Component_121),_$VirtualList_121=VirtualList;function ___extends_117(){return(___extends_117=Object.assign||function(e){for(var t=1;t0?t.props.i18nArray("dropPasteImport",{browse:r}):t.props.i18nArray("dropPaste",{browse:r}))},t.renderAcquirer=function(e){return __h_107("div",{class:"uppy-DashboardTab",role:"presentation"},__h_107("button",{type:"button",class:"uppy-DashboardTab-btn",role:"tab",tabindex:0,"aria-controls":"uppy-DashboardContent-panel--"+e.id,"aria-selected":t.props.activePickerPanel.id===e.id,"data-uppy-super-focusable":!0,onclick:function(){return t.props.showPanel(e.id)}},e.icon(),__h_107("div",{class:"uppy-DashboardTab-name"},e.name)))},t.renderAcquirers=function(e){var r=[].concat(e),n=r.splice(e.length-2,e.length);return __h_107("div",{class:"uppy-Dashboard-AddFiles-list",role:"tablist"},t.renderMyDeviceAcquirer(),r.map(function(e){return t.renderAcquirer(e)}),__h_107("span",{role:"presentation",style:"white-space: nowrap;"},n.map(function(e){return t.renderAcquirer(e)})))},t}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.renderPoweredByUppy=function(){var e=__h_107("span",null,__h_107("svg",{"aria-hidden":"true",focusable:"false",class:"UppyIcon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11"},__h_107("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z","fill-rule":"evenodd"})),__h_107("span",{class:"uppy-Dashboard-poweredByUppy"},"Uppy")),t=this.props.i18nArray("poweredBy2",{backwardsCompat:this.props.i18n("poweredBy"),uppy:e});return __h_107("a",{tabindex:"-1",href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",class:"uppy-Dashboard-poweredBy"},t)},i.render=function(){return __h_107("div",{class:"uppy-Dashboard-AddFiles"},this.renderHiddenFileInput(),this.renderDropPasteBrowseTagline(),this.props.acquirers.length>0&&this.renderAcquirers(this.props.acquirers),__h_107("div",{class:"uppy-Dashboard-AddFiles-info"},this.props.note&&__h_107("div",{class:"uppy-Dashboard-note"},this.props.note),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy(this.props)))},n}(_$preact_53.Component),_$AddFiles_107=AddFiles,__h_108=_$preact_53.h,_$AddFilesPanel_108=function(e){return __h_108("div",{class:"uppy-Dashboard-AddFilesPanel","data-uppy-panelType":"AddFiles","aria-hidden":e.showAddFilesPanel},__h_108("div",{class:"uppy-DashboardContent-bar"},__h_108("div",{class:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},e.i18n("addingMoreFiles")),__h_108("button",{class:"uppy-DashboardContent-back",type:"button",onclick:function(t){return e.toggleAddFilesPanel(!1)}},e.i18n("back"))),__h_108(_$AddFiles_107,e))},_$ignoreEvent_128=function(e){var t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t?(e.preventDefault(),e.stopPropagation()):e.stopPropagation()},__h_119=_$preact_53.h,_$PickerPanelContent_119=function(e){return __h_119("div",{class:"uppy-DashboardContent-panel",role:"tabpanel","data-uppy-panelType":"PickerPanel",id:"uppy-DashboardContent-panel--"+e.activePickerPanel.id,onDragOver:_$ignoreEvent_128,onDragLeave:_$ignoreEvent_128,onDrop:_$ignoreEvent_128,onPaste:_$ignoreEvent_128},__h_119("div",{class:"uppy-DashboardContent-bar"},__h_119("div",{class:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},e.i18n("importFrom",{name:e.activePickerPanel.name})),__h_119("button",{class:"uppy-DashboardContent-back",type:"button",onclick:e.hideAllPanels},e.i18n("done"))),__h_119("div",{class:"uppy-DashboardContent-panelBody"},e.getPlugin(e.activePickerPanel.id).render(e.state)))},__h_120=_$preact_53.h,iconPlus=_$icons_122.iconPlus,uploadStates={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function UploadStatus(e){switch(function(e,t,r,n){if(void 0===n&&(n={}),e)return uploadStates.STATE_ERROR;if(t)return uploadStates.STATE_COMPLETE;if(r)return uploadStates.STATE_PAUSED;for(var i=uploadStates.STATE_WAITING,o=Object.keys(n),s=0;s=0;)i=i.replace(t,l);e.className=i.trim()}}var _={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},f=[];"undefined"!=typeof window&&function(){var e=document.createElement("div").style;for(var t in"AnimationEvent"in window||delete _.animationend.animation,"TransitionEvent"in window||delete _.transitionend.transition,_){var r=_[t];for(var n in r)if(n in e){f.push(r[n]);break}}}();var g=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},y=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},m=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},v=function(e){function t(){var n,i;g(this,t);for(var o=arguments.length,s=Array(o),a=0;a=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(t,["component","transitionName","transitionEnter","transitionLeave","transitionEnterTimeout","transitionLeaveTimeout","children"])),s=r.children;return e.h(i,o,n(s).map(this.renderChild))},i}(e.Component);return b.defaultProps={component:"span",transitionEnter:!0,transitionLeave:!0},b},"object"==typeof _$preactCssTransitionGroup_52.exports?_$preactCssTransitionGroup_52.exports=__factory_52(_$preact_53):"function"==typeof define&&define.amd?define(["preact"],__factory_52):__global_52.PreactCSSTransitionGroup=__factory_52(__global_52.preact),_$preactCssTransitionGroup_52=_$preactCssTransitionGroup_52.exports;var __h_109=_$preact_53.h;function TransitionWrapper(e){return __h_109(_$preactCssTransitionGroup_52,{transitionName:"uppy-transition-slideDownUp",transitionEnterTimeout:250,transitionLeaveTimeout:250},e.children)}var _$Dashboard_109=function(e){var t=0===e.totalFileCount,r=e.containerWidth>576,n=_$classnames_9({"uppy-Root":e.isTargetDOMEl,"uppy-Dashboard":!0,"uppy-Dashboard--animateOpenClose":e.animateOpenClose,"uppy-Dashboard--isClosing":e.isClosing,"uppy-Dashboard--isDraggingOver":e.isDraggingOver,"uppy-Dashboard--modal":!e.inline,"uppy-size--md":e.containerWidth>576,"uppy-size--lg":e.containerWidth>700,"uppy-size--xl":e.containerWidth>900,"uppy-size--height-md":e.containerHeight>400,"uppy-Dashboard--isAddFilesPanelVisible":e.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":e.areInsidesReadyToBeVisible}),i=1;e.containerWidth>900?i=5:e.containerWidth>700?i=4:e.containerWidth>576&&(i=3);var o=e.showSelectedFiles&&!t;return __h_109("div",{class:n,"data-uppy-theme":e.theme,"data-uppy-num-acquirers":e.acquirers.length,"data-uppy-drag-drop-supported":_$isDragDropSupported_213(),"aria-hidden":e.inline?"false":e.isHidden,"aria-label":e.inline?e.i18n("dashboardTitle"):e.i18n("dashboardWindowTitle"),onpaste:e.handlePaste,onDragOver:e.handleDragOver,onDragLeave:e.handleDragLeave,onDrop:e.handleDrop},__h_109("div",{class:"uppy-Dashboard-overlay",tabindex:-1,onclick:e.handleClickOutside}),__h_109("div",{class:"uppy-Dashboard-inner","aria-modal":!e.inline&&"true",role:!e.inline&&"dialog",style:{width:e.inline&&e.width?e.width:"",height:e.inline&&e.height?e.height:""}},e.inline?null:__h_109("button",{class:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":e.i18n("closeModal"),title:e.i18n("closeModal"),onclick:e.closeModal},__h_109("span",{"aria-hidden":"true"},"\xd7")),__h_109("div",{class:"uppy-Dashboard-innerWrap"},__h_109("div",{class:"uppy-Dashboard-dropFilesHereHint"},e.i18n("dropHint")),o&&__h_109(_$PickerPanelTopBar_120,e),o?__h_109(_$FileList_117,___extends_109({},e,{itemsPerRow:i})):__h_109(_$AddFiles_107,___extends_109({},e,{isSizeMD:r})),__h_109(TransitionWrapper,null,e.showAddFilesPanel?__h_109(_$AddFilesPanel_108,___extends_109({key:"AddFilesPanel"},e,{isSizeMD:r})):null),__h_109(TransitionWrapper,null,e.fileCardFor?__h_109(_$FileCard_110,___extends_109({key:"FileCard"},e)):null),__h_109(TransitionWrapper,null,e.activePickerPanel?__h_109(_$PickerPanelContent_119,___extends_109({key:"PickerPanelContent"},e)):null),__h_109("div",{class:"uppy-Dashboard-progressindicators"},e.progressindicators.map(function(t){return e.getPlugin(t.id).render(e.state)})))))},_$StatusBarStates_169={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"},_$prettierBytes_171=function(e){if("number"!=typeof e||isNaN(e))throw new TypeError("Expected a number, got "+typeof e);var t=e<0,r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return(t?"-":"")+e+" B";var n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),r.length-1);e=Number(e/Math.pow(1024,n));var i=r[n];return e>=10||e%1==0?(t?"-":"")+e.toFixed(0)+" "+i:(t?"-":"")+e.toFixed(1)+" "+i},_$secondsToTime_219=function(e){return{hours:Math.floor(e/3600)%24,minutes:Math.floor(e/60)%60,seconds:Math.floor(e%60)}},_$prettyETA_218=function(e){var t=_$secondsToTime_219(e),r=t.hours?t.hours+"h ":"",n=t.hours?("0"+t.minutes).substr(-2):t.minutes,i=n?n+"m":"",o=n?("0"+t.seconds).substr(-2):t.seconds;return""+r+i+(t.hours?"":n?" "+o+"s":o+"s")};function ___extends_168(){return(___extends_168=Object.assign||function(e){for(var t=1;t0||_===_$StatusBarStates_169.STATE_COMPLETE&&e.hideAfterFinish,v=!l&&i&&!s&&!a&&o&&!c,b=!d&&_!==_$StatusBarStates_169.STATE_WAITING&&_!==_$StatusBarStates_169.STATE_COMPLETE,w=u&&!p&&_===_$StatusBarStates_169.STATE_UPLOADING,S=l&&!h,k="uppy-StatusBar-progress\n "+(t?"is-"+t:""),E=_$classnames_9({"uppy-Root":e.isTargetDOMEl},"uppy-StatusBar","is-"+_);return __h_168("div",{class:E,"aria-hidden":m},__h_168("div",{class:k,style:{width:y+"%"},role:"progressbar","aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":f}),r,__h_168("div",{class:"uppy-StatusBar-actions"},v?__h_168(UploadBtn,___extends_168({},e,{uploadState:_})):null,S?__h_168(RetryBtn,e):null,w?__h_168(PauseResumeButton,e):null,b?__h_168(CancelBtn,e):null))},UploadBtn=function(e){var t=_$classnames_9("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":e.uploadState===_$StatusBarStates_169.STATE_WAITING});return __h_168("button",{type:"button",class:t,"aria-label":e.i18n("uploadXFiles",{smart_count:e.newFiles}),onclick:e.startUpload,"data-uppy-super-focusable":!0},e.newFiles&&e.isUploadStarted?e.i18n("uploadXNewFiles",{smart_count:e.newFiles}):e.i18n("uploadXFiles",{smart_count:e.newFiles}))},RetryBtn=function(e){return __h_168("button",{type:"button",class:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e.i18n("retryUpload"),onclick:e.retryAll,"data-uppy-super-focusable":!0},__h_168("svg",{"aria-hidden":"true",focusable:"false",class:"UppyIcon",width:"8",height:"10",viewBox:"0 0 8 10"},__h_168("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})),e.i18n("retry"))},CancelBtn=function(e){return __h_168("button",{type:"button",class:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e.i18n("cancel"),"aria-label":e.i18n("cancel"),onclick:e.cancelAll,"data-uppy-super-focusable":!0},__h_168("svg",{"aria-hidden":"true",focusable:"false",class:"UppyIcon",width:"16",height:"16",viewBox:"0 0 16 16"},__h_168("g",{fill:"none","fill-rule":"evenodd"},__h_168("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),__h_168("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"}))))},PauseResumeButton=function(e){var t=e.isAllPaused,r=(0,e.i18n)(t?"resume":"pause");return __h_168("button",{title:r,"aria-label":r,class:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onclick:function(){return function(e){if(!e.isAllComplete)return e.resumableUploads?e.isAllPaused?e.resumeAll():e.pauseAll():e.cancelAll()}(e)},"data-uppy-super-focusable":!0},__h_168("svg",{"aria-hidden":"true",focusable:"false",class:"UppyIcon",width:"16",height:"16",viewBox:"0 0 16 16"},__h_168("g",{fill:"none","fill-rule":"evenodd"},__h_168("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),__h_168("path",t?{fill:"#FFF",d:"M6 4.25L11.5 8 6 11.75z"}:{d:"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z",fill:"#FFF"}))))},LoadingSpinner=function(){return __h_168("svg",{class:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14"},__h_168("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0","fill-rule":"evenodd"}))},ProgressBarProcessing=function(e){var t=Math.round(100*e.value);return __h_168("div",{class:"uppy-StatusBar-content"},__h_168(LoadingSpinner,null),"determinate"===e.mode?t+"% \xb7 ":"",e.message)},UnknownProgressDetails=function(e){return __h_168("div",{class:"uppy-StatusBar-statusSecondary"},e.i18n("filesUploadedOfTotal",{complete:e.complete,smart_count:e.numUploads}))},UploadNewlyAddedFiles=function(e){var t=_$classnames_9("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return __h_168("div",{class:"uppy-StatusBar-statusSecondary"},__h_168("div",{class:"uppy-StatusBar-statusSecondaryHint"},e.i18n("xMoreFilesAdded",{smart_count:e.newFiles})),__h_168("button",{type:"button",class:t,"aria-label":e.i18n("uploadXFiles",{smart_count:e.newFiles}),onclick:e.startUpload},e.i18n("upload")))},ThrottledProgressDetails=_$lodashThrottle_45(function(e){var t=e.numUploads>1;return __h_168("div",{class:"uppy-StatusBar-statusSecondary"},t&&e.i18n("filesUploadedOfTotal",{complete:e.complete,smart_count:e.numUploads}),__h_168("span",{class:"uppy-StatusBar-additionalInfo"},t&&" \xb7 ",e.i18n("dataUploadedOfTotal",{complete:_$prettierBytes_171(e.totalUploadedSize),total:_$prettierBytes_171(e.totalSize)})," \xb7 ",e.i18n("xTimeLeft",{time:_$prettyETA_218(e.totalETA)})))},500,{leading:!0,trailing:!0}),ProgressBarUploading=function(e){if(!e.isUploadStarted||e.isAllComplete)return null;var t=e.isAllPaused?e.i18n("paused"):e.i18n("uploading"),r=e.newFiles&&e.isUploadStarted;return __h_168("div",{class:"uppy-StatusBar-content","aria-label":t,title:t},e.isAllPaused?null:__h_168(LoadingSpinner,null),__h_168("div",{class:"uppy-StatusBar-status"},__h_168("div",{class:"uppy-StatusBar-statusPrimary"},e.supportsUploadProgress?t+": "+e.totalProgress+"%":t),e.isAllPaused||r||!e.showProgressDetails?null:e.supportsUploadProgress?__h_168(ThrottledProgressDetails,e):__h_168(UnknownProgressDetails,e),r?__h_168(UploadNewlyAddedFiles,e):null))},ProgressBarComplete=function(e){e.totalProgress;var t=e.i18n;return __h_168("div",{class:"uppy-StatusBar-content",role:"status",title:t("complete")},__h_168("div",{class:"uppy-StatusBar-status"},__h_168("div",{class:"uppy-StatusBar-statusPrimary"},__h_168("svg",{"aria-hidden":"true",focusable:"false",class:"uppy-StatusBar-statusIndicator UppyIcon",width:"15",height:"11",viewBox:"0 0 15 11"},__h_168("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})),t("complete"))))},ProgressBarError=function(e){var t=e.error,r=(e.retryAll,e.hideRetryButton,e.i18n);return __h_168("div",{class:"uppy-StatusBar-content",role:"alert",title:r("uploadFailed")},__h_168("div",{class:"uppy-StatusBar-status"},__h_168("div",{class:"uppy-StatusBar-statusPrimary"},__h_168("svg",{"aria-hidden":"true",focusable:"false",class:"uppy-StatusBar-statusIndicator UppyIcon",width:"11",height:"11",viewBox:"0 0 11 11"},__h_168("path",{d:"M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z"})),r("uploadFailed"))),__h_168("span",{class:"uppy-StatusBar-details","aria-label":t,"data-microtip-position":"top-right","data-microtip-size":"medium",role:"tooltip",onclick:function(){var e=r("uploadFailed")+" \n\n "+t;alert(e)}},"?"))},_$getSpeed_209=function(e){if(!e.bytesUploaded)return 0;var t=new Date-e.uploadStarted;return e.bytesUploaded/(t/1e3)},_$getBytesRemaining_199=function(e){return e.bytesTotal-e.bytesUploaded},___class_170,___temp_170;function ___extends_170(){return(___extends_170=Object.assign||function(e){for(var t=1;t0,v=100===i&&l.length===Object.keys(r).length&&0===_.length,b=o&&c.length===s.length,w=0!==p.length&&u.length===p.length,S=p.length>0,k=t.resumableUploads||!1,E=!1!==t.uploadProgress;return _$StatusBar_168({error:o,uploadState:this.getUploadingState(b,v,e.files||{}),allowNewUpload:n,totalProgress:i,totalSize:g,totalUploadedSize:y,isAllComplete:v,isAllPaused:w,isAllErrored:b,isUploadStarted:m,isUploadInProgress:S,complete:l.length,newFiles:a.length,numUploads:h.length,totalETA:f,files:r,i18n:this.i18n,pauseAll:this.uppy.pauseAll,resumeAll:this.uppy.resumeAll,retryAll:this.uppy.retryAll,cancelAll:this.uppy.cancelAll,startUpload:this.startUpload,resumableUploads:k,supportsUploadProgress:E,showProgressDetails:this.opts.showProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,hideAfterFinish:this.opts.hideAfterFinish,isTargetDOMEl:this.isTargetDOMEl})},i.install=function(){var e=this.opts.target;e&&this.mount(e,this)},i.uninstall=function(){this.unmount()},n}(__Plugin_170),___class_170.VERSION="1.6.6",___temp_170),___class_144,___temp_144;function ___extends_144(){return(___extends_144=Object.assign||function(e){for(var t=1;t0?i-4:i;for(r=0;r>16&255,s[a++]=t>>8&255,s[a++]=255&t;return 2===o&&(t=revLookup[e.charCodeAt(r)]<<2|revLookup[e.charCodeAt(r+1)]>>4,s[a++]=255&t),1===o&&(t=revLookup[e.charCodeAt(r)]<<10|revLookup[e.charCodeAt(r+1)]<<4|revLookup[e.charCodeAt(r+2)]>>2,s[a++]=t>>8&255,s[a++]=255&t),s},fromByteArray:function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;os?s:o+16383));return 1===n?(t=e[r-1],i.push(lookup[t>>2]+lookup[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],i.push(lookup[t>>10]+lookup[t>>4&63]+lookup[t<<2&63]+"=")),i.join("")}},lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i0)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 encodeChunk(e,t,r){for(var n,i,o=[],s=t;s>18&63]+lookup[i>>12&63]+lookup[i>>6&63]+lookup[63&i]);return o.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;var _$ieee754_40={read:function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,c=-7,p=r?i-1:0,d=r?-1:1,h=e[t+p];for(p+=d,o=h&(1<<-c)-1,h>>=-c,c+=a;c>0;o=256*o+e[t+p],p+=d,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+e[t+p],p+=d,c-=8);if(0===o)o=1-l;else{if(o===u)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),o-=l}return(h?-1:1)*s*Math.pow(2,o-n)},write:function(e,t,r,n,i,o){var s,a,u,l=8*o-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,_=n?1:-1,f=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*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+p>=1?d/u:d*Math.pow(2,1-p))*u>=2&&(s++,u/=2),s+p>=c?(a=0,s=c):s+p>=1?(a=(t*u-1)*Math.pow(2,i),s+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,i),s=0));i>=8;e[r+h]=255&a,h+=_,a/=256,i-=8);for(s=s<0;e[r+h]=255&s,h+=_,s/=256,l-=8);e[r+h-_]|=128*f}},_$miniLegacyUmd_175={exports:{}},___class_174,___temp_174;function ___extends_174(){return(___extends_174=Object.assign||function(e){for(var t=1;t1?t-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:0;return this.substring(t,t+e.length)===e}),String.prototype.endsWith||(String.prototype.endsWith=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return this.substring(t-e.length,t)===e});var S="undefined"!=typeof self?self:t,k=S.fetch||function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(r,n){var i=new XMLHttpRequest;if(i.open("get",e,!0),i.responseType="arraybuffer",i.onerror=n,t.headers)for(var o in t.headers)i.setRequestHeader(o,t.headers[o]);i.onload=function(){r({ok:i.status>=200&&i.status<300,status:i.status,arrayBuffer:function(){return Promise.resolve(i.response)}})},i.send(null)})},E=function(e){var t=[];if(Object.defineProperties(t,{size:{get:function(){return this.length}},has:{value:function(e){return-1!==this.indexOf(e)}},add:{value:function(e){this.has(e)||this.push(e)}},delete:{value:function(e){if(this.has(e)){var t=this.indexOf(e);this.splice(t,1)}}}}),Array.isArray(e))for(var r=0;r=0}},{key:"delete",value:function(e){var t=this._keys.indexOf(e);return!(t<0||(delete this._map["map_"+e],this._keys.splice(t,1),0))}},{key:"keys",value:function(){return this._keys.slice(0)}},{key:"values",value:function(){var e=this;return this._keys.map(function(t){return e.get(t)})}},{key:"entries",value:function(){var e=this;return this._keys.map(function(t){return[t,e.get(t)]})}},{key:"forEach",value:function(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;if(i(this,e),"boolean"==typeof o&&(this.le=o),Array.isArray(t)&&(t=new Uint8Array(t)),0===t)this.byteOffset=0,this.byteLength=0;else if(t instanceof ArrayBuffer){void 0===n&&(n=t.byteLength-r);var s=new DataView(t,r,n);this._swapDataView(s)}else if(t instanceof Uint8Array||t instanceof DataView||t instanceof e){if(void 0===n&&(n=t.byteLength-r),(r+=t.byteOffset)+n>t.byteOffset+t.byteLength)throw B("Creating view outside of available memory in ArrayBuffer");var a=new DataView(t.buffer,r,n);this._swapDataView(a)}else{if("number"!=typeof t)throw B("Invalid input argument for BufferView: "+t);var u=new DataView(new ArrayBuffer(t));this._swapDataView(u)}}return s(e,null,[{key:"from",value:function(t,r){return t instanceof this&&t.le===r?t:new e(t,void 0,void 0,r)}}]),s(e,[{key:"_swapArrayBuffer",value:function(e){this._swapDataView(new DataView(e))}},{key:"_swapBuffer",value:function(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}},{key:"_swapDataView",value:function(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}},{key:"_lengthToEnd",value:function(e){return this.byteLength-e}},{key:"set",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;if(t instanceof DataView||t instanceof e?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer&&(t=new Uint8Array(t)),!(t instanceof Uint8Array))throw B("BufferView.set(): Invalid data argument.");return this.toUint8().set(t,r),new n(this,r,t.byteLength)}},{key:"subarray",value:function(t,r){return new e(this,t,r=r||this._lengthToEnd(t))}},{key:"toUint8",value:function(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}},{key:"getUint8Array",value:function(e,t){return new Uint8Array(this.buffer,this.byteOffset+e,t)}},{key:"getString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.byteLength;return function(e){return M?M.decode(e):R?r.from(e).toString("utf8"):decodeURIComponent(escape(String.fromCharCode.apply(null,e)))}(this.getUint8Array(e,t))}},{key:"getUnicodeString",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.byteLength,r=[],n=0;n1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getInt16(e,t)}},{key:"getInt32",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getInt32(e,t)}},{key:"getUint16",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getUint16(e,t)}},{key:"getUint32",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getUint32(e,t)}},{key:"getFloat32",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getFloat32(e,t)}},{key:"getFloat64",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getFloat64(e,t)}},{key:"getFloat",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getFloat32(e,t)}},{key:"getDouble",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.le;return this.dataView.getFloat64(e,t)}},{key:"getUint64",value:function(e){var t=this.getUint32(e),r=this.getUint32(e+4);if(t<1048575)return t<<32|r;if(void 0!==typeof x)return console.warn("Using BigInt because of type 64uint but JS can only handle 53b numbers."),x(t)<1e4)return K(e,t,"base64");if(T)return J(e,t,"url",G);if($)return K(e,t,"fs");throw B("Invalid input argument");var r}var Z=function(e){function t(){return i(this,t),_(this,l(t).apply(this,arguments))}return u(t,d(C)),s(t,[{key:"tagKeys",get:function(){return this.allKeys||(this.allKeys=b(this.keys())),this.allKeys}},{key:"tagValues",get:function(){return this.allValues||(this.allValues=b(this.values())),this.allValues}}]),t}();function ee(e,t,r){var n=new Z,i=r;Array.isArray(i)||("function"==typeof i.entries&&(i=i.entries()),i=b(i));for(var o=0;o0&&s.translateTagSet(n,s.pick);else if("object"==typeof n){if(s.enabled=!0,s.parse=!1!==n.parse,s.canBeFiltered){var u=n.pick,c=n.skip;u&&u.length>0&&s.translateTagSet(u,s.pick),c&&c.length>0&&s.translateTagSet(c,s.skip)}s.applyInheritables(n)}else{if(!0!==n&&!1!==n)throw B("Invalid options argument: ".concat(n));s.parse=s.enabled=n}return s}return u(t,he),s(t,[{key:"needed",get:function(){return this.enabled||this.deps.size>0}}]),s(t,[{key:"applyInheritables",value:function(e){var t,r,n=pe;Array.isArray(n)||("function"==typeof n.entries&&(n=n.entries()),n=b(n));for(var i=0;i0?(this.enabled=!0,be(this.pick,this.deps)):this.enabled&&this.pick.size>0&&be(this.pick,this.deps)}}]),t}(),fe={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},ge=P(),ye=function(e){function t(e){var r;if(i(this,t),r=_(this,l(t).call(this)),!0===e)r.setupFromTrue();else if(void 0===e)r.setupFromUndefined();else if(Array.isArray(e))r.setupFromArray(e);else{if("object"!=typeof e)throw B("Invalid options argument ".concat(e));r.setupFromObject(e)}return void 0===r.firstChunkSize&&(r.firstChunkSize=T?r.firstChunkSizeBrowser:r.firstChunkSizeNode),r.mergeOutput&&(r.ifd1.enabled=!1),r.filterNestedSegmentTags(),r.traverseTiffDependencyTree(),r.checkLoadedPlugins(),r}return u(t,he),s(t,null,[{key:"useCached",value:function(e){var t=ge.get(e);return void 0!==t?t:(t=new this(e),ge.set(e,t),t)}}]),s(t,[{key:"setupFromUndefined",value:function(){var e,t=oe;Array.isArray(t)||("function"==typeof t.entries&&(t=t.entries()),t=b(t));for(var r=0;r3&&void 0!==arguments[3]?arguments[3]:r;if(e&&e.length){var i=n;Array.isArray(i)||("function"==typeof i.entries&&(i=i.entries()),i=b(i));for(var o=0;o50)return!1;for(var r=16,n=[];r0&&(r.errors=n),r=I(t=r)?void 0:t,e.file.close&&e.file.close(),r})})}catch(e){return Promise.reject(e)}}},{key:"extractThumbnail",value:function(){try{var e=this;e.setup();var t,r=q.get("tiff",e.options);return Ce(function(){if(!e.file.isTiff)return function(e){var t=e();if(t&&t.then)return t.then(Ae)}(function(){if(e.file.isJpeg)return Pe(e.fileParser.getOrFindSegment("tiff"),function(e){t=e})});t={start:0,type:"tiff"}},function(){if(void 0!==t)return Pe(e.fileParser.ensureSegmentChunk(t),function(t){return Pe((e.parsers.tiff=new r(t,e.options,e.file)).extractThumbnail(),function(t){return e.file.close&&e.file.close(),t})})})}catch(e){return Promise.reject(e)}}}]),e}();function Fe(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}function $e(e){return function(){for(var t=[],r=0;rthis.byteLength){var o=this._extend(i).dataView;this._swapDataView(o)}}}},{key:"_extend",value:function(e){var t;t=R?O.allocUnsafe(e):new Uint8Array(e);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:r}}},{key:"subarray",value:function(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return r=r||this._lengthToEnd(e),n&&this._tryExtend(e,r),this.ranges.add(e,r),f(l(t.prototype),"subarray",this).call(this,e,r)}},{key:"set",value:function(e,r){arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&this._tryExtend(r,e.byteLength,e);var n=f(l(t.prototype),"set",this).call(this,e,r);return this.ranges.add(r,n.byteLength),n}},{key:"ensureChunk",value:function(e,t){try{if(!this.chunked)return;if(this.ranges.available(e,t))return;return function(e,t){return e&&e.then?e.then(He):Promise.resolve()}(this.readChunk(e,t))}catch(e){return Promise.reject(e)}}},{key:"available",value:function(e,t){return this.ranges.available(e,t)}}]),t}(),We=function(){function e(){i(this,e),a(this,"list",[])}return s(e,[{key:"add",value:function(e,t){var r=e+t,n=this.list.filter(function(t){return Xe(e,t.offset,r)||Xe(e,t.end,r)});if(n.length>0){e=Math.min.apply(Math,[e].concat(n.map(function(e){return e.offset}))),t=(r=Math.max.apply(Math,[r].concat(n.map(function(e){return e.end}))))-e;var i=n.shift();i.offset=e,i.length=t,i.end=r,this.list=this.list.filter(function(e){return!n.includes(e)})}else this.list.push({offset:e,length:t,end:r})}},{key:"available",value:function(e,t){var r=e+t;return this.list.some(function(t){return t.offset<=e&&r<=t.end})}},{key:"length",get:function(){return this.list.length}}]),e}();function Xe(e,t,r){return e<=t&&t<=r}function Ge(){}function Ye(e,t){if(!t)return e&&e.then?e.then(Ge):Promise.resolve()}function Ke(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var Je=function(e){function t(){return i(this,t),_(this,l(t).apply(this,arguments))}return u(t,e),s(t,[{key:"readWhole",value:function(){try{var e=this;return e.chunked=!1,Ke(X(e.input),function(t){e._swapArrayBuffer(t)})}catch(e){return Promise.reject(e)}}},{key:"readChunked",value:function(){return this.chunked=!0,this.size=this.input.size,f(l(t.prototype),"readChunked",this).call(this)}},{key:"_readChunk",value:function(e,t){try{var r=this,n=t?e+t:void 0,i=r.input.slice(e,n);return Ke(X(i),function(t){return r.set(t,e,!0)})}catch(e){return Promise.reject(e)}}}]),t}(function(e){function t(e,r){var n;return i(this,t),a(h(n=_(this,l(t).call(this,0))),"chunksRead",0),n.input=e,n.options=r,n}return u(t,Ve),s(t,[{key:"readWhole",value:function(){try{return this.chunked=!1,Ye(this.readChunk(this.nextChunkOffset))}catch(e){return Promise.reject(e)}}},{key:"readChunked",value:function(){try{return this.chunked=!0,Ye(this.readChunk(0,this.options.firstChunkSize))}catch(e){return Promise.reject(e)}}},{key:"readNextChunk",value:function(e){try{if(void 0===e&&(e=this.nextChunkOffset),this.fullyRead)return this.chunksRead++,!1;var t=this.options.chunkSize;return r=this.readChunk(e,t),n=function(e){return!!e&&e.byteLength===t},r&&r.then||(r=Promise.resolve(r)),n?r.then(n):r}catch(e){return Promise.reject(e)}var r,n}},{key:"readChunk",value:function(e,t){try{if(this.chunksRead++,0===(t=this.safeWrapAddress(e,t)))return;return this._readChunk(e,t)}catch(e){return Promise.reject(e)}}},{key:"safeWrapAddress",value:function(e,t){return void 0!==this.size&&e+t>this.size?Math.max(0,this.size-e):t}},{key:"read",value:function(){return this.options.chunked?this.readChunked():this.readWhole()}},{key:"close",value:function(){}},{key:"nextChunkOffset",get:function(){if(0!==this.ranges.list.length)return this.ranges.list[0].length}},{key:"canReadNextChunk",get:function(){return this.chunksReadi+o)e.chunk=s.file.subarray(i,o);else{if(void 0!==e.size)throw B("Segment unreachable: "+JSON.stringify(e));e.chunk=s.file.subarray(i)}},r=function(t){return e.chunk},(n=t())&&n.then?n.then(r):r()},function(){for(var e=[],t=0;t1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;i(this,e),a(this,"errors",[]),a(this,"raw",P()),a(this,"handleError",function(e){if(!r.options.silentErrors)throw e;r.errors.push(e.message)}),this.chunk=this.normalizeInput(t),this.file=o,this.type=this.constructor.type,this.globalOptions=this.options=n,this.localOptions=n[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}return s(e,[{key:"normalizeInput",value:function(e){return e instanceof L?e:new L(e)}}],[{key:"findPosition",value:function(e,t){var r=e.getUint16(t+2)+2,n="function"==typeof this.headerLength?this.headerLength(e,t,r):this.headerLength,i=t+n,o=r-n;return{offset:t,length:r,headerLength:n,start:i,size:o,end:i+o}}},{key:"parse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new this(e,new ye(a({},this.type,t))).parse()}}]),s(e,[{key:"translate",value:function(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}},{key:"translateBlock",value:function(e,t){var r=ie.get(t),n=ne.get(t),i=re.get(t),o=this.options[t],s=o.reviveValues&&!!r,a=o.translateValues&&!!n,u=o.translateKeys&&!!i,l={},c=e;Array.isArray(c)||("function"==typeof c.entries&&(c=c.entries()),c=b(c));for(var p=0;p=224&&e<=239}function lt(e,t){var r=q;Array.isArray(r)||("function"==typeof r.entries&&(r=r.entries()),r=b(r));for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;try{var r=this;r.setupSegmentFinderArgs(t);var n=r.file,i=r.findAll,o=r.wanted,s=r.remaining;return nt(function(){if(!i&&r.file.chunked)return i=b(o).some(function(e){var t=q.get(e),n=r.options[e];return t.multiSegment&&n.multiSegment}),function(e){var t=function(){if(i)return rt(r.file.readWhole())}();if(t&&t.then)return t.then(tt)}()},function(){var t=!1;if(e=r._findAppSegments(e,n.byteLength,i,o,s),!r.options.onlyTiff)return function(){if(n.chunked){var i=!1;return function(e,t,r){for(var n;;){var i=e();if(st(i)&&(i=i.v),!i)return o;if(i.then){n=0;break}var o=r();if(o&&o.then){if(!st(o)){n=1;break}o=o.s}if(t){var s=t();if(s&&s.then&&!st(s)){n=2;break}}}var a=new ot,u=it.bind(null,a,2);return(0===n?i.then(c):1===n?o.then(l):s.then(p)).then(void 0,u),a;function l(n){o=n;do{if(t&&(s=t())&&s.then&&!st(s))return void s.then(p).then(void 0,u);if(!(i=e())||st(i)&&!i.v)return void it(a,1,o);if(i.then)return void i.then(c).then(void 0,u);st(o=r())&&(o=o.v)}while(!o||!o.then);o.then(l).then(void 0,u)}function c(e){e?(o=r())&&o.then?o.then(l).then(void 0,u):l(o):it(a,1,o)}function p(){(i=e())?i.then?i.then(c).then(void 0,u):c(i):it(a,1,o)}}(function(){return!t&&s.size>0&&!i&&(!!n.canReadNextChunk||!!r.unfinishedMultiSegment)},void 0,function(){var o=n.nextChunkOffset,s=r.appSegments.some(function(e){return!r.file.available(e.offset||e.start,e.length||e.size)});return nt(function(){return et(e>o&&!s?n.readNextChunk(e):n.readNextChunk(o),function(e){i=!e})},function(){void 0===(e=r._findAppSegments(e,n.byteLength))&&(t=!0)})})}}()})}catch(e){return Promise.reject(e)}}},{key:"_findAppSegments",value:function(e,t){for(var r,n,i,o,s,a,u=this.file,l=this.findAll,c=this.wanted,p=this.remaining,d=this.options;ee.file.byteLength)throw B("IFD0 offset points to outside of file.\nthis.ifd0Offset: ".concat(e.ifd0Offset,", file.byteLength: ").concat(e.file.byteLength));return ht(function(){if(e.file.isTiff)return dt(e.file.ensureChunk(e.ifd0Offset,D(e.options)))},function(){var t=e.parseBlock(e.ifd0Offset,"ifd0");if(0!==t.size)return e.exifOffset=t.get(34665),e.interopOffset=t.get(40965),e.gpsOffset=t.get(34853),e.xmp=t.get(700),e.iptc=t.get(33723),e.icc=t.get(34675),e.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t})}catch(e){return Promise.reject(e)}}},{key:"ensureBlockChunk",value:function(e,t){try{var r=this;return ht(function(){if(r.file.isTiff)return dt(r.file.ensureChunk(e,t))},function(){e>r.chunk.byteLength&&(r.chunk=L.from(r.file,r.le))})}catch(e){return Promise.reject(e)}}},{key:"parseExifBlock",value:function(){try{var e=this;if(e.exif)return;return ht(function(){if(!e.ifd0)return dt(e.parseIfd0Block())},function(){if(void 0!==e.exifOffset)return ht(function(){if(e.file.isTiff)return dt(e.file.ensureChunk(e.exifOffset,D(e.options)))},function(){var t=e.parseBlock(e.exifOffset,"exif");return e.interopOffset||(e.interopOffset=t.get(40965)),e.makerNote=t.get(37500),e.userComment=t.get(37510),e.options.sanitize&&(t.delete(40965),t.delete(37500),t.delete(37510)),e.unpack(t,41728),e.unpack(t,41729),t})})}catch(e){return Promise.reject(e)}}},{key:"unpack",value:function(e,t){var r=e.get(t);r&&1===r.length&&e.set(t,r[0])}},{key:"parseGpsBlock",value:function(){try{var e=this;if(e.gps)return;return ht(function(){if(!e.ifd0)return dt(e.parseIfd0Block())},function(){if(void 0!==e.gpsOffset){var t=e.parseBlock(e.gpsOffset,"gps");return t&&t.has(2)&&t.has(4)&&(t.set("latitude",gt.apply(void 0,t.get(2).concat([t.get(1)]))),t.set("longitude",gt.apply(void 0,t.get(4).concat([t.get(3)])))),t}})}catch(e){return Promise.reject(e)}}},{key:"parseInteropBlock",value:function(){try{var e=this;if(e.interop)return;return ht(function(){if(!e.ifd0)return dt(e.parseIfd0Block())},function(){return ht(function(){if(void 0===e.interopOffset&&!e.exif)return dt(e.parseExifBlock())},function(){if(void 0!==e.interopOffset)return e.parseBlock(e.interopOffset,"interop")})})}catch(e){return Promise.reject(e)}}},{key:"parseThumbnailBlock",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{var t=this;if(t.ifd1||t.ifd1Parsed)return;if(t.options.mergeOutput&&!e)return;return t.findIfd1Offset(),t.ifd1Offset>0&&(t.parseBlock(t.ifd1Offset,"ifd1"),t.ifd1Parsed=!0),t.ifd1}catch(e){return Promise.reject(e)}}},{key:"extractThumbnail",value:function(){try{var e=this;return e.headerParsed||e.parseHeader(),ht(function(){if(!e.ifd1Parsed)return dt(e.parseThumbnailBlock(!0))},function(){if(void 0!==e.ifd1){var t=e.ifd1.get(513),r=e.ifd1.get(514);return e.chunk.getUint8Array(t,r)}})}catch(e){return Promise.reject(e)}}},{key:"createOutput",value:function(){var e,t,r,n={},i=ue;Array.isArray(i)||("function"==typeof i.entries&&(i=i.entries()),i=b(i));for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:P(),n=this.options[t],i=n.pick,o=n.skip,s=(i=E(i)).size>0,a=0===o.size,u=this.chunk.getUint16(e);e+=2;for(var l=0;l13)throw B("Invalid TIFF value type. block: ".concat(r.toUpperCase(),", tag: ").concat(t.toString(16),", type: ").concat(i,", offset ").concat(e));if(e>this.chunk.byteLength)throw B("Invalid TIFF value offset. block: ".concat(r.toUpperCase(),", tag: ").concat(t.toString(16),", type: ").concat(i,", offset ").concat(e," is outside of chunk size ").concat(this.chunk.byteLength));if(1===i)return this.chunk.getUint8Array(e,o);if(2===i)return""===(n=function(e){for(;e.endsWith("\0");)e=e.slice(0,-1);return e}(n=this.chunk.getString(e,o)).trim())?void 0:n;if(7===i)return this.chunk.getUint8Array(e,o);if(1===o)return this.parseTagValue(i,e);for(var a=new(function(e){switch(i){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}}())(o),u=s,l=0;l4096&&(r=4096,n=Math.round(r/t)),n>4096&&(n=4096,r=Math.round(t*n)),e.width>r){var i=document.createElement("canvas");i.width=r,i.height=n,i.getContext("2d").drawImage(e,0,0,r,n),e=i}return e},i.resizeImage=function(e,t,r){e=this.protect(e);var n=Math.ceil(_$mathLog2_46(e.width/t));n<1&&(n=1);for(var i=t*Math.pow(2,n-1),o=r*Math.pow(2,n-1);n--;){var s=document.createElement("canvas");s.width=i,s.height=o,s.getContext("2d").drawImage(e,0,0,i,o),e=s,i=Math.round(i/2),o=Math.round(o/2)}return e},i.rotateImage=function(e,t){var r=e.width,n=e.height;90!==t.deg&&270!==t.deg||(r=e.height,n=e.width);var i=document.createElement("canvas");i.width=r,i.height=n;var o=i.getContext("2d");return o.translate(r/2,n/2),t.canvas&&(o.rotate(t.rad),o.scale(t.scaleX,t.scaleY)),o.drawImage(e,-e.width/2,-e.height/2,e.width,e.height),i},i.canvasToBlob=function(e,t,r){try{e.getContext("2d").getImageData(0,0,1,1)}catch(err){if(18===err.code)return Promise.reject(new Error("cannot read image, probably an svg with external resources"))}return e.toBlob?new Promise(function(n){e.toBlob(n,t,r)}).then(function(e){if(null===e)throw new Error("cannot read image, probably an svg with external resources");return e}):Promise.resolve().then(function(){return _$dataURItoBlob_194(e.toDataURL(t,r),{})}).then(function(e){if(null===e)throw new Error("could not extract blob, probably an old browser");return e})},i.setPreviewURL=function(e,t){this.uppy.setFileState(e,{preview:t})},i.addToQueue=function(e){this.queue.push(e),!1===this.queueProcessing&&this.processQueue()},i.processQueue=function(){var e=this;if(this.queueProcessing=!0,this.queue.length>0){var t=this.uppy.getFile(this.queue.shift());return t?this.requestThumbnail(t).catch(function(e){}).then(function(){return e.processQueue()}):void this.uppy.log("[ThumbnailGenerator] file was removed before a thumbnail could be generated, but not removed from the queue. This is probably a bug","error")}this.queueProcessing=!1,this.uppy.log("[ThumbnailGenerator] Emptied thumbnail queue"),this.uppy.emit("thumbnail:all-generated")},i.requestThumbnail=function(e){var t=this;return _$isPreviewSupported_216(e.type)&&!e.isRemote?this.createThumbnail(e,this.opts.thumbnailWidth,this.opts.thumbnailHeight).then(function(r){t.setPreviewURL(e.id,r),t.uppy.log("[ThumbnailGenerator] Generated thumbnail for "+e.id),t.uppy.emit("thumbnail:generated",t.uppy.getFile(e.id),r)}).catch(function(r){t.uppy.log("[ThumbnailGenerator] Failed thumbnail for "+e.id+":","warning"),t.uppy.log(r,"warning"),t.uppy.emit("thumbnail:error",t.uppy.getFile(e.id),r)}):Promise.resolve()},i.install=function(){this.uppy.on("file-removed",this.onFileRemoved),this.opts.lazy?(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("thumbnail:cancel",this.onCancelRequest)):(this.uppy.on("file-added",this.onFileAdded),this.uppy.on("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.addPreProcessor(this.waitUntilAllProcessed)},i.uninstall=function(){this.uppy.off("file-removed",this.onFileRemoved),this.opts.lazy?(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("thumbnail:cancel",this.onCancelRequest)):(this.uppy.off("file-added",this.onFileAdded),this.uppy.off("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.removePreProcessor(this.waitUntilAllProcessed)},n}(__Plugin_174),___class_174.VERSION="1.6.0",___temp_174),_$findAllDOMElements_196=function(e){if("string"==typeof e){var t=[].slice.call(document.querySelectorAll(e));return t.length>0?t:null}if("object"==typeof e&&_$isDOMElement_212(e))return[e]},_$toArray_221=function(e){return Array.prototype.slice.call(e||[],0)},_$getRelativePath_203=function(e){return e.fullPath&&e.fullPath!=="/"+e.name?e.fullPath:null},_$getFilesAndDirectoriesFromDirectory_202=function e(t,r,n,i){var o=i.onSuccess;t.readEntries(function(i){var s=[].concat(r,i);i.length?setTimeout(function(){e(t,s,n,{onSuccess:o})},0):o(s)},function(e){n(e),o(r)})},_$webkitGetAsEntryApi_204=function(e,t){var r=[],n=[];return _$toArray_221(e.items).forEach(function(e){var i=e.webkitGetAsEntry();i&&n.push(function e(n){return new Promise(function(i){if(n.isFile)n.file(function(e){e.relativePath=_$getRelativePath_203(n),r.push(e),i()},function(e){t(e),i()});else if(n.isDirectory){var o=n.createReader();_$getFilesAndDirectoriesFromDirectory_202(o,[],t,{onSuccess:function(t){var r=t.map(function(t){return e(t)});Promise.all(r).then(function(){return i()})}})}})}(i))}),Promise.all(n).then(function(){return r})},_$fallbackApi_201=function(e){var t=_$toArray_221(e.files);return Promise.resolve(t)},_$getDroppedFiles_200=function(e,t){var r=(void 0===t?{}:t).logDropError,n=void 0===r?function(){}:r;return e.items&&e.items[0]&&"webkitGetAsEntry"in e.items[0]?_$webkitGetAsEntryApi_204(e,n):_$fallbackApi_201(e)},_$getActiveOverlayEl_126=function(e,t){if(t){var r=e.querySelector('[data-uppy-paneltype="'+t+'"]');if(r)return r}return e},_$FOCUSABLE_ELEMENTS_188=['a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])',"input:not([disabled]):not([inert]):not([aria-hidden])","select:not([disabled]):not([inert]):not([aria-hidden])","textarea:not([disabled]):not([inert]):not([aria-hidden])","button:not([disabled]):not([inert]):not([aria-hidden])",'iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])','object:not([tabindex^="-"]):not([inert]):not([aria-hidden])','embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[tabindex]:not([tabindex^="-"]):not([inert]):not([aria-hidden])'];function focusOnFirstNode(e,t){var r=t[0];r&&(r.focus(),e.preventDefault())}function trapFocus(e,t,r){var n=_$getActiveOverlayEl_126(r,t),i=_$toArray_221(n.querySelectorAll(_$FOCUSABLE_ELEMENTS_188)),o=i.indexOf(document.activeElement);!function(e){return e.contains(document.activeElement)}(n)?focusOnFirstNode(e,i):e.shiftKey&&0===o?function(e,t){var r=i[i.length-1];r&&(r.focus(),e.preventDefault())}(e):e.shiftKey||o!==i.length-1||focusOnFirstNode(e,i)}var _$trapFocus_129={forModal:function(e,t,r){trapFocus(e,t,r)},forInline:function(e,t,r){null===t||trapFocus(e,t,r)}},_$ResizeObserver_58={exports:{}};(function(e){!function(e,t){"object"==typeof _$ResizeObserver_58.exports?_$ResizeObserver_58.exports=t():"function"==typeof define&&define.amd?define(t):e.ResizeObserver=t()}(this,function(){"use strict";var t=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var r=-1;return e.some(function(e,n){return e[0]===t&&(r=n,!0)}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var r=e(this.__entries__,t),n=this.__entries__[r];return n&&n[1]},t.prototype.set=function(t,r){var n=e(this.__entries__,t);~n?this.__entries__[n][1]=r:this.__entries__.push([t,r])},t.prototype.delete=function(t){var r=this.__entries__,n=e(r,t);~n&&r.splice(n,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var r=0,n=this.__entries__;r0},e.prototype.connect_=function(){r&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),u?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){r&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,r=void 0===t?"":t;a.some(function(e){return!!~r.indexOf(e)})&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),c=function(e,t){for(var r=0,n=Object.keys(t);r0},e}(),w="undefined"!=typeof WeakMap?new WeakMap:new t,S=function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=l.getInstance(),n=new b(t,r,this);w.set(this,n)};return["observe","unobserve","disconnect"].forEach(function(e){S.prototype[e]=function(){var t;return(t=w.get(this))[e].apply(t,arguments)}}),void 0!==n.ResizeObserver?n.ResizeObserver:S})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),_$ResizeObserver_58=_$ResizeObserver_58.exports;var _$lodashDebounce_44={};(function(e){var t=NaN,r="[object Symbol]",n=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,a=parseInt,u="object"==typeof e&&e&&e.Object===Object&&e,l="object"==typeof self&&self&&self.Object===Object&&self,c=u||l||Function("return this")(),p=Object.prototype.toString,d=Math.max,h=Math.min,_=function(){return c.Date.now()};function f(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&p.call(e)==r}(e))return t;if(f(e)){var u="function"==typeof e.valueOf?e.valueOf():e;e=f(u)?u+"":u}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var l=o.test(e);return l||s.test(e)?a(e.slice(2),l?2:8):i.test(e)?t:+e}_$lodashDebounce_44=function(e,t,r){var n,i,o,s,a,u,l=0,c=!1,p=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var r=n,o=i;return n=i=void 0,l=t,s=e.apply(o,r)}function v(e){var r=e-u;return void 0===u||r>=t||r<0||p&&e-l>=o}function b(){var e=_();if(v(e))return w(e);a=setTimeout(b,function(e){var r=t-(e-u);return p?h(r,o-(e-l)):r}(e))}function w(e){return a=void 0,y&&n?m(e):(n=i=void 0,s)}function S(){var e=_(),r=v(e);if(n=arguments,i=this,u=e,r){if(void 0===a)return function(e){return l=e,a=setTimeout(b,t),c?m(e):s}(u);if(p)return a=setTimeout(b,t),m(u)}return void 0===a&&(a=setTimeout(b,t)),s}return t=g(t)||0,f(r)&&(c=!!r.leading,o=(p="maxWait"in r)?d(g(r.maxWait)||0,t):o,y="trailing"in r?!!r.trailing:y),S.cancel=function(){void 0!==a&&clearTimeout(a),l=0,n=u=i=a=void 0},S.flush=function(){return void 0===a?s:w(_())},S}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$createSuperFocus_125=function(){var e=!1;return _$lodashDebounce_44(function(t,r){var n=_$getActiveOverlayEl_126(t,r),i=n.contains(document.activeElement);if(!i||!e){var o=n.querySelector("[data-uppy-super-focusable]");if(!i||o)if(o)o.focus({preventScroll:!0}),e=!0;else{var s=n.querySelector(_$FOCUSABLE_ELEMENTS_188);s&&s.focus({preventScroll:!0}),e=!1}}},260)};function areInputsEqual(e,t){if(e.length!==t.length)return!1;for(var r=0;r0&&(n.uppy.log("[Dashboard] Files were dropped"),n.addFiles(e))})},n.handleRequestThumbnail=function(e){n.opts.waitForThumbnailsBeforeUpload||n.uppy.emit("thumbnail:request",e)},n.handleCancelThumbnail=function(e){n.opts.waitForThumbnailsBeforeUpload||n.uppy.emit("thumbnail:cancel",e)},n.handleKeyDownInInline=function(e){e.keyCode===TAB_KEY&&_$trapFocus_129.forInline(e,n.getPluginState().activeOverlayType,n.el)},n.handlePasteOnBody=function(e){n.el.contains(document.activeElement)&&n.handlePaste(e)},n.handleComplete=function(e){var t=e.failed;e.uploadID,n.opts.closeAfterFinish&&0===t.length&&n.requestCloseModal()},n.initEvents=function(){if(n.opts.trigger&&!n.opts.inline){var e=_$findAllDOMElements_196(n.opts.trigger);e?e.forEach(function(e){return e.addEventListener("click",n.openModal)}):n.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openModal()` method yourself","warning")}n.startListeningToResize(),document.addEventListener("paste",n.handlePasteOnBody),n.uppy.on("plugin-remove",n.removeTarget),n.uppy.on("file-added",n.hideAllPanels),n.uppy.on("dashboard:modal-closed",n.hideAllPanels),n.uppy.on("complete",n.handleComplete),document.addEventListener("focus",n.recordIfFocusedOnUppyRecently,!0),document.addEventListener("click",n.recordIfFocusedOnUppyRecently,!0),n.opts.inline&&n.el.addEventListener("keydown",n.handleKeyDownInInline)},n.removeEvents=function(){var e=_$findAllDOMElements_196(n.opts.trigger);!n.opts.inline&&e&&e.forEach(function(e){return e.removeEventListener("click",n.openModal)}),n.stopListeningToResize(),document.removeEventListener("paste",n.handlePasteOnBody),window.removeEventListener("popstate",n.handlePopState,!1),n.uppy.off("plugin-remove",n.removeTarget),n.uppy.off("file-added",n.hideAllPanels),n.uppy.off("dashboard:modal-closed",n.hideAllPanels),n.uppy.off("complete",n.handleComplete),document.removeEventListener("focus",n.recordIfFocusedOnUppyRecently),document.removeEventListener("click",n.recordIfFocusedOnUppyRecently),n.opts.inline&&n.el.removeEventListener("keydown",n.handleKeyDownInInline)},n.superFocusOnEachUpdate=function(){var e=n.el.contains(document.activeElement),t=document.activeElement===document.body||null===document.activeElement,r=n.uppy.getState().info.isHidden,i=!n.opts.inline;r&&(i||e||t&&n.ifFocusedOnUppyRecently)?n.superFocus(n.el,n.getPluginState().activeOverlayType):n.superFocus.cancel()},n.afterUpdate=function(){n.superFocusOnEachUpdate()},n.cancelUpload=function(e){n.uppy.removeFile(e)},n.saveFileCard=function(e,t){n.uppy.setFileMeta(t,e),n.toggleFileCard()},n._attachRenderFunctionToTarget=function(e){var t=n.uppy.getPlugin(e.id);return ___extends_123({},e,{icon:t.icon||n.opts.defaultPickerIcon,render:t.render})},n._isTargetSupported=function(e){var t=n.uppy.getPlugin(e.id);return"function"!=typeof t.isSupported||t.isSupported()},n._getAcquirers=memoize(function(e){return e.filter(function(e){return"acquirer"===e.type&&n._isTargetSupported(e)}).map(n._attachRenderFunctionToTarget)}),n._getProgressIndicators=memoize(function(e){return e.filter(function(e){return"progressindicator"===e.type}).map(n._attachRenderFunctionToTarget)}),n.render=function(e){var t,r=n.getPluginState(),i=e.files,o=e.capabilities,s=e.allowNewUpload,a=Object.keys(i).filter(function(e){return!i[e].progress.uploadStarted}),u=Object.keys(i).filter(function(e){return i[e].progress.uploadStarted}),l=Object.keys(i).filter(function(e){return i[e].isPaused}),c=Object.keys(i).filter(function(e){return i[e].progress.uploadComplete}),p=Object.keys(i).filter(function(e){return i[e].error}),d=Object.keys(i).filter(function(e){return!i[e].progress.uploadComplete&&i[e].progress.uploadStarted}),h=d.filter(function(e){return!i[e].isPaused}),_=Object.keys(i).filter(function(e){return i[e].progress.preprocess||i[e].progress.postprocess}),f=u.length>0,g=100===e.totalProgress&&c.length===Object.keys(i).length&&0===_.length,y=f&&p.length===u.length,m=0!==d.length&&l.length===d.length,v=n._getAcquirers(r.targets),b=n._getProgressIndicators(r.targets);return t="auto"===n.opts.theme?o.darkMode?"dark":"light":n.opts.theme,_$Dashboard_109({state:e,isHidden:r.isHidden,files:i,newFiles:a,uploadStartedFiles:u,completeFiles:c,erroredFiles:p,inProgressFiles:d,inProgressNotPausedFiles:h,processingFiles:_,isUploadStarted:f,isAllComplete:g,isAllErrored:y,isAllPaused:m,totalFileCount:Object.keys(i).length,totalProgress:e.totalProgress,allowNewUpload:s,acquirers:v,theme:t,activePickerPanel:r.activePickerPanel,animateOpenClose:n.opts.animateOpenClose,isClosing:r.isClosing,getPlugin:n.uppy.getPlugin,progressindicators:b,autoProceed:n.uppy.opts.autoProceed,id:n.id,closeModal:n.requestCloseModal,handleClickOutside:n.handleClickOutside,handleInputChange:n.handleInputChange,handlePaste:n.handlePaste,inline:n.opts.inline,showPanel:n.showPanel,hideAllPanels:n.hideAllPanels,log:n.uppy.log,i18n:n.i18n,i18nArray:n.i18nArray,removeFile:n.uppy.removeFile,info:n.uppy.info,note:n.opts.note,metaFields:r.metaFields,resumableUploads:o.resumableUploads||!1,individualCancellation:o.individualCancellation,isMobileDevice:o.isMobileDevice,pauseUpload:n.uppy.pauseResume,retryUpload:n.uppy.retryUpload,cancelUpload:n.cancelUpload,cancelAll:n.uppy.cancelAll,fileCardFor:r.fileCardFor,toggleFileCard:n.toggleFileCard,toggleAddFilesPanel:n.toggleAddFilesPanel,showAddFilesPanel:r.showAddFilesPanel,saveFileCard:n.saveFileCard,width:n.opts.width,height:n.opts.height,showLinkToFileUploadResult:n.opts.showLinkToFileUploadResult,proudlyDisplayPoweredByUppy:n.opts.proudlyDisplayPoweredByUppy,hideCancelButton:n.opts.hideCancelButton,showRemoveButtonAfterComplete:n.opts.showRemoveButtonAfterComplete,containerWidth:r.containerWidth,containerHeight:r.containerHeight,areInsidesReadyToBeVisible:r.areInsidesReadyToBeVisible,isTargetDOMEl:n.isTargetDOMEl,parentElement:n.el,allowedFileTypes:n.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:n.uppy.opts.restrictions.maxNumberOfFiles,showSelectedFiles:n.opts.showSelectedFiles,handleRequestThumbnail:n.handleRequestThumbnail,handleCancelThumbnail:n.handleCancelThumbnail,isDraggingOver:r.isDraggingOver,handleDragOver:n.handleDragOver,handleDragLeave:n.handleDragLeave,handleDrop:n.handleDrop})},n.discoverProviderPlugins=function(){n.uppy.iteratePlugins(function(e){e&&!e.target&&e.opts&&e.opts.target===n.constructor&&n.addTarget(e)})},n.install=function(){n.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:!1,metaFields:n.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});var e=n.opts,t=e.inline,r=e.closeAfterFinish;if(t&&r)throw new Error("[Dashboard] `closeAfterFinish: true` cannot be used on an inline Dashboard, because an inline Dashboard cannot be closed at all. Either set `inline: false`, or disable the `closeAfterFinish` option.");n.uppy.opts.allowMultipleUploads&&r&&n.uppy.log("[Dashboard] When using `closeAfterFinish`, we recommended setting the `allowMultipleUploads` option to `false` in the Uppy constructor. See https://uppy.io/docs/uppy/#allowMultipleUploads-true","warning");var i=n.opts.target;i&&n.mount(i,___assertThisInitialized_123(n)),(n.opts.plugins||[]).forEach(function(e){var t=n.uppy.getPlugin(e);t&&t.mount(___assertThisInitialized_123(n),t)}),n.opts.disableStatusBar||n.uppy.use(_$lib_170,{id:n.id+":StatusBar",target:___assertThisInitialized_123(n),hideUploadButton:n.opts.hideUploadButton,hideRetryButton:n.opts.hideRetryButton,hidePauseResumeButton:n.opts.hidePauseResumeButton,hideCancelButton:n.opts.hideCancelButton,showProgressDetails:n.opts.showProgressDetails,hideAfterFinish:n.opts.hideProgressAfterFinish,locale:n.opts.locale}),n.opts.disableInformer||n.uppy.use(_$lib_144,{id:n.id+":Informer",target:___assertThisInitialized_123(n)}),n.opts.disableThumbnailGenerator||n.uppy.use(_$lib_174,{id:n.id+":ThumbnailGenerator",thumbnailWidth:n.opts.thumbnailWidth,waitForThumbnailsBeforeUpload:n.opts.waitForThumbnailsBeforeUpload,lazy:!n.opts.waitForThumbnailsBeforeUpload}),n.darkModeMediaQuery="undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;var o=!!n.darkModeMediaQuery&&n.darkModeMediaQuery.matches;n.uppy.log("[Dashboard] Dark mode is "+(o?"on":"off")),n.setDarkModeCapability(o),"auto"===n.opts.theme&&n.darkModeMediaQuery.addListener(n.handleSystemDarkModeChange),n.discoverProviderPlugins(),n.initEvents()},n.uninstall=function(){if(!n.opts.disableInformer){var e=n.uppy.getPlugin(n.id+":Informer");e&&n.uppy.removePlugin(e)}if(!n.opts.disableStatusBar){var t=n.uppy.getPlugin(n.id+":StatusBar");t&&n.uppy.removePlugin(t)}if(!n.opts.disableThumbnailGenerator){var r=n.uppy.getPlugin(n.id+":ThumbnailGenerator");r&&n.uppy.removePlugin(r)}(n.opts.plugins||[]).forEach(function(e){var t=n.uppy.getPlugin(e);t&&t.unmount()}),"auto"===n.opts.theme&&n.darkModeMediaQuery.removeListener(n.handleSystemDarkModeChange),n.unmount(),n.removeEvents()},n.id=n.opts.id||"Dashboard",n.title="Dashboard",n.type="orchestrator",n.modalName="uppy-Dashboard-"+_$cuid_13(),n.defaultLocale={strings:{closeModal:"Close Modal",importFrom:"Import from %{name}",addingMoreFiles:"Adding more files",addMoreFiles:"Add more files",dashboardWindowTitle:"File Uploader Window (Press escape to close)",dashboardTitle:"File Uploader",copyLinkToClipboardSuccess:"Link copied to clipboard",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",fileSource:"File source: %{name}",done:"Done",back:"Back",addMore:"Add more",removeFile:"Remove file",editFile:"Edit file",editing:"Editing %{file}",finishEditingFile:"Finish editing file",saveChanges:"Save changes",cancel:"Cancel",myDevice:"My Device",dropPaste:"Drop files here, paste or %{browse}",dropPasteImport:"Drop files here, paste, %{browse} or\xa0import\xa0from:",dropHint:"Drop your files here",browse:"browse",uploadComplete:"Upload complete",uploadPaused:"Upload paused",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},poweredBy2:"%{backwardsCompat} %{uppy}",poweredBy:"Powered by"}};var i={target:"body",metaFields:[],trigger:"#uppy-select-files",inline:!1,width:750,height:550,thumbnailWidth:280,waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:defaultPickerIcon,showLinkToFileUploadResult:!0,showProgressDetails:!1,hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeCancelButtons:!1,hideProgressAfterFinish:!1,note:null,closeModalOnClickOutside:!1,closeAfterFinish:!1,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,disablePageScrollWhenModalOpen:!0,animateOpenClose:!0,proudlyDisplayPoweredByUppy:!0,onRequestCloseModal:function(){return n.closeModal()},showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,browserBackButtonClose:!1,theme:"light"};return n.opts=___extends_123({},i,{},r),n.i18nInit(),n.superFocus=_$createSuperFocus_125(),n.ifFocusedOnUppyRecently=!1,n.makeDashboardInsidesVisibleAnywayTimeout=null,n.removeDragOverClassTimeout=null,n}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(__Plugin_123),___class_123.VERSION="1.9.0",___temp_123),___class_132,___temp_132;function ___extends_132(){return(___extends_132=Object.assign||function(e){for(var t=1;t0&&(e.mimeType=n[0])}return e},i._startRecording=function(){var e=this;this.recorder=new MediaRecorder(this.stream,this._getMediaRecorderOptions()),this.recordingChunks=[];var t=!1;this.recorder.addEventListener("dataavailable",function(r){e.recordingChunks.push(r.data);var n=e.uppy.opts.restrictions;if(e.recordingChunks.length>1&&null!=n.maxFileSize&&!t){var i=e.recordingChunks.reduce(function(e,t){return e+t.size},0),o=(i-e.recordingChunks[0].size)/(e.recordingChunks.length-1)*3;i>Math.max(0,n.maxFileSize-o)&&(t=!0,e.uppy.info(e.i18n("recordingStoppedMaxSize"),"warning",4e3),e._stopRecording())}}),this.recorder.start(500),this.opts.showRecordingLength&&(this.recordingLengthTimer=setInterval(function(){var t=e.getPluginState().recordingLengthSeconds;e.setPluginState({recordingLengthSeconds:t+1})},1e3)),this.setPluginState({isRecording:!0})},i._stopRecording=function(){var e=this;return new Promise(function(t,r){e.recorder.addEventListener("stop",function(){t()}),e.recorder.stop(),e.opts.showRecordingLength&&(clearInterval(e.recordingLengthTimer),e.setPluginState({recordingLengthSeconds:0}))}).then(function(){return e.setPluginState({isRecording:!1}),e.getVideo()}).then(function(t){try{e.uppy.addFile(t)}catch(err){err.isRestriction||e.uppy.log(err)}}).then(function(){e.recordingChunks=null,e.recorder=null},function(t){throw e.recordingChunks=null,e.recorder=null,t})},i._stop=function(){this.stream.getAudioTracks().forEach(function(e){e.stop()}),this.stream.getVideoTracks().forEach(function(e){e.stop()}),this.webcamActive=!1,this.stream=null},i._getVideoElement=function(){return this.el.querySelector(".uppy-Webcam-video")},i._oneTwoThreeSmile=function(){var e=this;return new Promise(function(t,r){var n=e.opts.countdown,i=setInterval(function(){if(!e.webcamActive)return clearInterval(i),e.captureInProgress=!1,r(new Error("Webcam is not active"));n>0?(e.uppy.info(n+"...","warning",800),n--):(clearInterval(i),e.uppy.info(e.i18n("smile"),"success",1500),setTimeout(function(){return t()},1500))},1e3)})},i._takeSnapshot=function(){var e=this;this.captureInProgress||(this.captureInProgress=!0,this.opts.onBeforeSnapshot().catch(function(t){var r="object"==typeof t?t.message:t;return e.uppy.info(r,"error",5e3),Promise.reject(new Error("onBeforeSnapshot: "+r))}).then(function(){return e._getImage()}).then(function(t){e.captureInProgress=!1;try{e.uppy.addFile(t)}catch(err){err.isRestriction||e.uppy.log(err)}},function(t){throw e.captureInProgress=!1,t}))},i._getImage=function(){var e=this,t=this._getVideoElement();if(!t)return Promise.reject(new Error("No video element found, likely due to the Webcam tab being closed."));var r=t.videoWidth,n=t.videoHeight,i=document.createElement("canvas");i.width=r,i.height=n,i.getContext("2d").drawImage(t,0,0);var o=this.uppy.opts.restrictions,s=[];this.opts.preferredImageMimeType?s=[this.opts.preferredImageMimeType]:o.allowedFileTypes&&(s=o.allowedFileTypes.map(toMimeType).filter(isImageMimeType));var a=s[0]||"image/jpeg",u=_$getFileTypeExtension_207(a)||"jpg",l="cam-"+Date.now()+"."+u;return _$canvasToBlob_193(i,a).then(function(t){return{source:e.id,name:l,data:new Blob([t],{type:a}),type:a}})},i.getVideo=function(){var e=this.recordingChunks[0].type,t=_$getFileTypeExtension_207(e);if(!t)return Promise.reject(new Error('Could not retrieve recording: Unsupported media type "'+e+'"'));var r="webcam-"+Date.now()+"."+t,n=new Blob(this.recordingChunks,{type:e}),i={source:this.id,name:r,data:new Blob([n],{type:e}),type:e};return Promise.resolve(i)},i._focus=function(){var e=this;this.opts.countdown&&setTimeout(function(){e.uppy.info(e.i18n("smile"),"success",1500)},1e3)},i.render=function(){this.webcamActive||this._start();var e=this.getPluginState();return e.cameraReady&&e.hasCamera?__h_229(_$CameraScreen_223,___extends_229({},e,{onSnapshot:this._takeSnapshot,onStartRecording:this._startRecording,onStopRecording:this._stopRecording,onFocus:this._focus,onStop:this._stop,i18n:this.i18n,modes:this.opts.modes,showRecordingLength:this.opts.showRecordingLength,supportsRecording:_$supportsMediaRecorder_230(),recording:e.isRecording,mirror:this.opts.mirror,src:this.stream})):__h_229(_$PermissionsScreen_224,{icon:_$CameraIcon_222,i18n:this.i18n,hasCamera:e.hasCamera})},i.install=function(){this.setPluginState({cameraReady:!1,recordingLengthSeconds:0});var e=this.opts.target;e&&this.mount(e,this)},i.uninstall=function(){this.stream&&this._stop(),this.unmount()},n}(__Plugin_229),___class_229.VERSION="1.6.6",___temp_229),__h_163=_$preact_53.h,_$ScreenRecIcon_163=function(){return __h_163("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg"},__h_163("g",{fill:"none","fill-rule":"evenodd"},__h_163("rect",{fill:"#2C3E50",width:"32",height:"32",rx:"16"}),__h_163("path",{d:"M24.182 9H7.818C6.81 9 6 9.742 6 10.667v10c0 .916.81 1.666 1.818 1.666h4.546V24h7.272v-1.667h4.546c1 0 1.809-.75 1.809-1.666l.009-10C26 9.742 25.182 9 24.182 9zM24 21H8V11h16v10z",fill:"#FFF","fill-rule":"nonzero"}),__h_163("circle",{fill:"#FFF",cx:"16",cy:"16",r:"2"})))},__h_162=_$preact_53.h,_$RecordButton_162=function(e){var t=e.recording,r=e.onStartRecording,n=e.onStopRecording,i=e.i18n;return t?__h_162("button",{class:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video uppy-ScreenCapture-button--stop-rec",type:"button",title:i("stopRecording"),"aria-label":i("stopRecording"),onclick:n,"data-uppy-super-focusable":!0},__h_162("svg",{"aria-hidden":"true",focusable:"false",class:"UppyIcon",width:"100",height:"100",viewBox:"0 0 100 100"},__h_162("rect",{x:"15",y:"15",width:"70",height:"70"}))):__h_162("button",{class:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video",type:"button",title:i("startCapturing"),"aria-label":i("stopCapturing"),onclick:r,"data-uppy-super-focusable":!0},__h_162("svg",{"aria-hidden":"true",focusable:"false",class:"UppyIcon",width:"100",height:"100",viewBox:"0 0 100 100"},__h_162("circle",{cx:"50",cy:"50",r:"40"})))},__h_166=_$preact_53.h,_$SubmitButton_166=function(e){var t=e.recording,r=e.recordedVideo,n=e.onSubmit,i=e.i18n;return r&&!t?__h_166("button",{class:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--submit",type:"button",title:i("submitRecordedFile"),"aria-label":i("submitRecordedFile"),onclick:n,"data-uppy-super-focusable":!0},__h_166("svg",{"aria-hidden":"true",focusable:"false",class:"UppyIcon",width:"48",height:"48",viewBox:"0 0 48 48"},__h_166("path",{d:"M0 0h48v48h-48z",fill:"none"}),__h_166("path",{d:"M38.71 20.07c-1.36-6.88-7.43-12.07-14.71-12.07-5.78 0-10.79 3.28-13.3 8.07-6.01.65-10.7 5.74-10.7 11.93 0 6.63 5.37 12 12 12h26c5.52 0 10-4.48 10-10 0-5.28-4.11-9.56-9.29-9.93zm-10.71 5.93v8h-8v-8h-6l10-10 10 10h-6z"}))):null};function ___extends_164(){return(___extends_164=Object.assign||function(e){for(var t=1;t9?":":":0")+e},i.render=function(){var e=___extends_164({},this.props),t=e.recording,r=e.i18n,n=this.fmtMSS(this.state.elapsedTime);return t&&!this.timerRunning&&this.startTimer(),!t&&this.timerRunning&&this.resetTimer(),t?__h_164("div",{style:this.wrapperStyle},__h_164("div",{style:this.overlayStyle}),__h_164("div",{style:this.infoContainerStyle},__h_164("div",{style:this.infotextStyle},r("recording")),__h_164("div",{style:this.timeStyle},n))):null},n}(_$preact_53.Component),_$Stopwatch_164=Stopwatch,__h_165=_$preact_53.h,_$StreamStatus_165=function(e){var t=e.streamActive,r=e.i18n;return t?__h_165("div",{title:r("streamActive"),"aria-label":r("streamActive"),class:"uppy-ScreenCapture-icon--stream uppy-ScreenCapture-icon--streamActive"},__h_165("svg",{"aria-hidden":"true",focusable:"false",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},__h_165("path",{d:"M0 0h24v24H0z",opacity:".1",fill:"none"}),__h_165("path",{d:"M0 0h24v24H0z",fill:"none"}),__h_165("path",{d:"M1 18v3h3c0-1.66-1.34-3-3-3zm0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7zm18-7H5v1.63c3.96 1.28 7.09 4.41 8.37 8.37H19V7zM1 10v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11zm20-7H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}))):__h_165("div",{title:r("streamPassive"),"aria-label":r("streamPassive"),class:"uppy-ScreenCapture-icon--stream"},__h_165("svg",{"aria-hidden":"true",focusable:"false",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},__h_165("path",{d:"M0 0h24v24H0z",opacity:".1",fill:"none"}),__h_165("path",{d:"M0 0h24v24H0z",fill:"none"}),__h_165("path",{d:"M21 3H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM1 18v3h3c0-1.66-1.34-3-3-3zm0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7zm0-4v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11z"})))};function ___extends_161(){return(___extends_161=Object.assign||function(e){for(var t=1;t=this.limit)&&0!==this.queuedHandlers.length){var e=this.queuedHandlers.shift(),t=this._call(e.fn);e.abort=t.abort,e.done=t.done}},t._queue=function(e,t){var r=this;void 0===t&&(t={});var n={fn:e,priority:t.priority||0,abort:function(){r._dequeue(n)},done:function(){throw new Error("Cannot mark a queued request as done: this indicates a bug")}},i=function(e,t){for(var r=0;ri.priority)return r;var i;return-1}(this.queuedHandlers);return-1===i?this.queuedHandlers.push(n):this.queuedHandlers.splice(i,0,n),n},t._dequeue=function(e){var t=this.queuedHandlers.indexOf(e);-1!==t&&this.queuedHandlers.splice(t,1)},t.run=function(e,t){return this.activeRequests0&&(this._aliveTimer&&clearTimeout(this._aliveTimer),this._aliveTimer=setTimeout(this._onTimedOut,this._timeout))},t.done=function(){this._aliveTimer&&(clearTimeout(this._aliveTimer),this._aliveTimer=null),this._isDone=!0},e}(),_$ProgressTimeout_190=ProgressTimeout,_$isNetworkError_214=function(e){return!!e&&(0!==e.readyState&&4!==e.readyState||0===e.status)};function ___extends_94(){return(___extends_94=Object.assign||function(e){for(var t=1;t=200&&e<300}},t),this.requests=t.__queue,this.uploaderEvents=Object.create(null)}var t=e.prototype;return t._getOptions=function(e){var t=this.uppy.getState().xhrUpload,r=___extends_94({},this.opts,{},t||{},{},e.xhrUpload||{},{headers:{}});return ___extends_94(r.headers,this.opts.headers),t&&___extends_94(r.headers,t.headers),e.xhrUpload&&___extends_94(r.headers,e.xhrUpload.headers),r},t.uploadFile=function(e,t,r){var n=this.uppy.getFile(e);if(n.error)throw new Error(n.error);return n.isRemote?this._uploadRemoteFile(n,t,r):this._uploadLocalFile(n,t,r)},t._addMetadata=function(e,t,r){(Array.isArray(r.metaFields)?r.metaFields:Object.keys(t)).forEach(function(r){e.append(r,t[r])})},t._createFormDataUpload=function(e,t){var r=new FormData;this._addMetadata(r,e.meta,t);var n=function(e){return e.data.slice(0,e.data.size,e.meta.type)}(e);return e.name?r.append(t.fieldName,n,e.meta.name):r.append(t.fieldName,n),r},t._createBareUpload=function(e,t){return e.data},t._onFileRemoved=function(e,t){this.uploaderEvents[e].on("file-removed",function(r){e===r.id&&t(r.id)})},t._onRetry=function(e,t){this.uploaderEvents[e].on("upload-retry",function(r){e===r&&t()})},t._onRetryAll=function(e,t){var r=this;this.uploaderEvents[e].on("retry-all",function(n){r.uppy.getFile(e)&&t()})},t._onCancelAll=function(e,t){var r=this;this.uploaderEvents[e].on("cancel-all",function(){r.uppy.getFile(e)&&t()})},t._uploadLocalFile=function(e,t,r){var n=this,i=this._getOptions(e);return this.uppy.log("uploading "+t+" of "+r),new Promise(function(t,r){var o=i.formData?n._createFormDataUpload(e,i):n._createBareUpload(e,i),s=new XMLHttpRequest;n.uploaderEvents[e.id]=new _$EventTracker_187(n.uppy);var a=new _$ProgressTimeout_190(i.timeout,function(){s.abort(),l.done();var t=new Error(n.i18n("timedOut",{seconds:Math.ceil(i.timeout/1e3)}));n.uppy.emit("upload-error",e,t),r(t)}),u=_$cuid_13();s.upload.addEventListener("loadstart",function(e){n.uppy.log("[AwsS3/XHRUpload] "+u+" started")}),s.upload.addEventListener("progress",function(t){n.uppy.log("[AwsS3/XHRUpload] "+u+" progress: "+t.loaded+" / "+t.total),a.progress(),t.lengthComputable&&n.uppy.emit("upload-progress",e,{uploader:n,bytesUploaded:t.loaded,bytesTotal:t.total})}),s.addEventListener("load",function(o){if(n.uppy.log("[AwsS3/XHRUpload] "+u+" finished"),a.done(),l.done(),n.uploaderEvents[e.id]&&(n.uploaderEvents[e.id].remove(),n.uploaderEvents[e.id]=null),i.validateStatus(o.target.status,s.responseText,s)){var c=i.getResponseData(s.responseText,s),p=c[i.responseUrlFieldName],d={status:o.target.status,body:c,uploadURL:p};return n.uppy.emit("upload-success",e,d),p&&n.uppy.log("Download "+e.name+" from "+p),t(e)}var h=i.getResponseData(s.responseText,s),_=buildResponseError(s,i.getResponseError(s.responseText,s)),f={status:o.target.status,body:h};return n.uppy.emit("upload-error",e,_,f),r(_)}),s.addEventListener("error",function(t){n.uppy.log("[AwsS3/XHRUpload] "+u+" errored"),a.done(),l.done(),n.uploaderEvents[e.id]&&(n.uploaderEvents[e.id].remove(),n.uploaderEvents[e.id]=null);var o=buildResponseError(s,i.getResponseError(s.responseText,s));return n.uppy.emit("upload-error",e,o),r(o)}),s.open(i.method.toUpperCase(),i.endpoint,!0),s.withCredentials=i.withCredentials,""!==i.responseType&&(s.responseType=i.responseType),Object.keys(i.headers).forEach(function(e){s.setRequestHeader(e,i.headers[e])});var l=n.requests.run(function(){return s.send(o),function(){a.done(),s.abort()}},{priority:1});n._onFileRemoved(e.id,function(){l.abort(),r(new Error("File removed"))}),n._onCancelAll(e.id,function(){l.abort(),r(new Error("Upload cancelled"))})})},t._uploadRemoteFile=function(e,t,r){var n=this,i=this._getOptions(e);return new Promise(function(t,r){var o={};(Array.isArray(i.metaFields)?i.metaFields:Object.keys(e.meta)).forEach(function(t){o[t]=e.meta[t]}),new(e.remote.providerOptions.provider?__Provider_94:__RequestClient_94)(n.uppy,e.remote.providerOptions).post(e.remote.url,___extends_94({},e.remote.body,{endpoint:i.endpoint,size:e.data.size,fieldname:i.fieldName,metadata:o,httpMethod:i.method,useFormData:i.formData,headers:i.headers})).then(function(o){var s=o.token,a=_$getSocketHost_208(e.remote.companionUrl),u=new __Socket_94({target:a+"/api/"+s,autoOpen:!1});n.uploaderEvents[e.id]=new _$EventTracker_187(n.uppy),n._onFileRemoved(e.id,function(){u.send("pause",{}),l.abort(),t("upload "+e.id+" was removed")}),n._onCancelAll(e.id,function(){u.send("pause",{}),l.abort(),t("upload "+e.id+" was canceled")}),n._onRetry(e.id,function(){u.send("pause",{}),u.send("resume",{})}),n._onRetryAll(e.id,function(){u.send("pause",{}),u.send("resume",{})}),u.on("progress",function(t){return _$emitSocketProgress_195(n,t,e)}),u.on("success",function(r){var o=i.getResponseData(r.response.responseText,r.response),s=o[i.responseUrlFieldName],a={status:r.response.status,body:o,uploadURL:s};return n.uppy.emit("upload-success",e,a),l.done(),n.uploaderEvents[e.id]&&(n.uploaderEvents[e.id].remove(),n.uploaderEvents[e.id]=null),t()}),u.on("error",function(t){var o=t.response,s=o?i.getResponseError(o.responseText,o):___extends_94(new Error(t.error.message),{cause:t.error});n.uppy.emit("upload-error",e,s),l.done(),n.uploaderEvents[e.id]&&(n.uploaderEvents[e.id].remove(),n.uploaderEvents[e.id]=null),r(s)});var l=n.requests.run(function(){return u.open(),e.isPaused&&u.send("pause",{}),function(){return u.close()}})}).catch(function(t){n.uppy.emit("upload-error",e,t),r(t)})})},e}(),___class_95,___temp_95;function ___assertThisInitialized_95(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ___extends_95(){return(___extends_95=Object.assign||function(e){for(var t=1;t"),n=e.indexOf("",r);return-1!==r&&-1!==n?e.slice(r+t.length+2,n):""}function assertServerError(e){if(e&&e.error){var t=new Error(e.message);throw ___extends_95(t,e.error),t}return e}var warnedSuccessActionStatus=!1,_$lib_95=(___temp_95=___class_95=function(e){var t,r;function n(t,r){var n;(n=e.call(this,t,r)||this).type="uploader",n.id=n.opts.id||"AwsS3",n.title="AWS S3";var i={timeout:3e4,limit:0,metaFields:[],getUploadParameters:n.getUploadParameters.bind(___assertThisInitialized_95(n))};return n.opts=___extends_95({},i,{},r),n.client=new __RequestClient_95(t,r),n.handleUpload=n.handleUpload.bind(___assertThisInitialized_95(n)),n.requests=new _$RateLimitedQueue_191(n.opts.limit),n}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.getUploadParameters=function(e){if(!this.opts.companionUrl)throw new Error("Expected a `companionUrl` option containing a Companion address.");var t=e.meta.name,r=e.meta.type,n={};this.opts.metaFields.forEach(function(t){null!=e.meta[t]&&(n[t]=e.meta[t].toString())});var i=_$queryStringify_55({filename:t,type:r,metadata:n});return this.client.get("s3/params?"+i).then(assertServerError)},i.validateParameters=function(e,t){if("object"!=typeof t||!t||"string"!=typeof t.url||"object"!=typeof t.fields&&null!=t.fields||null!=t.method&&!/^(put|post)$/i.test(t.method)){var r=new TypeError("AwsS3: got incorrect result from 'getUploadParameters()' for file '"+e.name+"', expected an object '{ url, method, fields, headers }'.\nSee https://uppy.io/docs/aws-s3/#getUploadParameters-file for more on the expected format.");throw console.error(r),r}},i.handleUpload=function(e){var t=this,r=Object.create(null);function n(e){var t=e.id;_$hasProperty_211(r,t)&&r[t].abort()}this.uppy.on("file-removed",n),e.forEach(function(e){var r=t.uppy.getFile(e);t.uppy.emit("upload-started",r)});var i=this.requests.wrapPromiseFunction(function(e){return t.opts.getUploadParameters(e)}),o=e.length;return _$settle_220(e.map(function(e,n){return r[e]=i(t.uppy.getFile(e)),r[e].then(function(i){delete r[e];var s=t.uppy.getFile(e);t.validateParameters(s,i);var a=i.method,u=void 0===a?"post":a,l=i.url,c=i.fields,p=i.headers,d={method:u,formData:"post"===u.toLowerCase(),endpoint:l,metaFields:c?Object.keys(c):[]};return p&&(d.headers=p),t.uppy.setFileState(s.id,{meta:___extends_95({},s.meta,{},c),xhrUpload:d}),t._uploader.uploadFile(s.id,n,o)}).catch(function(n){delete r[e];var i=t.uppy.getFile(e);t.uppy.emit("upload-error",i,n)})})).then(function(e){return t.uppy.off("file-removed",n),e})},i.install=function(){var e=this.uppy;this.uppy.addUploader(this.handleUpload);var t={fieldName:"file",responseUrlFieldName:"location",timeout:this.opts.timeout,__queue:this.requests,responseType:"text",getResponseData:this.opts.getResponseData||function(t,r){var n,i;return isXml(t,r)?{location:(n=r.responseURL,i=getXmlValue(t,"Location"),n?new URL_(i,n).toString():new URL_(i).toString()),bucket:getXmlValue(t,"Bucket"),key:getXmlValue(t,"Key"),etag:getXmlValue(t,"ETag")}:"POST"===this.method.toUpperCase()?(warnedSuccessActionStatus||(e.log("[AwsS3] No response data found, make sure to set the success_action_status AWS SDK option to 201. See https://uppy.io/docs/aws-s3/#POST-Uploads","warning"),warnedSuccessActionStatus=!0),{location:null}):r.responseURL?{location:r.responseURL.replace(/\?.*$/,"")}:{location:null}},getResponseError:function(e,t){if(isXml(e,t)){var r=getXmlValue(e,"Message");return new Error(r)}}};this._uploader=new _$MiniXHRUpload_94(this.uppy,t),this._uploader.i18n=this.uppy.i18n},i.uninstall=function(){this.uppy.removePreProcessor(this.handleUpload)},n}(__Plugin_95),___class_95.VERSION="1.6.5",___temp_95);function ___extends_92(){return(___extends_92=Object.assign||function(e){for(var t=1;t=t))break}r.forEach(function(t){e._uploadPart(t)})}}},t._uploadPart=function(e){var t=this,r=this.chunks[e];return this.chunkState[e].busy=!0,Promise.resolve().then(function(){return t.options.prepareUploadPart({key:t.key,uploadId:t.uploadId,body:r,number:e+1})}).then(function(e){if("object"!=typeof e||!e||"string"!=typeof e.url)throw new TypeError("AwsS3/Multipart: Got incorrect result from `prepareUploadPart()`, expected an object `{ url }`.");return e}).then(function(r){var n=r.url,i=r.headers;t._uploadPartBytes(e,n,i)},function(e){t._onError(e)})},t._onPartProgress=function(e,t,r){this.chunkState[e].uploaded=t;var n=this.chunkState.reduce(function(e,t){return e+t.uploaded},0);this.options.onProgress(n,this.file.size)},t._onPartComplete=function(e,t){this.chunkState[e].etag=t,this.chunkState[e].done=!0;var r={PartNumber:e+1,ETag:t};this.parts.push(r),this.options.onPartComplete(r),this._uploadParts()},t._uploadPartBytes=function(e,t,r){var n=this,i=this.chunks[e],o=new XMLHttpRequest;o.open("PUT",t,!0),r&&Object.keys(r).map(function(e){o.setRequestHeader(e,r[e])}),o.responseType="text",this.uploading.push(o),o.upload.addEventListener("progress",function(t){t.lengthComputable&&n._onPartProgress(e,t.loaded,t.total)}),o.addEventListener("abort",function(t){remove(n.uploading,t.target),n.chunkState[e].busy=!1}),o.addEventListener("load",function(t){if(remove(n.uploading,t.target),n.chunkState[e].busy=!1,t.target.status<200||t.target.status>=300)n._onError(new Error("Non 2xx"));else{n._onPartProgress(e,i.size,i.size);var r=t.target.getResponseHeader("ETag");null!==r?n._onPartComplete(e,r):n._onError(new Error("AwsS3/Multipart: Could not read the ETag header. This likely means CORS is not configured correctly on the S3 Bucket. Seee https://uppy.io/docs/aws-s3-multipart#S3-Bucket-Configuration for instructions."))}}),o.addEventListener("error",function(t){remove(n.uploading,t.target),n.chunkState[e].busy=!1;var r=new Error("Unknown error");r.source=t.target,n._onError(r)}),o.send(i)},t._completeUpload=function(){var e=this;return this.parts.sort(function(e,t){return e.PartNumber-t.PartNumber}),Promise.resolve().then(function(){return e.options.completeMultipartUpload({key:e.key,uploadId:e.uploadId,parts:e.parts})}).then(function(t){e.options.onSuccess(t)},function(t){e._onError(t)})},t._abortUpload=function(){var e=this;this.uploading.slice().forEach(function(e){e.abort()}),this.createdPromise.then(function(){e.options.abortMultipartUpload({key:e.key,uploadId:e.uploadId})},function(){}),this.uploading=[]},t._onError=function(e){this.options.onError(e)},t.start=function(){this.isPaused=!1,this.uploadId?this._resumeUpload():this._createUpload()},t.pause=function(){this.uploading.slice().forEach(function(e){e.abort()}),this.isPaused=!0},t.abort=function(e){if(void 0===e&&(e={}),!e.really)return this.pause();this._abortUpload()},e}(),_$MultipartUploader_92=MultipartUploader,___class_93,___temp_93;function ___assertThisInitialized_93(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ___extends_93(){return(___extends_93=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;!function(e,r){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e.message));i.originalRequest=n,i.causingError=r;var o=e.message;return null!=r&&(o+=", caused by "+r.toString()),null!=n&&(o+=", originated from request (response code: "+n.status+", response text: "+n.responseText+")"),i.message=o,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),t}();_$error_85.default=DetailedError;var hasOwn=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,defineProperty=Object.defineProperty,gOPD=Object.getOwnPropertyDescriptor,isArray=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===toStr.call(e)},isPlainObject=function(e){if(!e||"[object Object]"!==toStr.call(e))return!1;var t,r=hasOwn.call(e,"constructor"),n=e.constructor&&e.constructor.prototype&&hasOwn.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;for(t in e);return void 0===t||hasOwn.call(e,t)},setProperty=function(e,t){defineProperty&&"__proto__"===t.name?defineProperty(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},getProperty=function(e,t){if("__proto__"===t){if(!hasOwn.call(e,t))return;if(gOPD)return gOPD(e,t).value}return e[t]},_$extend_35=function e(){var t,r,n,i,o,s,a=arguments[0],u=1,l=arguments.length,c=!1;for("boolean"==typeof a&&(c=a,a=arguments[1]||{},u=2),(null==a||"object"!=typeof a&&"function"!=typeof a)&&(a={});u>>6)+fromCharCode(128|63&t):fromCharCode(224|t>>>12&15)+fromCharCode(128|t>>>6&63)+fromCharCode(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return fromCharCode(240|t>>>18&7)+fromCharCode(128|t>>>12&63)+fromCharCode(128|t>>>6&63)+fromCharCode(128|63&t)},re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,utob=function(e){return e.replace(re_utob,cb_utob)},cb_encode=function(e){var t=[0,2,1][e.length%3],r=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[b64chars.charAt(r>>>18),b64chars.charAt(r>>>12&63),t>=2?"=":b64chars.charAt(r>>>6&63),t>=1?"=":b64chars.charAt(63&r)].join("")},btoa=global.btoa?function(e){return global.btoa(e)}:function(e){return e.replace(/[\s\S]{1,3}/g,cb_encode)},_encode=function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)?e.toString("base64"):btoa(utob(String(e)))},encode=function(e,t){return t?_encode(String(e)).replace(/[+\/]/g,function(e){return"+"==e?"-":"_"}).replace(/=/g,""):_encode(e)},encodeURI=function(e){return encode(e,!0)},re_btou=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,cb_btou=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return fromCharCode(55296+(t>>>10))+fromCharCode(56320+(1023&t));case 3:return fromCharCode((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return fromCharCode((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},btou=function(e){return e.replace(re_btou,cb_btou)},cb_decode=function(e){var t=e.length,r=t%4,n=(t>0?b64tab[e.charAt(0)]<<18:0)|(t>1?b64tab[e.charAt(1)]<<12:0)|(t>2?b64tab[e.charAt(2)]<<6:0)|(t>3?b64tab[e.charAt(3)]:0),i=[fromCharCode(n>>>16),fromCharCode(n>>>8&255),fromCharCode(255&n)];return i.length-=[0,0,2,1][r],i.join("")},_atob=global.atob?function(e){return global.atob(e)}:function(e){return e.replace(/\S{1,4}/g,cb_decode)},atob=function(e){return _atob(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},_decode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e,"base64")).toString()}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e,"base64")).toString()}:function(e){return btou(_atob(e))},decode=function(e){return _decode(String(e).replace(/[-_]/g,function(e){return"-"==e?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},noConflict=function(){var e=global.Base64;return global.Base64=_Base64,e};if(global.Base64={VERSION:version,atob:atob,btoa:btoa,fromBase64:decode,toBase64:encode,utob:utob,encode:encode,encodeURI:encodeURI,btou:btou,decode:decode,noConflict:noConflict,__buffer__:buffer},"function"==typeof Object.defineProperty){var noEnum=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};global.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",noEnum(function(){return decode(this)})),Object.defineProperty(String.prototype,"toBase64",noEnum(function(e){return encode(this,e)})),Object.defineProperty(String.prototype,"toBase64URI",noEnum(function(){return encode(this,!0)}))}}return global.Meteor&&(Base64=global.Base64),_$base64_43.exports?_$base64_43.exports.Base64=global.Base64:"function"==typeof define&&define.amd&&define([],function(){return global.Base64}),{Base64:global.Base64}})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),_$base64_43=_$base64_43.exports;var _$request_81={};Object.defineProperty(_$request_81,"__esModule",{value:!0}),_$request_81.newRequest=function(){return new window.XMLHttpRequest},_$request_81.resolveUrl=function(e,t){return new _urlParse2.default(t,e).toString()};var obj,_urlParse2=(obj=_$urlParse_88)&&obj.__esModule?obj:{default:obj},_$isReactNative_79={};Object.defineProperty(_$isReactNative_79,"__esModule",{value:!0}),_$isReactNative_79.default=function(){return"undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase()};var _$uriToBlob_84={};Object.defineProperty(_$uriToBlob_84,"__esModule",{value:!0}),_$uriToBlob_84.default=function(e,t){var r=new XMLHttpRequest;r.responseType="blob",r.onload=function(){var e=r.response;t(null,e)},r.onerror=function(e){t(e)},r.open("GET",e),r.send()};var _$isCordova_78={};Object.defineProperty(_$isCordova_78,"__esModule",{value:!0}),_$isCordova_78.default=function(){return"undefined"!=typeof window&&(void 0!==window.PhoneGap||void 0!==window.Cordova||void 0!==window.cordova)};var _$readAsByteArray_80={};Object.defineProperty(_$readAsByteArray_80,"__esModule",{value:!0}),_$readAsByteArray_80.default=function(e,t){var r=new FileReader;r.onload=function(){t(null,new Uint8Array(r.result))},r.onerror=function(e){t(e)},r.readAsArrayBuffer(e)};var _$source_82={};Object.defineProperty(_$source_82,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;rthis._bufferOffset&&(this._buffer=this._buffer.slice(e-this._bufferOffset),this._bufferOffset=e);var r=0===__len_82(this._buffer);return this._done&&r?null:this._buffer.slice(0,t-e)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}]),e}();function __len_82(e){return void 0===e?0:void 0!==e.size?e.size:e.length}var _$storage_83={};Object.defineProperty(_$storage_83,"__esModule",{value:!0});var ___createClass_83=function(){function e(e,t){for(var r=0;rt._offsetBeforeRetry&&(t._retryAttempt=0);var r=!0;"undefined"!=typeof window&&"navigator"in window&&!1===window.navigator.onLine&&(r=!1);var o=e.originalRequest?e.originalRequest.status:0,s=!inStatusCategory(o,400)||409===o||423===o;if(t._retryAttemptthis._size)&&!this.options.uploadLengthDeferred&&(n=this._size),this._source.slice(r,n,function(r,n,i){r?t._emitError(r):(t.options.uploadLengthDeferred&&i&&(t._size=t._offset+(n&&n.size?n.size:0),e.setRequestHeader("Upload-Length",t._size)),null===n?e.send():(e.send(n),t._emitProgress(t._offset,t._size)))})}},{key:"_handleUploadResponse",value:function(e){var t=this,r=parseInt(e.getResponseHeader("Upload-Offset"),10);if(isNaN(r))this._emitXhrError(e,new Error("tus: invalid or missing offset value"));else{if(this._emitProgress(r,this._size),this._emitChunkComplete(r-this._offset,r,this._size),this._offset=r,r==this._size)return this.options.removeFingerprintOnSuccess&&this.options.resume&&this._storage.removeItem(this._fingerprint,function(e){e&&t._emitError(e)}),this._emitSuccess(),void this._source.close();this._startUpload()}}}],[{key:"terminate",value:function(e,t,r){if("function"!=typeof t&&"function"!=typeof r)throw new Error("tus: a callback function must be specified");"function"==typeof t&&(r=t,t={});var n=(0,_$request_81.newRequest)();n.open("DELETE",e,!0),n.onload=function(){204===n.status?r():r(new _error2.default(new Error("tus: unexpected response while terminating upload"),null,n))},n.onerror=function(e){r(new _error2.default(e,new Error("tus: failed to terminate upload"),n))},setupXHR(n,t),n.send(null)}}]),e}();function inStatusCategory(e,t){return e>=t&&e0)return function(e){if(!((e=String(e)).length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*y;case"days":case"day":case"d":return r*d;case"hours":case"hour":case"hrs":case"hr":case"h":return r*__h_67;case"minutes":case"minute":case"mins":case"min":case"m":return r*m;case"seconds":case"second":case"secs":case"sec":case"s":return r*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}(e);if("number"===n&&!1===isNaN(e))return t.long?plural(r=e,d,"day")||plural(r,__h_67,"hour")||plural(r,m,"minute")||plural(r,s,"second")||r+" ms":function(e){return e>=d?Math.round(e/d)+"d":e>=__h_67?Math.round(e/__h_67)+"h":e>=m?Math.round(e/m)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))},_$debug_66={};function createDebug(e){var t;function r(){if(r.enabled){var e=r,n=+new Date,i=n-(t||n);e.diff=i,e.prev=t,e.curr=n,t=n;for(var o=new Array(arguments.length),s=0;s=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},_$browser_65.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),_$browser_65.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],_$browser_65.formatters.j=function(e){try{return JSON.stringify(e)}catch(err){return"[UnexpectedJSONParseError]: "+err.message}},_$browser_65.enable(r())}).call(this,_$browser_54);var debug=_$browser_65("socket.io-client:url"),_$url_63=function(e,t){var r=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(debug("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),debug("parse %s",e),r=_$parseuri_51(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";var n=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+n+":"+r.port,r.href=r.protocol+"://"+n+(t&&t.port===r.port?"":":"+r.port),r},__s_75=1e3,__m_75=60*__s_75,__h_75=60*__m_75,__d_75=24*__h_75,__y_75=365.25*__d_75;function __plural_75(e,t,r){if(!(e0)return function(e){if(!((e=String(e)).length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*__y_75;case"days":case"day":case"d":return r*__d_75;case"hours":case"hour":case"hrs":case"hr":case"h":return r*__h_75;case"minutes":case"minute":case"mins":case"min":case"m":return r*__m_75;case"seconds":case"second":case"secs":case"sec":case"s":return r*__s_75;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}(e);if("number"===n&&!1===isNaN(e))return t.long?__plural_75(r=e,__d_75,"day")||__plural_75(r,__h_75,"hour")||__plural_75(r,__m_75,"minute")||__plural_75(r,__s_75,"second")||r+" ms":function(e){return e>=__d_75?Math.round(e/__d_75)+"d":e>=__h_75?Math.round(e/__h_75)+"h":e>=__m_75?Math.round(e/__m_75)+"m":e>=__s_75?Math.round(e/__s_75)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))},_$debug_73={};function __createDebug_73(e){var t;function r(){if(r.enabled){var e=r,n=+new Date,i=n-(t||n);e.diff=i,e.prev=t,e.curr=n,t=n;for(var o=new Array(arguments.length),s=0;s=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},_$browser_72.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),_$browser_72.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],_$browser_72.formatters.j=function(e){try{return JSON.stringify(e)}catch(err){return"[UnexpectedJSONParseError]: "+err.message}},_$browser_72.enable(r())}).call(this,_$browser_54);var _$componentEmitter_71={exports:{}};function Emitter(e){if(e)return function(e){for(var t in Emitter.prototype)e[t]=Emitter.prototype[t];return e}(e)}_$componentEmitter_71.exports=Emitter,Emitter.prototype.on=Emitter.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Emitter.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i0)return function(e){if(!((e=String(e)).length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*__y_29;case"days":case"day":case"d":return r*__d_29;case"hours":case"hour":case"hrs":case"hr":case"h":return r*__h_29;case"minutes":case"minute":case"mins":case"min":case"m":return r*__m_29;case"seconds":case"second":case"secs":case"sec":case"s":return r*__s_29;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}(e);if("number"===n&&!1===isNaN(e))return t.long?__plural_29(r=e,__d_29,"day")||__plural_29(r,__h_29,"hour")||__plural_29(r,__m_29,"minute")||__plural_29(r,__s_29,"second")||r+" ms":function(e){return e>=__d_29?Math.round(e/__d_29)+"d":e>=__h_29?Math.round(e/__h_29)+"h":e>=__m_29?Math.round(e/__m_29)+"m":e>=__s_29?Math.round(e/__s_29)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))},_$debug_28={};function __createDebug_28(e){var t;function r(){if(r.enabled){var e=r,n=+new Date,i=n-(t||n);e.diff=i,e.prev=t,e.curr=n,t=n;for(var o=new Array(arguments.length),s=0;s=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},_$browser_27.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),_$browser_27.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],_$browser_27.formatters.j=function(e){try{return JSON.stringify(e)}catch(err){return"[UnexpectedJSONParseError]: "+err.message}},_$browser_27.enable(r())}).call(this,_$browser_54);var indexOf=[].indexOf,_$indexof_41=function(e,t){if(indexOf)return e.indexOf(t);for(var r=0;rn&&(r=n),t>=n||t>=r||0===n)return new ArrayBuffer(0);for(var i=new Uint8Array(e),o=new Uint8Array(r-t),s=t,a=0;s=55296&&t<=56319&&i=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function createByte(e,t){return stringFromCharCode(e>>t&63|128)}function encodeCodePoint(e,t){if(0==(4294967168&e))return stringFromCharCode(e);var r="";return 0==(4294965248&e)?r=stringFromCharCode(e>>6&31|192):0==(4294901760&e)?(checkScalarValue(e,t)||(e=65533),r=stringFromCharCode(e>>12&15|224),r+=createByte(e,6)):0==(4292870144&e)&&(r=stringFromCharCode(e>>18&7|240),r+=createByte(e,12),r+=createByte(e,6)),r+stringFromCharCode(63&e|128)}function readContinuationByte(){if(byteIndex>=byteCount)throw Error("Invalid byte index");var e=255&byteArray[byteIndex];if(byteIndex++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function decodeSymbol(e){var t,r;if(byteIndex>byteCount)throw Error("Invalid byte index");if(byteIndex==byteCount)return!1;if(t=255&byteArray[byteIndex],byteIndex++,0==(128&t))return t;if(192==(224&t)){if((r=(31&t)<<6|readContinuationByte())>=128)return r;throw Error("Invalid continuation byte")}if(224==(240&t)){if((r=(15&t)<<12|readContinuationByte()<<6|readContinuationByte())>=2048)return checkScalarValue(r,e)?r:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(r=(7&t)<<18|readContinuationByte()<<12|readContinuationByte()<<6|readContinuationByte())>=65536&&r<=1114111)return r;throw Error("Invalid UTF-8 detected")}var _$utf8_32={encode:function(e,t){for(var r=!1!==(t=t||{}).strict,n=ucs2decode(e),i=n.length,o=-1,s="";++o65535&&(i+=stringFromCharCode((t-=65536)>>>10&1023|55296),t=56320|1023&t),i+=stringFromCharCode(t);return i}(i)}},_$base64Arraybuffer_4={};!function(){"use strict";for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=new Uint8Array(256),r=0;r>2],o+=e[(3&n[r])<<4|n[r+1]>>4],o+=e[(15&n[r+1])<<2|n[r+2]>>6],o+=e[63&n[r+2]];return i%3==2?o=o.substring(0,o.length-1)+"=":i%3==1&&(o=o.substring(0,o.length-2)+"=="),o},_$base64Arraybuffer_4.decode=function(e){var r,n,i,o,s,a=.75*e.length,u=e.length,l=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var c=new ArrayBuffer(a),p=new Uint8Array(c);for(r=0;r>4,p[l++]=(15&i)<<4|o>>2,p[l++]=(3&o)<<6|63&s;return c}}();var _$blob_6={},BlobBuilder=void 0!==BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,blobSupported=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),blobSupportsArrayBufferView=blobSupported&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),blobBuilderSupported=BlobBuilder&&BlobBuilder.prototype.append&&BlobBuilder.prototype.getBlob;function mapArrayBufferViews(e){return e.map(function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var r=new Uint8Array(e.byteLength);r.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=r.buffer}return t}return e})}function BlobBuilderConstructor(e,t){t=t||{};var r=new BlobBuilder;return mapArrayBufferViews(e).forEach(function(e){r.append(e)}),t.type?r.getBlob(t.type):r.getBlob()}function BlobConstructor(e,t){return new Blob(mapArrayBufferViews(e),t||{})}"undefined"!=typeof Blob&&(BlobBuilderConstructor.prototype=Blob.prototype,BlobConstructor.prototype=Blob.prototype),_$blob_6=blobSupported?blobSupportsArrayBufferView?Blob:BlobConstructor:blobBuilderSupported?BlobBuilderConstructor:void 0;var _$browser_30={},base64encoder;"undefined"!=typeof ArrayBuffer&&(base64encoder=_$base64Arraybuffer_4);var isAndroid="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),isPhantomJS="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),dontSendBlobs=isAndroid||isPhantomJS;_$browser_30.protocol=3;var packets=_$browser_30.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},packetslist=_$keys_31(packets),err={type:"error",data:"parser error"};function map(e,t,r){for(var n=new Array(e.length),i=_$after_1(e.length,r),o=function(e,r,i){t(r,function(t,r){n[e]=r,i(t,n)})},s=0;s1?{type:packetslist[i],data:t.substring(1)}:{type:packetslist[i]}:err}i=new Uint8Array(t)[0];var o=_$arraybufferSlice_2(t,1);return _$blob_6&&"blob"===r&&(o=new _$blob_6([o])),{type:packetslist[i],data:o}},_$browser_30.decodeBase64Packet=function(e,t){var r=packetslist[e.charAt(0)];if(!base64encoder)return{type:r,data:{base64:!0,data:e.substr(1)}};var n=base64encoder.decode(e.substr(1));return"blob"===t&&_$blob_6&&(n=new _$blob_6([n])),{type:r,data:n}},_$browser_30.encodePayload=function(e,t,r){"function"==typeof t&&(r=t,t=null);var n=_$hasBinary_37(e);return t&&n?_$blob_6&&!dontSendBlobs?_$browser_30.encodePayloadAsBlob(e,r):_$browser_30.encodePayloadAsArrayBuffer(e,r):e.length?void map(e,function(e,r){_$browser_30.encodePacket(e,!!n&&t,!1,function(e){r(null,function(e){return e.length+":"+e}(e))})},function(e,t){return r(t.join(""))}):r("0:")},_$browser_30.decodePayload=function(e,t,r){if("string"!=typeof e)return _$browser_30.decodePayloadAsBinary(e,t,r);var n;if("function"==typeof t&&(r=t,t=null),""===e)return r(err,0,1);for(var i,o,s="",a=0,u=e.length;a0;){for(var s=new Uint8Array(i),a=0===s[0],u="",l=1;255!==s[l];l++){if(u.length>310)return n(err,0,1);u+=s[l]}i=_$arraybufferSlice_2(i,2+u.length),u=parseInt(u);var c=_$arraybufferSlice_2(i,0,u);if(a)try{c=String.fromCharCode.apply(null,new Uint8Array(c))}catch(e){var p=new Uint8Array(c);for(c="",l=0;l0);return t}function yeast(){var e=encode(+new Date);return e!==prev?(seed=0,prev=e):e+"."+encode(seed++)}for(;__i_91';s=document.createElement(t)}catch(e){(s=document.createElement("iframe")).name=o.iframeId,s.src="javascript:0"}s.id=o.iframeId,o.form.appendChild(s),o.iframe=s}this.form.action=this.uri(),p(),t=t.replace(i,"\\\n"),this.area.value=t.replace(n,"\\n");try{this.form.submit()}catch(e){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===o.iframe.readyState&&c()}:this.iframe.onload=c}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$websocket_24={};(function(t){var r,n,i=_$browser_27("engine.io-client:websocket");if("undefined"!=typeof WebSocket)r=WebSocket;else if("undefined"!=typeof self)r=self.WebSocket||self.MozWebSocket;else try{n=_$empty_7({})}catch(e){}var o=r||n;function s(e){e&&e.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=r&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(o=n),_$transport_19.call(this,e)}_$websocket_24=s,_$componentInherit_12(s,_$transport_19),s.prototype.name="websocket",s.prototype.supportsBinary=!0,s.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=this.protocols,r={agent:this.agent,perMessageDeflate:this.perMessageDeflate};r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?t?new o(e,t):new o(e):new o(e,t,r)}catch(err){return this.emit("error",err)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},s.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},s.prototype.write=function(r){var n=this;this.writable=!1;for(var o=r.length,s=0,a=o;s0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}_$socket_18=__Socket_18,__Socket_18.priorWebsocketSuccess=!1,_$componentEmitter_26(__Socket_18.prototype),__Socket_18.protocol=_$browser_30.protocol,__Socket_18.Socket=__Socket_18,__Socket_18.Transport=_$transport_19,__Socket_18.transports=_$transports_20,__Socket_18.parser=_$browser_30,__Socket_18.prototype.createTransport=function(e){__debug_18('creating transport "%s"',e);var t=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}(this.query);t.EIO=_$browser_30.protocol,t.transport=e;var r=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new _$transports_20[e]({query:t,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0,isReactNative:this.isReactNative})},__Socket_18.prototype.open=function(){var t;if(this.rememberUpgrade&&__Socket_18.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length){var r=this;return void setTimeout(function(){r.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(e){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},__Socket_18.prototype.setTransport=function(e){__debug_18("setting transport %s",e.name);var t=this;this.transport&&(__debug_18("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},__Socket_18.prototype.probe=function(e){__debug_18('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),r=!1,n=this;function i(){if(n.onlyBinaryUpgrades){var i=!this.supportsBinary&&n.transport.supportsBinary;r=r||i}r||(__debug_18('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(i){if(!r)if("pong"===i.type&&"probe"===i.data){if(__debug_18('probe transport "%s" pong',e),n.upgrading=!0,n.emit("upgrading",t),!t)return;__Socket_18.priorWebsocketSuccess="websocket"===t.name,__debug_18('pausing current transport "%s"',n.transport.name),n.transport.pause(function(){r||"closed"!==n.readyState&&(__debug_18("changing transport and sending upgrade packet"),c(),n.setTransport(t),t.send([{type:"upgrade"}]),n.emit("upgrade",t),t=null,n.upgrading=!1,n.flush())})}else{__debug_18('probe transport "%s" failed',e);var o=new Error("probe error");o.transport=t.name,n.emit("upgradeError",o)}}))}function o(){r||(r=!0,c(),t.close(),t=null)}function s(r){var i=new Error("probe error: "+r);i.transport=t.name,o(),__debug_18('probe transport "%s" failed because of error: %s',e,r),n.emit("upgradeError",i)}function a(){s("transport closed")}function u(){s("socket closed")}function l(e){t&&e.name!==t.name&&(__debug_18('"%s" works - aborting "%s"',e.name,t.name),o())}function c(){t.removeListener("open",i),t.removeListener("error",s),t.removeListener("close",a),n.removeListener("close",u),n.removeListener("upgrading",l)}__Socket_18.priorWebsocketSuccess=!1,t.once("open",i),t.once("error",s),t.once("close",a),this.once("close",u),this.once("upgrading",l),t.open()},__Socket_18.prototype.onOpen=function(){if(__debug_18("socket open"),this.readyState="open",__Socket_18.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){__debug_18("starting upgrade probes");for(var e=0,t=this.upgrades.length;e0&&e.jitter<=1?e.jitter:0,this.attempts=0}_$backo2_3=Backoff,Backoff.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-r:e+r}return 0|Math.min(e,this.max)},Backoff.prototype.reset=function(){this.attempts=0},Backoff.prototype.setMin=function(e){this.ms=e},Backoff.prototype.setMax=function(e){this.max=e},Backoff.prototype.setJitter=function(e){this.jitter=e};var _$manager_60={},__debug_60=_$browser_65("socket.io-client:manager"),__has_60=Object.prototype.hasOwnProperty;function Manager(e,t){if(!(this instanceof Manager))return new Manager(e,t);e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new _$backo2_3({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=t.parser||_$socketIoParser_69;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}_$manager_60=Manager,Manager.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)__has_60.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},Manager.prototype.updateSocketIds=function(){for(var e in this.nsps)__has_60.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},Manager.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},_$componentEmitter_64(Manager.prototype),Manager.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},Manager.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},Manager.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},Manager.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},Manager.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},Manager.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},Manager.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},Manager.prototype.open=Manager.prototype.connect=function(e,t){if(__debug_60("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;__debug_60("opening %s",this.uri),this.engine=_$lib_17(this.uri,this.opts);var r=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var i=_$on_61(r,"open",function(){n.onopen(),e&&e()}),o=_$on_61(r,"error",function(t){if(__debug_60("connect_error"),n.cleanup(),n.readyState="closed",n.emitAll("connect_error",t),e){var r=new Error("Connection error");r.data=t,e(r)}else n.maybeReconnectOnOpen()});if(!1!==this._timeout){var s=this._timeout;__debug_60("connect attempt will timeout after %d",s);var a=setTimeout(function(){__debug_60("connect attempt timed out after %d",s),i.destroy(),r.close(),r.emit("error","timeout"),n.emitAll("connect_timeout",s)},s);this.subs.push({destroy:function(){clearTimeout(a)}})}return this.subs.push(i),this.subs.push(o),this},Manager.prototype.onopen=function(){__debug_60("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(_$on_61(e,"data",_$componentBind_10(this,"ondata"))),this.subs.push(_$on_61(e,"ping",_$componentBind_10(this,"onping"))),this.subs.push(_$on_61(e,"pong",_$componentBind_10(this,"onpong"))),this.subs.push(_$on_61(e,"error",_$componentBind_10(this,"onerror"))),this.subs.push(_$on_61(e,"close",_$componentBind_10(this,"onclose"))),this.subs.push(_$on_61(this.decoder,"decoded",_$componentBind_10(this,"ondecoded")))},Manager.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},Manager.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},Manager.prototype.ondata=function(e){this.decoder.add(e)},Manager.prototype.ondecoded=function(e){this.emit("packet",e)},Manager.prototype.onerror=function(e){__debug_60("error",e),this.emitAll("error",e)},Manager.prototype.socket=function(e,t){var r=this.nsps[e];if(!r){r=new _$socket_62(this,e,t),this.nsps[e]=r;var n=this;r.on("connecting",i),r.on("connect",function(){r.id=n.generateId(e)}),this.autoConnect&&i()}function i(){~_$indexof_41(n.connecting,r)||n.connecting.push(r)}return r},Manager.prototype.destroy=function(e){var t=_$indexof_41(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},Manager.prototype.packet=function(e){__debug_60("writing packet %j",e);var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,function(r){for(var n=0;n0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},Manager.prototype.cleanup=function(){__debug_60("cleanup");for(var e=this.subs.length,t=0;t=this._reconnectionAttempts)__debug_60("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();__debug_60("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var r=setTimeout(function(){e.skipReconnect||(__debug_60("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open(function(t){t?(__debug_60("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(__debug_60("reconnect success"),e.onreconnect())}))},t);this.subs.push({destroy:function(){clearTimeout(r)}})}},Manager.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)};var _$componentEmitter_11={exports:{}};function __Emitter_11(e){if(e)return function(e){for(var t in __Emitter_11.prototype)e[t]=__Emitter_11.prototype[t];return e}(e)}_$componentEmitter_11.exports=__Emitter_11,__Emitter_11.prototype.on=__Emitter_11.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},__Emitter_11.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},__Emitter_11.prototype.off=__Emitter_11.prototype.removeListener=__Emitter_11.prototype.removeAllListeners=__Emitter_11.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i=statusOrder.indexOf(t)}var TransloaditAssembly=function(e){var t,r;function n(t){var r;return(r=e.call(this)||this).status=t,r.socket=null,r.pollInterval=null,r.closed=!1,r}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.connect=function(){this._connectSocket(),this._beginPolling()},i._onFinished=function(){this.emit("finished"),this.close()},i._connectSocket=function(){var e=this,t=_$parseUrl_181(this.status.websocket_url),r=io().connect(t.origin,{transports:["websocket"],path:t.pathname});r.on("connect",function(){r.emit("assembly_connect",{id:e.status.assembly_id}),e.emit("connect")}),r.on("error",function(){r.disconnect(),e.socket=null}),r.on("assembly_finished",function(){e._onFinished()}),r.on("assembly_upload_finished",function(t){e.emit("upload",t),e.status.uploads.push(t)}),r.on("assembly_uploading_finished",function(){e.emit("executing")}),r.on("assembly_upload_meta_data_extracted",function(){e.emit("metadata"),e._fetchStatus({diff:!1})}),r.on("assembly_result_finished",function(t,r){e.emit("result",t,r),e.status.results[t]||(e.status.results[t]=[]),e.status.results[t].push(r)}),r.on("assembly_error",function(t){e._onError(t),e._fetchStatus({diff:!1})}),this.socket=r},i._onError=function(e){this.emit("error",___extends_176(new Error(e.message),e))},i._beginPolling=function(){var e=this;this.pollInterval=setInterval(function(){e.socket&&e.socket.connected||e._fetchStatus()},2e3)},i._fetchStatus=function(e){var t=this,r=(void 0===e?{}:e).diff,n=void 0===r||r;return fetch(this.status.assembly_ssl_url).then(function(e){return e.json()}).then(function(e){t.closed||(t.emit("status",e),n?t.updateStatus(e):t.status=e)})},i.update=function(){return this._fetchStatus({diff:!0})},i.updateStatus=function(e){this._diffStatus(this.status,e),this.status=e},i._diffStatus=function(e,t){var r=this,n=e.ok,i=t.ok;if(t.error&&!e.error)return this._onError(t);var o=isStatus(i,"ASSEMBLY_EXECUTING")&&!isStatus(n,"ASSEMBLY_EXECUTING");o&&this.emit("executing"),Object.keys(t.uploads).filter(function(t){return!_$hasProperty_211(e.uploads,t)}).map(function(e){return t.uploads[e]}).forEach(function(e){r.emit("upload",e)}),o&&this.emit("metadata"),Object.keys(t.results).forEach(function(n){var i=t.results[n],o=e.results[n];i.filter(function(e){return!o||!o.some(function(t){return t.id===e.id})}).forEach(function(e){r.emit("result",n,e)})}),isStatus(i,"ASSEMBLY_COMPLETED")&&!isStatus(n,"ASSEMBLY_COMPLETED")&&this.emit("finished")},i.close=function(){this.closed=!0,this.socket&&(this.socket.disconnect(),this.socket=null),clearInterval(this.pollInterval)},n}(_$componentEmitter_11),_$TransloaditAssembly_176=TransloaditAssembly,_$Client_179=function(){function e(e){void 0===e&&(e={}),this.opts=e,this._reportError=this._reportError.bind(this),this._headers={"Transloadit-Client":this.opts.client}}var t=e.prototype;return t.createAssembly=function(e){var t=this,r=(e.templateId,e.params),n=e.fields,i=e.signature,o=e.expectedFiles,s=new FormData;s.append("params","string"==typeof r?r:JSON.stringify(r)),i&&s.append("signature",i),Object.keys(n).forEach(function(e){s.append(e,n[e])}),s.append("num_expected_upload_files",o);var a=this.opts.service+"/assemblies";return fetch(a,{method:"post",headers:this._headers,body:s}).then(function(e){return e.json()}).then(function(e){if(e.error){var t=new Error(e.error);throw t.details=e.message,t.assembly=e,e.assembly_id&&(t.details+=" Assembly ID: "+e.assembly_id),t}return e}).catch(function(e){return t._reportError(e,{url:a,type:"API_ERROR"})})},t.reserveFile=function(e,t){var r=this,n=encodeURIComponent(t.size),i=e.assembly_ssl_url+"/reserve_file?size="+n;return fetch(i,{method:"post",headers:this._headers}).then(function(e){return e.json()}).catch(function(n){return r._reportError(n,{assembly:e,file:t,url:i,type:"API_ERROR"})})},t.addFile=function(e,t){var r=this;if(!t.uploadURL)return Promise.reject(new Error("File does not have an `uploadURL`."));var n=encodeURIComponent(t.size),i=encodeURIComponent(t.uploadURL),o="size="+n+"&filename="+encodeURIComponent(t.name)+"&fieldname=file&s3Url="+i,s=e.assembly_ssl_url+"/add_file?"+o;return fetch(s,{method:"post",headers:this._headers}).then(function(e){return e.json()}).catch(function(n){return r._reportError(n,{assembly:e,file:t,url:s,type:"API_ERROR"})})},t.cancelAssembly=function(e){var t=this,r=e.assembly_ssl_url;return fetch(r,{method:"delete",headers:this._headers}).then(function(e){return e.json()}).catch(function(e){return t._reportError(e,{url:r,type:"API_ERROR"})})},t.getAssemblyStatus=function(e){var t=this;return fetch(e,{headers:this._headers}).then(function(e){return e.json()}).catch(function(r){return t._reportError(r,{url:e,type:"STATUS_ERROR"})})},t.submitError=function(e,t){var r=t.endpoint,n=t.instance,i=t.assembly,o=e.details?e.message+" ("+e.details+")":e.message;return fetch("https://status.transloadit.com/client_error",{method:"post",body:JSON.stringify({endpoint:r,instance:n,assembly_id:i,agent:"undefined"!=typeof navigator?navigator.userAgent:"",client:this.opts.client,error:o})}).then(function(e){return e.json()})},t._reportError=function(e,t){if(!1===this.opts.errorReporting)throw e;var r={type:t.type};throw t.assembly&&(r.assembly=t.assembly.assembly_id,r.instance=t.assembly.instance),t.url&&(r.endpoint=t.url),this.submitError(e,r).catch(function(e){}),e},e}(),_$AssemblyOptions_177={};function validateParams(e){if(!e)throw new Error("Transloadit: The `params` option is required.");if("string"==typeof e)try{e=JSON.parse(e)}catch(err){throw err.message="Transloadit: The `params` option is a malformed JSON string: "+err.message,err}if(!e.auth||!e.auth.key)throw new Error("Transloadit: The `params.auth.key` option is required. You can find your Transloadit API key at https://transloadit.com/account/api-settings.")}var AssemblyOptions=function(){function e(e,t){this.files=e,this.opts=t}var t=e.prototype;return t._normalizeAssemblyOptions=function(e,t){if(Array.isArray(t.fields)){var r=t.fields;t.fields={},r.forEach(function(r){t.fields[r]=e.meta[r]})}return t.fields||(t.fields={}),t},t._getAssemblyOptions=function(e){var t=this,r=this.opts;return Promise.resolve().then(function(){return r.getAssemblyOptions(e,r)}).then(function(r){return t._normalizeAssemblyOptions(e,r)}).then(function(t){return validateParams(t.params),{fileIDs:[e.id],options:t}})},t._dedupe=function(e){var t=Object.create(null);return e.forEach(function(e){var r,n=e.fileIDs,i=e.options,o=JSON.stringify(i);t[o]?(r=t[o].fileIDs).push.apply(r,n):t[o]={options:i,fileIDs:[].concat(n)}}),Object.keys(t).map(function(e){return t[e]})},t.build=function(){var e=this,t=this.opts;return this.files.length>0?Promise.all(this.files.map(function(t){return e._getAssemblyOptions(t)})).then(function(t){return e._dedupe(t)}):t.alwaysRunAssembly?Promise.resolve(t.getAssemblyOptions(null,t)).then(function(t){return validateParams(t.params),[{fileIDs:e.files.map(function(e){return e.id}),options:t}]}):Promise.resolve([])},e}();function ___assertThisInitialized_178(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}_$AssemblyOptions_177=AssemblyOptions,_$AssemblyOptions_177.validateParams=validateParams;var TransloaditAssemblyWatcher=function(e){var t,r;function n(t,r){var n;return(n=e.call(this)||this)._uppy=t,n._assemblyIDs=r,n._remaining=r.length,n.promise=new Promise(function(e,t){n._resolve=e,n._reject=t}),n._onAssemblyComplete=n._onAssemblyComplete.bind(___assertThisInitialized_178(n)),n._onAssemblyCancel=n._onAssemblyCancel.bind(___assertThisInitialized_178(n)),n._onAssemblyError=n._onAssemblyError.bind(___assertThisInitialized_178(n)),n._onImportError=n._onImportError.bind(___assertThisInitialized_178(n)),n._addListeners(),n}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i._watching=function(e){return-1!==this._assemblyIDs.indexOf(e)},i._onAssemblyComplete=function(e){this._watching(e.assembly_id)&&(this._uppy.log("[Transloadit] AssemblyWatcher: Got Assembly finish "+e.assembly_id),this.emit("assembly-complete",e.assembly_id),this._checkAllComplete())},i._onAssemblyCancel=function(e){this._watching(e.assembly_id)&&this._checkAllComplete()},i._onAssemblyError=function(e,t){this._watching(e.assembly_id)&&(this._uppy.log("[Transloadit] AssemblyWatcher: Got Assembly error "+e.assembly_id),this._uppy.log(t),this.emit("assembly-error",e.assembly_id,t),this._checkAllComplete())},i._onImportError=function(e,t,r){this._watching(e.assembly_id)&&this._onAssemblyError(e,r)},i._checkAllComplete=function(){this._remaining-=1,0===this._remaining&&(this._removeListeners(),this._resolve())},i._removeListeners=function(){this._uppy.off("transloadit:complete",this._onAssemblyComplete),this._uppy.off("transloadit:assembly-cancel",this._onAssemblyCancel),this._uppy.off("transloadit:assembly-error",this._onAssemblyError),this._uppy.off("transloadit:import-error",this._onImportError)},i._addListeners=function(){this._uppy.on("transloadit:complete",this._onAssemblyComplete),this._uppy.on("transloadit:assembly-cancel",this._onAssemblyCancel),this._uppy.on("transloadit:assembly-error",this._onAssemblyError),this._uppy.on("transloadit:import-error",this._onImportError)},n}(_$componentEmitter_11),_$TransloaditAssemblyWatcher_178=TransloaditAssemblyWatcher,_$lib_180={},___class_180,___temp_180;function ___extends_180(){return(___extends_180=Object.assign||function(e){for(var t=1;t=200&&e<300}};if(n.opts=___extends_231({},i,{},r),n.i18nInit(),n.handleUpload=n.handleUpload.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n)),n.opts.__queue instanceof _$RateLimitedQueue_191?n.requests=n.opts.__queue:n.requests=new _$RateLimitedQueue_191(n.opts.limit),n.opts.bundle&&!n.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");return n.uploaderEvents=Object.create(null),n}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.setOptions=function(t){e.prototype.setOptions.call(this,t),this.i18nInit()},i.i18nInit=function(){this.translator=new _$Translator_192([this.defaultLocale,this.uppy.locale,this.opts.locale]),this.i18n=this.translator.translate.bind(this.translator),this.setPluginState()},i.getOptions=function(e){var t=this.uppy.getState().xhrUpload,r=___extends_231({},this.opts,{},t||{},{},e.xhrUpload||{},{headers:{}});return ___extends_231(r.headers,this.opts.headers),t&&___extends_231(r.headers,t.headers),e.xhrUpload&&___extends_231(r.headers,e.xhrUpload.headers),r},i.addMetadata=function(e,t,r){(Array.isArray(r.metaFields)?r.metaFields:Object.keys(t)).forEach(function(r){e.append(r,t[r])})},i.createFormDataUpload=function(e,t){var r=new FormData;this.addMetadata(r,e.meta,t);var n=setTypeInBlob(e);return e.name?r.append(t.fieldName,n,e.meta.name):r.append(t.fieldName,n),r},i.createBundledUpload=function(e,t){var r=this,n=new FormData,i=this.uppy.getState().meta;return this.addMetadata(n,i,t),e.forEach(function(e){var t=r.getOptions(e),i=setTypeInBlob(e);e.name?n.append(t.fieldName,i,e.name):n.append(t.fieldName,i)}),n},i.createBareUpload=function(e,t){return e.data},i.upload=function(e,t,r){var n=this,i=this.getOptions(e);return this.uppy.log("uploading "+t+" of "+r),new Promise(function(t,r){n.uppy.emit("upload-started",e);var o=i.formData?n.createFormDataUpload(e,i):n.createBareUpload(e,i),s=new XMLHttpRequest;n.uploaderEvents[e.id]=new _$EventTracker_187(n.uppy);var a=new _$ProgressTimeout_190(i.timeout,function(){s.abort(),l.done();var t=new Error(n.i18n("timedOut",{seconds:Math.ceil(i.timeout/1e3)}));n.uppy.emit("upload-error",e,t),r(t)}),u=_$cuid_13();s.upload.addEventListener("loadstart",function(e){n.uppy.log("[XHRUpload] "+u+" started")}),s.upload.addEventListener("progress",function(t){n.uppy.log("[XHRUpload] "+u+" progress: "+t.loaded+" / "+t.total),a.progress(),t.lengthComputable&&n.uppy.emit("upload-progress",e,{uploader:n,bytesUploaded:t.loaded,bytesTotal:t.total})}),s.addEventListener("load",function(o){if(n.uppy.log("[XHRUpload] "+u+" finished"),a.done(),l.done(),n.uploaderEvents[e.id]&&(n.uploaderEvents[e.id].remove(),n.uploaderEvents[e.id]=null),i.validateStatus(o.target.status,s.responseText,s)){var c=i.getResponseData(s.responseText,s),p=c[i.responseUrlFieldName],d={status:o.target.status,body:c,uploadURL:p};return n.uppy.emit("upload-success",e,d),p&&n.uppy.log("Download "+e.name+" from "+p),t(e)}var h=i.getResponseData(s.responseText,s),_=__buildResponseError_231(s,i.getResponseError(s.responseText,s)),f={status:o.target.status,body:h};return n.uppy.emit("upload-error",e,_,f),r(_)}),s.addEventListener("error",function(t){n.uppy.log("[XHRUpload] "+u+" errored"),a.done(),l.done(),n.uploaderEvents[e.id]&&(n.uploaderEvents[e.id].remove(),n.uploaderEvents[e.id]=null);var o=__buildResponseError_231(s,i.getResponseError(s.responseText,s));return n.uppy.emit("upload-error",e,o),r(o)}),s.open(i.method.toUpperCase(),i.endpoint,!0),s.withCredentials=i.withCredentials,""!==i.responseType&&(s.responseType=i.responseType),Object.keys(i.headers).forEach(function(e){s.setRequestHeader(e,i.headers[e])});var l=n.requests.run(function(){return s.send(o),function(){a.done(),s.abort()}});n.onFileRemove(e.id,function(){l.abort(),r(new Error("File removed"))}),n.onCancelAll(e.id,function(){l.abort(),r(new Error("Upload cancelled"))})})},i.uploadRemote=function(e,t,r){var n=this,i=this.getOptions(e);return new Promise(function(t,r){n.uppy.emit("upload-started",e);var o={};(Array.isArray(i.metaFields)?i.metaFields:Object.keys(e.meta)).forEach(function(t){o[t]=e.meta[t]}),new(e.remote.providerOptions.provider?__Provider_231:__RequestClient_231)(n.uppy,e.remote.providerOptions).post(e.remote.url,___extends_231({},e.remote.body,{endpoint:i.endpoint,size:e.data.size,fieldname:i.fieldName,metadata:o,httpMethod:i.method,useFormData:i.formData,headers:i.headers})).then(function(o){var s=o.token,a=_$getSocketHost_208(e.remote.companionUrl),u=new __Socket_231({target:a+"/api/"+s,autoOpen:!1});n.uploaderEvents[e.id]=new _$EventTracker_187(n.uppy),n.onFileRemove(e.id,function(){u.send("pause",{}),l.abort(),t("upload "+e.id+" was removed")}),n.onCancelAll(e.id,function(){u.send("pause",{}),l.abort(),t("upload "+e.id+" was canceled")}),n.onRetry(e.id,function(){u.send("pause",{}),u.send("resume",{})}),n.onRetryAll(e.id,function(){u.send("pause",{}),u.send("resume",{})}),u.on("progress",function(t){return _$emitSocketProgress_195(n,t,e)}),u.on("success",function(r){var o=i.getResponseData(r.response.responseText,r.response),s=o[i.responseUrlFieldName],a={status:r.response.status,body:o,uploadURL:s};return n.uppy.emit("upload-success",e,a),l.done(),n.uploaderEvents[e.id]&&(n.uploaderEvents[e.id].remove(),n.uploaderEvents[e.id]=null),t()}),u.on("error",function(t){var o=t.response,s=o?i.getResponseError(o.responseText,o):___extends_231(new Error(t.error.message),{cause:t.error});n.uppy.emit("upload-error",e,s),l.done(),n.uploaderEvents[e.id]&&(n.uploaderEvents[e.id].remove(),n.uploaderEvents[e.id]=null),r(s)});var l=n.requests.run(function(){return u.open(),e.isPaused&&u.send("pause",{}),function(){return u.close()}})}).catch(function(t){n.uppy.emit("upload-error",e,t),r(t)})})},i.uploadBundle=function(e){var t=this;return new Promise(function(r,n){var i=t.opts.endpoint,o=t.opts.method,s=t.uppy.getState().xhrUpload,a=t.createBundledUpload(e,___extends_231({},t.opts,{},s||{})),u=new XMLHttpRequest,l=new _$ProgressTimeout_190(t.opts.timeout,function(){u.abort();var e=new Error(t.i18n("timedOut",{seconds:Math.ceil(t.opts.timeout/1e3)}));c(e),n(e)}),c=function(r){e.forEach(function(e){t.uppy.emit("upload-error",e,r)})};u.upload.addEventListener("loadstart",function(e){t.uppy.log("[XHRUpload] started uploading bundle"),l.progress()}),u.upload.addEventListener("progress",function(r){l.progress(),r.lengthComputable&&e.forEach(function(e){t.uppy.emit("upload-progress",e,{uploader:t,bytesUploaded:r.loaded/r.total*e.size,bytesTotal:e.size})})}),u.addEventListener("load",function(i){if(l.done(),t.opts.validateStatus(i.target.status,u.responseText,u)){var o=t.opts.getResponseData(u.responseText,u),s={status:i.target.status,body:o};return e.forEach(function(e){t.uppy.emit("upload-success",e,s)}),r()}var a=t.opts.getResponseError(u.responseText,u)||new Error("Upload error");return a.request=u,c(a),n(a)}),u.addEventListener("error",function(e){l.done();var r=t.opts.getResponseError(u.responseText,u)||new Error("Upload error");return c(r),n(r)}),t.uppy.on("cancel-all",function(){l.done(),u.abort()}),u.open(o.toUpperCase(),i,!0),u.withCredentials=t.opts.withCredentials,""!==t.opts.responseType&&(u.responseType=t.opts.responseType),Object.keys(t.opts.headers).forEach(function(e){u.setRequestHeader(e,t.opts.headers[e])}),u.send(a),e.forEach(function(e){t.uppy.emit("upload-started",e)})})},i.uploadFiles=function(e){var t=this,r=e.map(function(r,n){var i=parseInt(n,10)+1,o=e.length;return r.error?Promise.reject(new Error(r.error)):r.isRemote?t.uploadRemote(r,i,o):t.upload(r,i,o)});return _$settle_220(r)},i.onFileRemove=function(e,t){this.uploaderEvents[e].on("file-removed",function(r){e===r.id&&t(r.id)})},i.onRetry=function(e,t){this.uploaderEvents[e].on("upload-retry",function(r){e===r&&t()})},i.onRetryAll=function(e,t){var r=this;this.uploaderEvents[e].on("retry-all",function(n){r.uppy.getFile(e)&&t()})},i.onCancelAll=function(e,t){var r=this;this.uploaderEvents[e].on("cancel-all",function(){r.uppy.getFile(e)&&t()})},i.handleUpload=function(e){var t=this;if(0===e.length)return this.uppy.log("[XHRUpload] No files to upload!"),Promise.resolve();0!==this.opts.limit||this.opts.__queue||this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");var r=e.map(function(e){return t.uppy.getFile(e)});if(this.opts.bundle){if(r.some(function(e){return e.isRemote}))throw new Error("Can\u2019t upload remote files when bundle: true option is set");return this.uploadBundle(r)}return this.uploadFiles(r).then(function(){return null})},i.install=function(){if(this.opts.bundle){var e=this.uppy.getState().capabilities;this.uppy.setState({capabilities:___extends_231({},e,{individualCancellation:!1})})}this.uppy.addUploader(this.handleUpload)},i.uninstall=function(){if(this.opts.bundle){var e=this.uppy.getState().capabilities;this.uppy.setState({capabilities:___extends_231({},e,{individualCancellation:!0})})}this.uppy.removeUploader(this.handleUpload)},n}(__Plugin_231),___class_231.VERSION="1.5.11",___temp_231),_$lib_36={__esModule:!0};_$lib_36.default=getFormData,_$lib_36.getFieldData=getFieldData;var NODE_LIST_CLASSES={"[object HTMLCollection]":!0,"[object NodeList]":!0,"[object RadioNodeList]":!0},IGNORED_ELEMENT_TYPES={button:!0,fieldset:!0,reset:!0,submit:!0},CHECKED_INPUT_TYPES={checkbox:!0,radio:!0},TRIM_RE=/^\s+|\s+$/g,__slice_36=Array.prototype.slice,__toString_36=Object.prototype.toString,___class_136,___temp_136;function getFormData(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{trim:!1};if(!e)throw new Error("A form is required by getFormData, was given form="+e);for(var r={},n=void 0,i=[],o={},s=0,a=e.elements.length;s2&&void 0!==arguments[2]?arguments[2]:{trim:!1};if(!e)throw new Error("A form is required by getFieldData, was given form="+e);if(!t&&"[object String]"!==__toString_36.call(t))throw new Error("A field name is required by getFieldData, was given fieldName="+t);var n=e.elements[t];if(!n||n.disabled)return null;if(!NODE_LIST_CLASSES[__toString_36.call(n)])return getFormElementValue(n,r.trim);for(var i=[],o=!0,s=0,a=n.length;s0?i:null}function getFormElementValue(e,t){var r=null,n=e.type;if("select-one"===n)return e.options.length&&(r=e.options[e.selectedIndex].value),r;if("select-multiple"===n){r=[];for(var i=0,o=e.options.length;i target element passed in options to operate, none was found","error")},i.uninstall=function(){this.form.removeEventListener("submit",this.handleFormSubmit),this.uppy.off("upload",this.handleUploadStart),this.uppy.off("complete",this.handleSuccess)},n}(__Plugin_136),___class_136.VERSION="1.3.15",___temp_136),_$ServiceWorkerStore_139={},isSupported="undefined"!=typeof navigator&&"serviceWorker"in navigator,ServiceWorkerStore=function(){function e(e){this.ready=new Promise(function(e,t){isSupported?navigator.serviceWorker.controller?e():navigator.serviceWorker.addEventListener("controllerchange",function(){e()}):t(new Error("Unsupported"))}),this.name=e.storeName}var t=e.prototype;return t.list=function(){var e=this,t={},r=new Promise(function(e,r){t.resolve=e,t.reject=r});console.log("Loading stored blobs from Service Worker");var n=function r(n){if(n.data.store===e.name)switch(n.data.type){case"uppy/ALL_FILES":t.resolve(n.data.files),navigator.serviceWorker.removeEventListener("message",r)}};return this.ready.then(function(){navigator.serviceWorker.addEventListener("message",n),navigator.serviceWorker.controller.postMessage({type:"uppy/GET_FILES",store:e.name})}),r},t.put=function(e){var t=this;return this.ready.then(function(){navigator.serviceWorker.controller.postMessage({type:"uppy/ADD_FILE",store:t.name,file:e})})},t.delete=function(e){var t=this;return this.ready.then(function(){navigator.serviceWorker.controller.postMessage({type:"uppy/REMOVE_FILE",store:t.name,fileID:e})})},e}();ServiceWorkerStore.isSupported=isSupported,_$ServiceWorkerStore_139=ServiceWorkerStore;var _$prettierBytes_141=function(e){if("number"!=typeof e||isNaN(e))throw new TypeError("Expected a number, got "+typeof e);var t=e<0,r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return(t?"-":"")+e+" B";var n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),r.length-1);e=Number(e/Math.pow(1024,n));var i=r[n];return e>=10||e%1==0?(t?"-":"")+e.toFixed(0)+" "+i:(t?"-":"")+e.toFixed(1)+" "+i},_$IndexedDBStore_137={};function ___extends_137(){return(___extends_137=Object.assign||function(e){for(var t=1;tthis.opts.maxFileSize?Promise.reject(new Error("File is too big to store.")):this.getSize().then(function(e){return e>t.opts.maxTotalSize?Promise.reject(new Error("No space left")):t.ready}).then(function(r){return waitForRequest(r.transaction([STORE_NAME],"readwrite").objectStore(STORE_NAME).add({id:t.key(e.id),fileID:e.id,store:t.name,expires:Date.now()+t.opts.expires,data:e.data}))})},t.delete=function(e){var t=this;return this.ready.then(function(r){return waitForRequest(r.transaction([STORE_NAME],"readwrite").objectStore(STORE_NAME).delete(t.key(e)))})},e.cleanup=function(){return connect(DB_NAME).then(function(e){var t=e.transaction([STORE_NAME],"readwrite").objectStore(STORE_NAME).index("expires").openCursor(IDBKeyRange.upperBound(Date.now()));return new Promise(function(r,n){t.onsuccess=function(t){var n=t.target.result;if(n){var i=n.value;console.log("[IndexedDBStore] Deleting record",i.fileID,"of size",_$prettierBytes_141(i.data.size),"- expired on",new Date(i.expires)),n.delete(),n.continue()}else r(e)},t.onerror=n})}).then(function(e){e.close()})},e}();function ___extends_138(){return(___extends_138=Object.assign||function(e){for(var t=1;t0)return e.uppy.log("[GoldenRetriever] Successfully recovered "+r+" blobs from IndexedDB!"),e.uppy.info("Successfully recovered "+r+" files","success",3e3),e.onBlobsLoaded(t);e.uppy.log("[GoldenRetriever] No blobs found in IndexedDB")}).catch(function(t){e.uppy.log("[GoldenRetriever] Failed to recover blobs from IndexedDB","warning"),e.uppy.log(t)})},i.onBlobsLoaded=function(e){var t=this,r=[],n=___extends_140({},this.uppy.getState().files);Object.keys(e).forEach(function(i){var o=t.uppy.getFile(i);if(o){var s=___extends_140({},o,{data:e[i],isRestored:!0});n[i]=s}else r.push(i)}),this.uppy.setState({files:n}),this.uppy.emit("restored",this.savedPluginData),r.length&&this.deleteBlobs(r).then(function(){t.uppy.log("[GoldenRetriever] Cleaned up "+r.length+" old files")}).catch(function(e){t.uppy.log("[GoldenRetriever] Could not clean up "+r.length+" old files","warning"),t.uppy.log(e)})},i.deleteBlobs=function(e){var t=this,r=[];return e.forEach(function(e){t.ServiceWorkerStore&&r.push(t.ServiceWorkerStore.delete(e)),t.IndexedDBStore&&r.push(t.IndexedDBStore.delete(e))}),Promise.all(r)},i.install=function(){var e=this;this.loadFilesStateFromLocalStorage(),this.uppy.getFiles().length>0?this.ServiceWorkerStore?(this.uppy.log("[GoldenRetriever] Attempting to load files from Service Worker..."),this.loadFileBlobsFromServiceWorker()):(this.uppy.log("[GoldenRetriever] Attempting to load files from Indexed DB..."),this.loadFileBlobsFromIndexedDB()):(this.uppy.log("[GoldenRetriever] No files need to be loaded, only restoring processing state..."),this.onBlobsLoaded([])),this.uppy.on("file-added",function(t){t.isRemote||(e.ServiceWorkerStore&&e.ServiceWorkerStore.put(t).catch(function(t){e.uppy.log("[GoldenRetriever] Could not store file","warning"),e.uppy.log(t)}),e.IndexedDBStore.put(t).catch(function(t){e.uppy.log("[GoldenRetriever] Could not store file","warning"),e.uppy.log(t)}))}),this.uppy.on("file-removed",function(t){e.ServiceWorkerStore&&e.ServiceWorkerStore.delete(t.id).catch(function(t){e.uppy.log("[GoldenRetriever] Failed to remove file","warning"),e.uppy.log(t)}),e.IndexedDBStore.delete(t.id).catch(function(t){e.uppy.log("[GoldenRetriever] Failed to remove file","warning"),e.uppy.log(t)})}),this.uppy.on("complete",function(t){var r=t.successful,n=r.map(function(e){return e.id});e.deleteBlobs(n).then(function(){e.uppy.log("[GoldenRetriever] Removed "+r.length+" files that finished uploading")}).catch(function(t){e.uppy.log("[GoldenRetriever] Could not remove "+r.length+" files that finished uploading","warning"),e.uppy.log(t)})}),this.uppy.on("state-update",this.saveFilesStateToLocalStorage),this.uppy.on("restored",function(){var t=e.uppy.getState().currentUploads;t&&Object.keys(t).forEach(function(r){e.uppy.restore(r,t[r])})})},n}(__Plugin_140),___class_140.VERSION="1.3.14",___temp_140),___class_160,___temp_160;function ___extends_160(){return(___extends_160=Object.assign||function(e){for(var t=1;t