!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,t,r,n=function(e){var t;return function(r){return t||e(t={exports:{},parent:r},t.exports),t.exports}},i=n((function(e,t){var r=tc("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=nc(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=nh(s,t)):(n[a]||(r("new io instance for %s",s),n[a]=nh(s,t)),i=n[a]),o.query&&!t.query&&(t.query=o.query),i.socket(o.path,t)}t.protocol=mc.protocol,t.connect=i,t.Manager=nh,t.Socket=$p})),o=n((function(e,t){})),s=n((function(e,t){(function(e){(function(){"use strict";t.Buffer=r,t.INSPECT_MAX_BYTES=50;function e(e){if(e>2147483647)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=r.prototype,t}function r(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 o(e)}return n(e,t,r)}function n(t,n,i){if("string"==typeof t)return function(t,n){if("string"==typeof n&&""!==n||(n="utf8"),!r.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var i=0|u(t,n),o=e(i),s=o.write(t,n);return s!==i&&(o=o.slice(0,s)),o}(t,n);if(ArrayBuffer.isView(t))return s(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(D(t,ArrayBuffer)||t&&D(t.buffer,ArrayBuffer))return function(e,t,n){if(t<0||e.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|e}function u(e,t){if(r.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||D(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return R(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(e).length;default:if(o)return i?-1:R(e).length;t=(""+t).toLowerCase(),o=!0}}function l(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function c(e,t,n,i,o){if(0===e.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:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=r.from(t,i)),r.isBuffer(t))return 0===t.length?-1:p(e,t,n,i,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):p(e,[t],n,i,o);throw new TypeError("val must be string, number or Buffer")}function p(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,h=0;hi&&(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 m(e,t,r){return 0===t&&r===e.length?Tn.fromByteArray(e):Tn.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 k(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return _(this,t,r);case"latin1":case"binary":return S(this,t,r);case"base64":return m(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)},r.prototype.toLocaleString=r.prototype.toString,r.prototype.equals=function(e){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===r.compare(this,e)},r.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+=" ... "),""},r.prototype.compare=function(e,t,n,i,o){if(D(e,Uint8Array)&&(e=r.from(e,e.offset,e.byteLength)),!r.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),t<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&t>=n)return 0;if(i>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var s=(o>>>=0)-(i>>>=0),a=(n>>>=0)-(t>>>=0),u=Math.min(s,a),l=this.slice(i,o),c=e.slice(t,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 d(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 v(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var w=4096;function _(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 E(e,t,n,i,o,s){if(!r.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function A(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||A(e,0,r,4),Vn.write(e,t,r,n,23,4),r+4}function O(e,t,r,n,i){return t=+t,r>>>=0,i||A(e,0,r,8),Vn.write(e,t,r,n,52,8),r+8}r.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=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},r.prototype.readUInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),this[e]},r.prototype.readUInt16LE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUInt16BE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]<<8|this[e+1]},r.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]},r.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])},r.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},r.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},r.prototype.readInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.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},r.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},r.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},r.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]},r.prototype.readFloatLE=function(e,t){return e>>>=0,t||C(e,4,this.length),Vn.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,t){return e>>>=0,t||C(e,4,this.length),Vn.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,t){return e>>>=0,t||C(e,8,this.length),Vn.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,t){return e>>>=0,t||C(e,8,this.length),Vn.read(this,e,!1,52,8)},r.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||E(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||E(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},r.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||E(this,e,t,1,255,0),this[t]=255&e,t+1},r.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||E(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},r.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||E(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},r.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||E(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},r.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||E(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},r.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);E(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},r.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);E(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},r.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||E(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},r.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||E(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},r.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||E(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},r.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||E(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},r.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||E(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},r.prototype.writeFloatLE=function(e,t,r){return F(this,e,t,!0,r)},r.prototype.writeFloatBE=function(e,t,r){return F(this,e,t,!1,r)},r.prototype.writeDoubleLE=function(e,t,r){return O(this,e,t,!0,r)},r.prototype.writeDoubleBE=function(e,t,r){return O(this,e,t,!1,r)},r.prototype.copy=function(e,t,n,i){if(!r.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=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),e.length-t=0;--s)e[s+t]=this[s+n];else Uint8Array.prototype.set.call(e,this.subarray(n,i),t);return o},r.prototype.fill=function(e,t,n,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=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&&!r.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){var o=e.charCodeAt(0);("utf8"===i&&o<128||"latin1"===i)&&(e=o)}}else"number"==typeof e&&(e&=255);if(t<0||this.length>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;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 U(e){return Tn.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(x,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function T(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function D(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)}).call(this,s({}).Buffer)})),a=e={};function u(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===u||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:u}catch(e){t=u}try{r="function"==typeof clearTimeout?clearTimeout:l}catch(e){r=l}}();var p,h=[],d=!1,f=-1;function g(){d&&p&&(d=!1,p.length?h=p.concat(h):f=-1,h.length&&v())}function v(){if(!d){var e=c(g);d=!0;for(var t=h.length;t;){for(p=h,h=[];++f1)for(var r=1;r-1};function u(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 l(e){return"string"!=typeof e&&(e=String(e)),e}function c(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function p(e){this.map={},e instanceof p?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 h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function d(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function f(e){var t=new FileReader,r=d(t);return t.readAsArrayBuffer(e),r}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){var r;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:n&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:i&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:t&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():o&&n&&(r=e)&&DataView.prototype.isPrototypeOf(r)?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(e)||a(e))?this._bodyArrayBuffer=g(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&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n&&(this.blob=function(){var e=h(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?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(f)}),this.text=function(){var e,t,r,n=h(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,r=d(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 b(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 w(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 p(t.headers),this.url=t.url||"",this._initBody(e)}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},v.call(m.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var _=[301,302,303,307,308];w.redirect=function(e,t){if(-1===_.indexOf(t))throw new RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},e.DOMException=self.DOMException;try{new e.DOMException}catch(pp){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 S(t,r){return new Promise((function(i,o){var s=new m(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var e,t,r={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new p,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 a?a.responseURL:r.headers.get("X-Request-URL");var n="response"in a?a.response:a.responseText;i(new w(n,r))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&n&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}S.polyfill=!0,self.fetch||(self.fetch=S,self.Headers=p,self.Request=m,self.Response=w),e.Headers=p,e.Request=m,e.Response=w,e.fetch=S,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof _.exports?w(_.exports):w(this.WHATWGFetch={}),_=_.exports;var S=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function k(){return(k=Object.assign||function(e){for(var t=1;t=7&&t<=10},z.fingerprint=R,B=z;var N={};(function(e){(function(){var t=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,i=/^0o[0-7]+$/i,o=parseInt,s="object"==typeof e&&e&&e.Object===Object&&e,a="object"==typeof self&&self&&self.Object===Object&&self,u=s||a||Function("return this")(),l=Object.prototype.toString,c=Math.max,p=Math.min,h=function(){return u.Date.now()};function d(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function f(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==l.call(e)}(e))return NaN;if(d(e)){var s="function"==typeof e.valueOf?e.valueOf():e;e=d(s)?s+"":s}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(t,"");var a=n.test(e);return a||i.test(e)?o(e.slice(2),a?2:8):r.test(e)?NaN:+e}N=function(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return d(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),function(e,t,r){var n,i,o,s,a,u,l=0,g=!1,v=!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 b(e){var r=e-u;return void 0===u||r>=t||r<0||v&&e-l>=o}function w(){var e=h();if(b(e))return _(e);a=setTimeout(w,function(e){var r=t-(e-u);return v?p(r,o-(e-l)):r}(e))}function _(e){return a=void 0,y&&n?m(e):(n=i=void 0,s)}function S(){var e=h(),r=b(e);if(n=arguments,i=this,u=e,r){if(void 0===a)return function(e){return l=e,a=setTimeout(w,t),g?m(e):s}(u);if(v)return a=setTimeout(w,t),m(u)}return void 0===a&&(a=setTimeout(w,t)),s}return t=f(t)||0,d(r)&&(g=!!r.leading,o=(v="maxWait"in r)?c(f(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:_(h())},S}(e,t,{leading:n,maxWait:t,trailing:i})}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var H,q=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};function V(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}V.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&&t18||18===n&&i>=18218};function te(e){return 2!==e.length?0+e:e}var re=function(){var e=new Date;return te(e.getHours().toString())+":"+te(e.getMinutes().toString())+":"+te(e.getSeconds().toString())},ne={justErrorsLogger:{debug:function(){},warn:function(){},error:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n2;)_.push(arguments[s]);for(r&&null!=r.children&&(_.length||_.push(r.children),delete r.children);_.length;)if((i=_.pop())&&void 0!==i.pop)for(s=i.length;s--;)_.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!==w.vnode&&w.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==C.push(e)&&(w.debounceRendering||k)(i)}function i(){var e,t=C;for(C=[];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===P.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](w.event&&w.event(e)||e)}function c(){for(var e;e=E.pop();)w.afterMount&&w.afterMount(e),e.componentDidMount&&e.componentDidMount()}function p(e,t,r,n,i,l){A++||(F=null!=i&&void 0!==i.ownerSVGElement,O=null!=e&&!("__preactattr_"in e));var p=function e(t,r,n,i,l){var c=t,p=F;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),h(t,!0))),c.__preactattr_=!0,c;var d,g,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)?(v(i,c,3,r,n),e=i.base):(o&&!u&&(m(o),e=a=null),i=f(t.nodeName,c,r),e&&!i.__b&&(i.__b=e,a=null),v(i,c,1,r,n),e=i.base,a&&e!==a&&(a._component=null,h(a,!1))),e}(t,r,n,i);if(F="svg"===y||"foreignObject"!==y&&F,y=String(y),(!t||!o(t,y))&&(d=y,(g=F?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d)).__n=d,c=g,t)){for(;t.firstChild;)c.appendChild(t.firstChild);t.parentNode&&t.parentNode.replaceChild(c,t),h(t,!0)}var b=c.firstChild,w=c.__preactattr_,_=r.children;if(null==w){w=c.__preactattr_={};for(var S=c.attributes,k=S.length;k--;)w[S[k].name]=S[k].value}return!O&&_&&1===_.length&&"string"==typeof _[0]&&null!=b&&void 0!==b.splitText&&null==b.nextSibling?b.nodeValue!=_[0]&&(b.nodeValue=_[0]):(_&&_.length||null!=b)&&function(t,r,n,i,s){var u,l,c,p,d,f,g,v,y=t.childNodes,m=[],b={},w=0,_=0,S=y.length,k=0,P=r?r.length:0;if(0!==S)for(var C=0;C2?[].slice.call(arguments,2):e.children)},Component:b,render:function(e,t,r){return p(r,e,{},!1,t,!1)},rerender:i,options:w};ie.exports=R}(),ie=ie.exports;var oe=function(e){return e&&"object"==typeof e&&e.nodeType===Node.ELEMENT_NODE},se=function(e,t){return void 0===t&&(t=document),"string"==typeof e?t.querySelector(e):oe(e)?e:void 0};function ae(){return(ae=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}();function ce(){return(ce=Object.assign||function(e){for(var t=1;ts)throw new me(""+this.i18n("youCanOnlyUploadX",{smart_count:s}));if(a&&!a.some((function(t){return t.indexOf("/")>-1?!!e.type&&function(e,t){function r(t){var r=H(t,e,X);return r&&r.length>=2}return t?r(t.split(";")[0]):r}(e.type.replace(/;.*?$/,""),t):!("."!==t[0]||!e.extension)&&e.extension.toLowerCase()===t.substr(1).toLowerCase()}))){var u=a.join(", ");throw new me(this.i18n("youCanOnlyUploadFileTypes",{types:u}))}if(o&&null!=e.size){var l=0;if(l+=e.size,t.forEach((function(e){l+=e.size})),l>o)throw new me(this.i18n("exceedsSize2",{backwardsCompat:this.i18n("exceedsSize"),size:q(o)}))}if(n&&null!=e.size&&e.size>n)throw new me(this.i18n("exceedsSize2",{backwardsCompat:this.i18n("exceedsSize"),size:q(n)}));if(i&&null!=e.size&&e.size5?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",this.opts.infoTimeout);var u=new Error(a);throw u.errors=i,u}},n.removeFiles=function(e,t){var r=this,n=this.getState(),i=n.files,o=n.currentUploads,s=ce({},i),a=ce({},o),u=Object.create(null);function l(e){return void 0===u[e]}e.forEach((function(e){i[e]&&(u[e]=i[e],delete s[e])}));var c=[];Object.keys(a).forEach((function(e){var t=o[e].fileIDs.filter(l);0!==t.length?a[e]=ce({},o[e],{fileIDs:t}):c.push(e)})),c.forEach((function(e){delete a[e]}));var p={currentUploads:a,files:s};0===Object.keys(s).length&&(p.allowNewUpload=!0,p.error=null),this.setState(p),this._calculateTotalProgress();var h=Object.keys(u);h.forEach((function(e){r.emit("file-removed",u[e],t)})),h.length>5?this.log("Removed "+h.length+" files"):this.log("Removed files: "+h.join(", "))},n.removeFile=function(e,t){void 0===t&&(t=null),this.removeFiles([e],t)},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=ce({},this.getState().files);Object.keys(e).filter((function(t){return!e[t].progress.uploadComplete&&e[t].progress.uploadStarted})).forEach((function(t){var r=ce({},e[t],{isPaused:!0});e[t]=r})),this.setState({files:e}),this.emit("pause-all")},n.resumeAll=function(){var e=ce({},this.getState().files);Object.keys(e).filter((function(t){return!e[t].progress.uploadComplete&&e[t].progress.uploadStarted})).forEach((function(t){var r=ce({},e[t],{isPaused:!1,error:null});e[t]=r})),this.setState({files:e}),this.emit("resume-all")},n.retryAll=function(){var e=ce({},this.getState().files),t=Object.keys(e).filter((function(t){return e[t].error}));if(t.forEach((function(t){var r=ce({},e[t],{isPaused:!1,error:null});e[t]=r})),this.setState({files:e,error:null}),this.emit("retry-all",t),0===t.length)return Promise.resolve({successful:[],failed:[]});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,"cancel-all"),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:ce({},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:ce({},n,{postprocess:e.postProcessors.length>0?{mode:"indeterminate"}:null,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:ce({},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=ce({},e.getState().files);r[t.id]=ce({},r[t.id],{progress:ce({},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:ce({},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=ce({},e.getState().files);r[t.id]=ce({},r[t.id],{progress:ce({},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=ce({},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=B();return this.emit("upload",{id:u,fileIDs:e}),this.setState({allowNewUpload:!1!==this.opts.allowMultipleUploads,currentUploads:ce({},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=ce({},n[e],{result:ce({},n[e].result,t)});this.setState({currentUploads:ce({},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=ce({},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 this.preflightDone?Promise.resolve(this.allowedHeaders.slice()):fetch(this._getUrl(e),{method:"OPTIONS"}).then((function(e){return 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,t.allowedHeaders.slice()})).catch((function(e){return t.uppy.log("[CompanionClient] unable to make preflight request "+e,"warning"),t.preflightDone=!0,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 this.preflightAndHeaders(e).then((function(t){return Ue(r._getUrl(e),{method:"get",headers:t,credentials:r.opts.companionCookiesRule||"same-origin"})})).then(this._getPostResponseFunc(t)).then((function(e){return r._json(e)})).catch((function(t){return t=t.isAuthError?t:new Error("Could not get "+r._getUrl(e)+". "+t),Promise.reject(t)}))},n.post=function(e,t,r){var n=this;return this.preflightAndHeaders(e).then((function(r){return Ue(n._getUrl(e),{method:"post",headers:r,credentials:n.opts.companionCookiesRule||"same-origin",body:JSON.stringify(t)})})).then(this._getPostResponseFunc(r)).then((function(e){return n._json(e)})).catch((function(t){return t=t.isAuthError?t:new Error("Could not post "+n._getUrl(e)+". "+t),Promise.reject(t)}))},n.delete=function(e,t,r){var n=this;return this.preflightAndHeaders(e).then((function(r){return Ue(n.hostname+"/"+e,{method:"delete",headers:r,credentials:n.opts.companionCookiesRule||"same-origin",body:t?JSON.stringify(t):null})})).then(this._getPostResponseFunc(r)).then((function(e){return n._json(e)})).catch((function(t){return t=t.isAuthError?t:new Error("Could not delete "+n._getUrl(e)+". "+t),Promise.reject(t)}))},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}}}])&&De(t.prototype,r),e}(),Oe.VERSION="1.8.2",xe),Ie=Object.prototype.hasOwnProperty,Me=function e(t,r){var n=[];for(var i in t)if(Ie.call(t,i)){var o,s=t[i],a=encodeURIComponent(i);o="object"==typeof s?e(s,r?r+"["+a+"]":a):(r?r+"["+a+"]":a)+"="+encodeURIComponent(s),n.push(o)}return n.join("&")},je={};function Le(){return(Le=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(pp){console.log(pp)}},e}()},He=ie.h,qe=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=He("span",{class:"uppy-Provider-authTitleName"},this.props.pluginName,He("br",null));return He("div",{class:"uppy-Provider-auth"},He("div",{class:"uppy-Provider-authIcon"},this.props.pluginIcon()),He("div",{class:"uppy-Provider-authTitle"},this.props.i18nArray("authenticateWithTitle",{pluginName:e})),He("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}(ie.Component),Ve=ie.h,We=ie.h,Xe=function(e){return We("span",null,We("button",{type:"button",class:"uppy-u-reset",onclick:e.getFolder},e.title),e.isLast?"":" / ")},Ye=function(e){var t=[];return e.showBreadcrumbs&&t.push(function(e){return We("div",{class:"uppy-Provider-breadcrumbs"},We("div",{class:"uppy-Provider-breadcrumbsIcon"},e.breadcrumbsIcon),e.directories.map((function(t,r){return We(Xe,{key:t.id,getFolder:function(){return e.getFolder(t.id)},title:0===r?e.title:t.title,isLast:r+1===e.directories.length})})))}({getFolder:e.getFolder,directories:e.directories,breadcrumbsIcon:e.pluginIcon&&e.pluginIcon(),title:e.title})),t.push(function(e){return[Ve("span",{class:"uppy-ProviderBrowser-user",key:"username"},e.username),Ve("button",{type:"button",onclick:e.logout,class:"uppy-u-reset uppy-ProviderBrowser-userLogout",key:"logout"},e.i18n("logOut"))]}({logout:e.logout,username:e.username,i18n:e.i18n})),t},Ge={exports:{}};!function(){"use strict";var e={}.hasOwnProperty;function t(){for(var r=[],n=0;n0&&_t(yt,mt({selected:u},e)))},kt=ie.h,Pt=function(e){return kt("div",{class:"uppy-Provider-loading"},kt("span",null,e.i18n("loading")))},Ct=function(e){if(!e)return!1;var t=e.split("/")[1];return!!/^(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(t)},Et=function(){function e(e){this.plugin=e,this.filterItems=this.filterItems.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.isChecked=this.isChecked.bind(this),this.loaderWrapper=this.loaderWrapper.bind(this)}var t=e.prototype;return t.filterItems=function(e){var t=this.plugin.getPluginState();return t.filterInput&&""!==t.filterInput?e.filter((function(e){return-1!==e.name.toLowerCase().indexOf(t.filterInput.toLowerCase())})):e},t.toggleCheckbox=function(e,t){var r=this;e.stopPropagation(),e.preventDefault(),e.currentTarget.focus();var n=this.plugin.getPluginState(),i=n.folders,o=n.files,s=this.filterItems(i.concat(o));if(this.lastCheckbox&&e.shiftKey){var a,u=s.indexOf(this.lastCheckbox),l=s.indexOf(t);return a=(a=ui?-1:ri?1:ri?-1:ri?1:ri?-1:ni?1:n0||!r&&i(t)?nr("button",{class:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--edit",type:"button","aria-label":o("editFile")+" "+t.meta.name,title:o("editFile"),onclick:function(){return s()}},nr("svg",{"aria-hidden":"true",focusable:"false",class:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14"},nr("g",{"fill-rule":"evenodd"},nr("path",{d:"M1.5 10.793h2.793A1 1 0 0 0 5 10.5L11.5 4a1 1 0 0 0 0-1.414L9.707.793a1 1 0 0 0-1.414 0l-6.5 6.5A1 1 0 0 0 1.5 8v2.793zm1-1V8L9 1.5l1.793 1.793-6.5 6.5H2.5z","fill-rule":"nonzero"}),nr("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),nr("path",{"fill-rule":"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})))):null}function or(e){var t=e.i18n,r=e.onClick;return nr("button",{class:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--remove",type:"button","aria-label":t("removeFile"),title:t("removeFile"),onclick:function(){return r()}},nr("svg",{"aria-hidden":"true",focusable:"false",class:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18"},nr("path",{d:"M9 0C4.034 0 0 4.034 0 9s4.034 9 9 9 9-4.034 9-9-4.034-9-9-9z"}),nr("path",{fill:"#FFF",d:"M13 12.222l-.778.778L9 9.778 5.778 13 5 12.222 8.222 9 5 5.778 5.778 5 9 8.222 12.222 5l.778.778L9.778 9z"})))}var sr=function(e,t){var r,n;(r=t.file.uploadURL,n=t.i18n("copyLinkToClipboardFallback"),n=n||"Copy the URL below",new Promise((function(e){var t=document.createElement("textarea");t.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),t.value=r,document.body.appendChild(t),t.select();var i=function(){document.body.removeChild(t),window.prompt(n,r),e()};try{return document.execCommand("copy")?(document.body.removeChild(t),e()):i()}catch(pp){return document.body.removeChild(t),i()}}))).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 ar(e){return nr("button",{class:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--copyLink",type:"button","aria-label":e.i18n("copyLink"),title:e.i18n("copyLink"),onclick:function(t){return sr(t,e)}},nr("svg",{"aria-hidden":"true",focusable:"false",class:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12"},nr("path",{d:"M7.94 7.703a2.613 2.613 0 0 1-.626 2.681l-.852.851a2.597 2.597 0 0 1-1.849.766A2.616 2.616 0 0 1 2.764 7.54l.852-.852a2.596 2.596 0 0 1 2.69-.625L5.267 7.099a1.44 1.44 0 0 0-.833.407l-.852.851a1.458 1.458 0 0 0 1.03 2.486c.39 0 .755-.152 1.03-.426l.852-.852c.231-.231.363-.522.406-.824l1.04-1.038zm4.295-5.937A2.596 2.596 0 0 0 10.387 1c-.698 0-1.355.272-1.849.766l-.852.851a2.614 2.614 0 0 0-.624 2.688l1.036-1.036c.041-.304.173-.6.407-.833l.852-.852c.275-.275.64-.426 1.03-.426a1.458 1.458 0 0 1 1.03 2.486l-.852.851a1.442 1.442 0 0 1-.824.406l-1.04 1.04a2.596 2.596 0 0 0 2.683-.628l.851-.85a2.616 2.616 0 0 0 0-3.697zm-6.88 6.883a.577.577 0 0 0 .82 0l3.474-3.474a.579.579 0 1 0-.819-.82L5.355 7.83a.579.579 0 0 0 0 .819z"})))}var ur=function(e){var t=e.file,r=e.uploadInProgressOrComplete,n=e.canEditFile,i=e.metaFields,o=e.showLinkToFileUploadResult,s=e.showRemoveButton,a=e.i18n,u=e.removeFile,l=e.toggleFileCard,c=e.openFileEditor,p=e.log,h=e.info;return nr("div",{className:"uppy-Dashboard-Item-actionWrapper"},nr(ir,{i18n:a,file:t,uploadInProgressOrComplete:r,canEditFile:n,metaFields:i,onClick:function(){i&&i.length>0?l(!0,t.id):c(t)}}),o&&t.uploadURL?nr(ar,{file:t,i18n:a,info:h,log:p}):null,s?nr(or,{i18n:a,info:e.info,log:e.log,onClick:function(){return u(t.id,"removed-by-user")}}):null)},lr=ie.h,cr=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!function(e,t){if(e===t)return!0;for(var r in e)if(!(r in t))return!1;for(var r in t)if(e[r]!==t[r])return!1;return!0}(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.error||!1,s=(this.props.individualCancellation||!i)&&!r;r&&this.props.showRemoveButtonAfterComplete&&(s=!0);var a=Ge({"uppy-Dashboard-Item":!0,"is-inprogress":i,"is-processing":t,"is-complete":r,"is-error":!!o,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation});return lr("div",{class:a,id:"uppy_"+e.id,role:this.props.role},lr("div",{class:"uppy-Dashboard-Item-preview"},lr(Yt,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult}),lr(Zt,{file:e,error:o,isUploaded:r,hideRetryButton:this.props.hideRetryButton,hideCancelButton:this.props.hideCancelButton,hidePauseResumeButton:this.props.hidePauseResumeButton,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})),lr("div",{class:"uppy-Dashboard-Item-fileInfoAndButtons"},lr(rr,{file:e,id:this.props.id,acquirers:this.props.acquirers,containerWidth:this.props.containerWidth,i18n:this.props.i18n}),lr(ur,{file:e,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:s,canEditFile:this.props.canEditFile,uploadInProgressOrComplete:n,removeFile:this.props.removeFile,toggleFileCard:this.props.toggleFileCard,openFileEditor:this.props.openFileEditor,i18n:this.props.i18n,log:this.props.log,info:this.props.info})))},n}(ie.Component);function pr(){return(pr=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 h=c+p+4,d=t.slice(c,h),f=pr({},fr,{height:t.length*r}),g=pr({},gr,{top:c*r});return hr("div",pr({onScroll:this.handleScroll},s),hr("div",{role:"presentation",style:f},hr("div",{role:"presentation",style:g},d.map(n))))},n}(dr);function yr(){return(yr=Object.assign||function(e){for(var t=1;t0?t.props.i18nArray("dropPasteImport"+n,{browseFiles:l,browseFolders:c,browse:u}):t.props.i18nArray("dropPaste"+n,{browseFiles:l,browseFolders:c,browse:u}),"files"===r)try{a=e>0?t.props.i18nArray("dropPasteImport",{browse:u}):t.props.i18nArray("dropPaste",{browse:u})}catch(d){}return wr("div",{class:"uppy-Dashboard-AddFiles-title"},a)},t.renderAcquirer=function(e){return wr("div",{class:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":e.id},wr("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(),wr("div",{class:"uppy-DashboardTab-name"},e.name)))},t.renderAcquirers=function(e){var r=[].concat(e),n=r.splice(e.length-2,e.length);return wr("div",{class:"uppy-Dashboard-AddFiles-list",role:"tablist"},t.renderMyDeviceAcquirer(),r.map((function(e){return t.renderAcquirer(e)})),wr("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=wr("span",null,wr("svg",{"aria-hidden":"true",focusable:"false",class:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11"},wr("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z","fill-rule":"evenodd"})),wr("span",{class:"uppy-Dashboard-poweredByUppy"},"Uppy")),t=this.props.i18nArray("poweredBy2",{backwardsCompat:this.props.i18n("poweredBy"),uppy:e});return wr("a",{tabindex:"-1",href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",class:"uppy-Dashboard-poweredBy"},t)},i.render=function(){var e=this;return wr("div",{class:"uppy-Dashboard-AddFiles"},this.renderHiddenInput(!1,(function(t){e.fileInput=t})),this.renderHiddenInput(!0,(function(t){e.folderInput=t})),this.renderDropPasteBrowseTagline(),this.props.acquirers.length>0&&this.renderAcquirers(this.props.acquirers),wr("div",{class:"uppy-Dashboard-AddFiles-info"},this.props.note&&wr("div",{class:"uppy-Dashboard-note"},this.props.note),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy(this.props)))},n}(ie.Component),Sr=ie.h,kr=function(e){return Sr("div",{class:Ge("uppy-Dashboard-AddFilesPanel",e.className),"data-uppy-panelType":"AddFiles","aria-hidden":e.showAddFilesPanel},Sr("div",{class:"uppy-DashboardContent-bar"},Sr("div",{class:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},e.i18n("addingMoreFiles")),Sr("button",{class:"uppy-DashboardContent-back",type:"button",onclick:function(t){return e.toggleAddFilesPanel(!1)}},e.i18n("back"))),Sr(_r,e))},Pr=function(e){var t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t?(e.preventDefault(),e.stopPropagation()):e.stopPropagation()},Cr=ie.h,Er=function(e){return Cr("div",{class:Ge("uppy-DashboardContent-panel",e.className),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:"uppy-DashboardContent-panel--"+e.activePickerPanel.id,onDragOver:Pr,onDragLeave:Pr,onDrop:Pr,onPaste:Pr},Cr("div",{class:"uppy-DashboardContent-bar"},Cr("div",{class:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},e.i18n("importFrom",{name:e.activePickerPanel.name})),Cr("button",{class:"uppy-DashboardContent-back",type:"button",onclick:e.hideAllPanels},e.i18n("done"))),Cr("div",{class:"uppy-DashboardContent-panelBody"},e.getPlugin(e.activePickerPanel.id).render(e.state)))},Ar=ie.h,Fr=function(e){var t=this.props.files[this.props.fileCardFor];return Ar("div",{class:Ge("uppy-DashboardContent-panel",e.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor"},Ar("div",{class:"uppy-DashboardContent-bar"},Ar("div",{class:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},e.i18nArray("editing",{file:Ar("span",{class:"uppy-DashboardContent-titleFile"},t.meta?t.meta.name:t.name)})),Ar("button",{class:"uppy-DashboardContent-back",type:"button",onclick:e.hideAllPanels},e.i18n("done"))),Ar("div",{class:"uppy-DashboardContent-panelBody"},e.editors.map((function(t){return e.getPlugin(t.id).render(e.state)}))))},Or=ie.h,xr="error",Rr="waiting",Ur="preprocessing",Tr="uploading",Dr="postprocessing",Br="complete",Ir="paused";function Mr(e){switch(function(e,t,r,n){if(void 0===n&&(n={}),e)return xr;if(t)return Br;if(r)return Ir;for(var i=Rr,o=Object.keys(n),s=0;s1;return sn("div",{class:"uppy-StatusBar-statusSecondary"},t&&e.i18n("filesUploadedOfTotal",{complete:e.complete,smart_count:e.numUploads}),sn("span",{class:"uppy-StatusBar-additionalInfo"},t&&" \xb7 ",e.i18n("dataUploadedOfTotal",{complete:q(e.totalUploadedSize),total:q(e.totalSize)})," \xb7 ",e.i18n("xTimeLeft",{time:tn(e.totalETA)})))}),500,{leading:!0,trailing:!0}),yn=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 sn("div",{class:"uppy-StatusBar-content","aria-label":t,title:t},e.isAllPaused?null:sn(hn,null),sn("div",{class:"uppy-StatusBar-status"},sn("div",{class:"uppy-StatusBar-statusPrimary"},e.supportsUploadProgress?t+": "+e.totalProgress+"%":t),e.isAllPaused||r||!e.showProgressDetails?null:e.supportsUploadProgress?sn(vn,e):sn(fn,e),r?sn(gn,e):null))},mn=function(e){e.totalProgress;var t=e.i18n;return sn("div",{class:"uppy-StatusBar-content",role:"status",title:t("complete")},sn("div",{class:"uppy-StatusBar-status"},sn("div",{class:"uppy-StatusBar-statusPrimary"},sn("svg",{"aria-hidden":"true",focusable:"false",class:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11"},sn("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})),t("complete"))))},bn=function(e){var t=e.error,r=(e.retryAll,e.hideRetryButton,e.i18n);return sn("div",{class:"uppy-StatusBar-content",role:"alert",title:r("uploadFailed")},sn("div",{class:"uppy-StatusBar-status"},sn("div",{class:"uppy-StatusBar-statusPrimary"},sn("svg",{"aria-hidden":"true",focusable:"false",class:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11"},sn("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"))),sn("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)}},"?"))},wn=function(e){for(;e&&!e.dir;)e=e.parentNode;return e?e.dir:void 0};function _n(){return(_n=Object.assign||function(e){for(var t=1;t0,b=100===i&&l.length===Object.keys(r).length&&0===f.length,w=o&&c.length===s.length,_=0!==p.length&&u.length===p.length,S=p.length>0,k=t.resumableUploads||!1,P=!1!==t.uploadProgress;return function(e){var t,r,n=e=e||{},i=n.newFiles,o=n.allowNewUpload,s=n.isUploadInProgress,a=n.isAllPaused,u=n.resumableUploads,l=n.error,c=n.hideUploadButton,p=n.hidePauseResumeButton,h=n.hideCancelButton,d=n.hideRetryButton,f=e.uploadState,g=e.totalProgress;if(f===Jr||f===Zr){var v=function(e){var t=[];Object.keys(e).forEach((function(r){var n=e[r].progress;n.preprocess&&t.push(n.preprocess),n.postprocess&&t.push(n.postprocess)}));var r=t[0];return{mode:r.mode,message:r.message,value:t.filter((function(e){return"determinate"===e.mode})).reduce((function(e,t,r,n){return e+t.value/n.length}),0)}}(e.files);"determinate"===(t=v.mode)&&(g=100*v.value),r=dn(v)}else f===en?r=mn(e):f===Qr?(e.supportsUploadProgress||(t="indeterminate",g=null),r=yn(e)):f===Kr&&(g=void 0,r=bn(e));var y="number"==typeof g?g:100,m=f===$r&&e.hideUploadButton||f===$r&&!e.newFiles>0||f===en&&e.hideAfterFinish,b=!l&&i&&!s&&!a&&o&&!c,w=!h&&f!==$r&&f!==en,_=u&&!p&&f===Qr,S=l&&!d,k=e.doneButtonHandler&&f===en,P="uppy-StatusBar-progress\n "+(t?"is-"+t:""),C=Ge({"uppy-Root":e.isTargetDOMEl},"uppy-StatusBar","is-"+f);return sn("div",{class:C,"aria-hidden":m},sn("div",{class:P,style:{width:y+"%"},role:"progressbar","aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":g}),r,sn("div",{class:"uppy-StatusBar-actions"},b?sn(an,rn({},e,{uploadState:f})):null,S?sn(un,e):null,_?sn(cn,e):null,w?sn(ln,e):null,k?sn(pn,e):null))}({error:o,uploadState:this.getUploadingState(w,b,e.files||{}),allowNewUpload:n,totalProgress:i,totalSize:v,totalUploadedSize:y,isAllComplete:b,isAllPaused:_,isAllErrored:w,isUploadStarted:m,isUploadInProgress:S,complete:l.length,newFiles:a.length,numUploads:d.length,totalETA:g,files:r,i18n:this.i18n,pauseAll:this.uppy.pauseAll,resumeAll:this.uppy.resumeAll,retryAll:this.uppy.retryAll,cancelAll:this.uppy.cancelAll,startUpload:this.startUpload,doneButtonHandler:this.opts.doneButtonHandler,resumableUploads:k,supportsUploadProgress:P,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.onMount=function(){var e=this.el;wn(e)||(e.dir="ltr")},i.install=function(){var e=this.opts.target;e&&this.mount(e,this)},i.uninstall=function(){this.unmount()},n}(ue.Plugin),nn.VERSION="1.9.1",on);function En(){return(En=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=Bn[e.charCodeAt(r)]<<2|Bn[e.charCodeAt(r+1)]>>4,s[a++]=255&t),1===o&&(t=Bn[e.charCodeAt(r)]<<10|Bn[e.charCodeAt(r+1)]<<4|Bn[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(Dn[t>>2]+Dn[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],i.push(Dn[t>>10]+Dn[t>>4&63]+Dn[t<<2&63]+"=")),i.join("")}},Dn=[],Bn=[],In="undefined"!=typeof Uint8Array?Uint8Array:Array,Mn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",jn=0,Ln=Mn.length;jn0)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 Nn(e,t,r){for(var n,i,o=[],s=t;s>18&63]+Dn[i>>12&63]+Dn[i>>6&63]+Dn[63&i]);return o.join("")}Bn["-".charCodeAt(0)]=62,Bn["_".charCodeAt(0)]=63;var Hn,qn,Vn={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,h=r?-1:1,d=e[t+p];for(p+=h,o=d&(1<<-c)-1,d>>=-c,c+=a;c>0;o=256*o+e[t+p],p+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+e[t+p],p+=h,c-=8);if(0===o)o=1-l;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=l}return(d?-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,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,f=n?1:-1,g=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?h/u:h*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+d]=255&a,d+=f,a/=256,i-=8);for(s=s<0;e[r+d]=255&s,d+=f,s/=256,l-=8);e[r+d-f]|=128*g}},Wn={exports:{}};function Xn(){return(Xn=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)}))},P=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){void 0===n&&(n=t.byteLength-r),(r+=t.byteOffset)+n>t.byteOffset+t.byteLength&&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){var u=new DataView(new ArrayBuffer(t));this._swapDataView(u)}else B("Invalid input argument for BufferView: "+t)}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;return 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||B("BufferView.set(): Invalid data argument."),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):U?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:"getUintBytes",value:function(e,t,r){switch(t){case 1:return this.getUint8(e,r);case 2:return this.getUint16(e,r);case 4:return this.getUint32(e,r);case 8:return this.getUint64&&this.getUint64(e,r)}}},{key:"getUint",value:function(e,t,r){switch(t){case 8:return this.getUint8(e,r);case 16:return this.getUint16(e,r);case 32:return this.getUint32(e,r);case 64:return this.getUint64&&this.getUint64(e,r)}}},{key:"toString",value:function(e){return this.dataView.toString(e,this.constructor.name)}},{key:"ensureChunk",value:function(){}}]),e}();function L(e,t){B("".concat(e," '").concat(t,"' was not loaded, try using full build of exifr."))}var z=function(e){function t(e){var r;return i(this,t),(r=f(this,l(t).call(this))).kind=e,r}return u(t,h(E)),s(t,[{key:"get",value:function(e,r){return this.has(e)||L(this.kind,e),r&&(e in r||function(e,t){B("Unknown ".concat(e," '").concat(t,"'."))}(this.kind,e),r[e].enabled||L(this.kind,e)),g(l(t.prototype),"get",this).call(this,e)}},{key:"keyList",value:function(){return w(this.keys())}}]),t}(),N=new z("file parser"),H=new z("segment parser"),q=new z("file reader");function V(e){return function(){for(var t=[],r=0;r1e4?K(e,t,"base64"):F?$(e,t,"url",Y):x?K(e,t,"fs"):void B("Invalid input argument");var r}var Q=function(e){function t(){return i(this,t),f(this,l(t).apply(this,arguments))}return u(t,h(E)),s(t,[{key:"tagKeys",get:function(){return this.allKeys||(this.allKeys=w(this.keys())),this.allKeys}},{key:"tagValues",get:function(){return this.allValues||(this.allValues=w(this.values())),this.allValues}}]),t}();function Z(e,t,r){var n=new Q,i=r;Array.isArray(i)||("function"==typeof i.entries&&(i=i.entries()),i=w(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!0===n||!1===n?s.parse=s.enabled=n:B("Invalid options argument: ".concat(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=ce;Array.isArray(n)||("function"==typeof n.entries&&(n=n.entries()),n=w(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,ihdr:void 0,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=C(),ve=function(e){function t(e){var r;return i(this,t),r=f(this,l(t).call(this)),!0===e?r.setupFromTrue():void 0===e?r.setupFromUndefined():Array.isArray(e)?r.setupFromArray(e):"object"==typeof e?r.setupFromObject(e):B("Invalid options argument ".concat(e)),void 0===r.firstChunkSize&&(r.firstChunkSize=F?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=new this(e),ge.set(e,t)),t}}]),s(t,[{key:"setupFromUndefined",value:function(){var e,t=ie;Array.isArray(t)||("function"==typeof t.entries&&(t=t.entries()),t=w(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=w(i));for(var o=0;o0&&(t.errors=r),D(n=t)?void 0:n;var n}))}catch(e){return Promise.reject(e)}}},{key:"doParse",value:function(e,t){try{var r=this;return we(r.fileParser.parse(),(function(){var n,i=v(r.parsers).map((n=function(t){return we(t.parse(),(function(r){t.assignToOutput(e,r)}))},function(){for(var e=[],t=0;ti+s?e.chunk=o.file.subarray(i,s):void 0===e.size?e.chunk=o.file.subarray(i):B("Segment unreachable: "+JSON.stringify(e))},r=function(){return e.chunk},(n=t())&&n.then?n.then(r):r()}.apply(this,t))}catch(e){return Promise.reject(e)}})),this.extendOptions&&this.extendOptions(t),this.options=t,this.file=r,this.parsers=n}return s(e,[{key:"injectSegment",value:function(e,t){this.options[e].enabled&&this.createParser(e,t)}},{key:"createParser",value:function(e,t){var r=new(H.get(e))(t,this.options,this.file);return this.parsers[e]=r}},{key:"createParsers",value:function(e){var t=e;Array.isArray(t)||("function"==typeof t.entries&&(t=t.entries()),t=w(t));for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;i(this,e),a(this,"errors",[]),a(this,"raw",C()),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 j?e:new j(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 ve(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=ne.get(t),n=re.get(t),i=te.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=w(c));for(var p=0;p=224&&e<=239}function Le(e,t,r){var n=H;Array.isArray(n)||("function"==typeof n.entries&&(n=n.entries()),n=w(n));for(var i=0;i0&&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 Te((function(){if(!i&&r.file.chunked)return i=w(o).some((function(e){var t=H.get(e),n=r.options[e];return t.multiSegment&&n.multiSegment})),function(e){var t=function(){if(i)return function(e,t){return e&&e.then?e.then(Ue):Promise.resolve()}(r.file.readWhole())}();if(t&&t.then)return t.then(Ue)}()}),(function(){var t=!1;if(e=r.findAppSegmentsInRange(e,n.byteLength),!r.options.onlyTiff)return function(){if(n.chunked){var i=!1;return function(e,t,r){for(var n;;){var i=e();if(Ie(i)&&(i=i.v),!i)return s;if(i.then){n=0;break}var o,s=r();if(s&&s.then){if(!Ie(s)){n=1;break}s=s.s}}var a=new Be,u=De.bind(null,a,2);return(0===n?i.then(c):1===n?s.then(l):o.then(p)).then(void 0,u),a;function l(t){s=t;do{if(!(i=e())||Ie(i)&&!i.v)return void De(a,1,s);if(i.then)return void i.then(c).then(void 0,u);Ie(s=r())&&(s=s.v)}while(!s||!s.then);s.then(l).then(void 0,u)}function c(e){e?(s=r())&&s.then?s.then(l).then(void 0,u):l(s):De(a,1,s)}function p(){(i=e())?i.then?i.then(c).then(void 0,u):c(i):De(a,1,s)}}((function(){return!t&&s.size>0&&!i&&(!!n.canReadNextChunk||!!r.unfinishedMultiSegment)}),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 Te((function(){return Re(e>o&&!s?n.readNextChunk(e):n.readNextChunk(o),(function(e){i=!e}))}),(function(){void 0===(e=r.findAppSegmentsInRange(e,n.byteLength))&&(t=!0)}))}))}}()}))}catch(e){return Promise.reject(e)}}},{key:"findAppSegmentsInRange",value:function(e,t){t-=2;for(var r,n,i,o,s,a,u=this.file,l=this.findAll,c=this.wanted,p=this.remaining,h=this.options;et.byteLength&&B("IFD0 offset points to outside of file.\nthis.ifd0Offset: ".concat(e.ifd0Offset,", file.byteLength: ").concat(t.byteLength)),qe((function(){if(t.tiff)return He(t.ensureChunk(e.ifd0Offset,I(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:"parseExifBlock",value:function(){try{var e=this;if(e.exif)return;return qe((function(){if(!e.ifd0)return He(e.parseIfd0Block())}),(function(){if(void 0!==e.exifOffset)return qe((function(){if(e.file.tiff)return He(e.file.ensureChunk(e.exifOffset,I(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 qe((function(){if(!e.ifd0)return He(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",Xe.apply(void 0,t.get(2).concat([t.get(1)]))),t.set("longitude",Xe.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 qe((function(){if(!e.ifd0)return He(e.parseIfd0Block())}),(function(){return qe((function(){if(void 0===e.interopOffset&&!e.exif)return He(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(),qe((function(){if(!e.ifd1Parsed)return He(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=ae;Array.isArray(i)||("function"==typeof i.entries&&(i=i.entries()),i=w(i));for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:C(),n=this.options[t],i=n.pick,o=n.skip,s=(i=P(i)).size>0,a=0===o.size,u=this.chunk.getUint16(e);e+=2;for(var l=0;l13)&&B("Invalid TIFF value type. block: ".concat(r.toUpperCase(),", tag: ").concat(t.toString(16),", type: ").concat(o,", offset ").concat(e)),e>i.byteLength&&B("Invalid TIFF value offset. block: ".concat(r.toUpperCase(),", tag: ").concat(t.toString(16),", type: ").concat(o,", offset ").concat(e," is outside of chunk size ").concat(i.byteLength)),1===o)return i.getUint8Array(e,s);if(2===o)return""===(n=function(e){for(;e.endsWith("\0");)e=e.slice(0,-1);return e}(n=i.getString(e,s)).trim())?void 0:n;if(7===o)return i.getUint8Array(e,s);if(1===s)return this.parseTagValue(o,e);for(var u=new(function(e){switch(o){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}}())(s),l=a,c=0;c=81&&(n.rotateCanvas=n.rotateCss=!1)}else if(ot.includes("Firefox/")){var ht=ot.match(/Firefox\/(\d+)/),dt=(ht[0],ht[1]);Number(dt)>=77&&(n.rotateCanvas=n.rotateCss=!1)}}function ft(){}var gt=function(e){function t(){var e,r;i(this,t);for(var n=arguments.length,o=new Array(n),s=0;sthis.byteLength){var o=this._extend(i).dataView;this._swapDataView(o)}}}},{key:"_extend",value:function(e){var t;t=U?R.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),g(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=g(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(ft):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}(),vt=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 yt(e,t.offset,r)||yt(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 yt(e,t,r){return e<=t&&t<=r}function mt(){}function bt(e,t){if(!t)return e&&e.then?e.then(mt):Promise.resolve()}function wt(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var _t=function(e){function t(){return i(this,t),f(this,l(t).apply(this,arguments))}return u(t,e),s(t,[{key:"readWhole",value:function(){try{var e=this;return e.chunked=!1,wt(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,g(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 wt(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(d(n=f(this,l(t).call(this,0))),"chunksRead",0),n.input=e,n.options=r,n}return u(t,gt),s(t,[{key:"readWhole",value:function(){try{return this.chunked=!1,bt(this.readChunk(this.nextChunkOffset))}catch(e){return Promise.reject(e)}}},{key:"readChunked",value:function(){try{return this.chunked=!0,bt(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.chunksRead4096&&(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(Un(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(pp){if(18===pp.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 xn(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 Ct(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}(ue.Plugin),Hn.VERSION="1.7.6",qn),Gn=function(e){if("string"==typeof e){var t=[].slice.call(document.querySelectorAll(e));return t.length>0?t:null}if("object"==typeof e&&oe(e))return[e]},Kn=function(e){return Array.prototype.slice.call(e||[],0)},$n=function(e,t){var r=[],n=[];return Kn(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){var t;e.relativePath=(t=n).fullPath&&t.fullPath!=="/"+t.name?t.fullPath:null,r.push(e),i()}),(function(e){t(e),i()}));else if(n.isDirectory){!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)}))}(n.createReader(),[],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}))},Jn=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]?$n(e,n):function(e){var t=Kn(e.files);return Promise.resolve(t)}(e)},Qn=function(e,t){if(t){var r=e.querySelector('[data-uppy-paneltype="'+t+'"]');if(r)return r}return e},Zn=['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 ei(e,t){var r=t[0];r&&(r.focus(),e.preventDefault())}function ti(e,t,r){var n=Qn(r,t),i=Kn(n.querySelectorAll(Zn)),o=i.indexOf(document.activeElement);!function(e){return e.contains(document.activeElement)}(n)?ei(e,i):e.shiftKey&&0===o?function(e,t){var r=t[t.length-1];r&&(r.focus(),e.preventDefault())}(e,i):e.shiftKey||o!==i.length-1||ei(e,i)}var ri=function(e,t,r){ti(e,t,r)},ni=function(e,t,r){null===t||ti(e,t,r)},ii={exports:{}};(function(e){(function(){!function(e,t){"object"==typeof ii.exports?ii.exports=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),s?(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;o.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}(),u=function(e,t){for(var r=0,n=Object.keys(t);r0},e}(),b="undefined"!=typeof WeakMap?new WeakMap:new t,w=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=a.getInstance(),n=new m(t,r,this);b.set(this,n)};return["observe","unobserve","disconnect"].forEach((function(e){w.prototype[e]=function(){var t;return(t=b.get(this))[e].apply(t,arguments)}})),void 0!==n.ResizeObserver?n.ResizeObserver:w}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),ii=ii.exports;var oi={};(function(e){(function(){var t=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,i=/^0o[0-7]+$/i,o=parseInt,s="object"==typeof e&&e&&e.Object===Object&&e,a="object"==typeof self&&self&&self.Object===Object&&self,u=s||a||Function("return this")(),l=Object.prototype.toString,c=Math.max,p=Math.min,h=function(){return u.Date.now()};function d(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function f(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==l.call(e)}(e))return NaN;if(d(e)){var s="function"==typeof e.valueOf?e.valueOf():e;e=d(s)?s+"":s}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(t,"");var a=n.test(e);return a||i.test(e)?o(e.slice(2),a?2:8):r.test(e)?NaN:+e}oi=function(e,t,r){var n,i,o,s,a,u,l=0,g=!1,v=!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 b(e){var r=e-u;return void 0===u||r>=t||r<0||v&&e-l>=o}function w(){var e=h();if(b(e))return _(e);a=setTimeout(w,function(e){var r=t-(e-u);return v?p(r,o-(e-l)):r}(e))}function _(e){return a=void 0,y&&n?m(e):(n=i=void 0,s)}function S(){var e=h(),r=b(e);if(n=arguments,i=this,u=e,r){if(void 0===a)return function(e){return l=e,a=setTimeout(w,t),g?m(e):s}(u);if(v)return a=setTimeout(w,t),m(u)}return void 0===a&&(a=setTimeout(w,t)),s}return t=f(t)||0,d(r)&&(g=!!r.leading,o=(v="maxWait"in r)?c(f(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:_(h())},S}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});function si(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){9===e.keyCode&&ni(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;n.opts.closeAfterFinish&&0===t.length&&n.requestCloseModal()},n._openFileEditorWhenFilesAdded=function(e){var t=e[0];n.canEditFile(t)&&n.openFileEditor(t)},n.initEvents=function(){if(n.opts.trigger&&!n.opts.inline){var e=Gn(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("file-editor:complete",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.opts.autoOpenFileEditor&&n.uppy.on("files-added",n._openFileEditorWhenFilesAdded)},n.removeEvents=function(){var e=Gn(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.opts.autoOpenFileEditor&&n.uppy.off("files-added",n._openFileEditorWhenFilesAdded)},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(!1,t)},n._attachRenderFunctionToTarget=function(e){var t=n.uppy.getPlugin(e.id);return ci({},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=gi((function(e){return e.filter((function(e){return"acquirer"===e.type&&n._isTargetSupported(e)})).map(n._attachRenderFunctionToTarget)})),n._getProgressIndicators=gi((function(e){return e.filter((function(e){return"progressindicator"===e.type})).map(n._attachRenderFunctionToTarget)})),n._getEditors=gi((function(e){return e.filter((function(e){return"editor"===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})),h=Object.keys(i).filter((function(e){return!i[e].progress.uploadComplete&&i[e].progress.uploadStarted})),d=h.filter((function(e){return!i[e].isPaused})),f=Object.keys(i).filter((function(e){return i[e].progress.preprocess||i[e].progress.postprocess})),g=u.length>0,v=100===e.totalProgress&&c.length===Object.keys(i).length&&0===f.length,y=g&&p.length===u.length,m=0!==h.length&&l.length===h.length,b=n._getAcquirers(r.targets),w=n._getProgressIndicators(r.targets),_=n._getEditors(r.targets);return t="auto"===n.opts.theme?o.darkMode?"dark":"light":n.opts.theme,["files","folders","both"].indexOf(n.opts.fileManagerSelectionType)<0&&(n.opts.fileManagerSelectionType="files",console.error('Unsupported option for "fileManagerSelectionType". Using default of "'+n.opts.fileManagerSelectionType+'".')),function(e){var t=0===e.totalFileCount,r=e.containerWidth>576,n=Ge({"uppy-Root":e.isTargetDOMEl}),i=Ge({"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}),o=1;e.containerWidth>900?o=5:e.containerWidth>700?o=4:e.containerWidth>576&&(o=3);var s=e.showSelectedFiles&&!t,a=Gr("div",{class:i,"data-uppy-theme":e.theme,"data-uppy-num-acquirers":e.acquirers.length,"data-uppy-drag-drop-supported":Xr(),"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},Gr("div",{class:"uppy-Dashboard-overlay",tabindex:-1,onclick:e.handleClickOutside}),Gr("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:Gr("button",{class:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":e.i18n("closeModal"),title:e.i18n("closeModal"),onclick:e.closeModal},Gr("span",{"aria-hidden":"true"},"\xd7")),Gr("div",{class:"uppy-Dashboard-innerWrap"},Gr("div",{class:"uppy-Dashboard-dropFilesHereHint"},e.i18n("dropHint")),s&&Gr(jr,e),s?Gr(br,Yr({},e,{itemsPerRow:o})):Gr(_r,Yr({},e,{isSizeMD:r})),Gr(Wr,null,e.showAddFilesPanel?Gr(kr,Yr({key:"AddFiles"},e,{isSizeMD:r})):null),Gr(Wr,null,e.fileCardFor?Gr(Nr,Yr({key:"FileCard"},e)):null),Gr(Wr,null,e.activePickerPanel?Gr(Er,Yr({key:"Picker"},e)):null),Gr(Wr,null,e.showFileEditor?Gr(Fr,Yr({key:"Editor"},e)):null),Gr("div",{class:"uppy-Dashboard-progressindicators"},e.progressindicators.map((function(t){return e.getPlugin(t.id).render(e.state)}))))));return Gr("div",{class:n,dir:e.direction},a)}({state:e,isHidden:r.isHidden,files:i,newFiles:a,uploadStartedFiles:u,completeFiles:c,erroredFiles:p,inProgressFiles:h,inProgressNotPausedFiles:d,processingFiles:f,isUploadStarted:g,isAllComplete:v,isAllErrored:y,isAllPaused:m,totalFileCount:Object.keys(i).length,totalProgress:e.totalProgress,allowNewUpload:s,acquirers:b,theme:t,direction:n.opts.direction,activePickerPanel:r.activePickerPanel,showFileEditor:r.showFileEditor,animateOpenClose:n.opts.animateOpenClose,isClosing:r.isClosing,getPlugin:n.uppy.getPlugin,progressindicators:w,editors:_,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,uppy:n.uppy,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,openFileEditor:n.openFileEditor,canEditFile:n.canEditFile,width:n.opts.width,height:n.opts.height,showLinkToFileUploadResult:n.opts.showLinkToFileUploadResult,fileManagerSelectionType:n.opts.fileManagerSelectionType,proudlyDisplayPoweredByUppy:n.opts.proudlyDisplayPoweredByUppy,hideCancelButton:n.opts.hideCancelButton,hideRetryButton:n.opts.hideRetryButton,hidePauseResumeButton:n.opts.hidePauseResumeButton,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,showFileEditor:!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,pi(n)),(n.opts.plugins||[]).forEach((function(e){var t=n.uppy.getPlugin(e);t&&t.mount(pi(n),t)})),n.opts.disableStatusBar||n.uppy.use(Cn,{id:n.id+":StatusBar",target:pi(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,doneButtonHandler:n.opts.doneButtonHandler}),n.opts.disableInformer||n.uppy.use(On,{id:n.id+":Informer",target:pi(n)}),n.opts.disableThumbnailGenerator||n.uppy.use(Yn,{id:n.id+":ThumbnailGenerator",thumbnailWidth:n.opts.thumbnailWidth,thumbnailType:n.opts.thumbnailType,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-"+B(),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",dropPasteFiles:"Drop files here, paste or %{browseFiles}",dropPasteFolders:"Drop files here, paste or %{browseFolders}",dropPasteBoth:"Drop files here, paste, %{browseFiles} or %{browseFolders}",dropPasteImportFiles:"Drop files here, paste, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, paste, %{browseFolders} or import from:",dropPasteImportBoth:"Drop files here, paste, %{browseFiles}, %{browseFolders} or import from:",dropHint:"Drop your files here",browseFiles:"browse files",browseFolders:"browse folders",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,o={target:"body",metaFields:[],trigger:"#uppy-select-files",inline:!1,width:750,height:550,thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:yi,showLinkToFileUploadResult:!0,showProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,doneButtonHandler:function(){n.uppy.reset(),n.requestCloseModal()},note:null,closeModalOnClickOutside:!1,closeAfterFinish:!1,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,disablePageScrollWhenModalOpen:!0,animateOpenClose:!0,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,onRequestCloseModal:function(){return n.closeModal()},showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,browserBackButtonClose:!1,theme:"light",autoOpenFileEditor:!1};return n.opts=ci({},o,r),n.i18nInit(),n.superFocus=(i=!1,oi((function(e,t){var r=Qn(e,t),n=r.contains(document.activeElement);if(!n||!i){var o=r.querySelector("[data-uppy-super-focusable]");if(!n||o)if(o)o.focus({preventScroll:!0}),i=!0;else{var s=r.querySelector(Zn);s&&s.focus({preventScroll:!0}),i=!1}}}),260)),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.prototype.onMount=function(){var e=this.el;wn(e)||(e.dir="ltr")},n}(di),ai.VERSION="1.16.1",ui);function _i(){return(_i=Object.assign||function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&e<1/0};function R(e){return void 0===e}function U(t){return"object"===e(t)&&null!==t}var T=Object.prototype.hasOwnProperty;function D(e){if(!U(e))return!1;try{var t=e.constructor,r=t.prototype;return t&&r&&T.call(r,"isPrototypeOf")}catch(Cc){return!1}}function B(e){return"function"==typeof e}var I=Array.prototype.slice;function M(e){return Array.from?Array.from(e):I.call(e)}function j(e,t){return e&&B(t)&&(Array.isArray(e)||O(e.length)?M(e).forEach((function(r,n){t.call(e,r,n,e)})):U(e)&&Object.keys(e).forEach((function(r){t.call(e,e[r],r,e)}))),e}var L=Object.assign||function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n0&&r.forEach((function(t){U(t)&&Object.keys(t).forEach((function(r){e[r]=t[r]}))})),e},z=/\.\d*(?:0|9){12}\d*$/;function N(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return z.test(e)?Math.round(e*t)/t:e}var H=/^width|height|left|top|marginLeft|marginTop$/;function q(e,t){var r=e.style;j(t,(function(e,t){H.test(t)&&O(e)&&(e="".concat(e,"px")),r[t]=e}))}function V(e,t){if(t)if(O(e.length))j(e,(function(e){V(e,t)}));else if(e.classList)e.classList.add(t);else{var r=e.className.trim();r?r.indexOf(t)<0&&(e.className="".concat(r," ").concat(t)):e.className=t}}function W(e,t){t&&(O(e.length)?j(e,(function(e){W(e,t)})):e.classList?e.classList.remove(t):e.className.indexOf(t)>=0&&(e.className=e.className.replace(t,"")))}function X(e,t,r){t&&(O(e.length)?j(e,(function(e){X(e,t,r)})):r?V(e,t):W(e,t))}var Y=/([a-z\d])([A-Z])/g;function G(e){return e.replace(Y,"$1-$2").toLowerCase()}function K(e,t){return U(e[t])?e[t]:e.dataset?e.dataset[t]:e.getAttribute("data-".concat(G(t)))}function $(e,t,r){U(r)?e[t]=r:e.dataset?e.dataset[t]=r:e.setAttribute("data-".concat(G(t)),r)}var J=/\s\s*/,Q=function(){var e=!1;if(a){var t=!1,r=function(){},n=Object.defineProperty({},"once",{get:function(){return e=!0,t},set:function(e){t=e}});u.addEventListener("test",r,n),u.removeEventListener("test",r,n)}return e}();function Z(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=r;t.trim().split(J).forEach((function(t){if(!Q){var o=e.listeners;o&&o[t]&&o[t][r]&&(i=o[t][r],delete o[t][r],0===Object.keys(o[t]).length&&delete o[t],0===Object.keys(o).length&&delete e.listeners)}e.removeEventListener(t,i,n)}))}function ee(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=r;t.trim().split(J).forEach((function(t){if(n.once&&!Q){var o=e.listeners,s=void 0===o?{}:o;i=function(){delete s[t][r],e.removeEventListener(t,i,n);for(var o=arguments.length,a=new Array(o),u=0;u1&&void 0!==arguments[1]?arguments[1]:"contain",o=x(n),s=x(r);if(o&&s){var a=r*t;"contain"===i&&a>n||"cover"===i&&ae.width?3===r?a=e.height*s:u=e.width/s:3===r?u=e.width/s:a=e.height*s;var l={aspectRatio:s,naturalWidth:i,naturalHeight:o,width:a,height:u};l.left=(e.width-a)/2,l.top=(e.height-u)/2,l.oldLeft=l.left,l.oldTop=l.top,this.canvasData=l,this.limited=1===r||2===r,this.limitCanvas(!0,!0),this.initialImageData=L({},t),this.initialCanvasData=L({},l)},limitCanvas:function(e,t){var r=this.options,n=this.containerData,i=this.canvasData,o=this.cropBoxData,s=r.viewMode,a=i.aspectRatio,u=this.cropped&&o;if(e){var l=Number(r.minCanvasWidth)||0,c=Number(r.minCanvasHeight)||0;s>1?(l=Math.max(l,n.width),c=Math.max(c,n.height),3===s&&(c*a>l?l=c*a:c=l/a)):s>0&&(l?l=Math.max(l,u?o.width:0):c?c=Math.max(c,u?o.height:0):u&&(l=o.width,(c=o.height)*a>l?l=c*a:c=l/a));var p=le({aspectRatio:a,width:l,height:c});l=p.width,c=p.height,i.minWidth=l,i.minHeight=c,i.maxWidth=1/0,i.maxHeight=1/0}if(t)if(s>(u?0:1)){var h=n.width-i.width,d=n.height-i.height;i.minLeft=Math.min(0,h),i.minTop=Math.min(0,d),i.maxLeft=Math.max(0,h),i.maxTop=Math.max(0,d),u&&this.limited&&(i.minLeft=Math.min(o.left,o.left+(o.width-i.width)),i.minTop=Math.min(o.top,o.top+(o.height-i.height)),i.maxLeft=o.left,i.maxTop=o.top,2===s&&(i.width>=n.width&&(i.minLeft=Math.min(0,h),i.maxLeft=Math.max(0,h)),i.height>=n.height&&(i.minTop=Math.min(0,d),i.maxTop=Math.max(0,d))))}else i.minLeft=-i.width,i.minTop=-i.height,i.maxLeft=n.width,i.maxTop=n.height},renderCanvas:function(e,t){var r=this.canvasData,n=this.imageData;if(t){var i=function(e){var t=e.width,r=e.height,n=e.degree;if(90==(n=Math.abs(n)%180))return{width:r,height:t};var i=n%90*Math.PI/180,o=Math.sin(i),s=Math.cos(i),a=t*s+r*o,u=t*o+r*s;return n>90?{width:u,height:a}:{width:a,height:u}}({width:n.naturalWidth*Math.abs(n.scaleX||1),height:n.naturalHeight*Math.abs(n.scaleY||1),degree:n.rotate||0}),o=i.width,s=i.height,a=r.width*(o/r.naturalWidth),u=r.height*(s/r.naturalHeight);r.left-=(a-r.width)/2,r.top-=(u-r.height)/2,r.width=a,r.height=u,r.aspectRatio=o/s,r.naturalWidth=o,r.naturalHeight=s,this.limitCanvas(!0,!1)}(r.width>r.maxWidth||r.widthr.maxHeight||r.heightt.width?i.height=i.width/r:i.width=i.height*r),this.cropBoxData=i,this.limitCropBox(!0,!0),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),i.width=Math.max(i.minWidth,i.width*n),i.height=Math.max(i.minHeight,i.height*n),i.left=t.left+(t.width-i.width)/2,i.top=t.top+(t.height-i.height)/2,i.oldLeft=i.left,i.oldTop=i.top,this.initialCropBoxData=L({},i)},limitCropBox:function(e,t){var r=this.options,n=this.containerData,i=this.canvasData,o=this.cropBoxData,s=this.limited,a=r.aspectRatio;if(e){var u=Number(r.minCropBoxWidth)||0,l=Number(r.minCropBoxHeight)||0,c=s?Math.min(n.width,i.width,i.width+i.left,n.width-i.left):n.width,p=s?Math.min(n.height,i.height,i.height+i.top,n.height-i.top):n.height;u=Math.min(u,n.width),l=Math.min(l,n.height),a&&(u&&l?l*a>u?l=u/a:u=l*a:u?l=u/a:l&&(u=l*a),p*a>c?p=c/a:c=p*a),o.minWidth=Math.min(u,c),o.minHeight=Math.min(l,p),o.maxWidth=c,o.maxHeight=p}t&&(s?(o.minLeft=Math.max(0,i.left),o.minTop=Math.max(0,i.top),o.maxLeft=Math.min(n.width,i.left+i.width)-o.width,o.maxTop=Math.min(n.height,i.top+i.height)-o.height):(o.minLeft=0,o.minTop=0,o.maxLeft=n.width-o.width,o.maxTop=n.height-o.height))},renderCropBox:function(){var e=this.options,t=this.containerData,r=this.cropBoxData;(r.width>r.maxWidth||r.widthr.maxHeight||r.height=t.width&&r.height>=t.height?"move":"all"),q(this.cropBox,L({width:r.width,height:r.height},ae({translateX:r.left,translateY:r.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),te(this.element,"crop",this.getData())}},de={initPreview:function(){var e=this.element,t=this.crossOrigin,r=this.options.preview,n=t?this.crossOriginUrl:this.url,i=e.alt||"The image to preview",o=document.createElement("img");if(t&&(o.crossOrigin=t),o.src=n,o.alt=i,this.viewBox.appendChild(o),this.viewBoxImage=o,r){var s=r;"string"==typeof r?s=e.ownerDocument.querySelectorAll(r):r.querySelector&&(s=[r]),this.previews=s,j(s,(function(e){var r=document.createElement("img");$(e,b,{width:e.offsetWidth,height:e.offsetHeight,html:e.innerHTML}),t&&(r.crossOrigin=t),r.src=n,r.alt=i,r.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',e.innerHTML="",e.appendChild(r)}))}},resetPreview:function(){j(this.previews,(function(e){var t=K(e,b);q(e,{width:t.width,height:t.height}),e.innerHTML=t.html,function(e,t){if(U(e[t]))try{delete e[t]}catch(Cc){e[t]=void 0}else if(e.dataset)try{delete e.dataset[t]}catch(Cc){e.dataset[t]=void 0}else e.removeAttribute("data-".concat(G(t)))}(e,b)}))},preview:function(){var e=this.imageData,t=this.canvasData,r=this.cropBoxData,n=r.width,i=r.height,o=e.width,s=e.height,a=r.left-t.left-e.left,u=r.top-t.top-e.top;this.cropped&&!this.disabled&&(q(this.viewBoxImage,L({width:o,height:s},ae(L({translateX:-a,translateY:-u},e)))),j(this.previews,(function(t){var r=K(t,b),l=r.width,c=r.height,p=l,h=c,d=1;n&&(h=i*(d=l/n)),i&&h>c&&(p=n*(d=c/i),h=c),q(t,{width:p,height:h}),q(t.getElementsByTagName("img")[0],L({width:o*d,height:s*d},ae(L({translateX:-a*d,translateY:-u*d},e))))})))}},fe={bind:function(){var e=this.element,t=this.options,r=this.cropper;B(t.cropstart)&&ee(e,"cropstart",t.cropstart),B(t.cropmove)&&ee(e,"cropmove",t.cropmove),B(t.cropend)&&ee(e,"cropend",t.cropend),B(t.crop)&&ee(e,"crop",t.crop),B(t.zoom)&&ee(e,"zoom",t.zoom),ee(r,w,this.onCropStart=this.cropStart.bind(this)),t.zoomable&&t.zoomOnWheel&&ee(r,"wheel",this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&ee(r,"dblclick",this.onDblclick=this.dblclick.bind(this)),ee(e.ownerDocument,_,this.onCropMove=this.cropMove.bind(this)),ee(e.ownerDocument,S,this.onCropEnd=this.cropEnd.bind(this)),t.responsive&&ee(window,"resize",this.onResize=this.resize.bind(this))},unbind:function(){var e=this.element,t=this.options,r=this.cropper;B(t.cropstart)&&Z(e,"cropstart",t.cropstart),B(t.cropmove)&&Z(e,"cropmove",t.cropmove),B(t.cropend)&&Z(e,"cropend",t.cropend),B(t.crop)&&Z(e,"crop",t.crop),B(t.zoom)&&Z(e,"zoom",t.zoom),Z(r,w,this.onCropStart),t.zoomable&&t.zoomOnWheel&&Z(r,"wheel",this.onWheel,{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&Z(r,"dblclick",this.onDblclick),Z(e.ownerDocument,_,this.onCropMove),Z(e.ownerDocument,S,this.onCropEnd),t.responsive&&Z(window,"resize",this.onResize)}},ge={resize:function(){if(!this.disabled){var e,t,r=this.options,n=this.container,i=this.containerData,o=n.offsetWidth/i.width;1===o&&n.offsetHeight===i.height||(r.restore&&(e=this.getCanvasData(),t=this.getCropBoxData()),this.render(),r.restore&&(this.setCanvasData(j(e,(function(t,r){e[r]=t*o}))),this.setCropBoxData(j(t,(function(e,r){t[r]=e*o})))))}},dblclick:function(){var e,t;this.disabled||"none"===this.options.dragMode||this.setDragMode((e=this.dragBox,t=p,(e.classList?e.classList.contains(t):e.className.indexOf(t)>-1)?"move":"crop"))},wheel:function(e){var t=this,r=Number(this.options.wheelZoomRatio)||.1,n=1;this.disabled||(e.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout((function(){t.wheeling=!1}),50),e.deltaY?n=e.deltaY>0?1:-1:e.wheelDelta?n=-e.wheelDelta/120:e.detail&&(n=e.detail>0?1:-1),this.zoom(-n*r,e)))},cropStart:function(e){var t=e.buttons,r=e.button;if(!(this.disabled||("mousedown"===e.type||"pointerdown"===e.type&&"mouse"===e.pointerType)&&(O(t)&&1!==t||O(r)&&0!==r||e.ctrlKey))){var n,i=this.options,o=this.pointers;e.changedTouches?j(e.changedTouches,(function(e){o[e.identifier]=ue(e)})):o[e.pointerId||0]=ue(e),n=Object.keys(o).length>1&&i.zoomable&&i.zoomOnTouch?"zoom":K(e.target,m),k.test(n)&&!1!==te(this.element,"cropstart",{originalEvent:e,action:n})&&(e.preventDefault(),this.action=n,this.cropping=!1,"crop"===n&&(this.cropping=!0,V(this.dragBox,v)))}},cropMove:function(e){var t=this.action;if(!this.disabled&&t){var r=this.pointers;e.preventDefault(),!1!==te(this.element,"cropmove",{originalEvent:e,action:t})&&(e.changedTouches?j(e.changedTouches,(function(e){L(r[e.identifier]||{},ue(e,!0))})):L(r[e.pointerId||0]||{},ue(e,!0)),this.change(e))}},cropEnd:function(e){if(!this.disabled){var t=this.action,r=this.pointers;e.changedTouches?j(e.changedTouches,(function(e){delete r[e.identifier]})):delete r[e.pointerId||0],t&&(e.preventDefault(),Object.keys(r).length||(this.action=""),this.cropping&&(this.cropping=!1,X(this.dragBox,v,this.cropped&&this.options.modal)),te(this.element,"cropend",{originalEvent:e,action:t}))}}},ve={change:function(e){var t,r=this.options,n=this.canvasData,o=this.containerData,s=this.cropBoxData,a=this.pointers,u=this.action,l=r.aspectRatio,c=s.left,p=s.top,h=s.width,f=s.height,g=c+h,v=p+f,y=0,m=0,b=o.width,w=o.height,_=!0;!l&&e.shiftKey&&(l=h&&f?h/f:1),this.limited&&(y=s.minLeft,m=s.minTop,b=y+Math.min(o.width,n.width,n.left+n.width),w=m+Math.min(o.height,n.height,n.top+n.height));var S=a[Object.keys(a)[0]],k={x:S.endX-S.startX,y:S.endY-S.startY},P=function(e){switch(e){case"e":g+k.x>b&&(k.x=b-g);break;case"w":c+k.xw&&(k.y=w-v)}};switch(u){case"all":c+=k.x,p+=k.y;break;case"e":if(k.x>=0&&(g>=b||l&&(p<=m||v>=w))){_=!1;break}P("e"),(h+=k.x)<0&&(u="w",c-=h=-h),l&&(f=h/l,p+=(s.height-f)/2);break;case"n":if(k.y<=0&&(p<=m||l&&(c<=y||g>=b))){_=!1;break}P("n"),f-=k.y,p+=k.y,f<0&&(u="s",p-=f=-f),l&&(h=f*l,c+=(s.width-h)/2);break;case"w":if(k.x<=0&&(c<=y||l&&(p<=m||v>=w))){_=!1;break}P("w"),h-=k.x,c+=k.x,h<0&&(u="e",c-=h=-h),l&&(f=h/l,p+=(s.height-f)/2);break;case"s":if(k.y>=0&&(v>=w||l&&(c<=y||g>=b))){_=!1;break}P("s"),(f+=k.y)<0&&(u="n",p-=f=-f),l&&(h=f*l,c+=(s.width-h)/2);break;case"ne":if(l){if(k.y<=0&&(p<=m||g>=b)){_=!1;break}P("n"),f-=k.y,p+=k.y,h=f*l}else P("n"),P("e"),k.x>=0?gm&&(f-=k.y,p+=k.y):(f-=k.y,p+=k.y);h<0&&f<0?(u="sw",p-=f=-f,c-=h=-h):h<0?(u="nw",c-=h=-h):f<0&&(u="se",p-=f=-f);break;case"nw":if(l){if(k.y<=0&&(p<=m||c<=y)){_=!1;break}P("n"),f-=k.y,p+=k.y,h=f*l,c+=s.width-h}else P("n"),P("w"),k.x<=0?c>y?(h-=k.x,c+=k.x):k.y<=0&&p<=m&&(_=!1):(h-=k.x,c+=k.x),k.y<=0?p>m&&(f-=k.y,p+=k.y):(f-=k.y,p+=k.y);h<0&&f<0?(u="se",p-=f=-f,c-=h=-h):h<0?(u="ne",c-=h=-h):f<0&&(u="sw",p-=f=-f);break;case"sw":if(l){if(k.x<=0&&(c<=y||v>=w)){_=!1;break}P("w"),h-=k.x,c+=k.x,f=h/l}else P("s"),P("w"),k.x<=0?c>y?(h-=k.x,c+=k.x):k.y>=0&&v>=w&&(_=!1):(h-=k.x,c+=k.x),k.y>=0?v=0&&(g>=b||v>=w)){_=!1;break}P("e"),f=(h+=k.x)/l}else P("s"),P("e"),k.x>=0?g=0&&v>=w&&(_=!1):h+=k.x,k.y>=0?v0?u=k.y>0?"se":"ne":k.x<0&&(c-=h,u=k.y>0?"sw":"nw"),k.y<0&&(p-=f),this.cropped||(W(this.cropBox,d),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}_&&(s.width=h,s.height=f,s.left=c,s.top=p,this.action=u,this.renderCropBox()),j(a,(function(e){e.startX=e.endX,e.startY=e.endY}))}},ye={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&V(this.dragBox,v),W(this.cropBox,d),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=L({},this.initialImageData),this.canvasData=L({},this.initialCanvasData),this.cropBoxData=L({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(L(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),W(this.dragBox,v),V(this.cropBox,d)),this},replace:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&e&&(this.isImg&&(this.element.src=e),t?(this.url=e,this.image.src=e,this.ready&&(this.viewBoxImage.src=e,j(this.previews,(function(t){t.getElementsByTagName("img")[0].src=e})))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(e))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,W(this.cropper,h)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,V(this.cropper,h)),this},destroy:function(){var e=this.element;return e.cropper?(e.cropper=void 0,this.isImg&&this.replaced&&(e.src=this.originalUrl),this.uncreate(),this):this},move:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=this.canvasData,n=r.left,i=r.top;return this.moveTo(R(e)?e:n+Number(e),R(t)?t:i+Number(t))},moveTo:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=this.canvasData,n=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.movable&&(O(e)&&(r.left=e,n=!0),O(t)&&(r.top=t,n=!0),n&&this.renderCanvas(!0)),this},zoom:function(e,t){var r=this.canvasData;return e=(e=Number(e))<0?1/(1-e):1+e,this.zoomTo(r.width*e/r.naturalWidth,null,t)},zoomTo:function(e,t,r){var n=this.options,i=this.canvasData,o=i.width,s=i.height,a=i.naturalWidth,u=i.naturalHeight;if((e=Number(e))>=0&&this.ready&&!this.disabled&&n.zoomable){var l=a*e,c=u*e;if(!1===te(this.element,"zoom",{ratio:e,oldRatio:o/a,originalEvent:r}))return this;if(r){var p=this.pointers,h=re(this.cropper),d=p&&Object.keys(p).length?function(e){var t=0,r=0,n=0;return j(e,(function(e){var i=e.startX,o=e.startY;t+=i,r+=o,n+=1})),{pageX:t/=n,pageY:r/=n}}(p):{pageX:r.pageX,pageY:r.pageY};i.left-=(l-o)*((d.pageX-h.left-i.left)/o),i.top-=(c-s)*((d.pageY-h.top-i.top)/s)}else D(t)&&O(t.x)&&O(t.y)?(i.left-=(l-o)*((t.x-i.left)/o),i.top-=(c-s)*((t.y-i.top)/s)):(i.left-=(l-o)/2,i.top-=(c-s)/2);i.width=l,i.height=c,this.renderCanvas(!0)}return this},rotate:function(e){return this.rotateTo((this.imageData.rotate||0)+Number(e))},rotateTo:function(e){return O(e=Number(e))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=e%360,this.renderCanvas(!0,!0)),this},scaleX:function(e){var t=this.imageData.scaleY;return this.scale(e,O(t)?t:1)},scaleY:function(e){var t=this.imageData.scaleX;return this.scale(O(t)?t:1,e)},scale:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=this.imageData,n=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.scalable&&(O(e)&&(r.scaleX=e,n=!0),O(t)&&(r.scaleY=t,n=!0),n&&this.renderCanvas(!0,!0)),this},getData:function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this.options,n=this.imageData,i=this.canvasData,o=this.cropBoxData;if(this.ready&&this.cropped){e={x:o.left-i.left,y:o.top-i.top,width:o.width,height:o.height};var s=n.width/n.naturalWidth;if(j(e,(function(t,r){e[r]=t/s})),t){var a=Math.round(e.y+e.height),u=Math.round(e.x+e.width);e.x=Math.round(e.x),e.y=Math.round(e.y),e.width=u-e.x,e.height=a-e.y}}else e={x:0,y:0,width:0,height:0};return r.rotatable&&(e.rotate=n.rotate||0),r.scalable&&(e.scaleX=n.scaleX||1,e.scaleY=n.scaleY||1),e},setData:function(e){var t=this.options,r=this.imageData,n=this.canvasData,i={};if(this.ready&&!this.disabled&&D(e)){var o=!1;t.rotatable&&O(e.rotate)&&e.rotate!==r.rotate&&(r.rotate=e.rotate,o=!0),t.scalable&&(O(e.scaleX)&&e.scaleX!==r.scaleX&&(r.scaleX=e.scaleX,o=!0),O(e.scaleY)&&e.scaleY!==r.scaleY&&(r.scaleY=e.scaleY,o=!0)),o&&this.renderCanvas(!0,!0);var s=r.width/r.naturalWidth;O(e.x)&&(i.left=e.x*s+n.left),O(e.y)&&(i.top=e.y*s+n.top),O(e.width)&&(i.width=e.width*s),O(e.height)&&(i.height=e.height*s),this.setCropBoxData(i)}return this},getContainerData:function(){return this.ready?L({},this.containerData):{}},getImageData:function(){return this.sized?L({},this.imageData):{}},getCanvasData:function(){var e=this.canvasData,t={};return this.ready&&j(["left","top","width","height","naturalWidth","naturalHeight"],(function(r){t[r]=e[r]})),t},setCanvasData:function(e){var t=this.canvasData,r=t.aspectRatio;return this.ready&&!this.disabled&&D(e)&&(O(e.left)&&(t.left=e.left),O(e.top)&&(t.top=e.top),O(e.width)?(t.width=e.width,t.height=e.width/r):O(e.height)&&(t.height=e.height,t.width=e.height*r),this.renderCanvas(!0)),this},getCropBoxData:function(){var e,t=this.cropBoxData;return this.ready&&this.cropped&&(e={left:t.left,top:t.top,width:t.width,height:t.height}),e||{}},setCropBoxData:function(e){var t,r,n=this.cropBoxData,i=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&D(e)&&(O(e.left)&&(n.left=e.left),O(e.top)&&(n.top=e.top),O(e.width)&&e.width!==n.width&&(t=!0,n.width=e.width),O(e.height)&&e.height!==n.height&&(r=!0,n.height=e.height),i&&(t?n.height=n.width/i:r&&(n.width=n.height*i)),this.renderCropBox()),this},getCroppedCanvas:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var t=this.canvasData,r=function(e,t,r,n){var i=t.aspectRatio,s=t.naturalWidth,a=t.naturalHeight,u=t.rotate,l=void 0===u?0:u,c=t.scaleX,p=void 0===c?1:c,h=t.scaleY,d=void 0===h?1:h,f=r.aspectRatio,g=r.naturalWidth,v=r.naturalHeight,y=n.fillColor,m=void 0===y?"transparent":y,b=n.imageSmoothingEnabled,w=void 0===b||b,_=n.imageSmoothingQuality,S=void 0===_?"low":_,k=n.maxWidth,P=void 0===k?1/0:k,C=n.maxHeight,E=void 0===C?1/0:C,A=n.minWidth,F=void 0===A?0:A,O=n.minHeight,x=void 0===O?0:O,R=document.createElement("canvas"),U=R.getContext("2d"),T=le({aspectRatio:f,width:P,height:E}),D=le({aspectRatio:f,width:F,height:x},"cover"),B=Math.min(T.width,Math.max(D.width,g)),I=Math.min(T.height,Math.max(D.height,v)),M=le({aspectRatio:i,width:P,height:E}),j=le({aspectRatio:i,width:F,height:x},"cover"),L=Math.min(M.width,Math.max(j.width,s)),z=Math.min(M.height,Math.max(j.height,a)),H=[-L/2,-z/2,L,z];return R.width=N(B),R.height=N(I),U.fillStyle=m,U.fillRect(0,0,B,I),U.save(),U.translate(B/2,I/2),U.rotate(l*Math.PI/180),U.scale(p,d),U.imageSmoothingEnabled=w,U.imageSmoothingQuality=S,U.drawImage.apply(U,[e].concat(o(H.map((function(e){return Math.floor(N(e))}))))),U.restore(),R}(this.image,this.imageData,t,e);if(!this.cropped)return r;var n=this.getData(),i=n.x,s=n.y,a=n.width,u=n.height,l=r.width/Math.floor(t.naturalWidth);1!==l&&(i*=l,s*=l,a*=l,u*=l);var c=a/u,p=le({aspectRatio:c,width:e.maxWidth||1/0,height:e.maxHeight||1/0}),h=le({aspectRatio:c,width:e.minWidth||0,height:e.minHeight||0},"cover"),d=le({aspectRatio:c,width:e.width||(1!==l?r.width:a),height:e.height||(1!==l?r.height:u)}),f=d.width,g=d.height;f=Math.min(p.width,Math.max(h.width,f)),g=Math.min(p.height,Math.max(h.height,g));var v=document.createElement("canvas"),y=v.getContext("2d");v.width=N(f),v.height=N(g),y.fillStyle=e.fillColor||"transparent",y.fillRect(0,0,f,g);var m=e.imageSmoothingEnabled,b=void 0===m||m,w=e.imageSmoothingQuality;y.imageSmoothingEnabled=b,w&&(y.imageSmoothingQuality=w);var _,S,k,P,C,E,A=r.width,F=r.height,O=i,x=s;O<=-a||O>A?(O=0,_=0,k=0,C=0):O<=0?(k=-O,O=0,C=_=Math.min(A,a+O)):O<=A&&(k=0,C=_=Math.min(a,A-O)),_<=0||x<=-u||x>F?(x=0,S=0,P=0,E=0):x<=0?(P=-x,x=0,E=S=Math.min(F,u+x)):x<=F&&(P=0,E=S=Math.min(u,F-x));var R=[O,x,_,S];if(C>0&&E>0){var U=f/a;R.push(k*U,P*U,C*U,E*U)}return y.drawImage.apply(y,[r].concat(o(R.map((function(e){return Math.floor(N(e))}))))),v},setAspectRatio:function(e){var t=this.options;return this.disabled||R(e)||(t.aspectRatio=Math.max(0,e)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(e){var t=this.options,r=this.dragBox,n=this.face;if(this.ready&&!this.disabled){var i="crop"===e,o=t.movable&&"move"===e;e=i||o?e:"none",t.dragMode=e,$(r,m,e),X(r,p,i),X(r,y,o),t.cropBoxMovable||($(n,m,e),X(n,p,i),X(n,y,o))}return this}},me=u.Cropper,be=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t||!E.test(t.tagName))throw new Error("The first argument is required and must be an or element.");this.element=t,this.options=L({},A,D(r)&&r),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}var r,n,i;return r=e,i=[{key:"noConflict",value:function(){return window.Cropper=me,e}},{key:"setDefaults",value:function(e){L(A,D(e)&&e)}}],(n=[{key:"init",value:function(){var e,t=this.element,r=t.tagName.toLowerCase();if(!t.cropper){if(t.cropper=this,"img"===r){if(this.isImg=!0,e=t.getAttribute("src")||"",this.originalUrl=e,!e)return;e=t.src}else"canvas"===r&&window.HTMLCanvasElement&&(e=t.toDataURL());this.load(e)}}},{key:"load",value:function(e){var t=this;if(e){this.url=e,this.imageData={};var r=this.element,n=this.options;if(n.rotatable||n.scalable||(n.checkOrientation=!1),n.checkOrientation&&window.ArrayBuffer)if(P.test(e))C.test(e)?this.read((i=e.replace(pe,""),o=atob(i),s=new ArrayBuffer(o.length),j(a=new Uint8Array(s),(function(e,t){a[t]=o.charCodeAt(t)})),s)):this.clone();else{var i,o,s,a,u=new XMLHttpRequest,l=this.clone.bind(this);this.reloading=!0,this.xhr=u,u.onabort=l,u.onerror=l,u.ontimeout=l,u.onprogress=function(){"image/jpeg"!==u.getResponseHeader("content-type")&&u.abort()},u.onload=function(){t.read(u.response)},u.onloadend=function(){t.reloading=!1,t.xhr=null},n.checkCrossOrigin&&oe(e)&&r.crossOrigin&&(e=se(e)),u.open("GET",e),u.responseType="arraybuffer",u.withCredentials="use-credentials"===r.crossOrigin,u.send()}else this.clone()}}},{key:"read",value:function(e){var t=this.options,r=this.imageData,n=function(e){var t,r=new DataView(e);try{var n,i,o;if(255===r.getUint8(0)&&216===r.getUint8(1))for(var s=r.byteLength,a=2;a+1=8&&(o=u+c)}}}if(o){var p,h,d=r.getUint16(o,n);for(h=0;h1){this.url=function(e,t){for(var r=[],n=new Uint8Array(e);n.length>0;)r.push(ce.apply(null,M(n.subarray(0,8192)))),n=n.subarray(8192);return"data:".concat("image/jpeg",";base64,").concat(btoa(r.join("")))}(e);var a=function(e){var t=0,r=1,n=1;switch(e){case 2:r=-1;break;case 3:t=-180;break;case 4:n=-1;break;case 5:t=90,n=-1;break;case 6:t=90;break;case 7:t=90,r=-1;break;case 8:t=-90}return{rotate:t,scaleX:r,scaleY:n}}(n);i=a.rotate,o=a.scaleX,s=a.scaleY}t.rotatable&&(r.rotate=i),t.scalable&&(r.scaleX=o,r.scaleY=s),this.clone()}},{key:"clone",value:function(){var e=this.element,t=this.url,r=e.crossOrigin,n=t;this.options.checkCrossOrigin&&oe(t)&&(r||(r="anonymous"),n=se(t)),this.crossOrigin=r,this.crossOriginUrl=n;var i=document.createElement("img");r&&(i.crossOrigin=r),i.src=n||t,i.alt=e.alt||"The image to crop",this.image=i,i.onload=this.start.bind(this),i.onerror=this.stop.bind(this),V(i,f),e.parentNode.insertBefore(i,e.nextSibling)}},{key:"start",value:function(){var e=this,t=this.image;t.onload=null,t.onerror=null,this.sizing=!0;var r=u.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(u.navigator.userAgent),n=function(t,r){L(e.imageData,{naturalWidth:t,naturalHeight:r,aspectRatio:t/r}),e.sizing=!1,e.sized=!0,e.build()};if(!t.naturalWidth||r){var i=document.createElement("img"),o=document.body||document.documentElement;this.sizingImage=i,i.onload=function(){n(i.width,i.height),r||o.removeChild(i)},i.src=t.src,r||(i.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",o.appendChild(i))}else n(t.naturalWidth,t.naturalHeight)}},{key:"stop",value:function(){var e=this.image;e.onload=null,e.onerror=null,e.parentNode.removeChild(e),this.image=null}},{key:"build",value:function(){if(this.sized&&!this.ready){var e=this.element,t=this.options,r=this.image,n=e.parentNode,i=document.createElement("div");i.innerHTML='
';var o=i.querySelector(".".concat("cropper","-container")),s=o.querySelector(".".concat("cropper","-canvas")),a=o.querySelector(".".concat("cropper","-drag-box")),u=o.querySelector(".".concat("cropper","-crop-box")),l=u.querySelector(".".concat("cropper","-face"));this.container=n,this.cropper=o,this.canvas=s,this.dragBox=a,this.cropBox=u,this.viewBox=o.querySelector(".".concat("cropper","-view-box")),this.face=l,s.appendChild(r),V(e,d),n.insertBefore(o,e.nextSibling),this.isImg||W(r,f),this.initPreview(),this.bind(),t.initialAspectRatio=Math.max(0,t.initialAspectRatio)||NaN,t.aspectRatio=Math.max(0,t.aspectRatio)||NaN,t.viewMode=Math.max(0,Math.min(3,Math.round(t.viewMode)))||0,V(u,d),t.guides||V(u.getElementsByClassName("".concat("cropper","-dashed")),d),t.center||V(u.getElementsByClassName("".concat("cropper","-center")),d),t.background&&V(o,"".concat("cropper","-bg")),t.highlight||V(l,g),t.cropBoxMovable&&(V(l,y),$(l,m,"all")),t.cropBoxResizable||(V(u.getElementsByClassName("".concat("cropper","-line")),d),V(u.getElementsByClassName("".concat("cropper","-point")),d)),this.render(),this.ready=!0,this.setDragMode(t.dragMode),t.autoCrop&&this.crop(),this.setData(t.data),B(t.ready)&&ee(e,"ready",t.ready,{once:!0}),te(e,"ready")}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),W(this.element,d))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}])&&t(r.prototype,n),i&&t(r,i),e}();return L(be.prototype,he,de,fe,ge,ve,ye),be},"object"==typeof Ni.exports?Ni.exports=Mi():(Ii=Ii||self).Cropper=Mi(),Ni=Ni.exports;var Hi,qi,Vi=ie.h,Wi=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),i=0;i1;return _s("div",{class:"uppy uppy-Webcam-container"},_s("div",{class:"uppy-Webcam-videoContainer"},_s("video",{class:"uppy-Webcam-video "+(this.props.mirror?"uppy-Webcam-video--mirrored":""),autoplay:!0,muted:!0,playsinline:!0,srcObject:this.props.src||""})),_s("div",{class:"uppy-Webcam-footer"},_s("div",{class:"uppy-Webcam-videoSourceContainer"},a?(e=this.props,t=e.currentDeviceId,r=e.videoSources,n=e.onChangeVideoSource,ws("div",{className:"uppy-Webcam-videoSource"},ws("select",{className:"uppy-u-reset uppy-Webcam-videoSource-select",onchange:function(e){n(e.target.value)}},r.map((function(e){return ws("option",{key:e.deviceId,value:e.deviceId,selected:e.deviceId===t},e.label)}))))):null),_s("div",{class:"uppy-Webcam-buttonContainer"},o?function(e){var t=e.onSnapshot,r=e.i18n;return vs("button",{class:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture",type:"button",title:r("takePicture"),"aria-label":r("takePicture"),onclick:t,"data-uppy-super-focusable":!0},gs())}(this.props):null," ",i?function(e){var t=e.recording,r=e.onStartRecording,n=e.onStopRecording,i=e.i18n;return t?ys("button",{class:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--video",type:"button",title:i("stopRecording"),"aria-label":i("stopRecording"),onclick:n,"data-uppy-super-focusable":!0},ys("svg",{"aria-hidden":"true",focusable:"false",class:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},ys("rect",{x:"15",y:"15",width:"70",height:"70"}))):ys("button",{class:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--video",type:"button",title:i("startRecording"),"aria-label":i("startRecording"),onclick:r,"data-uppy-super-focusable":!0},ys("svg",{"aria-hidden":"true",focusable:"false",class:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},ys("circle",{cx:"50",cy:"50",r:"40"})))}(this.props):null),_s("div",{class:"uppy-Webcam-recordingLength"},s?bs(this.props):null)))},n}(ie.Component),Es=ie.h,As=function(e){return Es("div",{class:"uppy-Webcam-permissons"},Es("div",{class:"uppy-Webcam-permissonsIcon"},e.icon()),Es("h1",{class:"uppy-Webcam-title"},e.hasCamera?e.i18n("allowAccessTitle"):e.i18n("noCameraTitle")),Es("p",null,e.hasCamera?e.i18n("allowAccessDescription"):e.i18n("noCameraDescription")))};function Fs(){return(Fs=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(pp){pp.isRestriction||e.uppy.log(pp)}})).then((function(){e.recordingChunks=null,e.recorder=null}),(function(t){throw e.recordingChunks=null,e.recorder=null,t}))},i._stop=function(){this.stream&&(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(pp){pp.isRestriction||e.uppy.log(pp)}}),(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(Rs).filter(Ts));var a=s[0]||"image/jpeg",u=ds(a)||"jpg",l="cam-"+Date.now()+"."+u;return function(e,t,r){return e.toBlob?new Promise((function(n){e.toBlob(n,t,r)})):Promise.resolve().then((function(){return xn(e.toDataURL(t,r),{})}))}(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=ds(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._changeVideoSource=function(e){this._stop(),this._start({deviceId:e})},i.updateVideoSources=function(){var e=this;this.mediaDevices.enumerateDevices().then((function(t){e.setPluginState({videoSources:t.filter((function(e){return"videoinput"===e.kind}))})}))},i.render=function(){this.webcamActive||this._start();var e=this.getPluginState();return e.cameraReady&&e.hasCamera?xs(Cs,Fs({},e,{onChangeVideoSource:this._changeVideoSource,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,showVideoSourceDropdown:this.opts.showVideoSourceDropdown,supportsRecording:"function"==typeof MediaRecorder&&!!MediaRecorder.prototype&&"function"==typeof MediaRecorder.prototype.start,recording:e.isRecording,mirror:this.opts.mirror,src:this.stream})):xs(As,{icon:gs,i18n:this.i18n,hasCamera:e.hasCamera})},i.install=function(){var e=this;this.setPluginState({cameraReady:!1,recordingLengthSeconds:0});var t=this.opts.target;t&&this.mount(t,this),this.mediaDevices&&(this.updateVideoSources(),this.mediaDevices.ondevicechange=function(t){if(e.updateVideoSources(),e.stream){var r=!0,n=e.getPluginState(),i=n.videoSources,o=n.currentDeviceId;i.forEach((function(e){o===e.deviceId&&(r=!1)})),r&&(e._stop(),e._start())}})},i.uninstall=function(){this.stream&&this._stop(),this.unmount()},n}(ue.Plugin),ks.VERSION="1.8.5",Ps),Bs=ie.h,Is=function(){return Bs("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},Bs("g",{fill:"none","fill-rule":"evenodd"},Bs("rect",{fill:"#2C3E50",width:"32",height:"32",rx:"16"}),Bs("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"}),Bs("circle",{fill:"#FFF",cx:"16",cy:"16",r:"2"})))},Ms=ie.h,js=function(e){var t=e.recording,r=e.onStartRecording,n=e.onStopRecording,i=e.i18n;return t?Ms("button",{class:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video uppy-ScreenCapture-button--stop-rec",type:"button",title:i("stopCapturing"),"aria-label":i("stopCapturing"),onclick:n,"data-uppy-super-focusable":!0},Ms("svg",{"aria-hidden":"true",focusable:"false",class:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},Ms("rect",{x:"15",y:"15",width:"70",height:"70"}))):Ms("button",{class:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video",type:"button",title:i("startCapturing"),"aria-label":i("startCapturing"),onclick:r,"data-uppy-super-focusable":!0},Ms("svg",{"aria-hidden":"true",focusable:"false",class:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},Ms("circle",{cx:"50",cy:"50",r:"40"})))},Ls=ie.h,zs=function(e){var t=e.recording,r=e.recordedVideo,n=e.onSubmit,i=e.i18n;return r&&!t?Ls("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},Ls("svg",{"aria-hidden":"true",focusable:"false",class:"uppy-c-icon",width:"48",height:"48",viewBox:"0 0 48 48"},Ls("path",{d:"M0 0h48v48h-48z",fill:"none"}),Ls("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 Ns(){return(Ns=Object.assign||function(e){for(var t=1;t9?":":":0")+e},i.render=function(){var e=Ns({},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?Hs("div",{style:this.wrapperStyle},Hs("div",{style:this.overlayStyle}),Hs("div",{style:this.infoContainerStyle},Hs("div",{style:this.infotextStyle},r("recording")),Hs("div",{style:this.timeStyle},n))):null},n}(ie.Component),Vs=ie.h,Ws=function(e){var t=e.streamActive,r=e.i18n;return t?Vs("div",{title:r("streamActive"),"aria-label":r("streamActive"),class:"uppy-ScreenCapture-icon--stream uppy-ScreenCapture-icon--streamActive"},Vs("svg",{"aria-hidden":"true",focusable:"false",width:"24",height:"24",viewBox:"0 0 24 24"},Vs("path",{d:"M0 0h24v24H0z",opacity:".1",fill:"none"}),Vs("path",{d:"M0 0h24v24H0z",fill:"none"}),Vs("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"}))):Vs("div",{title:r("streamPassive"),"aria-label":r("streamPassive"),class:"uppy-ScreenCapture-icon--stream"},Vs("svg",{"aria-hidden":"true",focusable:"false",width:"24",height:"24",viewBox:"0 0 24 24"},Vs("path",{d:"M0 0h24v24H0z",opacity:".1",fill:"none"}),Vs("path",{d:"M0 0h24v24H0z",fill:"none"}),Vs("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 Xs(){return(Xs=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}(),da=function(e){return!!e&&(0!==e.readyState&&4!==e.readyState||0===e.status)};function fa(){return(fa=Object.assign||function(e){for(var t=1;t=200&&e<300}},t),this.requests=t.__queue,this.uploaderEvents=Object.create(null),this.i18n=t.i18n}var t=e.prototype;return t._getOptions=function(e){var t=this.uppy.getState().xhrUpload,r=fa({},this.opts,t||{},e.xhrUpload||{},{headers:{}});return fa(r.headers,this.opts.headers),t&&fa(r.headers,t.headers),e.xhrUpload&&fa(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 pa(n.uppy);var a=new ha(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=B();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],h={status:o.target.status,body:c,uploadURL:p};return n.uppy.emit("upload-success",e,h),p&&n.uppy.log("Download "+e.name+" from "+p),t(e)}var d=i.getResponseData(s.responseText,s),f=ma(s,i.getResponseError(s.responseText,s)),g={status:o.target.status,body:d};return n.uppy.emit("upload-error",e,f,g),r(f)})),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=ma(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?ga:va)(n.uppy,e.remote.providerOptions).post(e.remote.url,fa({},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=ca(e.remote.companionUrl),u=new ya({target:a+"/api/"+s,autoOpen:!1});n.uploaderEvents[e.id]=new pa(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 la(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):fa(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}(),Sa=function(e,t){var r,n=t.headers?t.headers["content-type"]:t.getResponseHeader("Content-Type");if("string"==typeof n){var i=(r=n,r.replace(/;.*$/,"")).toLowerCase();if("application/xml"===i||"text/xml"===i)return!0;if("text/html"===i&&/^<\?xml /.test(e))return!0}return!1};function ka(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pa(){return(Pa=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 Fa(e){if(e&&e.error){var t=new Error(e.message);throw Pa(t,e.error),t}return e}var Oa=!1,xa=(wa=ba=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",n.defaultLocale={strings:{timedOut:"Upload stalled for %{seconds} seconds, aborting."}};var i={timeout:3e4,limit:0,metaFields:[],getUploadParameters:n.getUploadParameters.bind(ka(n))};return n.opts=Pa({},i,r),n.i18nInit(),n.client=new Ea(t,r),n.handleUpload=n.handleUpload.bind(ka(n)),n.requests=new aa(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.setOptions=function(t){e.prototype.setOptions.call(this,t),this.i18nInit()},i.i18nInit=function(){this.translator=new C([this.defaultLocale,this.uppy.locale,this.opts.locale]),this.i18n=this.translator.translate.bind(this.translator),this.setPluginState()},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=Me({filename:t,type:r,metadata:n});return this.client.get("s3/params?"+i).then(Fa)},i.validateParameters=function(e,t){if("object"!=typeof t||!t||"string"!=typeof t.url||"object"!=typeof t.fields&&null!=t.fields){var r=new TypeError("AwsS3: got incorrect result from 'getUploadParameters()' for file '"+e.name+"', expected an object '{ url, method, fields, headers }' but got '"+JSON.stringify(t)+"' instead.\nSee https://uppy.io/docs/aws-s3/#getUploadParameters-file for more on the expected format.");throw console.error(r),r}if(null!=t.method&&!/^(put|post)$/i.test(t.method)){var n=new TypeError("AwsS3: got incorrect method from 'getUploadParameters()' for file '"+e.name+"', expected 'put' or 'post' but got '"+t.method+"' instead.\nSee https://uppy.io/docs/aws-s3/#getUploadParameters-file for more on the expected format.");throw console.error(n),n}},i.handleUpload=function(e){var t=this,r=Object.create(null);function n(e){var t=e.id;S(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 ua(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,h={method:u,formData:"post"===u.toLowerCase(),endpoint:l,metaFields:c?Object.keys(c):[]};return p&&(h.headers=p),t.uppy.setFileState(s.id,{meta:Pa({},s.meta,c),xhrUpload:h}),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 Sa(t,r)?{location:(n=r.responseURL,i=Aa(t,"Location"),n?new Ca(i,n).toString():new Ca(i).toString()),bucket:Aa(t,"Bucket"),key:Aa(t,"Key"),etag:Aa(t,"ETag")}:"POST"===this.method.toUpperCase()?(Oa||(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"),Oa=!0),{location:null}):r.responseURL?{location:r.responseURL.replace(/\?.*$/,"")}:{location:null}},getResponseError:function(e,t){if(Sa(e,t)){var r=Aa(e,"Message");return new Error(r)}}};t.i18n=this.i18n,this._uploader=new _a(this.uppy,t)},i.uninstall=function(){this.uppy.removePreProcessor(this.handleUpload)},n}(ue.Plugin),ba.VERSION="1.7.7",wa),Ra={};function Ua(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ta(e,t){for(var r=0;r=t))break}r.forEach((function(t){e._uploadPartRetryable(t).then((function(){e._uploadParts()}),(function(t){e._onError(t)}))}))}}},t._retryable=function(e){var t=this,r=e.before,n=e.attempt,i=e.after,o=this.options.retryDelays,s=this.abortController.signal;return r&&r(),function e(r){return n().catch((function(n){if(t._aborted())throw Ya();if(function(e){if(e.source&&"number"==typeof e.source.status){var t=e.source.status;return 0===t||409===t||423===t||t>=500&&t<600}return!1}(n)&&r=300){var r=new Error("Non 2xx");return r.source=t.target,void n.reject(r)}i._onPartProgress(e,o.size,o.size);var s=t.target.getResponseHeader("ETag");null!==s?(i._onPartComplete(e,s),n.resolve()):n.reject(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."))})),u.addEventListener("error",(function(t){l(),i.chunkState[e].busy=!1;var r=new Error("Unknown error");r.source=t.target,n.reject(r)})),u.send(o),a},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.abortController.abort(),this.createdPromise.then((function(){e.options.abortMultipartUpload({key:e.key,uploadId:e.uploadId})}),(function(){}))},t._onError=function(e){e&&"AbortError"===e.name||this.options.onError(e)},t.start=function(){this.isPaused=!1,this.uploadId?this._resumeUpload():this._createUpload()},t.pause=function(){this.abortController.abort(),this.abortController=new Xa,this.isPaused=!0},t.abort=function(e){if(void 0===e&&(e={}),!e.really)return this.pause();this._abortUpload()},e}();function Za(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function eu(){return(eu=Object.assign||function(e){for(var t=1;t>>6)+o(128|63&t):o(224|t>>>12&15)+o(128|t>>>6&63)+o(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return o(240|t>>>18&7)+o(128|t>>>12&63)+o(128|t>>>6&63)+o(128|63&t)},a=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,u=function(e){return e.replace(a,s)},l=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[n.charAt(r>>>18),n.charAt(r>>>12&63),t>=2?"=":n.charAt(r>>>6&63),t>=1?"=":n.charAt(63&r)].join("")},c=e.btoa&&"function"==typeof e.btoa?function(t){return e.btoa(t)}:function(e){if(e.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return e.replace(/[\s\S]{1,3}/g,l)},p=function(e){return c(u(String(e)))},h=function(e){return e.replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"})).replace(/=/g,"")},d=function(e,t){return t?h(p(e)):p(e)};e.Uint8Array&&(t=function(e,t){for(var r="",i=0,o=e.length;i>>18)+n.charAt(l>>>12&63)+(void 0!==a?n.charAt(l>>>6&63):"=")+(void 0!==u?n.charAt(63&l):"=")}return t?h(r):r});var f,g=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,v=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 o(55296+(t>>>10))+o(56320+(1023&t));case 3:return o((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return o((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},y=function(e){return e.replace(g,v)},m=function(e){var t=e.length,r=t%4,n=(t>0?i[e.charAt(0)]<<18:0)|(t>1?i[e.charAt(1)]<<12:0)|(t>2?i[e.charAt(2)]<<6:0)|(t>3?i[e.charAt(3)]:0),s=[o(n>>>16),o(n>>>8&255),o(255&n)];return s.length-=[0,0,2,1][r],s.join("")},b=e.atob&&"function"==typeof e.atob?function(t){return e.atob(t)}:function(e){return e.replace(/\S{1,4}/g,m)},w=function(e){return b(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},_=function(e){return String(e).replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,"")},S=function(e){return function(e){return y(b(e))}(_(e))};if(e.Uint8Array&&(f=function(e){return Uint8Array.from(w(_(e)),(function(e){return e.charCodeAt(0)}))}),e.Base64={VERSION:"2.6.4",atob:w,btoa:c,fromBase64:S,toBase64:d,utob:u,encode:d,encodeURI:function(e){return d(e,!0)},btou:y,decode:S,noConflict:function(){var t=e.Base64;return e.Base64=r,t},fromUint8Array:t,toUint8Array:f},"function"==typeof Object.defineProperty){var k=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};e.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",k((function(){return S(this)}))),Object.defineProperty(String.prototype,"toBase64",k((function(e){return d(this,e)}))),Object.defineProperty(String.prototype,"toBase64URI",k((function(){return d(this,!0)})))}}return e.Meteor&&(Base64=e.Base64),!!su.exports&&(su.exports.Base64=e.Base64),{Base64:e.Base64}}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),su=su.exports;var au={};function uu(e){return(uu="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})(e)}function lu(e){var t="function"==typeof Map?new Map:void 0;return(lu=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return cu(e,arguments,du(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),hu(n,e)})(e)}function cu(e,t,r){return(cu=pu()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&hu(i,r.prototype),i}).apply(null,arguments)}function pu(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function hu(e,t){return(hu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function du(e){return(du=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Object.defineProperty(au,"__esModule",{value:!0}),au.default=void 0;var fu=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&hu(e,t)}(n,lu(Error));var t,r=(t=n,function(){var e,r=du(t);if(pu()){var n=du(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return function(e,t){return!t||"object"!==uu(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,e)});function n(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(t=r.call(this,e)).originalRequest=o,t.originalResponse=s,t.causingError=i,null!=i&&(e+=", caused by ".concat(i.toString())),null!=o){var a=o.getHeader("X-Request-ID")||"n/a",u=o.getMethod(),l=o.getURL(),c=s?s.getStatus():"n/a",p=s?s.getBody()||"":"n/a";e+=", originated from request (method: ".concat(u,", url: ").concat(l,", response code: ").concat(c,", response text: ").concat(p,", request id: ").concat(a,")")}return t.message=e,t}return n}();au.default=fu;var gu={};Object.defineProperty(gu,"__esModule",{value:!0}),gu.enableDebugLog=function(){vu=!0},gu.log=function(e){vu&&console.log(e)};var vu=!1,yu={};Object.defineProperty(yu,"__esModule",{value:!0}),yu.default=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))};var mu={};Object.defineProperty(mu,"__esModule",{value:!0}),mu.default=void 0;var bu=Su(sa),wu=Su(au),_u=Su(yu);function Su(e){return e&&e.__esModule?e:{default:e}}function ku(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Pu(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if("function"==typeof r||"function"==typeof n)throw new Error("tus: the terminate function does not accept a callback since v2 anymore; please use the returned Promise instead");var i=xu("DELETE",t,r);return Ru(i,null,r).then((function(e){if(204!==e.getStatus())throw new wu.default("tus: unexpected response while terminating upload",null,i,e)})).catch((function(n){if(n instanceof wu.default||(n=new wu.default("tus: failed to terminate upload",n,i,null)),!Uu(n,0,r))throw n;var o=r.retryDelays[0],s=r.retryDelays.slice(1),a=Pu({},r,{retryDelays:s});return new Promise((function(e){return setTimeout(e,o)})).then((function(){return e.terminate(t,a)}))}))}}],(r=[{key:"findPreviousUploads",value:function(){var e=this;return this.options.fingerprint(this.file,this.options).then((function(t){return e._urlStorage.findUploadsByFingerprint(t)}))}},{key:"resumeFromPreviousUpload",value:function(e){this.url=e.uploadUrl||null,this._parallelUploadUrls=e.parallelUploadUrls||null,this._urlStorageKey=e.urlStorageKey}},{key:"start",value:function(){var e=this,t=this.file;if(t)if(this.options.endpoint||this.options.uploadUrl){var r=this.options.retryDelays;null==r||"[object Array]"===Object.prototype.toString.call(r)?(this.options.parallelUploads>1&&["uploadUrl","uploadSize","uploadLengthDeferred"].forEach((function(t){e.options[t]&&e._emitError(new Error("tus: cannot use the ".concat(t," option when parallelUploads is enabled")))})),this.options.fingerprint(t,this.options).then((function(r){return null==r?(0,gu.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,gu.log)("Calculated fingerprint: ".concat(r)),e._fingerprint=r,e._source?e._source:e.options.fileReader.openFile(t,e.options.chunkSize)})).then((function(t){e._source=t,e.options.parallelUploads>1||null!=e._parallelUploadUrls?e._startParallelUpload():e._startSingleUpload()})).catch((function(t){e._emitError(t)}))):this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"))}else this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));else this._emitError(new Error("tus: no file or stream to upload provided"))}},{key:"_startParallelUpload",value:function(){var t=this,r=this._size=this._source.size,n=0;this._parallelUploads=[];var i=null!=this._parallelUploadUrls?this._parallelUploadUrls.length:this.options.parallelUploads,o=function(e,t,r){for(var n=Math.floor(e/t),i=[],o=0;othis._offsetBeforeRetry&&(this._retryAttempt=0),Uu(e,this._retryAttempt,this.options))){var r=this.options.retryDelays[this._retryAttempt++];return this._offsetBeforeRetry=this._offset,void(this._retryTimeout=setTimeout((function(){t.start()}),r))}if("function"!=typeof this.options.onError)throw e;this.options.onError(e)}}},{key:"_emitSuccess",value:function(){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),"function"==typeof this.options.onSuccess&&this.options.onSuccess()}},{key:"_emitProgress",value:function(e,t){"function"==typeof this.options.onProgress&&this.options.onProgress(e,t)}},{key:"_emitChunkComplete",value:function(e,t,r){"function"==typeof this.options.onChunkComplete&&this.options.onChunkComplete(e,t,r)}},{key:"_createUpload",value:function(){var e=this;if(this.options.endpoint){var t=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?t.setHeader("Upload-Defer-Length",1):t.setHeader("Upload-Length",this._size);var r,n=Fu(this.options.metadata);""!==n&&t.setHeader("Upload-Metadata",n),this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,r=this._addChunkToRequest(t)):r=this._sendRequest(t,null),r.then((function(r){if(Ou(r.getStatus(),200)){var n=r.getHeader("Location");if(null!=n){if(e.url=Tu(e.options.endpoint,n),(0,gu.log)("Created upload at ".concat(e.url)),"function"==typeof e.options._onUploadUrlAvailable&&e.options._onUploadUrlAvailable(),0===e._size)return e._emitSuccess(),void e._source.close();e._saveUploadInUrlStorage(),e.options.uploadDataDuringCreation?e._handleUploadResponse(t,r):(e._offset=0,e._performUpload())}else e._emitHttpError(t,r,"tus: invalid or missing Location header")}else e._emitHttpError(t,r,"tus: unexpected response while creating upload")})).catch((function(r){e._emitHttpError(t,null,"tus: failed to create upload",r)}))}else this._emitError(new Error("tus: unable to create upload because no endpoint is provided"))}},{key:"_resumeUpload",value:function(){var e=this,t=this._openRequest("HEAD",this.url);this._sendRequest(t,null).then((function(r){var n=r.getStatus();if(!Ou(n,200))return Ou(n,400)&&e._removeFromUrlStorage(),423===n?void e._emitHttpError(t,r,"tus: upload is currently locked; retry later"):e.options.endpoint?(e.url=null,void e._createUpload()):void e._emitHttpError(t,r,"tus: unable to resume upload (new upload cannot be created without an endpoint)");var i=parseInt(r.getHeader("Upload-Offset"),10);if(isNaN(i))e._emitHttpError(t,r,"tus: invalid or missing offset value");else{var o=parseInt(r.getHeader("Upload-Length"),10);if(!isNaN(o)||e.options.uploadLengthDeferred){if("function"==typeof e.options._onUploadUrlAvailable&&e.options._onUploadUrlAvailable(),i===o)return e._emitProgress(o,o),void e._emitSuccess();e._offset=i,e._performUpload()}else e._emitHttpError(t,r,"tus: invalid or missing length value")}})).catch((function(r){e._emitHttpError(t,null,"tus: failed to resume upload",r)}))}},{key:"_performUpload",value:function(){var e,t=this;this._aborted||(this.options.overridePatchMethod?(e=this._openRequest("POST",this.url)).setHeader("X-HTTP-Method-Override","PATCH"):e=this._openRequest("PATCH",this.url),e.setHeader("Upload-Offset",this._offset),this._addChunkToRequest(e).then((function(r){Ou(r.getStatus(),200)?t._handleUploadResponse(e,r):t._emitHttpError(e,r,"tus: unexpected response while uploading chunk")})).catch((function(r){t._aborted||t._emitHttpError(e,null,"tus: failed to upload chunk at offset "+t._offset,r)})))}},{key:"_addChunkToRequest",value:function(e){var t=this,r=this._offset,n=this._offset+this.options.chunkSize;return e.setProgressHandler((function(e){t._emitProgress(r+e,t._size)})),e.setHeader("Content-Type","application/offset+octet-stream"),(n===1/0||n>this._size)&&!this.options.uploadLengthDeferred&&(n=this._size),this._source.slice(r,n).then((function(r){var n=r.value,i=r.done;return t.options.uploadLengthDeferred&&i&&(t._size=t._offset+(n&&n.size?n.size:0),e.setHeader("Upload-Length",t._size)),null===n?t._sendRequest(e):(t._emitProgress(t._offset,t._size),t._sendRequest(e,n))}))}},{key:"_handleUploadResponse",value:function(e,t){var r=parseInt(t.getHeader("Upload-Offset"),10);if(isNaN(r))this._emitHttpError(e,t,"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._emitSuccess(),void this._source.close();this._performUpload()}}},{key:"_openRequest",value:function(e,t){var r=xu(e,t,this.options);return this._req=r,r}},{key:"_removeFromUrlStorage",value:function(){var e=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch((function(t){e._emitError(t)})),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var e=this;if(this.options.storeFingerprintForResuming&&this._fingerprint){var t={size:this._size,metadata:this.options.metadata,creationTime:(new Date).toString()};this._parallelUploads?t.parallelUploadUrls=this._parallelUploadUrls:t.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,t).then((function(t){return e._urlStorageKey=t})).catch((function(t){e._emitError(t)}))}}},{key:"_sendRequest",value:function(e){return Ru(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,this.options)}}])&&Eu(t.prototype,r),n&&Eu(t,n),e}();function Fu(e){var t=[];for(var r in e)t.push(r+" "+su.Base64.encode(e[r]));return t.join(",")}function Ou(e,t){return e>=t&&e=r.retryDelays.length||null==e.originalRequest)return!1;if(r&&"function"==typeof r.onShouldRetry)return r.onShouldRetry(e,t,r);var n,i=e.originalResponse?e.originalResponse.getStatus():0;return(!Ou(i,400)||409===i||423===i)&&(n=!0,"undefined"!=typeof window&&"navigator"in window&&!1===window.navigator.onLine&&(n=!1),n)}function Tu(e,t){return new bu.default(t,e).toString()}Au.defaultOptions={endpoint:null,uploadUrl:null,metadata:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,_onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:null,chunkSize:1/0,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null};var Du=Au;mu.default=Du;var Bu={};function Iu(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:null;return new Promise((function(r,n){e._xhr.onload=function(){r(new $u(e._xhr))},e._xhr.onerror=function(e){n(e)},e._xhr.send(t)}))}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),e}(),$u=function(){function e(t){Wu(this,e),this._xhr=t}return Yu(e,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(e){return this._xhr.getResponseHeader(e)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),e}(),Ju={};Object.defineProperty(Ju,"__esModule",{value:!0}),Ju.default=void 0;Ju.default=function(){return"undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase()};var Qu={};Object.defineProperty(Qu,"__esModule",{value:!0}),Qu.default=function(e){return new Promise((function(t,r){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var e=n.response;t(e)},n.onerror=function(e){r(e)},n.open("GET",e),n.send()}))};var Zu={};Object.defineProperty(Zu,"__esModule",{value:!0}),Zu.default=void 0;Zu.default=function(){return"undefined"!=typeof window&&(void 0!==window.PhoneGap||void 0!==window.Cordova||void 0!==window.cordova)};var el={};Object.defineProperty(el,"__esModule",{value:!0}),el.default=function(e){return new Promise((function(t,r){var n=new FileReader;n.onload=function(){var e=new Uint8Array(n.result);t({value:e})},n.onerror=function(e){r(e)},n.readAsArrayBuffer(e)}))};var tl={};Object.defineProperty(tl,"__esModule",{value:!0}),tl.default=void 0;var rl=sl(Ju),nl=sl(Qu),il=sl(Zu),ol=sl(el);function sl(e){return e&&e.__esModule?e:{default:e}}function al(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ul(e,t){for(var r=0;rthis._bufferOffset&&(this._buffer=this._buffer.slice(e-this._bufferOffset),this._bufferOffset=e);var r=0===hl(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 hl(e){return void 0===e?0:void 0!==e.size?e.size:e.length}var dl=function(){function e(){al(this,e)}return ll(e,[{key:"openFile",value:function(e,t){return(0,rl.default)()&&e&&void 0!==e.uri?(0,nl.default)(e.uri).then((function(e){return new cl(e)})).catch((function(e){throw new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. "+e)})):"function"==typeof e.slice&&void 0!==e.size?Promise.resolve(new cl(e)):"function"==typeof e.read?(t=+t,isFinite(t)?Promise.resolve(new pl(e,t)):Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option"))):Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment"))}}]),e}();tl.default=dl;var fl={};Object.defineProperty(fl,"__esModule",{value:!0}),fl.default=function(e,t){return(0,vl.default)()?Promise.resolve(function(e,t){var r=e.exif?function(e){var t=0;if(0===e.length)return t;for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),t=Ol({},Rl,{},t),i.call(this,e,t)}return t=o,r=[{key:"terminate",value:function(e,t,r){return t=Ol({},Rl,{},t),ml.default.terminate(e,t,r)}}],null&&Cl(t.prototype,null),r&&Cl(t,r),o}();yl.Upload=Ul;var Tl,Dl,Bl=window,Il=Bl.XMLHttpRequest,Ml=Bl.Blob;Il&&Ml&&Ml.prototype.slice;function jl(){return(jl=Object.assign||function(e){for(var t=1;t0)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 315576e5*r;case"days":case"day":case"d":return r*$l;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*r;case"minutes":case"minute":case"mins":case"min":case"m":return r*Kl;case"seconds":case"second":case"secs":case"sec":case"s":return r*Gl;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}(e);if("number"===n&&!1===isNaN(e))return t.long?Jl(r=e,$l,"day")||Jl(r,36e5,"hour")||Jl(r,Kl,"minute")||Jl(r,Gl,"second")||r+" ms":function(e){return e>=$l?Math.round(e/$l)+"d":e>=36e5?Math.round(e/36e5)+"h":e>=Kl?Math.round(e/Kl)+"m":e>=Gl?Math.round(e/Gl)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))},Ql.instances=[],Ql.names=[],Ql.skips=[],Ql.formatters={};var tc={};(function(e){(function(){function t(){var t;try{t=tc.storage.debug}catch(Cd){}return!t&&void 0!==e&&"env"in e&&(t=e.env.DEBUG),t}(tc=tc=Ql).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},tc.formatArgs=function(e){var t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+tc.humanize(this.diff),t){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(n++,"%c"===e&&(i=n))})),e.splice(i,0,r)}},tc.save=function(e){try{null==e?tc.storage.removeItem("debug"):tc.storage.debug=e}catch(Cd){}},tc.load=t,tc.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},tc.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(Cd){}}(),tc.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"],tc.formatters.j=function(e){try{return JSON.stringify(e)}catch(pp){return"[UnexpectedJSONParseError]: "+pp.message}},tc.enable(t())}).call(this)}).call(this,e);var rc=tc("socket.io-client:url"),nc=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)||(rc("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),rc("parse %s",e),r=Yl(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};function ic(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 315576e5*r;case"days":case"day":case"d":return 864e5*r;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*r;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*r;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}(e);if("number"===n&&!1===isNaN(e))return t.long?ic(r=e,864e5,"day")||ic(r,36e5,"hour")||ic(r,6e4,"minute")||ic(r,1e3,"second")||r+" ms":function(e){return e>=864e5?Math.round(e/864e5)+"d":e>=36e5?Math.round(e/36e5)+"h":e>=6e4?Math.round(e/6e4)+"m":e>=1e3?Math.round(e/1e3)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))},oc.instances=[],oc.names=[],oc.skips=[],oc.formatters={};var uc={};(function(e){(function(){function t(){var t;try{t=uc.storage.debug}catch(Cd){}return!t&&void 0!==e&&"env"in e&&(t=e.env.DEBUG),t}(uc=uc=oc).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},uc.formatArgs=function(e){var t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+uc.humanize(this.diff),t){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(n++,"%c"===e&&(i=n))})),e.splice(i,0,r)}},uc.save=function(e){try{null==e?uc.storage.removeItem("debug"):uc.storage.debug=e}catch(Cd){}},uc.load=t,uc.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},uc.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(Cd){}}(),uc.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"],uc.formatters.j=function(e){try{return JSON.stringify(e)}catch(pp){return"[UnexpectedJSONParseError]: "+pp.message}},uc.enable(t())}).call(this)}).call(this,e);var lc={exports:{}};function cc(e){if(e)return function(e){for(var t in cc.prototype)e[t]=cc.prototype[t];return e}(e)}lc.exports=cc,cc.prototype.on=cc.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},cc.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},cc.prototype.off=cc.prototype.removeListener=cc.prototype.removeAllListeners=cc.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;in&&(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 qc(e,t){return zc(e>>t&63|128)}function Vc(e,t){if(0==(4294967168&e))return zc(e);var r="";return 0==(4294965248&e)?r=zc(e>>6&31|192):0==(4294901760&e)?(Hc(e,t)||(e=65533),r=zc(e>>12&15|224),r+=qc(e,6)):0==(4292870144&e)&&(r=zc(e>>18&7|240),r+=qc(e,12),r+=qc(e,6)),r+zc(63&e|128)}function Wc(){if(Lc>=jc)throw Error("Invalid byte index");var e=255&Mc[Lc];if(Lc++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function Xc(e){var t,r;if(Lc>jc)throw Error("Invalid byte index");if(Lc==jc)return!1;if(t=255&Mc[Lc],Lc++,0==(128&t))return t;if(192==(224&t)){if((r=(31&t)<<6|Wc())>=128)return r;throw Error("Invalid continuation byte")}if(224==(240&t)){if((r=(15&t)<<12|Wc()<<6|Wc())>=2048)return Hc(r,e)?r:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(r=(7&t)<<18|Wc()<<12|Wc()<<6|Wc())>=65536&&r<=1114111)return r;throw Error("Invalid UTF-8 detected")}var Yc=function(e,t){for(var r=!1!==(t=t||{}).strict,n=Nc(e),i=n.length,o=-1,s="";++o65535&&(i+=zc((t-=65536)>>>10&1023|55296),t=56320|1023&t),i+=zc(t);return i}(i)},Kc={};!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},Kc.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 $c={},Jc=void 0!==Jc?Jc:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,Qc=function(){try{return 2===new Blob(["hi"]).size}catch(Cd){return!1}}(),Zc=Qc&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(Cd){return!1}}(),ep=Jc&&Jc.prototype.append&&Jc.prototype.getBlob;function tp(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 rp(e,t){t=t||{};var r=new Jc;return tp(e).forEach((function(e){r.append(e)})),t.type?r.getBlob(t.type):r.getBlob()}function np(e,t){return new Blob(tp(e),t||{})}"undefined"!=typeof Blob&&(rp.prototype=Blob.prototype,np.prototype=Blob.prototype),$c=Qc?Zc?Blob:np:ep?rp:void 0;var ip,op={};"undefined"!=typeof ArrayBuffer&&(ip=Kc);var sp="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),ap="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),up=sp||ap;op.protocol=3;var lp=op.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},cp=Rc(lp),pp={type:"error",data:"parser error"};function hp(e,t,r){for(var n=new Array(e.length),i=function(e,t,r){var n=!1;return r=r||Ic,i.count=e,0===e?t():i;function i(e,o){if(i.count<=0)throw new Error("after called too many times");--i.count,e?(n=!0,t(e),t=r):0!==i.count||n||t(null,o)}}(e.length,r),o=function(e,r,i){t(r,(function(t,r){n[e]=r,i(t,n)}))},s=0;s1?{type:cp[n],data:e.substring(1)}:{type:cp[n]}:pp}n=new Uint8Array(e)[0];var i=Bc(e,1);return $c&&"blob"===t&&(i=new $c([i])),{type:cp[n],data:i}},op.decodeBase64Packet=function(e,t){var r=cp[e.charAt(0)];if(!ip)return{type:r,data:{base64:!0,data:e.substr(1)}};var n=ip.decode(e.substr(1));return"blob"===t&&$c&&(n=new $c([n])),{type:r,data:n}},op.encodePayload=function(e,t,r){"function"==typeof t&&(r=t,t=null);var n=Dc(e);return t&&n?$c&&!up?op.encodePayloadAsBlob(e,r):op.encodePayloadAsArrayBuffer(e,r):e.length?void hp(e,(function(e,r){op.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:")},op.decodePayload=function(e,t,r){if("string"!=typeof e)return op.decodePayloadAsBinary(e,t,r);var n;if("function"==typeof t&&(r=t,t=null),""===e)return r(pp,0,1);for(var i,o,s="",a=0,u=e.length;a0;){for(var o=new Uint8Array(n),s=0===o[0],a="",u=1;255!==o[u];u++){if(a.length>310)return r(pp,0,1);a+=o[u]}n=Bc(n,2+a.length),a=parseInt(a);var l=Bc(n,0,a);if(s)try{l=String.fromCharCode.apply(null,new Uint8Array(l))}catch(Cd){var c=new Uint8Array(l);for(l="",u=0;u0);return t}function Cp(){var e=Pp(+new Date);return e!==vp?(Sp=0,vp=e):e+"."+Pp(Sp++)}for(;kp<64;kp++)_p[wp[kp]]=kp;Cp.encode=Pp,Cp.decode=function(e){var t=0;for(kp=0;kp';o=document.createElement(e)}catch(Cd){(o=document.createElement("iframe")).name=i.iframeId,o.src="javascript:0"}o.id=i.iframeId,i.form.appendChild(o),i.iframe=o}this.form.action=this.uri(),c(),e=e.replace(n,"\\\n"),this.area.value=e.replace(r,"\\n");try{this.form.submit()}catch(Cd){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===i.iframe.readyState&&l()}:this.iframe.onload=l}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var jp={};(function(e){(function(){var t,r,n=tc("engine.io-client:websocket");if("undefined"!=typeof WebSocket)t=WebSocket;else if("undefined"!=typeof self)t=self.WebSocket||self.MozWebSocket;else try{r=o({})}catch(Cd){}var i=t||r;function s(e){e&&e.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=t&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(i=r),dp.call(this,e)}jp=s,mp(s,dp),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 i(e,t):new i(e):new i(e,t,r)}catch(pp){return this.emit("error",pp)}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(t){var r=this;this.writable=!1;for(var i=t.length,o=0,s=i;o0&&(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()}zp=Hp,Hp.priorWebsocketSuccess=!1,Ec(Hp.prototype),Hp.protocol=op.protocol,Hp.Socket=Hp,Hp.Transport=dp,Hp.transports=Lp,Hp.parser=op,Hp.prototype.createTransport=function(e){Np('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=op.protocol,t.transport=e;var r=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new Lp[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})},Hp.prototype.open=function(){var e;if(this.rememberUpgrade&&Hp.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout((function(){t.emit("error","No transports available")}),0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(Cd){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},Hp.prototype.setTransport=function(e){Np("setting transport %s",e.name);var t=this;this.transport&&(Np("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")}))},Hp.prototype.probe=function(e){Np('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||(Np('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(Np('probe transport "%s" pong',e),n.upgrading=!0,n.emit("upgrading",t),!t)return;Hp.priorWebsocketSuccess="websocket"===t.name,Np('pausing current transport "%s"',n.transport.name),n.transport.pause((function(){r||"closed"!==n.readyState&&(Np("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{Np('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(),Np('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&&(Np('"%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)}Hp.priorWebsocketSuccess=!1,t.once("open",i),t.once("error",s),t.once("close",a),this.once("close",u),this.once("upgrading",l),t.open()},Hp.prototype.onOpen=function(){if(Np("socket open"),this.readyState="open",Hp.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){Np("starting upgrade probes");for(var e=0,t=this.upgrades.length;e0&&e.jitter<=1?e.jitter:0,this.attempts=0}th=rh,rh.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)},rh.prototype.reset=function(){this.attempts=0},rh.prototype.setMin=function(e){this.ms=e},rh.prototype.setMax=function(e){this.max=e},rh.prototype.setJitter=function(e){this.jitter=e};var nh={},ih=tc("socket.io-client:manager"),oh=Object.prototype.hasOwnProperty;function sh(e,t){if(!(this instanceof sh))return new sh(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 th({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||mc;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}nh=sh,sh.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)oh.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},sh.prototype.updateSocketIds=function(){for(var e in this.nsps)oh.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},sh.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},Vp(sh.prototype),sh.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},sh.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},sh.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},sh.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},sh.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},sh.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},sh.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},sh.prototype.open=sh.prototype.connect=function(e,t){if(ih("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;ih("opening %s",this.uri),this.engine=qp(this.uri,this.opts);var r=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var i=Yp(r,"open",(function(){n.onopen(),e&&e()})),o=Yp(r,"error",(function(t){if(ih("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;ih("connect attempt will timeout after %d",s);var a=setTimeout((function(){ih("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},sh.prototype.onopen=function(){ih("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(Yp(e,"data",Kp(this,"ondata"))),this.subs.push(Yp(e,"ping",Kp(this,"onping"))),this.subs.push(Yp(e,"pong",Kp(this,"onpong"))),this.subs.push(Yp(e,"error",Kp(this,"onerror"))),this.subs.push(Yp(e,"close",Kp(this,"onclose"))),this.subs.push(Yp(this.decoder,"decoded",Kp(this,"ondecoded")))},sh.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},sh.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},sh.prototype.ondata=function(e){this.decoder.add(e)},sh.prototype.ondecoded=function(e){this.emit("packet",e)},sh.prototype.onerror=function(e){ih("error",e),this.emitAll("error",e)},sh.prototype.socket=function(e,t){var r=this.nsps[e];if(!r){r=new $p(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(){~Oc(n.connecting,r)||n.connecting.push(r)}return r},sh.prototype.destroy=function(e){var t=Oc(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},sh.prototype.packet=function(e){ih("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)}},sh.prototype.cleanup=function(){ih("cleanup");for(var e=this.subs.length,t=0;t=this._reconnectionAttempts)ih("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();ih("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var r=setTimeout((function(){e.skipReconnect||(ih("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open((function(t){t?(ih("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(ih("reconnect success"),e.onreconnect())})))}),t);this.subs.push({destroy:function(){clearTimeout(r)}})}},sh.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)};function ah(){return(ah=Object.assign||function(e){for(var t=1;t=lh.indexOf(t)}var ph=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 o=n.prototype;return o.connect=function(){this._connectSocket(),this._beginPolling()},o._onFinished=function(){this.emit("finished"),this.close()},o._connectSocket=function(){var e=this,t=function(e){var t=/^\w+:\/\//.exec(e),r=0;t&&(r=t[0].length+1);var n=e.indexOf("/",r);return-1===n?{origin:e,pathname:"/"}:{origin:e.slice(0,n),pathname:e.slice(n)}}(this.status.websocket_url),r=(uh||(uh=i({})),uh).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("connect_failed",(function(){e._onError(new Re("Transloadit Socket.io connection error")),e.socket=null})),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},o._onError=function(e){this.emit("error",ah(new Error(e.message),e))},o._beginPolling=function(){var e=this;this.pollInterval=setInterval((function(){e.socket&&e.socket.connected||e._fetchStatus()}),2e3)},o._fetchStatus=function(e){var t=this,r=(void 0===e?{}:e).diff,n=void 0===r||r;return Ue(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)})).catch((function(e){return t._onError(e)}))},o.update=function(){return this._fetchStatus({diff:!0})},o.updateStatus=function(e){this._diffStatus(this.status,e),this.status=e},o._diffStatus=function(e,t){var r=this,n=e.ok,i=t.ok;if(t.error&&!e.error)return this._onError(t);var o=ch(i,"ASSEMBLY_EXECUTING")&&!ch(n,"ASSEMBLY_EXECUTING");o&&this.emit("executing"),Object.keys(t.uploads).filter((function(t){return!S(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)}))})),ch(i,"ASSEMBLY_COMPLETED")&&!ch(n,"ASSEMBLY_COMPLETED")&&this.emit("finished")},o.close=function(){this.closed=!0,this.socket&&(this.socket.disconnect(),this.socket=null),clearInterval(this.pollInterval)},n}(lc),hh=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.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 Ue(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 Ue(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 Ue(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 Ue(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 Ue(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 Ue("https://transloaditstatus.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}(),dh={};function fh(e){if(!e)throw new Error("Transloadit: The `params` option is required.");if("string"==typeof e)try{e=JSON.parse(e)}catch(pp){throw pp.message="Transloadit: The `params` option is a malformed JSON string: "+pp.message,pp}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 gh=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 fh(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 fh(t.params),[{fileIDs:e.files.map((function(e){return e.id})),options:t}]})):Promise.resolve([])},e}();function vh(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(dh=gh).validateParams=fh;var yh,mh,bh=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(vh(n)),n._onAssemblyCancel=n._onAssemblyCancel.bind(vh(n)),n._onAssemblyError=n._onAssemblyError.bind(vh(n)),n._onImportError=n._onImportError.bind(vh(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}(lc),wh={};function _h(){return(_h=Object.assign||function(e){for(var t=1;t=200&&e<300}};if(n.opts=Oh({},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 aa?n.requests=n.opts.__queue:n.requests=new aa(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 C([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=this.opts.headers,n=Oh({},this.opts,t||{},e.xhrUpload||{},{headers:{}});return"function"==typeof r?n.headers=r(e):Oh(n.headers,this.opts.headers),t&&Oh(n.headers,t.headers),e.xhrUpload&&Oh(n.headers,e.xhrUpload.headers),n},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=Dh(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=Dh(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 pa(n.uppy);var a=new ha(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=B();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],h={status:o.target.status,body:c,uploadURL:p};return n.uppy.emit("upload-success",e,h),p&&n.uppy.log("Download "+e.name+" from "+p),t(e)}var d=i.getResponseData(s.responseText,s),f=Th(s,i.getResponseError(s.responseText,s)),g={status:o.target.status,body:d};return n.uppy.emit("upload-error",e,f,g),r(f)})),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=Th(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?xh:Rh)(n.uppy,e.remote.providerOptions).post(e.remote.url,Oh({},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=ca(e.remote.companionUrl),u=new Uh({target:a+"/api/"+s,autoOpen:!1});n.uploaderEvents[e.id]=new pa(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 la(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):Oh(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,Oh({},t.opts,s||{})),u=new XMLHttpRequest,l=new ha(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 ua(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 the `bundle: true` option is set");if("function"==typeof this.opts.headers)throw new TypeError("`headers` may not be a function when the `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:Oh({},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:Oh({},e,{individualCancellation:!0})})}this.uppy.removeUploader(this.handleUpload)},n}(ue.Plugin),Ph.VERSION="1.7.0",Ch),Ih={__esModule:!0};Ih.default=Wh,Ih.getFieldData=Xh;var Mh,jh,Lh={"[object HTMLCollection]":!0,"[object NodeList]":!0,"[object RadioNodeList]":!0},zh={button:!0,fieldset:!0,reset:!0,submit:!0},Nh={checkbox:!0,radio:!0},Hh=/^\s+|\s+$/g,qh=Array.prototype.slice,Vh=Object.prototype.toString;function Wh(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]"!==Vh.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(!Lh[Vh.call(n)])return Yh(n,r.trim);for(var i=[],o=!0,s=0,a=n.length;s0?i:null}function Yh(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}($h),Mh.VERSION="1.3.26",jh),Zh={},ed="undefined"!=typeof navigator&&"serviceWorker"in navigator,td=function(){function e(e){this.ready=new Promise((function(e,t){ed?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}();td.isSupported=ed,Zh=td;var rd={};function nd(){return(nd=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 ad(r.transaction(["files"],"readwrite").objectStore("files").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 ad(r.transaction(["files"],"readwrite").objectStore("files").delete(t.key(e)))}))},e.cleanup=function(){return sd("uppy-blobs").then((function(e){var t=e.transaction(["files"],"readwrite").objectStore("files").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",q(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 cd(){return(cd=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=vd({},this.uppy.getState().files);Object.keys(e).forEach((function(i){var o=t.uppy.getFile(i);if(o){var s=vd({},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}(ue.Plugin),hd.VERSION="1.3.25",dd);function _d(){return(_d=Object.assign||function(e){for(var t=1;t