@oub/fusion 0.3.23 → 0.3.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/fusion.js CHANGED
@@ -17354,7 +17354,7 @@ var Nb = Qb();
17354
17354
  const qb = /* @__PURE__ */ kr(Nb);
17355
17355
  let Hb = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", zb = (e = 21) => {
17356
17356
  let t = "", a = e | 0;
17357
- for (; a--; )
17357
+ for (; a-- > 0; )
17358
17358
  t += Hb[Math.random() * 64 | 0];
17359
17359
  return t;
17360
17360
  };
@@ -52,7 +52,7 @@
52
52
  *
53
53
  * @param phrase that needs interpolation, with placeholders
54
54
  * @param options with values that will be used to replace placeholders
55
- */function li(t,n){const a=/\$/g,o="$$$$";let r=[t];if(n==null)return r;for(const s of Object.keys(n))if(s!=="_"){let i=n[s];typeof i=="string"&&(i=a[Symbol.replace](i,o)),r=Fb(r,new RegExp(`%\\{${s}\\}`,"g"),i)}return r}const Db=t=>{throw new Error(`missing string: ${t}`)};class di{constructor(n,{onMissingKey:a=Db}={}){Ve(this,Xn);j(this,"locale");Ve(this,jn);this.locale={strings:{},pluralize(o){return o===1?0:1}},Array.isArray(n)?n.forEach(ue(this,Xn,gr),this):ue(this,Xn,gr).call(this,n),Oe(this,jn,a)}translate(n,a){return this.translateArray(n,a).join("")}translateArray(n,a){let o=this.locale.strings[n];if(o==null&&(Z(this,jn).call(this,n),o=n),typeof o=="object"){if(a&&typeof a.smart_count<"u"){const s=this.locale.pluralize(a.smart_count);return li(o[s],a)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof o!="string")throw new Error("string was not a string");return li(o,a)}}jn=new WeakMap,Xn=new WeakSet,gr=function(n){if(!(n!=null&&n.strings))return;const a=this.locale;Object.assign(this.locale,{strings:{...a.strings,...n.strings},pluralize:n.pluralize||a.pluralize})};class Eb{constructor(n,a){j(this,"uppy");j(this,"opts");j(this,"id");j(this,"defaultLocale");j(this,"i18n");j(this,"i18nArray");j(this,"type");j(this,"VERSION");this.uppy=n,this.opts=a??{}}getPluginState(){const{plugins:n}=this.uppy.getState();return(n==null?void 0:n[this.id])||{}}setPluginState(n){const{plugins:a}=this.uppy.getState();this.uppy.setState({plugins:{...a,[this.id]:{...a[this.id],...n}}})}setOptions(n){this.opts={...this.opts,...n},this.setPluginState(void 0),this.i18nInit()}i18nInit(){const n=new di([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=n.translate.bind(n),this.i18nArray=n.translateArray.bind(n),this.setPluginState(void 0)}addTarget(n){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(n){}afterUpdate(){}}class xb{constructor(n){Ve(this,kt);Ve(this,Gn,[]);Oe(this,kt,n)}on(n,a){return Z(this,Gn).push([n,a]),Z(this,kt).on(n,a)}remove(){for(const[n,a]of Z(this,Gn).splice(0))Z(this,kt).off(n,a)}onFilePause(n,a){this.on("upload-pause",(o,r)=>{n===(o==null?void 0:o.id)&&a(r)})}onFileRemove(n,a){this.on("file-removed",o=>{n===o.id&&a(o.id)})}onPause(n,a){this.on("upload-pause",(o,r)=>{n===(o==null?void 0:o.id)&&a(r)})}onRetry(n,a){this.on("upload-retry",o=>{n===(o==null?void 0:o.id)&&a()})}onRetryAll(n,a){this.on("retry-all",()=>{Z(this,kt).getFile(n)&&a()})}onPauseAll(n,a){this.on("pause-all",()=>{Z(this,kt).getFile(n)&&a()})}onCancelAll(n,a){this.on("cancel-all",(...o)=>{Z(this,kt).getFile(n)&&a(...o)})}onResumeAll(n,a){this.on("resume-all",()=>{Z(this,kt).getFile(n)&&a()})}}kt=new WeakMap,Gn=new WeakMap;const Tb={debug:()=>{},warn:()=>{},error:(...t)=>console.error(`[Uppy] [${Pa()}]`,...t)},Nb={debug:(...t)=>console.debug(`[Uppy] [${Pa()}]`,...t),warn:(...t)=>console.warn(`[Uppy] [${Pa()}]`,...t),error:(...t)=>console.error(`[Uppy] [${Pa()}]`,...t)},Ob={version:"5.0.0"};class ci{constructor(){Ve(this,Ta);j(this,"state",{});Ve(this,Cn,new Set)}getState(){return this.state}setState(n){const a={...this.state},o={...this.state,...n};this.state=o,ue(this,Ta,Qi).call(this,a,o,n)}subscribe(n){return Z(this,Cn).add(n),()=>{Z(this,Cn).delete(n)}}}Cn=new WeakMap,Ta=new WeakSet,Qi=function(...n){Z(this,Cn).forEach(a=>{a(...n)})},j(ci,"VERSION",Ob.version);var Va=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fa(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ro,ui;function Qo(){if(ui)return Ro;ui=1;function t(n){var a=typeof n;return n!=null&&(a=="object"||a=="function")}return Ro=t,Ro}var qo,pi;function Mb(){if(pi)return qo;pi=1;var t=typeof Va=="object"&&Va&&Va.Object===Object&&Va;return qo=t,qo}var zo,fi;function mi(){if(fi)return zo;fi=1;var t=Mb(),n=typeof self=="object"&&self&&self.Object===Object&&self,a=t||n||Function("return this")();return zo=a,zo}var Ho,hi;function Ib(){if(hi)return Ho;hi=1;var t=mi(),n=function(){return t.Date.now()};return Ho=n,Ho}var Jo,gi;function Lb(){if(gi)return Jo;gi=1;var t=/\s/;function n(a){for(var o=a.length;o--&&t.test(a.charAt(o)););return o}return Jo=n,Jo}var Yo,yi;function Ub(){if(yi)return Yo;yi=1;var t=Lb(),n=/^\s+/;function a(o){return o&&o.slice(0,t(o)+1).replace(n,"")}return Yo=a,Yo}var Ko,bi;function ki(){if(bi)return Ko;bi=1;var t=mi(),n=t.Symbol;return Ko=n,Ko}var Wo,wi;function Rb(){if(wi)return Wo;wi=1;var t=ki(),n=Object.prototype,a=n.hasOwnProperty,o=n.toString,r=t?t.toStringTag:void 0;function s(i){var l=a.call(i,r),d=i[r];try{i[r]=void 0;var u=!0}catch{}var c=o.call(i);return u&&(l?i[r]=d:delete i[r]),c}return Wo=s,Wo}var jo,Ai;function Qb(){if(Ai)return jo;Ai=1;var t=Object.prototype,n=t.toString;function a(o){return n.call(o)}return jo=a,jo}var Xo,Ci;function qb(){if(Ci)return Xo;Ci=1;var t=ki(),n=Rb(),a=Qb(),o="[object Null]",r="[object Undefined]",s=t?t.toStringTag:void 0;function i(l){return l==null?l===void 0?r:o:s&&s in Object(l)?n(l):a(l)}return Xo=i,Xo}var Go,Si;function zb(){if(Si)return Go;Si=1;function t(n){return n!=null&&typeof n=="object"}return Go=t,Go}var Zo,Bi;function Hb(){if(Bi)return Zo;Bi=1;var t=qb(),n=zb(),a="[object Symbol]";function o(r){return typeof r=="symbol"||n(r)&&t(r)==a}return Zo=o,Zo}var _o,vi;function Jb(){if(vi)return _o;vi=1;var t=Ub(),n=Qo(),a=Hb(),o=NaN,r=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,l=parseInt;function d(u){if(typeof u=="number")return u;if(a(u))return o;if(n(u)){var c=typeof u.valueOf=="function"?u.valueOf():u;u=n(c)?c+"":c}if(typeof u!="string")return u===0?u:+u;u=t(u);var k=s.test(u);return k||i.test(u)?l(u.slice(2),k?2:8):r.test(u)?o:+u}return _o=d,_o}var $o,Pi;function Yb(){if(Pi)return $o;Pi=1;var t=Qo(),n=Ib(),a=Jb(),o="Expected a function",r=Math.max,s=Math.min;function i(l,d,u){var c,k,g,p,y,w,S=0,m=!1,f=!1,h=!0;if(typeof l!="function")throw new TypeError(o);d=a(d)||0,t(u)&&(m=!!u.leading,f="maxWait"in u,g=f?r(a(u.maxWait)||0,d):g,h="trailing"in u?!!u.trailing:h);function B(z){var X=c,K=k;return c=k=void 0,S=z,p=l.apply(K,X),p}function D(z){return S=z,y=setTimeout(F,d),m?B(z):p}function I(z){var X=z-w,K=z-S,_=d-X;return f?s(_,g-K):_}function A(z){var X=z-w,K=z-S;return w===void 0||X>=d||X<0||f&&K>=g}function F(){var z=n();if(A(z))return O(z);y=setTimeout(F,I(z))}function O(z){return y=void 0,h&&c?B(z):(c=k=void 0,p)}function q(){y!==void 0&&clearTimeout(y),S=0,c=w=k=y=void 0}function Y(){return y===void 0?p:O(n())}function H(){var z=n(),X=A(z);if(c=arguments,k=this,w=z,X){if(y===void 0)return D(w);if(f)return clearTimeout(y),y=setTimeout(F,d),B(w)}return y===void 0&&(y=setTimeout(F,d)),p}return H.cancel=q,H.flush=Y,H}return $o=i,$o}var er,Vi;function Kb(){if(Vi)return er;Vi=1;var t=Yb(),n=Qo(),a="Expected a function";function o(r,s,i){var l=!0,d=!0;if(typeof r!="function")throw new TypeError(a);return n(i)&&(l="leading"in i?!!i.leading:l,d="trailing"in i?!!i.trailing:d),t(r,s,{leading:l,maxWait:s,trailing:d})}return er=o,er}var Wb=Kb();const jb=Fa(Wb);var tr,Fi;function Xb(){return Fi||(Fi=1,tr=function(){var n={},a=n._fns={};n.emit=function(i,l,d,u,c,k,g){var p=o(i);p.length&&r(i,p,[l,d,u,c,k,g])},n.on=function(i,l){a[i]||(a[i]=[]),a[i].push(l)},n.once=function(i,l){function d(){l.apply(this,arguments),n.off(i,d)}this.on(i,d)},n.off=function(i,l){var d=[];if(i&&l){var u=this._fns[i],c=0,k=u?u.length:0;for(c;c<k;c++)u[c]!==l&&d.push(u[c])}d.length?this._fns[i]=d:delete this._fns[i]};function o(s){var i=a[s]?a[s]:[],l=s.indexOf(":"),d=l===-1?[s]:[s.substring(0,l),s.substring(l+1)],u=Object.keys(a),c=0,k=u.length;for(c;c<k;c++){var g=u[c];if(g==="*"&&(i=i.concat(a[g])),d.length===2&&d[0]===g){i=i.concat(a[g]);break}}return i}function r(s,i,l){var d=0,u=i.length;for(d;d<u&&i[d];d++)i[d].event=s,i[d].apply(i[d],l)}return n}),tr}var Gb=Xb();const Zb=Fa(Gb);let _b="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",$b=(t=21)=>{let n="",a=t|0;for(;a--;)n+=_b[Math.random()*64|0];return n};const ek={version:"5.0.1"};function tk(t,n){return n.name?n.name:t.split("/")[0]==="image"?`${t.split("/")[0]}.${t.split("/")[1]}`:"noname"}const nk={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};var nr,Di;function ak(){return Di||(Di=1,nr=function(n){if(typeof n!="number"||Number.isNaN(n))throw new TypeError(`Expected a number, got ${typeof n}`);const a=n<0;let o=Math.abs(n);if(a&&(o=-o),o===0)return"0 B";const r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],s=Math.min(Math.floor(Math.log(o)/Math.log(1024)),r.length-1),i=Number(o/1024**s),l=r[s];return`${i>=10||i%1===0?Math.round(i):i.toFixed(1)} ${l}`}),nr}var ok=ak();const Da=Fa(ok);var ar,Ei;function rk(){if(Ei)return ar;Ei=1;function t(n,a){this.text=n=n||"",this.hasWild=~n.indexOf("*"),this.separator=a,this.parts=n.split(a)}return t.prototype.match=function(n){var a=!0,o=this.parts,r,s=o.length,i;if(typeof n=="string"||n instanceof String)if(!this.hasWild&&this.text!=n)a=!1;else{for(i=(n||"").split(this.separator),r=0;a&&r<s;r++)o[r]!=="*"&&(r<i.length?a=o[r]===i[r]:a=!1);a=a&&i}else if(typeof n.splice=="function")for(a=[],r=n.length;r--;)this.match(n[r])&&(a[a.length]=n[r]);else if(typeof n=="object"){a={};for(var l in n)this.match(l)&&(a[l]=n[l])}return a},ar=function(n,a,o){var r=new t(n,o||/[\/\.]/);return typeof a<"u"?r.match(a):r},ar}var or,xi;function sk(){if(xi)return or;xi=1;var t=rk(),n=/[\/\+\.]/;return or=function(a,o){function r(s){var i=t(s,a,n);return i&&i.length>=2}return o?r(o.split(";")[0]):r},or}var ik=sk();const lk=Fa(ik),dk={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class rt extends Error{constructor(a,o){super(a);j(this,"isUserFacing");j(this,"file");j(this,"isRestriction",!0);this.isUserFacing=(o==null?void 0:o.isUserFacing)??!0,o!=null&&o.file&&(this.file=o.file)}}class ck{constructor(n,a){j(this,"getI18n");j(this,"getOpts");this.getI18n=a,this.getOpts=()=>{var r;const o=n();if(((r=o.restrictions)==null?void 0:r.allowedFileTypes)!=null&&!Array.isArray(o.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return o}}validateAggregateRestrictions(n,a){const{maxTotalFileSize:o,maxNumberOfFiles:r}=this.getOpts().restrictions;if(r&&n.filter(i=>!i.isGhost).length+a.length>r)throw new rt(`${this.getI18n()("youCanOnlyUploadX",{smart_count:r})}`);if(o){const s=[...n,...a].reduce((i,l)=>i+(l.size??0),0);if(s>o)throw new rt(this.getI18n()("aggregateExceedsSize",{sizeAllowed:Da(o),size:Da(s)}))}}validateSingleFile(n){const{maxFileSize:a,minFileSize:o,allowedFileTypes:r}=this.getOpts().restrictions;if(r&&!r.some(i=>i.includes("/")?n.type?lk(n.type.replace(/;.*?$/,""),i):!1:i[0]==="."&&n.extension?n.extension.toLowerCase()===i.slice(1).toLowerCase():!1)){const i=r.join(", ");throw new rt(this.getI18n()("youCanOnlyUploadFileTypes",{types:i}),{file:n})}if(a&&n.size!=null&&n.size>a)throw new rt(this.getI18n()("exceedsSize",{size:Da(a),file:n.name??this.getI18n()("unnamed")}),{file:n});if(o&&n.size!=null&&n.size<o)throw new rt(this.getI18n()("inferiorSize",{size:Da(o)}),{file:n})}validate(n,a){a.forEach(o=>{this.validateSingleFile(o)}),this.validateAggregateRestrictions(n,a)}validateMinNumberOfFiles(n){const{minNumberOfFiles:a}=this.getOpts().restrictions;if(a&&Object.keys(n).length<a)throw new rt(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:a}))}getMissingRequiredMetaFields(n){const a=new rt(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:n.name??this.getI18n()("unnamed")})),{requiredMetaFields:o}=this.getOpts().restrictions,r=[];for(const s of o)(!Object.hasOwn(n.meta,s)||n.meta[s]==="")&&r.push(s);return{missingFields:r,error:a}}}function uk(t){if(t==null&&typeof navigator<"u"&&(t=navigator.userAgent),!t)return!0;const n=/Edge\/(\d+\.\d+)/.exec(t);if(!n)return!0;const o=n[1].split(".",2),r=parseInt(o[0],10),s=parseInt(o[1],10);return r<15||r===15&&s<15063||r>18||r===18&&s>=18218}const Ea={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},Oa=class Oa{constructor(n){Ve(this,ce);Ve(this,st,Object.create(null));Ve(this,it);Ve(this,Zn);Ve(this,Gt,Zb());Ve(this,Sn,new Set);Ve(this,Bn,new Set);Ve(this,Zt,new Set);j(this,"defaultLocale");j(this,"locale");j(this,"opts");j(this,"store");j(this,"i18n");j(this,"i18nArray");j(this,"scheduledAutoProceed",null);j(this,"wasOffline",!1);Ve(this,Na,(n,a)=>{const o=n?this.getFile(n.id):void 0;if(n==null||!o){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}if(o.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${n.id}`);return}const r={bytesTotal:a.bytesTotal,percentage:a.bytesTotal!=null&&Number.isFinite(a.bytesTotal)&&a.bytesTotal>0?Math.round(a.bytesUploaded/a.bytesTotal*100):void 0};o.progress.uploadStarted!=null?this.setFileState(n.id,{progress:{...o.progress,...r,bytesUploaded:a.bytesUploaded}}):this.setFileState(n.id,{progress:{...o.progress,...r}}),Z(this,_t).call(this)});Ve(this,_t,jb(()=>ue(this,ce,Sr).call(this),500,{leading:!0,trailing:!0}));Ve(this,Ot,this.updateOnlineStatus.bind(this));Ve(this,_n,new Map);this.defaultLocale=nk;const a={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:dk,meta:{},onBeforeFileAdded:(r,s)=>!Object.hasOwn(s,r.id),onBeforeUpload:r=>r,store:new ci,logger:Tb,infoTimeout:5e3},o={...a,...n};this.opts={...o,restrictions:{...a.restrictions,...n==null?void 0:n.restrictions}},n!=null&&n.logger&&n.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"):n!=null&&n.debug&&(this.opts.logger=Nb),this.log(`Using Core v${Oa.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...Ea,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:uk(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),Oe(this,it,new ck(()=>this.opts,()=>this.i18n)),Oe(this,Zn,this.store.subscribe((r,s,i)=>{this.emit("state-update",r,s,i),this.updateAll(s)})),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),ue(this,ce,Ji).call(this)}emit(n,...a){Z(this,Gt).emit(n,...a)}on(n,a){return Z(this,Gt).on(n,a),this}once(n,a){return Z(this,Gt).once(n,a),this}off(n,a){return Z(this,Gt).off(n,a),this}updateAll(n){this.iteratePlugins(a=>{a.update(n)})}setState(n){this.store.setState(n)}getState(){return this.store.getState()}patchFilesState(n){const a=this.getState().files;this.setState({files:{...a,...Object.fromEntries(Object.entries(n).map(([o,r])=>[o,{...a[o],...r}]))}})}setFileState(n,a){if(!this.getState().files[n])throw new Error(`Can’t set state for ${n} (the file could have been removed)`);this.patchFilesState({[n]:a})}i18nInit(){const n=o=>this.log(`Missing i18n string: ${o}`,"error"),a=new di([this.defaultLocale,this.opts.locale],{onMissingKey:n});this.i18n=a.translate.bind(a),this.i18nArray=a.translateArray.bind(a),this.locale=a.locale}setOptions(n){this.opts={...this.opts,...n,restrictions:{...this.opts.restrictions,...n==null?void 0:n.restrictions}},n.meta&&this.setMeta(n.meta),this.i18nInit(),n.locale&&this.iteratePlugins(a=>{a.setOptions(n)}),this.setState(void 0)}resetProgress(){const n={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},a={...this.getState().files},o=Object.create(null);Object.keys(a).forEach(r=>{o[r]={...a[r],progress:{...a[r].progress,...n},tus:void 0,transloadit:void 0}}),this.setState({files:o,...Ea})}clear(){const{capabilities:n,currentUploads:a}=this.getState();if(Object.keys(a).length>0&&!n.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...Ea,files:{}})}addPreProcessor(n){Z(this,Sn).add(n)}removePreProcessor(n){return Z(this,Sn).delete(n)}addPostProcessor(n){Z(this,Zt).add(n)}removePostProcessor(n){return Z(this,Zt).delete(n)}addUploader(n){Z(this,Bn).add(n)}removeUploader(n){return Z(this,Bn).delete(n)}setMeta(n){const a={...this.getState().meta,...n},o={...this.getState().files};Object.keys(o).forEach(r=>{o[r]={...o[r],meta:{...o[r].meta,...n}}}),this.log("Adding metadata:"),this.log(n),this.setState({meta:a,files:o})}setFileMeta(n,a){const o={...this.getState().files};if(!o[n]){this.log(`Was trying to set metadata for a file that has been removed: ${n}`);return}const r={...o[n].meta,...a};o[n]={...o[n],meta:r},this.setState({files:o})}getFile(n){return this.getState().files[n]}getFiles(){const{files:n}=this.getState();return Object.values(n)}getFilesByIds(n){return n.map(a=>this.getFile(a))}getObjectOfFilesPerState(){const{files:n,totalProgress:a,error:o}=this.getState(),r=Object.values(n),s=[],i=[],l=[],d=[],u=[],c=[],k=[],g=[],p=[];for(const y of r){const{progress:w}=y;!w.uploadComplete&&w.uploadStarted&&(s.push(y),y.isPaused||g.push(y)),w.uploadStarted||i.push(y),(w.uploadStarted||w.preprocess||w.postprocess)&&l.push(y),w.uploadStarted&&d.push(y),y.isPaused&&u.push(y),w.uploadComplete&&c.push(y),y.error&&k.push(y),(w.preprocess||w.postprocess)&&p.push(y)}return{newFiles:i,startedFiles:l,uploadStartedFiles:d,pausedFiles:u,completeFiles:c,erroredFiles:k,inProgressFiles:s,inProgressNotPausedFiles:g,processingFiles:p,isUploadStarted:d.length>0,isAllComplete:a===100&&c.length===r.length&&p.length===0,isAllErrored:!!o&&k.length===r.length,isAllPaused:s.length!==0&&u.length===s.length,isUploadInProgress:s.length>0,isSomeGhost:r.some(y=>y.isGhost)}}validateRestrictions(n,a=this.getFiles()){try{Z(this,it).validate(a,[n])}catch(o){return o}return null}validateSingleFile(n){try{Z(this,it).validateSingleFile(n)}catch(a){return a.message}return null}validateAggregateRestrictions(n){const a=this.getFiles();try{Z(this,it).validateAggregateRestrictions(a,n)}catch(o){return o.message}return null}checkIfFileAlreadyExists(n){const{files:a}=this.getState();return!!(a[n]&&!a[n].isGhost)}addFile(n){ue(this,ce,br).call(this,n);const{nextFilesState:a,validFilesToAdd:o,errors:r}=ue(this,ce,wr).call(this,[n]),s=r.filter(l=>l.isRestriction);if(ue(this,ce,en).call(this,s),r.length>0)throw r[0];this.setState({files:a});const[i]=o;return this.emit("file-added",i),this.emit("files-added",o),this.log(`Added file: ${i.name}, ${i.id}, mime type: ${i.type}`),ue(this,ce,kr).call(this),i.id}addFiles(n){ue(this,ce,br).call(this);const{nextFilesState:a,validFilesToAdd:o,errors:r}=ue(this,ce,wr).call(this,n),s=r.filter(l=>l.isRestriction);ue(this,ce,en).call(this,s);const i=r.filter(l=>!l.isRestriction);if(i.length>0){let l=`Multiple errors occurred while adding files:
55
+ */function li(t,n){const a=/\$/g,o="$$$$";let r=[t];if(n==null)return r;for(const s of Object.keys(n))if(s!=="_"){let i=n[s];typeof i=="string"&&(i=a[Symbol.replace](i,o)),r=Fb(r,new RegExp(`%\\{${s}\\}`,"g"),i)}return r}const Db=t=>{throw new Error(`missing string: ${t}`)};class di{constructor(n,{onMissingKey:a=Db}={}){Ve(this,Xn);j(this,"locale");Ve(this,jn);this.locale={strings:{},pluralize(o){return o===1?0:1}},Array.isArray(n)?n.forEach(ue(this,Xn,gr),this):ue(this,Xn,gr).call(this,n),Oe(this,jn,a)}translate(n,a){return this.translateArray(n,a).join("")}translateArray(n,a){let o=this.locale.strings[n];if(o==null&&(Z(this,jn).call(this,n),o=n),typeof o=="object"){if(a&&typeof a.smart_count<"u"){const s=this.locale.pluralize(a.smart_count);return li(o[s],a)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof o!="string")throw new Error("string was not a string");return li(o,a)}}jn=new WeakMap,Xn=new WeakSet,gr=function(n){if(!(n!=null&&n.strings))return;const a=this.locale;Object.assign(this.locale,{strings:{...a.strings,...n.strings},pluralize:n.pluralize||a.pluralize})};class Eb{constructor(n,a){j(this,"uppy");j(this,"opts");j(this,"id");j(this,"defaultLocale");j(this,"i18n");j(this,"i18nArray");j(this,"type");j(this,"VERSION");this.uppy=n,this.opts=a??{}}getPluginState(){const{plugins:n}=this.uppy.getState();return(n==null?void 0:n[this.id])||{}}setPluginState(n){const{plugins:a}=this.uppy.getState();this.uppy.setState({plugins:{...a,[this.id]:{...a[this.id],...n}}})}setOptions(n){this.opts={...this.opts,...n},this.setPluginState(void 0),this.i18nInit()}i18nInit(){const n=new di([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=n.translate.bind(n),this.i18nArray=n.translateArray.bind(n),this.setPluginState(void 0)}addTarget(n){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(n){}afterUpdate(){}}class xb{constructor(n){Ve(this,kt);Ve(this,Gn,[]);Oe(this,kt,n)}on(n,a){return Z(this,Gn).push([n,a]),Z(this,kt).on(n,a)}remove(){for(const[n,a]of Z(this,Gn).splice(0))Z(this,kt).off(n,a)}onFilePause(n,a){this.on("upload-pause",(o,r)=>{n===(o==null?void 0:o.id)&&a(r)})}onFileRemove(n,a){this.on("file-removed",o=>{n===o.id&&a(o.id)})}onPause(n,a){this.on("upload-pause",(o,r)=>{n===(o==null?void 0:o.id)&&a(r)})}onRetry(n,a){this.on("upload-retry",o=>{n===(o==null?void 0:o.id)&&a()})}onRetryAll(n,a){this.on("retry-all",()=>{Z(this,kt).getFile(n)&&a()})}onPauseAll(n,a){this.on("pause-all",()=>{Z(this,kt).getFile(n)&&a()})}onCancelAll(n,a){this.on("cancel-all",(...o)=>{Z(this,kt).getFile(n)&&a(...o)})}onResumeAll(n,a){this.on("resume-all",()=>{Z(this,kt).getFile(n)&&a()})}}kt=new WeakMap,Gn=new WeakMap;const Tb={debug:()=>{},warn:()=>{},error:(...t)=>console.error(`[Uppy] [${Pa()}]`,...t)},Nb={debug:(...t)=>console.debug(`[Uppy] [${Pa()}]`,...t),warn:(...t)=>console.warn(`[Uppy] [${Pa()}]`,...t),error:(...t)=>console.error(`[Uppy] [${Pa()}]`,...t)},Ob={version:"5.0.0"};class ci{constructor(){Ve(this,Ta);j(this,"state",{});Ve(this,Cn,new Set)}getState(){return this.state}setState(n){const a={...this.state},o={...this.state,...n};this.state=o,ue(this,Ta,Qi).call(this,a,o,n)}subscribe(n){return Z(this,Cn).add(n),()=>{Z(this,Cn).delete(n)}}}Cn=new WeakMap,Ta=new WeakSet,Qi=function(...n){Z(this,Cn).forEach(a=>{a(...n)})},j(ci,"VERSION",Ob.version);var Va=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fa(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ro,ui;function Qo(){if(ui)return Ro;ui=1;function t(n){var a=typeof n;return n!=null&&(a=="object"||a=="function")}return Ro=t,Ro}var qo,pi;function Mb(){if(pi)return qo;pi=1;var t=typeof Va=="object"&&Va&&Va.Object===Object&&Va;return qo=t,qo}var zo,fi;function mi(){if(fi)return zo;fi=1;var t=Mb(),n=typeof self=="object"&&self&&self.Object===Object&&self,a=t||n||Function("return this")();return zo=a,zo}var Ho,hi;function Ib(){if(hi)return Ho;hi=1;var t=mi(),n=function(){return t.Date.now()};return Ho=n,Ho}var Jo,gi;function Lb(){if(gi)return Jo;gi=1;var t=/\s/;function n(a){for(var o=a.length;o--&&t.test(a.charAt(o)););return o}return Jo=n,Jo}var Yo,yi;function Ub(){if(yi)return Yo;yi=1;var t=Lb(),n=/^\s+/;function a(o){return o&&o.slice(0,t(o)+1).replace(n,"")}return Yo=a,Yo}var Ko,bi;function ki(){if(bi)return Ko;bi=1;var t=mi(),n=t.Symbol;return Ko=n,Ko}var Wo,wi;function Rb(){if(wi)return Wo;wi=1;var t=ki(),n=Object.prototype,a=n.hasOwnProperty,o=n.toString,r=t?t.toStringTag:void 0;function s(i){var l=a.call(i,r),d=i[r];try{i[r]=void 0;var u=!0}catch{}var c=o.call(i);return u&&(l?i[r]=d:delete i[r]),c}return Wo=s,Wo}var jo,Ai;function Qb(){if(Ai)return jo;Ai=1;var t=Object.prototype,n=t.toString;function a(o){return n.call(o)}return jo=a,jo}var Xo,Ci;function qb(){if(Ci)return Xo;Ci=1;var t=ki(),n=Rb(),a=Qb(),o="[object Null]",r="[object Undefined]",s=t?t.toStringTag:void 0;function i(l){return l==null?l===void 0?r:o:s&&s in Object(l)?n(l):a(l)}return Xo=i,Xo}var Go,Si;function zb(){if(Si)return Go;Si=1;function t(n){return n!=null&&typeof n=="object"}return Go=t,Go}var Zo,Bi;function Hb(){if(Bi)return Zo;Bi=1;var t=qb(),n=zb(),a="[object Symbol]";function o(r){return typeof r=="symbol"||n(r)&&t(r)==a}return Zo=o,Zo}var _o,vi;function Jb(){if(vi)return _o;vi=1;var t=Ub(),n=Qo(),a=Hb(),o=NaN,r=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,l=parseInt;function d(u){if(typeof u=="number")return u;if(a(u))return o;if(n(u)){var c=typeof u.valueOf=="function"?u.valueOf():u;u=n(c)?c+"":c}if(typeof u!="string")return u===0?u:+u;u=t(u);var k=s.test(u);return k||i.test(u)?l(u.slice(2),k?2:8):r.test(u)?o:+u}return _o=d,_o}var $o,Pi;function Yb(){if(Pi)return $o;Pi=1;var t=Qo(),n=Ib(),a=Jb(),o="Expected a function",r=Math.max,s=Math.min;function i(l,d,u){var c,k,g,p,y,w,S=0,m=!1,f=!1,h=!0;if(typeof l!="function")throw new TypeError(o);d=a(d)||0,t(u)&&(m=!!u.leading,f="maxWait"in u,g=f?r(a(u.maxWait)||0,d):g,h="trailing"in u?!!u.trailing:h);function B(z){var X=c,K=k;return c=k=void 0,S=z,p=l.apply(K,X),p}function D(z){return S=z,y=setTimeout(F,d),m?B(z):p}function I(z){var X=z-w,K=z-S,_=d-X;return f?s(_,g-K):_}function A(z){var X=z-w,K=z-S;return w===void 0||X>=d||X<0||f&&K>=g}function F(){var z=n();if(A(z))return O(z);y=setTimeout(F,I(z))}function O(z){return y=void 0,h&&c?B(z):(c=k=void 0,p)}function q(){y!==void 0&&clearTimeout(y),S=0,c=w=k=y=void 0}function Y(){return y===void 0?p:O(n())}function H(){var z=n(),X=A(z);if(c=arguments,k=this,w=z,X){if(y===void 0)return D(w);if(f)return clearTimeout(y),y=setTimeout(F,d),B(w)}return y===void 0&&(y=setTimeout(F,d)),p}return H.cancel=q,H.flush=Y,H}return $o=i,$o}var er,Vi;function Kb(){if(Vi)return er;Vi=1;var t=Yb(),n=Qo(),a="Expected a function";function o(r,s,i){var l=!0,d=!0;if(typeof r!="function")throw new TypeError(a);return n(i)&&(l="leading"in i?!!i.leading:l,d="trailing"in i?!!i.trailing:d),t(r,s,{leading:l,maxWait:s,trailing:d})}return er=o,er}var Wb=Kb();const jb=Fa(Wb);var tr,Fi;function Xb(){return Fi||(Fi=1,tr=function(){var n={},a=n._fns={};n.emit=function(i,l,d,u,c,k,g){var p=o(i);p.length&&r(i,p,[l,d,u,c,k,g])},n.on=function(i,l){a[i]||(a[i]=[]),a[i].push(l)},n.once=function(i,l){function d(){l.apply(this,arguments),n.off(i,d)}this.on(i,d)},n.off=function(i,l){var d=[];if(i&&l){var u=this._fns[i],c=0,k=u?u.length:0;for(c;c<k;c++)u[c]!==l&&d.push(u[c])}d.length?this._fns[i]=d:delete this._fns[i]};function o(s){var i=a[s]?a[s]:[],l=s.indexOf(":"),d=l===-1?[s]:[s.substring(0,l),s.substring(l+1)],u=Object.keys(a),c=0,k=u.length;for(c;c<k;c++){var g=u[c];if(g==="*"&&(i=i.concat(a[g])),d.length===2&&d[0]===g){i=i.concat(a[g]);break}}return i}function r(s,i,l){var d=0,u=i.length;for(d;d<u&&i[d];d++)i[d].event=s,i[d].apply(i[d],l)}return n}),tr}var Gb=Xb();const Zb=Fa(Gb);let _b="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",$b=(t=21)=>{let n="",a=t|0;for(;a-- >0;)n+=_b[Math.random()*64|0];return n};const ek={version:"5.0.1"};function tk(t,n){return n.name?n.name:t.split("/")[0]==="image"?`${t.split("/")[0]}.${t.split("/")[1]}`:"noname"}const nk={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};var nr,Di;function ak(){return Di||(Di=1,nr=function(n){if(typeof n!="number"||Number.isNaN(n))throw new TypeError(`Expected a number, got ${typeof n}`);const a=n<0;let o=Math.abs(n);if(a&&(o=-o),o===0)return"0 B";const r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],s=Math.min(Math.floor(Math.log(o)/Math.log(1024)),r.length-1),i=Number(o/1024**s),l=r[s];return`${i>=10||i%1===0?Math.round(i):i.toFixed(1)} ${l}`}),nr}var ok=ak();const Da=Fa(ok);var ar,Ei;function rk(){if(Ei)return ar;Ei=1;function t(n,a){this.text=n=n||"",this.hasWild=~n.indexOf("*"),this.separator=a,this.parts=n.split(a)}return t.prototype.match=function(n){var a=!0,o=this.parts,r,s=o.length,i;if(typeof n=="string"||n instanceof String)if(!this.hasWild&&this.text!=n)a=!1;else{for(i=(n||"").split(this.separator),r=0;a&&r<s;r++)o[r]!=="*"&&(r<i.length?a=o[r]===i[r]:a=!1);a=a&&i}else if(typeof n.splice=="function")for(a=[],r=n.length;r--;)this.match(n[r])&&(a[a.length]=n[r]);else if(typeof n=="object"){a={};for(var l in n)this.match(l)&&(a[l]=n[l])}return a},ar=function(n,a,o){var r=new t(n,o||/[\/\.]/);return typeof a<"u"?r.match(a):r},ar}var or,xi;function sk(){if(xi)return or;xi=1;var t=rk(),n=/[\/\+\.]/;return or=function(a,o){function r(s){var i=t(s,a,n);return i&&i.length>=2}return o?r(o.split(";")[0]):r},or}var ik=sk();const lk=Fa(ik),dk={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class rt extends Error{constructor(a,o){super(a);j(this,"isUserFacing");j(this,"file");j(this,"isRestriction",!0);this.isUserFacing=(o==null?void 0:o.isUserFacing)??!0,o!=null&&o.file&&(this.file=o.file)}}class ck{constructor(n,a){j(this,"getI18n");j(this,"getOpts");this.getI18n=a,this.getOpts=()=>{var r;const o=n();if(((r=o.restrictions)==null?void 0:r.allowedFileTypes)!=null&&!Array.isArray(o.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return o}}validateAggregateRestrictions(n,a){const{maxTotalFileSize:o,maxNumberOfFiles:r}=this.getOpts().restrictions;if(r&&n.filter(i=>!i.isGhost).length+a.length>r)throw new rt(`${this.getI18n()("youCanOnlyUploadX",{smart_count:r})}`);if(o){const s=[...n,...a].reduce((i,l)=>i+(l.size??0),0);if(s>o)throw new rt(this.getI18n()("aggregateExceedsSize",{sizeAllowed:Da(o),size:Da(s)}))}}validateSingleFile(n){const{maxFileSize:a,minFileSize:o,allowedFileTypes:r}=this.getOpts().restrictions;if(r&&!r.some(i=>i.includes("/")?n.type?lk(n.type.replace(/;.*?$/,""),i):!1:i[0]==="."&&n.extension?n.extension.toLowerCase()===i.slice(1).toLowerCase():!1)){const i=r.join(", ");throw new rt(this.getI18n()("youCanOnlyUploadFileTypes",{types:i}),{file:n})}if(a&&n.size!=null&&n.size>a)throw new rt(this.getI18n()("exceedsSize",{size:Da(a),file:n.name??this.getI18n()("unnamed")}),{file:n});if(o&&n.size!=null&&n.size<o)throw new rt(this.getI18n()("inferiorSize",{size:Da(o)}),{file:n})}validate(n,a){a.forEach(o=>{this.validateSingleFile(o)}),this.validateAggregateRestrictions(n,a)}validateMinNumberOfFiles(n){const{minNumberOfFiles:a}=this.getOpts().restrictions;if(a&&Object.keys(n).length<a)throw new rt(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:a}))}getMissingRequiredMetaFields(n){const a=new rt(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:n.name??this.getI18n()("unnamed")})),{requiredMetaFields:o}=this.getOpts().restrictions,r=[];for(const s of o)(!Object.hasOwn(n.meta,s)||n.meta[s]==="")&&r.push(s);return{missingFields:r,error:a}}}function uk(t){if(t==null&&typeof navigator<"u"&&(t=navigator.userAgent),!t)return!0;const n=/Edge\/(\d+\.\d+)/.exec(t);if(!n)return!0;const o=n[1].split(".",2),r=parseInt(o[0],10),s=parseInt(o[1],10);return r<15||r===15&&s<15063||r>18||r===18&&s>=18218}const Ea={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},Oa=class Oa{constructor(n){Ve(this,ce);Ve(this,st,Object.create(null));Ve(this,it);Ve(this,Zn);Ve(this,Gt,Zb());Ve(this,Sn,new Set);Ve(this,Bn,new Set);Ve(this,Zt,new Set);j(this,"defaultLocale");j(this,"locale");j(this,"opts");j(this,"store");j(this,"i18n");j(this,"i18nArray");j(this,"scheduledAutoProceed",null);j(this,"wasOffline",!1);Ve(this,Na,(n,a)=>{const o=n?this.getFile(n.id):void 0;if(n==null||!o){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}if(o.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${n.id}`);return}const r={bytesTotal:a.bytesTotal,percentage:a.bytesTotal!=null&&Number.isFinite(a.bytesTotal)&&a.bytesTotal>0?Math.round(a.bytesUploaded/a.bytesTotal*100):void 0};o.progress.uploadStarted!=null?this.setFileState(n.id,{progress:{...o.progress,...r,bytesUploaded:a.bytesUploaded}}):this.setFileState(n.id,{progress:{...o.progress,...r}}),Z(this,_t).call(this)});Ve(this,_t,jb(()=>ue(this,ce,Sr).call(this),500,{leading:!0,trailing:!0}));Ve(this,Ot,this.updateOnlineStatus.bind(this));Ve(this,_n,new Map);this.defaultLocale=nk;const a={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:dk,meta:{},onBeforeFileAdded:(r,s)=>!Object.hasOwn(s,r.id),onBeforeUpload:r=>r,store:new ci,logger:Tb,infoTimeout:5e3},o={...a,...n};this.opts={...o,restrictions:{...a.restrictions,...n==null?void 0:n.restrictions}},n!=null&&n.logger&&n.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"):n!=null&&n.debug&&(this.opts.logger=Nb),this.log(`Using Core v${Oa.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...Ea,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:uk(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),Oe(this,it,new ck(()=>this.opts,()=>this.i18n)),Oe(this,Zn,this.store.subscribe((r,s,i)=>{this.emit("state-update",r,s,i),this.updateAll(s)})),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),ue(this,ce,Ji).call(this)}emit(n,...a){Z(this,Gt).emit(n,...a)}on(n,a){return Z(this,Gt).on(n,a),this}once(n,a){return Z(this,Gt).once(n,a),this}off(n,a){return Z(this,Gt).off(n,a),this}updateAll(n){this.iteratePlugins(a=>{a.update(n)})}setState(n){this.store.setState(n)}getState(){return this.store.getState()}patchFilesState(n){const a=this.getState().files;this.setState({files:{...a,...Object.fromEntries(Object.entries(n).map(([o,r])=>[o,{...a[o],...r}]))}})}setFileState(n,a){if(!this.getState().files[n])throw new Error(`Can’t set state for ${n} (the file could have been removed)`);this.patchFilesState({[n]:a})}i18nInit(){const n=o=>this.log(`Missing i18n string: ${o}`,"error"),a=new di([this.defaultLocale,this.opts.locale],{onMissingKey:n});this.i18n=a.translate.bind(a),this.i18nArray=a.translateArray.bind(a),this.locale=a.locale}setOptions(n){this.opts={...this.opts,...n,restrictions:{...this.opts.restrictions,...n==null?void 0:n.restrictions}},n.meta&&this.setMeta(n.meta),this.i18nInit(),n.locale&&this.iteratePlugins(a=>{a.setOptions(n)}),this.setState(void 0)}resetProgress(){const n={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},a={...this.getState().files},o=Object.create(null);Object.keys(a).forEach(r=>{o[r]={...a[r],progress:{...a[r].progress,...n},tus:void 0,transloadit:void 0}}),this.setState({files:o,...Ea})}clear(){const{capabilities:n,currentUploads:a}=this.getState();if(Object.keys(a).length>0&&!n.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...Ea,files:{}})}addPreProcessor(n){Z(this,Sn).add(n)}removePreProcessor(n){return Z(this,Sn).delete(n)}addPostProcessor(n){Z(this,Zt).add(n)}removePostProcessor(n){return Z(this,Zt).delete(n)}addUploader(n){Z(this,Bn).add(n)}removeUploader(n){return Z(this,Bn).delete(n)}setMeta(n){const a={...this.getState().meta,...n},o={...this.getState().files};Object.keys(o).forEach(r=>{o[r]={...o[r],meta:{...o[r].meta,...n}}}),this.log("Adding metadata:"),this.log(n),this.setState({meta:a,files:o})}setFileMeta(n,a){const o={...this.getState().files};if(!o[n]){this.log(`Was trying to set metadata for a file that has been removed: ${n}`);return}const r={...o[n].meta,...a};o[n]={...o[n],meta:r},this.setState({files:o})}getFile(n){return this.getState().files[n]}getFiles(){const{files:n}=this.getState();return Object.values(n)}getFilesByIds(n){return n.map(a=>this.getFile(a))}getObjectOfFilesPerState(){const{files:n,totalProgress:a,error:o}=this.getState(),r=Object.values(n),s=[],i=[],l=[],d=[],u=[],c=[],k=[],g=[],p=[];for(const y of r){const{progress:w}=y;!w.uploadComplete&&w.uploadStarted&&(s.push(y),y.isPaused||g.push(y)),w.uploadStarted||i.push(y),(w.uploadStarted||w.preprocess||w.postprocess)&&l.push(y),w.uploadStarted&&d.push(y),y.isPaused&&u.push(y),w.uploadComplete&&c.push(y),y.error&&k.push(y),(w.preprocess||w.postprocess)&&p.push(y)}return{newFiles:i,startedFiles:l,uploadStartedFiles:d,pausedFiles:u,completeFiles:c,erroredFiles:k,inProgressFiles:s,inProgressNotPausedFiles:g,processingFiles:p,isUploadStarted:d.length>0,isAllComplete:a===100&&c.length===r.length&&p.length===0,isAllErrored:!!o&&k.length===r.length,isAllPaused:s.length!==0&&u.length===s.length,isUploadInProgress:s.length>0,isSomeGhost:r.some(y=>y.isGhost)}}validateRestrictions(n,a=this.getFiles()){try{Z(this,it).validate(a,[n])}catch(o){return o}return null}validateSingleFile(n){try{Z(this,it).validateSingleFile(n)}catch(a){return a.message}return null}validateAggregateRestrictions(n){const a=this.getFiles();try{Z(this,it).validateAggregateRestrictions(a,n)}catch(o){return o.message}return null}checkIfFileAlreadyExists(n){const{files:a}=this.getState();return!!(a[n]&&!a[n].isGhost)}addFile(n){ue(this,ce,br).call(this,n);const{nextFilesState:a,validFilesToAdd:o,errors:r}=ue(this,ce,wr).call(this,[n]),s=r.filter(l=>l.isRestriction);if(ue(this,ce,en).call(this,s),r.length>0)throw r[0];this.setState({files:a});const[i]=o;return this.emit("file-added",i),this.emit("files-added",o),this.log(`Added file: ${i.name}, ${i.id}, mime type: ${i.type}`),ue(this,ce,kr).call(this),i.id}addFiles(n){ue(this,ce,br).call(this);const{nextFilesState:a,validFilesToAdd:o,errors:r}=ue(this,ce,wr).call(this,n),s=r.filter(l=>l.isRestriction);ue(this,ce,en).call(this,s);const i=r.filter(l=>!l.isRestriction);if(i.length>0){let l=`Multiple errors occurred while adding files:
56
56
  `;if(i.forEach(d=>{l+=`
57
57
  * ${d.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:i.length}),details:l},"error",this.opts.infoTimeout),typeof AggregateError=="function")throw new AggregateError(i,l);{const d=new Error(l);throw d.errors=i,d}}this.setState({files:a}),o.forEach(l=>{this.emit("file-added",l)}),this.emit("files-added",o),o.length>5?this.log(`Added batch of ${o.length} files`):Object.values(o).forEach(l=>{this.log(`Added file: ${l.name}
58
58
  id: ${l.id}
package/package.json CHANGED
@@ -65,6 +65,9 @@
65
65
  "@uppy/core": "5.0.1",
66
66
  "@uppy/xhr-upload": "5.0.0"
67
67
  },
68
+ "overrides": {
69
+ "lodash": "4.18.0"
70
+ },
68
71
  "devDependencies": {
69
72
  "@fullhuman/postcss-purgecss": "5.0.0",
70
73
  "@rushstack/eslint-patch": "1.12.0",
@@ -118,5 +121,5 @@
118
121
  "vue-country-flag-next": "2.3.2",
119
122
  "vue-tsc": "1.8.27"
120
123
  },
121
- "version": "0.3.23"
124
+ "version": "0.3.24"
122
125
  }