uppy
Version:
Extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:
1 lines • 294 kB
JavaScript
!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 e={exports:{}};!function(){"use strict";function t(e,t){var o,r,n,i,s=_;for(i=arguments.length;i-- >2;)S.push(arguments[i]);for(t&&null!=t.children&&(S.length||S.push(t.children),delete t.children);S.length;)if((r=S.pop())&&void 0!==r.pop)for(i=r.length;i--;)S.push(r[i]);else"boolean"==typeof r&&(r=null),(n="function"!=typeof e)&&(null==r?r="":"number"==typeof r?r=String(r):"string"!=typeof r&&(n=!1)),n&&o?s[s.length-1]+=r:s===_?s=[r]:s.push(r),o=n;var a=new function(){};return a.nodeName=e,a.children=s,a.attributes=null==t?void 0:t,a.key=null==t?void 0:t.key,void 0!==w.vnode&&w.vnode(a),a}function o(e,t){for(var o in t)e[o]=t[o];return e}function r(e){!e.__d&&(e.__d=!0)&&1==x.push(e)&&(w.debounceRendering||P)(n)}function n(){var e,t=x;for(x=[];e=t.pop();)e.__d&&m(e)}function i(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function s(e){var t=o({},e.attributes);t.children=e.children;var r=e.nodeName.defaultProps;if(void 0!==r)for(var n in r)void 0===t[n]&&(t[n]=r[n]);return t}function a(e){var t=e.parentNode;t&&t.removeChild(e)}function l(e,t,o,r,n){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)o&&o(null),r&&r(e);else if("class"!==t||n)if("style"===t){if(r&&"string"!=typeof r&&"string"!=typeof o||(e.style.cssText=r||""),r&&"object"==typeof r){if("string"!=typeof o)for(var i in o)i in r||(e.style[i]="");for(var i in r)e.style[i]="number"==typeof r[i]&&!1===k.test(i)?r[i]+"px":r[i]}}else if("dangerouslySetInnerHTML"===t)r&&(e.innerHTML=r.__html||"");else if("o"==t[0]&&"n"==t[1]){var s=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),r?o||e.addEventListener(t,u,s):e.removeEventListener(t,u,s),(e.__l||(e.__l={}))[t]=r}else if("list"!==t&&"type"!==t&&!n&&t in e)!function(e,t,o){try{e[t]=o}catch(e){}}(e,t,null==r?"":r),null!=r&&!1!==r||e.removeAttribute(t);else{var a=n&&t!==(t=t.replace(/^xlink\:?/,""));null==r||!1===r?a?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof r&&(a?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),r):e.setAttribute(t,r))}else e.className=r||""}function u(e){return this.__l[e.type](w.event&&w.event(e)||e)}function p(){for(var e;e=E.pop();)w.afterMount&&w.afterMount(e),e.componentDidMount&&e.componentDidMount()}function c(e,t,o,r,n,u){T++||(O=null!=n&&void 0!==n.ownerSVGElement,U=null!=e&&!("__preactattr_"in e));var c=function e(t,o,r,n,u){var p=t,c=O;if(null!=o&&"boolean"!=typeof o||(o=""),"string"==typeof o||"number"==typeof o)return t&&void 0!==t.splitText&&t.parentNode&&(!t._component||u)?t.nodeValue!=o&&(t.nodeValue=o):(p=document.createTextNode(o),t&&(t.parentNode&&t.parentNode.replaceChild(p,t),d(t,!0))),p.__preactattr_=!0,p;var h,y,m=o.nodeName;if("function"==typeof m)return function(e,t,o,r){for(var n=e&&e._component,i=n,a=e,l=n&&e._componentConstructor===t.nodeName,u=l,p=s(t);n&&!u&&(n=n.__u);)u=n.constructor===t.nodeName;return n&&u&&(!r||n._component)?(g(n,p,3,o,r),e=n.base):(i&&!l&&(v(i),e=a=null),n=f(t.nodeName,p,o),e&&!n.__b&&(n.__b=e,a=null),g(n,p,1,o,r),e=n.base,a&&e!==a&&(a._component=null,d(a,!1))),e}(t,o,r,n);if(O="svg"===m||"foreignObject"!==m&&O,m=String(m),(!t||!i(t,m))&&(h=m,(y=O?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h)).__n=h,p=y,t)){for(;t.firstChild;)p.appendChild(t.firstChild);t.parentNode&&t.parentNode.replaceChild(p,t),d(t,!0)}var b=p.firstChild,w=p.__preactattr_,S=o.children;if(null==w){w=p.__preactattr_={};for(var _=p.attributes,P=_.length;P--;)w[_[P].name]=_[P].value}return!U&&S&&1===S.length&&"string"==typeof S[0]&&null!=b&&void 0!==b.splitText&&null==b.nextSibling?b.nodeValue!=S[0]&&(b.nodeValue=S[0]):(S&&S.length||null!=b)&&function(t,o,r,n,s){var l,u,p,c,h,f,y,g,m=t.childNodes,v=[],b={},w=0,S=0,_=m.length,P=0,k=o?o.length:0;if(0!==_)for(var x=0;x<_;x++){var E=m[x],T=E.__preactattr_,O=k&&T?E._component?E._component.__k:T.key:null;null!=O?(w++,b[O]=E):(T||(void 0!==E.splitText?!s||E.nodeValue.trim():s))&&(v[P++]=E)}if(0!==k)for(var x=0;x<k;x++){c=o[x],h=null;var O=c.key;if(null!=O)w&&void 0!==b[O]&&(h=b[O],b[O]=void 0,w--);else if(!h&&S<P)for(l=S;l<P;l++)if(void 0!==v[l]&&(f=u=v[l],g=s,"string"==typeof(y=c)||"number"==typeof y?void 0!==f.splitText:"string"==typeof y.nodeName?!f._componentConstructor&&i(f,y.nodeName):g||f._componentConstructor===y.nodeName)){h=u,v[l]=void 0,l===P-1&&P--,l===S&&S++;break}h=e(h,c,r,n),p=m[x],h&&h!==t&&h!==p&&(null==p?t.appendChild(h):h===p.nextSibling?a(p):t.insertBefore(h,p))}if(w)for(var x in b)void 0!==b[x]&&d(b[x],!1);for(;S<=P;)void 0!==(h=v[P--])&&d(h,!1)}(p,S,r,n,U||null!=w.dangerouslySetInnerHTML),function(e,t,o){var r;for(r in o)t&&null!=t[r]||null==o[r]||l(e,r,o[r],o[r]=void 0,O);for(r in t)"children"===r||"innerHTML"===r||r in o&&t[r]===("value"===r||"checked"===r?e[r]:o[r])||l(e,r,o[r],o[r]=t[r],O)}(p,o.attributes,w),O=c,p}(e,t,o,r,u);return n&&c.parentNode!==n&&n.appendChild(c),--T||(U=!1,u||p()),c}function d(e,t){var o=e._component;o?v(o):(null!=e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),!1!==t&&null!=e.__preactattr_||a(e),h(e))}function h(e){for(e=e.lastChild;e;){var t=e.previousSibling;d(e,!0),e=t}}function f(e,t,o){var r,n=A[e.name];if(e.prototype&&e.prototype.render?(r=new e(t,o),b.call(r,t,o)):((r=new b(t,o)).constructor=e,r.render=y),n)for(var i=n.length;i--;)if(n[i].constructor===e){r.__b=n[i].__b,n.splice(i,1);break}return r}function y(e,t,o){return this.constructor(e,o)}function g(e,t,o,n,i){e.__x||(e.__x=!0,(e.__r=t.ref)&&delete t.ref,(e.__k=t.key)&&delete t.key,!e.base||i?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,n),n&&n!==e.context&&(e.__c||(e.__c=e.context),e.context=n),e.__p||(e.__p=e.props),e.props=t,e.__x=!1,0!==o&&(1!==o&&!1===w.syncComponentUpdates&&e.base?r(e):m(e,1,i)),e.__r&&e.__r(e))}function m(e,t,r,n){if(!e.__x){var i,a,l,u=e.props,h=e.state,y=e.context,b=e.__p||u,S=e.__s||h,_=e.__c||y,P=e.base,k=e.__b,x=P||k,O=e._component,U=!1;if(P&&(e.props=b,e.state=S,e.context=_,2!==t&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(u,h,y)?U=!0:e.componentWillUpdate&&e.componentWillUpdate(u,h,y),e.props=u,e.state=h,e.context=y),e.__p=e.__s=e.__c=e.__b=null,e.__d=!1,!U){i=e.render(u,h,y),e.getChildContext&&(y=o(o({},y),e.getChildContext()));var A,C,F=i&&i.nodeName;if("function"==typeof F){var D=s(i);(a=O)&&a.constructor===F&&D.key==a.__k?g(a,D,1,y,!1):(A=a,e._component=a=f(F,D,y),a.__b=a.__b||k,a.__u=e,g(a,D,0,y,!1),m(a,1,r,!0)),C=a.base}else l=x,(A=O)&&(l=e._component=null),(x||1===t)&&(l&&(l._component=null),C=c(l,i,y,r||!P,x&&x.parentNode,!0));if(x&&C!==x&&a!==O){var j=x.parentNode;j&&C!==j&&(j.replaceChild(C,x),A||(x._component=null,d(x,!1)))}if(A&&v(A),e.base=C,C&&!n){for(var I=e,R=e;R=R.__u;)(I=R).base=C;C._component=I,C._componentConstructor=I.constructor}}if(!P||r?E.unshift(e):U||(e.componentDidUpdate&&e.componentDidUpdate(b,S,_),w.afterUpdate&&w.afterUpdate(e)),null!=e.__h)for(;e.__h.length;)e.__h.pop().call(e);T||n||p()}}function v(e){w.beforeUnmount&&w.beforeUnmount(e);var t=e.base;e.__x=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var o=e._component;o?v(o):t&&(t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),e.__b=t,a(t),function(e){var t=e.constructor.name;(A[t]||(A[t]=[])).push(e)}(e),h(t)),e.__r&&e.__r(null)}function b(e,t){this.__d=!0,this.context=t,this.props=e,this.state=this.state||{}}var w={},S=[],_=[],P="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout,k=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,x=[],E=[],T=0,O=!1,U=!1,A={};o(b.prototype,{setState:function(e,t){var n=this.state;this.__s||(this.__s=o({},n)),o(n,"function"==typeof e?e(n,this.props):e),t&&(this.__h=this.__h||[]).push(t),r(this)},forceUpdate:function(e){e&&(this.__h=this.__h||[]).push(e),m(this,2)},render:function(){}});var C={h:t,createElement:t,cloneElement:function(e,r){return t(e.nodeName,o(o({},e.attributes),r),arguments.length>2?[].slice.call(arguments,2):e.children)},Component:b,render:function(e,t,o){return c(o,e,{},!1,t,!1)},rerender:n,options:w};e.exports=C}(),e=e.exports;var t,o,r,n=t={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(o===setTimeout)return setTimeout(e,0);if((o===i||!o)&&setTimeout)return o=setTimeout,setTimeout(e,0);try{return o(e,0)}catch(t){try{return o.call(null,e,0)}catch(t){return o.call(this,e,0)}}}!function(){try{o="function"==typeof setTimeout?setTimeout:i}catch(e){o=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var l,u=[],p=!1,c=-1;function d(){p&&l&&(p=!1,l.length?u=l.concat(u):c=-1,u.length&&h())}function h(){if(!p){var e=a(d);p=!0;for(var t=u.length;t;){for(l=u,u=[];++c<t;)l&&l[c].run();c=-1,t=u.length}l=null,p=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function y(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)t[o-1]=arguments[o];u.push(new f(e,t)),1!==u.length||p||a(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=y,n.addListener=y,n.once=y,n.off=y,n.removeListener=y,n.removeAllListeners=y,n.emit=y,n.prependListener=y,n.prependOnceListener=y,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0};var g={exports:{}};(function(e,t){!function(e,t){"object"==typeof g.exports?g.exports=t():e.ES6Promise=t()}(this,function(){"use strict";function o(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,i=void 0,s=void 0,a=function(e,t){f[n]=e,f[n+1]=t,2===(n+=2)&&(s?s(y):w())},l="undefined"!=typeof window?window:void 0,u=l||{},p=u.MutationObserver||u.WebKitMutationObserver,c="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function h(){var e=setTimeout;return function(){return e(y,1)}}var f=new Array(1e3);function y(){for(var e=0;e<n;e+=2)(0,f[e])(f[e+1]),f[e]=void 0,f[e+1]=void 0;n=0}var g,m,v,b,w=void 0;function S(e,t){var o=this,r=new this.constructor(k);void 0===r[P]&&L(r);var n=o._state;if(n){var i=arguments[n-1];a(function(){return B(n,r,i,o._result)})}else I(o,r,e,t);return r}function _(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(k);return C(t,e),t}c?w=function(){return e.nextTick(y)}:p?(m=0,v=new p(y),b=document.createTextNode(""),v.observe(b,{characterData:!0}),w=function(){b.data=m=++m%2}):d?((g=new MessageChannel).port1.onmessage=y,w=function(){return g.port2.postMessage(0)}):w=void 0===l&&"function"==typeof require?function(){try{var e=Function("return this")().require("vertx");return void 0!==(i=e.runOnLoop||e.runOnContext)?function(){i(y)}:h()}catch(e){return h()}}():h();var P=Math.random().toString(36).substring(2);function k(){}var x=void 0,E=1,T=2,O={error:null};function U(e){try{return e.then}catch(e){return O.error=e,O}}function A(e,t,r){t.constructor===e.constructor&&r===S&&t.constructor.resolve===_?function(e,t){t._state===E?D(e,t._result):t._state===T?j(e,t._result):I(t,void 0,function(t){return C(e,t)},function(t){return j(e,t)})}(e,t):r===O?(j(e,O.error),O.error=null):void 0===r?D(e,t):o(r)?function(e,t,o){a(function(e){var r=!1,n=function(o,n,i,s){try{o.call(n,function(o){r||(r=!0,t!==o?C(e,o):D(e,o))},function(t){r||(r=!0,j(e,t))})}catch(e){return e}}(o,t,0,0,e._label);!r&&n&&(r=!0,j(e,n))},e)}(e,t,r):D(e,t)}function C(e,t){var o,r;e===t?j(e,new TypeError("You cannot resolve a promise with itself")):(r=typeof(o=t),null===o||"object"!==r&&"function"!==r?D(e,t):A(e,t,U(t)))}function F(e){e._onerror&&e._onerror(e._result),R(e)}function D(e,t){e._state===x&&(e._result=t,e._state=E,0!==e._subscribers.length&&a(R,e))}function j(e,t){e._state===x&&(e._state=T,e._result=t,a(F,e))}function I(e,t,o,r){var n=e._subscribers,i=n.length;e._onerror=null,n[i]=t,n[i+E]=o,n[i+T]=r,0===i&&e._state&&a(R,e)}function R(e){var t=e._subscribers,o=e._state;if(0!==t.length){for(var r=void 0,n=void 0,i=e._result,s=0;s<t.length;s+=3)r=t[s],n=t[s+o],r?B(o,r,n,i):n(i);e._subscribers.length=0}}function B(e,t,r,n){var i=o(r),s=void 0,a=void 0,l=void 0,u=void 0;if(i){if((s=function(e,t){try{return e(t)}catch(e){return O.error=e,O}}(r,n))===O?(u=!0,a=s.error,s.error=null):l=!0,t===s)return void j(t,new TypeError("A promises callback cannot return that same promise."))}else s=n,l=!0;t._state!==x||(i&&l?C(t,s):u?j(t,a):e===E?D(t,s):e===T&&j(t,s))}var M=0;function L(e){e[P]=M++,e._state=void 0,e._result=void 0,e._subscribers=[]}var N=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(k),this.promise[P]||L(this.promise),r(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?D(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&D(this.promise,this._result))):j(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===x&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var o=this._instanceConstructor,r=o.resolve;if(r===_){var n=U(e);if(n===S&&e._state!==x)this._settledAt(e._state,t,e._result);else if("function"!=typeof n)this._remaining--,this._result[t]=e;else if(o===z){var i=new o(k);A(i,e,n),this._willSettleAt(i,t)}else this._willSettleAt(new o(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},e.prototype._settledAt=function(e,t,o){var r=this.promise;r._state===x&&(this._remaining--,e===T?j(r,o):this._result[t]=o),0===this._remaining&&D(r,this._result)},e.prototype._willSettleAt=function(e,t){var o=this;I(e,void 0,function(e){return o._settledAt(E,t,e)},function(e){return o._settledAt(T,t,e)})},e}(),z=function(){function e(t){this[P]=M++,this._result=this._state=void 0,this._subscribers=[],k!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t(function(t){C(e,t)},function(t){j(e,t)})}catch(t){j(e,t)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var t=this.constructor;return this.then(function(o){return t.resolve(e()).then(function(){return o})},function(o){return t.resolve(e()).then(function(){throw o})})},e}();return z.prototype.then=S,z.all=function(e){return new N(this,e).promise},z.race=function(e){var t=this;return r(e)?new t(function(o,r){for(var n=e.length,i=0;i<n;i++)t.resolve(e[i]).then(o,r)}):new t(function(e,t){return t(new TypeError("You must pass an array to race."))})},z.resolve=_,z.reject=function(e){var t=new this(k);return j(t,e),t},z._setScheduler=function(e){s=e},z._setAsap=function(e){a=e},z._asap=a,z.polyfill=function(){var e=void 0;if(void 0!==t)e=t;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var o=e.Promise;if(o){var r=null;try{r=Object.prototype.toString.call(o.resolve())}catch(e){}if("[object Promise]"===r&&!o.cast)return}e.Promise=z},z.Promise=z,z})}).call(this,t,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),g=g.exports;var m={};(function(e){var t="Expected a function",o=NaN,r="[object Symbol]",n=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,l=parseInt,u="object"==typeof e&&e&&e.Object===Object&&e,p="object"==typeof self&&self&&self.Object===Object&&self,c=u||p||Function("return this")(),d=Object.prototype.toString,h=Math.max,f=Math.min,y=function(){return c.Date.now()};function g(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function v(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)==r}(e))return o;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(n,"");var u=s.test(e);return u||a.test(e)?l(e.slice(2),u?2:8):i.test(e)?o:+e}m=function(e,o,r){var n=!0,i=!0;if("function"!=typeof e)throw new TypeError(t);return g(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),function(e,o,r){var n,i,s,a,l,u,p=0,c=!1,d=!1,m=!0;if("function"!=typeof e)throw new TypeError(t);function b(t){var o=n,r=i;return n=i=void 0,p=t,a=e.apply(r,o)}function w(e){var t=e-u;return void 0===u||t>=o||t<0||d&&e-p>=s}function S(){var e=y();if(w(e))return _(e);l=setTimeout(S,function(e){var t=o-(e-u);return d?f(t,s-(e-p)):t}(e))}function _(e){return l=void 0,m&&n?b(e):(n=i=void 0,a)}function P(){var e=y(),t=w(e);if(n=arguments,i=this,u=e,t){if(void 0===l)return function(e){return p=e,l=setTimeout(S,o),c?b(e):a}(u);if(d)return l=setTimeout(S,o),b(u)}return void 0===l&&(l=setTimeout(S,o)),a}return o=v(o)||0,g(r)&&(c=!!r.leading,s=(d="maxWait"in r)?h(v(r.maxWait)||0,o):s,m="trailing"in r?!!r.trailing:m),P.cancel=function(){void 0!==l&&clearTimeout(l),p=0,n=u=i=l=void 0},P.flush=function(){return void 0===l?a:_(y())},P}(e,o,{leading:n,maxWait:o,trailing:i})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w="undefined"==typeof Promise?g.Promise:Promise;function S(e){return 2!==e.length?0+e:e}var _={"video/ogg":"ogv","audio/ogg":"ogg","video/webm":"webm","audio/webm":"webm","video/mp4":"mp4","audio/mp3":"mp3"};function P(e){var t=/(?:\.([^.]+))?$/.exec(e)[1];return{name:e.replace("."+t,""),extension:t}}function k(e,t,o){var r=e.split(",")[1],n=t.mimeType||e.split(",")[0].split(":")[1].split(";")[0];null==n&&(n="plain/text");for(var i=atob(r),s=[],a=0;a<i.length;a++)s.push(i.charCodeAt(a));return o?new File([new Uint8Array(s)],t.name||"",{type:n}):new Blob([new Uint8Array(s)],{type:n})}function x(e){if(!e.bytesUploaded)return 0;var t=new Date-e.uploadStarted;return e.bytesUploaded/(t/1e3)}function E(e){return e.bytesTotal-e.bytesUploaded}function T(e){return e&&"object"===(void 0===e?"undefined":b(e))&&e.nodeType===Node.ELEMENT_NODE}var O={generateFileID:function(e){return["uppy",e.name?e.name.toLowerCase().replace(/[^A-Z0-9]/gi,""):"",e.type,e.data.size,e.data.lastModified].filter(function(e){return e}).join("-")},toArray:function(e){return Array.prototype.slice.call(e||[],0)},getTimeStamp:function(){var e=new Date;return S(e.getHours().toString())+":"+S(e.getMinutes().toString())+":"+S(e.getSeconds().toString())},isTouchDevice:function(){return"ontouchstart"in window||navigator.maxTouchPoints},getFileNameAndExtension:P,truncateString:function(e,t){return e.length>t?e.substr(0,t/2)+"..."+e.substr(e.length-t/4,e.length):e},getFileTypeExtension:function(e){return _[e]||null},getFileType:function(e){var t,o={md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",gif:"image/gif"},r=e.name?P(e.name).extension:null;if(e.isRemote){var n=e.type?e.type:o[r];return w.resolve(n)}return(t=e.data.slice(0,4100),new w(function(e,o){var r=new FileReader;r.addEventListener("load",function(t){e(t.target.result)}),r.addEventListener("error",function(e){console.error("FileReader error"+e),o(e)}),r.readAsArrayBuffer(t)})).then(function(t){var n=function(e){var t=new Uint8Array(e);if(!(t&&t.length>1))return null;var o=function(e,o){o=v({offset:0},o);for(var r=0;r<e.length;r++)if(e[r]!==t[r+o.offset])return!1;return!0};if(o([255,216,255]))return{ext:"jpg",mime:"image/jpeg"};if(o([137,80,78,71,13,10,26,10]))return{ext:"png",mime:"image/png"};if(o([71,73,70]))return{ext:"gif",mime:"image/gif"};if(o([87,69,66,80],{offset:8}))return{ext:"webp",mime:"image/webp"};if(o([70,76,73,70]))return{ext:"flif",mime:"image/flif"};if((o([73,73,42,0])||o([77,77,0,42]))&&o([67,82],{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(o([73,73,42,0])||o([77,77,0,42]))return{ext:"tif",mime:"image/tiff"};if(o([66,77]))return{ext:"bmp",mime:"image/bmp"};if(o([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(o([56,66,80,83]))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(o([80,75,3,4])&&o([109,105,109,101,116,121,112,101,97,112,112,108,105,99,97,116,105,111,110,47,101,112,117,98,43,122,105,112],{offset:30}))return{ext:"epub",mime:"application/epub+zip"};if(o([80,75,3,4])&&o([77,69,84,65,45,73,78,70,47,109,111,122,105,108,108,97,46,114,115,97],{offset:30}))return{ext:"xpi",mime:"application/x-xpinstall"};if(o([80,75])&&(3===t[2]||5===t[2]||7===t[2])&&(4===t[3]||6===t[3]||8===t[3]))return{ext:"zip",mime:"application/zip"};if(o([117,115,116,97,114],{offset:257}))return{ext:"tar",mime:"application/x-tar"};if(o([82,97,114,33,26,7])&&(0===t[6]||1===t[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(o([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(o([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(o([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(o([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(o([0,0,0])&&(24===t[3]||32===t[3])&&o([102,116,121,112],{offset:4})||o([51,103,112,53])||o([0,0,0,28,102,116,121,112,109,112,52,50])&&o([109,112,52,49,109,112,52,50,105,115,111,109],{offset:16})||o([0,0,0,28,102,116,121,112,105,115,111,109])||o([0,0,0,28,102,116,121,112,109,112,52,50,0,0,0,0]))return{ext:"mp4",mime:"video/mp4"};if(o([0,0,0,28,102,116,121,112,77,52,86]))return{ext:"m4v",mime:"video/x-m4v"};if(o([77,84,104,100]))return{ext:"mid",mime:"audio/midi"};if(o([26,69,223,163])){var r=t.subarray(4,4100),n=r.findIndex(function(e,t,o){return 66===o[t]&&130===o[t+1]});if(n>=0){var i=n+3,s=function(e){return Array.from(e).every(function(e,t){return r[i+t]===e.charCodeAt(0)})};if(s("matroska"))return{ext:"mkv",mime:"video/x-matroska"};if(s("webm"))return{ext:"webm",mime:"video/webm"}}}return o([0,0,0,20,102,116,121,112,113,116,32,32])||o([102,114,101,101],{offset:4})||o([102,116,121,112,113,116,32,32],{offset:4})||o([109,100,97,116],{offset:4})||o([119,105,100,101],{offset:4})?{ext:"mov",mime:"video/quicktime"}:o([82,73,70,70])&&o([65,86,73],{offset:8})?{ext:"avi",mime:"video/x-msvideo"}:o([48,38,178,117,142,102,207,17,166,217])?{ext:"wmv",mime:"video/x-ms-wmv"}:o([0,0,1,186])?{ext:"mpg",mime:"video/mpeg"}:o([73,68,51])||o([255,251])?{ext:"mp3",mime:"audio/mpeg"}:o([102,116,121,112,77,52,65],{offset:4})||o([77,52,65,32])?{ext:"m4a",mime:"audio/m4a"}:o([79,112,117,115,72,101,97,100],{offset:28})?{ext:"opus",mime:"audio/opus"}:o([79,103,103,83])?{ext:"ogg",mime:"audio/ogg"}:o([102,76,97,67])?{ext:"flac",mime:"audio/x-flac"}:o([82,73,70,70])&&o([87,65,86,69],{offset:8})?{ext:"wav",mime:"audio/x-wav"}:o([35,33,65,77,82,10])?{ext:"amr",mime:"audio/amr"}:o([37,80,68,70])?{ext:"pdf",mime:"application/pdf"}:o([77,90])?{ext:"exe",mime:"application/x-msdownload"}:67!==t[0]&&70!==t[0]||!o([87,83],{offset:1})?o([123,92,114,116,102])?{ext:"rtf",mime:"application/rtf"}:o([0,97,115,109])?{ext:"wasm",mime:"application/wasm"}:o([119,79,70,70])&&(o([0,1,0,0],{offset:4})||o([79,84,84,79],{offset:4}))?{ext:"woff",mime:"font/woff"}:o([119,79,70,50])&&(o([0,1,0,0],{offset:4})||o([79,84,84,79],{offset:4}))?{ext:"woff2",mime:"font/woff2"}:o([76,80],{offset:34})&&(o([0,0,1],{offset:8})||o([1,0,2],{offset:8})||o([2,0,2],{offset:8}))?{ext:"eot",mime:"application/octet-stream"}:o([0,1,0,0,0])?{ext:"ttf",mime:"font/ttf"}:o([79,84,84,79,0])?{ext:"otf",mime:"font/otf"}:o([0,0,1,0])?{ext:"ico",mime:"image/x-icon"}:o([70,76,86,1])?{ext:"flv",mime:"video/x-flv"}:o([37,33])?{ext:"ps",mime:"application/postscript"}:o([253,55,122,88,90,0])?{ext:"xz",mime:"application/x-xz"}:o([83,81,76,105])?{ext:"sqlite",mime:"application/x-sqlite3"}:o([78,69,83,26])?{ext:"nes",mime:"application/x-nintendo-nes-rom"}:o([67,114,50,52])?{ext:"crx",mime:"application/x-google-chrome-extension"}:o([77,83,67,70])||o([73,83,99,40])?{ext:"cab",mime:"application/vnd.ms-cab-compressed"}:o([33,60,97,114,99,104,62,10,100,101,98,105,97,110,45,98,105,110,97,114,121])?{ext:"deb",mime:"application/x-deb"}:o([33,60,97,114,99,104,62])?{ext:"ar",mime:"application/x-unix-archive"}:o([237,171,238,219])?{ext:"rpm",mime:"application/x-rpm"}:o([31,160])||o([31,157])?{ext:"Z",mime:"application/x-compress"}:o([76,90,73,80])?{ext:"lz",mime:"application/x-lzip"}:o([208,207,17,224,161,177,26,225])?{ext:"msi",mime:"application/x-msi"}:o([6,14,43,52,2,5,1,1,13,1,2,1,1,2])?{ext:"mxf",mime:"application/mxf"}:o([71],{offset:4})&&(o([71],{offset:192})||o([71],{offset:196}))?{ext:"mts",mime:"video/mp2t"}:o([66,76,69,78,68,69,82])?{ext:"blend",mime:"application/x-blender"}:o([66,80,71,251])?{ext:"bpg",mime:"image/bpg"}:null:{ext:"swf",mime:"application/x-shockwave-flash"}}(t);return n&&n.mime?n.mime:e.type?e.type:r&&o[r]?o[r]:null}).catch(function(){return null})},isPreviewSupported:function(e){if(!e)return!1;var t=e.split("/")[1];return!!/^(jpeg|gif|png|svg|svg\+xml|bmp)$/.test(t)},isObjectURL:function(e){return 0===e.indexOf("blob:")},dataURItoBlob:k,canvasToBlob:function(e,t,o){return e.toBlob?new w(function(r){e.toBlob(r,t,o)}):w.resolve().then(function(){return k(e.toDataURL(t,o),{})})},getSpeed:x,getBytesRemaining:E,getETA:function(e){if(!e.bytesUploaded)return 0;var t=x(e),o=E(e);return Math.round(o/t*10)/10},copyToClipboard:function(e,t){return t=t||"Copy the URL below",new w(function(o){var r=document.createElement("textarea");r.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),r.value=e,document.body.appendChild(r),r.select();var n=function(){document.body.removeChild(r),window.prompt(t,e),o()};try{return document.execCommand("copy")?(document.body.removeChild(r),o()):n()}catch(e){return document.body.removeChild(r),n()}})},prettyETA:function(e){var t,o=(t=e,{hours:Math.floor(t/3600)%24,minutes:Math.floor(t/60)%60,seconds:Math.floor(t%60)}),r=o.hours?o.hours+"h ":"",n=o.hours?("0"+o.minutes).substr(-2):o.minutes;return r+(n?n+"m ":"")+(n?("0"+o.seconds).substr(-2):o.seconds)+"s"},findDOMElement:function(e){return"string"==typeof e?document.querySelector(e):"object"===(void 0===e?"undefined":b(e))&&T(e)?e:void 0},findAllDOMElements:function(e){if("string"==typeof e){var t=[].slice.call(document.querySelectorAll(e));return t.length>0?t:null}if("object"===(void 0===e?"undefined":b(e))&&T(e))return[e]},getSocketHost:function(e){var t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/.exec(e)[1];return("https:"===location.protocol?"wss":"ws")+"://"+t},emitSocketProgress:m(function(e,t,o){var r=t.progress,n=t.bytesUploaded,i=t.bytesTotal;r&&(e.uppy.log("Upload progress: "+r),e.uppy.emit("upload-progress",o,{uploader:e,bytesUploaded:n,bytesTotal:i}))},300,{leading:!0,trailing:!0}),settle:function(e){var t=[],o=[];function r(e){t.push(e)}function n(e){o.push(e)}return w.all(e.map(function(e){return e.then(r,n)})).then(function(){return{successful:t,failed:o}})},limitPromises:function(e){var t=0,o=[];return function(n){return function(){for(var i=arguments.length,s=Array(i),a=0;a<i;a++)s[a]=arguments[a];var l=function(){t++;var e=n.apply(void 0,s);return e.then(r,r),e};return t>=e?new w(function(e,t){o.push(function(){l().then(e,t)})}):l()}};function r(){t--;var e=o.shift();e&&e()}}},U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},C=O.findDOMElement,F=function(){function t(e,o){!function(e,o){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.uppy=e,this.opts=o||{},this.update=this.update.bind(this),this.mount=this.mount.bind(this),this.install=this.install.bind(this),this.uninstall=this.uninstall.bind(this)}return t.prototype.getPluginState=function(){return this.uppy.state.plugins[this.id]},t.prototype.setPluginState=function(e){var t=A({},this.uppy.state.plugins);t[this.id]=A({},t[this.id],e),this.uppy.setState({plugins:t})},t.prototype.update=function(e){void 0!==this.el&&this.updateUI&&this.updateUI(e)},t.prototype.mount=function(o,r){var n=this,i=r.id,s=C(o);if(s)return this.updateUI=function(t){n.el=e.render(n.render(t),s,n.el)},this.uppy.log("Installing "+i+" to a DOM element"),this.opts.replaceTargetContent&&(s.innerHTML=""),this.el=e.render(this.render(this.uppy.state),s),this.el;var a=void 0;if("object"===(void 0===o?"undefined":U(o))&&o instanceof t)a=o;else if("function"==typeof o){var l=o;this.uppy.iteratePlugins(function(e){if(e instanceof l)return a=e,!1})}if(a){var u=a.id;return this.uppy.log("Installing "+i+" to "+u),this.el=a.addTarget(r),this.el}throw this.uppy.log("Not installing "+i),new Error("Invalid target option given to "+i)},t.prototype.render=function(e){throw new Error("Extend the render method to add your plugin to a DOM element")},t.prototype.addTarget=function(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")},t.prototype.unmount=function(){this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},t.prototype.install=function(){},t.prototype.uninstall=function(){this.unmount()},t}(),D=function(e,t){var o="000000000"+e;return o.substr(o.length-t)},j="object"==typeof window?window:self,I=Object.keys(j),R=D(((navigator.mimeTypes?navigator.mimeTypes.length:0)+navigator.userAgent.length).toString(36)+I.toString(36),4),B=function(){return R},M={},L=0,N=4,z=36,q=Math.pow(z,N);function H(){return D((Math.random()*q<<0).toString(z),N)}function W(){return L=L<q?L:0,++L-1}function X(){return"c"+(new Date).getTime().toString(z)+D(W().toString(z),N)+B()+(H()+H())}X.slug=function(){var e=(new Date).getTime().toString(36),t=W().toString(36).slice(-4),o=B().slice(0,1)+B().slice(-1),r=H().slice(-2);return e.slice(-2)+t+o+r},X.fingerprint=B,M=X;var V={};function G(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}G.prototype.match=function(e){var t,o,r=!0,n=this.parts,i=n.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(o=(e||"").split(this.separator),t=0;r&&t<i;t++)"*"!==n[t]&&(r=t<o.length&&n[t]===o[t]);r=r&&o}else r=!1;else if("function"==typeof e.splice)for(r=[],t=e.length;t--;)this.match(e[t])&&(r[r.length]=e[t]);else if("object"==typeof e)for(var s in r={},e)this.match(s)&&(r[s]=e[s]);return r},V=function(e,t,o){var r=new G(e,o||/[\/\.]/);return void 0!==t?r.match(t):r};var J=/[\/\+\.]/,Y=function(){var e={},t=e._fns={};return e.emit=function(e,o,r,n,i,s,a){var l=function(e){for(var o=t[e]?t[e]:[],r=e.indexOf(":"),n=-1===r?[e]:[e.substring(0,r),e.substring(r+1)],i=Object.keys(t),s=0,a=i.length;s<a;s++){var l=i[s];if("*"===l&&(o=o.concat(t[l])),2===n.length&&n[0]===l){o=o.concat(t[l]);break}}return o}(e);l.length&&function(e,t,o){for(var r=0,n=t.length;r<n&&t[r];r++)t[r].event=e,t[r].apply(t[r],o)}(e,l,[o,r,n,i,s,a])},e.on=function(e,o){t[e]||(t[e]=[]),t[e].push(o)},e.once=function(t,o){this.on(t,function r(){o.apply(this,arguments),e.off(t,r)})},e.off=function(e,t){var o=[];if(e&&t)for(var r=this._fns[e],n=0,i=r?r.length:0;n<i;n++)r[n]!==t&&o.push(r[n]);o.length?this._fns[e]=o:delete this._fns[e]},e},K=function(e){if("number"!=typeof e||isNaN(e))throw new TypeError("Expected a number, got "+typeof e);var t=e<0,o=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return(t?"-":"")+e+" B";var r=Math.min(Math.floor(Math.log(e)/Math.log(1e3)),o.length-1);e=Number(e/Math.pow(1e3,r));var n=o[r];return e>=10||e%1==0?(t?"-":"")+e.toFixed(0)+" "+n:(t?"-":"")+e.toFixed(1)+" "+n},$=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},Q=function(){function e(t){!function(t,o){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o={locale:{strings:{},pluralize:function(e){return 1===e?0:1}}};this.opts=$({},o,t),this.locale=$({},o.locale,t.locale)}return e.prototype.interpolate=function(e,t){var o=String.prototype.replace,r=/\$/g;for(var n in t)if("_"!==n&&t.hasOwnProperty(n)){var i=t[n];"string"==typeof i&&(i=o.call(t[n],r,"$$$$")),e=o.call(e,new RegExp("%\\{"+n+"\\}","g"),i)}return e},e.prototype.translate=function(e,t){if(t&&t.smart_count){var o=this.locale.pluralize(t.smart_count);return this.interpolate(this.opts.locale.strings[e][o],t)}return this.interpolate(this.opts.locale.strings[e],t)},e}(),Z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},ee=function(){function e(){!function(t,o){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),this.state={},this.callbacks=[]}return e.prototype.getState=function(){return this.state},e.prototype.setState=function(e){var t=Z({},this.state),o=Z({},this.state,e);this.state=o,this._publish(t,o,e)},e.prototype.subscribe=function(e){var t=this;return this.callbacks.push(e),function(){t.callbacks.splice(t.callbacks.indexOf(e),1)}},e.prototype._publish=function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];this.callbacks.forEach(function(e){e.apply(void 0,t)})},e}(),te=function(){return new ee},oe={};(function(e){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},r=function(){function e(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,o,r){return o&&e(t.prototype,o),r&&e(t,r),t}}(),n="undefined"==typeof Promise?g.Promise:Promise,i=function(){function i(t){var r=this;!function(e,t){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}(this);var s={strings:{youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},exceedsSize:"This file exceeds maximum allowed size of",youCanOnlyUploadFileTypes:"You can only upload:",uppyServerError:"Connection with Uppy Server failed"}},a={id:"uppy",autoProceed:!0,debug:!1,restrictions:{maxFileSize:!1,maxNumberOfFiles:!1,minNumberOfFiles:!1,allowedFileTypes:!1},meta:{},onBeforeFileAdded:function(e,t){return n.resolve()},onBeforeUpload:function(e){return n.resolve()},locale:s,store:new te};this.opts=o({},a,t),this.locale=o({},s,this.opts.locale),this.locale.strings=o({},s.strings,this.opts.locale.strings),this.translator=new Q({locale:this.locale}),this.i18n=this.translator.translate.bind(this.translator),this.plugins={},this.getState=this.getState.bind(this),this.getPlugin=this.getPlugin.bind(this),this.setFileMeta=this.setFileMeta.bind(this),this.setFileState=this.setFileState.bind(this),this.log=this.log.bind(this),this.info=this.info.bind(this),this.hideInfo=this.hideInfo.bind(this),this.addFile=this.addFile.bind(this),this.removeFile=this.removeFile.bind(this),this.pauseResume=this.pauseResume.bind(this),this._calculateProgress=this._calculateProgress.bind(this),this.updateOnlineStatus=this.updateOnlineStatus.bind(this),this.resetProgress=this.resetProgress.bind(this),this.pauseAll=this.pauseAll.bind(this),this.resumeAll=this.resumeAll.bind(this),this.retryAll=this.retryAll.bind(this),this.cancelAll=this.cancelAll.bind(this),this.retryUpload=this.retryUpload.bind(this),this.upload=this.upload.bind(this),this.emitter=Y(),this.on=this.on.bind(this),this.off=this.off.bind(this),this.once=this.emitter.once.bind(this.emitter),this.emit=this.emitter.emit.bind(this.emitter),this.preProcessors=[],this.uploaders=[],this.postProcessors=[],this.store=this.opts.store,this.setState({plugins:{},files:{},currentUploads:{},capabilities:{resumableUploads:!1},totalProgress:0,meta:o({},this.opts.meta),info:{isHidden:!0,type:"info",message:""}}),this._storeUnsubscribe=this.store.subscribe(function(e,t,o){r.emit("state-update",e,t,o),r.updateAll(t)}),this.opts.debug&&(e.uppyLog="",e[this.opts.id]=this)}return i.prototype.on=function(e,t){return this.emitter.on(e,t),this},i.prototype.off=function(e,t){return this.emitter.off(e,t),this},i.prototype.updateAll=function(e){this.iteratePlugins(function(t){t.update(e)})},i.prototype.setState=function(e){this.store.setState(e)},i.prototype.getState=function(){return this.store.getState()},i.prototype.setFileState=function(e,t){var r;this.setState({files:o({},this.getState().files,(r={},r[e]=o({},this.getState().files[e],t),r))})},i.prototype.resetProgress=function(){var e={percentage:0,bytesUploaded:0,uploadComplete:!1,uploadStarted:!1},t=o({},this.getState().files),r={};Object.keys(t).forEach(function(n){var i=o({},t[n]);i.progress=o({},i.progress,e),r[n]=i}),this.setState({files:r,totalProgress:0}),this.emit("reset-progress")},i.prototype.addPreProcessor=function(e){this.preProcessors.push(e)},i.prototype.removePreProcessor=function(e){var t=this.preProcessors.indexOf(e);-1!==t&&this.preProcessors.splice(t,1)},i.prototype.addPostProcessor=function(e){this.postProcessors.push(e)},i.prototype.removePostProcessor=function(e){var t=this.postProcessors.indexOf(e);-1!==t&&this.postProcessors.splice(t,1)},i.prototype.addUploader=function(e){this.uploaders.push(e)},i.prototype.removeUploader=function(e){var t=this.uploaders.indexOf(e);-1!==t&&this.uploaders.splice(t,1)},i.prototype.setMeta=function(e){var t=o({},this.getState().meta,e),r=o({},this.getState().files);Object.keys(r).forEach(function(t){r[t]=o({},r[t],{meta:o({},r[t].meta,e)})}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:r})},i.prototype.setFileMeta=function(e,t){var r=o({},this.getState().files);if(r[e]){var n=o({},r[e].meta,t);r[e]=o({},r[e],{meta:n}),this.setState({files:r})}else this.log("Was trying to set metadata for a file that\u2019s not with us anymore: ",e)},i.prototype.getFile=function(e){return this.getState().files[e]},i.prototype._checkMinNumberOfFiles=function(){var e=this.opts.restrictions.minNumberOfFiles;if(Object.keys(this.getState().files).length<e)throw new Error(""+this.i18n("youHaveToAtLeastSelectX",{smart_count:e}))},i.prototype._checkRestrictions=function(e){var t=this.opts.restrictions,o=t.maxFileSize,r=t.maxNumberOfFiles,n=t.allowedFileTypes;if(r&&Object.keys(this.getState().files).length+1>r)throw new Error(""+this.i18n("youCanOnlyUploadX",{smart_count:r}));if(n&&!(n.filter(function(t){return!!e.type&&function(e,t){function o(t){var o=V(t,e,J);return o&&o.length>=2}return t?o(t.split(";")[0]):o}(e.type,t)}).length>0)){var i=n.join(", ");throw new Error(this.i18n("youCanOnlyUploadFileTypes")+" "+i)}if(o&&e.data.size>o)throw new Error(this.i18n("exceedsSize")+" "+K(o))},i.prototype.addFile=function(e){var r=this;return n.resolve().then(function(){return r.opts.onBeforeFileAdded(e,r.getState().files)}).then(function(){return O.getFileType(e)}).then(function(t){var n,i=o({},r.getState().files);n=e.name?e.name:"image"===t.split("/")[0]?t.split("/")[0]+"."+t.split("/")[1]:"noname";var s=O.getFileNameAndExtension(n).extension,a=e.isRemote||!1,l=O.generateFileID(e),u={source:e.source||"",id:l,name:n,extension:s||"",meta:o({},r.getState().meta,{name:n,type:t}),type:t,data:e.data,progress:{percentage:0,bytesUploaded:0,bytesTotal:e.data.size||0,uploadComplete:!1,uploadStarted:!1},size:e.data.size||0,isRemote:a,remote:e.remote||"",preview:e.preview};r._checkRestrictions(u),i[l]=u,r.setState({files:i}),r.emit("file-added",u),r.log("Added file: "+n+", "+l+", mime type: "+t),r.opts.autoProceed&&!r.scheduledAutoProceed&&(r.scheduledAutoProceed=setTimeout(function(){r.scheduledAutoProceed=null,r.upload().catch(function(e){console.error(e.stack||e.message||e)})},4))}).catch(function(e){var o="object"===(void 0===e?"undefined":t(e))?e.message:e;return r.log(o),r.info(o,"error",5e3),n.reject("object"===(void 0===e?"undefined":t(e))?e:new Error(e))})},i.prototype.removeFile=function(e){var t=this,r=this.state,n=r.files,i=r.currentUploads,s=o({},n),a=s[e];delete s[e];var l=o({},i),u=[];Object.keys(l).forEach(function(t){var r=i[t].fileIDs.filter(function(t){return t!==e});0!==r.length?l[t]=o({},i[t],{fileIDs:r}):u.push(t)}),this.setState({currentUploads:l,files:s}),u.forEach(function(e){t._removeUpload(e)}),this._calculateTotalProgress(),this.emit("file-removed",a),this.log("File removed: "+a.id),a.preview&&O.isObjectURL(a.preview)&&URL.revokeObjectURL(a.preview),this.log("Removed file: "+e)},i.prototype.pauseResume=function(e){var t=o({},this.getState().files);if(!t[e].uploadComplete){var r=!t[e].isPaused,n=o({},t[e],{isPaused:r});return t[e]=n,this.setState({files:t}),this.emit("upload-pause",e,r),r}},i.prototype.pauseAll=function(){var e=o({},this.getState().files);Object.keys(e).filter(function(t){return!e[t].progress.uploadComplete&&e[t].progress.uploadStarted}).forEach(function(t){var r=o({},e[t],{isPaused:!0});e[t]=r}),this.setState({files:e}),this.emit("pause-all")},i.prototype.resumeAll=function(){var e=o({},this.getState().files);Object.keys(e).filter(function(t){return!e[t].progress.uploadComplete&&e[t].progress.uploadStarted}).forEach(function(t){var r=o({},e[t],{isPaused:!1,error:null});e[t]=r}),this.setState({files:e}),this.emit("resume-all")},i.prototype.retryAll=function(){var e=o({},this.getState().files),t=Object.keys(e).filter(function(t){return e[t].error});t.forEach(function(t){var r=o({},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);return this._runUpload(r)},i.prototype.cancelAll=function(){this.emit("cancel-all"),this.setState({files:{},totalProgress:0})},i.prototype.retryUpload=function(e){var t=o({},this.getState().files),r=o({},t[e],{error:null,isPaused:!1});t[e]=r,this.setState({files:t}),this.emit("upload-retry",e);var n=this._createUpload([e]);return this._runUpload(n)},i.prototype.reset=function(){this.cancelAll()},i.prototype._calculateProgress=function(e,t){this.getFile(e.id)?(this.setFileState(e.id,{progress:o({},this.getFile(e.id).progress,{bytesUploaded:t.bytesUploaded,bytesTotal:t.bytesTotal,percentage:Math.floor((t.bytesUploaded/t.bytesTotal*100).toFixed(2))})}),this._calculateTotalProgress()):this.log("Not setting progress for a file that has been removed: "+e.id)},i.prototype._calculateTotalProgress=function(){var e=o({},this.getState().files),t=Object.keys(e).filter(function(t){return e[t].progress.uploadStarted}),r=100*t.length,n=0;t.forEach(function(t){n+=e[t].progress.percentage});var i=0===r?0:Math.floor((100*n/r).toFixed(2));this.setState({totalProgress:i})},i.prototype.actions=function(){var e=this;this.on("error",function(t){e.setState({error:t.message})}),this.on("upload-error",function(o,r){e.setFileState(o.id,{error:r.message}),e.setState({error:r.message});var n="Failed to upload "+o.name;"object"===(void 0===r?"undefined":t(r))&&r.message&&(n={message:n,details:r.message}),e.info(n,"error",5e3)}),this.on("upload",function(){e.setState({error:null})}),this.on("upload-started",function(t,r){e.getFile(t.id)?e.setFileState(t.id,{progress:o({},e.getFile(t.id),{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)});var r=m(this._calculateProgress,100,{leading:!0,trailing:!0});this.on("upload-progress",r),this.on("upload-success",function(t,r,n){e.setFileState(t.id,{progress:o({},e.getFile(t.id).progress,{uploadComplete:!0,percentage:100}),uploadURL:n,isPaused:!1}),e._calculateTotalProgress()}),this.on("preprocess-progress",function(t,r){e.getFile(t.id)?e.setFileState(t.id,{progress:o({},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=o({},e.getState().files);r[t.id]=o({},r[t.id],{progress:o({},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:o({},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=o({},e.getState().files);r[t.id]=o({},r[t.id],{progress:o({},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("online",function(){return e.updateOnlineStatus()}),window.addEventListener("offline",function(){return e.updateOnlineStatus()}),setTimeout(function(){return e.updateOnlineStatus()},3e3))},i.prototype.updateOnlineStatus=function(){void 0===window.navigator.onLine||window.navigator.onLine?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info("Connected!","success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info("No internet connection","error",0),this.wasOffline=!0)},i.prototype.getID=function(){return this.opts.id},i.prototype.use=function(e,o){if("function"!=typeof e){var r="Expected a plugin class, but got "+(null===e?"null":void 0===e?"undefined":t(e))+". Please verify that the plugin was imported and spelled correctly.";throw new TypeError(r)}var n=new e(this,o),i=n.id;if(this.plugins[n.type]=this.plugins[n.type]||[],!i)throw new Error("Your plugin must have an id");if(!n.type)throw new Error("Your plugin must have a type");var s=this.getPlugin(i);if(s){var a="Already found a plugin named '"+s.id+"'.\n Tried to use: '"+i+"'.\n Uppy is currently limited to running one of every plugin.\n Share your use case with us over at\n https://github.com/transloadit/uppy/issues/\n if you want us to reconsider.";throw new Error(a)}return this.plugins[n.type].push(n),n.install(),this},i.prototype.getPlugin=function(e){var t=!1;return this.iteratePlugins(function(o){if(o.id===e)return t=o,!1}),t},i.prototype.iteratePlugins=function(e){var t=this;Object.keys(this.plugins).forEach(function(o){t.plugins[o].forEach(e)})},i.prototype.removePlugin=function(e){var t=this.plugins[e.type];e.uninstall&&e.uninstall();var o=t.indexOf(e);-1!==o&&t.splice(o,1)},i.prototype.close=function(){this.reset(),this._storeUnsubscribe(),this.iteratePlugins(function(e){e.uninstall()})},i.prototype.info=function(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3,n="object"===(void 0===e?"undefined":t(e));this.setState({info:{isHidden:!1,type:o,message:n?e.message:e,details:n?e.details:null}}),this.emit("info-visible"),window.clearTimeout(this.infoTimeoutID),this.infoTimeoutID=0!==r?setTimeout(this.hideInfo,r):void 0},i.prototype.hideInfo=function(){var e=o({},this.getState().info,{isHidden:!0});this.setState({info:e}),this.emit("info-hidden")},i.prototype.log=function(t,o){if(this.opts.debug){var r="[Uppy] ["+O.getTimeStamp()+"] "+t;e.uppyLog=e.uppyLog+"\nDEBUG LOG: "+t,"error"!==o?"warning"!==o?t===""+t?console.log(r):(r="[Uppy] ["+O.getTimeStamp()+"]",console.log(r),console.dir(t)):console.warn(r):console.error(r)}},i.prototype.run=function(){return this.log("Core is run, initializing actions..."),this.actions(),this},i.prototype.restore=function(e){return this.log('Core: attempting to restore upload "'+e+'"'),this.getState().currentUploads[e]?this._runUpload(e):(this._removeUpload(e),n.reject(new Error("Nonexistent upload")))},i.prototype._createUpload=function(e){var t,r=M();return this.emit("upload",{id:r,fileIDs:e}),this.setState({currentUploads:o({},this.getState().currentUploads,(t={},t[r]={fileIDs:e,step:0,result:{}},t))}),r},i.prototype._getUpload=function(e){return this.getState().currentUploads[e]},i.prototype.addResultData=function(e,t){var r;if(this._getUpload(e)){var n=this.getState(