/*! For license information please see bundle.js.LICENSE.txt */ (()=>{var e={505:e=>{"use strict";e.exports=function(e){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("Expected a number, got "+typeof e);const t=e<0,i=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return(t?"-":"")+e+" B";const s=Math.min(Math.floor(Math.log(e)/Math.log(1024)),i.length-1);e=Number(e/1024**s);const r=i[s];return e>=10||e%1==0?`${(t?"-":"")+e.toFixed(0)} ${r}`:`${(t?"-":"")+e.toFixed(1)} ${r}`}},228:e=>{"use strict";var t=Object.prototype.hasOwnProperty,i="~";function s(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function n(e,t,s,n,o){if("function"!=typeof s)throw new TypeError("The listener must be a function");var a=new r(s,n||e,o),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function a(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),a.prototype.eventNames=function(){var e,s,r=[];if(0===this._eventsCount)return r;for(s in e=this._events)t.call(e,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=i?i+e:e,s=this._events[t];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,n=s.length,o=new Array(n);r{e.exports=function(e,t){if(e===t)return!0;for(var i in e)if(!(i in t))return!1;for(var i in t)if(e[i]!==t[i])return!1;return!0}},873:(e,t,i)=>{var s=i(325).Symbol;e.exports=s},552:(e,t,i)=>{var s=i(873),r=i(659),n=i(350),o=s?s.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?r(e):n(e)}},128:(e,t,i)=>{var s=i(800),r=/^\s+/;e.exports=function(e){return e?e.slice(0,s(e)+1).replace(r,""):e}},840:(e,t,i)=>{var s="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g;e.exports=s},659:(e,t,i)=>{var s=i(873),r=Object.prototype,n=r.hasOwnProperty,o=r.toString,a=s?s.toStringTag:void 0;e.exports=function(e){var t=n.call(e,a),i=e[a];try{e[a]=void 0;var s=!0}catch(e){}var r=o.call(e);return s&&(t?e[a]=i:delete e[a]),r}},350:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},325:(e,t,i)=>{var s=i(840),r="object"==typeof self&&self&&self.Object===Object&&self,n=s||r||Function("return this")();e.exports=n},800:e=>{var t=/\s/;e.exports=function(e){for(var i=e.length;i--&&t.test(e.charAt(i)););return i}},221:(e,t,i)=>{var s=i(805),r=i(124),n=i(374),o=Math.max,a=Math.min;e.exports=function(e,t,i){var l,u,d,h,p,c,f=0,m=!1,g=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var i=l,s=u;return l=u=void 0,f=t,h=e.apply(s,i)}function b(e){var i=e-c;return void 0===c||i>=t||i<0||g&&e-f>=d}function w(){var e=r();if(b(e))return _(e);p=setTimeout(w,function(e){var i=t-(e-c);return g?a(i,d-(e-f)):i}(e))}function _(e){return p=void 0,y&&l?v(e):(l=u=void 0,h)}function F(){var e=r(),i=b(e);if(l=arguments,u=this,c=e,i){if(void 0===p)return function(e){return f=e,p=setTimeout(w,t),m?v(e):h}(c);if(g)return clearTimeout(p),p=setTimeout(w,t),v(c)}return void 0===p&&(p=setTimeout(w,t)),h}return t=n(t)||0,s(i)&&(m=!!i.leading,d=(g="maxWait"in i)?o(n(i.maxWait)||0,t):d,y="trailing"in i?!!i.trailing:y),F.cancel=function(){void 0!==p&&clearTimeout(p),f=0,l=c=u=p=void 0},F.flush=function(){return void 0===p?h:_(r())},F}},805:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},394:(e,t,i)=>{var s=i(552),r=i(346);e.exports=function(e){return"symbol"==typeof e||r(e)&&"[object Symbol]"==s(e)}},124:(e,t,i)=>{var s=i(325);e.exports=function(){return s.Date.now()}},969:(e,t,i)=>{var s=i(221),r=i(805);e.exports=function(e,t,i){var n=!0,o=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return r(i)&&(n="leading"in i?!!i.leading:n,o="trailing"in i?!!i.trailing:o),s(e,t,{leading:n,maxWait:t,trailing:o})}},374:(e,t,i)=>{var s=i(128),r=i(805),n=i(394),o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(n(e))return NaN;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=s(e);var i=a.test(e);return i||l.test(e)?u(e.slice(2),i?2:8):o.test(e)?NaN:+e}},57:(e,t,i)=>{var s=i(163),r=/[\/\+\.]/;e.exports=function(e,t){function i(t){var i=s(t,e,r);return i&&i.length>=2}return t?i(t.split(";")[0]):i}},835:e=>{e.exports=function(){var e={},t=e._fns={};return e.emit=function(e,i,s,r,n,o,a){var l=function(e){for(var i=t[e]?t[e]:[],s=e.indexOf(":"),r=-1===s?[e]:[e.substring(0,s),e.substring(s+1)],n=Object.keys(t),o=0,a=n.length;o{"use strict";function t(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}t.prototype.match=function(e){var t,i,s=!0,r=this.parts,n=r.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(i=(e||"").split(this.separator),t=0;s&&t{var i;!function(){"use strict";var s={}.hasOwnProperty;function r(){for(var e="",t=0;t{"use strict";function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var t=0;function s(e){return"__private_"+t+++"_"+e}function r(e,t,i){const s=[];return e.forEach((e=>"string"!=typeof e?s.push(e):t[Symbol.split](e).forEach(((e,t,r)=>{""!==e&&s.push(e),t{throw new Error(`missing string: ${e}`)};var a=s("onMissingKey"),l=s("apply");class u{constructor(t,i){let{onMissingKey:s=o}=void 0===i?{}:i;Object.defineProperty(this,l,{value:d}),Object.defineProperty(this,a,{writable:!0,value:void 0}),this.locale={strings:{},pluralize:e=>1===e?0:1},Array.isArray(t)?t.forEach(e(this,l)[l],this):e(this,l)[l](t),e(this,a)[a]=s}translate(e,t){return this.translateArray(e,t).join("")}translateArray(t,i){let s=this.locale.strings[t];if(null==s&&(e(this,a)[a](t),s=t),"object"==typeof s){if(i&&void 0!==i.smart_count)return n(s[this.locale.pluralize(i.smart_count)],i);throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if("string"!=typeof s)throw new Error("string was not a string");return n(s,i)}}function d(e){if(null==e||!e.strings)return;const t=this.locale;Object.assign(this.locale,{strings:{...t.strings,...e.strings},pluralize:e.pluralize||t.pluralize})}var h=i(835);let p=(e=21)=>{let t="",i=e;for(;i--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t};var c=i(969);function f(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var m=0;function g(e){return"__private_"+m+++"_"+e}var y=g("callbacks"),v=g("publish");class b{constructor(){Object.defineProperty(this,v,{value:w}),this.state={},Object.defineProperty(this,y,{writable:!0,value:new Set})}getState(){return this.state}setState(e){const t={...this.state},i={...this.state,...e};this.state=i,f(this,v)[v](t,i,e)}subscribe(e){return f(this,y)[y].add(e),()=>{f(this,y)[y].delete(e)}}}function w(){for(var e=arguments.length,t=new Array(e),i=0;i{e(...t)}))}b.VERSION="3.2.2";const _=b;function F(e){const t=e.lastIndexOf(".");return-1===t||t===e.length-1?{name:e,extension:void 0}:{name:e.slice(0,t),extension:e.slice(t+1)}}const P={__proto__:null,md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",webp:"image/webp",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"};function S(e){var t;if(e.type)return e.type;const i=e.name?null==(t=F(e.name).extension)?void 0:t.toLowerCase():null;return i&&i in P?P[i]:"application/octet-stream"}function C(e){let t="";return e.replace(/[^A-Z0-9]/gi,(e=>(t+=`-${function(e){return e.charCodeAt(0).toString(32)}(e)}`,"/")))+t}function k(e){if(function(e){return!(!e.isRemote||!e.remote)&&new Set(["box","dropbox","drive","facebook","unsplash"]).has(e.remote.provider)}(e))return e.id;const t=S(e);return function(e){let t="uppy";return"string"==typeof e.name&&(t+=`-${C(e.name.toLowerCase())}`),void 0!==e.type&&(t+=`-${e.type}`),e.meta&&"string"==typeof e.meta.relativePath&&(t+=`-${C(e.meta.relativePath.toLowerCase())}`),void 0!==e.data.size&&(t+=`-${e.data.size}`),void 0!==e.data.lastModified&&(t+=`-${e.data.lastModified}`),t}({...e,type:t})}function T(e){if(null==e&&"undefined"!=typeof navigator&&(e=navigator.userAgent),!e)return!0;const t=/Edge\/(\d+\.\d+)/.exec(e);if(!t)return!0;const i=t[1].split(".",2),s=parseInt(i[0],10),r=parseInt(i[1],10);return s<15||15===s&&r<15063||s>18||18===s&&r>=18218}function O(e){return e<10?`0${e}`:e.toString()}function E(){const e=new Date;return`${O(e.getHours())}:${O(e.getMinutes())}:${O(e.getSeconds())}`}const A={debug:()=>{},warn:()=>{},error:function(){for(var e=arguments.length,t=new Array(e),i=0;i{var t;const i=e();if(null!=(null==(t=i.restrictions)?void 0:t.allowedFileTypes)&&!Array.isArray(i.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return i}}validateAggregateRestrictions(e,t){const{maxTotalFileSize:i,maxNumberOfFiles:s}=this.getOpts().restrictions;if(s){const i=e.filter((e=>!e.isGhost));if(i.length+t.length>s)throw new I(`${this.i18n("youCanOnlyUploadX",{smart_count:s})}`)}if(i){let s=e.reduce(((e,t)=>{var i;return e+(null!=(i=t.size)?i:0)}),0);for(const e of t)if(null!=e.size&&(s+=e.size,s>i))throw new I(this.i18n("exceedsSize",{size:D(i),file:e.name}))}}validateSingleFile(e){const{maxFileSize:t,minFileSize:i,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some((t=>t.includes("/")?!!e.type&&N(e.type.replace(/;.*?$/,""),t):!("."!==t[0]||!e.extension)&&e.extension.toLowerCase()===t.slice(1).toLowerCase()))){const t=s.join(", ");throw new I(this.i18n("youCanOnlyUploadFileTypes",{types:t}),{file:e})}if(t&&null!=e.size&&e.size>t)throw new I(this.i18n("exceedsSize",{size:D(t),file:e.name}),{file:e});if(i&&null!=e.size&&e.size{this.validateSingleFile(e)})),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length{const i=this.getFile(null==e?void 0:e.id);if(null==e||!i)return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);if(100===i.progress.percentage)return void this.log(`Not setting progress for a file that has been already uploaded: ${e.id}`);const s=Number.isFinite(t.bytesTotal)&&t.bytesTotal>0;this.setFileState(e.id,{progress:{...i.progress,bytesUploaded:t.bytesUploaded,bytesTotal:t.bytesTotal,percentage:s?Math.round(t.bytesUploaded/t.bytesTotal*100):0}}),this.calculateTotalProgress()}),500,{leading:!0,trailing:!0}),Object.defineProperty(this,oe,{writable:!0,value:this.updateOnlineStatus.bind(this)}),Object.defineProperty(this,ae,{writable:!0,value:new Map}),this.defaultLocale=R;const t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:U,meta:{},onBeforeFileAdded:(e,t)=>!Object.hasOwn(t,e.id),onBeforeUpload:e=>e,store:new _,logger:A,infoTimeout:5e3},i={...t,...e};this.opts={...i,restrictions:{...t.restrictions,...e&&e.restrictions}},e&&e.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e&&e.debug&&(this.opts.logger=x),this.log(`Using Core v${pe.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...H,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:T(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),z(this,W)[W]=new B((()=>this.opts),this.i18n),z(this,G)[G]=this.store.subscribe(((e,t,i)=>{this.emit("state-update",e,t,i),this.updateAll(t)})),this.opts.debug&&"undefined"!=typeof window&&(window[this.opts.id]=this),z(this,ne)[ne]()}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s{t.update(e)}))}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){const t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(e).map((e=>{let[i,s]=e;return[i,{...t[i],...s}]})))}})}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can’t set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:t})}i18nInit(){const e=new u([this.defaultLocale,this.opts.locale],{onMissingKey:e=>this.log(`Missing i18n string: ${e}`,"error")});this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.locale=e.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...null==e?void 0:e.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins((t=>{t.setOptions(e)})),this.setState(void 0)}resetProgress(){const e={percentage:0,bytesUploaded:0,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},i={};Object.keys(t).forEach((s=>{i[s]={...t[s],progress:{...t[s].progress,...e}}})),this.setState({files:i,...H}),this.emit("reset-progress")}clearUploadedFiles(){this.setState({...H,files:{}})}addPreProcessor(e){z(this,X)[X].add(e)}removePreProcessor(e){return z(this,X)[X].delete(e)}addPostProcessor(e){z(this,Q)[Q].add(e)}removePostProcessor(e){return z(this,Q)[Q].delete(e)}addUploader(e){z(this,Y)[Y].add(e)}removeUploader(e){return z(this,Y)[Y].delete(e)}setMeta(e){const t={...this.getState().meta,...e},i={...this.getState().files};Object.keys(i).forEach((t=>{i[t]={...i[t],meta:{...i[t].meta,...e}}})),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:i})}setFileMeta(e,t){const i={...this.getState().files};if(!i[e])return void this.log("Was trying to set metadata for a file that has been removed: ",e);const s={...i[e].meta,...t};i[e]={...i[e],meta:s},this.setState({files:i})}getFile(e){return this.getState().files[e]}getFiles(){const{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map((e=>this.getFile(e)))}getObjectOfFilesPerState(){const{files:e,totalProgress:t,error:i}=this.getState(),s=Object.values(e),r=s.filter((e=>{let{progress:t}=e;return!t.uploadComplete&&t.uploadStarted})),n=s.filter((e=>!e.progress.uploadStarted)),o=s.filter((e=>e.progress.uploadStarted||e.progress.preprocess||e.progress.postprocess)),a=s.filter((e=>e.progress.uploadStarted)),l=s.filter((e=>e.isPaused)),u=s.filter((e=>e.progress.uploadComplete)),d=s.filter((e=>e.error)),h=r.filter((e=>!e.isPaused)),p=s.filter((e=>e.progress.preprocess||e.progress.postprocess));return{newFiles:n,startedFiles:o,uploadStartedFiles:a,pausedFiles:l,completeFiles:u,erroredFiles:d,inProgressFiles:r,inProgressNotPausedFiles:h,processingFiles:p,isUploadStarted:a.length>0,isAllComplete:100===t&&u.length===s.length&&0===p.length,isAllErrored:!!i&&d.length===s.length,isAllPaused:0!==r.length&&l.length===r.length,isUploadInProgress:r.length>0,isSomeGhost:s.some((e=>e.isGhost))}}validateRestrictions(e,t){void 0===t&&(t=this.getFiles());try{z(this,W)[W].validate(t,[e])}catch(e){return e}return null}checkIfFileAlreadyExists(e){const{files:t}=this.getState();return!(!t[e]||t[e].isGhost)}addFile(e){z(this,te)[te](e);const{nextFilesState:t,validFilesToAdd:i,errors:s}=z(this,re)[re]([e]),r=s.filter((e=>e.isRestriction));if(z(this,J)[J](r),s.length>0)throw s[0];this.setState({files:t});const[n]=i;return this.emit("file-added",n),this.emit("files-added",i),this.log(`Added file: ${n.name}, ${n.id}, mime type: ${n.type}`),z(this,se)[se](),n.id}addFiles(e){z(this,te)[te]();const{nextFilesState:t,validFilesToAdd:i,errors:s}=z(this,re)[re](e),r=s.filter((e=>e.isRestriction));z(this,J)[J](r);const n=s.filter((e=>!e.isRestriction));if(n.length>0){let e="Multiple errors occurred while adding files:\n";if(n.forEach((t=>{e+=`\n * ${t.message}`})),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:n.length}),details:e},"error",this.opts.infoTimeout),"function"==typeof AggregateError)throw new AggregateError(n,e);{const t=new Error(e);throw t.errors=n,t}}this.setState({files:t}),i.forEach((e=>{this.emit("file-added",e)})),this.emit("files-added",i),i.length>5?this.log(`Added batch of ${i.length} files`):Object.values(i).forEach((e=>{this.log(`Added file: ${e.name}\n id: ${e.id}\n type: ${e.type}`)})),i.length>0&&z(this,se)[se]()}removeFiles(e,t){const{files:i,currentUploads:s}=this.getState(),r={...i},n={...s},o=Object.create(null);function a(e){return void 0===o[e]}e.forEach((e=>{i[e]&&(o[e]=i[e],delete r[e])})),Object.keys(n).forEach((e=>{const t=s[e].fileIDs.filter(a);if(0===t.length)return void delete n[e];const{capabilities:i}=this.getState();if(t.length!==s[e].fileIDs.length&&!i.individualCancellation)throw new Error("individualCancellation is disabled");n[e]={...s[e],fileIDs:t}}));const l={currentUploads:n,files:r};0===Object.keys(r).length&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),this.calculateTotalProgress();const u=Object.keys(o);u.forEach((e=>{this.emit("file-removed",o[e],t)})),u.length>5?this.log(`Removed ${u.length} files`):this.log(`Removed files: ${u.join(", ")}`)}removeFile(e,t){this.removeFiles([e],t)}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).progress.uploadComplete)return;const t=!this.getFile(e).isPaused;return this.setFileState(e,{isPaused:t}),this.emit("upload-pause",e,t),t}pauseAll(){const e={...this.getState().files};Object.keys(e).filter((t=>!e[t].progress.uploadComplete&&e[t].progress.uploadStarted)).forEach((t=>{const i={...e[t],isPaused:!0};e[t]=i})),this.setState({files:e}),this.emit("pause-all")}resumeAll(){const e={...this.getState().files};Object.keys(e).filter((t=>!e[t].progress.uploadComplete&&e[t].progress.uploadStarted)).forEach((t=>{const i={...e[t],isPaused:!1,error:null};e[t]=i})),this.setState({files:e}),this.emit("resume-all")}retryAll(){const e={...this.getState().files},t=Object.keys(e).filter((t=>e[t].error));if(t.forEach((t=>{const i={...e[t],isPaused:!1,error:null};e[t]=i})),this.setState({files:e,error:null}),this.emit("retry-all",t),0===t.length)return Promise.resolve({successful:[],failed:[]});const i=z(this,le)[le](t,{forceAllowNewUpload:!0});return z(this,he)[he](i)}cancelAll(e){let{reason:t="user"}=void 0===e?{}:e;if(this.emit("cancel-all",{reason:t}),"user"===t){const{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t,"cancel-all"),this.setState(H)}}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",e);const t=z(this,le)[le]([e],{forceAllowNewUpload:!0});return z(this,he)[he](t)}logout(){this.iteratePlugins((e=>{var t;null==(t=e.provider)||null==t.logout||t.logout()}))}calculateTotalProgress(){const e=this.getFiles().filter((e=>e.progress.uploadStarted||e.progress.preprocess||e.progress.postprocess));if(0===e.length)return this.emit("progress",0),void this.setState({totalProgress:0});const t=e.filter((e=>null!=e.progress.bytesTotal)),i=e.filter((e=>null==e.progress.bytesTotal));if(0===t.length){const t=100*e.length,s=i.reduce(((e,t)=>e+t.progress.percentage),0),r=Math.round(s/t*100);return void this.setState({totalProgress:r})}let s=t.reduce(((e,t)=>{var i;return e+(null!=(i=t.progress.bytesTotal)?i:0)}),0);const r=s/t.length;s+=r*i.length;let n=0;t.forEach((e=>{n+=e.progress.bytesUploaded})),i.forEach((e=>{n+=r*(e.progress.percentage||0)/100}));let o=0===s?0:Math.round(n/s*100);o>100&&(o=100),this.setState({totalProgress:o}),this.emit("progress",o)}updateOnlineStatus(){var e;null==(e=window.navigator.onLine)||e?(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)}getID(){return this.opts.id}use(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.`);const i=new e(this,t),s=i.id;if(!s)throw new Error("Your plugin must have an id");if(!i.type)throw new Error("Your plugin must have a type");const r=this.getPlugin(s);if(r){const e=`Already found a plugin named '${r.id}'. Tried to use: '${s}'.\nUppy plugins must have unique \`id\` options. See https://uppy.io/docs/plugins/#id.`;throw new Error(e)}return e.VERSION&&this.log(`Using ${s} v${e.VERSION}`),i.type in z(this,V)[V]?z(this,V)[V][i.type].push(i):z(this,V)[V][i.type]=[i],i.install(),this.emit("plugin-added",i),this}getPlugin(e){for(const t of Object.values(z(this,V)[V])){const i=t.find((t=>t.id===e));if(null!=i)return i}}[M](e){return z(this,V)[V][e]}iteratePlugins(e){Object.values(z(this,V)[V]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const t=z(this,V)[V][e.type],i=t.findIndex((t=>t.id===e.id));-1!==i&&t.splice(i,1);const s={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(s)}close(e){let{reason:t}=void 0===e?{}:e;this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll({reason:t}),z(this,G)[G](),this.iteratePlugins((e=>{this.removePlugin(e)})),"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener("online",z(this,oe)[oe]),window.removeEventListener("offline",z(this,oe)[oe]))}hideInfo(){const{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t,i){void 0===t&&(t="info"),void 0===i&&(i=3e3);const s="object"==typeof e;this.setState({info:[...this.getState().info,{type:t,message:s?e.message:e,details:s?e.details:null}]}),setTimeout((()=>this.hideInfo()),i),this.emit("info-visible")}log(e,t){const{logger:i}=this.opts;switch(t){case"error":i.error(e);break;case"warning":i.warn(e);break;default:i.debug(e)}}registerRequestClient(e,t){z(this,ae)[ae].set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);const t=z(this,ae)[ae].get(e.remote.requestClientId);if(null==t)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return t}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?z(this,he)[he](e):(z(this,de)[de](e),Promise.reject(new Error("Nonexistent upload")))}[L](){return z(this,le)[le](...arguments)}addResultData(e,t){if(!z(this,ue)[ue](e))return void this.log(`Not setting result for an upload that has been removed: ${e}`);const{currentUploads:i}=this.getState(),s={...i[e],result:{...i[e].result,...t}};this.setState({currentUploads:{...i,[e]:s}})}upload(){var e;null!=(e=z(this,V)[V].uploader)&&e.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState();const i=this.opts.onBeforeUpload(t);return!1===i?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(i&&"object"==typeof i&&(t=i,this.setState({files:t})),Promise.resolve().then((()=>z(this,W)[W].validateMinNumberOfFiles(t))).catch((e=>{throw z(this,J)[J]([e]),e})).then((()=>{if(!z(this,ee)[ee](t))throw new I(this.i18n("missingRequiredMetaField"))})).catch((e=>{throw e})).then((()=>{const{currentUploads:e}=this.getState(),i=Object.values(e).flatMap((e=>e.fileIDs)),s=[];Object.keys(t).forEach((e=>{const t=this.getFile(e);t.progress.uploadStarted||-1!==i.indexOf(e)||s.push(t.id)}));const r=z(this,le)[le](s);return z(this,he)[he](r)})).catch((e=>{throw this.emit("error",e),this.log(e,"error"),e})))}}function ce(e){for(const t of e)t.isRestriction?this.emit("restriction-failed",t.file,t):this.emit("error",t,t.file),this.log(t,"warning");const t=e.filter((e=>e.isUserFacing)),i=t.slice(0,4),s=t.slice(4);i.forEach((e=>{let{message:t,details:i=""}=e;this.info({message:t,details:i},"error",this.opts.infoTimeout)})),s.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:s.length})})}function fe(e){const{missingFields:t,error:i}=z(this,W)[W].getMissingRequiredMetaFields(e);return!(t.length>0&&(this.setFileState(e.id,{missingRequiredMetaFields:t}),this.log(i.message),this.emit("restriction-failed",e,i),1))}function me(e){let t=!0;for(const i of Object.values(e))z(this,Z)[Z](i)||(t=!1);return t}function ge(e){const{allowNewUpload:t}=this.getState();if(!1===t){const t=new I(this.i18n("noMoreFilesAllowed"),{file:e});throw z(this,J)[J]([t]),t}}function ye(e){const t=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e}:e,i=S(t),s=function(e,t){return t.name?t.name:"image"===e.split("/")[0]?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}(i,t),r=F(s).extension,n=k(t),o=t.meta||{};o.name=s,o.type=i;const a=Number.isFinite(t.data.size)?t.data.size:null;return{source:t.source||"",id:n,name:s,extension:r||"",meta:{...this.getState().meta,...o},type:i,data:t.data,progress:{percentage:0,bytesUploaded:0,bytesTotal:a,uploadComplete:!1,uploadStarted:null},size:a,isGhost:!1,isRemote:t.isRemote||!1,remote:t.remote||"",preview:t.preview}}function ve(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout((()=>{this.scheduledAutoProceed=null,this.upload().catch((e=>{e.isRestriction||this.log(e.stack||e.message||e)}))}),4))}function be(e){const{files:t}=this.getState(),i={...t},s=[],r=[];for(const o of e)try{var n;let e=z(this,ie)[ie](o);const r=null==(n=t[e.id])?void 0:n.isGhost;r&&(e={...t[e.id],isGhost:!1,data:o.data},this.log(`Replaced the blob in the restored ghost file: ${e.name}, ${e.id}`));const a=this.opts.onBeforeFileAdded(e,i);if(!a&&this.checkIfFileAlreadyExists(e.id))throw new I(this.i18n("noDuplicates",{fileName:e.name}),{file:o});if(!1===a&&!r)throw new I("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:o});"object"==typeof a&&null!==a&&(e=a),z(this,W)[W].validateSingleFile(e),i[e.id]=e,s.push(e)}catch(e){r.push(e)}try{z(this,W)[W].validateAggregateRestrictions(Object.values(t),s)}catch(e){return r.push(e),{nextFilesState:t,validFilesToAdd:[],errors:r}}return{nextFilesState:i,validFilesToAdd:s,errors:r}}function we(){const e=(e,t,i)=>{let s=e.message||"Unknown error";e.details&&(s+=` ${e.details}`),this.setState({error:s}),null!=t&&t.id in this.getState().files&&this.setFileState(t.id,{error:s,response:i})};this.on("error",e),this.on("upload-error",((t,i,s)=>{if(e(i,t,s),"object"==typeof i&&i.message){var r;this.log(i.message,"error");const e=new Error(this.i18n("failedToUpload",{file:null!=(r=null==t?void 0:t.name)?r:""}));e.isUserFacing=!0,e.details=i.message,i.details&&(e.details+=` ${i.details}`),z(this,J)[J]([e])}else z(this,J)[J]([i])}));let t=null;this.on("upload-stalled",((e,i)=>{const{message:s}=e,r=i.map((e=>e.meta.name)).join(", ");t||(this.info({message:s,details:r},"warning",this.opts.infoTimeout),t=setTimeout((()=>{t=null}),this.opts.infoTimeout)),this.log(`${s} ${r}`.trim(),"warning")})),this.on("upload",(()=>{this.setState({error:null})}));const i=e=>{const t=e.filter((e=>{const t=null!=e&&this.getFile(e.id);return t||this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`),t})),i=Object.fromEntries(t.map((e=>[e.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:e.size}}])));this.patchFilesState(i)};this.on("upload-start",(e=>{e.forEach((e=>{this.emit("upload-started",e)})),i(e)})),this.on("upload-progress",this.calculateProgress),this.on("upload-success",((e,t)=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const i=this.getFile(e.id).progress;this.setFileState(e.id,{progress:{...i,postprocess:z(this,Q)[Q].size>0?{mode:"indeterminate"}:void 0,uploadComplete:!0,percentage:100,bytesUploaded:i.bytesTotal},response:t,uploadURL:t.uploadURL,isPaused:!1}),null==e.size&&this.setFileState(e.id,{size:t.bytesUploaded||i.bytesTotal}),this.calculateTotalProgress()})),this.on("preprocess-progress",((e,t)=>{null!=e&&this.getFile(e.id)?this.setFileState(e.id,{progress:{...this.getFile(e.id).progress,preprocess:t}}):this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`)})),this.on("preprocess-complete",(e=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const t={...this.getState().files};t[e.id]={...t[e.id],progress:{...t[e.id].progress}},delete t[e.id].progress.preprocess,this.setState({files:t})})),this.on("postprocess-progress",((e,t)=>{null!=e&&this.getFile(e.id)?this.setFileState(e.id,{progress:{...this.getState().files[e.id].progress,postprocess:t}}):this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`)})),this.on("postprocess-complete",(e=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const t={...this.getState().files};t[e.id]={...t[e.id],progress:{...t[e.id].progress}},delete t[e.id].progress.postprocess,this.setState({files:t})})),this.on("restored",(()=>{this.calculateTotalProgress()})),this.on("dashboard:file-edit-complete",(e=>{e&&z(this,Z)[Z](e)})),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",z(this,oe)[oe]),window.addEventListener("offline",z(this,oe)[oe]),setTimeout(z(this,oe)[oe],3e3))}function _e(e,t){void 0===t&&(t={});const{forceAllowNewUpload:i=!1}=t,{allowNewUpload:s,currentUploads:r}=this.getState();if(!s&&!i)throw new Error("Cannot create a new upload: already uploading.");const n=p();return this.emit("upload",{id:n,fileIDs:e}),this.setState({allowNewUpload:!1!==this.opts.allowMultipleUploadBatches&&!1!==this.opts.allowMultipleUploads,currentUploads:{...r,[n]:{fileIDs:e,step:0,result:{}}}}),n}function Fe(e){const{currentUploads:t}=this.getState();return t[e]}function Pe(e){const t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async function Se(e){const t=()=>{const{currentUploads:t}=this.getState();return t[e]};let i=t();const s=[...z(this,X)[X],...z(this,Y)[Y],...z(this,Q)[Q]];try{for(let r=i.step||0;r{const t=this.getFile(e);t&&t.progress.postprocess&&this.emit("postprocess-complete",t)}));const s=i.fileIDs.map((e=>this.getFile(e))),r=s.filter((e=>!e.error)),n=s.filter((e=>e.error));this.addResultData(e,{successful:r,failed:n,uploadID:e}),i=t()}let r;return i&&(r=i.result,this.emit("complete",r),z(this,de)[de](e)),null==r&&this.log(`Not setting result for an upload that has been removed: ${e}`),r}pe.VERSION="3.9.3";const Ce=pe;var ke,Te,Oe,Ee,Ae,xe,De,Ne={},Ue=[],Ie=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Be=Array.isArray;function Re(e,t){for(var i in t)e[i]=t[i];return e}function Me(e){var t=e.parentNode;t&&t.removeChild(e)}function Le(e,t,i){var s,r,n,o={};for(n in t)"key"==n?s=t[n]:"ref"==n?r=t[n]:o[n]=t[n];if(arguments.length>2&&(o.children=arguments.length>3?ke.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(n in e.defaultProps)void 0===o[n]&&(o[n]=e.defaultProps[n]);return ze(e,o,s,r,null)}function ze(e,t,i,s,r){var n={type:e,props:t,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++Oe:r,__i:-1,__u:0};return null==r&&null!=Te.vnode&&Te.vnode(n),n}function je(e){return e.children}function $e(e,t){this.props=e,this.context=t}function qe(e,t){if(null==t)return e.__?qe(e.__,e.__i+1):null;for(var i;ti?(rt(s,t,r),r.length=s.length=0,t=void 0,Ee.sort(De)):t&&Te.__c&&Te.__c(t,Ue));t&&rt(s,t,r),Ge.__r=0}function Ke(e,t,i,s,r,n,o,a,l,u,d){var h,p,c,f,m,g=s&&s.__k||Ue,y=t.length;for(i.__d=l,Xe(i,t,g),l=i.__d,h=0;h0?ze(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)?(r.__=e,r.__b=e.__b+1,a=Je(r,i,o,d),r.__i=a,n=null,-1!==a&&(d--,(n=i[a])&&(n.__u|=131072)),null==n||null===n.__v?(-1==a&&h--,"function"!=typeof r.type&&(r.__u|=65536)):a!==o&&(a===o+1?h++:a>o?d>l-o?h+=a-o:h--:a(null==l||131072&l.__u?0:1))for(;o>=0||a=0){if((l=t[o])&&!(131072&l.__u)&&r==l.key&&n===l.type)return o;o--}if(a2&&(a.children=arguments.length>3?ke.call(arguments,2):i),ze(e.type,a,s||e.key,r||e.ref,null)}function ht(e){return"object"==typeof e&&null!==e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}ke=Ue.slice,Te={__e:function(e,t,i,s){for(var r,n,o;t=t.__;)if((r=t.__c)&&!r.__)try{if((n=r.constructor)&&null!=n.getDerivedStateFromError&&(r.setState(n.getDerivedStateFromError(e)),o=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,s||{}),o=r.__d),o)return r.__E=r}catch(t){e=t}throw e}},Oe=0,$e.prototype.setState=function(e,t){var i;i=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Re({},this.state),"function"==typeof e&&(e=e(Re({},i),this.props)),e&&Re(i,e),null!=e&&this.__v&&(t&&this._sb.push(t),We(this))},$e.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),We(this))},$e.prototype.render=je,Ee=[],xe="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,De=function(e,t){return e.__v.__b-t.__v.__b},Ge.__r=0;const pt=function(e){for(var t;e&&!e.dir;)e=e.parentNode;return null==(t=e)?void 0:t.dir};class ct{constructor(e,t){this.uppy=e,this.opts=null!=t?t:{}}getPluginState(){const{plugins:e}=this.uppy.getState();return(null==e?void 0:e[this.id])||{}}setPluginState(e){if(!e)return;const{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){const e=new u([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}}function ft(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var mt=0;function gt(e){return"__private_"+mt+++"_"+e}var yt=gt("updateUI");class vt extends ct{constructor(){super(...arguments),Object.defineProperty(this,yt,{writable:!0,value:void 0})}getTargetPlugin(e){let t;if("function"==typeof(null==e?void 0:e.addTarget))t=e,t instanceof vt||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:vt}}));else if("function"==typeof e){const i=e;this.uppy.iteratePlugins((e=>{e instanceof i&&(t=e)}))}return t}mount(e,t){const i=t.id,s=(r=e,void 0===n&&(n=document),"string"==typeof r?n.querySelector(r):ht(r)?r:null);var r,n;if(s){this.isTargetDOMEl=!0;const t=document.createElement("div");return t.classList.add("uppy-Root"),ft(this,yt)[yt]=function(e){let t,i=null;return function(){for(var s=arguments.length,r=new Array(s),n=0;n(i=null,e(...t))))),i}}((e=>{this.uppy.getPlugin(this.id)&&(ut(this.render(e),t),this.afterUpdate())})),this.uppy.log(`Installing ${i} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(s.innerHTML=""),ut(this.render(this.uppy.getState()),t),this.el=t,s.appendChild(t),t.dir=this.opts.direction||pt(t)||"ltr",this.onMount(),this.el}const o=this.getTargetPlugin(e);if(o)return this.uppy.log(`Installing ${i} to ${o.id}`),this.parent=o,this.el=o.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${i}`);let a=`Invalid target option given to ${i}.`;throw a+="function"==typeof e?" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":"If you meant to target an HTML element, please make sure that the element exists. Check that the