import{b as j,A as dr}from"./Cu5ilWky.js";class ne extends Error{cause;isNetworkError;request;constructor(t,e=null){super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=t,this.isNetworkError=!0,this.request=e}}class ur{#t;#e=!1;#r;#i;constructor(t,e){this.#i=t,this.#r=()=>e(t)}progress(){this.#e||this.#i>0&&(clearTimeout(this.#t),this.#t=setTimeout(this.#r,this.#i))}done(){this.#e||(clearTimeout(this.#t),this.#t=void 0,this.#e=!0)}}const vt=()=>{};function pr(r,t={}){const{body:e=null,headers:i={},method:s="GET",onBeforeRequest:a=vt,onUploadProgress:n=vt,shouldRetry:o=()=>!0,onAfterResponse:c=vt,onTimeout:l=vt,responseType:d,retries:h=3,signal:u=null,timeout:p=3e4,withCredentials:g=!1}=t,y=m=>.3*2**(m-1)*1e3,v=new ur(p,l);function b(m=0){return new Promise(async(E,R)=>{const w=new XMLHttpRequest,f=x=>{o(w)&&m{b(m+1).then(E,R)},y(m)):(v.done(),R(x))};w.open(s,r,!0),w.withCredentials=g,d&&(w.responseType=d),w.onload=async()=>{try{await c(w,m)}catch(x){x.request=w,f(x);return}w.status>=200&&w.status<300?(v.done(),E(w)):o(w)&&m{b(m+1).then(E,R)},y(m)):(v.done(),R(new ne(w.statusText,w)))},w.onerror=()=>f(new ne(w.statusText,w)),w.upload.onprogress=x=>{v.progress(),n(x)},i&&Object.keys(i).forEach(x=>{w.setRequestHeader(x,i[x])});function _(){w.abort(),R(new DOMException("Aborted","AbortError"))}if(u?.addEventListener("abort",_),u?.aborted){_();return}await a(w,m),w.send(e)})}return b()}const fr=r=>"error"in r&&!!r.error,gr=r=>r.progress.uploadComplete;function mr(r){return r.filter(t=>!fr(t)&&!gr(t))}function vr(r){return r.filter(t=>!t.progress?.uploadStarted||!t.isRestored)}function yr(r){return typeof r!="object"||r===null||!("nodeType"in r)?!1:r.nodeType===Node.ELEMENT_NODE}function br(r,t=document){return typeof r=="string"?t.querySelector(r):yr(r)?r:null}function Ti(r){const t=r.lastIndexOf(".");return t===-1||t===r.length-1?{name:r,extension:void 0}:{name:r.slice(0,t),extension:r.slice(t+1)}}const Pe={__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",msg:"application/vnd.ms-outlook",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 Mi(r){if(r.type)return r.type;const t=r.name?Ti(r.name).extension?.toLowerCase():null;return t&&t in Pe?Pe[t]:"application/octet-stream"}function wr(r){return r.charCodeAt(0).toString(32)}function Ue(r){let t="";return r.replace(/[^A-Z0-9]/gi,e=>(t+=`-${wr(e)}`,"/"))+t}function _r(r,t){let e=t||"uppy";return typeof r.name=="string"&&(e+=`-${Ue(r.name.toLowerCase())}`),r.type!==void 0&&(e+=`-${r.type}`),r.meta&&typeof r.meta.relativePath=="string"&&(e+=`-${Ue(r.meta.relativePath.toLowerCase())}`),r.data?.size!==void 0&&(e+=`-${r.data.size}`),r.data.lastModified!==void 0&&(e+=`-${r.data.lastModified}`),e}function Sr(r){return!r.isRemote||!r.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(r.remote.provider)}function xr(r,t){if(Sr(r))return r.id;const e=Mi(r);return _r({...r,type:e},t)}function ke(r,t){return r===!0?Object.keys(t):Array.isArray(r)?r:[]}function Er(r){for(;r&&!r.dir;)r=r.parentNode;return r?.dir}function zt(r){return r<10?`0${r}`:r.toString()}function Et(){const r=new Date,t=zt(r.getHours()),e=zt(r.getMinutes()),i=zt(r.getSeconds());return`${t}:${e}:${i}`}function Tr(r){return r?r.readyState===4&&r.status===0:!1}class Mr{#t=[];#e=0;#r;#i=!1;constructor(t){const e=t?.concurrency;this.#r=typeof e!="number"||e===0?1/0:e}add(t){const e=new AbortController;let i,s;const a=new Promise((o,c)=>{i=o,s=c}),n={run:()=>t(e.signal),resolve:i,reject:s,controller:e};return e.signal.addEventListener("abort",()=>{const o=this.#t.indexOf(n);o!==-1&&(this.#t.splice(o,1),s(e.signal.reason??new DOMException("Aborted","AbortError")))},{once:!0}),a.abort=o=>{e.abort(o??new DOMException("Aborted","AbortError"))},a.abortOn=o=>{if(o){const c=()=>a.abort(o.reason);o.addEventListener("abort",c,{once:!0}),a.then(()=>o.removeEventListener("abort",c),()=>o.removeEventListener("abort",c))}return a},!this.#i&&this.#e{t.controller.signal.aborted?t.reject(t.controller.signal.reason??new DOMException("Aborted","AbortError")):t.resolve(i)},i=>{t.reject(i)}).finally(()=>{this.#e--,this.#s()})}#s(){queueMicrotask(()=>{if(!(this.#i||this.#e>=this.#r))for(;this.#t.length>0;){const t=this.#t.shift();if(!t.controller.signal.aborted){this.#a(t);return}}})}pause(){this.#i=!0}resume(){this.#i=!1;const t=this.#r-this.#e;for(let e=0;ethis.add(i=>t(...e))}}function Rr(r,t,e){const i=[];return r.forEach(s=>typeof s!="string"?i.push(s):t[Symbol.split](s).forEach((a,n,o)=>{a!==""&&i.push(a),n{throw new Error(`missing string: ${r}`)};class Ri{locale;constructor(t,{onMissingKey:e=Or}={}){this.locale={strings:{},pluralize(i){return i===1?0:1}},Array.isArray(t)?t.forEach(this.#e,this):this.#e(t),this.#t=e}#t;#e(t){if(!t?.strings)return;const e=this.locale;Object.assign(this.locale,{strings:{...e.strings,...t.strings},pluralize:t.pluralize||e.pluralize})}translate(t,e){return this.translateArray(t,e).join("")}translateArray(t,e){let i=this.locale.strings[t];if(i==null&&(this.#t(t),i=t),typeof i=="object"){if(e&&typeof e.smart_count<"u"){const a=this.locale.pluralize(e.smart_count);return Ie(i[a],e)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof i!="string")throw new Error("string was not a string");return Ie(i,e)}}var At,F,Oi,Z,ze,Fi,Ci,Ai,we,oe,le,Mt={},Rt=[],Fr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Nt=Array.isArray;function V(r,t){for(var e in t)r[e]=t[e];return r}function _e(r){r&&r.parentNode&&r.parentNode.removeChild(r)}function Cr(r,t,e){var i,s,a,n={};for(a in t)a=="key"?i=t[a]:a=="ref"?s=t[a]:n[a]=t[a];if(arguments.length>2&&(n.children=arguments.length>3?At.call(arguments,2):e),typeof r=="function"&&r.defaultProps!=null)for(a in r.defaultProps)n[a]===void 0&&(n[a]=r.defaultProps[a]);return Tt(r,n,i,s,null)}function Tt(r,t,e,i,s){var a={type:r,props:t,key:e,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++Oi,__i:-1,__u:0};return s==null&&F.vnode!=null&&F.vnode(a),a}function Dt(r){return r.children}function ut(r,t){this.props=r,this.context=t}function ot(r,t){if(t==null)return r.__?ot(r.__,r.__i+1):null;for(var e;tt&&Z.sort(Ci),r=Z.shift(),t=Z.length,Ar(r)}finally{Z.length=Ot.__r=0}}function Di(r,t,e,i,s,a,n,o,c,l,d){var h,u,p,g,y,v,b,m=i&&i.__k||Rt,E=t.length;for(c=Nr(e,t,m,c,E),h=0;h0?n=r.__k[a]=Tt(n.type,n.props,n.key,n.ref?n.ref:null,n.__v):r.__k[a]=n,c=a+u,n.__=r,n.__b=r.__b+1,o=null,(l=n.__i=Dr(n,e,c,h))!=-1&&(h--,(o=e[l])&&(o.__u|=2)),o==null||o.__v==null?(l==-1&&(s>d?u--:sc?u--:u++,n.__u|=4))):r.__k[a]=null;if(h)for(a=0;a(d?1:0)){for(s=e-1,a=e+1;s>=0||a=0?s--:a++])!=null&&(2&l.__u)==0&&o==l.key&&c==l.type)return n}return-1}function je(r,t,e){t[0]=="-"?r.setProperty(t,e??""):r[t]=e==null?"":typeof e!="number"||Fr.test(t)?e:e+"px"}function yt(r,t,e,i,s){var a,n;t:if(t=="style")if(typeof e=="string")r.style.cssText=e;else{if(typeof i=="string"&&(r.style.cssText=i=""),i)for(t in i)e&&t in e||je(r.style,t,"");if(e)for(t in e)i&&e[t]==i[t]||je(r.style,t,e[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(Ai,"$1")),n=t.toLowerCase(),t=n in r||t=="onFocusOut"||t=="onFocusIn"?n.slice(2):t.slice(2),r.l||(r.l={}),r.l[t+a]=e,e?i?e.u=i.u:(e.u=we,r.addEventListener(t,a?le:oe,a)):r.removeEventListener(t,a?le:oe,a);else{if(s=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in r)try{r[t]=e??"";break t}catch{}typeof e=="function"||(e==null||e===!1&&t[4]!="-"?r.removeAttribute(t):r.setAttribute(t,t=="popover"&&e==1?"":e))}}function Be(r){return function(t){if(this.l){var e=this.l[t.type+r];if(t.t==null)t.t=we++;else if(t.t0?r:Nt(r)?r.map(ki):V({},r)}function Pr(r,t,e,i,s,a,n,o,c){var l,d,h,u,p,g,y,v=e.props||Mt,b=t.props,m=t.type;if(m=="svg"?s="http://www.w3.org/2000/svg":m=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),a!=null){for(l=0;l{t===i?.id&&e(s)})}onFileRemove(t,e){this.on("file-removed",i=>{t===i.id&&e(i.id)})}onPause(t,e){this.on("upload-pause",(i,s)=>{t===i?.id&&e(s)})}onRetry(t,e){this.on("upload-retry",i=>{t===i?.id&&e()})}onRetryAll(t,e){this.on("retry-all",()=>{this.#t.getFile(t)&&e()})}onPauseAll(t,e){this.on("pause-all",()=>{this.#t.getFile(t)&&e()})}onCancelAll(t,e){this.on("cancel-all",(...i)=>{this.#t.getFile(t)&&e(...i)})}onResumeAll(t,e){this.on("resume-all",()=>{this.#t.getFile(t)&&e()})}}const zr={debug:()=>{},warn:()=>{},error:(...r)=>console.error(`[Uppy] [${Et()}]`,...r)},Lr={debug:(...r)=>console.debug(`[Uppy] [${Et()}]`,...r),warn:(...r)=>console.warn(`[Uppy] [${Et()}]`,...r),error:(...r)=>console.error(`[Uppy] [${Et()}]`,...r)};var bt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pt(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Lt,$e;function jr(){return $e||($e=1,Lt=function(t){if(typeof t!="number"||Number.isNaN(t))throw new TypeError(`Expected a number, got ${typeof t}`);const e=t<0;let i=Math.abs(t);if(e&&(i=-i),i===0)return"0 B";const s=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],a=Math.min(Math.floor(Math.log(i)/Math.log(1024)),s.length-1),n=Number(i/1024**a),o=s[a];return`${n>=10||n%1===0?Math.round(n):n.toFixed(1)} ${o}`}),Lt}var Br=jr();const wt=Pt(Br);var jt,qe;function Hr(){if(qe)return jt;qe=1;function r(t,e){this.text=t=t||"",this.hasWild=~t.indexOf("*"),this.separator=e,this.parts=t.split(e)}return r.prototype.match=function(t){var e=!0,i=this.parts,s,a=i.length,n;if(typeof t=="string"||t instanceof String)if(!this.hasWild&&this.text!=t)e=!1;else{for(n=(t||"").split(this.separator),s=0;e&&s=2}return i?s(i.split(";")[0]):s},Bt}var qr=$r();const Wr=Pt(qr),Xr={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class $ extends Error{isUserFacing;file;constructor(t,e){super(t),this.isUserFacing=e?.isUserFacing??!0,e?.file&&(this.file=e.file)}isRestriction=!0}class Yr{getI18n;getOpts;constructor(t,e){this.getI18n=e,this.getOpts=()=>{const i=t();if(i.restrictions?.allowedFileTypes!=null&&!Array.isArray(i.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return i}}validateAggregateRestrictions(t,e){const{maxTotalFileSize:i,maxNumberOfFiles:s}=this.getOpts().restrictions;if(s&&t.filter(n=>!n.isGhost).length+e.length>s)throw new $(`${this.getI18n()("youCanOnlyUploadX",{smart_count:s})}`);if(i){const a=[...t,...e].reduce((n,o)=>n+(o.size??0),0);if(a>i)throw new $(this.getI18n()("aggregateExceedsSize",{sizeAllowed:wt(i),size:wt(a)}))}}validateSingleFile(t){const{maxFileSize:e,minFileSize:i,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(n=>n.includes("/")?t.type?Wr(t.type.replace(/;.*?$/,""),n):!1:n[0]==="."&&t.extension?t.extension.toLowerCase()===n.slice(1).toLowerCase():!1)){const n=s.join(", ");throw new $(this.getI18n()("youCanOnlyUploadFileTypes",{types:n}),{file:t})}if(e&&t.size!=null&&t.size>e)throw new $(this.getI18n()("exceedsSize",{size:wt(e),file:t.name??this.getI18n()("unnamed")}),{file:t});if(i&&t.size!=null&&t.size{this.validateSingleFile(i)}),this.validateAggregateRestrictions(t,e)}validateMinNumberOfFiles(t){const{minNumberOfFiles:e}=this.getOpts().restrictions;if(e&&Object.keys(t).length(e=i,t||(t=Promise.resolve().then(()=>(t=null,r(...e)))),t)}class Ft extends zi{#t;isTargetDOMEl;el;parent;title;getTargetPlugin(t){let e;if(typeof t?.addTarget=="function")e=t,e instanceof Ft||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:e,UIPlugin:Ft}}));else if(typeof t=="function"){const i=t;this.uppy.iteratePlugins(s=>{s instanceof i&&(e=s)})}return e}mount(t,e){const i=e.id,s=br(t);if(s){this.isTargetDOMEl=!0;const o=document.createElement("div");return o.classList.add("uppy-Root"),this.#t=Vr(c=>{this.uppy.getPlugin(this.id)&&(He(this.render(c,o),o),this.afterUpdate())}),this.uppy.log(`Installing ${i} to a DOM element '${t}'`),this.opts.replaceTargetContent&&(s.innerHTML=""),He(this.render(this.uppy.getState(),o),o),this.el=o,s.appendChild(o),o.dir=this.opts.direction||Er(o)||"ltr",this.onMount(),this.el}const a=this.getTargetPlugin(t);if(a)return this.uppy.log(`Installing ${i} to ${a.id}`),this.parent=a,this.el=a.addTarget(e),this.onMount(),this.el;this.uppy.log(`Not installing ${i}`);let n=`Invalid target option given to ${i}.`;throw typeof t=="function"?n+=" 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.":n+="If you meant to target an HTML element, please make sure that the element exists. Check that the