uppy
Version:
Extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:
69 lines • 584 kB
JavaScript
var Bg=Object.create;var ro=Object.defineProperty;var jg=Object.getOwnPropertyDescriptor;var zg=Object.getOwnPropertyNames;var Hg=Object.getPrototypeOf,qg=Object.prototype.hasOwnProperty;var o=(i,e)=>ro(i,"name",{value:e,configurable:!0});var pe=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),An=(i,e)=>{for(var t in e)ro(i,t,{get:e[t],enumerable:!0})},Vg=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of zg(e))!qg.call(i,s)&&s!==t&&ro(i,s,{get:()=>e[s],enumerable:!(r=jg(e,s))||r.enumerable});return i};var ae=(i,e,t)=>(t=i!=null?Bg(Hg(i)):{},Vg(e||!i||!i.__esModule?ro(t,"default",{value:i,enumerable:!0}):t,i));var Zi=pe((_5,vc)=>{"use strict";vc.exports=o(function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);let t=e<0,r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return`${(t?"-":"")+e} B`;let s=Math.min(Math.floor(Math.log(e)/Math.log(1024)),r.length-1);e=Number(e/1024**s);let n=r[s];return e>=10||e%1===0?`${(t?"-":"")+e.toFixed(0)} ${n}`:`${(t?"-":"")+e.toFixed(1)} ${n}`},"prettierBytes")});var Sc=pe((E5,wc)=>{"use strict";function bc(i,e){this.text=i=i||"",this.hasWild=~i.indexOf("*"),this.separator=e,this.parts=i.split(e)}o(bc,"WildcardMatcher");bc.prototype.match=function(i){var e=!0,t=this.parts,r,s=t.length,n;if(typeof i=="string"||i instanceof String)if(!this.hasWild&&this.text!=i)e=!1;else{for(n=(i||"").split(this.separator),r=0;e&&r<s;r++)t[r]!=="*"&&(r<n.length?e=t[r]===n[r]:e=!1);e=e&&n}else if(typeof i.splice=="function")for(e=[],r=i.length;r--;)this.match(i[r])&&(e[e.length]=i[r]);else if(typeof i=="object"){e={};for(var a in i)this.match(a)&&(e[a]=i[a])}return e};wc.exports=function(i,e,t){var r=new bc(i,t||/[\/\.]/);return typeof e<"u"?r.match(e):r}});var Pc=pe((T5,xc)=>{var by=Sc(),wy=/[\/\+\.]/;xc.exports=function(i,e){function t(r){var s=by(r,i,wy);return s&&s.length>=2}return o(t,"test"),e?t(e.split(";")[0]):t}});var go=pe((z5,Fc)=>{function Py(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}o(Py,"isObject");Fc.exports=Py});var Cc=pe((q5,Tc)=>{var _y=typeof global=="object"&&global&&global.Object===Object&&global;Tc.exports=_y});var ia=pe((V5,Ac)=>{var ky=Cc(),Ey=typeof self=="object"&&self&&self.Object===Object&&self,Fy=ky||Ey||Function("return this")();Ac.exports=Fy});var Uc=pe(($5,Rc)=>{var Ty=ia(),Cy=o(function(){return Ty.Date.now()},"now");Rc.exports=Cy});var Dc=pe((G5,Oc)=>{var Ay=/\s/;function Ry(i){for(var e=i.length;e--&&Ay.test(i.charAt(e)););return e}o(Ry,"trimmedEndIndex");Oc.exports=Ry});var Nc=pe((X5,Ic)=>{var Uy=Dc(),Oy=/^\s+/;function Dy(i){return i&&i.slice(0,Uy(i)+1).replace(Oy,"")}o(Dy,"baseTrim");Ic.exports=Dy});var ra=pe((J5,Mc)=>{var Iy=ia(),Ny=Iy.Symbol;Mc.exports=Ny});var zc=pe((Q5,jc)=>{var Lc=ra(),Bc=Object.prototype,My=Bc.hasOwnProperty,Ly=Bc.toString,Jr=Lc?Lc.toStringTag:void 0;function By(i){var e=My.call(i,Jr),t=i[Jr];try{i[Jr]=void 0;var r=!0}catch{}var s=Ly.call(i);return r&&(e?i[Jr]=t:delete i[Jr]),s}o(By,"getRawTag");jc.exports=By});var qc=pe((e3,Hc)=>{var jy=Object.prototype,zy=jy.toString;function Hy(i){return zy.call(i)}o(Hy,"objectToString");Hc.exports=Hy});var Gc=pe((i3,Wc)=>{var Vc=ra(),qy=zc(),Vy=qc(),$y="[object Null]",Wy="[object Undefined]",$c=Vc?Vc.toStringTag:void 0;function Gy(i){return i==null?i===void 0?Wy:$y:$c&&$c in Object(i)?qy(i):Vy(i)}o(Gy,"baseGetTag");Wc.exports=Gy});var Xc=pe((s3,Kc)=>{function Ky(i){return i!=null&&typeof i=="object"}o(Ky,"isObjectLike");Kc.exports=Ky});var Jc=pe((n3,Yc)=>{var Xy=Gc(),Yy=Xc(),Jy="[object Symbol]";function Qy(i){return typeof i=="symbol"||Yy(i)&&Xy(i)==Jy}o(Qy,"isSymbol");Yc.exports=Qy});var tp=pe((l3,ep)=>{var Zy=Nc(),Qc=go(),ev=Jc(),Zc=NaN,tv=/^[-+]0x[0-9a-f]+$/i,iv=/^0b[01]+$/i,rv=/^0o[0-7]+$/i,sv=parseInt;function ov(i){if(typeof i=="number")return i;if(ev(i))return Zc;if(Qc(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Qc(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=Zy(i);var t=iv.test(i);return t||rv.test(i)?sv(i.slice(2),t?2:8):tv.test(i)?Zc:+i}o(ov,"toNumber");ep.exports=ov});var yo=pe((c3,rp)=>{var nv=go(),sa=Uc(),ip=tp(),av="Expected a function",lv=Math.max,uv=Math.min;function cv(i,e,t){var r,s,n,a,u,c,p=0,f=!1,d=!1,v=!0;if(typeof i!="function")throw new TypeError(av);e=ip(e)||0,nv(t)&&(f=!!t.leading,d="maxWait"in t,n=d?lv(ip(t.maxWait)||0,e):n,v="trailing"in t?!!t.trailing:v);function _(H){var Q=r,K=s;return r=s=void 0,p=H,a=i.apply(K,Q),a}o(_,"invokeFunc");function k(H){return p=H,u=setTimeout(R,e),f?_(H):a}o(k,"leadingEdge");function A(H){var Q=H-c,K=H-p,Z=e-Q;return d?uv(Z,n-K):Z}o(A,"remainingWait");function F(H){var Q=H-c,K=H-p;return c===void 0||Q>=e||Q<0||d&&K>=n}o(F,"shouldInvoke");function R(){var H=sa();if(F(H))return U(H);u=setTimeout(R,A(H))}o(R,"timerExpired");function U(H){return u=void 0,v&&r?_(H):(r=s=void 0,a)}o(U,"trailingEdge");function C(){u!==void 0&&clearTimeout(u),p=0,r=c=s=u=void 0}o(C,"cancel");function Y(){return u===void 0?a:U(sa())}o(Y,"flush");function $(){var H=sa(),Q=F(H);if(r=arguments,s=this,c=H,Q){if(u===void 0)return k(c);if(d)return clearTimeout(u),u=setTimeout(R,e),_(c)}return u===void 0&&(u=setTimeout(R,e)),a}return o($,"debounced"),$.cancel=C,$.flush=Y,$}o(cv,"debounce");rp.exports=cv});var oa=pe((d3,sp)=>{var pv=yo(),dv=go(),hv="Expected a function";function fv(i,e,t){var r=!0,s=!0;if(typeof i!="function")throw new TypeError(hv);return dv(t)&&(r="leading"in t?!!t.leading:r,s="trailing"in t?!!t.trailing:s),pv(i,e,{leading:r,maxWait:e,trailing:s})}o(fv,"throttle");sp.exports=fv});var np=pe((f3,op)=>{op.exports=o(function(){var e={},t=e._fns={};e.emit=o(function(a,u,c,p,f,d,v){var _=r(a);_.length&&s(a,_,[u,c,p,f,d,v])},"emit"),e.on=o(function(a,u){t[a]||(t[a]=[]),t[a].push(u)},"on"),e.once=o(function(a,u){function c(){u.apply(this,arguments),e.off(a,c)}o(c,"one"),this.on(a,c)},"once"),e.off=o(function(a,u){var c=[];if(a&&u){var p=this._fns[a],f=0,d=p?p.length:0;for(f;f<d;f++)p[f]!==u&&c.push(p[f])}c.length?this._fns[a]=c:delete this._fns[a]},"off");function r(n){var a=t[n]?t[n]:[],u=n.indexOf(":"),c=u===-1?[n]:[n.substring(0,u),n.substring(u+1)],p=Object.keys(t),f=0,d=p.length;for(f;f<d;f++){var v=p[f];if(v==="*"&&(a=a.concat(t[v])),c.length===2&&c[0]===v){a=a.concat(t[v]);break}}return a}o(r,"getListeners");function s(n,a,u){var c=0,p=a.length;for(c;c<p&&a[c];c++)a[c].event=n,a[c].apply(a[c],u)}return o(s,"emitAll"),e},"createNamespaceEmitter")});var hp=pe((q3,dp)=>{function Pt(i,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(i)),this._timeouts=i,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}o(Pt,"RetryOperation");dp.exports=Pt;Pt.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Pt.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Pt.prototype.retry=function(i){if(this._timeout&&clearTimeout(this._timeout),!i)return!1;var e=new Date().getTime();if(i&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(i),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(i);var t=this._timeouts.shift();if(t===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),t=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},t),this._options.unref&&this._timer.unref(),!0};Pt.prototype.attempt=function(i,e){this._fn=i,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var t=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){t._operationTimeoutCb()},t._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Pt.prototype.try=function(i){console.log("Using RetryOperation.try() is deprecated"),this.attempt(i)};Pt.prototype.start=function(i){console.log("Using RetryOperation.start() is deprecated"),this.attempt(i)};Pt.prototype.start=Pt.prototype.try;Pt.prototype.errors=function(){return this._errors};Pt.prototype.attempts=function(){return this._attempts};Pt.prototype.mainError=function(){if(this._errors.length===0)return null;for(var i={},e=null,t=0,r=0;r<this._errors.length;r++){var s=this._errors[r],n=s.message,a=(i[n]||0)+1;i[n]=a,a>=t&&(e=s,t=a)}return e}});var fp=pe(vi=>{var vv=hp();vi.operation=function(i){var e=vi.timeouts(i);return new vv(e,{forever:i&&(i.forever||i.retries===1/0),unref:i&&i.unref,maxRetryTime:i&&i.maxRetryTime})};vi.timeouts=function(i){if(i instanceof Array)return[].concat(i);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var t in i)e[t]=i[t];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],s=0;s<e.retries;s++)r.push(this.createTimeout(s,e));return i&&i.forever&&!r.length&&r.push(this.createTimeout(s,e)),r.sort(function(n,a){return n-a}),r};vi.createTimeout=function(i,e){var t=e.randomize?Math.random()+1:1,r=Math.round(t*Math.max(e.minTimeout,1)*Math.pow(e.factor,i));return r=Math.min(r,e.maxTimeout),r};vi.wrap=function(i,e,t){if(e instanceof Array&&(t=e,e=null),!t){t=[];for(var r in i)typeof i[r]=="function"&&t.push(r)}for(var s=0;s<t.length;s++){var n=t[s],a=i[n];i[n]=o(function(c){var p=vi.operation(e),f=Array.prototype.slice.call(arguments,1),d=f.pop();f.push(function(v){p.retry(v)||(v&&(arguments[0]=p.mainError()),d.apply(this,arguments))}),p.attempt(function(){c.apply(i,f)})},"retryWrapper").bind(i,a),i[n].options=e}}});var gp=pe((G3,mp)=>{mp.exports=fp()});var Ge=pe((VP,Eo)=>{(function(){"use strict";var i={}.hasOwnProperty;function e(){for(var s="",n=0;n<arguments.length;n++){var a=arguments[n];a&&(s=r(s,t(a)))}return s}o(e,"classNames");function t(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return e.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var n="";for(var a in s)i.call(s,a)&&s[a]&&(n=r(n,a));return n}o(t,"parseValue");function r(s,n){return n?s?s+" "+n:s+n:s}o(r,"appendClass"),typeof Eo<"u"&&Eo.exports?(e.default=e,Eo.exports=e):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return e}):window.classNames=e})()});var Up=pe((N_,va)=>{"use strict";var Zv=Object.prototype.hasOwnProperty,nt="~";function ts(){}o(ts,"Events");Object.create&&(ts.prototype=Object.create(null),new ts().__proto__||(nt=!1));function e0(i,e,t){this.fn=i,this.context=e,this.once=t||!1}o(e0,"EE");function Rp(i,e,t,r,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var n=new e0(t,r||i,s),a=nt?nt+e:e;return i._events[a]?i._events[a].fn?i._events[a]=[i._events[a],n]:i._events[a].push(n):(i._events[a]=n,i._eventsCount++),i}o(Rp,"addListener");function Oo(i,e){--i._eventsCount===0?i._events=new ts:delete i._events[e]}o(Oo,"clearEvent");function st(){this._events=new ts,this._eventsCount=0}o(st,"EventEmitter");st.prototype.eventNames=o(function(){var e=[],t,r;if(this._eventsCount===0)return e;for(r in t=this._events)Zv.call(t,r)&&e.push(nt?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},"eventNames");st.prototype.listeners=o(function(e){var t=nt?nt+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,n=r.length,a=new Array(n);s<n;s++)a[s]=r[s].fn;return a},"listeners");st.prototype.listenerCount=o(function(e){var t=nt?nt+e:e,r=this._events[t];return r?r.fn?1:r.length:0},"listenerCount");st.prototype.emit=o(function(e,t,r,s,n,a){var u=nt?nt+e:e;if(!this._events[u])return!1;var c=this._events[u],p=arguments.length,f,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),p){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,s),!0;case 5:return c.fn.call(c.context,t,r,s,n),!0;case 6:return c.fn.call(c.context,t,r,s,n,a),!0}for(d=1,f=new Array(p-1);d<p;d++)f[d-1]=arguments[d];c.fn.apply(c.context,f)}else{var v=c.length,_;for(d=0;d<v;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),p){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,r);break;case 4:c[d].fn.call(c[d].context,t,r,s);break;default:if(!f)for(_=1,f=new Array(p-1);_<p;_++)f[_-1]=arguments[_];c[d].fn.apply(c[d].context,f)}}return!0},"emit");st.prototype.on=o(function(e,t,r){return Rp(this,e,t,r,!1)},"on");st.prototype.once=o(function(e,t,r){return Rp(this,e,t,r,!0)},"once");st.prototype.removeListener=o(function(e,t,r,s){var n=nt?nt+e:e;if(!this._events[n])return this;if(!t)return Oo(this,n),this;var a=this._events[n];if(a.fn)a.fn===t&&(!s||a.once)&&(!r||a.context===r)&&Oo(this,n);else{for(var u=0,c=[],p=a.length;u<p;u++)(a[u].fn!==t||s&&!a[u].once||r&&a[u].context!==r)&&c.push(a[u]);c.length?this._events[n]=c.length===1?c[0]:c:Oo(this,n)}return this},"removeListener");st.prototype.removeAllListeners=o(function(e){var t;return e?(t=nt?nt+e:e,this._events[t]&&Oo(this,t)):(this._events=new ts,this._eventsCount=0),this},"removeAllListeners");st.prototype.off=st.prototype.removeListener;st.prototype.addListener=st.prototype.on;st.prefixed=nt;st.EventEmitter=st;typeof va<"u"&&(va.exports=st)});var pd=pe((Na,Ma)=>{(function(i,e){typeof Na=="object"&&typeof Ma<"u"?Ma.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Compressor=e())})(Na,(function(){"use strict";function i(I,T){var O=Object.keys(I);if(Object.getOwnPropertySymbols){var L=Object.getOwnPropertySymbols(I);T&&(L=L.filter(function(X){return Object.getOwnPropertyDescriptor(I,X).enumerable})),O.push.apply(O,L)}return O}o(i,"ownKeys");function e(I){for(var T=1;T<arguments.length;T++){var O=arguments[T]!=null?arguments[T]:{};T%2?i(Object(O),!0).forEach(function(L){n(I,L,O[L])}):Object.getOwnPropertyDescriptors?Object.defineProperties(I,Object.getOwnPropertyDescriptors(O)):i(Object(O)).forEach(function(L){Object.defineProperty(I,L,Object.getOwnPropertyDescriptor(O,L))})}return I}o(e,"_objectSpread2");function t(I,T){if(!(I instanceof T))throw new TypeError("Cannot call a class as a function")}o(t,"_classCallCheck");function r(I,T){for(var O=0;O<T.length;O++){var L=T[O];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(I,c(L.key),L)}}o(r,"_defineProperties");function s(I,T,O){return T&&r(I.prototype,T),O&&r(I,O),Object.defineProperty(I,"prototype",{writable:!1}),I}o(s,"_createClass");function n(I,T,O){return T=c(T),T in I?Object.defineProperty(I,T,{value:O,enumerable:!0,configurable:!0,writable:!0}):I[T]=O,I}o(n,"_defineProperty");function a(){return a=Object.assign?Object.assign.bind():function(I){for(var T=1;T<arguments.length;T++){var O=arguments[T];for(var L in O)Object.prototype.hasOwnProperty.call(O,L)&&(I[L]=O[L])}return I},a.apply(this,arguments)}o(a,"_extends");function u(I,T){if(typeof I!="object"||I===null)return I;var O=I[Symbol.toPrimitive];if(O!==void 0){var L=O.call(I,T||"default");if(typeof L!="object")return L;throw new TypeError("@@toPrimitive must return a primitive value.")}return(T==="string"?String:Number)(I)}o(u,"_toPrimitive");function c(I){var T=u(I,"string");return typeof T=="symbol"?T:String(T)}o(c,"_toPropertyKey");var p={exports:{}};(function(I){typeof window>"u"||(function(T){var O=T.HTMLCanvasElement&&T.HTMLCanvasElement.prototype,L=T.Blob&&(function(){try{return!!new Blob}catch{return!1}})(),X=L&&T.Uint8Array&&(function(){try{return new Blob([new Uint8Array(100)]).size===100}catch{return!1}})(),J=T.BlobBuilder||T.WebKitBlobBuilder||T.MozBlobBuilder||T.MSBlobBuilder,ne=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,ue=(L||J)&&T.atob&&T.ArrayBuffer&&T.Uint8Array&&function(te){var ie,xe,Ee,ot,Ce,ee,et,Oe,jt;if(ie=te.match(ne),!ie)throw new Error("invalid data URI");for(xe=ie[2]?ie[1]:"text/plain"+(ie[3]||";charset=US-ASCII"),Ee=!!ie[4],ot=te.slice(ie[0].length),Ee?Ce=atob(ot):Ce=decodeURIComponent(ot),ee=new ArrayBuffer(Ce.length),et=new Uint8Array(ee),Oe=0;Oe<Ce.length;Oe+=1)et[Oe]=Ce.charCodeAt(Oe);return L?new Blob([X?et:ee],{type:xe}):(jt=new J,jt.append(ee),jt.getBlob(xe))};T.HTMLCanvasElement&&!O.toBlob&&(O.mozGetAsFile?O.toBlob=function(te,ie,xe){var Ee=this;setTimeout(function(){xe&&O.toDataURL&&ue?te(ue(Ee.toDataURL(ie,xe))):te(Ee.mozGetAsFile("blob",ie))})}:O.toDataURL&&ue&&(O.msToBlob?O.toBlob=function(te,ie,xe){var Ee=this;setTimeout(function(){(ie&&ie!=="image/png"||xe)&&O.toDataURL&&ue?te(ue(Ee.toDataURL(ie,xe))):te(Ee.msToBlob(ie))})}:O.toBlob=function(te,ie,xe){var Ee=this;setTimeout(function(){te(ue(Ee.toDataURL(ie,xe)))})})),I.exports?I.exports=ue:T.dataURLtoBlob=ue})(window)})(p);var f=p.exports,d=o(function(T){return typeof Blob>"u"?!1:T instanceof Blob||Object.prototype.toString.call(T)==="[object Blob]"},"isBlob"),v={strict:!0,checkOrientation:!0,retainExif:!1,maxWidth:1/0,maxHeight:1/0,minWidth:0,minHeight:0,width:void 0,height:void 0,resize:"none",quality:.8,mimeType:"auto",convertTypes:["image/png"],convertSize:5e6,beforeDraw:null,drew:null,success:null,error:null},_=typeof window<"u"&&typeof window.document<"u",k=_?window:{},A=o(function(T){return T>0&&T<1/0},"isPositiveNumber"),F=Array.prototype.slice;function R(I){return Array.from?Array.from(I):F.call(I)}o(R,"toArray");var U=/^image\/.+$/;function C(I){return U.test(I)}o(C,"isImageType");function Y(I){var T=C(I)?I.substr(6):"";return T==="jpeg"&&(T="jpg"),".".concat(T)}o(Y,"imageTypeToExtension");var $=String.fromCharCode;function H(I,T,O){var L="",X;for(O+=T,X=T;X<O;X+=1)L+=$(I.getUint8(X));return L}o(H,"getStringFromCharCode");var Q=k.btoa;function K(I,T){for(var O=[],L=8192,X=new Uint8Array(I);X.length>0;)O.push($.apply(null,R(X.subarray(0,L)))),X=X.subarray(L);return"data:".concat(T,";base64,").concat(Q(O.join("")))}o(K,"arrayBufferToDataURL");function Z(I){var T=new DataView(I),O;try{var L,X,J;if(T.getUint8(0)===255&&T.getUint8(1)===216)for(var ne=T.byteLength,ue=2;ue+1<ne;){if(T.getUint8(ue)===255&&T.getUint8(ue+1)===225){X=ue;break}ue+=1}if(X){var te=X+4,ie=X+10;if(H(T,te,4)==="Exif"){var xe=T.getUint16(ie);if(L=xe===18761,(L||xe===19789)&&T.getUint16(ie+2,L)===42){var Ee=T.getUint32(ie+4,L);Ee>=8&&(J=ie+Ee)}}}if(J){var ot=T.getUint16(J,L),Ce,ee;for(ee=0;ee<ot;ee+=1)if(Ce=J+ee*12+2,T.getUint16(Ce,L)===274){Ce+=8,O=T.getUint16(Ce,L),T.setUint16(Ce,1,L);break}}}catch{O=1}return O}o(Z,"resetAndGetOrientation");function ye(I){var T=0,O=1,L=1;switch(I){case 2:O=-1;break;case 3:T=-180;break;case 4:L=-1;break;case 5:T=90,L=-1;break;case 6:T=90;break;case 7:T=90,O=-1;break;case 8:T=-90;break}return{rotate:T,scaleX:O,scaleY:L}}o(ye,"parseOrientation");var se=/\.\d*(?:0|9){12}\d*$/;function we(I){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return se.test(I)?Math.round(I*T)/T:I}o(we,"normalizeDecimalNumber");function me(I){var T=I.aspectRatio,O=I.height,L=I.width,X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"none",J=A(L),ne=A(O);if(J&&ne){var ue=O*T;(X==="contain"||X==="none")&&ue>L||X==="cover"&&ue<L?O=L/T:L=O*T}else J?O=L/T:ne&&(L=O*T);return{width:L,height:O}}o(me,"getAdjustedSizes");function _e(I){for(var T=R(new Uint8Array(I)),O=T.length,L=[],X=0;X+3<O;){var J=T[X],ne=T[X+1];if(J===255&&ne===218)break;if(J===255&&ne===216)X+=2;else{var ue=T[X+2]*256+T[X+3],te=X+ue+2,ie=T.slice(X,te);L.push(ie),X=te}}return L.reduce(function(xe,Ee){return Ee[0]===255&&Ee[1]===225?xe.concat(Ee):xe},[])}o(_e,"getExif");function ve(I,T){var O=R(new Uint8Array(I));if(O[2]!==255||O[3]!==224)return I;var L=O[4]*256+O[5],X=[255,216].concat(T,O.slice(4+L));return new Uint8Array(X)}o(ve,"insertExif");var E=k.ArrayBuffer,w=k.FileReader,S=k.URL||k.webkitURL,B=/\.\w+$/,q=k.Compressor,j=(function(){function I(T,O){t(this,I),this.file=T,this.exif=[],this.image=new Image,this.options=e(e({},v),O),this.aborted=!1,this.result=null,this.init()}return o(I,"Compressor"),s(I,[{key:"init",value:o(function(){var O=this,L=this.file,X=this.options;if(!d(L)){this.fail(new Error("The first argument must be a File or Blob object."));return}var J=L.type;if(!C(J)){this.fail(new Error("The first argument must be an image File or Blob object."));return}if(!S||!w){this.fail(new Error("The current browser does not support image compression."));return}E||(X.checkOrientation=!1,X.retainExif=!1);var ne=J==="image/jpeg",ue=ne&&X.checkOrientation,te=ne&&X.retainExif;if(S&&!ue&&!te)this.load({url:S.createObjectURL(L)});else{var ie=new w;this.reader=ie,ie.onload=function(xe){var Ee=xe.target,ot=Ee.result,Ce={},ee=1;ue&&(ee=Z(ot),ee>1&&a(Ce,ye(ee))),te&&(O.exif=_e(ot)),ue||te?!S||ee>1?Ce.url=K(ot,J):Ce.url=S.createObjectURL(L):Ce.url=ot,O.load(Ce)},ie.onabort=function(){O.fail(new Error("Aborted to read the image with FileReader."))},ie.onerror=function(){O.fail(new Error("Failed to read the image with FileReader."))},ie.onloadend=function(){O.reader=null},ue||te?ie.readAsArrayBuffer(L):ie.readAsDataURL(L)}},"init")},{key:"load",value:o(function(O){var L=this,X=this.file,J=this.image;J.onload=function(){L.draw(e(e({},O),{},{naturalWidth:J.naturalWidth,naturalHeight:J.naturalHeight}))},J.onabort=function(){L.fail(new Error("Aborted to load the image."))},J.onerror=function(){L.fail(new Error("Failed to load the image."))},k.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(k.navigator.userAgent)&&(J.crossOrigin="anonymous"),J.alt=X.name,J.src=O.url},"load")},{key:"draw",value:o(function(O){var L=this,X=O.naturalWidth,J=O.naturalHeight,ne=O.rotate,ue=ne===void 0?0:ne,te=O.scaleX,ie=te===void 0?1:te,xe=O.scaleY,Ee=xe===void 0?1:xe,ot=this.file,Ce=this.image,ee=this.options,et=document.createElement("canvas"),Oe=et.getContext("2d"),jt=Math.abs(ue)%180===90,ji=(ee.resize==="contain"||ee.resize==="cover")&&A(ee.width)&&A(ee.height),Vt=Math.max(ee.maxWidth,0)||1/0,zt=Math.max(ee.maxHeight,0)||1/0,$t=Math.max(ee.minWidth,0)||0,ni=Math.max(ee.minHeight,0)||0,Wt=X/J,Ve=ee.width,$e=ee.height;if(jt){var _r=[zt,Vt];Vt=_r[0],zt=_r[1];var kr=[ni,$t];$t=kr[0],ni=kr[1];var Er=[$e,Ve];Ve=Er[0],$e=Er[1]}ji&&(Wt=Ve/$e);var Js=me({aspectRatio:Wt,width:Vt,height:zt},"contain");Vt=Js.width,zt=Js.height;var Qs=me({aspectRatio:Wt,width:$t,height:ni},"cover");if($t=Qs.width,ni=Qs.height,ji){var oe=me({aspectRatio:Wt,width:Ve,height:$e},ee.resize);Ve=oe.width,$e=oe.height}else{var Fr=me({aspectRatio:Wt,width:Ve,height:$e}),zi=Fr.width;Ve=zi===void 0?X:zi;var Ft=Fr.height;$e=Ft===void 0?J:Ft}Ve=Math.floor(we(Math.min(Math.max(Ve,$t),Vt))),$e=Math.floor(we(Math.min(Math.max($e,ni),zt)));var kn=-Ve/2,Gt=-$e/2,tt=Ve,En=$e,Hi=[];if(ji){var Fe=0,be=0,Tr=X,Tt=J,Zs=me({aspectRatio:Wt,width:X,height:J},{contain:"cover",cover:"contain"}[ee.resize]);Tr=Zs.width,Tt=Zs.height,Fe=(X-Tr)/2,be=(J-Tt)/2,Hi.push(Fe,be,Tr,Tt)}if(Hi.push(kn,Gt,tt,En),jt){var _t=[$e,Ve];Ve=_t[0],$e=_t[1]}et.width=Ve,et.height=$e,C(ee.mimeType)||(ee.mimeType=ot.type);var eo="transparent";ot.size>ee.convertSize&&ee.convertTypes.indexOf(ee.mimeType)>=0&&(ee.mimeType="image/jpeg");var Ae=ee.mimeType==="image/jpeg";if(Ae&&(eo="#fff"),Oe.fillStyle=eo,Oe.fillRect(0,0,Ve,$e),ee.beforeDraw&&ee.beforeDraw.call(this,Oe,et),!this.aborted&&(Oe.save(),Oe.translate(Ve/2,$e/2),Oe.rotate(ue*Math.PI/180),Oe.scale(ie,Ee),Oe.drawImage.apply(Oe,[Ce].concat(Hi)),Oe.restore(),ee.drew&&ee.drew.call(this,Oe,et),!this.aborted)){var dt=o(function(li){if(!L.aborted){var qi=o(function(Kt){return L.done({naturalWidth:X,naturalHeight:J,result:Kt})},"done");if(li&&Ae&&ee.retainExif&&L.exif&&L.exif.length>0){var Vi=o(function(Kt){return qi(f(K(ve(Kt,L.exif),ee.mimeType)))},"next");if(li.arrayBuffer)li.arrayBuffer().then(Vi).catch(function(){L.fail(new Error("Failed to read the compressed image with Blob.arrayBuffer()."))});else{var vt=new w;L.reader=vt,vt.onload=function(Cr){var Kt=Cr.target;Vi(Kt.result)},vt.onabort=function(){L.fail(new Error("Aborted to read the compressed image with FileReader."))},vt.onerror=function(){L.fail(new Error("Failed to read the compressed image with FileReader."))},vt.onloadend=function(){L.reader=null},vt.readAsArrayBuffer(li)}}else qi(li)}},"callback");et.toBlob?et.toBlob(dt,ee.mimeType,ee.quality):dt(f(et.toDataURL(ee.mimeType,ee.quality)))}},"draw")},{key:"done",value:o(function(O){var L=O.naturalWidth,X=O.naturalHeight,J=O.result,ne=this.file,ue=this.image,te=this.options;if(S&&ue.src.indexOf("blob:")===0&&S.revokeObjectURL(ue.src),J)if(te.strict&&!te.retainExif&&J.size>ne.size&&te.mimeType===ne.type&&!(te.width>L||te.height>X||te.minWidth>L||te.minHeight>X||te.maxWidth<L||te.maxHeight<X))J=ne;else{var ie=new Date;J.lastModified=ie.getTime(),J.lastModifiedDate=ie,J.name=ne.name,J.name&&J.type!==ne.type&&(J.name=J.name.replace(B,Y(J.type)))}else J=ne;this.result=J,te.success&&te.success.call(this,J)},"done")},{key:"fail",value:o(function(O){var L=this.options;if(L.error)L.error.call(this,O);else throw O},"fail")},{key:"abort",value:o(function(){this.aborted||(this.aborted=!0,this.reader?this.reader.abort():this.image.complete?this.fail(new Error("The compression process has been aborted.")):(this.image.onload=null,this.image.onabort()))},"abort")}],[{key:"noConflict",value:o(function(){return window.Compressor=q,I},"noConflict")},{key:"setDefaults",value:o(function(O){a(v,O)},"setDefaults")}]),I})();return j}))});var Gh=pe((xl,Pl)=>{(function(i,e){typeof xl=="object"&&typeof Pl<"u"?Pl.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Cropper=e())})(xl,(function(){"use strict";function i(y,h){var g=Object.keys(y);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(y);h&&(m=m.filter(function(P){return Object.getOwnPropertyDescriptor(y,P).enumerable})),g.push.apply(g,m)}return g}o(i,"ownKeys");function e(y){for(var h=1;h<arguments.length;h++){var g=arguments[h]!=null?arguments[h]:{};h%2?i(Object(g),!0).forEach(function(m){c(y,m,g[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(g)):i(Object(g)).forEach(function(m){Object.defineProperty(y,m,Object.getOwnPropertyDescriptor(g,m))})}return y}o(e,"_objectSpread2");function t(y,h){if(typeof y!="object"||!y)return y;var g=y[Symbol.toPrimitive];if(g!==void 0){var m=g.call(y,h||"default");if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(h==="string"?String:Number)(y)}o(t,"_toPrimitive");function r(y){var h=t(y,"string");return typeof h=="symbol"?h:h+""}o(r,"_toPropertyKey");function s(y){"@babel/helpers - typeof";return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},s(y)}o(s,"_typeof");function n(y,h){if(!(y instanceof h))throw new TypeError("Cannot call a class as a function")}o(n,"_classCallCheck");function a(y,h){for(var g=0;g<h.length;g++){var m=h[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(y,r(m.key),m)}}o(a,"_defineProperties");function u(y,h,g){return h&&a(y.prototype,h),g&&a(y,g),Object.defineProperty(y,"prototype",{writable:!1}),y}o(u,"_createClass");function c(y,h,g){return h=r(h),h in y?Object.defineProperty(y,h,{value:g,enumerable:!0,configurable:!0,writable:!0}):y[h]=g,y}o(c,"_defineProperty");function p(y){return f(y)||d(y)||v(y)||k()}o(p,"_toConsumableArray");function f(y){if(Array.isArray(y))return _(y)}o(f,"_arrayWithoutHoles");function d(y){if(typeof Symbol<"u"&&y[Symbol.iterator]!=null||y["@@iterator"]!=null)return Array.from(y)}o(d,"_iterableToArray");function v(y,h){if(y){if(typeof y=="string")return _(y,h);var g=Object.prototype.toString.call(y).slice(8,-1);if(g==="Object"&&y.constructor&&(g=y.constructor.name),g==="Map"||g==="Set")return Array.from(y);if(g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g))return _(y,h)}}o(v,"_unsupportedIterableToArray");function _(y,h){(h==null||h>y.length)&&(h=y.length);for(var g=0,m=new Array(h);g<h;g++)m[g]=y[g];return m}o(_,"_arrayLikeToArray");function k(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}o(k,"_nonIterableSpread");var A=typeof window<"u"&&typeof window.document<"u",F=A?window:{},R=A&&F.document.documentElement?"ontouchstart"in F.document.documentElement:!1,U=A?"PointerEvent"in F:!1,C="cropper",Y="all",$="crop",H="move",Q="zoom",K="e",Z="w",ye="s",se="n",we="ne",me="nw",_e="se",ve="sw",E="".concat(C,"-crop"),w="".concat(C,"-disabled"),S="".concat(C,"-hidden"),B="".concat(C,"-hide"),q="".concat(C,"-invisible"),j="".concat(C,"-modal"),I="".concat(C,"-move"),T="".concat(C,"Action"),O="".concat(C,"Preview"),L="crop",X="move",J="none",ne="crop",ue="cropend",te="cropmove",ie="cropstart",xe="dblclick",Ee=R?"touchstart":"mousedown",ot=R?"touchmove":"mousemove",Ce=R?"touchend touchcancel":"mouseup",ee=U?"pointerdown":Ee,et=U?"pointermove":ot,Oe=U?"pointerup pointercancel":Ce,jt="ready",ji="resize",Vt="wheel",zt="zoom",$t="image/jpeg",ni=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Wt=/^data:/,Ve=/^data:image\/jpeg;base64,/,$e=/^img|canvas$/i,_r=200,kr=100,Er={viewMode:0,dragMode:L,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:_r,minContainerHeight:kr,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},Js='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',Qs=Number.isNaN||F.isNaN;function oe(y){return typeof y=="number"&&!Qs(y)}o(oe,"isNumber");var Fr=o(function(h){return h>0&&h<1/0},"isPositiveNumber");function zi(y){return typeof y>"u"}o(zi,"isUndefined");function Ft(y){return s(y)==="object"&&y!==null}o(Ft,"isObject");var kn=Object.prototype.hasOwnProperty;function Gt(y){if(!Ft(y))return!1;try{var h=y.constructor,g=h.prototype;return h&&g&&kn.call(g,"isPrototypeOf")}catch{return!1}}o(Gt,"isPlainObject");function tt(y){return typeof y=="function"}o(tt,"isFunction");var En=Array.prototype.slice;function Hi(y){return Array.from?Array.from(y):En.call(y)}o(Hi,"toArray");function Fe(y,h){return y&&tt(h)&&(Array.isArray(y)||oe(y.length)?Hi(y).forEach(function(g,m){h.call(y,g,m,y)}):Ft(y)&&Object.keys(y).forEach(function(g){h.call(y,y[g],g,y)})),y}o(Fe,"forEach");var be=Object.assign||o(function(h){for(var g=arguments.length,m=new Array(g>1?g-1:0),P=1;P<g;P++)m[P-1]=arguments[P];return Ft(h)&&m.length>0&&m.forEach(function(b){Ft(b)&&Object.keys(b).forEach(function(x){h[x]=b[x]})}),h},"assign"),Tr=/\.\d*(?:0|9){12}\d*$/;function Tt(y){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Tr.test(y)?Math.round(y*h)/h:y}o(Tt,"normalizeDecimalNumber");var Zs=/^width|height|left|top|marginLeft|marginTop$/;function _t(y,h){var g=y.style;Fe(h,function(m,P){Zs.test(P)&&oe(m)&&(m="".concat(m,"px")),g[P]=m})}o(_t,"setStyle");function eo(y,h){return y.classList?y.classList.contains(h):y.className.indexOf(h)>-1}o(eo,"hasClass");function Ae(y,h){if(h){if(oe(y.length)){Fe(y,function(m){Ae(m,h)});return}if(y.classList){y.classList.add(h);return}var g=y.className.trim();g?g.indexOf(h)<0&&(y.className="".concat(g," ").concat(h)):y.className=h}}o(Ae,"addClass");function dt(y,h){if(h){if(oe(y.length)){Fe(y,function(g){dt(g,h)});return}if(y.classList){y.classList.remove(h);return}y.className.indexOf(h)>=0&&(y.className=y.className.replace(h,""))}}o(dt,"removeClass");function ai(y,h,g){if(h){if(oe(y.length)){Fe(y,function(m){ai(m,h,g)});return}g?Ae(y,h):dt(y,h)}}o(ai,"toggleClass");var li=/([a-z\d])([A-Z])/g;function qi(y){return y.replace(li,"$1-$2").toLowerCase()}o(qi,"toParamCase");function Vi(y,h){return Ft(y[h])?y[h]:y.dataset?y.dataset[h]:y.getAttribute("data-".concat(qi(h)))}o(Vi,"getData");function vt(y,h,g){Ft(g)?y[h]=g:y.dataset?y.dataset[h]=g:y.setAttribute("data-".concat(qi(h)),g)}o(vt,"setData");function Cr(y,h){if(Ft(y[h]))try{delete y[h]}catch{y[h]=void 0}else if(y.dataset)try{delete y.dataset[h]}catch{y.dataset[h]=void 0}else y.removeAttribute("data-".concat(qi(h)))}o(Cr,"removeData");var Kt=/\s\s*/,Tu=(function(){var y=!1;if(A){var h=!1,g=o(function(){},"listener"),m=Object.defineProperty({},"once",{get:o(function(){return y=!0,h},"get"),set:o(function(b){h=b},"set")});F.addEventListener("test",g,m),F.removeEventListener("test",g,m)}return y})();function kt(y,h,g){var m=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},P=g;h.trim().split(Kt).forEach(function(b){if(!Tu){var x=y.listeners;x&&x[b]&&x[b][g]&&(P=x[b][g],delete x[b][g],Object.keys(x[b]).length===0&&delete x[b],Object.keys(x).length===0&&delete y.listeners)}y.removeEventListener(b,P,m)})}o(kt,"removeListener");function bt(y,h,g){var m=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},P=g;h.trim().split(Kt).forEach(function(b){if(m.once&&!Tu){var x=y.listeners,D=x===void 0?{}:x;P=o(function(){delete D[b][g],y.removeEventListener(b,P,m);for(var z=arguments.length,N=new Array(z),M=0;M<z;M++)N[M]=arguments[M];g.apply(y,N)},"handler"),D[b]||(D[b]={}),D[b][g]&&y.removeEventListener(b,D[b][g],m),D[b][g]=P,y.listeners=D}y.addEventListener(b,P,m)})}o(bt,"addListener");function $i(y,h,g){var m;return tt(Event)&&tt(CustomEvent)?m=new CustomEvent(h,{detail:g,bubbles:!0,cancelable:!0}):(m=document.createEvent("CustomEvent"),m.initCustomEvent(h,!0,!0,g)),y.dispatchEvent(m)}o($i,"dispatchEvent");function Cu(y){var h=y.getBoundingClientRect();return{left:h.left+(window.pageXOffset-document.documentElement.clientLeft),top:h.top+(window.pageYOffset-document.documentElement.clientTop)}}o(Cu,"getOffset");var Fn=F.location,bg=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function Au(y){var h=y.match(bg);return h!==null&&(h[1]!==Fn.protocol||h[2]!==Fn.hostname||h[3]!==Fn.port)}o(Au,"isCrossOriginURL");function Ru(y){var h="timestamp=".concat(new Date().getTime());return y+(y.indexOf("?")===-1?"?":"&")+h}o(Ru,"addTimestamp");function Ar(y){var h=y.rotate,g=y.scaleX,m=y.scaleY,P=y.translateX,b=y.translateY,x=[];oe(P)&&P!==0&&x.push("translateX(".concat(P,"px)")),oe(b)&&b!==0&&x.push("translateY(".concat(b,"px)")),oe(h)&&h!==0&&x.push("rotate(".concat(h,"deg)")),oe(g)&&g!==1&&x.push("scaleX(".concat(g,")")),oe(m)&&m!==1&&x.push("scaleY(".concat(m,")"));var D=x.length?x.join(" "):"none";return{WebkitTransform:D,msTransform:D,transform:D}}o(Ar,"getTransforms");function wg(y){var h=e({},y),g=0;return Fe(y,function(m,P){delete h[P],Fe(h,function(b){var x=Math.abs(m.startX-b.startX),D=Math.abs(m.startY-b.startY),W=Math.abs(m.endX-b.endX),z=Math.abs(m.endY-b.endY),N=Math.sqrt(x*x+D*D),M=Math.sqrt(W*W+z*z),V=(M-N)/N;Math.abs(V)>Math.abs(g)&&(g=V)})}),g}o(wg,"getMaxZoomRatio");function to(y,h){var g=y.pageX,m=y.pageY,P={endX:g,endY:m};return h?P:e({startX:g,startY:m},P)}o(to,"getPointer");function Sg(y){var h=0,g=0,m=0;return Fe(y,function(P){var b=P.startX,x=P.startY;h+=b,g+=x,m+=1}),h/=m,g/=m,{pageX:h,pageY:g}}o(Sg,"getPointersCenter");function Xt(y){var h=y.aspectRatio,g=y.height,m=y.width,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",b=Fr(m),x=Fr(g);if(b&&x){var D=g*h;P==="contain"&&D>m||P==="cover"&&D<m?g=m/h:m=g*h}else b?g=m/h:x&&(m=g*h);return{width:m,height:g}}o(Xt,"getAdjustedSizes");function xg(y){var h=y.width,g=y.height,m=y.degree;if(m=Math.abs(m)%180,m===90)return{width:g,height:h};var P=m%90*Math.PI/180,b=Math.sin(P),x=Math.cos(P),D=h*x+g*b,W=h*b+g*x;return m>90?{width:W,height:D}:{width:D,height:W}}o(xg,"getRotatedSizes");function Pg(y,h,g,m){var P=h.aspectRatio,b=h.naturalWidth,x=h.naturalHeight,D=h.rotate,W=D===void 0?0:D,z=h.scaleX,N=z===void 0?1:z,M=h.scaleY,V=M===void 0?1:M,ce=g.aspectRatio,le=g.naturalWidth,ke=g.naturalHeight,de=m.fillColor,Le=de===void 0?"transparent":de,We=m.imageSmoothingEnabled,De=We===void 0?!0:We,Ht=m.imageSmoothingQuality,ht=Ht===void 0?"low":Ht,G=m.maxWidth,he=G===void 0?1/0:G,Be=m.maxHeight,wt=Be===void 0?1/0:Be,qt=m.minWidth,ui=qt===void 0?0:qt,ci=m.minHeight,Yt=ci===void 0?0:ci,Ct=document.createElement("canvas"),lt=Ct.getContext("2d"),pi=Xt({aspectRatio:ce,width:he,height:wt}),io=Xt({aspectRatio:ce,width:ui,height:Yt},"cover"),Tn=Math.min(pi.width,Math.max(io.width,le)),Cn=Math.min(pi.height,Math.max(io.height,ke)),Du=Xt({aspectRatio:P,width:he,height:wt}),Iu=Xt({aspectRatio:P,width:ui,height:Yt},"cover"),Nu=Math.min(Du.width,Math.max(Iu.width,b)),Mu=Math.min(Du.height,Math.max(Iu.height,x)),Mg=[-Nu/2,-Mu/2,Nu,Mu];return Ct.width=Tt(Tn),Ct.height=Tt(Cn),lt.fillStyle=Le,lt.fillRect(0,0,Tn,Cn),lt.save(),lt.translate(Tn/2,Cn/2),lt.rotate(W*Math.PI/180),lt.scale(N,V),lt.imageSmoothingEnabled=De,lt.imageSmoothingQuality=ht,lt.drawImage.apply(lt,[y].concat(p(Mg.map(function(Lg){return Math.floor(Tt(Lg))})))),lt.restore(),Ct}o(Pg,"getSourceCanvas");var Uu=String.fromCharCode;function _g(y,h,g){var m="";g+=h;for(var P=h;P<g;P+=1)m+=Uu(y.getUint8(P));return m}o(_g,"getStringFromCharCode");var kg=/^data:.*,/;function Eg(y){var h=y.replace(kg,""),g=atob(h),m=new ArrayBuffer(g.length),P=new Uint8Array(m);return Fe(P,function(b,x){P[x]=g.charCodeAt(x)}),m}o(Eg,"dataURLToArrayBuffer");function Fg(y,h){for(var g=[],m=8192,P=new Uint8Array(y);P.length>0;)g.push(Uu.apply(null,Hi(P.subarray(0,m)))),P=P.subarray(m);return"data:".concat(h,";base64,").concat(btoa(g.join("")))}o(Fg,"arrayBufferToDataURL");function Tg(y){var h=new DataView(y),g;try{var m,P,b;if(h.getUint8(0)===255&&h.getUint8(1)===216)for(var x=h.byteLength,D=2;D+1<x;){if(h.getUint8(D)===255&&h.getUint8(D+1)===225){P=D;break}D+=1}if(P){var W=P+4,z=P+10;if(_g(h,W,4)==="Exif"){var N=h.getUint16(z);if(m=N===18761,(m||N===19789)&&h.getUint16(z+2,m)===42){var M=h.getUint32(z+4,m);M>=8&&(b=z+M)}}}if(b){var V=h.getUint16(b,m),ce,le;for(le=0;le<V;le+=1)if(ce=b+le*12+2,h.getUint16(ce,m)===274){ce+=8,g=h.getUint16(ce,m),h.setUint16(ce,1,m);break}}}catch{g=1}return g}o(Tg,"resetAndGetOrientation");function Cg(y){var h=0,g=1,m=1;switch(y){case 2:g=-1;break;case 3:h=-180;break;case 4:m=-1;break;case 5:h=90,m=-1;break;case 6:h=90;break;case 7:h=90,g=-1;break;case 8:h=-90;break}return{rotate:h,scaleX:g,scaleY:m}}o(Cg,"parseOrientation");var Ag={render:o(function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},"render"),initContainer:o(function(){var h=this.element,g=this.options,m=this.container,P=this.cropper,b=Number(g.minContainerWidth),x=Number(g.minContainerHeight);Ae(P,S),dt(h,S);var D={width:Math.max(m.offsetWidth,b>=0?b:_r),height:Math.max(m.offsetHeight,x>=0?x:kr)};this.containerData=D,_t(P,{width:D.width,height:D.height}),Ae(h,S),dt(P,S)},"initContainer"),initCanvas:o(function(){var h=this.containerData,g=this.imageData,m=this.options.viewMode,P=Math.abs(g.rotate)%180===90,b=P?g.naturalHeight:g.naturalWidth,x=P?g.naturalWidth:g.naturalHeight,D=b/x,W=h.width,z=h.height;h.height*D>h.width?m===3?W=h.height*D:z=h.width/D:m===3?z=h.width/D:W=h.height*D;var N={aspectRatio:D,naturalWidth:b,naturalHeight:x,width:W,height:z};this.canvasData=N,this.limited=m===1||m===2,this.limitCanvas(!0,!0),N.width=Math.min(Math.max(N.width,N.minWidth),N.maxWidth),N.height=Math.min(Math.max(N.height,N.minHeight),N.maxHeight),N.left=(h.width-N.width)/2,N.top=(h.height-N.height)/2,N.oldLeft=N.left,N.oldTop=N.top,this.initialCanvasData=be({},N)},"initCanvas"),limitCanvas:o(function(h,g){var m=this.options,P=this.containerData,b=this.canvasData,x=this.cropBoxData,D=m.viewMode,W=b.aspectRatio,z=this.cropped&&x;if(h){var N=Number(m.minCanvasWidth)||0,M=Number(m.minCanvasHeight)||0;D>1?(N=Math.max(N,P.width),M=Math.max(M,P.height),D===3&&(M*W>N?N=M*W:M=N/W)):D>0&&(N?N=Math.max(N,z?x.width:0):M?M=Math.max(M,z?x.height:0):z&&(N=x.width,M=x.height,M*W>N?N=M*W:M=N/W));var V=Xt({aspectRatio:W,width:N,height:M});N=V.width,M=V.height,b.minWidth=N,b.minHeight=M,b.maxWidth=1/0,b.maxHeight=1/0}if(g)if(D>(z?0:1)){var ce=P.width-b.width,le=P.height-b.height;b.minLeft=Math.min(0,ce),b.minTop=Math.min(0,le),b.maxLeft=Math.max(0,ce),b.maxTop=Math.max(0,le),z&&this.limited&&(b.minLeft=Math.min(x.left,x.left+(x.width-b.width)),b.minTop=Math.min(x.top,x.top+(x.height-b.height)),b.maxLeft=x.left,b.maxTop=x.top,D===2&&(b.width>=P.width&&(b.minLeft=Math.min(0,ce),b.maxLeft=Math.max(0,ce)),b.height>=P.height&&(b.minTop=Math.min(0,le),b.maxTop=Math.max(0,le))))}else b.minLeft=-b.width,b.minTop=-b.height,b.maxLeft=P.width,b.maxTop=P.height},"limitCanvas"),renderCanvas:o(function(h,g){var m=this.canvasData,P=this.imageData;if(g){var b=xg({width:P.naturalWidth*Math.abs(P.scaleX||1),height:P.naturalHeight*Math.abs(P.scaleY||1),degree:P.rotate||0}),x=b.width,D=b.height,W=m.width*(x/m.naturalWidth),z=m.height*(D/m.naturalHeight);m.left-=(W-m.width)/2,m.top-=(z-m.height)/2,m.width=W,m.height=z,m.aspectRatio=x/D,m.naturalWidth=x,m.naturalHeight=D,this.limitCanvas(!0,!1)}(m.width>m.maxWidth||m.width<m.minWidth)&&(m.left=m.oldLeft),(m.height>m.maxHeight||m.height<m.minHeight)&&(m.top=m.oldTop),m.width=Math.min(Math.max(m.width,m.minWidth),m.maxWidth),m.height=Math.min(Math.max(m.height,m.minHeight),m.maxHeight),this.limitCanvas(!1,!0),m.left=Math.min(Math.max(m.left,m.minLeft),m.maxLeft),m.top=Math.min(Math.max(m.top,m.minTop),m.maxTop),m.oldLeft=m.left,m.oldTop=m.top,_t(this.canvas,be({width:m.width,height:m.height},Ar({translateX:m.left,translateY:m.top}))),this.renderImage(h),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},"renderCanvas"),renderImage:o(function(h){var g=this.canvasData,m=this.imageData,P=m.naturalWidth*(g.width/g.naturalWidth),b=m.naturalHeight*(g.height/g.naturalHeight);be(m,{width:P,height:b,left:(g.width-P)/2,top:(g.height-b)/2}),_t(this.image,be({width:m.width,height:m.height},Ar(be({translateX:m.left,translateY:m.top},m)))),h&&this.output()},"renderImage"),initCropBox:o(function(){var h=this.options,g=this.canvasData,m=h.aspectRatio||h.initialAspectRatio,P=Number(h.autoCropArea)||.8,b={width:g.width,height:g.height};m&&(g.height*m>g.width?b.height=b.width/m:b.width=b.height*m),this.cropBoxData=b,this.limitCropBox(!0,!0),b.width=Math.min(Math.max(b.width,b.minWidth),b.maxWidth),b.height=Math.min(Math.max(b.height,b.minHeight),b.maxHeight),b.width=Math.max(b.minWidth,b.width*P),b.height=Math.max(b.minHeight,b.height*P),b.left=g.left+(g.width-b.width)/2,b.top=g.top+(g.height-b.height)/2,b.oldLeft=b.left,b.oldTop=b.top,this.initialCropBoxData=be({},b)},"initCropBox"),limitCropBox:o(function(h,g){var m=this.options,P=this.containerData,b=this.canvasData,x=this.cropBoxData,D=this.limited,W=m.aspectRatio;if(h){var z=Number(m.minCropBoxWidth)||0,N=Number(m.minCropBoxHeight)||0,M=D?Math.min(P.width,b.width,b.width+b.left,P.width-b.left):P.width,V=D?Math.min(P.height,b.height,b.height+b.top,P.height-b.top):P.height;z=Math.min(z,P.width),N=Math.min(N,P.height),W&&(z&&N?N*W>z?N=z/W:z=N*W:z?N=z/W:N&&(z=N*W),V*W>M?V=M/W:M=V*W),x.minWidth=Math.min(z,M),x.minHeight=Math.min(N,V),x.maxWidth=M,x.maxHeight=V}g&&(D?(x.minLeft=Math.max(0,b.left),x.minTop=Math.max(0,b.top),x.maxLeft=Math.min(P.width,b.left+b.width)-x.width,x.maxTop=Math.min(P.height,b.top+b.height)-x.height):(x.minLeft=0,x.minTop=0,x.maxLeft=P.width-x.width,x.maxTop=P.height-x.height))},"limitCropBox"),renderCropBox:o(function(){var h=this.options,g=this.containerData,m=this.cropBoxData;(m.width>m.maxWidth||m.width<m.minWidth)&&(m.left=m.oldLeft),(m.height>m.maxHeight||m.height<m.minHeight)&&(m.top=m.oldTop),m.width=Math.min(Math.max(m.width,m.minWidth),m.maxWidth),m.height=Math.min(Math.max(m.height,m.minHeight),m.maxHeight),this.limitCropBox(!1,!0),m.left=Math.min(Math.max(m.left,m.minLeft),m.maxLeft),m.top=Math.min(Math.max(m.top,m.minTop),m.maxTop),m.oldLeft=m.left,m.oldTop=m.top,h.movable&&h.cropBoxMovable&&vt(this.face,T,m.width>=g.width&&m.height>=g.height?H:Y),_t(this.cropBox,be({width:m.width,height:m.height},Ar({translateX:m.left,translateY:m.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},"renderCropBox"),output:o(function(){this.preview(),$i(this.element,ne,this.getData())},"output")},Rg={initPreview:o(function(){var h=this.element,g=this.crossOrigin,m=this.options.preview,P=g?this.crossOriginUrl:this.url,b=h.alt||"The image to preview",x=document.createElement("img");if(g&&(x.crossOrigin=g),x.src=P,x.alt=b,this.viewBox.appendChild(x),this.viewBoxImage=x,!!m){var D=m;typeof m=="string"?D=h.ownerDocument.querySelectorAll(m):m.querySelector&&(D=[m]),this.previews=D,Fe(D,function(W){var z=document.createElement("img");vt(W,O,{width:W.offsetWidth,height:W.offsetHeight,html:W.innerHTML}),g&&(z.crossOrigin=g),z.src=P,z.alt=b,z.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',W.innerHTML="",W.appendChild(z)})}},"initPreview"),resetPreview:o(function(){Fe(this.previews,function(h){var g=Vi(h,O);_t(h,{width:g.width,height:g.height}),h.innerHTML=g.html,Cr(h,O)})},"resetPreview"),preview:o(function(){var h=this.imageData,g=this.canvasData,m=this.cropBoxData,P=m.width,b=m.height,x=h.width,D=h.height,W=m.left-g.left-h.left,z=m.top-g.top-h.top;!this.cropped||this.disabled||(_t(this.viewBoxImage,be({width:x,height:D},Ar(be({translateX:-W,translateY:-z},h)))),Fe(this.previews,function(N){var M=Vi(N,O),V=M.width,ce=M.height,le=V,ke=ce,de=1;P&&(de=V/P,ke=b*de),b&&ke>ce&&(de=ce/b,le=P*de,ke=ce),_t(N,{width:le,height:ke}),_t(N.getElementsByTagName("img")[0],be({width:x*de,height:D*de},Ar(be({translateX:-W*de,translateY:-z*de},h))))}))},"preview")},Ug={bind:o(function(){var h=this.element,g=this.options,m=this.cropper;tt(g.cropstart)&&bt(h,ie,g.cropstart),tt(g.cropmove)&&bt(h,te,g.cropmove),tt(g.cropend)&&bt(h,ue,g.cropend),tt(g.crop)&&bt(h,ne,g.crop),tt(g.zoom)&&bt(h,zt,g.zoom),bt(m,ee,this.onCropStart=this.cropStart.bind(this)),g.zoomable&&g.zoomOnWheel&&bt(m,Vt,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),g.toggleDragModeOnDblclick&&bt(m,xe,this.onDblclick=this.dblclick.bind(this)),bt(h.ownerDocument,et,this.onCropMove=this.cropMove.bind(this)),bt(h.ownerDocument,Oe,this.onCropEnd=this.cropEnd.bind(this)),g.responsive&&bt(window,ji,this.onResize=this.resize.bind(this))},"bind"),unbind:o(function(){var h=this.element,g=this.options,m=this.cropper;tt(g.cropstart)&&kt(h,ie,g.cropstart),tt(g.cropmove)&&kt(h,te,g.cropmove),tt(g.cropend)&&kt(h,ue,g.cropend),tt(g.crop)&&kt(h,ne,g.crop),tt(g.zoom)&&kt(h,zt,g.zoom),kt(m,ee,this.onCropStart),g.zoomable&&g.zoomOnWheel&&kt(m,Vt,this.onWheel,{passive:!1,capture:!0}),g.toggleDragModeOnDblclick&&kt(m,xe,this.onDblclick),kt(h.ownerDocument,et,this.onCropMove),kt(h.ownerDocument,Oe,this.onCropEnd),g.responsive&&kt(window,ji,this.onResize)},"unbind")},Og={resize:o(function(){if(!this.disabled){var h=this.options,g=this.container,m=this.containerData,P=g.offsetWidth/m.width,b=g.offsetHeight/m.height,x=Math.abs(P-1)>Math.abs(b-1)?P:b;if(x!==1){var D,W;h.restore&&(D=this.getCanvasData(),W=this.getCropBoxData()),this.render(),h.restore&&(this.setCanvasData(Fe(D,function(z,N){D[N]=z*x})),this.setCropBoxData(Fe(W,function(z,N){W[N]=z*x})))}}},"resize"),dblclick:o(function(){this.disabled||this.options.dragMode===J||this.setDragMode(eo(this.dragBox,E)?X:L)},"dblclick"),wheel:o(function(h){var g=this,m=Number(this.options.wheelZoomRatio)||.1,P=1;this.disabled||(h.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){g.wheeling=!1},50),h.deltaY?P=h.deltaY>0?1:-1:h.wheelDelta?P=-h.wheelDelta/120:h.detail&&(P=h.detail>0?1:-1),this.zoom(-P*m,h)))},"wheel"),cropStart:o(function(h){var g=h.buttons,m=h.button;if(!(this.disabled||(h.type==="mousedown"||h.type==="pointerdown"&&h.pointerType==="mouse")&&(oe(g)&&g!==1||oe(m)&&m!==0||h.ctrlKey))){var P=this.options,b=this.pointers,x;h.changedTouches?Fe(h.changedTouches,function(D){b[D.identifier]=to(D)}):b[h.pointerId||0]=to(h),Object.keys(b).length>1&&P.zoomable&&P.zoomOnTouch?x=Q:x=Vi(h.target,T),ni.test(x)&&$i(this.element,ie,{originalEvent:h,action:x})!==!1&&(h.preventDefault(),this.action=x,this.cropping=!1,x===$&&(this.cropping=!0,Ae(this.dragBox,j)))}},"cropStart"),cropMove:o(function(h){var g=this.action;if(!(this.disabled||!g)){var m=this.pointers;h.preventDefault(),$i(this.element,te,{originalEvent:h,action:g})!==!1&&(h.changedTouches?Fe(h.changedTouches,function(P){be(m[P.identifier]||{},to(P,!0))}):be(m[h.pointerId||0]||{},to(h,!0)),this.change(h))}},"cropMove"),cropEnd:o(function(h){if(!this.disabled){var g=this.action,m=this.pointers;h.changedTouches?Fe(h.changedTouches,function(P){delete m[P.identifier]}):delete m[h.pointerId||0],g&&(h.preventDefault(),Object.keys(m).length||(this.action=""),this.cropping&&(this.cropping=!1,ai(this.dragBox,j,this.cropped&&this.options.modal)),$i(this.element,ue,{originalEvent:h,action:g}))}},"cropEnd")},Dg={change:o(function(h){var g=this.options,m=this.canvasData,P=this.containerData,b=this.cropBoxData,x=this.pointers,D=this.action,W=g.aspectRatio,z=b.left,N=b.top,M=b.width,V=b.height,ce=z+M,le=N+V,ke=0,de=0,Le=P.width,We=P.height,De=!0,Ht;!W&&h.shiftKey&&(W=M&&V?M/V:1),this.limited&&(ke=b.minLeft,de=b.minTop,Le=ke+Math.min(P.width,m.width,m.left+m.width),We=de+Math.min(P.height,m.height,m.top+m.height));var ht=x[Object.keys(x)[0]],G={x:ht.endX-ht.startX,y:ht.endY-ht.startY},he=o(function(wt){switch(wt){case K:ce+G.x>Le&&(G.x=Le-ce);break;case Z:z+G.x<ke&&(G.x=ke-z);break;case se:N+G.y<de&&(G.y=de-N);break;case ye:le+G.y>We&&(G.y=We-le);break}},"check");switch(D){case Y:z+=G.x,N+=G.y;break;case K:if(G.x>=0&&(ce>=Le||W&&(N<=de||le>=We))){De=!1;break}he(K),M+=G.x,M<0&&(D=Z,M=-M,z-=M),W&&(V=M/W,N+=(b.height-V)/2);break;case se:if(G.y<=0&&(N<=de||W&&(z<=ke||ce>=Le))){De=!1;break}he(se),V-=G.y,N+=G.y,V<0&&(D=ye,V=-V,N-=V),W&&(M=V*W,z+=(b.width-M)/2);break;case Z:if(G.x<=0&&(z<=ke||W&&(N<=de||le>=We))){De=!1;break}he(Z),M-=G.x,z+=G.x,M<0&&(D=K,M=-M,z-=M),W&&(V=M/W,N+=(b.height-V)/2);break;case ye:if(G.y>=0&&(le>=We||W&&(z<=ke||ce>=Le))){De=!1;break}he(ye),V+=G.y,V<0&&(D=se,V=-V,N-=V),W&&(M=V*W,z+=(b.width-M)/2);break;case we:if(W){if(G.y<=0&&(N<=de||ce>=Le)){De=!1;break}he(se),V-=G.y,N+=G.y,M=V*W}else he(se),he(K),G.x>=0?ce<Le?M+=G.x:G.y<=0&&N<=de&&(De=!1):M+=G.x,G.y<=0?N>de&&(V-=G.y,N+=G.y):(V-=G.y,N+=G.y);M<0&&V<0?(D=ve,V=-V,M=-M,N-=V,z-=M):M<0?(D=me,M=-M,z-=M):V<0&&(D=_e,V=-V,N-=V);break;case me:if(W){if(G.y<=0&&(N<=de||z<=ke)){De=!1;break}he(se),V-=G.y,N+=G.y,M=V*W,z+=b.width-M}else he(se),he(Z),G.x<=0?z>ke?(M-=G.x,z+=G.x):G.y<=0&&N<=de&&(De=!1):(M-=G.x,z+=G.x),G.y<=0?N>de&&(V-=G.y,N+=G.y):(V-=G.y,N+=G.y);M<0&&V<0?(D=_e,V=-V,M=-M,N-=V,z-=M):M<0?(D=we,M=-M,z-=M):V<0&&(D=ve,V=-V,N-=V);break;case ve:if(W){if(G.x<=0&&(z<=ke||le>=We)){De=!1;break}he(Z),M-=G.x,z+=G.x,V=M/W}else he(ye),he(Z),G.x<=0?z>ke?(M-=G.x,z+=G.x):G.y>=0&&le>=We&&(De=!1):(M-=G.x,z+=G.x),G.y>=0?le<We&&(V+=G.y):V+=G.y;M<0&&V<0?(D=we,V=-V,M=-M,N-=V,z-=M):M<0?(D=_e,M=-M,z-=M):V<0&&(D=me,V=-V,N-=V);break;case _e:if(W){if(G.x>=0&&(ce>=Le||le>=We)){De=!1;break}he(K),M+=G.x,V=M/W}else he(ye),he(K),G.x>=0?ce<Le?M+=G.x:G.y>=0&&le>=We&&(De=!1):M+=G.x,G.y>=0?le<We&&(V+=G.y):V+=G.y;M<0&&V<0?(D=me,V=-V,M=-M,N-=V,z-=M):M<0?(D=ve,M=-M,z-=M):V<0&&(D=we,V=-V,N-=V);break;case H:this.move(G.x,G.y),De=!1;break;case Q:this.zoom(wg(x),h),De=!1;break;case $:if(!G.x||!G.y){De=!1;break}Ht=Cu(this.cropper),z=ht.startX-Ht.left,N=ht.startY-Ht.top,M=b.minWidth,V=b.minHeight,G.x>0?D=G.y>0?_e:we:G.x<0&&(z-=M,D=G.y>0?ve:me),G.y<0&&(N-=V),this.cropped||(dt(this.cropBox,S),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}De&&(b.width=M,b.height=V,b.left=z,b.top=N,this.action=D,this.renderCropBox()),Fe(x,function(Be){Be.startX=Be.endX,Be.startY=Be.endY})},"change")},Ig={crop:o(function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Ae(this.dragBox,j),dt(this.cropBox,S),this.setCropBoxData(this.initialCropBoxData)),this},"crop"),reset:o(function(){return this.ready&&!this.disabled&&(this.imageData=be({},this.initialImageData),this.canvasData=be({},this.initialCanvasData),this.cropBoxData=be({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},"reset"),clear:o(function(){return this.cropped&&!this.disabled&&(be(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),dt(this.dragBox,j),Ae(this.cropBox,S)),this},"clear"),replace:o(function(h){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&h&&(this.isImg&&(this.element.src=h),g?(this.url=h,this.image.src=h,this.ready&&(this.viewBoxImage.src=h,Fe(this.previews,function(m){m.getElementsByTagName("img")[0].src=h}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(h))),this},"replace"),enable:o(function(){return this.ready&&this.disabled&&(this.disabled=!1,dt(this.cropper,w)),this},"enable"),disable:o(function(){return this.ready&&!this.disabled&&(this.disabled=!0,Ae(this.cropper,w)),this},"disable"),destroy:o(function(){var h=this.element;return h[C]?(h[C]=void 0,this.isImg&&this.replaced&&(h.src=this.originalUrl),this.uncreate(),this):this},"destroy"),move:o(function(h){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h,m=this.canvasData,P=m.left,b=m.top;return this.moveTo(zi(h)?h:P+Number(h),zi(g)?g:b+Number(g))},"move"),moveTo:o(function(h){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h,m=this.canvasData,P=!1;return h=Number(h),g=Number(g),this.ready&&!this.disabled&&this.options.movable&&(oe(h)&&(m.left=h,P=!0),oe(g)&&(m.top=g,P=!0),P&&this.renderCanvas(!0)),this},"moveTo"),zoom:o(function(h,g){var m=this.canvasData;return h=Number(h),h<0?h=1/(1-h):h=1+h,this.zoomTo(m.width*h/m.naturalWidth,null,g)},"zoom"),zoomTo:o(function(h,g,m){var P=this.options,b=this.canvasData,x=b.width,D=b.height,W=b.naturalWidth,z=b.naturalHeight;if(h=Number(h),h>=0&&this.ready&&!this.disabled&&P.zoomable){var N=W*h,M=z*h;if($i(this.element,zt,{ratio:h,oldRatio:x/W,originalEvent:m})===!1)return this;if(m){var V=this.pointers,ce=Cu(this.cropper),le=V&&Object.keys(V).length?Sg(V):{pageX:m.pageX,pageY:m.pageY};b.left-=(N-x)*((le.pageX-ce.left-b.left)/x),b.top-=(M-D)*((le.pageY-ce.top-b.top)/D)}else Gt(g)&&oe(g.x)&&oe(g.y)?(b.left-=(N-x)*((g.x-b.left)/x),b.top-=(M-D)*((g.y-b.top)/D)):(b.left-=(N-x)/2,b.top-=(M-D)/2);b.width=N,b.height=M,this.renderCanvas(!0)}return this},"zoomTo"),rotate:o(function(h){return this.rotateTo((this.imageData.rotate||0)+Number(h))},"rotate"),rotateTo:o(function(h){return h=Number(h),oe(h)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=h%360,this.renderCanvas(!0,!0)),this},"rotateTo"),scaleX:o(function(h){var g=this.imageData.scaleY;return this.scale(h,oe(g)?g:1)},"scaleX"),scaleY:o(function(h){var g=this.imageData.scaleX;return this.scale(oe(g)?g:1,h)},"scaleY"),scale:o(function(h){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h,m=this.imageData,P=!1;return h=Number(h),g=Number(g),this.ready&&!this.disabled&&this.options.scalable&&(oe(h)&&(m.scaleX=h,P=!0),oe(g)&&(m.scaleY=g,P=!0),P&&this.renderCanvas(!0,!0)),this},"scale"),getData:o(function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,g=this.options,m=this.imageData,P=this.canvasData,b=this.cropBoxData,x;if(this.ready&&this.cropped){x={x:b.left-P.left,y:b.top-P.top,width:b.width,height:b.height};var D=m.width/m.naturalWidth;if(Fe(x,function(N,M){x[M]=N/D}),h){var W=Math.round(x.y+x.height),z=Math.round(x.x+x.width);x.x=Math.round(x.x),x.y=Math.round(x.y),x.width=z-x.x,x.height=W-x.y}}else x={x:0,y:0,width:0,height:0};return g.rotatable&&(x.rotate=m.rotate||0),g.scalable&&(x.scaleX=m.scaleX||1,x.scaleY=m.scaleY||1),x},"getData"),setData:o(function(h){var g=this.options,m=this.imageData,P=this.canvasData,b={};if(this.ready&&!this.disabled&&Gt(h)){var x=!1;g.rotatable&&oe(h.rotate)&&h.rotate!==m.rotate&&(m.rotate=h.rotate,x=!0),g.scalable&&(oe(h.scaleX)&&h.scaleX!==m.scaleX&&(m.scaleX=h.scaleX,x=!0),oe(h.scaleY)&&h.scaleY!==m.scaleY&&(m.scaleY=h.scaleY,x=!0)),x&&this.renderCanvas(!0,!0);var D=m.width/m.naturalWidth;oe(h.x)&&(b.left=h.x*D+P.left),oe(h.y)&&(b.top=h.y*D+P.top),oe(h.width)&&(b.width=h.width*D),oe(h.height)&&(b.height=h.height*D),this.setCropBoxData(b)}return this},"setData"),getContainerData:o(function(){return this.ready?be({},this.containerData):{}},"getContainerData"),getImageData:o(function(){return this.sized?be({},this.imageData):{}},"getImageData"),getCanvasData:o(function(){var h=this.canvasData,g={};return this.ready&&Fe(["left","top","width","height","naturalWidth","naturalHeight"],function(m){g[m]=h[m]}),g},"getCanvasData"),setCanvasData:o(function(h){var g=this.canvasData,m=g.aspectRatio;return this.ready&&!this.disabled&&Gt(h)&&(oe(h.left)&&(g.left=h.left),oe(h.top)&&(g.top=h.top),oe(h.width)?(g.width=h.width,g.height=h.width/m):oe(h.height)&&(g.height=h.height,g.width=h.height*m),this.renderCanvas(!0)),this},"setCanvasData"),getCropBoxData:o(function(){var h=this.cropBoxData,g;return this.ready&&this.cropped&&(g={left:h.left,top:h.top,width:h.width,height:h.height}),g||{}},"getCropBoxData"),setCropBoxData:o(function(h){var g=this.cropBoxData,m=this.options.aspectRatio,P,b;return this.ready&&this.cropped&&!this.disabled&&Gt(h)&&(oe(h.left)&&(g.left=h.left),oe(h.top)&&(g.top=h.top),oe(h.width)&&h.width!==g.width&&(P=!0,g.width=h.width),oe(h.height)&&h.height!==g.height&&(b=!0,g.height=h.height),m&&(P?g.height=g.width/m:b&&(g.width=g.height*m)),this.renderCropBox()),this},"setCropBoxData"),getCroppedCanvas:o(function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var g=this.canvasData,m=Pg(this.image,this.imageData,g,h);if(!this.cropped)return m;var P=this.getData(h.rounded),b=P.x,x=P.y,D=P.width,W=P.height,z=m.width/Math.floor(g.naturalWidth);z!==1&&(b*=z,x*=z,D*=z,W*=z);var N=D/W,M=Xt({aspectRatio:N,width:h.maxWidth||1/0,height:h.maxHeight||1/0}),V=Xt({aspectRatio:N,width:h.minWidth||0,height:h.minHeight||0},"cover"),ce=Xt({aspectRatio:N,width:h.width||(z!==1?m.width:D),height:h.height||(z!==1?m.height:W)}),le=ce.width,ke=ce.height;le=Math.min(M.width,Math.max(V.width,le)),ke=Math.min(M.height,Math.max(V.height,ke));var de=document.createElement("canvas"),Le=de.getContext("2d");de.width=Tt(le),de.height=Tt(ke),Le.fillStyle=h.fillColor||"transparent",Le.fillRect(0,0,le,ke);var We=h.imageSmoothingEnabled,De=We===void 0?!0:We,Ht=h.imageSmoothingQuality;Le.imageSmoothingEnabled=De,Ht&&(Le.imageSmoothingQuality=Ht);var ht=m.width,G=m.height,he=b,Be=x,wt,qt,ui,ci,Yt,Ct;he<=-D||he>ht?(he=0,wt=0,ui=0,Yt=0):he<=0?(ui=-he,he=0,wt=Math.min(ht,D+he),Yt=wt):he<=ht&&(ui=0,wt=Math.min(D,ht-he),Yt=wt),wt<=0||Be<=-W||Be>G?(Be=0,qt=0,ci=0,Ct=0):Be<=0?(ci=-Be,Be=0,qt=Math.min(G,W+Be),Ct=qt):Be<=G&&(ci=0,qt=Math.min(W,G-Be),Ct=qt);var lt=[he,Be,wt,qt];if(Yt>0&&Ct>0){var pi=le/D;lt.push(ui*pi,ci*pi,Yt*pi,Ct*pi)}return Le.drawImage.apply(Le,[m].concat(p(lt.map(function(io){return Math.floor(Tt(io))})))),de},"getCroppedCanvas"),setAspectRatio:o(function(h){var g=this.options;return!this.disabled&&!zi(h)&&(g.aspectRatio=Math.max(0,h)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},"setAspectRatio"),setDragMode:o(function(h){var g=this.options,m=this.dragBox,P=this.face;if(this.ready&&!this.disabled){var b=h===L,x=g.movable&&h===X;h=b||x?h:J,g.dragMode=h,vt(m,T,h),ai(m,E,b),ai(m,I,x),g.cropBoxMovable||(vt(P,T,h),ai(P,E,b),ai(P,I,x))}return this},"setDragMode")},Ng=F.Cropper,Ou=(function(){function y(h){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n(this,y),!h||!$e.test(h.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=h,this.options=be({},Er,Gt(g)&&g),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return o(y,"Cropper"),u(y,[{key:"init",value:o(function(){var g=this.element,m=g.tagName.toLowerCase(),P;if(!g[C]){if(g[C]=this,m==="img"){if(this.isImg=!0,P=g.getAttribute("src")||"",this.originalUrl=P,!P)return;P=g.src}else m==="canvas"&&window.HTMLCanvasElement&&(P=g.toDataURL());this.load(P)}},"init")},{key:"load",value:o(function(g){var m=this;if(g){this.url=g,this.imageData={};var P=this.element,b=this.options;if(!b.rotatable&&!b.scalable&&(b.checkOrientation=!1),!b.checkOrientation||!window.ArrayBuffer){this.clone();return}if(Wt.test(g)){Ve.test(g)?this.read(Eg(g)):this.clone();return}var x=new XMLHttpRequest,D=this.clone.bind(this);this.reloading=!0,this.xhr=x,x.onabort=D,x.onerror=D,x.ontimeout=D,x.onprogress=function(){x.getResponseHeader("content-type")!==$t&&x.abort()},x.onload=function(){m.read(x.response)},x.onloadend=function(){m.reloading=!1,m.xhr=null},b.checkCrossOrigin&&Au(g)&&P.crossOrigin&&(g=Ru(g)),x.open("GET",g,!0),x.responseType="arraybuffer",x.withCredentials=P.crossOrigin==="use-credentials",x.send()}},"load")},{key:"read",value:o(function(g){var m=this.options,P=this.imageData,b=Tg(g),x=0,D=1,W=1;if(b>1){this.url=Fg(g,$t);var z=Cg(b);x=z.rotate,D=z.scaleX,W=z.scaleY}m.rotatable&&(P.rotate=x),m.scalable&&(P.scaleX=D,P.scaleY=W),this.clone()},"read")},{key:"clone",value:o(function(){var g=this.element,m=this.url,P=g.crossOrigin,b=m;this.options.checkCrossOrigin&&Au(m)&&(P||(P="anonymous"),b=Ru(m)),this.crossOrigin=P,this.crossOriginUrl=b;var x=document.createElement("img");P&&(x.crossOrigin=P),x.src=b||m,x.alt=g.alt||"The image to crop",this.image=x,x.onload=this.start.bind(this),x.onerror=this.stop.bind(this),Ae(x,B),g.parentNode.insertBefore(x,g.nextSibling)},"clone")},{key:"start",value:o(function(){var g=this,m=this.image;m.onload=null,m.onerror=null,this.sizing=!0;var P=F.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(F.navigator.userAgent),b=o(function(z,N){be(g.imageData,{naturalWidth:z,naturalHeight:N,aspectRatio:z/N}),g.initialImageData=be({},g.imageData),g.sizing=!1,g.sized=!0,g.build()},"done");if(m.naturalWidth&&!P){b(m.naturalWidth,m.naturalHeight);return}var x=document.createElement("img"),D=document.body||document.documentElement;this.sizingImage=x,x.onload=function(){b(x.width,x.height),P||D.removeChild(x)},x.src=m.src,P||(x.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",D.appendChild(x))},"start")},{key:"stop",value:o(function(){var g=this.image;g.onload=null,g.onerror=null,g.parentNode.removeChild(g),this.image=null},"stop")},{key:"build",value:o(function(){if(!(!this.sized||this.ready)){var g=this.element,m=this.options,P=this.image,b=g.parentNode,x=document.createElement("div");x.innerHTML=Js;var D=x.querySelector(".".concat(C,"-container")),W=D.querySelector(".".concat(C,"-canvas")),z=D.querySelector(".".concat(C,"-drag-box")),N=D.querySelector(".".concat(C,"-crop-box")),M=N.querySelector(".".concat(C,"-face"));this.container=b,this.cropper=D,this.canvas=W,this.dragBox=z,this.cropBox=N,this.viewBox=D.querySelector(".".concat(C,"-view-box")),this.face=M,W.appendChild(P),Ae(g,S),b.insertBefore(D,g.nextSibling),dt(P,B),this.initPreview(),this.bind(),m.initialAspectRatio=Math.max(0,m.initialAspectRatio)||NaN,m.aspectRatio=Math.max(0,m.aspectRatio)||NaN,m.viewMode=Math.max(0,Math.min(3,Math.round(m.viewMode)))||0,Ae(N,S),m.guides||Ae(N.getElementsByClassName("".concat(C,"-dashed")),S),m.center||Ae(N.getElementsByClassName("".concat(C,"-center")),S),m.background&&Ae(D,"".concat(C,"-bg")),m.highlight||Ae(M,q),m.cropBoxMovable&&(Ae(M,I),vt(M,T,Y)),m.cropBoxResizable||(Ae(N.getElementsByClassName("".concat(C,"-line")),S),Ae(N.getElementsByClassName("".concat(C,"-point")),S)),this.render(),this.ready=!0,this.setDragMode(m.dragMode),m.autoCrop&&this.crop(),this.setData(m.data),tt(m.ready)&&bt(g,jt,m.ready,{once:!0}),$i(g,jt)}},"build")},{key:"unbuild",value:o(function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var g=this.cropper.parentNode;g&&g.removeChild(this.cropper),dt(this.element,S)}},"unbuild")},{key:"uncreate",value:o(function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()},"uncreate")}],[{key:"noConflict",value:o(function(){return window.Cropper=Ng,y},"noConflict")},{key:"setDefaults",value:o(function(g){be(Er,Gt(g)&&g)},"setDefaults")}])})();return be(Ou.prototype,Ag,Rg,Ug,Og,Dg,Ig),Ou}))});var rm=pe((yO,im)=>{"use strict";im.exports=o(function(e,t){if(t=t.split(":")[0],e=+e,!e)return!1;switch(t){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0},"required")});var nm=pe(Wl=>{"use strict";var lw=Object.prototype.hasOwnProperty,uw;function sm(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return null}}o(sm,"decode");function om(i){try{return encodeURIComponent(i)}catch{return null}}o(om,"encode");function cw(i){for(var e=/([^=?#&]+)=?([^&]*)/g,t={},r;r=e.exec(i);){var s=sm(r[1]),n=sm(r[2]);s===null||n===null||s in t||(t[s]=n)}return t}o(cw,"querystring");function pw(i,e){e=e||"";var t=[],r,s;typeof e!="string"&&(e="?");for(s in i)if(lw.call(i,s)){if(r=i[s],!r&&(r===null||r===uw||isNaN(r))&&(r=""),s=om(s),r=om(r),s===null||r===null)continue;t.push(s+"="+r)}return t.length?e+t.join("&"):""}o(pw,"querystringify");Wl.stringify=pw;Wl.parse=cw});var fm=pe((SO,hm)=>{"use strict";var lm=rm(),hn=nm(),dw=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,um=/[\n\r\t]/g,hw=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,cm=/:\d+$/,fw=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,mw=/^[a-zA-Z]:/;function Kl(i){return(i||"").toString().replace(dw,"")}o(Kl,"trimLeft");var Gl=[["#","hash"],["?","query"],o(function(e,t){return Lt(t.protocol)?e.replace(/\\/g,"/"):e},"sanitize"),["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],am={hash:1,query:1};function pm(i){var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e={};var t=e.location||{};i=i||t;var r={},s=typeof i,n;if(i.protocol==="blob:")r=new Bt(unescape(i.pathname),{});else if(s==="string"){r=new Bt(i,{});for(n in am)delete r[n]}else if(s==="object"){for(n in i)n in am||(r[n]=i[n]);r.slashes===void 0&&(r.slashes=hw.test(i.href))}return r}o(pm,"lolcation");function Lt(i){return i==="file:"||i==="ftp:"||i==="http:"||i==="https:"||i==="ws:"||i==="wss:"}o(Lt,"isSpecial");function dm(i,e){i=Kl(i),i=i.replace(um,""),e=e||{};var t=fw.exec(i),r=t[1]?t[1].toLowerCase():"",s=!!t[2],n=!!t[3],a=0,u;return s?n?(u=t[2]+t[3]+t[4],a=t[2].length+t[3].length):(u=t[2]+t[4],a=t[2].length):n?(u=t[3]+t[4],a=t[3].length):u=t[4],r==="file:"?a>=2&&(u=u.slice(2)):Lt(r)?u=t[4]:r?s&&(u=u.slice(2)):a>=2&&Lt(e.protocol)&&(u=t[4]),{protocol:r,slashes:s||Lt(r),slashesCount:a,rest:u}}o(dm,"extractProtocol");function gw(i,e){if(i==="")return e;for(var t=(e||"/").split("/").slice(0,-1).concat(i.split("/")),r=t.length,s=t[r-1],n=!1,a=0;r--;)t[r]==="."?t.splice(r,1):t[r]===".."?(t.splice(r,1),a++):a&&(r===0&&(n=!0),t.splice(r,1),a--);return n&&t.unshift(""),(s==="."||s==="..")&&t.push(""),t.join("/")}o(gw,"resolve");function Bt(i,e,t){if(i=Kl(i),i=i.replace(um,""),!(this instanceof Bt))return new Bt(i,e,t);var r,s,n,a,u,c,p=Gl.slice(),f=typeof e,d=this,v=0;for(f!=="object"&&f!=="string"&&(t=e,e=null),t&&typeof t!="function"&&(t=hn.parse),e=pm(e),s=dm(i||"",e),r=!s.protocol&&!s.slashes,d.slashes=s.slashes||r&&e.slashes,d.protocol=s.protocol||e.protocol||"",i=s.rest,(s.protocol==="file:"&&(s.slashesCount!==2||mw.test(i))||!s.slashes&&(s.protocol||s.slashesCount<2||!Lt(d.protocol)))&&(p[3]=[/(.*)/,"pathname"]);v<p.length;v++){if(a=p[v],typeof a=="function"){i=a(i,d);continue}n=a[0],c=a[1],n!==n?d[c]=i:typeof n=="string"?(u=n==="@"?i.lastIndexOf(n):i.indexOf(n),~u&&(typeof a[2]=="number"?(d[c]=i.slice(0,u),i=i.slice(u+a[2])):(d[c]=i.slice(u),i=i.slice(0,u)))):(u=n.exec(i))&&(d[c]=u[1],i=i.slice(0,u.index)),d[c]=d[c]||r&&a[3]&&e[c]||"",a[4]&&(d[c]=d[c].toLowerCase())}t&&(d.query=t(d.query)),r&&e.slashes&&d.pathname.charAt(0)!=="/"&&(d.pathname!==""||e.pathname!=="")&&(d.pathname=gw(d.pathname,e.pathname)),d.pathname.charAt(0)!=="/"&&Lt(d.protocol)&&(d.pathname="/"+d.pathname),lm(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(u=d.auth.indexOf(":"),~u?(d.username=d.auth.slice(0,u),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(u+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin=d.protocol!=="file:"&&Lt(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}o(Bt,"Url");function yw(i,e,t){var r=this;switch(i){case"query":typeof e=="string"&&e.length&&(e=(t||hn.parse)(e)),r[i]=e;break;case"port":r[i]=e,lm(e,r.protocol)?e&&(r.host=r.hostname+":"+e):(r.host=r.hostname,r[i]="");break;case"hostname":r[i]=e,r.port&&(e+=":"+r.port),r.host=e;break;case"host":r[i]=e,cm.test(e)?(e=e.split(":"),r.port=e.pop(),r.hostname=e.join(":")):(r.hostname=e,r.port="");break;case"protocol":r.protocol=e.toLowerCase(),r.slashes=!t;break;case"pathname":case"hash":if(e){var s=i==="pathname"?"/":"#";r[i]=e.charAt(0)!==s?s+e:e}else r[i]=e;break;case"username":case"password":r[i]=encodeURIComponent(e);break;case"auth":var n=e.indexOf(":");~n?(r.username=e.slice(0,n),r.username=encodeURIComponent(decodeURIComponent(r.username)),r.password=e.slice(n+1),r.password=encodeURIComponent(decodeURIComponent(r.password))):r.username=encodeURIComponent(decodeURIComponent(e))}for(var a=0;a<Gl.length;a++){var u=Gl[a];u[4]&&(r[u[1]]=r[u[1]].toLowerCase())}return r.auth=r.password?r.username+":"+r.password:r.username,r.origin=r.protocol!=="file:"&&Lt(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r}o(yw,"set");function vw(i){(!i||typeof i!="function")&&(i=hn.stringify);var e,t=this,r=t.host,s=t.protocol;s&&s.charAt(s.length-1)!==":"&&(s+=":");var n=s+(t.protocol&&t.slashes||Lt(t.protocol)?"//":"");return t.username?(n+=t.username,t.password&&(n+=":"+t.password),n+="@"):t.password?(n+=":"+t.password,n+="@"):t.protocol!=="file:"&&Lt(t.protocol)&&!r&&t.pathname!=="/"&&(n+="@"),(r[r.length-1]===":"||cm.test(t.hostname)&&!t.port)&&(r+=":"),n+=r+t.pathname,e=typeof t.query=="object"?i(t.query):t.query,e&&(n+=e.charAt(0)!=="?"?"?"+e:e),t.hash&&(n+=t.hash),n}o(vw,"toString");Bt.prototype={set:yw,toString:vw};Bt.extractProtocol=dm;Bt.location=pm;Bt.trimLeft=Kl;Bt.qs=hn;hm.exports=Bt});var cu=pe((kD,uu)=>{function Ze(i){if(i)return g2(i);this._callbacks=new Map}o(Ze,"Emitter");function g2(i){return Object.assign(i,Ze.prototype),i._callbacks=new Map,i}o(g2,"mixin");Ze.prototype.on=function(i,e){let t=this._callbacks.get(i)??[];return t.push(e),this._callbacks.set(i,t),this};Ze.prototype.once=function(i,e){let t=o((...r)=>{this.off(i,t),e.apply(this,r)},"on");return t.fn=e,this.on(i,t),this};Ze.prototype.off=function(i,e){if(i===void 0&&e===void 0)return this._callbacks.clear(),this;if(e===void 0)return this._callbacks.delete(i),this;let t=this._callbacks.get(i);if(t){for(let[r,s]of t.entries())if(s===e||s.fn===e){t.splice(r,1);break}t.length===0?this._callbacks.delete(i):this._callbacks.set(i,t)}return this};Ze.prototype.emit=function(i,...e){let t=this._callbacks.get(i);if(t){let r=[...t];for(let s of r)s.apply(this,e)}return this};Ze.prototype.listeners=function(i){return this._callbacks.get(i)??[]};Ze.prototype.listenerCount=function(i){if(i)return this.listeners(i).length;let e=0;for(let t of this._callbacks.values())e+=t.length;return e};Ze.prototype.hasListeners=function(i){return this.listenerCount(i)>0};Ze.prototype.addEventListener=Ze.prototype.on;Ze.prototype.removeListener=Ze.prototype.off;Ze.prototype.removeEventListener=Ze.prototype.off;Ze.prototype.removeAllListeners=Ze.prototype.off;typeof uu<"u"&&(uu.exports=Ze)});var ag=pe((KD,xn)=>{"use strict";xn.exports=vu;xn.exports.isMobile=vu;xn.exports.default=vu;var x2=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,P2=/CrOS/,_2=/android|ipad|playbook|silk/i;function vu(i){i||(i={});let e=i.ua;if(!e&&typeof navigator<"u"&&(e=navigator.userAgent),e&&e.headers&&typeof e.headers["user-agent"]=="string"&&(e=e.headers["user-agent"]),typeof e!="string")return!1;let t=x2.test(e)&&!P2.test(e)||!!i.tablet&&_2.test(e);return!t&&i.tablet&&i.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.indexOf("Macintosh")!==-1&&e.indexOf("Safari")!==-1&&(t=!0),t}o(vu,"isMobile")});function ut(i,e){return Object.hasOwn(i,e)}o(ut,"hasProperty");var{AbortController:Rr}=globalThis,{AbortSignal:$g}=globalThis,Ur=o((i="Aborted",e)=>{let t=new DOMException(i,"AbortError");return e!=null&&ut(e,"cause")&&Object.defineProperty(t,"cause",{__proto__:null,configurable:!0,writable:!0,value:e.cause}),t},"createAbortError");function so(i,e,t){return new Promise(r=>{i.toBlob(r,e,t)})}o(so,"canvasToBlob");var Wg=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function Gg(i,e,t){let r=Wg.exec(i),s=e.mimeType??r?.[1]??"plain/text",n;if(r?.[2]!=null){let a=atob(decodeURIComponent(r[3])),u=new Uint8Array(a.length);for(let c=0;c<a.length;c++)u[c]=a.charCodeAt(c);n=[u]}else r?.[3]!=null&&(n=[decodeURIComponent(r[3])]);return t?new File(n,e.name||"",{type:s}):new Blob(n,{type:s})}o(Gg,"dataURItoBlob");var Rn=Gg;var Un=class extends Error{static{o(this,"ErrorWithCause")}isNetworkError;cause;constructor(e,t){super(e),this.cause=t?.cause,this.cause&&ut(this.cause,"isNetworkError")?this.isNetworkError=this.cause.isNetworkError:this.isNetworkError=!1}},di=Un;function Jt(i,e,t,r){return t===0||i===e?i:r===0?e:i+(e-i)*2**(-r/t)}o(Jt,"emaFilter");var Or=['a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])',"input:not([disabled]):not([inert]):not([aria-hidden])","select:not([disabled]):not([inert]):not([aria-hidden])","textarea:not([disabled]):not([inert]):not([aria-hidden])","button:not([disabled]):not([inert]):not([aria-hidden])",'iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])','object:not([tabindex^="-"]):not([inert]):not([aria-hidden])','embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[tabindex]:not([tabindex^="-"]):not([inert]):not([aria-hidden])'];var On=class extends Error{static{o(this,"NetworkError")}cause;isNetworkError;request;constructor(e,t=null){super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=e,this.isNetworkError=!0,this.request=t}},St=On;var Dn=class{static{o(this,"ProgressTimeout")}#e;#t=!1;#r;#i;constructor(e,t){this.#i=e,this.#r=()=>t(e)}progress(){this.#t||this.#i>0&&(clearTimeout(this.#e),this.#e=setTimeout(this.#r,this.#i))}done(){this.#t||(clearTimeout(this.#e),this.#e=void 0,this.#t=!0)}},Lu=Dn;var oo=o(()=>{},"noop");function In(i,e={}){let{body:t=null,headers:r={},method:s="GET",onBeforeRequest:n=oo,onUploadProgress:a=oo,shouldRetry:u=o(()=>!0,"shouldRetry"),onAfterResponse:c=oo,onTimeout:p=oo,responseType:f,retries:d=3,signal:v=null,timeout:_=3e4,withCredentials:k=!1}=e,A=o(U=>.3*2**(U-1)*1e3,"delay"),F=new Lu(_,p);function R(U=0){return new Promise(async(C,Y)=>{let $=new XMLHttpRequest,H=o(K=>{u($)&&U<d?setTimeout(()=>{R(U+1).then(C,Y)},A(U)):(F.done(),Y(K))},"onError");$.open(s,i,!0),$.withCredentials=k,f&&($.responseType=f),$.onload=async()=>{try{await c($,U)}catch(K){K.request=$,H(K);return}$.status>=200&&$.status<300?(F.done(),C($)):u($)&&U<d?setTimeout(()=>{R(U+1).then(C,Y)},A(U)):(F.done(),Y(new St($.statusText,$)))},$.onerror=()=>H(new St($.statusText,$)),$.upload.onprogress=K=>{F.progress(),a(K)},r&&Object.keys(r).forEach(K=>{$.setRequestHeader(K,r[K])});function Q(){$.abort(),Y(new DOMException("Aborted","AbortError"))}if(o(Q,"abort"),v?.addEventListener("abort",Q),v?.aborted){Q();return}await n($,U),$.send(t)})}return o(R,"requestWithRetry"),R()}o(In,"fetcher");function Qt(...i){return fetch(...i).catch(e=>{throw e.name==="AbortError"?e:new St(e)})}o(Qt,"fetchWithNetworkError");var Kg=o(i=>"error"in i&&!!i.error,"hasError"),Xg=o(i=>i.progress.uploadComplete,"isCompleted");function hi(i){return i.filter(e=>!Kg(e)&&!Xg(e))}o(hi,"filterFilesToUpload");function fi(i){return i.filter(e=>!e.progress?.uploadStarted||!e.isRestored)}o(fi,"filterFilesToEmitUploadStarted");function Dr(i){return typeof i!="object"||i===null||!("nodeType"in i)?!1:i.nodeType===Node.ELEMENT_NODE}o(Dr,"isDOMElement");function Yg(i){if(typeof i=="string"){let e=document.querySelectorAll(i);return e.length===0?null:Array.from(e)}return typeof i=="object"&&Dr(i)?[i]:null}o(Yg,"findAllDOMElements");var no=Yg;function Jg(i,e=document){return typeof i=="string"?e.querySelector(i):Dr(i)?i:null}o(Jg,"findDOMElement");var Ir=Jg;function Et(i){let e=i.lastIndexOf(".");return e===-1||e===i.length-1?{name:i,extension:void 0}:{name:i.slice(0,e),extension:i.slice(e+1)}}o(Et,"getFileNameAndExtension");var Wi={__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 Gi(i){if(i.type)return i.type;let e=i.name?Et(i.name).extension?.toLowerCase():null;return e&&e in Wi?Wi[e]:"application/octet-stream"}o(Gi,"getFileType");function Qg(i){return i.charCodeAt(0).toString(32)}o(Qg,"encodeCharacter");function Bu(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${Qg(t)}`,"/"))+e}o(Bu,"encodeFilename");function Nn(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${Bu(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${Bu(i.meta.relativePath.toLowerCase())}`),i.data?.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}o(Nn,"generateFileID");function Zg(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}o(Zg,"hasFileStableId");function Nr(i,e){if(Zg(i))return i.id;let t=Gi(i);return Nn({...i,type:t},e)}o(Nr,"getSafeFileId");function At(i,e){return i===!0?Object.keys(e):Array.isArray(i)?i:[]}o(At,"getAllowedMetaFields");var je=Array.from;function Mn(i){let e=je(i.files);return Promise.resolve(e)}o(Mn,"fallbackApi");function ao(i,e,t,{onSuccess:r}){i.readEntries(s=>{let n=[...e,...s];s.length?queueMicrotask(()=>{ao(i,n,t,{onSuccess:r})}):r(n)},s=>{t(s),r(e)})}o(ao,"getFilesAndDirectoriesFromDirectory");function ju(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,r)=>i.file(t,r))},async*values(){let t=i.createReader();yield*await new Promise(s=>{ao(t,[],e,{onSuccess:o(n=>s(n.map(a=>ju(a,e))),"onSuccess")})})},isSameEntry:void 0}}o(ju,"getAsFileSystemHandleFromEntry");async function*zu(i,e,t=void 0){let r=o(()=>`${e}/${i.name}`,"getNextRelativePath");if(i.kind==="file"){let s=await i.getFile();s!=null?(s.relativePath=e?r():null,yield s):t!=null&&(yield t)}else if(i.kind==="directory")for await(let s of i.values())yield*zu(s,e?r():i.name);else t!=null&&(yield t)}o(zu,"createPromiseToAddFileOrParseDirectory");async function*Ln(i,e){let t=await Promise.all(Array.from(i.items,async r=>{let s;return s??=ju(o(()=>typeof r.getAsEntry=="function"?r.getAsEntry():r.webkitGetAsEntry(),"getAsEntry")(),e),{fileSystemHandle:s,lastResortFile:r.getAsFile()}}));for(let{lastResortFile:r,fileSystemHandle:s}of t)if(s!=null)try{yield*zu(s,"",r)}catch(n){r!=null?yield r:e(n)}else r!=null&&(yield r)}o(Ln,"getFilesFromDataTransfer");async function Zt(i,e){let t=e?.logDropError??Function.prototype;try{let r=[];for await(let s of Ln(i,t))r.push(s);return r}catch{return Mn(i)}}o(Zt,"getDroppedFiles");var ey={__proto__:null,"audio/mp3":"mp3","audio/mp4":"mp4","audio/ogg":"ogg","audio/webm":"webm","image/gif":"gif","image/heic":"heic","image/heif":"heif","image/jpeg":"jpg","image/webp":"webp","image/png":"png","image/svg+xml":"svg","video/mp4":"mp4","video/ogg":"ogv","video/quicktime":"mov","video/webm":"webm","video/x-matroska":"mkv","video/x-msvideo":"avi"};function xt(i){return[i]=i.split(";",1),ey[i]||null}o(xt,"getFileTypeExtension");function lo(i){let t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?([^\n]+)/i.exec(i)?.[1];return`${/^http:\/\//i.test(i)?"ws":"wss"}://${t}`}o(lo,"getSocketHost");function ty(i){for(;i&&!i.dir;)i=i.parentNode;return i?.dir}o(ty,"getTextDirection");var Mr=ty;function Bn(i){return i<10?`0${i}`:i.toString()}o(Bn,"pad");function mi(){let i=new Date,e=Bn(i.getHours()),t=Bn(i.getMinutes()),r=Bn(i.getSeconds());return`${e}:${t}:${r}`}o(mi,"getTimeStamp");function Ki(){if(typeof window>"u")return!1;let i=document.body;return!(i==null||window==null||!("draggable"in i)||!("ondragstart"in i)||!("ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}o(Ki,"isDragDropSupported");function iy(i){return i?i.readyState===4&&i.status===0:!1}o(iy,"isNetworkError");var Lr=iy;function Br(i){return i.startsWith("blob:")}o(Br,"isObjectURL");function jr(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}o(jr,"isPreviewSupported");function jn(i){let e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,r=Math.floor(i%60);return{hours:e,minutes:t,seconds:r}}o(jn,"secondsToTime");function Xi(i){let e=jn(i),t=e.hours===0?"":`${e.hours}h`,r=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,s=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${r}${s}`}o(Xi,"prettyETA");function ry(i){return new Error("Cancelled",{cause:i})}o(ry,"createCancelError");function Hu(i){if(i!=null){let e=o(()=>this.abort(i.reason),"abortPromise");i.addEventListener("abort",e,{once:!0});let t=o(()=>{i.removeEventListener("abort",e)},"removeAbortListener");this.then?.(t,t)}return this}o(Hu,"abortOn");var ft=class{static{o(this,"RateLimitedQueue")}#e=0;#t=[];#r=!1;#i;#s=1;#l;#o;limit;constructor(e){typeof e!="number"||e===0?this.limit=1/0:this.limit=e}#n(e){this.#e+=1;let t=!1,r;try{r=e()}catch(s){throw this.#e-=1,s}return{abort:o(s=>{t||(t=!0,this.#e-=1,r?.(s),this.#a())},"abort"),done:o(()=>{t||(t=!0,this.#e-=1,this.#a())},"done")}}#a(){queueMicrotask(()=>this.#c())}#c(){if(this.#r||this.#e>=this.limit||this.#t.length===0)return;let e=this.#t.shift();if(e==null)throw new Error("Invariant violation: next is null");let t=this.#n(e.fn);e.abort=t.abort,e.done=t.done}#u(e,t){let r={fn:e,priority:t?.priority||0,abort:o(()=>{this.#d(r)},"abort"),done:o(()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")},"done")},s=this.#t.findIndex(n=>r.priority>n.priority);return s===-1?this.#t.push(r):this.#t.splice(s,0,r),r}#d(e){let t=this.#t.indexOf(e);t!==-1&&this.#t.splice(t,1)}run(e,t){return!this.#r&&this.#e<this.limit?this.#n(e):this.#u(e,t)}wrapSyncFunction(e,t){return(...r)=>{let s=this.run(()=>(e(...r),queueMicrotask(()=>s.done()),()=>{}),t);return{abortOn:Hu,abort(){s.abort()}}}}wrapPromiseFunction(e,t){return(...r)=>{let s,n=new Promise((a,u)=>{s=this.run(()=>{let c,p;try{p=Promise.resolve(e(...r))}catch(f){p=Promise.reject(f)}return p.then(f=>{c?u(c):(s.done(),a(f))},f=>{c?u(c):(s.done(),u(f))}),f=>{c=ry(f)}},t)});return n.abort=a=>{s.abort(a)},n.abortOn=Hu,n}}resume(){this.#r=!1,clearTimeout(this.#i);for(let e=0;e<this.limit;e++)this.#a()}#p=o(()=>this.resume(),"#resume");pause(e=null){this.#r=!0,clearTimeout(this.#i),e!=null&&(this.#i=setTimeout(this.#p,e))}rateLimit(e){clearTimeout(this.#o),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(this.#l=this.limit-1,this.limit=this.#s,this.#o=setTimeout(this.#h,e))}#h=o(()=>{if(this.#r){this.#o=setTimeout(this.#h,0);return}this.#s=this.limit,this.limit=Math.ceil((this.#l+this.#s)/2);for(let e=this.#s;e<=this.limit;e++)this.#a();this.#l-this.#s>3?this.#o=setTimeout(this.#h,2e3):this.#s=Math.floor(this.#s/2)},"#increaseLimit");get isPaused(){return this.#r}},zr=Symbol("__queue");function Yi(i){return{...i,type:i.mimeType,extension:i.name?Et(i.name).extension:null}}o(Yi,"remoteFileObjToLocal");function sy(i,e,t){let r=[];return i.forEach(s=>typeof s!="string"?r.push(s):e[Symbol.split](s).forEach((n,a,u)=>{n!==""&&r.push(n),a<u.length-1&&r.push(t)})),r}o(sy,"insertReplacement");function qu(i,e){let t=/\$/g,r="$$$$",s=[i];if(e==null)return s;for(let n of Object.keys(e))if(n!=="_"){let a=e[n];typeof a=="string"&&(a=t[Symbol.replace](a,r)),s=sy(s,new RegExp(`%\\{${n}\\}`,"g"),a)}return s}o(qu,"interpolate");var oy=o(i=>{throw new Error(`missing string: ${i}`)},"defaultOnMissingKey"),ei=class{static{o(this,"Translator")}locale;constructor(e,{onMissingKey:t=oy}={}){this.locale={strings:{},pluralize(r){return r===1?0:1}},Array.isArray(e)?e.forEach(this.#t,this):this.#t(e),this.#e=t}#e;#t(e){if(!e?.strings)return;let t=this.locale;Object.assign(this.locale,{strings:{...t.strings,...e.strings},pluralize:e.pluralize||t.pluralize})}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let r=this.locale.strings[e];if(r==null&&(this.#e(e),r=e),typeof r=="object"){if(t&&typeof t.smart_count<"u"){let n=this.locale.pluralize(t.smart_count);return qu(r[n],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof r!="string")throw new Error("string was not a string");return qu(r,t)}};function Hr(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=4)return`${i.slice(0,e-1)}\u2026`;let t=e-3,r=Math.ceil(t/2),s=Math.floor(t/2);return i.slice(0,r)+"..."+i.slice(-s)}o(Hr,"truncateString");var zn=class extends Error{static{o(this,"UserFacingApiError")}name="UserFacingApiError"},Hn=zn;var $r,ge,Ku,ny,gi,Vu,Xu,Yu,Ju,$n,qn,Vn,ay,Vr={},Qu=[],ly=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Wr=Array.isArray;function Rt(i,e){for(var t in e)i[t]=e[t];return i}o(Rt,"d");function Wn(i){i&&i.parentNode&&i.parentNode.removeChild(i)}o(Wn,"g");function Gr(i,e,t){var r,s,n,a={};for(n in e)n=="key"?r=e[n]:n=="ref"?s=e[n]:a[n]=e[n];if(arguments.length>2&&(a.children=arguments.length>3?$r.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(n in i.defaultProps)a[n]===void 0&&(a[n]=i.defaultProps[n]);return qr(i,a,r,s,null)}o(Gr,"_");function qr(i,e,t,r,s){var n={type:i,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++Ku,__i:-1,__u:0};return s==null&&ge.vnode!=null&&ge.vnode(n),n}o(qr,"m");function Zu(){return{current:null}}o(Zu,"b");function Re(i){return i.children}o(Re,"k");function Se(i,e){this.props=i,this.context=e}o(Se,"x");function Ji(i,e){if(e==null)return i.__?Ji(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?Ji(i):null}o(Ji,"S");function ec(i){var e,t;if((i=i.__)!=null&&i.__c!=null){for(i.__e=i.__c.base=null,e=0;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null){i.__e=i.__c.base=t.__e;break}return ec(i)}}o(ec,"C");function $u(i){(!i.__d&&(i.__d=!0)&&gi.push(i)&&!co.__r++||Vu!=ge.debounceRendering)&&((Vu=ge.debounceRendering)||Xu)(co)}o($u,"M");function co(){for(var i,e,t,r,s,n,a,u=1;gi.length;)gi.length>u&&gi.sort(Yu),i=gi.shift(),u=gi.length,i.__d&&(t=void 0,s=(r=(e=i).__v).__e,n=[],a=[],e.__P&&((t=Rt({},r)).__v=r.__v+1,ge.vnode&&ge.vnode(t),Gn(e.__P,t,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,n,s??Ji(r),!!(32&r.__u),a),t.__v=r.__v,t.__.__k[t.__i]=t,rc(n,t,a),t.__e!=s&&ec(t)));co.__r=0}o(co,"$");function tc(i,e,t,r,s,n,a,u,c,p,f){var d,v,_,k,A,F,R=r&&r.__k||Qu,U=e.length;for(c=uy(t,e,R,c,U),d=0;d<U;d++)(_=t.__k[d])!=null&&(v=_.__i==-1?Vr:R[_.__i]||Vr,_.__i=d,F=Gn(i,_,v,s,n,a,u,c,p,f),k=_.__e,_.ref&&v.ref!=_.ref&&(v.ref&&Kn(v.ref,null,_),f.push(_.ref,_.__c||k,_)),A==null&&k!=null&&(A=k),4&_.__u||v.__k===_.__k?c=ic(_,c,i):typeof _.type=="function"&&F!==void 0?c=F:k&&(c=k.nextSibling),_.__u&=-7);return t.__e=A,c}o(tc,"I");function uy(i,e,t,r,s){var n,a,u,c,p,f=t.length,d=f,v=0;for(i.__k=new Array(s),n=0;n<s;n++)(a=e[n])!=null&&typeof a!="boolean"&&typeof a!="function"?(c=n+v,(a=i.__k[n]=typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?qr(null,a,null,null,null):Wr(a)?qr(Re,{children:a},null,null,null):a.constructor==null&&a.__b>0?qr(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=i,a.__b=i.__b+1,u=null,(p=a.__i=cy(a,t,c,d))!=-1&&(d--,(u=t[p])&&(u.__u|=2)),u==null||u.__v==null?(p==-1&&(s>f?v--:s<f&&v++),typeof a.type!="function"&&(a.__u|=4)):p!=c&&(p==c-1?v--:p==c+1?v++:(p>c?v--:v++,a.__u|=4))):i.__k[n]=null;if(d)for(n=0;n<f;n++)(u=t[n])!=null&&(2&u.__u)==0&&(u.__e==r&&(r=Ji(u)),oc(u,u));return r}o(uy,"P");function ic(i,e,t){var r,s;if(typeof i.type=="function"){for(r=i.__k,s=0;r&&s<r.length;s++)r[s]&&(r[s].__=i,e=ic(r[s],e,t));return e}i.__e!=e&&(e&&i.type&&!t.contains(e)&&(e=Ji(i)),t.insertBefore(i.__e,e||null),e=i.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}o(ic,"A");function Ut(i,e){return e=e||[],i==null||typeof i=="boolean"||(Wr(i)?i.some(function(t){Ut(t,e)}):e.push(i)),e}o(Ut,"H");function cy(i,e,t,r){var s,n,a=i.key,u=i.type,c=e[t];if(c===null&&i.key==null||c&&a==c.key&&u==c.type&&(2&c.__u)==0)return t;if(r>(c!=null&&(2&c.__u)==0?1:0))for(s=t-1,n=t+1;s>=0||n<e.length;){if(s>=0){if((c=e[s])&&(2&c.__u)==0&&a==c.key&&u==c.type)return s;s--}if(n<e.length){if((c=e[n])&&(2&c.__u)==0&&a==c.key&&u==c.type)return n;n++}}return-1}o(cy,"L");function Wu(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||ly.test(e)?t:t+"px"}o(Wu,"T");function uo(i,e,t,r,s){var n,a;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof r=="string"&&(i.style.cssText=r=""),r)for(e in r)t&&e in t||Wu(i.style,e,"");if(t)for(e in t)r&&t[e]==r[e]||Wu(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(Ju,"$1")),a=e.toLowerCase(),e=a in i||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+n]=t,t?r?t.u=r.u:(t.u=$n,i.addEventListener(e,n?Vn:qn,n)):i.removeEventListener(e,n?Vn:qn,n);else{if(s=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}o(uo,"j");function Gu(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=$n++;else if(e.t<t.u)return;return t(ge.event?ge.event(e):e)}}}o(Gu,"F");function Gn(i,e,t,r,s,n,a,u,c,p){var f,d,v,_,k,A,F,R,U,C,Y,$,H,Q,K,Z,ye,se=e.type;if(e.constructor!=null)return null;128&t.__u&&(c=!!(32&t.__u),n=[u=e.__e=t.__e]),(f=ge.__b)&&f(e);e:if(typeof se=="function")try{if(R=e.props,U="prototype"in se&&se.prototype.render,C=(f=se.contextType)&&r[f.__c],Y=f?C?C.props.value:f.__:r,t.__c?F=(d=e.__c=t.__c).__=d.__E:(U?e.__c=d=new se(R,Y):(e.__c=d=new Se(R,Y),d.constructor=se,d.render=dy),C&&C.sub(d),d.props=R,d.state||(d.state={}),d.context=Y,d.__n=r,v=d.__d=!0,d.__h=[],d._sb=[]),U&&d.__s==null&&(d.__s=d.state),U&&se.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Rt({},d.__s)),Rt(d.__s,se.getDerivedStateFromProps(R,d.__s))),_=d.props,k=d.state,d.__v=e,v)U&&se.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),U&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(U&&se.getDerivedStateFromProps==null&&R!==_&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(R,Y),!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(R,d.__s,Y)===!1||e.__v==t.__v){for(e.__v!=t.__v&&(d.props=R,d.state=d.__s,d.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(we){we&&(we.__=e)}),$=0;$<d._sb.length;$++)d.__h.push(d._sb[$]);d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(R,d.__s,Y),U&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(_,k,A)})}if(d.context=Y,d.props=R,d.__P=i,d.__e=!1,H=ge.__r,Q=0,U){for(d.state=d.__s,d.__d=!1,H&&H(e),f=d.render(d.props,d.state,d.context),K=0;K<d._sb.length;K++)d.__h.push(d._sb[K]);d._sb=[]}else do d.__d=!1,H&&H(e),f=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++Q<25);d.state=d.__s,d.getChildContext!=null&&(r=Rt(Rt({},r),d.getChildContext())),U&&!v&&d.getSnapshotBeforeUpdate!=null&&(A=d.getSnapshotBeforeUpdate(_,k)),Z=f,f!=null&&f.type===Re&&f.key==null&&(Z=sc(f.props.children)),u=tc(i,Wr(Z)?Z:[Z],e,t,r,s,n,a,u,c,p),d.base=e.__e,e.__u&=-161,d.__h.length&&a.push(d),F&&(d.__E=d.__=null)}catch(we){if(e.__v=null,c||n!=null)if(we.then){for(e.__u|=c?160:128;u&&u.nodeType==8&&u.nextSibling;)u=u.nextSibling;n[n.indexOf(u)]=null,e.__e=u}else for(ye=n.length;ye--;)Wn(n[ye]);else e.__e=t.__e,e.__k=t.__k;ge.__e(we,e,t)}else n==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):u=e.__e=py(t.__e,e,t,r,s,n,a,c,p);return(f=ge.diffed)&&f(e),128&e.__u?void 0:u}o(Gn,"O");function rc(i,e,t){for(var r=0;r<t.length;r++)Kn(t[r],t[++r],t[++r]);ge.__c&&ge.__c(e,i),i.some(function(s){try{i=s.__h,s.__h=[],i.some(function(n){n.call(s)})}catch(n){ge.__e(n,s.__v)}})}o(rc,"z");function sc(i){return typeof i!="object"||i==null||i.__b&&i.__b>0?i:Wr(i)?i.map(sc):Rt({},i)}o(sc,"N");function py(i,e,t,r,s,n,a,u,c){var p,f,d,v,_,k,A,F=t.props,R=e.props,U=e.type;if(U=="svg"?s="http://www.w3.org/2000/svg":U=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),n!=null){for(p=0;p<n.length;p++)if((_=n[p])&&"setAttribute"in _==!!U&&(U?_.localName==U:_.nodeType==3)){i=_,n[p]=null;break}}if(i==null){if(U==null)return document.createTextNode(R);i=document.createElementNS(s,U,R.is&&R),u&&(ge.__m&&ge.__m(e,n),u=!1),n=null}if(U==null)F===R||u&&i.data==R||(i.data=R);else{if(n=n&&$r.call(i.childNodes),F=t.props||Vr,!u&&n!=null)for(F={},p=0;p<i.attributes.length;p++)F[(_=i.attributes[p]).name]=_.value;for(p in F)if(_=F[p],p!="children"){if(p=="dangerouslySetInnerHTML")d=_;else if(!(p in R)){if(p=="value"&&"defaultValue"in R||p=="checked"&&"defaultChecked"in R)continue;uo(i,p,null,_,s)}}for(p in R)_=R[p],p=="children"?v=_:p=="dangerouslySetInnerHTML"?f=_:p=="value"?k=_:p=="checked"?A=_:u&&typeof _!="function"||F[p]===_||uo(i,p,_,F[p],s);if(f)u||d&&(f.__html==d.__html||f.__html==i.innerHTML)||(i.innerHTML=f.__html),e.__k=[];else if(d&&(i.innerHTML=""),tc(e.type=="template"?i.content:i,Wr(v)?v:[v],e,t,r,U=="foreignObject"?"http://www.w3.org/1999/xhtml":s,n,a,n?n[0]:t.__k&&Ji(t,0),u,c),n!=null)for(p=n.length;p--;)Wn(n[p]);u||(p="value",U=="progress"&&k==null?i.removeAttribute("value"):k!=null&&(k!==i[p]||U=="progress"&&!k||U=="option"&&k!=F[p])&&uo(i,p,k,F[p],s),p="checked",A!=null&&A!=i[p]&&uo(i,p,A,F[p],s))}return i}o(py,"V");function Kn(i,e,t){try{if(typeof i=="function"){var r=typeof i.__u=="function";r&&i.__u(),r&&e==null||(i.__u=i(e))}else i.current=e}catch(s){ge.__e(s,t)}}o(Kn,"q");function oc(i,e,t){var r,s;if(ge.unmount&&ge.unmount(i),(r=i.ref)&&(r.current&&r.current!=i.__e||Kn(r,null,e)),(r=i.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(n){ge.__e(n,e)}r.base=r.__P=null}if(r=i.__k)for(s=0;s<r.length;s++)r[s]&&oc(r[s],e,t||typeof i.type!="function");t||Wn(i.__e),i.__c=i.__=i.__e=void 0}o(oc,"B");function dy(i,e,t){return this.constructor(i,t)}o(dy,"D");function Xn(i,e,t){var r,s,n,a;e==document&&(e=document.documentElement),ge.__&&ge.__(i,e),s=(r=typeof t=="function")?null:t&&t.__k||e.__k,n=[],a=[],Gn(e,i=(!r&&t||e).__k=Gr(Re,null,[i]),s||Vr,Vr,e.namespaceURI,!r&&t?[t]:s?null:e.firstChild?$r.call(e.childNodes):null,n,!r&&t?t:s?s.__e:e.firstChild,r,a),rc(n,i,a)}o(Xn,"E");function po(i,e,t){var r,s,n,a,u=Rt({},i.props);for(n in i.type&&i.type.defaultProps&&(a=i.type.defaultProps),e)n=="key"?r=e[n]:n=="ref"?s=e[n]:u[n]=e[n]===void 0&&a!=null?a[n]:e[n];return arguments.length>2&&(u.children=arguments.length>3?$r.call(arguments,2):t),qr(i.type,u,r||i.key,s||i.ref,null)}o(po,"J");$r=Qu.slice,ge={__e:o(function(i,e,t,r){for(var s,n,a;e=e.__;)if((s=e.__c)&&!s.__)try{if((n=s.constructor)&&n.getDerivedStateFromError!=null&&(s.setState(n.getDerivedStateFromError(i)),a=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(i,r||{}),a=s.__d),a)return s.__E=s}catch(u){i=u}throw i},"__e")},Ku=0,ny=o(function(i){return i!=null&&i.constructor==null},"t"),Se.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Rt({},this.state),typeof i=="function"&&(i=i(Rt({},t),this.props)),i&&Rt(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),$u(this))},Se.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),$u(this))},Se.prototype.render=Re,gi=[],Xu=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Yu=o(function(i,e){return i.__v.__b-e.__v.__b},"e"),co.__r=0,Ju=/(PointerCapture)$|Capture$/i,$n=0,qn=Gu(!1),Vn=Gu(!0),ay=0;var hy=0,Px=Array.isArray;function l(i,e,t,r,s,n){e||(e={});var a,u,c=e;if("ref"in c)for(u in c={},e)u=="ref"?a=e[u]:c[u]=e[u];var p={type:i,props:c,key:t,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--hy,__i:-1,__u:0,__source:s,__self:n};if(typeof i=="function"&&(a=i.defaultProps))for(u in a)c[u]===void 0&&(c[u]=a[u]);return ge.vnode&&ge.vnode(p),p}o(l,"u");var Kr,Ue,Yn,nc,Xr=0,fc=[],Ie=ge,ac=Ie.__b,lc=Ie.__r,uc=Ie.diffed,cc=Ie.__c,pc=Ie.unmount,dc=Ie.__;function Qn(i,e){Ie.__h&&Ie.__h(Ue,i,Xr||e),Xr=0;var t=Ue.__H||(Ue.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}o(Qn,"p");function it(i){return Xr=1,fy(gc,i)}o(it,"d");function fy(i,e,t){var r=Qn(Kr++,2);if(r.t=i,!r.__c&&(r.__=[t?t(e):gc(void 0,e),function(u){var c=r.__N?r.__N[0]:r.__[0],p=r.t(c,u);c!==p&&(r.__N=[p,r.__[1]],r.__c.setState({}))}],r.__c=Ue,!Ue.__f)){var s=o(function(u,c,p){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(v){return!!v.__c});if(f.every(function(v){return!v.__N}))return!n||n.call(this,u,c,p);var d=r.__c.props!==u;return f.forEach(function(v){if(v.__N){var _=v.__[0];v.__=v.__N,v.__N=void 0,_!==v.__[0]&&(d=!0)}}),n&&n.call(this,u,c,p)||d},"f");Ue.__f=!0;var n=Ue.shouldComponentUpdate,a=Ue.componentWillUpdate;Ue.componentWillUpdate=function(u,c,p){if(this.__e){var f=n;n=void 0,s(u,c,p),n=f}a&&a.call(this,u,c,p)},Ue.shouldComponentUpdate=s}return r.__N||r.__}o(fy,"h");function ze(i,e){var t=Qn(Kr++,3);!Ie.__s&&mc(t.__H,e)&&(t.__=i,t.u=e,Ue.__H.__h.push(t))}o(ze,"y");function Ye(i){return Xr=5,yi(function(){return{current:i}},[])}o(Ye,"A");function yi(i,e){var t=Qn(Kr++,7);return mc(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}o(yi,"T");function rt(i,e){return Xr=8,yi(function(){return i},e)}o(rt,"q");function my(){for(var i;i=fc.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach(ho),i.__H.__h.forEach(Jn),i.__H.__h=[]}catch(e){i.__H.__h=[],Ie.__e(e,i.__v)}}o(my,"j");Ie.__b=function(i){Ue=null,ac&&ac(i)},Ie.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),dc&&dc(i,e)},Ie.__r=function(i){lc&&lc(i),Kr=0;var e=(Ue=i.__c).__H;e&&(Yn===Ue?(e.__h=[],Ue.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(ho),e.__h.forEach(Jn),e.__h=[],Kr=0)),Yn=Ue},Ie.diffed=function(i){uc&&uc(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(fc.push(e)!==1&&nc===Ie.requestAnimationFrame||((nc=Ie.requestAnimationFrame)||gy)(my)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),Yn=Ue=null},Ie.__c=function(i,e){e.some(function(t){try{t.__h.forEach(ho),t.__h=t.__h.filter(function(r){return!r.__||Jn(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],Ie.__e(r,t.__v)}}),cc&&cc(i,e)},Ie.unmount=function(i){pc&&pc(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{ho(r)}catch(s){e=s}}),t.__H=void 0,e&&Ie.__e(e,t.__v))};var hc=typeof requestAnimationFrame=="function";function gy(i){var e,t=o(function(){clearTimeout(r),hc&&cancelAnimationFrame(e),setTimeout(i)},"r"),r=setTimeout(t,35);hc&&(e=requestAnimationFrame(t))}o(gy,"w");function ho(i){var e=Ue,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),Ue=e}o(ho,"z");function Jn(i){var e=Ue;i.__c=i.__(),Ue=e}o(Jn,"B");function mc(i,e){return!i||i.length!==e.length||e.some(function(t,r){return t!==i[r]})}o(mc,"C");function gc(i,e){return typeof e=="function"?e(i):e}o(gc,"D");var yy={position:"relative",width:"100%",minHeight:"100%"},vy={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"};function Qi({data:i,rowHeight:e,renderRow:t,overscanCount:r=10,padding:s=4,...n}){let a=Ye(null),[u,c]=it(0),[p,f]=it(0);ze(()=>{function U(){a.current!=null&&p!==a.current.offsetHeight&&f(a.current.offsetHeight)}return o(U,"resize"),U(),window.addEventListener("resize",U),()=>{window.removeEventListener("resize",U)}},[p]);let d=rt(()=>{a.current&&c(a.current.scrollTop)},[]),v=Math.floor(u/e),_=Math.floor(p/e);r&&(v=Math.max(0,v-v%r),_+=r);let k=v+_+s,A=i.slice(v,k),F={...yy,height:i.length*e},R={...vy,top:v*e};return l("div",{onScroll:d,ref:a,...n,children:l("div",{role:"presentation",style:F,children:l("div",{role:"presentation",style:R,children:A.map(t)})})})}o(Qi,"VirtualList");var Pe=class{static{o(this,"BasePlugin")}uppy;opts;id;defaultLocale;i18n;i18nArray;type;VERSION;constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){let{plugins:e}=this.uppy.getState();return e?.[this.id]||{}}setPluginState(e){let{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(){let e=new ei([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(){}};var Ot=class{static{o(this,"EventManager")}#e;#t=[];constructor(e){this.#e=e}on(e,t){return this.#t.push([e,t]),this.#e.on(e,t)}remove(){for(let[e,t]of this.#t.splice(0))this.#e.off(e,t)}onFilePause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onFileRemove(e,t){this.on("file-removed",r=>{e===r.id&&t(r.id)})}onPause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onRetry(e,t){this.on("upload-retry",r=>{e===r?.id&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{this.#e.getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{this.#e.getFile(e)&&t()})}onCancelAll(e,t){this.on("cancel-all",(...r)=>{this.#e.getFile(e)&&t(...r)})}onResumeAll(e,t){this.on("resume-all",()=>{this.#e.getFile(e)&&t()})}};var yc={debug:o(()=>{},"debug"),warn:o(()=>{},"warn"),error:o((...i)=>console.error(`[Uppy] [${mi()}]`,...i),"error")},fo={debug:o((...i)=>console.debug(`[Uppy] [${mi()}]`,...i),"debug"),warn:o((...i)=>console.warn(`[Uppy] [${mi()}]`,...i),"warn"),error:o((...i)=>console.error(`[Uppy] [${mi()}]`,...i),"error")};var Yr=ae(Zi(),1),_c=ae(Pc(),1);var kc={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]},ct=class extends Error{static{o(this,"RestrictionError")}isUserFacing;file;constructor(e,t){super(e),this.isUserFacing=t?.isUserFacing??!0,t?.file&&(this.file=t.file)}isRestriction=!0},mo=class{static{o(this,"Restricter")}getI18n;getOpts;constructor(e,t){this.getI18n=t,this.getOpts=()=>{let r=e();if(r.restrictions?.allowedFileTypes!=null&&!Array.isArray(r.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return r}}validateAggregateRestrictions(e,t){let{maxTotalFileSize:r,maxNumberOfFiles:s}=this.getOpts().restrictions;if(s&&e.filter(a=>!a.isGhost).length+t.length>s)throw new ct(`${this.getI18n()("youCanOnlyUploadX",{smart_count:s})}`);if(r){let n=[...e,...t].reduce((a,u)=>a+(u.size??0),0);if(n>r)throw new ct(this.getI18n()("aggregateExceedsSize",{sizeAllowed:(0,Yr.default)(r),size:(0,Yr.default)(n)}))}}validateSingleFile(e){let{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(a=>a.includes("/")?e.type?(0,_c.default)(e.type.replace(/;.*?$/,""),a):!1:a[0]==="."&&e.extension?e.extension.toLowerCase()===a.slice(1).toLowerCase():!1)){let a=s.join(", ");throw new ct(this.getI18n()("youCanOnlyUploadFileTypes",{types:a}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new ct(this.getI18n()("exceedsSize",{size:(0,Yr.default)(t),file:e.name??this.getI18n()("unnamed")}),{file:e});if(r&&e.size!=null&&e.size<r)throw new ct(this.getI18n()("inferiorSize",{size:(0,Yr.default)(r)}),{file:e})}validate(e,t){t.forEach(r=>{this.validateSingleFile(r)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){let{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length<t)throw new ct(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){let t=new ct(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:e.name??this.getI18n()("unnamed")})),{requiredMetaFields:r}=this.getOpts().restrictions,s=[];for(let n of r)(!Object.hasOwn(e.meta,n)||e.meta[n]==="")&&s.push(n);return{missingFields:s,error:t}}};function Sy(i){let e=null,t;return(...r)=>(t=r,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e)}o(Sy,"debounce");var Zn=class i extends Pe{static{o(this,"UIPlugin")}#e;isTargetDOMEl;el;parent;title;getTargetPlugin(e){let t;if(typeof e?.addTarget=="function")t=e,t instanceof i||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:i}}));else if(typeof e=="function"){let r=e;this.uppy.iteratePlugins(s=>{s instanceof r&&(t=s)})}return t}mount(e,t){let r=t.id,s=Ir(e);if(s){this.isTargetDOMEl=!0;let u=document.createElement("div");return u.classList.add("uppy-Root"),this.#e=Sy(c=>{this.uppy.getPlugin(this.id)&&(Xn(this.render(c,u),u),this.afterUpdate())}),this.uppy.log(`Installing ${r} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(s.innerHTML=""),Xn(this.render(this.uppy.getState(),u),u),this.el=u,s.appendChild(u),u.dir=this.opts.direction||Mr(u)||"ltr",this.onMount(),this.el}let n=this.getTargetPlugin(e);if(n)return this.uppy.log(`Installing ${r} to ${n.id}`),this.parent=n,this.el=n.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${r}`);let a=`Invalid target option given to ${r}.`;throw typeof e=="function"?a+=" 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.":a+="If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(a)}render(e,t){throw new Error("Extend the render method to add your plugin to a DOM element")}update(e){this.el!=null&&this.#e?.(e)}unmount(){this.isTargetDOMEl&&this.el?.remove(),this.onUnmount()}onMount(){}onUnmount(){}},re=Zn;var Ec={name:"@uppy/store-default",description:"The default simple object-based store for Uppy.",version:"5.0.0",license:"MIT",main:"lib/index.js",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-store"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},devDependencies:{jsdom:"^26.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},exports:{".":"./lib/index.js","./package.json":"./package.json"},files:["src","lib","dist","CHANGELOG.md"]};var ea=class{static{o(this,"DefaultStore")}static VERSION=Ec.version;state={};#e=new Set;getState(){return this.state}setState(e){let t={...this.state},r={...this.state,...e};this.state=r,this.#t(t,r,e)}subscribe(e){return this.#e.add(e),()=>{this.#e.delete(e)}}#t(...e){this.#e.forEach(t=>{t(...e)})}},ta=ea;var up=ae(oa(),1),cp=ae(np(),1);var mv="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Dt=o((i=21)=>{let e="",t=i|0;for(;t--;)e+=mv[Math.random()*64|0];return e},"nanoid");var ap={name:"@uppy/core",description:"Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",version:"5.2.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.min.css":"./dist/style.min.css","./css/style.css":"./dist/style.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/store-default":"workspace:^","@uppy/utils":"workspace:^",lodash:"^4.17.21","mime-match":"^1.0.2","namespace-emitter":"^2.0.1",nanoid:"^5.0.9",preact:"^10.5.13"},devDependencies:{"@types/deep-freeze":"^0",cssnano:"^7.0.7","deep-freeze":"^0.0.1",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"}};function na(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}o(na,"getFileName");var lp={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"}};function aa(i){if(i==null&&typeof navigator<"u"&&(i=navigator.userAgent),!i)return!0;let e=/Edge\/(\d+\.\d+)/.exec(i);if(!e)return!0;let r=e[1].split(".",2),s=parseInt(r[0],10),n=parseInt(r[1],10);return s<15||s===15&&n<15063||s>18||s===18&&n>=18218}o(aa,"supportsUploadProgress");var vo={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},la=class i{static{o(this,"Uppy")}static VERSION=ap.version;#e=Object.create(null);#t;#r;#i=(0,cp.default)();#s=new Set;#l=new Set;#o=new Set;defaultLocale;locale;opts;store;i18n;i18nArray;scheduledAutoProceed=null;wasOffline=!1;constructor(e){this.defaultLocale=lp;let t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:kc,meta:{},onBeforeFileAdded:o((s,n)=>!Object.hasOwn(n,s.id),"onBeforeFileAdded"),onBeforeUpload:o(s=>s,"onBeforeUpload"),store:new ta,logger:yc,infoTimeout:5e3},r={...t,...e};this.opts={...r,restrictions:{...t.restrictions,...e?.restrictions}},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?.debug&&(this.opts.logger=fo),this.log(`Using Core v${i.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...vo,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:aa(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),this.#t=new mo(()=>this.opts,()=>this.i18n),this.#r=this.store.subscribe((s,n,a)=>{this.emit("state-update",s,n,a),this.updateAll(n)}),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),this.#S()}emit(e,...t){this.#i.emit(e,...t)}on(e,t){return this.#i.on(e,t),this}once(e,t){return this.#i.once(e,t),this}off(e,t){return this.#i.off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){let t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(e).map(([r,s])=>[r,{...t[r],...s}]))}})}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can\u2019t set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:t})}i18nInit(){let e=o(r=>this.log(`Missing i18n string: ${r}`,"error"),"onMissingKey"),t=new ei([this.defaultLocale,this.opts.locale],{onMissingKey:e});this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.locale=t.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e?.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(t=>{t.setOptions(e)}),this.setState(void 0)}resetProgress(){let e={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},r=Object.create(null);Object.keys(t).forEach(s=>{r[s]={...t[s],progress:{...t[s].progress,...e},tus:void 0,transloadit:void 0}}),this.setState({files:r,...vo})}clear(){let{capabilities:e,currentUploads:t}=this.getState();if(Object.keys(t).length>0&&!e.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...vo,files:{}})}addPreProcessor(e){this.#s.add(e)}removePreProcessor(e){return this.#s.delete(e)}addPostProcessor(e){this.#o.add(e)}removePostProcessor(e){return this.#o.delete(e)}addUploader(e){this.#l.add(e)}removeUploader(e){return this.#l.delete(e)}setMeta(e){let t={...this.getState().meta,...e},r={...this.getState().files};Object.keys(r).forEach(s=>{r[s]={...r[s],meta:{...r[s].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:r})}setFileMeta(e,t){let r={...this.getState().files};if(!r[e]){this.log(`Was trying to set metadata for a file that has been removed: ${e}`);return}let s={...r[e].meta,...t};r[e]={...r[e],meta:s},this.setState({files:r})}getFile(e){return this.getState().files[e]}getFiles(){let{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map(t=>this.getFile(t))}getObjectOfFilesPerState(){let{files:e,totalProgress:t,error:r}=this.getState(),s=Object.values(e),n=[],a=[],u=[],c=[],p=[],f=[],d=[],v=[],_=[];for(let k of s){let{progress:A}=k;!A.uploadComplete&&A.uploadStarted&&(n.push(k),k.isPaused||v.push(k)),A.uploadStarted||a.push(k),(A.uploadStarted||A.preprocess||A.postprocess)&&u.push(k),A.uploadStarted&&c.push(k),k.isPaused&&p.push(k),A.uploadComplete&&f.push(k),k.error&&d.push(k),(A.preprocess||A.postprocess)&&_.push(k)}return{newFiles:a,startedFiles:u,uploadStartedFiles:c,pausedFiles:p,completeFiles:f,erroredFiles:d,inProgressFiles:n,inProgressNotPausedFiles:v,processingFiles:_,isUploadStarted:c.length>0,isAllComplete:t===100&&f.length===s.length&&_.length===0,isAllErrored:!!r&&d.length===s.length,isAllPaused:n.length!==0&&p.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:s.some(k=>k.isGhost)}}#n(e){for(let a of e)a.isRestriction?this.emit("restriction-failed",a.file,a):this.emit("error",a,a.file),this.log(a,"warning");let t=e.filter(a=>a.isUserFacing),r=4,s=t.slice(0,r),n=t.slice(r);s.forEach(({message:a,details:u=""})=>{this.info({message:a,details:u},"error",this.opts.infoTimeout)}),n.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:n.length})})}validateRestrictions(e,t=this.getFiles()){try{this.#t.validate(t,[e])}catch(r){return r}return null}validateSingleFile(e){try{this.#t.validateSingleFile(e)}catch(t){return t.message}return null}validateAggregateRestrictions(e){let t=this.getFiles();try{this.#t.validateAggregateRestrictions(t,e)}catch(r){return r.message}return null}#a(e){let{missingFields:t,error:r}=this.#t.getMissingRequiredMetaFields(e);return t.length>0?(this.setFileState(e.id,{missingRequiredMetaFields:t,error:r.message}),this.log(r.message),this.emit("restriction-failed",e,r),!1):(t.length===0&&e.missingRequiredMetaFields&&this.setFileState(e.id,{missingRequiredMetaFields:[]}),!0)}#c(e){let t=!0;for(let r of Object.values(e))this.#a(r)||(t=!1);return t}#u(e){let{allowNewUpload:t}=this.getState();if(t===!1){let r=new ct(this.i18n("noMoreFilesAllowed"),{file:e});throw this.#n([r]),r}}checkIfFileAlreadyExists(e){let{files:t}=this.getState();return!!(t[e]&&!t[e].isGhost)}#d(e){let t=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e,meta:{},isRemote:!1,source:void 0,preview:void 0}:e,r=Gi(t),s=na(r,t),n=Et(s).extension,a=Nr(t,this.getID()),u={...t.meta,name:s,type:r},c=Number.isFinite(t.data.size)?t.data.size:null;return{source:t.source||"",id:a,name:s,extension:n||"",meta:{...this.getState().meta,...u},type:r,progress:{percentage:0,bytesUploaded:!1,bytesTotal:c,uploadComplete:!1,uploadStarted:null},size:c,isGhost:!1,...t.isRemote?{isRemote:!0,remote:t.remote,data:t.data}:{isRemote:!1,data:t.data},preview:t.preview}}#p(){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))}#h(e){let{files:t}=this.getState(),r={...t},s=[],n=[];for(let a of e)try{let u=this.#d(a);this.#u(u);let c=t[u.id],p=c?.isGhost;if(p&&!u.isRemote){if(u.data==null)throw new Error("File data is missing");u={...c,isGhost:!1,data:u.data},this.log(`Replaced the blob in the restored ghost file: ${u.name}, ${u.id}`)}let f=this.opts.onBeforeFileAdded(u,r);if(t=this.getState().files,r={...t,...r},!f&&this.checkIfFileAlreadyExists(u.id))throw new ct(this.i18n("noDuplicates",{fileName:u.name??this.i18n("unnamed")}),{file:u});if(f===!1&&!p)throw new ct("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:u});typeof f=="object"&&f!==null&&(u=f),this.#t.validateSingleFile(u),r[u.id]=u,s.push(u)}catch(u){n.push(u)}try{this.#t.validateAggregateRestrictions(Object.values(t),s)}catch(a){return n.push(a),{nextFilesState:t,validFilesToAdd:[],errors:n}}return{nextFilesState:r,validFilesToAdd:s,errors:n}}addFile(e){let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#h([e]),n=s.filter(u=>u.isRestriction);if(this.#n(n),s.length>0)throw s[0];this.setState({files:t});let[a]=r;return this.emit("file-added",a),this.emit("files-added",r),this.log(`Added file: ${a.name}, ${a.id}, mime type: ${a.type}`),this.#p(),a.id}addFiles(e){let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#h(e),n=s.filter(u=>u.isRestriction);this.#n(n);let a=s.filter(u=>!u.isRestriction);if(a.length>0){let u=`Multiple errors occurred while adding files:
`;if(a.forEach(c=>{u+=`
* ${c.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:a.length}),details:u},"error",this.opts.infoTimeout),typeof AggregateError=="function")throw new AggregateError(a,u);{let c=new Error(u);throw c.errors=a,c}}this.setState({files:t}),r.forEach(u=>{this.emit("file-added",u)}),this.emit("files-added",r),r.length>5?this.log(`Added batch of ${r.length} files`):Object.values(r).forEach(u=>{this.log(`Added file: ${u.name}
id: ${u.id}
type: ${u.type}`)}),r.length>0&&this.#p()}removeFiles(e){let{files:t,currentUploads:r}=this.getState(),s={...t},n={...r},a=Object.create(null);e.forEach(f=>{t[f]&&(a[f]=t[f],delete s[f])});function u(f){return a[f]===void 0}o(u,"fileIsNotRemoved"),Object.keys(n).forEach(f=>{let d=r[f].fileIDs.filter(u);if(d.length===0){delete n[f];return}let{capabilities:v}=this.getState();if(d.length!==r[f].fileIDs.length&&!v.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");n[f]={...r[f],fileIDs:d}});let c={currentUploads:n,files:s};Object.keys(s).length===0&&(c.allowNewUpload=!0,c.error=null,c.recoveredState=null),this.setState(c),this.#y();let p=Object.keys(a);p.forEach(f=>{this.emit("file-removed",a[f])}),p.length>5?this.log(`Removed ${p.length} files`):this.log(`Removed files: ${p.join(", ")}`)}removeFile(e){this.removeFiles([e])}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).progress.uploadComplete)return;let t=this.getFile(e),s=!(t.isPaused||!1);return this.setFileState(e,{isPaused:s}),this.emit("upload-pause",t,s),s}pauseAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!0};e[r]=s}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!1,error:null};e[r]=s}),this.setState({files:e}),this.emit("resume-all")}#f(){let{files:e}=this.getState();return Object.keys(e).filter(t=>{let r=e[t];return r.error&&(!r.missingRequiredMetaFields||r.missingRequiredMetaFields.length===0)})}async#g(){let e=this.#f(),t={...this.getState().files};if(e.forEach(s=>{t[s]={...t[s],isPaused:!1,error:null}}),this.setState({files:t,error:null}),this.emit("retry-all",this.getFilesByIds(e)),e.length===0)return{successful:[],failed:[]};let r=this.#w(e,{forceAllowNewUpload:!0});return this.#k(r)}async retryAll(){let e=await this.#g();return this.emit("complete",e),e}cancelAll(){this.emit("cancel-all");let{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t),this.setState(vo)}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(e));let t=this.#w([e],{forceAllowNewUpload:!0});return this.#k(t)}logout(){this.iteratePlugins(e=>{e.provider?.logout?.()})}#b=o((e,t)=>{let r=e?this.getFile(e.id):void 0;if(e==null||!r){this.log(`Not setting progress for a file that has been removed: ${e?.id}`);return}if(r.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${e.id}`);return}let s={bytesTotal:t.bytesTotal,percentage:t.bytesTotal!=null&&Number.isFinite(t.bytesTotal)&&t.bytesTotal>0?Math.round(t.bytesUploaded/t.bytesTotal*100):void 0};r.progress.uploadStarted!=null?this.setFileState(e.id,{progress:{...r.progress,...s,bytesUploaded:t.bytesUploaded}}):this.setFileState(e.id,{progress:{...r.progress,...s}}),this.#y()},"#handleUploadProgress");#m(){let e=this.#P(),t=null;e!=null&&(t=Math.round(e*100),t>100?t=100:t<0&&(t=0)),this.emit("progress",t??0),this.setState({totalProgress:t??0})}#y=(0,up.default)(()=>this.#m(),500,{leading:!0,trailing:!0});[Symbol.for("uppy test: updateTotalProgress")](){return this.#m()}#P(){let t=this.getFiles().filter(c=>c.progress.uploadStarted||c.progress.preprocess||c.progress.postprocess);if(t.length===0)return 0;if(t.every(c=>c.progress.uploadComplete))return 1;let r=o(c=>c.progress.bytesTotal!=null&&c.progress.bytesTotal!==0,"isSizedFile"),s=t.filter(r),n=t.filter(c=>!r(c));if(s.every(c=>c.progress.uploadComplete)&&n.length>0&&!n.every(c=>c.progress.uploadComplete))return null;let a=s.reduce((c,p)=>c+(p.progress.bytesTotal??0),0),u=s.reduce((c,p)=>c+(p.progress.bytesUploaded||0),0);return a===0?0:u/a}#S(){let e=o((s,n,a)=>{let u=s.message||"Unknown error";s.details&&(u+=` ${s.details}`),this.setState({error:u}),n!=null&&n.id in this.getState().files&&this.setFileState(n.id,{error:u,response:a})},"errorHandler");this.on("error",e),this.on("upload-error",(s,n,a)=>{if(e(n,s,a),typeof n=="object"&&n.message){this.log(n.message,"error");let u=new Error(this.i18n("failedToUpload",{file:s?.name??""}));u.isUserFacing=!0,u.details=n.message,n.details&&(u.details+=` ${n.details}`),this.#n([u])}else this.#n([n])});let t=null;this.on("upload-stalled",(s,n)=>{let{message:a}=s,u=n.map(c=>c.meta.name).join(", ");t||(this.info({message:a,details:u},"warning",this.opts.infoTimeout),t=setTimeout(()=>{t=null},this.opts.infoTimeout)),this.log(`${a} ${u}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});let r=o(s=>{let n=s.filter(u=>{let c=u!=null&&this.getFile(u.id);return c||this.log(`Not setting progress for a file that has been removed: ${u?.id}`),c}),a=Object.fromEntries(n.map(u=>[u.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:u.size}}]));this.patchFilesState(a)},"onUploadStarted");this.on("upload-start",r),this.on("upload-progress",this.#b),this.on("upload-success",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let a=this.getFile(s.id).progress,u=this.#o.size>0;this.setFileState(s.id,{progress:{...a,postprocess:u?{mode:"indeterminate"}:void 0,uploadComplete:!0,...!u&&{complete:!0},percentage:100,bytesUploaded:a.bytesTotal},response:n,uploadURL:n.uploadURL,isPaused:!1}),s.size==null&&this.setFileState(s.id,{size:n.bytesUploaded||a.bytesTotal}),this.#y()}),this.on("preprocess-progress",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}this.setFileState(s.id,{progress:{...this.getFile(s.id).progress,preprocess:n}})}),this.on("preprocess-complete",s=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let n={...this.getState().files};n[s.id]={...n[s.id],progress:{...n[s.id].progress}},delete n[s.id].progress.preprocess,this.setState({files:n})}),this.on("postprocess-progress",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}this.setFileState(s.id,{progress:{...this.getState().files[s.id].progress,postprocess:n}})}),this.on("postprocess-complete",s=>{let n=s&&this.getFile(s.id);if(n==null){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let{postprocess:a,...u}=n.progress;this.patchFilesState({[n.id]:{progress:{...u,complete:!0}}})}),this.on("restored",()=>{this.#y()}),this.on("dashboard:file-edit-complete",s=>{s&&this.#a(s)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",this.#v),window.addEventListener("offline",this.#v),setTimeout(this.#v,3e3))}updateOnlineStatus(){window.navigator.onLine??!0?(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)}#v=this.updateOnlineStatus.bind(this);getID(){return this.opts.id}use(e,...t){if(typeof e!="function"){let a=`Expected a plugin class, but got ${e===null?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`;throw new TypeError(a)}let r=new e(this,...t),s=r.id;if(!s)throw new Error("Your plugin must have an id");if(!r.type)throw new Error("Your plugin must have a type");let n=this.getPlugin(s);if(n){let a=`Already found a plugin named '${n.id}'. Tried to use: '${s}'.
Uppy plugins must have unique \`id\` options.`;throw new Error(a)}return e.VERSION&&this.log(`Using ${s} v${e.VERSION}`),r.type in this.#e?this.#e[r.type].push(r):this.#e[r.type]=[r],r.install(),this.emit("plugin-added",r),this}getPlugin(e){for(let t of Object.values(this.#e)){let r=t.find(s=>s.id===e);if(r!=null)return r}}[Symbol.for("uppy test: getPlugins")](e){return this.#e[e]}iteratePlugins(e){Object.values(this.#e).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();let t=this.#e[e.type],r=t.findIndex(a=>a.id===e.id);r!==-1&&t.splice(r,1);let n={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(n)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),this.#r(),this.iteratePlugins(e=>{this.removePlugin(e)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",this.#v),window.removeEventListener("offline",this.#v))}hideInfo(){let{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t="info",r=3e3){let s=typeof e=="object";this.setState({info:[...this.getState().info,{type:t,message:s?e.message:e,details:s?e.details:null}]}),setTimeout(()=>this.hideInfo(),r),this.emit("info-visible")}log(e,t){let{logger:r}=this.opts;switch(t){case"error":r.error(e);break;case"warning":r.warn(e);break;default:r.debug(e);break}}#x=new Map;registerRequestClient(e,t){this.#x.set(e,t)}getRequestClientForFile(e){if(!("remote"in e&&e.remote))throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);let t=this.#x.get(e.remote.requestClientId);if(t==null)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return t}async restore(e){this.log(`Core: Running restored upload "${e}"`);let t=await this.#k(e);return this.emit("complete",t),t}#w(e,t={}){let{forceAllowNewUpload:r=!1}=t,{allowNewUpload:s,currentUploads:n}=this.getState();if(!s&&!r)throw new Error("Cannot create a new upload: already uploading.");let a=Dt();return this.emit("upload",a,this.getFilesByIds(e)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...n,[a]:{fileIDs:e,step:0,result:{}}}}),a}[Symbol.for("uppy test: createUpload")](...e){return this.#w(...e)}#E(e){let{currentUploads:t}=this.getState();return t[e]}addResultData(e,t){if(!this.#E(e)){this.log(`Not setting result for an upload that has been removed: ${e}`);return}let{currentUploads:r}=this.getState(),s={...r[e],result:{...r[e].result,...t}};this.setState({currentUploads:{...r,[e]:s}})}#_(e){let{[e]:t,...r}=this.getState().currentUploads;this.setState({currentUploads:r})}async#k(e){let t=o(()=>{let{currentUploads:a}=this.getState();return a[e]},"getCurrentUpload"),r=t();if(!r)throw new Error("Nonexistent upload");let s=[...this.#s,...this.#l,...this.#o];try{for(let a=r.step||0;a<s.length;a++){let u=s[a];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...r,step:a}}});let{fileIDs:c}=r;if(await u(c,e),r=t(),!r)break}}catch(a){throw this.#_(e),a}if(r){r.fileIDs.forEach(p=>{let f=this.getFile(p);f?.progress.postprocess&&this.emit("postprocess-complete",f)});let a=r.fileIDs.map(p=>this.getFile(p)),u=a.filter(p=>!p.error),c=a.filter(p=>p.error);this.addResultData(e,{successful:u,failed:c,uploadID:e}),r=t()}let n;return r&&(n=r.result,this.#_(e)),n==null&&(this.log(`Not setting result for an upload that has been removed: ${e}`),n={successful:[],failed:[],uploadID:e}),n}async upload(){this.#e.uploader?.length||this.log("No uploader type plugins are used","warning");let{files:e}=this.getState();if(this.#f().length>0){let s=await this.#g();if(!(this.getFiles().filter(a=>a.progress.uploadStarted==null).length>0))return this.emit("complete",s),s;({files:e}=this.getState())}let r=this.opts.onBeforeUpload(e);if(r===!1)throw new Error("Not starting the upload because onBeforeUpload returned false");r&&typeof r=="object"&&(e=r,this.setState({files:e}));try{if(this.#t.validateMinNumberOfFiles(e),!this.#c(e))throw new ct(this.i18n("missingRequiredMetaField"));let{currentUploads:s}=this.getState(),n=Object.values(s).flatMap(p=>p.fileIDs),a=Object.keys(e).filter(p=>{let f=this.getFile(p);return f&&!f.progress.uploadStarted&&!n.includes(p)}),u=this.#w(a),c=await this.#k(u);return this.emit("complete",c),c}catch(s){throw this.#n([s]),s}}},ua=la;var xp={};An(xp,{Provider:()=>qe,RequestClient:()=>Je,SearchProvider:()=>bi,getAllowedHosts:()=>He,tokenStorage:()=>Te});function yv(i){return i.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}o(yv,"escapeRegex");function ca(i){if(typeof i=="string")return new RegExp(i);if(i instanceof RegExp)return i}o(ca,"wrapInRegex");function He(i,e){if(i){let r=o(s=>{if(!(typeof s=="string"&&ca(s))&&!(s instanceof RegExp))throw new TypeError('The option "companionAllowedHosts" must be one of string, Array, RegExp')},"validate");return Array.isArray(i)?i.every(r):r(i),i}let t=e;return/^(?!https?:\/\/).*$/i.test(t)&&(t=`https://${e.replace(/^\/\//,"")}`),t=new URL(t).origin,t=yv(t),t}o(He,"getAllowedHosts");function pp(i,e){return(Array.isArray(e)?e.map(ca):[ca(e)]).some(r=>r?.test(i)||r?.test(`${i}/`))}o(pp,"isOriginAllowed");var vp=ae(gp(),1);var bv=Object.prototype.toString,wv=o(i=>bv.call(i)==="[object Error]","isError"),Sv=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Load failed","Network request failed","fetch failed","terminated"]);function pa(i){return i&&wv(i)&&i.name==="TypeError"&&typeof i.message=="string"?i.message==="Load failed"?i.stack===void 0:Sv.has(i.message):!1}o(pa,"isNetworkError");var er=class extends Error{static{o(this,"AbortError")}constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},yp=o((i,e,t)=>{let r=t.retries-(e-1);return i.attemptNumber=e,i.retriesLeft=r,i},"decorateErrorWithCounts");async function bo(i,e){return new Promise((t,r)=>{e={onFailedAttempt(){},retries:10,shouldRetry:o(()=>!0,"shouldRetry"),...e};let s=vp.default.operation(e),n=o(()=>{s.stop(),r(e.signal?.reason)},"abortHandler");e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",n,{once:!0});let a=o(()=>{e.signal?.removeEventListener("abort",n),s.stop()},"cleanUp");s.attempt(async u=>{try{let c=await i(u);a(),t(c)}catch(c){try{if(!(c instanceof Error))throw new TypeError(`Non-error was thrown: "${c}". You should only throw errors.`);if(c instanceof er)throw c.originalError;if(c instanceof TypeError&&!pa(c))throw c;if(yp(c,u,e),await e.shouldRetry(c)||(s.stop(),r(c)),await e.onFailedAttempt(c),!s.retry(c))throw s.mainError()}catch(p){yp(p,u,e),a(),r(p)}}})})}o(bo,"pRetry");var bp={name:"@uppy/companion-client",description:"Client library for communication with Companion. Intended for use in Uppy plugins.",version:"5.1.1",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin","companion","provider"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^","namespace-emitter":"^2.0.1","p-retry":"^6.1.0"},devDependencies:{jsdom:"^26.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"}};var da=class extends Error{static{o(this,"AuthError")}isAuthError;constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}},wp=da;function Pv(i){return i.replace(/\/$/,"")}o(Pv,"stripSlash");var Sp=10,_v=300*1e3,fa=401,ha=class extends Error{static{o(this,"HttpError")}statusCode;constructor({statusCode:e,message:t}){super(t),this.name="HttpError",this.statusCode=e}};async function kv(i){if(i.status===fa)throw new wp;if(i.ok)return i.json();let e=`Failed request with status: ${i.status}. ${i.statusText}`,t;try{t=await i.json(),t.message&&(e=`${e} message: ${t.message}`),t.requestId&&(e=`${e} request-Id: ${t.requestId}`)}catch(r){throw new Error(e,{cause:r})}throw i.status>=400&&i.status<=499&&t.message?new Hn(t.message):new ha({statusCode:i.status,message:e})}o(kv,"handleJSONResponse");function Ev(i,e,t){let{progress:r,bytesUploaded:s,bytesTotal:n}=e;r&&(i.uppy.log(`Upload progress: ${r}`),i.uppy.emit("upload-progress",t,{uploadStarted:t.progress.uploadStarted??0,bytesUploaded:s,bytesTotal:n}))}o(Ev,"emitSocketProgress");var Je=class{static{o(this,"RequestClient")}static VERSION=bp.version;#e;uppy;opts;constructor(e,t){this.uppy=e,this.opts=t,this.onReceiveResponse=this.onReceiveResponse.bind(this),this.#e=t.companionHeaders}setCompanionHeaders(e){this.#e=e}[Symbol.for("uppy test: getCompanionHeaders")](){return this.#e}get hostname(){let{companion:e}=this.uppy.getState(),t=this.opts.companionUrl;return Pv(e?.[t]?e[t]:t)}async headers(e=!1){return{...{Accept:"application/json",...e?void 0:{"Content-Type":"application/json"}},...this.#e}}onReceiveResponse(e){let{headers:t}=e,s=this.uppy.getState().companion||{},n=this.opts.companionUrl;t.has("i-am")&&t.get("i-am")!==s[n]&&this.uppy.setState({companion:{...s,[n]:t.get("i-am")}})}#t(e){return/^(https?:|)\/\//.test(e)?e:`${this.hostname}/${e}`}async request({path:e,method:t="GET",data:r,skipPostResponse:s,signal:n}){try{let a=await this.headers(!r),u=await Qt(this.#t(e),{method:t,signal:n,headers:a,credentials:this.opts.companionCookiesRule||"same-origin",body:r?JSON.stringify(r):null});return s||this.onReceiveResponse(u),await kv(u)}catch(a){throw a.isAuthError||a.name==="UserFacingApiError"||a.name==="AbortError"?a:new di(`Could not ${t} ${this.#t(e)}`,{cause:a})}}async get(e,t){return this.request({...t,path:e})}async post(e,t,r){return this.request({...r,path:e,method:"POST",data:t})}async delete(e,t,r){return this.request({...r,path:e,method:"DELETE",data:t})}async uploadRemoteFile(e,t,r){try{let{signal:s,getQueue:n}=r||{};return await bo(async()=>{let a=this.uppy.getFile(e.id)?.serverToken;if(a!=null)return this.uppy.log(`Connecting to exiting websocket ${a}`),this.#i({file:e,queue:n(),signal:s});let c=await n().wrapPromiseFunction(async(...p)=>{try{return await this.#r(...p)}catch(f){if(f.isAuthError)throw new er(f);if(f.cause==null)throw f;let d=f.cause,v=o(()=>[408,409,429,418,423].includes(d.statusCode)||d.statusCode>=500&&d.statusCode<=599&&![501,505].includes(d.statusCode),"isRetryableHttpError");throw d.name==="HttpError"&&!v()?new er(d):d}},{priority:-1})({file:e,postBody:t,signal:s}).abortOn(s);if(this.uppy.getFile(e.id))return this.uppy.setFileState(e.id,{serverToken:c}),this.#i({file:this.uppy.getFile(e.id),queue:n(),signal:s})},{retries:Sp,signal:s,onFailedAttempt:o(a=>this.uppy.log(`Retrying upload due to: ${a.message}`,"warning"),"onFailedAttempt")})}catch(s){if(s.name==="AbortError")return;throw this.uppy.emit("upload-error",e,s),s}}#r=o(async({file:e,postBody:t,signal:r})=>{if(e.remote?.url==null)throw new Error("Cannot connect to an undefined URL");return(await this.post(e.remote.url,{...e.remote.body,...t},{signal:r})).token},"#requestSocketToken");async#i({file:e,queue:t,signal:r}){let s,{capabilities:n}=this.uppy.getState();try{return await new Promise((a,u)=>{let c=e.serverToken,p=lo(e.remote.companionUrl),f,d,v,{isPaused:_}=e,k=o((Q,K)=>{if(f==null||f.readyState!==f.OPEN){this.uppy.log(`Cannot send "${Q}" to socket ${e.id} because the socket state was ${String(f?.readyState)}`,"warning");return}f.send(JSON.stringify({action:Q,payload:K??{}}))},"socketSend");function A(){n.resumableUploads&&k(_?"pause":"resume")}o(A,"sendState");let F=o(async()=>{d&&d.abort(),d=new AbortController;let Q=o(Z=>{this.uppy.setFileState(e.id,{serverToken:null}),d?.abort?.(),u(Z)},"onFatalError");function K(){clearTimeout(v),!_&&(v=setTimeout(()=>Q(new Error("Timeout waiting for message from Companion socket")),_v))}o(K,"resetActivityTimeout");try{await t.wrapPromiseFunction(async()=>{await bo(o(async()=>new Promise((ye,se)=>{f=new WebSocket(`${p}/api/${c}`),K(),f.addEventListener("close",()=>{f=void 0,se(new Error("Socket closed unexpectedly"))}),f.addEventListener("error",me=>{this.uppy.log(`Companion socket error ${JSON.stringify(me)}, closing socket`,"warning"),f?.close()}),f.addEventListener("open",()=>{A()}),f.addEventListener("message",me=>{K();try{let{action:_e,payload:ve}=JSON.parse(me.data);switch(_e){case"progress":{Ev(this,ve,this.uppy.getFile(e.id));break}case"success":{let E=ve.response?.responseText;this.uppy.emit("upload-success",this.uppy.getFile(e.id),{uploadURL:ve.url,status:ve.response?.status??200,body:E?JSON.parse(E):void 0}),d?.abort?.(),a();break}case"error":{let{message:E}=ve.error;throw Object.assign(new Error(E),{cause:ve.error})}default:this.uppy.log(`Companion socket unknown action ${_e}`,"warning")}}catch(_e){Q(_e)}});let we=o(()=>{this.uppy.log(`Closing socket ${e.id}`),clearTimeout(v),f&&f.close(),f=void 0},"closeSocket");d.signal.addEventListener("abort",()=>{we()})}),"reconnectWebsocket"),{retries:Sp,signal:d.signal,onFailedAttempt:o(()=>{d.signal.aborted||this.uppy.log(`Retrying websocket ${e.id}`)},"onFailedAttempt")})})().abortOn(d.signal)}catch(Z){if(d.signal.aborted)return;Q(Z)}},"createWebsocket"),R=o(Q=>{n.resumableUploads&&(_=Q,f&&A())},"pause"),U=o(Q=>{n.individualCancellation&&Q.id===e.id&&(k("cancel"),d?.abort?.(),this.uppy.log(`upload ${e.id} was removed`),a())},"onFileRemove"),C=o(()=>{k("cancel"),d?.abort?.(),this.uppy.log(`upload ${e.id} was canceled`),a()},"onCancelAll"),Y=o((Q,K)=>{Q?.id===e.id&&R(K)},"onFilePausedChange"),$=o(()=>R(!0),"onPauseAll"),H=o(()=>R(!1),"onResumeAll");this.uppy.on("file-removed",U),this.uppy.on("cancel-all",C),this.uppy.on("upload-pause",Y),this.uppy.on("pause-all",$),this.uppy.on("resume-all",H),s=o(()=>{this.uppy.off("file-removed",U),this.uppy.off("cancel-all",C),this.uppy.off("upload-pause",Y),this.uppy.off("pause-all",$),this.uppy.off("resume-all",H)},"removeEventHandlers"),r.addEventListener("abort",()=>{d?.abort()}),F()})}finally{s?.()}}};var Fv=o(i=>i.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),"getName");function Tv(){return location.origin}o(Tv,"getOrigin");var qe=class extends Je{static{o(this,"Provider")}#e;provider;id;name;pluginId;tokenKey;companionKeysParams;preAuthToken;supportsRefreshToken;constructor(e,t){super(e,t),this.provider=t.provider,this.id=this.provider,this.name=this.opts.name||Fv(this.id),this.pluginId=this.opts.pluginId,this.tokenKey=`companion-${this.pluginId}-auth-token`,this.companionKeysParams=this.opts.companionKeysParams,this.preAuthToken=null,this.supportsRefreshToken=!!t.supportsRefreshToken}async headers(){let[e,t]=await Promise.all([super.headers(),this.#t()]),r={};return t&&(r["uppy-auth-token"]=t),this.companionKeysParams&&(r["uppy-credentials-params"]=btoa(JSON.stringify({params:this.companionKeysParams}))),{...e,...r}}onReceiveResponse(e){super.onReceiveResponse(e);let t=this.#r(),s=t.getPluginState().authenticated?e.status!==fa:e.status<400;return t.setPluginState({authenticated:s}),e}async setAuthToken(e){return this.#r().storage.setItem(this.tokenKey,e)}async#t(){return this.#r().storage.getItem(this.tokenKey)}async removeAuthToken(){return this.#r().storage.removeItem(this.tokenKey)}#r(){let e=this.uppy.getPlugin(this.pluginId);if(e==null)throw new Error("Plugin was nullish");return e}async ensurePreAuth(){if(this.companionKeysParams&&!this.preAuthToken&&(await this.fetchPreAuthToken(),!this.preAuthToken))throw new Error("Could not load authentication data required for third-party login. Please try again later.")}authQuery(e){return{}}authUrl({authFormData:e,query:t}){let r=new URLSearchParams({...t,state:btoa(JSON.stringify({origin:Tv()})),...this.authQuery({authFormData:e})});return this.preAuthToken&&r.set("uppyPreAuthToken",this.preAuthToken),`${this.hostname}/${this.id}/connect?${r}`}async loginSimpleAuth({uppyVersions:e,authFormData:t,signal:r}){let s=await this.post(`${this.id}/simple-auth`,{form:t},{qs:{uppyVersions:e},signal:r});this.setAuthToken(s.uppyAuthToken)}async loginOAuth({uppyVersions:e,authFormData:t,signal:r}){await this.ensurePreAuth(),r.throwIfAborted();let s=this.authUrl({query:{uppyVersions:e},authFormData:t}),n=window.open(s,"_blank"),a,u;try{return await new Promise((c,p)=>{u=o(f=>{if(f.source!==n){let _="";try{_=JSON.stringify(f.data)}catch{}this.uppy.log(`ignoring event from unknown source ${_}`,"warning");return}let{companionAllowedHosts:d}=this.#r().opts;if(!pp(f.origin,d)){this.uppy.log(`ignoring event from ${f.origin} vs allowed pattern ${d}`,"warning");return}let v=typeof f.data=="string"?JSON.parse(f.data):f.data;if(v.error){let{uppy:_}=this,k=_.i18n("authAborted");_.info({message:k},"warning",5e3),p(new Error("auth aborted"));return}if(!v.token){p(new Error("did not receive token from auth window"));return}c(this.setAuthToken(v.token))},"handleMessage"),n&&(a=window.setInterval(()=>{n.closed&&p(new Error("Auth window was closed by the user"))},500)),r.addEventListener("abort",()=>p(new Error("Aborted"))),window.addEventListener("message",u)})}finally{n?.close(),window.clearInterval(a),u&&window.removeEventListener("message",u)}}async login({uppyVersions:e,authFormData:t,signal:r}){return this.loginOAuth({uppyVersions:e,authFormData:t,signal:r})}refreshTokenUrl(){return`${this.hostname}/${this.id}/refresh-token`}fileUrl(e){return`${this.hostname}/${this.id}/get/${e}`}async request(...e){await this.#e;try{return await super.request(...e)}catch(t){if(!this.supportsRefreshToken)throw t;let r=await this.#t();if(!t.isAuthError||!r)throw t;return this.#e==null&&(this.#e=(async()=>{try{this.uppy.log("[CompanionClient] Refreshing expired auth token");let s=await super.request({path:this.refreshTokenUrl(),method:"POST"});await this.setAuthToken(s.uppyAuthToken)}catch(s){throw s.isAuthError&&await this.removeAuthToken(),t}finally{this.#e=void 0}})()),await this.#e,super.request(...e)}}async fetchPreAuthToken(){if(this.companionKeysParams)try{let e=await this.post(`${this.id}/preauth/`,{params:this.companionKeysParams});this.preAuthToken=e.token}catch(e){this.uppy.log(`[CompanionClient] unable to fetch preAuthToken ${e}`,"warning")}}list(e,t){return this.get(`${this.id}/list/${e||""}`,t)}search(e,t={}){let r=new URLSearchParams;r.set("q",e),t.path&&r.set("path",t.path),t.cursor&&r.set("cursor",t.cursor);let n=`${`${this.id}/search`}?${r.toString()}`;return this.get(n,t)}async logout(e){let t=await this.get(`${this.id}/logout`,e);return await this.removeAuthToken(),t}};var Cv=o(i=>i.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),"getName"),bi=class extends Je{static{o(this,"SearchProvider")}provider;id;name;pluginId;constructor(e,t){super(e,t),this.provider=t.provider,this.id=this.provider,this.name=this.opts.name||Cv(this.id),this.pluginId=this.opts.pluginId}fileUrl(e){return`${this.hostname}/search/${this.id}/get/${e}`}search(e,t){return this.get(`search/${this.id}/list?q=${encodeURIComponent(e)}${t?`&${t}`:""}`)}};var Te={};An(Te,{getItem:()=>Rv,removeItem:()=>Uv,setItem:()=>Av});async function Av(i,e){localStorage.setItem(i,e)}o(Av,"setItem");async function Rv(i){return localStorage.getItem(i)}o(Rv,"getItem");async function Uv(i){localStorage.removeItem(i)}o(Uv,"removeItem");var Ea={};An(Ea,{FilterInput:()=>ir,GoogleDriveIcon:()=>or,GooglePhotosIcon:()=>sr,GooglePickerView:()=>wi,ProviderViews:()=>Ne,SearchProviderViews:()=>ii,SearchView:()=>No,authorize:()=>Zr,defaultPickerIcon:()=>nr,ensureScriptsInjected:()=>So,logout:()=>xo,pollPickingSession:()=>ko,showDrivePicker:()=>Po,showPhotosPicker:()=>_o,useSearchForm:()=>tr});function tr(i){let e=rt(r=>{r.preventDefault(),i()},[i]),[t]=it(()=>{let r=document.createElement("form");return r.setAttribute("tabindex","-1"),r.id=Dt(),r});return ze(()=>(document.body.appendChild(t),t.addEventListener("submit",e),()=>{t.removeEventListener("submit",e),document.body.removeChild(t)}),[t,e]),{formId:t.id}}o(tr,"useSearchForm");function Ov({value:i,onChange:e,onSubmit:t,inputLabel:r,i18n:s}){let{formId:n}=tr(t);return l("section",{className:"uppy-ProviderBrowser-searchFilter",children:[l("input",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterInput",type:"search","aria-label":r,placeholder:r,value:i,onInput:o(a=>e(a.target.value),"onInput"),form:n,"data-uppy-super-focusable":!0}),l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-ProviderBrowser-searchFilterIcon",width:"12",height:"12",viewBox:"0 0 12 12",children:l("path",{d:"M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z"})}),i&&l("button",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterReset",type:"button","aria-label":s("resetFilter"),onClick:o(()=>e(""),"onClick"),children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",viewBox:"0 0 19 19",children:l("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"})})})]})}o(Ov,"FilterInput");var ir=Ov;function Dv(){return l("svg",{width:"26",height:"26",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg",children:l("g",{fill:"none","fill-rule":"evenodd",children:[l("circle",{fill:"#FFF",cx:"13",cy:"13",r:"13"}),l("path",{d:"M21.64 13.205c0-.639-.057-1.252-.164-1.841H13v3.481h4.844a4.14 4.14 0 01-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4","fill-rule":"nonzero"}),l("path",{d:"M13 22c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H4.957v2.332A8.997 8.997 0 0013 22z",fill:"#34A853","fill-rule":"nonzero"}),l("path",{d:"M7.964 14.71A5.41 5.41 0 017.682 13c0-.593.102-1.17.282-1.71V8.958H4.957A8.996 8.996 0 004 13c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05","fill-rule":"nonzero"}),l("path",{d:"M13 7.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C17.463 4.891 15.426 4 13 4a8.997 8.997 0 00-8.043 4.958l3.007 2.332C8.672 9.163 10.656 7.58 13 7.58z",fill:"#EA4335","fill-rule":"nonzero"}),l("path",{d:"M4 4h18v18H4z"})]})})}o(Dv,"GoogleIcon");function Iv({pluginName:i,i18n:e,onAuth:t}){let r=i==="Google Drive",s=rt(n=>{n.preventDefault(),t()},[t]);return l("form",{onSubmit:s,children:r?l("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn uppy-Provider-btn-google","data-uppy-super-focusable":!0,children:[l(Dv,{}),e("signInWithGoogle")]}):l("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn","data-uppy-super-focusable":!0,children:e("authenticateWith",{pluginName:i})})})}o(Iv,"DefaultForm");var Nv=o(({pluginName:i,i18n:e,onAuth:t})=>l(Iv,{pluginName:i,i18n:e,onAuth:t}),"defaultRenderForm");function Qr({loading:i,pluginName:e,pluginIcon:t,i18n:r,handleAuth:s,renderForm:n=Nv}){return l("div",{className:"uppy-Provider-auth",children:[l("div",{className:"uppy-Provider-authIcon",children:t()}),l("div",{className:"uppy-Provider-authTitle",children:r("authenticateWithTitle",{pluginName:e})}),n({pluginName:e,i18n:r,loading:i,onAuth:s})]})}o(Qr,"AuthView");var wo=o(i=>({authorization:`Bearer ${i}`}),"getAuthHeader"),Pp=new Set,_p=!1;async function kp(i){Pp.has(i)||(await new Promise((e,t)=>{let r=document.createElement("script");r.src=i,r.addEventListener("load",()=>e()),r.addEventListener("error",s=>t(s.error)),document.head.appendChild(r)}),Pp.add(i))}o(kp,"injectScript");async function So(i){await Promise.all([kp("https://accounts.google.com/gsi/client"),(async()=>{await kp("https://apis.google.com/js/api.js"),i==="drive"&&!_p&&(await new Promise(e=>gapi.load("client:picker",()=>e())),await gapi.client.load("https://www.googleapis.com/discovery/v1/apis/drive/v3/rest"),_p=!0)})()])}o(So,"ensureScriptsInjected");async function Mv(i,e){return!!(await fetch(`https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=${encodeURIComponent(i)}`,{signal:e})).ok}o(Mv,"isTokenValid");async function Zr({pickerType:i,clientId:e,accessToken:t}){let r=await new Promise((s,n)=>{let a=i==="drive"?["https://www.googleapis.com/auth/drive.file"]:["https://www.googleapis.com/auth/photospicker.mediaitems.readonly"],u=google.accounts.oauth2.initTokenClient({client_id:e,scope:a.join(" "),callback:s,error_callback:n});t===null?u.requestAccessToken({prompt:"consent"}):u.requestAccessToken({prompt:""})});if(r.error)throw new Error(`OAuth2 error: ${r.error}`);return r.access_token}o(Zr,"authorize");async function xo(i){await new Promise(e=>google.accounts.oauth2.revoke(i,e))}o(xo,"logout");var rr=class extends Error{static{o(this,"InvalidTokenError")}constructor(){super("Invalid or expired token"),this.name="InvalidTokenError"}};async function Po({token:i,apiKey:e,appId:t,onFilesPicked:r,signal:s,onLoadingChange:n,onError:a}){if(!await Mv(i,s))throw new rr;async function u({doc:f,token:d,signal:v}){if(f.mimeType==="application/vnd.google-apps.shortcut")return f.shortcutDetails?.targetMimeType==="application/vnd.google-apps.folder"?[]:[{platform:"drive",id:f.id,name:f.name,mimeType:f.mimeType}];if(f.mimeType!=="application/vnd.google-apps.folder")return[{platform:"drive",id:f.id,name:f.name,mimeType:f.mimeType}];let _=wo(d),k=[],A;do{let F=new URLSearchParams({q:`'${f.id.replace(/'/g,"\\'")}' in parents and trashed = false`,fields:"nextPageToken, files(id, name, mimeType, shortcutDetails(targetMimeType))",includeItemsFromAllDrives:"true",supportsAllDrives:"true",pageSize:"1000",...A&&{pageToken:A}}),R=await fetch(`https://www.googleapis.com/drive/v3/files?${F.toString()}`,{headers:_,signal:v});if(!R.ok)throw new Error(`Failed to list folder contents for '${f.name}' (${f.id}): ${R.status} ${R.statusText}`);let U=await R.json();A=U.nextPageToken;for(let C of U.files)k.push(...await u({doc:C,token:d,signal:v}))}while(A);return k}o(u,"handleDocObjectRecursively");let c=o(async f=>{if(f.action===google.picker.Action.PICKED)try{n(!0);let d=[];for(let v of f.docs)d.push(...await u({doc:v,token:i,signal:s}));r(d,i)}catch(d){a(d)}finally{n(!1)}},"onPicked"),p=new google.picker.PickerBuilder().enableFeature(google.picker.Feature.NAV_HIDDEN).enableFeature(google.picker.Feature.MULTISELECT_ENABLED).setDeveloperKey(e).setAppId(t).setOAuthToken(i).addView(new google.picker.DocsView(google.picker.ViewId.DOCS).setIncludeFolders(!0).setSelectFolderEnabled(!0).setMode(google.picker.DocsViewMode.LIST)).setCallback(c).build();p.setVisible(!0),s?.addEventListener("abort",()=>p.dispose())}o(Po,"showDrivePicker");async function _o({token:i,pickingSession:e,onPickingSessionChange:t,signal:r}){let s=wo(i),n=e;if(n==null){let u=await fetch("https://photospicker.googleapis.com/v1/sessions",{method:"post",headers:s,signal:r});if(u.status===401&&(await u.json()).error?.status==="UNAUTHENTICATED")throw new rr;if(!u.ok)throw new Error("Failed to create a session");n=await u.json(),t(n)}let a=window.open(n.pickerUri);r?.addEventListener("abort",()=>a?.close())}o(_o,"showPhotosPicker");async function Lv({accessToken:i,pickingSession:e,signal:t}){let r=wo(i),s,n=[];do{let u=await fetch(`https://photospicker.googleapis.com/v1/mediaItems?${new URLSearchParams({sessionId:e.id,pageSize:String(100),...s&&{pageToken:s}}).toString()}`,{headers:r,signal:t});if(!u.ok)throw new Error("Failed to get a media items");let{mediaItems:c,nextPageToken:p}=await u.json();s=p,n.push(...c)}while(s);return n=n.flatMap(a=>a.type==="PHOTO"||a.type==="VIDEO"&&a.mediaFile.mediaFileMetadata.videoMetadata.processingStatus==="READY"?[a]:[]),n.map(a=>{let{id:u,type:c,mediaFile:{mimeType:p,filename:f,baseUrl:d}}=a;return{platform:"photos",id:u,mimeType:p,url:c==="VIDEO"?`${d}=dv`:`${d}=d`,name:f,metadata:{googlePhotosFileType:a.type,createTime:a.createTime,width:a.mediaFile.mediaFileMetadata.width,height:a.mediaFile.mediaFileMetadata.height,...a.type==="PHOTO"&&{cameraMake:a.mediaFile.mediaFileMetadata.photoMetadata?.cameraMake,cameraModel:a.mediaFile.mediaFileMetadata.photoMetadata?.cameraModel,focalLength:a.mediaFile.mediaFileMetadata.photoMetadata?.focalLength,apertureFNumber:a.mediaFile.mediaFileMetadata.photoMetadata?.apertureFNumber,isoEquivalent:a.mediaFile.mediaFileMetadata.photoMetadata?.isoEquivalent,exposureTime:a.mediaFile.mediaFileMetadata.photoMetadata?.exposureTime},...a.type==="VIDEO"&&{cameraMake:a.mediaFile.mediaFileMetadata.videoMetadata.cameraMake,cameraModel:a.mediaFile.mediaFileMetadata.videoMetadata.cameraModel,fps:a.mediaFile.mediaFileMetadata.videoMetadata.fps,processingStatus:a.mediaFile.mediaFileMetadata.videoMetadata.processingStatus}}}})}o(Lv,"resolvePickedPhotos");async function ko({pickingSessionRef:i,accessTokenRef:e,signal:t,onFilesPicked:r,onError:s}){for(let n=1;;)try{i.current!=null?n=parseFloat(i.current.pollingConfig.pollInterval):n=1,await Promise.race([new Promise(c=>setTimeout(c,n*1e3)),new Promise((c,p)=>{t.addEventListener("abort",p)})]),t.throwIfAborted();let a=e.current,u=i.current;if(u!=null&&a!=null){let c=wo(a),p=await fetch(`https://photospicker.googleapis.com/v1/sessions/${encodeURIComponent(u.id)}`,{headers:c,signal:t});if(!p.ok)throw new Error("Failed to get session");if((await p.json()).mediaItemsSet){let d=await Lv({accessToken:a,pickingSession:u,signal:t});i.current=void 0,r(d,a)}u.pollingConfig.timeoutIn==="0s"&&(i.current=void 0)}}catch(a){if(a instanceof Error&&a.name==="AbortError")return;s(a)}}o(ko,"pollPickingSession");var sr=o(()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"-7 -7 73 73",children:l("g",{fill:"none","fill-rule":"evenodd",children:[l("path",{d:"M-3-3h64v64H-3z"}),l("g",{"fill-rule":"nonzero",children:[l("path",{fill:"#FBBC04",d:"M14.8 13.4c8.1 0 14.7 6.6 14.7 14.8v1.3H1.3c-.7 0-1.3-.6-1.3-1.3C0 20 6.6 13.4 14.8 13.4z"}),l("path",{fill:"#EA4335",d:"M45.6 14.8c0 8.1-6.6 14.7-14.8 14.7h-1.3V1.3c0-.7.6-1.3 1.3-1.3C39 0 45.6 6.6 45.6 14.8z"}),l("path",{fill:"#4285F4",d:"M44.3 45.6c-8.2 0-14.8-6.6-14.8-14.8v-1.3h28.2c.7 0 1.3.6 1.3 1.3 0 8.2-6.6 14.8-14.8 14.8z"}),l("path",{fill:"#34A853",d:"M13.4 44.3c0-8.2 6.6-14.8 14.8-14.8h1.3v28.2c0 .7-.6 1.3-1.3 1.3-8.2 0-14.8-6.6-14.8-14.8z"})]})]})}),"GooglePhotosIcon"),or=o(()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("g",{fillRule:"nonzero",fill:"none",children:[l("path",{d:"M6.663 22.284l.97 1.62c.202.34.492.609.832.804l3.465-5.798H5c0 .378.1.755.302 1.096l1.361 2.278z",fill:"#0066DA"}),l("path",{d:"M16 12.09l-3.465-5.798c-.34.195-.63.463-.832.804l-6.4 10.718A2.15 2.15 0 005 18.91h6.93L16 12.09z",fill:"#00AC47"}),l("path",{d:"M23.535 24.708c.34-.195.63-.463.832-.804l.403-.67 1.928-3.228c.201-.34.302-.718.302-1.096h-6.93l1.474 2.802 1.991 2.996z",fill:"#EA4335"}),l("path",{d:"M16 12.09l3.465-5.798A2.274 2.274 0 0018.331 6h-4.662c-.403 0-.794.11-1.134.292L16 12.09z",fill:"#00832D"}),l("path",{d:"M20.07 18.91h-8.14l-3.465 5.798c.34.195.73.292 1.134.292h12.802c.403 0 .794-.11 1.134-.292L20.07 18.91z",fill:"#2684FC"}),l("path",{d:"M23.497 12.455l-3.2-5.359a2.252 2.252 0 00-.832-.804L16 12.09l4.07 6.82h6.917c0-.377-.1-.755-.302-1.096l-3.188-5.359z",fill:"#FFBA00"})]})}),"GoogleDriveIcon");function Bv(i,e){let[t,r]=it();ze(()=>{(async()=>r(await i.getItem(e)))()},[e,i]);let s=rt(async n=>(r(n),n==null?i.removeItem(e):i.setItem(e,n)),[e,i]);return[t,s]}o(Bv,"useStore");function wi({uppy:i,i18n:e,clientId:t,onFilesPicked:r,pickerType:s,apiKey:n,appId:a,storage:u}){let[c,p]=it(!1),[f,d]=Bv(u,`uppy:google-${s}-picker:accessToken`),v=Ye(),_=Ye(f),k=Ye(!1),A=rt(U=>{i.log("Access token updated"),d(U),_.current=U},[d,i]);ze(()=>{_.current=f},[f]);let F=rt(async U=>{let C=f,Y=o(async $=>{if(s==="drive")await Po({token:$,apiKey:n,appId:a,onFilesPicked:r,signal:U,onLoadingChange:o(H=>p(H),"onLoadingChange"),onError:o(H=>{i.log(H),i.info(e("failedToAddFiles"),"error")},"onError")});else{let H=o(Q=>{v.current=Q},"onPickingSessionChange");await _o({token:$,pickingSession:v.current,onPickingSessionChange:H,signal:U})}},"doShowPicker");p(!0);try{try{if(await So(s),C==null&&(C=await Zr({clientId:t,pickerType:s})),C==null)throw new Error;await Y(C),k.current=!0,A(C)}catch($){if($ instanceof rr)i.log("Token is invalid or expired, reauthenticating"),C=await Zr({pickerType:s,accessToken:C,clientId:t}),await Y(C),k.current=!0,A(C);else throw $}}catch($){$ instanceof Error&&"type"in $&&$.type==="popup_closed"||(A(null),i.log($))}finally{p(!1)}},[f,n,a,t,r,s,A,i,e]);ze(()=>{let U=new AbortController;return ko({pickingSessionRef:v,accessTokenRef:_,signal:U.signal,onFilesPicked:r,onError:o(C=>i.log(C),"onError")}),()=>U.abort()},[r,i]),ze(()=>{if(f===void 0||k.current)return;let U=new AbortController;return F(U.signal),()=>{k.current||U.abort()}},[f,F]);let R=rt(async()=>{f&&(await xo(f),A(null),v.current=void 0)},[f,A]);return c?l("div",{children:[e("pleaseWait"),"..."]}):f==null?l(Qr,{pluginName:e(s==="drive"?"pluginNameGoogleDrivePicker":"pluginNameGooglePhotosPicker"),pluginIcon:s==="drive"?or:sr,handleAuth:F,i18n:e,loading:c}):l("div",{style:{textAlign:"center"},children:[l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary",style:{display:"block",marginBottom:"1em"},disabled:c,onClick:o(()=>F(),"onClick"),children:e(s==="drive"?"pickFiles":"pickPhotos")}),l("button",{type:"button",className:"uppy-u-reset uppy-c-btn",disabled:c,onClick:R,children:e("logOut")})]})}o(wi,"GooglePickerView");var Gp=ae(Ge(),1),Kp=ae(yo(),1);var Fo={name:"@uppy/provider-views",description:"View library for Uppy remote provider plugins.",version:"5.2.2",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.min.css":"./dist/style.min.css","./css/style.css":"./dist/style.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^",classnames:"^2.2.6",lodash:"^4.17.21",nanoid:"^5.0.9","p-queue":"^8.0.0",preact:"^10.5.13"},devDependencies:{"@types/gapi":"^0.0.47","@types/google.accounts":"^0.0.14","@types/google.picker":"^0.0.42",cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"}};var Ep=ae(Ge(),1);function zv(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:11,height:14.5,viewBox:"0 0 44 58",children:l("path",{d:"M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"})})}o(zv,"FileIcon");function Hv(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",style:{minWidth:16,marginRight:3},viewBox:"0 0 276.157 276.157",children:l("path",{d:"M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"})})}o(Hv,"FolderIcon");function qv(){return l("svg",{"aria-hidden":"true",focusable:"false",style:{width:16,marginRight:4},viewBox:"0 0 58 58",children:[l("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),l("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"})]})}o(qv,"VideoIcon");function ti({itemIconString:i,alt:e=void 0}){if(i===null)return null;switch(i){case"file":return l(zv,{});case"folder":return l(Hv,{});case"video":return l(qv,{});default:return l("img",{src:i,alt:e,referrerPolicy:"no-referrer",loading:"lazy",width:16,height:16})}}o(ti,"ItemIcon");function Vv({file:i,toggleCheckbox:e,className:t,isDisabled:r,restrictionError:s,showTitles:n,children:a=null,i18n:u}){return l("li",{className:t,title:r&&s?s:void 0,children:[l("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox uppy-ProviderBrowserItem-checkbox--grid",onChange:e,name:"listitem",id:i.id,checked:i.status==="checked",disabled:r,"data-uppy-super-focusable":!0}),l("label",{htmlFor:i.id,"aria-label":i.data.name??u("unnamed"),className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[l(ti,{itemIconString:i.data.thumbnail||i.data.icon}),n&&(i.data.name??u("unnamed")),a]})]})}o(Vv,"GridItem");var ma=Vv;function ga({file:i,openFolder:e,className:t,isDisabled:r,restrictionError:s,toggleCheckbox:n,showTitles:a,i18n:u}){return l("li",{className:t,title:i.status!=="checked"&&s?s:void 0,children:[l("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox",onChange:n,name:"listitem",id:i.id,checked:i.status==="checked","aria-label":i.data.isFolder?u("allFilesFromFolderNamed",{name:i.data.name??u("unnamed")}):null,disabled:r,"data-uppy-super-focusable":!0}),i.data.isFolder?l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",onClick:o(()=>e(i.id),"onClick"),"aria-label":u("openFolderNamed",{name:i.data.name??u("unnamed")}),children:[l("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:l(ti,{itemIconString:i.data.icon})}),a&&i.data.name?l("span",{className:"uppy-truncate-text",children:i.data.name}):u("unnamed")]}):l("label",{htmlFor:i.id,className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[l("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:l(ti,{itemIconString:i.data.icon})}),a&&l("span",{className:"uppy-truncate-text",children:i.data.name??u("unnamed")})]})]})}o(ga,"ListItem");function ya(i){let{viewType:e,toggleCheckbox:t,showTitles:r,i18n:s,openFolder:n,file:a,utmSource:u}=i,c=a.type==="folder"?null:a.restrictionError,p=!!c&&a.status!=="checked",f={file:a,openFolder:n,toggleCheckbox:t,utmSource:u,i18n:s,viewType:e,showTitles:r,className:(0,Ep.default)("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--disabled":p},{"uppy-ProviderBrowserItem--noPreview":a.data.icon==="video"},{"uppy-ProviderBrowserItem--is-checked":a.status==="checked"},{"uppy-ProviderBrowserItem--is-partial":a.status==="partial"}),isDisabled:p,restrictionError:c};switch(e){case"grid":return l(ma,{...f});case"list":return l(ga,{...f});case"unsplash":return l(ma,{...f,children:l("a",{href:`${a.data.author.url}?utm_source=${u}&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"uppy-ProviderBrowserItem-author",tabIndex:-1,children:a.data.author.name})});default:throw new Error(`There is no such type ${e}`)}}o(ya,"Item");function $v(i){let{displayedPartialTree:e,viewType:t,toggleCheckbox:r,handleScroll:s,showTitles:n,i18n:a,isLoading:u,openFolder:c,noResultsLabel:p,virtualList:f,utmSource:d}=i,[v,_]=it(!1);if(ze(()=>{let A=o(R=>{R.key==="Shift"&&_(!1)},"handleKeyUp"),F=o(R=>{R.key==="Shift"&&_(!0)},"handleKeyDown");return document.addEventListener("keyup",A),document.addEventListener("keydown",F),()=>{document.removeEventListener("keyup",A),document.removeEventListener("keydown",F)}},[]),u)return l("div",{className:"uppy-Provider-loading",children:typeof u=="string"?u:a("loading")});if(e.length===0)return l("div",{className:"uppy-Provider-empty",children:p});let k=o(A=>l(ya,{viewType:t,toggleCheckbox:o(F=>{F.stopPropagation(),F.preventDefault(),document.getSelection()?.removeAllRanges(),r(A,v)},"toggleCheckbox"),showTitles:n,i18n:a,openFolder:c,file:A,utmSource:d},A.id),"renderItem");return f?l("div",{className:"uppy-ProviderBrowser-body",children:l(Qi,{className:"uppy-ProviderBrowser-list",data:e,renderRow:k,rowHeight:35.5})}):l("div",{className:"uppy-ProviderBrowser-body",children:l("ul",{className:"uppy-ProviderBrowser-list",onScroll:s,tabIndex:-1,children:e.map(k)})})}o($v,"Browser");var To=$v;var Fp=ae(Ge(),1);var Wv=o(i=>i.filter(t=>t.type==="file"&&t.status==="checked"?!0:t.type==="folder"&&t.status==="checked"?!i.some(s=>s.type!=="root"&&s.parentId===t.id):!1).length,"getNumberOfSelectedFiles"),Co=Wv;function es({cancelSelection:i,donePicking:e,i18n:t,partialTree:r,validateAggregateRestrictions:s}){let n=yi(()=>s(r),[r,s]),a=yi(()=>Co(r),[r]);return a===0?null:l("div",{className:"uppy-ProviderBrowser-footer",children:[l("div",{className:"uppy-ProviderBrowser-footer-buttons",children:[l("button",{className:(0,Fp.default)("uppy-u-reset uppy-c-btn uppy-c-btn-primary",{"uppy-c-btn--disabled":n}),disabled:!!n,onClick:e,type:"button",children:t("selectX",{smart_count:a})}),l("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:i,type:"button",children:t("cancel")})]}),n&&l("div",{className:"uppy-ProviderBrowser-footer-error",children:n})]})}o(es,"FooterActions");var Gv=o((i,e,t)=>{let r=i.name||i.id;return{id:i.id,source:e.id,name:r,type:i.mimeType,isRemote:!0,data:i,preview:i.thumbnail||void 0,meta:{authorName:i.author?.name,authorUrl:i.author?.url,relativePath:i.relDirPath||null,absolutePath:i.absDirPath},body:{fileId:i.id},remote:{companionUrl:e.opts.companionUrl,url:`${t.fileUrl(i.requestPath)}`,body:{fileId:i.id},providerName:t.name,provider:t.provider,requestClientId:t.provider}}},"companionFileToUppyFile"),Tp=Gv;var Kv=o((i,e,t)=>{let r=i.map(a=>Tp(a,e,t)),s=[],n=[];r.forEach(a=>{e.uppy.checkIfFileAlreadyExists(Nr(a,e.uppy.getID()))?n.push(a):s.push(a)}),s.length>0&&e.uppy.info(e.uppy.i18n("addedNumFiles",{numFiles:s.length})),n.length>0&&e.uppy.info(`Not adding ${n.length} files because they already exist`),e.uppy.addFiles(s)},"addFiles"),Ao=Kv;var Xv=o((i,e,t,r)=>{let s=e.findIndex(n=>n.id===r);if(s!==-1&&t){let n=e.findIndex(u=>u.id===i);return e.slice(Math.min(s,n),Math.max(s,n)+1).map(u=>u.id)}return[i]},"getClickedRange"),Ro=Xv;var Yv=o(i=>e=>{if(!e.isAuthError){if(e.name==="AbortError"){i.log("Aborting request","warning");return}i.log(e,"error"),e.name==="UserFacingApiError"&&i.info({message:i.i18n("companionError"),details:i.i18n(e.message)},"warning",5e3)}},"handleError"),It=Yv;var Jv=o((i,e)=>{let t=i.find(s=>s.id===e),r=[];for(;r=[t,...r],t.type!=="root";){let s=t.parentId;t=i.find(n=>n.id===s)}return r},"getBreadcrumbs"),Cp=Jv;var Ap=o((i,e,t)=>{let r=e===null?"null":e;if(t[r])return t[r];let s=i.find(a=>a.id===e);if(s.type==="root")return[];let n=[...Ap(i,s.parentId,t),s];return t[r]=n,n},"getPath"),Qv=o(i=>{let e=Object.create(null);return i.filter(s=>s.type==="file"&&s.status==="checked").map(s=>{let n=Ap(i,s.id,e),a=n.findIndex(f=>f.type==="folder"&&f.status==="checked"),u=n.slice(a),c=`/${n.map(f=>f.data.name).join("/")}`,p=u.length===1?void 0:u.map(f=>f.data.name).join("/");return{...s.data,absDirPath:c,relDirPath:p}})},"getCheckedFilesWithPaths"),Uo=Qv;var ba=ae(Up(),1);var is=class extends Error{static{o(this,"TimeoutError")}constructor(e){super(e),this.name="TimeoutError"}},wa=class extends Error{static{o(this,"AbortError")}constructor(e){super(),this.name="AbortError",this.message=e}},Op=o(i=>globalThis.DOMException===void 0?new wa(i):new DOMException(i),"getDOMException"),Dp=o(i=>{let e=i.reason===void 0?Op("This operation was aborted."):i.reason;return e instanceof Error?e:Op(e)},"getAbortedReason");function Sa(i,e){let{milliseconds:t,fallback:r,message:s,customTimers:n={setTimeout,clearTimeout}}=e,a,c=new Promise((p,f)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){let{signal:v}=e;v.aborted&&f(Dp(v)),v.addEventListener("abort",()=>{f(Dp(v))})}if(t===Number.POSITIVE_INFINITY){i.then(p,f);return}let d=new is;a=n.setTimeout.call(void 0,()=>{if(r){try{p(r())}catch(v){f(v)}return}typeof i.cancel=="function"&&i.cancel(),s===!1?p():s instanceof Error?f(s):(d.message=s??`Promise timed out after ${t} milliseconds`,f(d))},t),(async()=>{try{p(await i)}catch(v){f(v)}})()}).finally(()=>{c.clear()});return c.clear=()=>{n.clearTimeout.call(void 0,a),a=void 0},c}o(Sa,"pTimeout");function xa(i,e,t){let r=0,s=i.length;for(;s>0;){let n=Math.trunc(s/2),a=r+n;t(i[a],e)<=0?(r=++a,s-=n+1):s=n}return r}o(xa,"lowerBound");var rs=class{static{o(this,"PriorityQueue")}#e=[];enqueue(e,t){t={priority:0,...t};let r={priority:t.priority,id:t.id,run:e};if(this.size===0||this.#e[this.size-1].priority>=t.priority){this.#e.push(r);return}let s=xa(this.#e,r,(n,a)=>a.priority-n.priority);this.#e.splice(s,0,r)}setPriority(e,t){let r=this.#e.findIndex(n=>n.id===e);if(r===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[s]=this.#e.splice(r,1);this.enqueue(s.run,{priority:t,id:e})}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return this.#e.length}};var ss=class extends ba.default{static{o(this,"PQueue")}#e;#t;#r=0;#i;#s;#l=0;#o;#n;#a;#c;#u=0;#d;#p;#h;#f=1n;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:rs,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#t=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#i=e.intervalCap,this.#s=e.interval,this.#a=new e.queueClass,this.#c=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#h=e.throwOnTimeout===!0,this.#p=e.autoStart===!1}get#g(){return this.#t||this.#r<this.#i}get#b(){return this.#u<this.#d}#m(){this.#u--,this.#S(),this.emit("next")}#y(){this.#x(),this.#v(),this.#n=void 0}get#P(){let e=Date.now();if(this.#o===void 0){let t=this.#l-e;if(t<0)this.#r=this.#e?this.#u:0;else return this.#n===void 0&&(this.#n=setTimeout(()=>{this.#y()},t)),!0}return!1}#S(){if(this.#a.size===0)return this.#o&&clearInterval(this.#o),this.#o=void 0,this.emit("empty"),this.#u===0&&this.emit("idle"),!1;if(!this.#p){let e=!this.#P;if(this.#g&&this.#b){let t=this.#a.dequeue();return t?(this.emit("active"),t(),e&&this.#v(),!0):!1}}return!1}#v(){this.#t||this.#o!==void 0||(this.#o=setInterval(()=>{this.#x()},this.#s),this.#l=Date.now()+this.#s)}#x(){this.#r===0&&this.#u===0&&this.#o&&(clearInterval(this.#o),this.#o=void 0),this.#r=this.#e?this.#u:0,this.#w()}#w(){for(;this.#S(););}get concurrency(){return this.#d}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#d=e,this.#w()}async#E(e){return new Promise((t,r)=>{e.addEventListener("abort",()=>{r(e.reason)},{once:!0})})}setPriority(e,t){this.#a.setPriority(e,t)}async add(e,t={}){return t.id??=(this.#f++).toString(),t={timeout:this.timeout,throwOnTimeout:this.#h,...t},new Promise((r,s)=>{this.#a.enqueue(async()=>{this.#u++,this.#r++;try{t.signal?.throwIfAborted();let n=e({signal:t.signal});t.timeout&&(n=Sa(Promise.resolve(n),{milliseconds:t.timeout})),t.signal&&(n=Promise.race([n,this.#E(t.signal)]));let a=await n;r(a),this.emit("completed",a)}catch(n){if(n instanceof is&&!t.throwOnTimeout){r();return}s(n),this.emit("error",n)}finally{this.#m()}},t),this.emit("add"),this.#S()})}async addAll(e,t){return Promise.all(e.map(async r=>this.add(r,t)))}start(){return this.#p?(this.#p=!1,this.#w(),this):this}pause(){this.#p=!0}clear(){this.#a=new this.#c}async onEmpty(){this.#a.size!==0&&await this.#_("empty")}async onSizeLessThan(e){this.#a.size<e||await this.#_("next",()=>this.#a.size<e)}async onIdle(){this.#u===0&&this.#a.size===0||await this.#_("idle")}async#_(e,t){return new Promise(r=>{let s=o(()=>{t&&!t()||(this.off(e,s),r())},"listener");this.on(e,s)})}get size(){return this.#a.size}sizeBy(e){return this.#a.filter(e).length}get pending(){return this.#u}get isPaused(){return this.#p}};var t0=o(i=>i.map(e=>({...e})),"shallowClone"),Do=t0;var Ip=o(async(i,e,t,r,s)=>{let n=[],a=t.cached?t.nextPagePath:t.id;for(;a;){let d=await r(a);n=n.concat(d.items),a=d.nextPagePath}let u=n.filter(d=>d.isFolder===!0),c=n.filter(d=>d.isFolder===!1),p=u.map(d=>({type:"folder",id:d.requestPath,cached:!1,nextPagePath:null,status:"checked",parentId:t.id,data:d})),f=c.map(d=>{let v=s(d);return{type:"file",id:d.requestPath,restrictionError:v,status:v?"unchecked":"checked",parentId:t.id,data:d}});t.cached=!0,t.nextPagePath=null,e.push(...f,...p),p.forEach(async d=>{i.add(()=>Ip(i,e,d,r,s))})},"recursivelyFetch"),i0=o(async(i,e,t,r)=>{let s=new ss({concurrency:6}),n=Do(i);return n.filter(u=>u.type==="folder"&&u.status==="checked"&&(u.cached===!1||u.nextPagePath)).forEach(u=>{s.add(()=>Ip(s,n,u,e,t))}),s.on("completed",()=>{let u=n.filter(c=>c.type==="file"&&c.status==="checked").length;r(u)}),await s.onIdle(),n},"afterFill"),Np=i0;var r0=o((i,e,t,r,s)=>{let n=e.filter(k=>!i.find(A=>A.id===k.requestPath)),a=n.filter(k=>k.isFolder===!0),u=n.filter(k=>k.isFolder===!1),c=t.type==="folder"&&t.status==="checked",p=a.map(k=>({type:"folder",id:k.requestPath,cached:!1,nextPagePath:null,status:c?"checked":"unchecked",parentId:t.id,data:k})),f=u.map(k=>{let A=s(k);return{type:"file",id:k.requestPath,restrictionError:A,status:c&&!A?"checked":"unchecked",parentId:t.id,data:k}}),d={...t,cached:!0,nextPagePath:r};return[...i.map(k=>k.id===d.id?d:k),...p,...f]},"afterOpenFolder"),Mp=r0;var s0=o((i,e,t,r,s)=>{let n=i.find(k=>k.id===e),a=t.filter(k=>k.isFolder===!0),u=t.filter(k=>k.isFolder===!1),c={...n,nextPagePath:r},p=i.map(k=>k.id===c.id?c:k),f=c.type==="folder"&&c.status==="checked",d=a.map(k=>({type:"folder",id:k.requestPath,cached:!1,nextPagePath:null,status:f?"checked":"unchecked",parentId:c.id,data:k})),v=u.map(k=>{let A=s(k);return{type:"file",id:k.requestPath,restrictionError:A,status:f&&!A?"checked":"unchecked",parentId:c.id,data:k}});return[...p,...d,...v]},"afterScrollFolder"),Lp=s0;var Bp=o((i,e,t)=>{i.filter(s=>s.type!=="root"&&s.parentId===e).forEach(s=>{s.status=t&&!(s.type==="file"&&s.restrictionError)?"checked":"unchecked",Bp(i,s.id,t)})},"percolateDown"),jp=o((i,e)=>{let t=i.find(a=>a.id===e);if(t.type==="root")return;let r=i.filter(a=>a.type!=="root"&&a.parentId===t.id&&!(a.type==="file"&&a.restrictionError)),s=r.every(a=>a.status==="checked"),n=r.every(a=>a.status==="unchecked");s&&t.cached?t.status="checked":n?t.status="unchecked":t.status="partial",jp(i,t.parentId)},"percolateUp"),o0=o((i,e)=>{let t=Do(i),r=t.filter(s=>s.type!=="root"&&e.includes(s.id));return r.forEach(s=>{let n=s.status==="checked"?"unchecked":"checked";s.type==="file"?s.status=s.restrictionError?"unchecked":n:s.status=n,Bp(t,s.id,s.status==="checked")}),jp(t,r[0].parentId),t},"afterToggleCheckbox"),zp=o0;var Si={afterOpenFolder:Mp,afterScrollFolder:Lp,afterToggleCheckbox:zp,afterFill:Np};var n0=o(i=>{let{scrollHeight:e,scrollTop:t,offsetHeight:r}=i.target;return e-(t+r)<50},"shouldHandleScroll"),Io=n0;var Hp=ae(Ge(),1);var a0=o(({i18n:i,item:e,toggleCheckbox:t,openFolder:r})=>{let s="restrictionError"in e&&e.restrictionError!=null&&e.status!=="checked";return l("li",{className:(0,Hp.default)("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--disabled":s},{"uppy-ProviderBrowserItem--noPreview":e.data.icon==="video"},{"uppy-ProviderBrowserItem--is-checked":e.status==="checked"},{"uppy-ProviderBrowserItem--is-partial":e.status==="partial"}),title:("restrictionError"in e?e.restrictionError:void 0)??void 0,children:[l("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox",onChange:o(()=>t(e,!1),"onChange"),checked:e.status==="checked","aria-label":e.data.name??i("unnamed"),disabled:s,"data-uppy-super-focusable":!0}),l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",disabled:s,"aria-label":e.data.name,onClick:o(()=>{e.data.isFolder&&r(e.id)},"onClick"),children:[l("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:l(ti,{itemIconString:e.data.icon})}),e.data.name??i("unnamed")]})]})},"SearchResultItem"),qp=a0;var l0=o(({searchResults:i,toggleCheckbox:e,openFolder:t,i18n:r})=>i.length===0?l("div",{className:"uppy-Provider-empty",children:r("noFilesFound")}):l("div",{className:"uppy-ProviderBrowser-body",children:l("ul",{className:"uppy-ProviderBrowser-list",children:i.map(s=>l(qp,{i18n:r,item:s,toggleCheckbox:e,openFolder:t},s.id))})}),"GlobalSearchView"),Vp=l0;var $p=ae(Ge(),1);function Pa(i){let{openFolder:e,title:t,breadcrumbsIcon:r,breadcrumbs:s,i18n:n}=i;return l("div",{className:"uppy-Provider-breadcrumbs",children:[l("div",{className:"uppy-Provider-breadcrumbsIcon",children:r}),s.map((a,u)=>l(Re,{children:[l("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:o(()=>e(a.id),"onClick"),children:a.type==="root"?t:a.data.name??n("unnamed")},a.id),s.length===u+1?"":" / "]}))]})}o(Pa,"Breadcrumbs");function _a({i18n:i,logout:e,username:t}){return l(Re,{children:[t&&l("span",{className:"uppy-ProviderBrowser-user",children:t},"username"),l("button",{type:"button",onClick:e,className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-userLogout",children:i("logOut")},"logout")]})}o(_a,"User");function ka(i){return l("div",{className:"uppy-ProviderBrowser-header",children:l("div",{className:(0,$p.default)("uppy-ProviderBrowser-headerBar",!i.showBreadcrumbs&&"uppy-ProviderBrowser-headerBar--simple"),children:[i.showBreadcrumbs&&l(Pa,{openFolder:i.openFolder,breadcrumbs:i.breadcrumbs,breadcrumbsIcon:i.pluginIcon?.(),title:i.title,i18n:i.i18n}),l(_a,{logout:i.logout,username:i.username,i18n:i.i18n})]})})}o(ka,"Header");function nr(){return l("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30",children:l("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"})})}o(nr,"defaultPickerIcon");var Wp=o(i=>({authenticated:void 0,partialTree:[{type:"root",id:i,cached:!1,nextPagePath:null}],currentFolderId:i,searchString:"",didFirstRender:!1,username:null,loading:!1}),"getDefaultState"),Ne=class i{static{o(this,"ProviderView")}static VERSION=Fo.version;static[Symbol.for("uppy test: searchDebounceMs")];plugin;provider;opts;isHandlingScroll=!1;previousCheckbox=null;#e;constructor(e,t){this.plugin=e,this.provider=t.provider;let r={viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0,loadAllFiles:!1,virtualList:!1};this.opts={...r,...t},this.openFolder=this.openFolder.bind(this),this.logout=this.logout.bind(this),this.handleAuth=this.handleAuth.bind(this),this.handleScroll=this.handleScroll.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.openSearchResultFolder=this.openSearchResultFolder.bind(this),this.clearSearchState=this.clearSearchState.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider);let s=Symbol.for("uppy test: searchDebounceMs"),n=i[s],a=n??500,u=n===0?{leading:!0,trailing:!0}:void 0;this.#e=(0,Kp.default)(this.#i,a,u)}resetPluginState(){this.plugin.setPluginState(Wp(this.plugin.rootFolderId))}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}get isLoading(){return this.plugin.getPluginState().loading}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}clearSearchState(){this.plugin.setPluginState({searchResults:void 0})}#t;async#r(e){this.#t?.abort();let t=new AbortController;this.#t=t;let r=o(()=>{t.abort()},"cancelRequest");try{this.plugin.uppy.on("dashboard:close-panel",r),this.plugin.uppy.on("cancel-all",r),await e(t.signal)}finally{this.plugin.uppy.off("dashboard:close-panel",r),this.plugin.uppy.off("cancel-all",r),this.#t=void 0}}async#i(){let{partialTree:e,currentFolderId:t,searchString:r}=this.plugin.getPluginState(),s=e.find(n=>n.id===t);if(r.trim()===""){this.#t?.abort(),this.clearSearchState();return}this.setLoading(!0),await this.#r(async n=>{let a=s.type==="root"?void 0:t,{items:u}=await this.provider.search(r,{signal:n,path:a}),{partialTree:c}=this.plugin.getPluginState(),p=[...c];for(let f of u){let v=decodeURIComponent(f.requestPath).split("/").filter(A=>A.length>0),_=this.plugin.rootFolderId,k;v.forEach((A,F,R)=>{let U=v.slice(0,F+1),C=encodeURIComponent(`/${U.join("/")}`),Y=p.find(K=>K.id===C&&K.type!=="root");if(Y){_=C,k=Y.status==="checked";return}let $=F===R.length-1,H,Q=k?"checked":"unchecked";if($)if(f.isFolder)H={type:"folder",id:C,cached:!1,nextPagePath:null,status:Q,parentId:_,data:f};else{let K=this.validateSingleFile(f);H={type:"file",id:C,restrictionError:K,status:K?"unchecked":Q,parentId:_,data:f}}else H={type:"folder",id:C,cached:!1,nextPagePath:null,status:Q,parentId:_,data:{name:decodeURIComponent(A),icon:"folder",isFolder:!0}};p.push(H),_=C,k=Q==="checked"})}this.plugin.setPluginState({partialTree:p,searchResults:u.map(f=>f.requestPath)})}).catch(It(this.plugin.uppy)),this.setLoading(!1)}onSearchInput=o(e=>{this.plugin.setPluginState({searchString:e}),this.opts.supportsSearch&&this.#e()},"onSearchInput");async openSearchResultFolder(e){this.plugin.setPluginState({searchString:""}),await this.openFolder(e)}async openFolder(e){this.clearSearchState(),this.previousCheckbox=null;let{partialTree:t}=this.plugin.getPluginState(),r=t.find(s=>s.id===e);if(r.cached){this.plugin.setPluginState({currentFolderId:e,searchString:""});return}this.setLoading(!0),await this.#r(async s=>{let n=e,a=[];do{let{username:c,nextPagePath:p,items:f}=await this.provider.list(n,{signal:s});this.plugin.setPluginState({username:c}),n=p,a=a.concat(f),this.setLoading(this.plugin.uppy.i18n("loadedXFiles",{numFiles:a.length}))}while(this.opts.loadAllFiles&&n);let u=Si.afterOpenFolder(t,a,r,n,this.validateSingleFile);this.plugin.setPluginState({partialTree:u,currentFolderId:e,searchString:""})}).catch(It(this.plugin.uppy)),this.setLoading(!1)}async logout(){await this.#r(async e=>{let t=await this.provider.logout({signal:e});if(t.ok){if(!t.revoked){let r=this.plugin.uppy.i18n("companionUnauthorizeHint",{provider:this.plugin.title,url:t.manual_revoke_url});this.plugin.uppy.info(r,"info",7e3)}this.plugin.setPluginState({...Wp(this.plugin.rootFolderId),authenticated:!1})}}).catch(It(this.plugin.uppy))}async handleAuth(e){await this.#r(async t=>{this.setLoading(!0),await this.provider.login({authFormData:e,signal:t}),this.plugin.setPluginState({authenticated:!0}),await Promise.all([this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId)])}).catch(It(this.plugin.uppy)),this.setLoading(!1)}async handleScroll(e){let{partialTree:t,currentFolderId:r}=this.plugin.getPluginState(),s=t.find(n=>n.id===r);Io(e)&&!this.isHandlingScroll&&s.nextPagePath&&(this.isHandlingScroll=!0,await this.#r(async n=>{let{nextPagePath:a,items:u}=await this.provider.list(s.nextPagePath,{signal:n}),c=Si.afterScrollFolder(t,r,u,a,this.validateSingleFile);this.plugin.setPluginState({partialTree:c})}).catch(It(this.plugin.uppy)),this.isHandlingScroll=!1)}validateSingleFile=o(e=>{let t=Yi(e);return this.plugin.uppy.validateSingleFile(t)},"validateSingleFile");async donePicking(){let{partialTree:e}=this.plugin.getPluginState();this.isLoading||(this.setLoading(!0),await this.#r(async t=>{let r=await Si.afterFill(e,a=>this.provider.list(a,{signal:t}),this.validateSingleFile,a=>{this.setLoading(this.plugin.uppy.i18n("addedNumFiles",{numFiles:a}))});if(this.validateAggregateRestrictions(r)){this.plugin.setPluginState({partialTree:r});return}let n=Uo(r);Ao(n,this.plugin,this.provider),this.resetPluginState()}).catch(It(this.plugin.uppy)),this.setLoading(!1))}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=Ro(e.id,this.getDisplayedPartialTree(),t,this.previousCheckbox),n=Si.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.previousCheckbox=e.id}getDisplayedPartialTree=o(()=>{let{partialTree:e,currentFolderId:t,searchString:r}=this.plugin.getPluginState(),s=e.filter(a=>a.type!=="root"&&a.parentId===t);return this.opts.supportsSearch||r.trim()===""?s:s.filter(a=>(a.data.name??this.plugin.uppy.i18n("unnamed")).toLowerCase().indexOf(r.trim().toLowerCase())!==-1)},"getDisplayedPartialTree");getBreadcrumbs=o(()=>{let{partialTree:e,currentFolderId:t}=this.plugin.getPluginState();return Cp(e,t)},"getBreadcrumbs");getSelectedAmount=o(()=>{let{partialTree:e}=this.plugin.getPluginState();return Co(e)},"getSelectedAmount");validateAggregateRestrictions=o(e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)},"validateAggregateRestrictions");#s(){let{i18n:e}=this.plugin.uppy,{searchResults:t,partialTree:r}=this.plugin.getPluginState(),s=new Map;r.forEach(a=>{a.type!=="root"&&s.set(a.id,a)});let n=t.map(a=>{let u=s.get(a);if(u==null)throw new Error("Partial tree not complete");return u});return l(Vp,{searchResults:n,openFolder:this.openSearchResultFolder,toggleCheckbox:this.toggleCheckbox,i18n:e})}render(e,t={}){let{didFirstRender:r}=this.plugin.getPluginState(),{i18n:s}=this.plugin.uppy;r||(this.plugin.setPluginState({didFirstRender:!0}),this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId));let n={...this.opts,...t},{authenticated:a,loading:u}=this.plugin.getPluginState(),c=this.plugin.icon||nr;if(a===!1)return l(Qr,{pluginName:this.plugin.title,pluginIcon:c,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18n,renderForm:n.renderAuthForm,loading:u});let{partialTree:p,username:f,searchString:d,searchResults:v}=this.plugin.getPluginState(),_=this.getBreadcrumbs();return l("div",{className:(0,Gp.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${n.viewType}`),children:[l(ka,{showBreadcrumbs:n.showBreadcrumbs,openFolder:this.openFolder,breadcrumbs:_,pluginIcon:c,title:this.plugin.title,logout:this.logout,username:f,i18n:s}),n.showFilter&&l(ir,{value:d,onChange:o(k=>this.onSearchInput(k),"onChange"),onSubmit:o(()=>{},"onSubmit"),inputLabel:s("filter"),i18n:s}),v?this.#s():l(To,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),openFolder:this.openFolder,virtualList:n.virtualList,noResultsLabel:s("noFilesFound"),handleScroll:this.handleScroll,viewType:n.viewType,showTitles:n.showTitles,i18n:this.plugin.uppy.i18n,isLoading:u,utmSource:"Companion"}),l(es,{partialTree:p,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:s,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};var Xp=ae(Ge(),1);function u0({value:i,onChange:e,onSubmit:t,inputLabel:r,loading:s=!1,children:n}){let{formId:a}=tr(t);return l("section",{className:"uppy-SearchProvider",children:[l("input",{className:"uppy-u-reset uppy-c-textInput uppy-SearchProvider-input",type:"search","aria-label":r,placeholder:r,value:i,onInput:o(u=>e(u.target.value),"onInput"),form:a,disabled:s,"data-uppy-super-focusable":!0}),l("button",{disabled:s,className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-SearchProvider-searchButton",type:"submit",form:a,children:n})]})}o(u0,"SearchView");var No=u0;var c0={loading:!1,searchString:"",partialTree:[{type:"root",id:null,cached:!1,nextPagePath:null}],currentFolderId:null,isInputMode:!0},p0={viewType:"grid",showTitles:!0,showFilter:!0,utmSource:"Companion"},ii=class{static{o(this,"SearchProviderView")}static VERSION=Fo.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider,this.opts={...p0,...t},this.setSearchString=this.setSearchString.bind(this),this.search=this.search.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.render=this.render.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}resetPluginState(){this.plugin.setPluginState(c0)}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}async search(){let{searchString:e}=this.plugin.getPluginState();if(e!==""){this.setLoading(!0);try{let t=await this.provider.search(e),r=[{type:"root",id:null,cached:!1,nextPagePath:t.nextPageQuery},...t.items.map(s=>({type:"file",id:s.requestPath,status:"unchecked",parentId:null,data:s}))];this.plugin.setPluginState({partialTree:r,isInputMode:!1})}catch(t){It(this.plugin.uppy)(t)}this.setLoading(!1)}}async handleScroll(e){let{partialTree:t,searchString:r}=this.plugin.getPluginState(),s=t.find(n=>n.type==="root");if(Io(e)&&!this.isHandlingScroll&&s.nextPagePath){this.isHandlingScroll=!0;try{let n=await this.provider.search(r,s.nextPagePath),a={...s,nextPagePath:n.nextPageQuery},u=t.filter(p=>p.type!=="root"),c=[a,...u,...n.items.map(p=>({type:"file",id:p.requestPath,status:"unchecked",parentId:null,data:p}))];this.plugin.setPluginState({partialTree:c})}catch(n){It(this.plugin.uppy)(n)}this.isHandlingScroll=!1}}async donePicking(){let{partialTree:e}=this.plugin.getPluginState(),t=Uo(e);Ao(t,this.plugin,this.provider),this.resetPluginState()}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=Ro(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=Si.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}validateSingleFile=o(e=>{let t=Yi(e);return this.plugin.uppy.validateSingleFile(t)},"validateSingleFile");getDisplayedPartialTree=o(()=>{let{partialTree:e}=this.plugin.getPluginState();return e.filter(t=>t.type!=="root")},"getDisplayedPartialTree");setSearchString=o(e=>{this.plugin.setPluginState({searchString:e}),e===""&&this.plugin.setPluginState({partialTree:[]})},"setSearchString");validateAggregateRestrictions=o(e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)},"validateAggregateRestrictions");render(e,t={}){let{isInputMode:r,searchString:s,loading:n,partialTree:a}=this.plugin.getPluginState(),{i18n:u}=this.plugin.uppy,c={...this.opts,...t};return r?l(No,{value:s,onChange:this.setSearchString,onSubmit:this.search,inputLabel:u("enterTextToSearch"),children:u("searchImages")}):l("div",{className:(0,Xp.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${c.viewType}`),children:[c.showFilter&&l(ir,{value:s,onChange:this.setSearchString,onSubmit:this.search,inputLabel:u("search"),i18n:u}),l(To,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),handleScroll:this.handleScroll,openFolder:o(async()=>{},"openFolder"),noResultsLabel:u("noSearchResults"),viewType:c.viewType,showTitles:c.showTitles,isLoading:n,i18n:u,virtualList:!1,utmSource:this.opts.utmSource}),l(es,{partialTree:a,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:u,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};var Yp={name:"@uppy/audio",description:"Uppy plugin that records audio using the device\u2019s microphone.",version:"3.1.0",license:"MIT",style:"dist/style.min.css",keywords:["file uploader","uppy","uppy-plugin","audio","microphone","sound","record","mediarecorder"],type:"module",sideEffects:["*.css"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^",preact:"^10.5.13"},devDependencies:{cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"}};var Jp={strings:{pluginNameAudio:"Audio",startAudioRecording:"Begin audio recording",stopAudioRecording:"Stop audio recording",allowAudioAccessTitle:"Please allow access to your microphone",allowAudioAccessDescription:"In order to record audio, please allow microphone access for this site.",noAudioTitle:"Microphone Not Available",noAudioDescription:"In order to record audio, please connect a microphone or another audio input device",recordingStoppedMaxSize:"Recording stopped because the file size is about to exceed the limit",recordingLength:"Recording length %{recording_length}",submitRecordedFile:"Submit recorded file",discardRecordedFile:"Discard recorded file"}};var Qp=o(i=>{let{icon:e,hasAudio:t,i18n:r}=i;return l("div",{className:"uppy-Audio-permissons",children:[l("div",{className:"uppy-Audio-permissonsIcon",children:e()}),l("div",{className:"uppy-Audio-title",children:r(t?"allowAudioAccessTitle":"noAudioTitle")}),l("p",{children:r(t?"allowAudioAccessDescription":"noAudioDescription")})]})},"default");var Zp=o(({currentDeviceId:i,audioSources:e,onChangeSource:t})=>l("div",{className:"uppy-Audio-videoSource",children:l("select",{className:"uppy-u-reset uppy-Audio-audioSource-select",onChange:o(r=>{t(r.target.value)},"onChange"),children:e.map(r=>l("option",{value:r.deviceId,selected:r.deviceId===i,children:r.label},r.deviceId))})}),"default");function ed(i){return typeof i=="function"}o(ed,"isFunction");function os(i){return ed(i)?i():i}o(os,"result");var ns=class{static{o(this,"AudioOscilloscope")}canvas;canvasContext;width;height;analyser;bufferLength;dataArray;onDrawFrame;streamSource;audioContext;source;constructor(e,t={}){let r=t.canvas||{},s=t.canvasContext||{};this.analyser=null,this.bufferLength=0,this.canvas=e,this.width=os(r.width)||this.canvas.width,this.height=os(r.height)||this.canvas.height,this.canvas.width=this.width,this.canvas.height=this.height,this.canvasContext=this.canvas.getContext("2d"),this.canvasContext.fillStyle=os(s.fillStyle)||"rgb(255, 255, 255)",this.canvasContext.strokeStyle=os(s.strokeStyle)||"rgb(0, 0, 0)",this.canvasContext.lineWidth=os(s.lineWidth)||1,this.onDrawFrame=ed(t.onDrawFrame)?t.onDrawFrame:()=>{}}addSource(e){this.streamSource=e,this.audioContext=this.streamSource.context,this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2048,this.bufferLength=this.analyser.frequencyBinCount,this.source=this.audioContext.createBufferSource(),this.dataArray=new Uint8Array(this.bufferLength),this.analyser.getByteTimeDomainData(this.dataArray),this.streamSource.connect(this.analyser)}draw(){let{analyser:e,dataArray:t,bufferLength:r}=this,s=this.canvasContext,n=this.width,a=this.height;e&&e.getByteTimeDomainData(t),s.fillRect(0,0,n,a),s.beginPath();let u=n*1/r,c=0;r||s.moveTo(0,this.height/2);for(let p=0;p<r;p++){let d=t[p]/128*(a/2);p===0?s.moveTo(c,d):s.lineTo(c,d),c+=u}s.lineTo(n,a/2),s.stroke(),this.onDrawFrame(this),requestAnimationFrame(this.#e)}#e=o(()=>this.draw(),"#draw")};function h0({onDiscard:i,i18n:e}){return l("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button",type:"button",title:e("discardRecordedFile"),"aria-label":e("discardRecordedFile"),onClick:i,"data-uppy-super-focusable":!0,children:l("svg",{width:"13",height:"13",viewBox:"0 0 13 13",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",className:"uppy-c-icon",children:l("g",{fill:"#FFF",fillRule:"evenodd",children:[l("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),l("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"})]})})})}o(h0,"DiscardButton");var td=h0;function Fa({recording:i,onStartRecording:e,onStopRecording:t,i18n:r}){return i?l("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button",type:"button",title:r("stopAudioRecording"),"aria-label":r("stopAudioRecording"),onClick:t,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:l("rect",{x:"15",y:"15",width:"70",height:"70"})})}):l("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button",type:"button",title:r("startAudioRecording"),"aria-label":r("startAudioRecording"),onClick:e,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14px",height:"20px",viewBox:"0 0 14 20",children:l("path",{d:"M7 14c2.21 0 4-1.71 4-3.818V3.818C11 1.71 9.21 0 7 0S3 1.71 3 3.818v6.364C3 12.29 4.79 14 7 14zm6.364-7h-.637a.643.643 0 0 0-.636.65V9.6c0 3.039-2.565 5.477-5.6 5.175-2.645-.264-4.582-2.692-4.582-5.407V7.65c0-.36-.285-.65-.636-.65H.636A.643.643 0 0 0 0 7.65v1.631c0 3.642 2.544 6.888 6.045 7.382v1.387H3.818a.643.643 0 0 0-.636.65v.65c0 .36.285.65.636.65h6.364c.351 0 .636-.29.636-.65v-.65c0-.36-.285-.65-.636-.65H7.955v-1.372C11.363 16.2 14 13.212 14 9.6V7.65c0-.36-.285-.65-.636-.65z",fill:"#FFF","fill-rule":"nonzero"})})})}o(Fa,"RecordButton");function Ta(i){return`${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`}o(Ta,"formatSeconds");function Ca({recordingLengthSeconds:i}){let e=Ta(i);return l("span",{children:e})}o(Ca,"RecordingLength");function f0({onSubmit:i,i18n:e}){return l("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button uppy-Audio-button--submit",type:"button",title:e("submitRecordedFile"),"aria-label":e("submitRecordedFile"),onClick:i,"data-uppy-super-focusable":!0,children:l("svg",{width:"12",height:"9",viewBox:"0 0 12 9",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon",children:l("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})})})}o(f0,"SubmitButton");var id=f0;function Aa(i){let{stream:e,recordedAudio:t,onStop:r,recording:s,supportsRecording:n,audioSources:a,showAudioSourceDropdown:u,onSubmit:c,i18n:p,onStartRecording:f,onStopRecording:d,onDiscardRecordedAudio:v,recordingLengthSeconds:_}=i,k=Ye(null),A=Ye();ze(()=>()=>{A.current=null,r()},[r]),ze(()=>{if(!t&&(A.current=new ns(k.current,{canvas:{width:600,height:600},canvasContext:{lineWidth:2,fillStyle:"rgb(0,0,0)",strokeStyle:"green"}}),A.current.draw(),e)){let Y=new AudioContext().createMediaStreamSource(e);A.current.addSource(Y)}},[t,e]);let F=t!=null,R=!F&&n,U=u&&!F&&a&&a.length>1;return l("div",{className:"uppy-Audio-container",children:[l("div",{className:"uppy-Audio-audioContainer",children:F?l("audio",{className:"uppy-Audio-player",controls:!0,src:t}):l("canvas",{ref:k,className:"uppy-Audio-canvas"})}),l("div",{className:"uppy-Audio-footer",children:[l("div",{className:"uppy-Audio-audioSourceContainer",children:U?Zp(i):null}),l("div",{className:"uppy-Audio-buttonContainer",children:[R&&l(Fa,{recording:s,onStartRecording:f,onStopRecording:d,i18n:p}),F&&l(id,{onSubmit:c,i18n:p}),F&&l(td,{onDiscard:v,i18n:p})]}),l("div",{className:"uppy-Audio-recordingLength",children:!F&&l(Ca,{recordingLengthSeconds:_})})]})]})}o(Aa,"RecordingScreen");function Ra(){return typeof MediaRecorder=="function"&&typeof MediaRecorder.prototype?.start=="function"}o(Ra,"supportsMediaRecorder");var as=class extends re{static{o(this,"Audio")}static VERSION=Yp.version;#e;icon;#t=null;#r=!1;#i=null;#s=null;#l=null;#o;#n;constructor(e,t){super(e,t),this.#o=navigator.mediaDevices,this.#n=this.#o!=null,this.id=this.opts.id||"Audio",this.type="acquirer",this.icon=()=>l("svg",{className:"uppy-DashboardTab-iconAudio","aria-hidden":"true",focusable:"false",width:"32px",height:"32px",viewBox:"0 0 32 32",children:l("path",{d:"M21.143 12.297c.473 0 .857.383.857.857v2.572c0 3.016-2.24 5.513-5.143 5.931v2.64h2.572a.857.857 0 110 1.714H12.57a.857.857 0 110-1.714h2.572v-2.64C12.24 21.24 10 18.742 10 15.726v-2.572a.857.857 0 111.714 0v2.572A4.29 4.29 0 0016 20.01a4.29 4.29 0 004.286-4.285v-2.572c0-.474.384-.857.857-.857zM16 6.5a3 3 0 013 3v6a3 3 0 01-6 0v-6a3 3 0 013-3z",fill:"currentcolor","fill-rule":"nonzero"})}),this.defaultLocale=Jp,this.opts={...t},this.i18nInit(),this.title=this.i18n("pluginNameAudio"),this.setPluginState({hasAudio:!1,audioReady:!1,cameraError:null,recordingLengthSeconds:0,audioSources:[],currentDeviceId:null})}#a(){return this.#o?this.#o.enumerateDevices().then(e=>e.some(t=>t.kind==="audioinput")):Promise.resolve(!1)}#c=o(e=>{if(!this.#n)return Promise.reject(new Error("Microphone access not supported"));this.#r=!0,this.#a().then(t=>(this.setPluginState({hasAudio:t}),this.#o.getUserMedia({audio:!0}).then(r=>{this.#t=r;let s=null,n=r.getAudioTracks();e?.deviceId?s=n.findLast(a=>a.getSettings().deviceId===e.deviceId):s=n[0].getSettings().deviceId,this.#m(),this.setPluginState({currentDeviceId:s,audioReady:!0})}).catch(r=>{this.setPluginState({audioReady:!1,cameraError:r}),this.uppy.info(r.message,"error")})))},"#start");#u=o(()=>{this.#s=new MediaRecorder(this.#t),this.#i=[];let e=!1;this.#s.addEventListener("dataavailable",t=>{this.#i.push(t.data);let{restrictions:r}=this.uppy.opts;if(this.#i.length>1&&r.maxFileSize!=null&&!e){let s=this.#i.reduce((c,p)=>c+p.size,0),a=(s-this.#i[0].size)/(this.#i.length-1)*3,u=Math.max(0,r.maxFileSize-a);s>u&&(e=!0,this.uppy.info(this.i18n("recordingStoppedMaxSize"),"warning",4e3),this.#d())}}),this.#s.start(500),this.#e=setInterval(()=>{let t=this.getPluginState().recordingLengthSeconds;this.setPluginState({recordingLengthSeconds:t+1})},1e3),this.setPluginState({isRecording:!0})},"#startRecording");#d=o(()=>new Promise(t=>{this.#s.addEventListener("stop",()=>{t()}),this.#s.stop(),clearInterval(this.#e),this.setPluginState({recordingLengthSeconds:0})}).then(()=>(this.setPluginState({isRecording:!1}),this.#g())).then(t=>{try{this.#l=t,this.setPluginState({recordedAudio:URL.createObjectURL(t.data)})}catch(r){r.isRestriction||this.uppy.log(r)}}).then(()=>{this.#i=null,this.#s=null},t=>{throw this.#i=null,this.#s=null,t}),"#stopRecording");#p=o(()=>{this.setPluginState({recordedAudio:null}),this.#l=null},"#discardRecordedAudio");#h=o(()=>{try{this.#l&&this.uppy.addFile(this.#l)}catch(e){e.isRestriction||this.uppy.log(e,"warning")}},"#submit");#f=o(async()=>{this.#t&&this.#t.getAudioTracks().forEach(t=>t.stop()),this.#s&&await new Promise(e=>{this.#s.addEventListener("stop",e,{once:!0}),this.#s.stop(),clearInterval(this.#e)}),this.#i=null,this.#s=null,this.#r=!1,this.#t=null,this.setPluginState({recordedAudio:null,isRecording:!1,recordingLengthSeconds:0})},"#stop");#g(){let e=this.#i.find(a=>a.type?.length>0).type,t=xt(e);if(!t)return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type "${e}"`));let r=`audio-${Date.now()}.${t}`,s=new Blob(this.#i,{type:e}),n={source:this.id,name:r,data:new Blob([s],{type:e}),type:e};return Promise.resolve(n)}#b=o(e=>{this.#f(),this.#c({deviceId:e})},"#changeSource");#m=o(()=>{this.#o.enumerateDevices().then(e=>{this.setPluginState({audioSources:e.filter(t=>t.kind==="audioinput")})})},"#updateSources");render(){this.#r||this.#c();let e=this.getPluginState();return!e.audioReady||!e.hasAudio?l(Qp,{icon:this.icon,i18n:this.i18n,hasAudio:e.hasAudio}):l(Aa,{...e,onChangeSource:this.#b,onStartRecording:this.#u,onStopRecording:this.#d,onDiscardRecordedAudio:this.#p,onSubmit:this.#h,onStop:this.#f,i18n:this.i18n,showAudioSourceDropdown:this.opts.showAudioSourceDropdown,supportsRecording:Ra(),recording:e.isRecording,stream:this.#t})}install(){this.setPluginState({audioReady:!1,recordingLengthSeconds:0});let{target:e}=this.opts;e&&this.mount(e,this),this.#o&&(this.#m(),this.#o.ondevicechange=()=>{if(this.#m(),this.#t){let t=!0,{audioSources:r,currentDeviceId:s}=this.getPluginState();r.forEach(n=>{s===n.deviceId&&(t=!1)}),t&&(this.#f(),this.#c())}})}uninstall(){this.#t&&this.#f(),this.unmount()}};var rd={name:"@uppy/aws-s3",description:"Upload to Amazon S3 with Uppy",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","aws s3","amazon s3","s3","uppy","uppy-plugin","multipart"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/utils":"workspace:^"},devDependencies:{"@aws-sdk/client-s3":"^3.362.0","@aws-sdk/s3-request-presigner":"^3.362.0","@uppy/core":"workspace:^",jsdom:"^26.1.0",nock:"^13.1.0",typescript:"^5.8.3",vitest:"^3.2.4","whatwg-fetch":"3.6.2"},peerDependencies:{"@uppy/core":"workspace:^"}};function g0({method:i="PUT",CanonicalUri:e="/",CanonicalQueryString:t="",SignedHeaders:r,HashedPayload:s}){let n=Object.keys(r).map(a=>a.toLowerCase()).sort();return[i,e,t,...n.map(a=>`${a}:${r[a]}`),"",n.join(";"),s].join(`
`)}o(g0,"createCanonicalRequest");var Ua=new TextEncoder,Oa={name:"HMAC",hash:"SHA-256"};async function y0(i){let{subtle:e}=globalThis.crypto;return e.digest(Oa.hash,Ua.encode(i))}o(y0,"digest");async function v0(i){let{subtle:e}=globalThis.crypto;return e.importKey("raw",typeof i=="string"?Ua.encode(i):i,Oa,!1,["sign"])}o(v0,"generateHmacKey");function sd(i){let e=new Uint8Array(i),t="";for(let r=0;r<e.length;r++)t+=e[r].toString(16).padStart(2,"0");return t}o(sd,"arrayBufferToHexString");async function ls(i,e){let{subtle:t}=globalThis.crypto;return t.sign(Oa,await v0(i),Ua.encode(e))}o(ls,"hash");async function Da({accountKey:i,accountSecret:e,sessionToken:t,bucketName:r,Key:s,Region:n,expires:a,uploadId:u,partNumber:c}){let f=`s3.${n}.amazonaws.com`,d=`/${r}/${encodeURI(s).replace(/[;?:@&=+$,#!'()*]/g,Z=>`%${Z.charCodeAt(0).toString(16).toUpperCase()}`)}`,v="UNSIGNED-PAYLOAD",_=new Date().toISOString().replace(/[-:]|\.\d+/g,""),k=_.slice(0,8),A=`${k}/${n}/s3/aws4_request`,F=new URL(`https://${f}${d}`);F.searchParams.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),F.searchParams.set("X-Amz-Content-Sha256",v),F.searchParams.set("X-Amz-Credential",`${i}/${A}`),F.searchParams.set("X-Amz-Date",_),F.searchParams.set("X-Amz-Expires",a),F.searchParams.set("X-Amz-Security-Token",t),F.searchParams.set("X-Amz-SignedHeaders","host"),c&&F.searchParams.set("partNumber",c),u&&F.searchParams.set("uploadId",u),F.searchParams.set("x-id",c&&u?"UploadPart":"PutObject");let R=g0({CanonicalUri:d,CanonicalQueryString:F.search.slice(1),SignedHeaders:{host:f},HashedPayload:v}),U=sd(await y0(R)),C=["AWS4-HMAC-SHA256",_,A,U].join(`
`),Y=await ls(`AWS4${e}`,k),$=await ls(Y,n),H=await ls($,"s3"),Q=await ls(H,"aws4_request"),K=sd(await ls(Q,C));return F.searchParams.set("X-Amz-Signature",K),F}o(Da,"createSignedURL");var b0=1024*1024,od={getChunkSize(i){return Math.ceil(i.size/1e4)},onProgress(){},onPartComplete(){},onSuccess(){},onError(i){throw i}};function w0(i){if(typeof i=="string")return parseInt(i,10);if(typeof i=="number")return i;throw new TypeError("Expected a number")}o(w0,"ensureInt");var us=Symbol("pausing upload, not an actual error"),Ia=class{static{o(this,"MultipartUploader")}options;#e=new Rr;#t=[];#r=[];#i;#s;#l=!1;#o;#n;#a;#c;#u=o(e=>e?.cause===us?null:this.#o(e),"#onReject");#d=1e4;#p=5*b0;constructor(e,t){this.options={...od,...t},this.options.getChunkSize??=od.getChunkSize,this.#i=e,this.#s=t.file,this.#n=this.options.onSuccess,this.#o=this.options.onError,this.#a=this.options.shouldUseMultipart,this.#c=t.uploadId&&t.key,this.#h()}#h(){let e=this.#i.size,t=typeof this.#a=="function"?this.#a(this.#s):!!this.#a;if(t&&e>this.#p){let r=Math.max(this.options.getChunkSize(this.#i),this.#p),s=Math.floor(e/r);s>this.#d&&(s=this.#d,r=e/this.#d),this.#t=Array(s);for(let n=0,a=0;n<e;n+=r,a++){let u=Math.min(e,n+r),c=o(()=>{let p=n;return this.#i.slice(p,u)},"getData");if(this.#t[a]={getData:c,onProgress:this.#b(a),onComplete:this.#m(a),shouldUseMultipart:t},this.#c){let p=n+r>e?e-n:r;this.#t[a].setAsUploaded=()=>{this.#t[a]=null,this.#r[a].uploaded=p}}}}else this.#t=[{getData:o(()=>this.#i,"getData"),onProgress:this.#b(0),onComplete:this.#m(0),shouldUseMultipart:t}];this.#r=this.#t.map(()=>({uploaded:0}))}#f(){this.options.companionComm.uploadFile(this.#s,this.#t,this.#e.signal).then(this.#n,this.#u),this.#l=!0}#g(){this.options.companionComm.resumeUploadFile(this.#s,this.#t,this.#e.signal).then(this.#n,this.#u)}#b=o(e=>t=>{if(!t.lengthComputable)return;this.#r[e].uploaded=w0(t.loaded);let r=this.#r.reduce((s,n)=>s+n.uploaded,0);this.options.onProgress(r,this.#i.size)},"#onPartProgress");#m=o(e=>t=>{this.#t[e]=null,this.#r[e].etag=t,this.#r[e].done=!0;let r={PartNumber:e+1,ETag:t};this.options.onPartComplete(r)},"#onPartComplete");#y(){this.#e.abort(),this.options.companionComm.abortFileUpload(this.#s).catch(e=>this.options.log(e))}start(){this.#l?(this.#e.signal.aborted||this.#e.abort(us),this.#e=new Rr,this.#g()):this.#c?(this.options.companionComm.restoreUploadFile(this.#s,{uploadId:this.options.uploadId,key:this.options.key}),this.#g()):this.#f()}pause(){this.#e.abort(us),this.#e=new Rr}abort(e){e?.really?this.#y():this.pause()}[Symbol.for("uppy test: getChunkState")](){return this.#r}},nd=Ia;function Ke(i){if(i?.aborted)throw Ur("The operation was aborted",{cause:i.reason})}o(Ke,"throwIfAborted");function S0(i){let e=new URL(i);return e.search="",e.hash="",e.href}o(S0,"removeMetadataFromURL");var Mo=class{static{o(this,"HTTPCommunicationQueue")}#e;#t=new WeakMap;#r;#i;#s;#l;#o;#n;#a;#c;#u;#d;#p;constructor(e,t,r,s){this.#n=e,this.#u=r,this.#p=s,this.setOptions(t)}setOptions(e){let t=this.#n;"abortMultipartUpload"in e&&(this.#e=t.wrapPromiseFunction(e.abortMultipartUpload,{priority:1})),"createMultipartUpload"in e&&(this.#r=t.wrapPromiseFunction(e.createMultipartUpload,{priority:-1})),"signPart"in e&&(this.#i=t.wrapPromiseFunction(e.signPart)),"listParts"in e&&(this.#l=t.wrapPromiseFunction(e.listParts)),"completeMultipartUpload"in e&&(this.#c=t.wrapPromiseFunction(e.completeMultipartUpload,{priority:1})),"retryDelays"in e&&(this.#a=e.retryDelays??[]),"uploadPartBytes"in e&&(this.#d=t.wrapPromiseFunction(e.uploadPartBytes,{priority:1/0})),"getUploadParameters"in e&&(this.#s=t.wrapPromiseFunction(e.getUploadParameters))}async#h(e,t){let r=this.#n,s=e?.source?.status;if(s==null)return!1;if(s===403&&e.message==="Request has expired"){if(!r.isPaused){if(r.limit===1||this.#o==null){let n=t.next();if(n==null||n.done)return!1;this.#o=n.value}r.rateLimit(0),await new Promise(n=>setTimeout(n,this.#o))}}else if(s===429){if(!r.isPaused){let n=t.next();if(n==null||n.done)return!1;r.rateLimit(n.value)}}else{if(s>400&&s<500&&s!==409)return!1;if(typeof navigator<"u"&&navigator.onLine===!1)r.isPaused||(r.pause(),window.addEventListener("online",()=>{r.resume()},{once:!0}));else{let n=t.next();if(n==null||n.done)return!1;await new Promise(a=>setTimeout(a,n.value))}}return!0}async getUploadId(e,t){let r;for(;;){if(e.data==null)throw new Error("File data is empty");if(r=this.#t.get(e.data),r==null)break;try{return await r}catch{}}let s=this.#r(this.#p(e),t),n=o(()=>{if(e.data==null)throw new Error("File data is empty");s.abort(t.reason),this.#t.delete(e.data)},"abortPromise");return t.addEventListener("abort",n,{once:!0}),this.#t.set(e.data,s),s.then(async a=>{if(t.removeEventListener("abort",n),this.#u(e,a),e.data==null)throw new Error("File data is empty");this.#t.set(e.data,a)},()=>{if(t.removeEventListener("abort",n),e.data==null)throw new Error("File data is empty");this.#t.delete(e.data)}),s}async abortFileUpload(e){if(e.data==null)throw new Error("File data is empty");let t=this.#t.get(e.data);if(t==null)return;this.#t.delete(e.data),this.#u(e,Object.create(null));let r;try{r=await t}catch{return}await this.#e(this.#p(e),r)}async#f(e,t,r){let{method:s="POST",url:n,fields:a,headers:u}=await this.#s(this.#p(e),{signal:r}).abortOn(r),c,p=t.getData();if(s.toUpperCase()==="POST"){let k=new FormData;Object.entries(a).forEach(([A,F])=>k.set(A,F)),k.set("file",p),c=k}else c=p;let{onProgress:f,onComplete:d}=t,v=await this.#d({signature:{url:n,headers:u,method:s},body:c,size:p.size,onProgress:f,onComplete:d,signal:r}).abortOn(r),_=a?.key;return this.#u(e,{key:_}),{...v,location:v.location??S0(n),bucket:a?.bucket,key:_}}async uploadFile(e,t,r){if(Ke(r),t.length===1&&!t[0].shouldUseMultipart)return this.#f(e,t[0],r);let{uploadId:s,key:n}=await this.getUploadId(e,r);Ke(r);try{let a=await Promise.all(t.map((u,c)=>this.uploadChunk(e,c+1,u,r)));return Ke(r),await this.#c(this.#p(e),{key:n,uploadId:s,parts:a,signal:r},r).abortOn(r)}catch(a){throw a?.cause!==us&&a?.name!=="AbortError"&&this.abortFileUpload(e),a}}restoreUploadFile(e,t){if(e.data==null)throw new Error("File data is empty");this.#t.set(e.data,t)}async resumeUploadFile(e,t,r){if(Ke(r),t.length===1&&t[0]!=null&&!t[0].shouldUseMultipart)return this.#f(e,t[0],r);let{uploadId:s,key:n}=await this.getUploadId(e,r);Ke(r);let a=await this.#l(this.#p(e),{uploadId:s,key:n,signal:r},r).abortOn(r);Ke(r);let u=await Promise.all(t.map((c,p)=>{let f=p+1,d=a.find(({PartNumber:v})=>v===f);return d==null?this.uploadChunk(e,f,c,r):(c?.setAsUploaded?.(),{PartNumber:f,ETag:d.ETag})}));return Ke(r),this.#c(this.#p(e),{key:n,uploadId:s,parts:u,signal:r},r).abortOn(r)}async uploadChunk(e,t,r,s){Ke(s);let{uploadId:n,key:a}=await this.getUploadId(e,s),u=this.#a.values(),c=this.#a.values(),p=o(()=>{let f=u.next();return f==null||f.done?null:f.value},"shouldRetrySignature");for(;;){Ke(s);let f=r.getData(),{onProgress:d,onComplete:v}=r,_;try{_=await this.#i(this.#p(e),{uploadId:n,key:a,partNumber:t,body:f,signal:s}).abortOn(s)}catch(k){let A=p();if(A==null||s.aborted)throw k;await new Promise(F=>setTimeout(F,A));continue}Ke(s);try{return{PartNumber:t,...await this.#d({signature:_,body:f,size:f.size,onProgress:d,onComplete:v,signal:s}).abortOn(s)}}catch(k){if(!await this.#h(k,c))throw k}}}};function ar(i){if(i?.error){let e=new Error(i.message);throw Object.assign(e,i.error),e}return i}o(ar,"assertServerError");function ad(i){let e=i.Expiration;if(e){let t=Math.floor((new Date(e)-Date.now())/1e3);if(t>9)return t}}o(ad,"getExpiry");function ld({meta:i,allowedMetaFields:e,querify:t=!1}){let r=e??Object.keys(i);return i?Object.fromEntries(r.filter(s=>i[s]!=null).map(s=>{let n=t?`metadata[${s}]`:s,a=String(i[s]);return[n,a]})):{}}o(ld,"getAllowedMetadata");var x0={allowedMetaFields:!0,limit:6,getTemporarySecurityCredentials:!1,shouldUseMultipart:o((i=>(i.size||0)>100*1024*1024),"shouldUseMultipart"),retryDelays:[0,1e3,3e3,5e3]},Lo=class i extends Pe{static{o(this,"AwsS3Multipart")}static VERSION=rd.version;#e;#t;requests;uploaderEvents;uploaders;constructor(e,t){super(e,{...x0,uploadPartBytes:i.uploadPartBytes,createMultipartUpload:null,listParts:null,abortMultipartUpload:null,completeMultipartUpload:null,signPart:null,getUploadParameters:null,...t}),this.type="uploader",this.id=this.opts.id||"AwsS3Multipart",this.#r(t);let r={createMultipartUpload:this.createMultipartUpload,listParts:this.listParts,abortMultipartUpload:this.abortMultipartUpload,completeMultipartUpload:this.completeMultipartUpload,signPart:t?.getTemporarySecurityCredentials?this.createSignedURL:this.signPart,getUploadParameters:t?.getTemporarySecurityCredentials?this.createSignedURL:this.getUploadParameters};for(let s of Object.keys(r))this.opts[s]==null&&(this.opts[s]=r[s].bind(this));this.requests=this.opts.rateLimitedQueue??new ft(this.opts.limit),this.#e=new Mo(this.requests,this.opts,this.#o,this.#n),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null)}[Symbol.for("uppy test: getClient")](){return this.#t}#r(e){e==null||!("endpoint"in e||"companionUrl"in e||"headers"in e||"companionHeaders"in e||"cookiesRule"in e||"companionCookiesRule"in e)||("companionUrl"in e&&!("endpoint"in e)&&this.uppy.log("`companionUrl` option has been removed in @uppy/aws-s3, use `endpoint` instead.","warning"),"companionHeaders"in e&&!("headers"in e)&&this.uppy.log("`companionHeaders` option has been removed in @uppy/aws-s3, use `headers` instead.","warning"),"companionCookiesRule"in e&&!("cookiesRule"in e)&&this.uppy.log("`companionCookiesRule` option has been removed in @uppy/aws-s3, use `cookiesRule` instead.","warning"),"endpoint"in e?this.#t=new Je(this.uppy,{pluginId:this.id,provider:"AWS",companionUrl:this.opts.endpoint,companionHeaders:this.opts.headers,companionCookiesRule:this.opts.cookiesRule}):("headers"in e&&this.#d(),"cookiesRule"in e&&(this.#t.opts.companionCookiesRule=e.cookiesRule)))}setOptions(e){this.#e.setOptions(e),super.setOptions(e),this.#r(e)}resetUploaderReferences(e,t){this.uploaders[e]&&(this.uploaders[e].abort({really:t?.abort||!1}),this.uploaders[e]=null),this.uploaderEvents[e]&&(this.uploaderEvents[e].remove(),this.uploaderEvents[e]=null)}#i(e){if(!this.#t)throw new Error(`Expected a \`endpoint\` option containing a URL, or if you are not using Companion, a custom \`${e}\` implementation.`)}createMultipartUpload(e,t){this.#i("createMultipartUpload"),Ke(t);let r=At(this.opts.allowedMetaFields,e.meta),s=ld({meta:e.meta,allowedMetaFields:r});return this.#t.post("s3/multipart",{filename:e.name,type:e.type,metadata:s},{signal:t}).then(ar)}listParts(e,{key:t,uploadId:r,signal:s},n){s??=n,this.#i("listParts"),Ke(s);let a=encodeURIComponent(t);return this.#t.get(`s3/multipart/${encodeURIComponent(r)}?key=${a}`,{signal:s}).then(ar)}completeMultipartUpload(e,{key:t,uploadId:r,parts:s,signal:n},a){n??=a,this.#i("completeMultipartUpload"),Ke(n);let u=encodeURIComponent(t),c=encodeURIComponent(r);return this.#t.post(`s3/multipart/${c}/complete?key=${u}`,{parts:s.map(({ETag:p,PartNumber:f})=>({ETag:p,PartNumber:f}))},{signal:n}).then(ar)}#s;async#l(e){if(Ke(e?.signal),this.#s==null){let{getTemporarySecurityCredentials:t}=this.opts;t===!0?(this.#i("getTemporarySecurityCredentials"),this.#s=this.#t.get("s3/sts",e).then(ar)):this.#s=t(e),this.#s=await this.#s,setTimeout(()=>{this.#s=null},(ad(this.#s.credentials)||0)*500)}return this.#s}async createSignedURL(e,t){let r=await this.#l(t),s=ad(r.credentials)||604800,{uploadId:n,key:a,partNumber:u}=t;return{method:"PUT",expires:s,fields:{},url:`${await Da({accountKey:r.credentials.AccessKeyId,accountSecret:r.credentials.SecretAccessKey,sessionToken:r.credentials.SessionToken,expires:s,bucketName:r.bucket,Region:r.region,Key:a??`${crypto.randomUUID()}-${e.name}`,uploadId:n,partNumber:u})}`,headers:{"Content-Type":e.type}}}signPart(e,{uploadId:t,key:r,partNumber:s,signal:n}){if(this.#i("signPart"),Ke(n),t==null||r==null||s==null)throw new Error("Cannot sign without a key, an uploadId, and a partNumber");let a=encodeURIComponent(r);return this.#t.get(`s3/multipart/${encodeURIComponent(t)}/${s}?key=${a}`,{signal:n}).then(ar)}abortMultipartUpload(e,{key:t,uploadId:r,signal:s}){this.#i("abortMultipartUpload");let n=encodeURIComponent(t),a=encodeURIComponent(r);return this.#t.delete(`s3/multipart/${a}?key=${n}`,void 0,{signal:s}).then(ar)}getUploadParameters(e,t){this.#i("getUploadParameters");let{meta:r}=e,{type:s,name:n}=r,a=At(this.opts.allowedMetaFields,e.meta),u=ld({meta:r,allowedMetaFields:a,querify:!0}),c=new URLSearchParams({filename:n,type:s,...u});return this.#t.get(`s3/params?${c}`,t)}static async uploadPartBytes({signature:{url:e,expires:t,headers:r,method:s="PUT"},body:n,size:a=n.size,onProgress:u,onComplete:c,signal:p}){if(Ke(p),e==null)throw new Error("Cannot upload to an undefined URL");return new Promise((f,d)=>{let v=new XMLHttpRequest;v.open(s,e,!0),r&&Object.keys(r).forEach(A=>{v.setRequestHeader(A,r[A])}),v.responseType="text",typeof t=="number"&&(v.timeout=t*1e3);function _(){v.abort()}o(_,"onabort");function k(){p?.removeEventListener("abort",_)}o(k,"cleanup"),p?.addEventListener("abort",_),v.upload.addEventListener("progress",A=>{u(A)}),v.addEventListener("abort",()=>{k(),d(Ur())}),v.addEventListener("timeout",()=>{k();let A=new Error("Request has expired");A.source={status:403},d(A)}),v.addEventListener("load",()=>{if(k(),v.status===403&&v.responseText.includes("<Message>Request has expired</Message>")){let C=new Error("Request has expired");C.source=v,d(C);return}if(v.status<200||v.status>=300){let C=new Error("Non 2xx");C.source=v,d(C);return}u?.({loaded:a,lengthComputable:!0});let A=v.getAllResponseHeaders().trim().split(/[\r\n]+/),F={__proto__:null};for(let C of A){let Y=C.split(": "),$=Y.shift(),H=Y.join(": ");F[$]=H}let{etag:R,location:U}=F;if(s.toUpperCase()==="POST"&&U==null&&console.error("@uppy/aws-s3: Could not read the Location header. This likely means CORS is not configured correctly on the S3 Bucket. See https://uppy.io/docs/aws-s3/#setting-up-your-s3-bucket"),R==null){console.error("@uppy/aws-s3: Could not read the ETag header. This likely means CORS is not configured correctly on the S3 Bucket. See https://uppy.io/docs/aws-s3/#setting-up-your-s3-bucket");return}c?.(R),f({...F,ETag:R})}),v.addEventListener("error",A=>{k();let F=new Error("Unknown error");F.source=A.target,d(F)}),v.send(n)})}#o=o((e,{key:t,uploadId:r})=>{let s=this.uppy.getFile(e.id);s!=null&&this.uppy.setFileState(e.id,{s3Multipart:{...s.s3Multipart,key:t,uploadId:r}})},"#setS3MultipartState");#n=o(e=>this.uppy.getFile(e.id)||e,"#getFile");#a(e){return new Promise((t,r)=>{let s=o((p,f)=>{let d=this.uppy.getFile(e.id);this.uppy.emit("upload-progress",d,{uploadStarted:d.progress.uploadStarted??0,bytesUploaded:p,bytesTotal:f})},"onProgress"),n=o(p=>{this.uppy.log(p),this.uppy.emit("upload-error",e,p),this.resetUploaderReferences(e.id),r(p)},"onError"),a=o(p=>{let f={body:{...p},status:200,uploadURL:p.location};this.resetUploaderReferences(e.id),this.uppy.emit("upload-success",this.#n(e),f),p.location&&this.uppy.log(`Download ${e.name} from ${p.location}`),t(void 0)},"onSuccess");if(e.data==null)throw new Error("File data is empty");let u=new nd(e.data,{companionComm:this.#e,log:o((...p)=>this.uppy.log(...p),"log"),getChunkSize:this.opts.getChunkSize?this.opts.getChunkSize.bind(this):void 0,onProgress:s,onError:n,onSuccess:a,onPartComplete:o(p=>{this.uppy.emit("s3-multipart:part-uploaded",this.#n(e),p)},"onPartComplete"),file:e,shouldUseMultipart:this.opts.shouldUseMultipart,...e.s3Multipart});this.uploaders[e.id]=u;let c=new Ot(this.uppy);this.uploaderEvents[e.id]=c,c.onFileRemove(e.id,p=>{u.abort(),this.resetUploaderReferences(e.id,{abort:!0}),t(`upload ${p} was removed`)}),c.onCancelAll(e.id,()=>{u.abort(),this.resetUploaderReferences(e.id,{abort:!0}),t(`upload ${e.id} was canceled`)}),c.onFilePause(e.id,p=>{p?u.pause():u.start()}),c.onPauseAll(e.id,()=>{u.pause()}),c.onResumeAll(e.id,()=>{u.start()}),u.start()})}#c(e){return{..."remote"in e&&e.remote?.body,protocol:"s3-multipart",size:e.data.size,metadata:e.meta}}#u=o(async e=>{if(e.length===0)return;let t=this.uppy.getFilesByIds(e),r=hi(t),s=fi(r);this.uppy.emit("upload-start",s);let n=r.map(u=>{if(u.isRemote){let c=o(()=>this.requests,"getQueue");this.#p(!1);let p=new AbortController,f=o(v=>{v.id===u.id&&p.abort()},"removedHandler");this.uppy.on("file-removed",f);let d=this.uppy.getRequestClientForFile(u).uploadRemoteFile(u,this.#c(u),{signal:p.signal,getQueue:c});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",f)},{priority:-1})(),d}return this.#a(u)}),a=await Promise.allSettled(n);return this.#p(!0),a},"#upload");#d=o(()=>{this.#t?.setCompanionHeaders(this.opts.headers)},"#setCompanionHeaders");#p=o(e=>{let{capabilities:t}=this.uppy.getState();this.uppy.setState({capabilities:{...t,resumableUploads:e}})},"#setResumableUploadsCapability");#h=o(()=>{this.#p(!0)},"#resetResumableCapability");install(){this.#p(!0),this.uppy.addPreProcessor(this.#d),this.uppy.addUploader(this.#u),this.uppy.on("cancel-all",this.#h)}uninstall(){this.uppy.removePreProcessor(this.#d),this.uppy.removeUploader(this.#u),this.uppy.off("cancel-all",this.#h)}};var ud={name:"@uppy/box",description:"Import files from Box, into Uppy.",version:"4.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","box"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var cd={strings:{pluginNameBox:"Box"}};var xi=class extends re{static{o(this,"Box")}static VERSION=ud.version;icon;provider;view;storage;files;rootFolderId=null;constructor(e,t){super(e,t),this.id=this.opts.id||"Box",this.type="acquirer",this.storage=this.opts.storage||Te,this.files=[],this.icon=()=>l("svg",{className:"uppy-DashboardTab-iconBox","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("g",{fill:"currentcolor",fillRule:"nonzero",children:[l("path",{d:"m16.4 13.5c-1.6 0-3 0.9-3.7 2.2-0.7-1.3-2.1-2.2-3.7-2.2-1 0-1.8 0.3-2.5 0.8v-3.6c-0.1-0.3-0.5-0.7-1-0.7s-0.8 0.4-0.8 0.8v7c0 2.3 1.9 4.2 4.2 4.2 1.6 0 3-0.9 3.7-2.2 0.7 1.3 2.1 2.2 3.7 2.2 2.3 0 4.2-1.9 4.2-4.2 0.1-2.4-1.8-4.3-4.1-4.3m-7.5 6.8c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5m7.5 0c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5"}),l("path",{d:"m27.2 20.6l-2.3-2.8 2.3-2.8c0.3-0.4 0.2-0.9-0.2-1.2s-1-0.2-1.3 0.2l-2 2.4-2-2.4c-0.3-0.4-0.9-0.4-1.3-0.2-0.4 0.3-0.5 0.8-0.2 1.2l2.3 2.8-2.3 2.8c-0.3 0.4-0.2 0.9 0.2 1.2s1 0.2 1.3-0.2l2-2.4 2 2.4c0.3 0.4 0.9 0.4 1.3 0.2 0.4-0.3 0.4-0.8 0.2-1.2"})]})}),this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new qe(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionKeysParams:this.opts.companionKeysParams,companionCookiesRule:this.opts.companionCookiesRule,provider:"box",pluginId:this.id,supportsRefreshToken:!1}),this.defaultLocale=cd,this.i18nInit(),this.title=this.i18n("pluginNameBox"),this.render=this.render.bind(this)}install(){this.view=new Ne(this,{provider:this.provider,loadAllFiles:!0,virtualList:!0});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.view.tearDown(),this.unmount()}render(e){return this.view.render(e)}};var La=ae(Zi(),1);var hd=ae(pd(),1);var dd={strings:{compressingImages:"Compressing images...",compressedX:"Saved %{size} by compressing images"}};var _0={quality:.6,limit:10},Bo=class extends Pe{static{o(this,"Compressor")}#e;constructor(e,t){super(e,{..._0,...t}),this.id=this.opts.id||"Compressor",this.type="modifier",this.defaultLocale=dd,this.#e=new ft(this.opts.limit),this.i18nInit(),this.prepareUpload=this.prepareUpload.bind(this),this.compress=this.compress.bind(this)}compress(e){return new Promise((t,r)=>{new hd.default(e,{...this.opts,success:t,error:r})})}async prepareUpload(e){let t=0,r=[],s=this.#e.wrapPromiseFunction(async a=>{try{if(a.data==null)throw new Error("File data is empty");let u=await this.compress(a.data),c=a.data.size-u.size;this.uppy.log(`[Image Compressor] Image ${a.id} compressed by ${(0,La.default)(c)}`),t+=c;let{name:p,type:f,size:d}=u,v=Et(p),k=`${Et(a.meta.name).name}.${v.extension}`;this.uppy.setFileState(a.id,{...p&&{name:p},...v.extension&&{extension:v.extension},...f&&{type:f},...d&&{size:d},data:u,meta:{...a.meta,type:f,name:k}}),r.push(a)}catch(u){this.uppy.log(`[Image Compressor] Failed to compress ${a.id}:`,"warning"),this.uppy.log(u,"warning")}}),n=e.map(a=>{let u=this.uppy.getFile(a);return this.uppy.emit("preprocess-progress",u,{mode:"indeterminate",message:this.i18n("compressingImages")}),u.isRemote||(u.data.type||(u.data=u.data.slice(0,u.data.size,u.type)),!u.type?.startsWith("image/"))?Promise.resolve():s(u)});await Promise.all(n),this.uppy.emit("compressor:complete",r),t>1024&&this.uppy.info(this.i18n("compressedX",{size:(0,La.default)(t)}),"info");for(let a of e){let u=this.uppy.getFile(a);this.uppy.emit("preprocess-complete",u)}}install(){this.uppy.addPreProcessor(this.prepareUpload)}uninstall(){this.uppy.removePreProcessor(this.prepareUpload)}};function fe(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}o(fe,"e");var xd=typeof self<"u"?self:global,hs=typeof navigator<"u",k0=hs&&typeof HTMLImageElement>"u",fd=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),Pd=xd.Buffer,_d=!!Pd,E0=o(i=>i!==void 0,"h");function kd(i){return i===void 0||(i instanceof Map?i.size===0:Object.values(i).filter(E0).length===0)}o(kd,"f");function Xe(i){let e=new Error(i);throw delete e.stack,e}o(Xe,"l");function md(i){let e=(function(t){let r=0;return t.ifd0.enabled&&(r+=1024),t.exif.enabled&&(r+=2048),t.makerNote&&(r+=2048),t.userComment&&(r+=1024),t.gps.enabled&&(r+=512),t.interop.enabled&&(r+=100),t.ifd1.enabled&&(r+=1024),r+2048})(i);return i.jfif.enabled&&(e+=50),i.xmp.enabled&&(e+=2e4),i.iptc.enabled&&(e+=14e3),i.icc.enabled&&(e+=6e3),e}o(md,"o");var Ba=o(i=>String.fromCharCode.apply(null,i),"u"),gd=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0,_i=class i{static{o(this,"c")}static from(e,t){return e instanceof this&&e.le===t?e:new i(e,void 0,void 0,t)}constructor(e,t=0,r,s){if(typeof s=="boolean"&&(this.le=s),Array.isArray(e)&&(e=new Uint8Array(e)),e===0)this.byteOffset=0,this.byteLength=0;else if(e instanceof ArrayBuffer){r===void 0&&(r=e.byteLength-t);let n=new DataView(e,t,r);this._swapDataView(n)}else if(e instanceof Uint8Array||e instanceof DataView||e instanceof i){r===void 0&&(r=e.byteLength-t),(t+=e.byteOffset)+r>e.byteOffset+e.byteLength&&Xe("Creating view outside of available memory in ArrayBuffer");let n=new DataView(e.buffer,t,r);this._swapDataView(n)}else if(typeof e=="number"){let n=new DataView(new ArrayBuffer(e));this._swapDataView(n)}else Xe("Invalid input argument for BufferView: "+e)}_swapArrayBuffer(e){this._swapDataView(new DataView(e))}_swapBuffer(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}_swapDataView(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}_lengthToEnd(e){return this.byteLength-e}set(e,t,r=i){return e instanceof DataView||e instanceof i?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||Xe("BufferView.set(): Invalid data argument."),this.toUint8().set(e,t),new r(this,t,e.byteLength)}subarray(e,t){return t=t||this._lengthToEnd(e),new i(this,e,t)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(e,t){return new Uint8Array(this.buffer,this.byteOffset+e,t)}getString(e=0,t=this.byteLength){return s=this.getUint8Array(e,t),gd?gd.decode(s):_d?Buffer.from(s).toString("utf8"):decodeURIComponent(escape(Ba(s)));var s}getLatin1String(e=0,t=this.byteLength){let r=this.getUint8Array(e,t);return Ba(r)}getUnicodeString(e=0,t=this.byteLength){let r=[];for(let s=0;s<t&&e+s<this.byteLength;s+=2)r.push(this.getUint16(e+s));return Ba(r)}getInt8(e){return this.dataView.getInt8(e)}getUint8(e){return this.dataView.getUint8(e)}getInt16(e,t=this.le){return this.dataView.getInt16(e,t)}getInt32(e,t=this.le){return this.dataView.getInt32(e,t)}getUint16(e,t=this.le){return this.dataView.getUint16(e,t)}getUint32(e,t=this.le){return this.dataView.getUint32(e,t)}getFloat32(e,t=this.le){return this.dataView.getFloat32(e,t)}getFloat64(e,t=this.le){return this.dataView.getFloat64(e,t)}getFloat(e,t=this.le){return this.dataView.getFloat32(e,t)}getDouble(e,t=this.le){return this.dataView.getFloat64(e,t)}getUintBytes(e,t,r){switch(t){case 1:return this.getUint8(e,r);case 2:return this.getUint16(e,r);case 4:return this.getUint32(e,r);case 8:return this.getUint64&&this.getUint64(e,r)}}getUint(e,t,r){switch(t){case 8:return this.getUint8(e,r);case 16:return this.getUint16(e,r);case 32:return this.getUint32(e,r);case 64:return this.getUint64&&this.getUint64(e,r)}}toString(e){return this.dataView.toString(e,this.constructor.name)}ensureChunk(){}};function za(i,e){Xe(`${i} '${e}' was not loaded, try using full build of exifr.`)}o(za,"p");var fs=class extends Map{static{o(this,"g")}constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||za(this.kind,e),t&&(e in t||(function(r,s){Xe(`Unknown ${r} '${s}'.`)})(this.kind,e),t[e].enabled||za(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}},Vo=new fs("file parser"),mt=new fs("segment parser"),ys=new fs("file reader"),F0=xd.fetch;function yd(i,e){return(t=i).startsWith("data:")||t.length>1e4?qa(i,e,"base64"):fd&&i.includes("://")?Ha(i,e,"url",jo):fd?qa(i,e,"fs"):hs?Ha(i,e,"url",jo):void Xe("Invalid input argument");var t}o(yd,"k");async function Ha(i,e,t,r){return ys.has(t)?qa(i,e,t):r?(async function(s,n){let a=await n(s);return new _i(a)})(i,r):void Xe(`Parser ${t} is not loaded`)}o(Ha,"O");async function qa(i,e,t){let r=new(ys.get(t))(i,e);return await r.read(),r}o(qa,"v");var jo=o(i=>F0(i).then((e=>e.arrayBuffer())),"S"),ms=o(i=>new Promise(((e,t)=>{let r=new FileReader;r.onloadend=()=>e(r.result||new ArrayBuffer),r.onerror=t,r.readAsArrayBuffer(i)})),"A"),Va=class extends Map{static{o(this,"U")}get tagKeys(){return this.allKeys||(this.allKeys=Array.from(this.keys())),this.allKeys}get tagValues(){return this.allValues||(this.allValues=Array.from(this.values())),this.allValues}};function Ed(i,e,t){let r=new Va;for(let[s,n]of t)r.set(s,n);if(Array.isArray(e))for(let s of e)i.set(s,r);else i.set(e,r);return r}o(Ed,"x");function Fd(i,e,t){let r,s=i.get(e);for(r of t)s.set(r[0],r[1])}o(Fd,"C");var vs=new Map,Xa=new Map,Ya=new Map,lr=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],$o=["jfif","xmp","icc","iptc","ihdr"],gs=["tiff",...$o],Me=["ifd0","ifd1","exif","gps","interop"],ur=[...gs,...Me],cr=["makerNote","userComment"],Wo=["translateKeys","translateValues","reviveValues","multiSegment"],pr=[...Wo,"sanitize","mergeOutput","silentErrors"],zo=class{static{o(this,"_")}get translate(){return this.translateKeys||this.translateValues||this.reviveValues}},Pi=class extends zo{static{o(this,"D")}get needed(){return this.enabled||this.deps.size>0}constructor(e,t,r,s){if(super(),fe(this,"enabled",!1),fe(this,"skip",new Set),fe(this,"pick",new Set),fe(this,"deps",new Set),fe(this,"translateKeys",!1),fe(this,"translateValues",!1),fe(this,"reviveValues",!1),this.key=e,this.enabled=t,this.parse=this.enabled,this.applyInheritables(s),this.canBeFiltered=Me.includes(e),this.canBeFiltered&&(this.dict=vs.get(e)),r!==void 0)if(Array.isArray(r))this.parse=this.enabled=!0,this.canBeFiltered&&r.length>0&&this.translateTagSet(r,this.pick);else if(typeof r=="object"){if(this.enabled=!0,this.parse=r.parse!==!1,this.canBeFiltered){let{pick:n,skip:a}=r;n&&n.length>0&&this.translateTagSet(n,this.pick),a&&a.length>0&&this.translateTagSet(a,this.skip)}this.applyInheritables(r)}else r===!0||r===!1?this.parse=this.enabled=r:Xe(`Invalid options argument: ${r}`)}applyInheritables(e){let t,r;for(t of Wo)r=e[t],r!==void 0&&(this[t]=r)}translateTagSet(e,t){if(this.dict){let r,s,{tagKeys:n,tagValues:a}=this.dict;for(r of e)typeof r=="string"?(s=a.indexOf(r),s===-1&&(s=n.indexOf(Number(r))),s!==-1&&t.add(Number(n[s]))):t.add(r)}else for(let r of e)t.add(r)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,Ho(this.pick,this.deps)):this.enabled&&this.pick.size>0&&Ho(this.pick,this.deps)}},at={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},vd=new Map,ki=class extends zo{static{o(this,"R")}static useCached(e){let t=vd.get(e);return t!==void 0||(t=new this(e),vd.set(e,t)),t}constructor(e){super(),e===!0?this.setupFromTrue():e===void 0?this.setupFromUndefined():Array.isArray(e)?this.setupFromArray(e):typeof e=="object"?this.setupFromObject(e):Xe(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=hs?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of lr)this[e]=at[e];for(e of pr)this[e]=at[e];for(e of cr)this[e]=at[e];for(e of ur)this[e]=new Pi(e,at[e],void 0,this)}setupFromTrue(){let e;for(e of lr)this[e]=at[e];for(e of pr)this[e]=at[e];for(e of cr)this[e]=!0;for(e of ur)this[e]=new Pi(e,!0,void 0,this)}setupFromArray(e){let t;for(t of lr)this[t]=at[t];for(t of pr)this[t]=at[t];for(t of cr)this[t]=at[t];for(t of ur)this[t]=new Pi(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,Me)}setupFromObject(e){let t;for(t of(Me.ifd0=Me.ifd0||Me.image,Me.ifd1=Me.ifd1||Me.thumbnail,Object.assign(this,e),lr))this[t]=ja(e[t],at[t]);for(t of pr)this[t]=ja(e[t],at[t]);for(t of cr)this[t]=ja(e[t],at[t]);for(t of gs)this[t]=new Pi(t,at[t],e[t],this);for(t of Me)this[t]=new Pi(t,at[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,Me,ur),e.tiff===!0?this.batchEnableWithBool(Me,!0):e.tiff===!1?this.batchEnableWithUserValue(Me,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,Me):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,Me)}batchEnableWithBool(e,t){for(let r of e)this[r].enabled=t}batchEnableWithUserValue(e,t){for(let r of e){let s=t[r];this[r].enabled=s!==!1&&s!==void 0}}setupGlobalFilters(e,t,r,s=r){if(e&&e.length){for(let a of s)this[a].enabled=!1;let n=bd(e,r);for(let[a,u]of n)Ho(this[a].pick,u),this[a].enabled=!0}else if(t&&t.length){let n=bd(t,r);for(let[a,u]of n)Ho(this[a].skip,u)}}filterNestedSegmentTags(){let{ifd0:e,exif:t,xmp:r,iptc:s,icc:n}=this;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),r.enabled||e.skip.add(700),s.enabled||e.skip.add(33723),n.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:t,gps:r,interop:s}=this;s.needed&&(t.deps.add(40965),e.deps.add(40965)),t.needed&&e.deps.add(34665),r.needed&&e.deps.add(34853),this.tiff.enabled=Me.some((n=>this[n].enabled===!0))||this.makerNote||this.userComment;for(let n of Me)this[n].finalizeFilters()}get onlyTiff(){return!$o.map((e=>this[e].enabled)).some((e=>e===!0))&&this.tiff.enabled}checkLoadedPlugins(){for(let e of gs)this[e].enabled&&!mt.has(e)&&za("segment parser",e)}};function bd(i,e){let t,r,s,n,a=[];for(s of e){for(n of(t=vs.get(s),r=[],t))(i.includes(n[0])||i.includes(n[1]))&&r.push(n[0]);r.length&&a.push([s,r])}return a}o(bd,"K");function ja(i,e){return i!==void 0?i:e!==void 0?e:void 0}o(ja,"W");function Ho(i,e){for(let t of e)i.add(t)}o(Ho,"X");fe(ki,"default",at);var dr=class{static{o(this,"H")}constructor(e){fe(this,"parsers",{}),fe(this,"output",{}),fe(this,"errors",[]),fe(this,"pushToErrors",(t=>this.errors.push(t))),this.options=ki.useCached(e)}async read(e){this.file=await(function(t,r){return typeof t=="string"?yd(t,r):hs&&!k0&&t instanceof HTMLImageElement?yd(t.src,r):t instanceof Uint8Array||t instanceof ArrayBuffer||t instanceof DataView?new _i(t):hs&&t instanceof Blob?Ha(t,r,"blob",ms):void Xe("Invalid input argument")})(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[r,s]of Vo)if(s.canHandle(e,t))return this.fileParser=new s(this.options,this.file,this.parsers),e[r]=!0;this.file.close&&this.file.close(),Xe("Unknown file format")}async parse(){let{output:e,errors:t}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),t.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&t.length>0&&(e.errors=t),kd(r=e)?void 0:r;var r}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let t=Object.values(this.parsers).map((async r=>{let s=await r.parse();r.assignToOutput(e,s)}));this.options.silentErrors&&(t=t.map((r=>r.catch(this.pushToErrors)))),await Promise.all(t)}async extractThumbnail(){this.setup();let{options:e,file:t}=this,r=mt.get("tiff",e);var s;if(t.tiff?s={start:0,type:"tiff"}:t.jpeg&&(s=await this.fileParser.getOrFindSegment("tiff")),s===void 0)return;let n=await this.fileParser.ensureSegmentChunk(s),a=this.parsers.tiff=new r(n,e,t),u=await a.extractThumbnail();return t.close&&t.close(),u}};async function Td(i,e){let t=new dr(e);return await t.read(i),t.parse()}o(Td,"Y");var T0=Object.freeze({__proto__:null,parse:Td,Exifr:dr,fileParsers:Vo,segmentParsers:mt,fileReaders:ys,tagKeys:vs,tagValues:Xa,tagRevivers:Ya,createDictionary:Ed,extendDictionary:Fd,fetchUrlAsArrayBuffer:jo,readBlobAsArrayBuffer:ms,chunkedProps:lr,otherSegments:$o,segments:gs,tiffBlocks:Me,segmentsAndBlocks:ur,tiffExtractables:cr,inheritables:Wo,allFormatters:pr,Options:ki}),ri=class{static{o(this,"J")}static findPosition(e,t){let r=e.getUint16(t+2)+2,s=typeof this.headerLength=="function"?this.headerLength(e,t,r):this.headerLength,n=t+s,a=r-s;return{offset:t,length:r,headerLength:s,start:n,size:a,end:n+a}}static parse(e,t={}){return new this(e,new ki({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof _i?e:new _i(e)}constructor(e,t={},r){fe(this,"errors",[]),fe(this,"raw",new Map),fe(this,"handleError",(s=>{if(!this.options.silentErrors)throw s;this.errors.push(s.message)})),this.chunk=this.normalizeInput(e),this.file=r,this.type=this.constructor.type,this.globalOptions=this.options=t,this.localOptions=t[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(e,t){let r=Ya.get(t),s=Xa.get(t),n=vs.get(t),a=this.options[t],u=a.reviveValues&&!!r,c=a.translateValues&&!!s,p=a.translateKeys&&!!n,f={};for(let[d,v]of e)u&&r.has(d)?v=r.get(d)(v):c&&s.has(d)&&(v=this.translateValue(v,s.get(d))),p&&n.has(d)&&(d=n.get(d)||d),f[d]=v;return f}translateValue(e,t){return t[e]||t.DEFAULT||e}assignToOutput(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}assignObjectToOutput(e,t,r){if(this.globalOptions.mergeOutput)return Object.assign(e,r);e[t]?Object.assign(e[t],r):e[t]=r}};fe(ri,"headerLength",4),fe(ri,"type",void 0),fe(ri,"multiSegment",!1),fe(ri,"canHandle",(()=>!1));function C0(i){return i===192||i===194||i===196||i===219||i===221||i===218||i===254}o(C0,"q");function A0(i){return i>=224&&i<=239}o(A0,"Q");function R0(i,e,t){for(let[r,s]of mt)if(s.canHandle(i,e,t))return r}o(R0,"Z");var qo=class extends class{constructor(e,t,r){fe(this,"errors",[]),fe(this,"ensureSegmentChunk",(async s=>{let n=s.start,a=s.size||65536;if(this.file.chunked)if(this.file.available(n,a))s.chunk=this.file.subarray(n,a);else try{s.chunk=await this.file.readChunk(n,a)}catch(u){Xe(`Couldn't read segment: ${JSON.stringify(s)}. ${u.message}`)}else this.file.byteLength>n+a?s.chunk=this.file.subarray(n,a):s.size===void 0?s.chunk=this.file.subarray(n):Xe("Segment unreachable: "+JSON.stringify(s));return s.chunk})),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=t,this.parsers=r}injectSegment(e,t){this.options[e].enabled&&this.createParser(e,t)}createParser(e,t){let r=new(mt.get(e))(t,this.options,this.file);return this.parsers[e]=r}createParsers(e){for(let t of e){let{type:r,chunk:s}=t,n=this.options[r];if(n&&n.enabled){let a=this.parsers[r];a&&a.append||a||this.createParser(r,s)}}}async readSegments(e){let t=e.map(this.ensureSegmentChunk);await Promise.all(t)}}{static{o(this,"ee")}constructor(...e){super(...e),fe(this,"appSegments",[]),fe(this,"jpegSegments",[]),fe(this,"unknownSegments",[])}static canHandle(e,t){return t===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(e){e===!0?(this.findAll=!0,this.wanted=new Set(mt.keyList())):(e=e===void 0?mt.keyList().filter((t=>this.options[t].enabled)):e.filter((t=>this.options[t].enabled&&mt.has(t))),this.findAll=!1,this.remaining=new Set(e),this.wanted=new Set(e)),this.unfinishedMultiSegment=!1}async findAppSegments(e=0,t){this.setupSegmentFinderArgs(t);let{file:r,findAll:s,wanted:n,remaining:a}=this;if(!s&&this.file.chunked&&(s=Array.from(n).some((u=>{let c=mt.get(u),p=this.options[u];return c.multiSegment&&p.multiSegment})),s&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,r.byteLength),!this.options.onlyTiff&&r.chunked){let u=!1;for(;a.size>0&&!u&&(r.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:c}=r,p=this.appSegments.some((f=>!this.file.available(f.offset||f.start,f.length||f.size)));if(u=e>c&&!p?!await r.readNextChunk(e):!await r.readNextChunk(c),(e=this.findAppSegmentsInRange(e,r.byteLength))===void 0)return}}}findAppSegmentsInRange(e,t){t-=2;let r,s,n,a,u,c,{file:p,findAll:f,wanted:d,remaining:v,options:_}=this;for(;e<t;e++)if(p.getUint8(e)===255){if(r=p.getUint8(e+1),A0(r)){if(s=p.getUint16(e+2),n=R0(p,e,s),n&&d.has(n)&&(a=mt.get(n),u=a.findPosition(p,e),c=_[n],u.type=n,this.appSegments.push(u),!f&&(a.multiSegment&&c.multiSegment?(this.unfinishedMultiSegment=u.chunkNumber<u.chunkCount,this.unfinishedMultiSegment||v.delete(n)):v.delete(n),v.size===0)))break;_.recordUnknownSegments&&(u=ri.findPosition(p,e),u.marker=r,this.unknownSegments.push(u)),e+=s+1}else if(C0(r)){if(s=p.getUint16(e+2),r===218&&_.stopAfterSos!==!1)return;_.recordJpegSegments&&this.jpegSegments.push({offset:e,length:s,marker:r}),e+=s+1}}return e}mergeMultiSegments(){if(!this.appSegments.some((t=>t.multiSegment)))return;let e=(function(t,r){let s,n,a,u=new Map;for(let c=0;c<t.length;c++)s=t[c],n=s[r],u.has(n)?a=u.get(n):u.set(n,a=[]),a.push(s);return Array.from(u)})(this.appSegments,"type");this.mergedAppSegments=e.map((([t,r])=>{let s=mt.get(t,this.options);return s.handleMultiSegments?{type:t,chunk:s.handleMultiSegments(r)}:r[0]}))}getSegment(e){return this.appSegments.find((t=>t.type===e))}async getOrFindSegment(e){let t=this.getSegment(e);return t===void 0&&(await this.findAppSegments(0,[e]),t=this.getSegment(e)),t}};fe(qo,"type","jpeg"),Vo.set("jpeg",qo);var U0=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4],$a=class extends ri{static{o(this,"se")}parseHeader(){var e=this.chunk.getUint16();e===18761?this.le=!0:e===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(e,t,r=new Map){let{pick:s,skip:n}=this.options[t];s=new Set(s);let a=s.size>0,u=n.size===0,c=this.chunk.getUint16(e);e+=2;for(let p=0;p<c;p++){let f=this.chunk.getUint16(e);if(a){if(s.has(f)&&(r.set(f,this.parseTag(e,f,t)),s.delete(f),s.size===0))break}else!u&&n.has(f)||r.set(f,this.parseTag(e,f,t));e+=12}return r}parseTag(e,t,r){let{chunk:s}=this,n=s.getUint16(e+2),a=s.getUint32(e+4),u=U0[n];if(u*a<=4?e+=8:e=s.getUint32(e+8),(n<1||n>13)&&Xe(`Invalid TIFF value type. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e}`),e>s.byteLength&&Xe(`Invalid TIFF value offset. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e} is outside of chunk size ${s.byteLength}`),n===1)return s.getUint8Array(e,a);if(n===2)return(c=(function(p){for(;p.endsWith("\0");)p=p.slice(0,-1);return p})(c=s.getString(e,a)).trim())===""?void 0:c;var c;if(n===7)return s.getUint8Array(e,a);if(a===1)return this.parseTagValue(n,e);{let p=new((function(d){switch(d){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}})(n))(a),f=u;for(let d=0;d<a;d++)p[d]=this.parseTagValue(n,e),e+=f;return p}}parseTagValue(e,t){let{chunk:r}=this;switch(e){case 1:return r.getUint8(t);case 3:return r.getUint16(t);case 4:return r.getUint32(t);case 5:return r.getUint32(t)/r.getUint32(t+4);case 6:return r.getInt8(t);case 8:return r.getInt16(t);case 9:return r.getInt32(t);case 10:return r.getInt32(t)/r.getInt32(t+4);case 11:return r.getFloat(t);case 12:return r.getDouble(t);case 13:return r.getUint32(t);default:Xe(`Invalid tiff type ${e}`)}}},ds=class extends $a{static{o(this,"ie")}static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1165519206&&e.getUint16(t+8)===0}async parse(){this.parseHeader();let{options:e}=this;return e.ifd0.enabled&&await this.parseIfd0Block(),e.exif.enabled&&await this.safeParse("parseExifBlock"),e.gps.enabled&&await this.safeParse("parseGpsBlock"),e.interop.enabled&&await this.safeParse("parseInteropBlock"),e.ifd1.enabled&&await this.safeParse("parseThumbnailBlock"),this.createOutput()}safeParse(e){let t=this[e]();return t.catch!==void 0&&(t=t.catch(this.handleError)),t}findIfd0Offset(){this.ifd0Offset===void 0&&(this.ifd0Offset=this.chunk.getUint32(4))}findIfd1Offset(){if(this.ifd1Offset===void 0){this.findIfd0Offset();let e=this.chunk.getUint16(this.ifd0Offset),t=this.ifd0Offset+2+12*e;this.ifd1Offset=this.chunk.getUint32(t)}}parseBlock(e,t){let r=new Map;return this[t]=r,this.parseTags(e,t,r),r}async parseIfd0Block(){if(this.ifd0)return;let{file:e}=this;this.findIfd0Offset(),this.ifd0Offset<8&&Xe("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&Xe(`IFD0 offset points to outside of file.
this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,md(this.options));let t=this.parseBlock(this.ifd0Offset,"ifd0");return t.size!==0?(this.exifOffset=t.get(34665),this.interopOffset=t.get(40965),this.gpsOffset=t.get(34853),this.xmp=t.get(700),this.iptc=t.get(33723),this.icc=t.get(34675),this.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,md(this.options));let e=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=e.get(40965)),this.makerNote=e.get(37500),this.userComment=e.get(37510),this.options.sanitize&&(e.delete(40965),e.delete(37500),e.delete(37510)),this.unpack(e,41728),this.unpack(e,41729),e}unpack(e,t){let r=e.get(t);r&&r.length===1&&e.set(t,r[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let e=this.parseBlock(this.gpsOffset,"gps");return e&&e.has(2)&&e.has(4)&&(e.set("latitude",wd(...e.get(2),e.get(1))),e.set("longitude",wd(...e.get(4),e.get(3)))),e}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(e=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||e))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let e=this.ifd1.get(513),t=this.ifd1.get(514);return this.chunk.getUint8Array(e,t)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let e,t,r,s={};for(t of Me)if(e=this[t],!kd(e))if(r=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t==="ifd1")continue;Object.assign(s,r)}else s[t]=r;return this.makerNote&&(s.makerNote=this.makerNote),this.userComment&&(s.userComment=this.userComment),s}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[r,s]of Object.entries(t))this.assignObjectToOutput(e,r,s)}};function wd(i,e,t,r){var s=i+e/60+t/3600;return r!=="S"&&r!=="W"||(s*=-1),s}o(wd,"ne");fe(ds,"type","tiff"),fe(ds,"headerLength",10),mt.set("tiff",ds);var bF=Object.freeze({__proto__:null,default:T0,Exifr:dr,fileParsers:Vo,segmentParsers:mt,fileReaders:ys,tagKeys:vs,tagValues:Xa,tagRevivers:Ya,createDictionary:Ed,extendDictionary:Fd,fetchUrlAsArrayBuffer:jo,readBlobAsArrayBuffer:ms,chunkedProps:lr,otherSegments:$o,segments:gs,tiffBlocks:Me,segmentsAndBlocks:ur,tiffExtractables:cr,inheritables:Wo,allFormatters:pr,Options:ki,parse:Td}),Ja={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1},wF=Object.assign({},Ja,{firstChunkSize:4e4,gps:[1,2,3,4]});var SF=Object.assign({},Ja,{tiff:!1,ifd1:!0,mergeOutput:!1});var O0=Object.assign({},Ja,{firstChunkSize:4e4,ifd0:[274]});async function D0(i){let e=new dr(O0);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}o(D0,"ce");var I0=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}}),cs=!0,ps=!0;if(typeof navigator=="object"){let i=navigator.userAgent;if(i.includes("iPad")||i.includes("iPhone")){let e=i.match(/OS (\d+)_(\d+)/);if(e){let[,t,r]=e;cs=Number(t)+.1*Number(r)<13.4,ps=!1}}else if(i.includes("OS X 10")){let[,e]=i.match(/OS X 10[_.](\d+)/);cs=ps=Number(e)<15}if(i.includes("Chrome/")){let[,e]=i.match(/Chrome\/(\d+)/);cs=ps=Number(e)<81}else if(i.includes("Firefox/")){let[,e]=i.match(/Firefox\/(\d+)/);cs=ps=Number(e)<77}}async function Cd(i){let e=await D0(i);return Object.assign({canvas:cs,css:ps},I0[e])}o(Cd,"ye");var Wa=class extends _i{static{o(this,"be")}constructor(...e){super(...e),fe(this,"ranges",new Ga),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,r){if(e===0&&this.byteLength===0&&r){let s=new DataView(r.buffer||r,r.byteOffset,r.byteLength);this._swapDataView(s)}else{let s=e+t;if(s>this.byteLength){let{dataView:n}=this._extend(s);this._swapDataView(n)}}}_extend(e){let t;t=_d?Pd.allocUnsafe(e):new Uint8Array(e);let r=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:r}}subarray(e,t,r=!1){return t=t||this._lengthToEnd(e),r&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,r=!1){r&&this._tryExtend(t,e.byteLength,e);let s=super.set(e,t);return this.ranges.add(t,s.byteLength),s}async ensureChunk(e,t){this.chunked&&(this.ranges.available(e,t)||await this.readChunk(e,t))}available(e,t){return this.ranges.available(e,t)}},Ga=class{static{o(this,"we")}constructor(){fe(this,"list",[])}get length(){return this.list.length}add(e,t,r=0){let s=e+t,n=this.list.filter((a=>Sd(e,a.offset,s)||Sd(e,a.end,s)));if(n.length>0){e=Math.min(e,...n.map((u=>u.offset))),s=Math.max(s,...n.map((u=>u.end))),t=s-e;let a=n.shift();a.offset=e,a.length=t,a.end=s,this.list=this.list.filter((u=>!n.includes(u)))}else this.list.push({offset:e,length:t,end:s})}available(e,t){let r=e+t;return this.list.some((s=>s.offset<=e&&r<=s.end))}};function Sd(i,e,t){return i<=e&&e<=t}o(Sd,"ke");var Ka=class extends Wa{static{o(this,"Oe")}constructor(e,t){super(0),fe(this,"chunksRead",0),this.input=e,this.options=t}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(e=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let t=this.options.chunkSize,r=await this.readChunk(e,t);return!!r&&r.byteLength===t}async readChunk(e,t){if(this.chunksRead++,(t=this.safeWrapAddress(e,t))!==0)return this._readChunk(e,t)}safeWrapAddress(e,t){return this.size!==void 0&&e+t>this.size?Math.max(0,this.size-e):t}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksRead<this.options.chunkLimit}get fullyRead(){return this.size!==void 0&&this.nextChunkOffset===this.size}read(){return this.options.chunked?this.readChunked():this.readWhole()}close(){}};ys.set("blob",class extends Ka{async readWhole(){this.chunked=!1;let i=await ms(this.input);this._swapArrayBuffer(i)}readChunked(){return this.chunked=!0,this.size=this.input.size,super.readChunked()}async _readChunk(i,e){let t=e?i+e:void 0,r=this.input.slice(i,t),s=await ms(r);return this.set(s,i,!0)}});var Ad={name:"@uppy/thumbnail-generator",description:"Uppy plugin that generates small previews of images to show on your upload UI.",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin","thumbnail","preview","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^",exifr:"^7.0.0"},devDependencies:{jsdom:"^26.1.0","namespace-emitter":"2.0.1",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"}};var Rd={strings:{generatingThumbnails:"Generating thumbnails..."}};function M0(i,e,t){try{i.getContext("2d").getImageData(0,0,1,1)}catch(r){if(r.code===18)return Promise.reject(new Error("cannot read image, probably an svg with external resources"))}return i.toBlob?new Promise(r=>{i.toBlob(r,e,t)}).then(r=>{if(r===null)throw new Error("cannot read image, probably an svg with external resources");return r}):Promise.resolve().then(()=>Rn(i.toDataURL(e,t),{})).then(r=>{if(r===null)throw new Error("could not extract blob, probably an old browser");return r})}o(M0,"canvasToBlob");function L0(i,e){let t=i.width,r=i.height;(e.deg===90||e.deg===270)&&(t=i.height,r=i.width);let s=document.createElement("canvas");s.width=t,s.height=r;let n=s.getContext("2d");return n.translate(t/2,r/2),e.canvas&&(n.rotate(e.rad),n.scale(e.scaleX,e.scaleY)),n.drawImage(i,-i.width/2,-i.height/2,i.width,i.height),s}o(L0,"rotateImage");function B0(i){let e=i.width/i.height,t=5e6,r=4096,s=Math.floor(Math.sqrt(t*e)),n=Math.floor(t/Math.sqrt(t*e));if(s>r&&(s=r,n=Math.round(s/e)),n>r&&(n=r,s=Math.round(e*n)),i.width>s){let a=document.createElement("canvas");return a.width=s,a.height=n,a.getContext("2d").drawImage(i,0,0,s,n),a}return i}o(B0,"protect");var j0={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1},hr=class extends re{static{o(this,"ThumbnailGenerator")}static VERSION=Ad.version;queue;queueProcessing;defaultThumbnailDimension;thumbnailType;constructor(e,t){if(super(e,{...j0,...t}),this.type="modifier",this.id=this.opts.id||"ThumbnailGenerator",this.title="Thumbnail Generator",this.queue=[],this.queueProcessing=!1,this.defaultThumbnailDimension=200,this.thumbnailType=this.opts.thumbnailType,this.defaultLocale=Rd,this.i18nInit(),this.opts.lazy&&this.opts.waitForThumbnailsBeforeUpload)throw new Error("ThumbnailGenerator: The `lazy` and `waitForThumbnailsBeforeUpload` options are mutually exclusive. Please ensure at most one of them is set to `true`.")}createThumbnail(e,t,r){if(e.data==null)throw new Error("File data is empty");let s=URL.createObjectURL(e.data),n=new Promise((u,c)=>{let p=new Image;p.src=s,p.addEventListener("load",()=>{URL.revokeObjectURL(s),u(p)}),p.addEventListener("error",f=>{URL.revokeObjectURL(s),c(f.error||new Error("Could not create thumbnail"))})}),a=Cd(e.data).catch(()=>1);return Promise.all([n,a]).then(([u,c])=>{let p=this.getProportionalDimensions(u,t,r,c.deg),f=L0(u,c),d=this.resizeImage(f,p.width,p.height);return M0(d,this.thumbnailType,80)}).then(u=>URL.createObjectURL(u))}getProportionalDimensions(e,t,r,s){let n=e.width/e.height;if((s===90||s===270)&&(n=e.height/e.width),t!=null){let a=t;return e.width<t&&(a=e.width),{width:a,height:Math.round(a/n)}}if(r!=null){let a=r;return e.height<r&&(a=e.height),{width:Math.round(a*n),height:a}}return{width:this.defaultThumbnailDimension,height:Math.round(this.defaultThumbnailDimension/n)}}resizeImage(e,t,r){let s=B0(e),n=Math.ceil(Math.log2(s.width/t));n<1&&(n=1);let a=t*2**(n-1),u=r*2**(n-1),c=2;for(;n--;){let p=document.createElement("canvas");p.width=a,p.height=u,p.getContext("2d").drawImage(s,0,0,a,u),s=p,a=Math.round(a/c),u=Math.round(u/c)}return s}setPreviewURL(e,t){this.uppy.setFileState(e,{preview:t})}addToQueue(e){this.queue.push(e),this.queueProcessing===!1&&this.processQueue()}processQueue(){if(this.queueProcessing=!0,this.queue.length>0){let e=this.uppy.getFile(this.queue.shift());return e?this.requestThumbnail(e).catch(()=>{}).then(()=>this.processQueue()):(this.uppy.log("[ThumbnailGenerator] file was removed before a thumbnail could be generated, but not removed from the queue. This is probably a bug","error"),Promise.resolve())}return this.queueProcessing=!1,this.uppy.log("[ThumbnailGenerator] Emptied thumbnail queue"),this.uppy.emit("thumbnail:all-generated"),Promise.resolve()}requestThumbnail(e){return jr(e.type)&&!e.isRemote?this.createThumbnail(e,this.opts.thumbnailWidth,this.opts.thumbnailHeight).then(t=>{this.setPreviewURL(e.id,t),this.uppy.log(`[ThumbnailGenerator] Generated thumbnail for ${e.id}`),this.uppy.emit("thumbnail:generated",this.uppy.getFile(e.id),t)}).catch(t=>{this.uppy.log(`[ThumbnailGenerator] Failed thumbnail for ${e.id}:`,"warning"),this.uppy.log(t,"warning"),this.uppy.emit("thumbnail:error",this.uppy.getFile(e.id),t)}):Promise.resolve()}onFileAdded=o(e=>{!e.preview&&e.data&&jr(e.type)&&!e.isRemote&&this.addToQueue(e.id)},"onFileAdded");onCancelRequest=o(e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1)},"onCancelRequest");onFileRemoved=o(e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1),e.preview&&Br(e.preview)&&URL.revokeObjectURL(e.preview)},"onFileRemoved");onRestored=o(()=>{this.uppy.getFiles().filter(t=>t.isRestored).forEach(t=>{(!t.preview||Br(t.preview))&&this.addToQueue(t.id)})},"onRestored");onAllFilesRemoved=o(()=>{this.queue=[]},"onAllFilesRemoved");waitUntilAllProcessed=o(e=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-progress",s,{mode:"indeterminate",message:this.i18n("generatingThumbnails")})});let t=o(()=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-complete",s)})},"emitPreprocessCompleteForAll");return new Promise(r=>{this.queueProcessing?this.uppy.once("thumbnail:all-generated",()=>{t(),r()}):(t(),r())})},"waitUntilAllProcessed");install(){this.uppy.on("file-removed",this.onFileRemoved),this.uppy.on("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("thumbnail:cancel",this.onCancelRequest)):(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("file-added",this.onFileAdded),this.uppy.on("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.addPreProcessor(this.waitUntilAllProcessed)}uninstall(){this.uppy.off("file-removed",this.onFileRemoved),this.uppy.off("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("thumbnail:cancel",this.onCancelRequest)):(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("file-added",this.onFileAdded),this.uppy.off("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.removePreProcessor(this.waitUntilAllProcessed)}};var Ud={name:"@uppy/dashboard",description:"Universal UI plugin for Uppy.",version:"5.1.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --silent='passed-only'","test:e2e":"vitest run --project browser"},keywords:["file uploader","uppy","uppy-plugin","dashboard","ui"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/provider-views":"workspace:^","@uppy/thumbnail-generator":"workspace:^","@uppy/utils":"workspace:^",classnames:"^2.2.6",lodash:"^4.17.21",nanoid:"^5.0.9",preact:"^10.5.13","shallow-equal":"^3.0.0"},devDependencies:{"@uppy/core":"workspace:^","@uppy/dropbox":"workspace:^","@uppy/google-drive":"workspace:^","@uppy/url":"workspace:^","@uppy/webcam":"workspace:^","@vitest/browser":"^3.2.4",cssnano:"^7.0.7",jsdom:"^26.1.0",playwright:"1.57.0",postcss:"^8.5.6","postcss-cli":"^11.0.1","resize-observer-polyfill":"^1.5.0",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"}};var ph=ae(Ge(),1);var Qa=class extends Se{static{o(this,"AddFiles")}fileInput=null;folderInput=null;mobilePhotoFileInput=null;mobileVideoFileInput=null;triggerFileInputClick=o(()=>{this.fileInput?.click()},"triggerFileInputClick");triggerFolderInputClick=o(()=>{this.folderInput?.click()},"triggerFolderInputClick");triggerVideoCameraInputClick=o(()=>{this.mobileVideoFileInput?.click()},"triggerVideoCameraInputClick");triggerPhotoCameraInputClick=o(()=>{this.mobilePhotoFileInput?.click()},"triggerPhotoCameraInputClick");onFileInputChange=o(e=>{this.props.handleInputChange(e),e.currentTarget.value=""},"onFileInputChange");renderHiddenInput=o((e,t)=>l("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,webkitdirectory:e,type:"file",name:"files[]",multiple:this.props.maxNumberOfFiles!==1,onChange:this.onFileInputChange,accept:this.props.allowedFileTypes?.join(", "),ref:t}),"renderHiddenInput");renderHiddenCameraInput=o((e,t,r)=>{let n={photo:"image/*",video:"video/*"}[e];return l("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,type:"file",name:`camera-${e}`,onChange:this.onFileInputChange,capture:t===""?"environment":t,accept:n,ref:r})},"renderHiddenCameraInput");renderMyDeviceAcquirer=o(()=>l("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MyDevice",children:l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerFileInputClick,children:[l("div",{className:"uppy-DashboardTab-inner",children:l("svg",{className:"uppy-DashboardTab-iconMyDevice","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("path",{d:"M8.45 22.087l-1.305-6.674h17.678l-1.572 6.674H8.45zm4.975-12.412l1.083 1.765a.823.823 0 00.715.386h7.951V13.5H8.587V9.675h4.838zM26.043 13.5h-1.195v-2.598c0-.463-.336-.75-.798-.75h-8.356l-1.082-1.766A.823.823 0 0013.897 8H7.728c-.462 0-.815.256-.815.718V13.5h-.956a.97.97 0 00-.746.37.972.972 0 00-.19.81l1.724 8.565c.095.44.484.755.933.755H24c.44 0 .824-.3.929-.727l2.043-8.568a.972.972 0 00-.176-.825.967.967 0 00-.753-.38z",fill:"currentcolor","fill-rule":"evenodd"})})}),l("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("myDevice")})]})}),"renderMyDeviceAcquirer");renderPhotoCamera=o(()=>l("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobilePhotoCamera",children:l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerPhotoCameraInputClick,children:[l("div",{className:"uppy-DashboardTab-inner",children:l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383","fill-rule":"nonzero"})})}),l("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("takePictureBtn")})]})}),"renderPhotoCamera");renderVideoCamera=o(()=>l("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobileVideoCamera",children:l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerVideoCameraInputClick,children:[l("div",{className:"uppy-DashboardTab-inner",children:l("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32",children:l("path",{fill:"#FF675E",fillRule:"nonzero",d:"m21.254 14.277 2.941-2.588c.797-.313 1.243.818 1.09 1.554-.01 2.094.02 4.189-.017 6.282-.126.915-1.145 1.08-1.58.34l-2.434-2.142c-.192.287-.504 1.305-.738.468-.104-1.293-.028-2.596-.05-3.894.047-.312.381.823.426 1.069.063-.384.206-.744.362-1.09zm-12.939-3.73c3.858.013 7.717-.025 11.574.02.912.129 1.492 1.237 1.351 2.217-.019 2.412.04 4.83-.03 7.239-.17 1.025-1.166 1.59-2.029 1.429-3.705-.012-7.41.025-11.114-.019-.913-.129-1.492-1.237-1.352-2.217.018-2.404-.036-4.813.029-7.214.136-.82.83-1.473 1.571-1.454z "})})}),l("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("recordVideoBtn")})]})}),"renderVideoCamera");renderBrowseButton=o((e,t)=>{let r=this.props.acquirers.length;return l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-browse",onClick:t,"data-uppy-super-focusable":r===0,children:e})},"renderBrowseButton");renderDropPasteBrowseTagline=o(e=>{let t=this.renderBrowseButton(this.props.i18n("browseFiles"),this.triggerFileInputClick),r=this.renderBrowseButton(this.props.i18n("browseFolders"),this.triggerFolderInputClick),s=this.props.fileManagerSelectionType,n=s.charAt(0).toUpperCase()+s.slice(1);return l("div",{class:"uppy-Dashboard-AddFiles-title",children:this.props.disableLocalFiles?this.props.i18n("importFiles"):e>0?this.props.i18nArray(`dropPasteImport${n}`,{browseFiles:t,browseFolders:r,browse:t}):this.props.i18nArray(`dropPaste${n}`,{browseFiles:t,browseFolders:r,browse:t})})},"renderDropPasteBrowseTagline");[Symbol.for("uppy test: disable unused locale key warning")](){this.props.i18nArray("dropPasteBoth"),this.props.i18nArray("dropPasteFiles"),this.props.i18nArray("dropPasteFolders"),this.props.i18nArray("dropPasteImportBoth"),this.props.i18nArray("dropPasteImportFiles"),this.props.i18nArray("dropPasteImportFolders")}renderAcquirer=o(e=>l("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":e.id,children:l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-cy":e.id,"aria-controls":`uppy-DashboardContent-panel--${e.id}`,"aria-selected":this.props.activePickerPanel?.id===e.id,"data-uppy-super-focusable":!0,onClick:o(()=>this.props.showPanel(e.id),"onClick"),children:[l("div",{className:"uppy-DashboardTab-inner",children:e.icon()}),l("div",{className:"uppy-DashboardTab-name",children:e.name})]})}),"renderAcquirer");renderAcquirers=o(e=>{let t=[...e],r=t.splice(e.length-2,e.length);return l(Re,{children:[t.map(s=>this.renderAcquirer(s)),l("span",{role:"presentation",style:{"white-space":"nowrap"},children:r.map(s=>this.renderAcquirer(s))})]})},"renderAcquirers");renderSourcesList=o((e,t)=>{let{showNativePhotoCameraButton:r,showNativeVideoCameraButton:s}=this.props,n=[],a="myDevice";t||n.push({key:a,elements:this.renderMyDeviceAcquirer()}),r&&n.push({key:"nativePhotoCameraButton",elements:this.renderPhotoCamera()}),s&&n.push({key:"nativePhotoCameraButton",elements:this.renderVideoCamera()}),n.push(...e.map(f=>({key:f.id,elements:this.renderAcquirer(f)}))),n.length===1&&n[0].key===a&&(n=[]);let c=[...n],p=c.splice(n.length-2,n.length);return l(Re,{children:[this.renderDropPasteBrowseTagline(n.length),l("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist",children:[c.map(({key:f,elements:d})=>l(Re,{children:d},f)),l("span",{role:"presentation",style:{"white-space":"nowrap"},children:p.map(({key:f,elements:d})=>l(Re,{children:d},f))})]})]})},"renderSourcesList");renderPoweredByUppy(){let{i18nArray:e}=this.props,t=l("span",{children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11",children:l("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z",fillRule:"evenodd"})}),l("span",{className:"uppy-Dashboard-poweredByUppy",children:"Uppy"})]}),r=e("poweredBy",{uppy:t});return l("a",{tabIndex:-1,href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",className:"uppy-Dashboard-poweredBy",children:r})}render(){let{showNativePhotoCameraButton:e,showNativeVideoCameraButton:t,nativeCameraFacingMode:r}=this.props;return l("div",{className:"uppy-Dashboard-AddFiles",children:[this.renderHiddenInput(!1,s=>{this.fileInput=s}),this.renderHiddenInput(!0,s=>{this.folderInput=s}),e&&this.renderHiddenCameraInput("photo",r,s=>{this.mobilePhotoFileInput=s}),t&&this.renderHiddenCameraInput("video",r,s=>{this.mobileVideoFileInput=s}),this.renderSourcesList(this.props.acquirers,this.props.disableLocalFiles),l("div",{className:"uppy-Dashboard-AddFiles-info",children:[this.props.note&&l("div",{className:"uppy-Dashboard-note",children:this.props.note}),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy()]})]})}},Go=Qa;var Od=ae(Ge(),1);var H0=o(i=>l("div",{className:(0,Od.default)("uppy-Dashboard-AddFilesPanel",i.className),"data-uppy-panelType":"AddFiles","aria-hidden":!i.showAddFilesPanel,children:[l("div",{className:"uppy-DashboardContent-bar",children:[l("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18n("addingMoreFiles")}),l("button",{className:"uppy-DashboardContent-back",type:"button",onClick:o(()=>i.toggleAddFilesPanel(!1),"onClick"),children:i.i18n("back")})]}),l(Go,{...i})]}),"AddFilesPanel"),Dd=H0;var Id=ae(Ge(),1);function q0(i){let e=i.files[i.fileCardFor],t=o(()=>{i.uppy.emit("file-editor:cancel",e),i.closeFileEditor()},"handleCancel");return l("div",{className:(0,Id.default)("uppy-DashboardContent-panel",i.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor",children:[l("div",{className:"uppy-DashboardContent-bar",children:[l("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18nArray("editing",{file:l("span",{className:"uppy-DashboardContent-titleFile",children:e.meta?e.meta.name:e.name})})}),l("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:i.i18n("cancel")}),l("button",{className:"uppy-DashboardContent-save",type:"button",onClick:i.saveFileEditor,children:i.i18n("save")})]}),l("div",{className:"uppy-DashboardContent-panelBody",children:i.editors.map(r=>i.uppy.getPlugin(r.id).render(i.state))})]})}o(q0,"EditorPanel");var Nd=q0;var Md=ae(Ge(),1);function V0(){return l("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:l("g",{fill:"#686DE0",fillRule:"evenodd",children:[l("path",{d:"M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",fillRule:"nonzero"}),l("path",{d:"M6.35 17.172l4.994-5.026a.5.5 0 0 1 .707 0l2.16 2.16 3.505-3.505a.5.5 0 0 1 .707 0l2.336 2.31-.707.72-1.983-1.97-3.505 3.505a.5.5 0 0 1-.707 0l-2.16-2.159-3.938 3.939-1.409.026z",fillRule:"nonzero"}),l("circle",{cx:"7.5",cy:"9.5",r:"1.5"})]})})}o(V0,"iconImage");function $0(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:l("path",{d:"M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z",fill:"#049BCF",fillRule:"nonzero"})})}o($0,"iconAudio");function W0(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:l("path",{d:"M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z",fill:"#19AF67",fillRule:"nonzero"})})}o(W0,"iconVideo");function G0(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:l("path",{d:"M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z",fill:"#E2514A",fillRule:"nonzero"})})}o(G0,"iconPDF");function K0(){return l("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:l("path",{d:"M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z",fill:"#00C469",fillRule:"nonzero"})})}o(K0,"iconArchive");function X0(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:l("g",{fill:"#A7AFB7",fillRule:"nonzero",children:[l("path",{d:"M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z"}),l("path",{d:"M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z"})]})})}o(X0,"iconFile");function Y0(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:l("path",{d:"M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z",fill:"#5A5E69",fillRule:"nonzero"})})}o(Y0,"iconText");function Ei(i){let e={color:"#838999",icon:X0()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:Y0()}:t==="image"?{color:"#686de0",icon:V0()}:t==="audio"?{color:"#068dbb",icon:$0()}:t==="video"?{color:"#19af67",icon:W0()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:G0()}:t==="application"&&["zip","x-7z-compressed","x-zip-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:K0()}:e}o(Ei,"getIconByMime");function J0(i){let{tagName:e}=i.target;if(e==="INPUT"||e==="TEXTAREA"){i.stopPropagation();return}i.preventDefault(),i.stopPropagation()}o(J0,"ignoreEvent");var Nt=J0;function bs(i){let{file:e}=i;if(e.preview)return l("img",{draggable:!1,className:"uppy-Dashboard-Item-previewImg",alt:e.name,src:e.preview});let{color:t,icon:r}=Ei(e.type);return l("div",{className:"uppy-Dashboard-Item-previewIconWrap",children:[l("span",{className:"uppy-Dashboard-Item-previewIcon",style:{color:t},children:r}),l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-Dashboard-Item-previewIconBg",width:"58",height:"76",viewBox:"0 0 58 76",children:l("rect",{fill:"#FFF",width:"58",height:"76",rx:"3",fillRule:"evenodd"})})]})}o(bs,"FilePreview");function Za(i){let{computedMetaFields:e,requiredMetaFields:t,updateMeta:r,form:s,formState:n}=i,a={text:"uppy-u-reset uppy-c-textInput uppy-Dashboard-FileCard-input"};return e.map(u=>{let c=`uppy-Dashboard-FileCard-input-${u.id}`,p=t.includes(u.id);return l("fieldset",{className:"uppy-Dashboard-FileCard-fieldset",children:[l("label",{className:"uppy-Dashboard-FileCard-label",htmlFor:c,children:u.name}),u.render!==void 0?u.render({value:n[u.id],onChange:o(f=>r(f,u.id),"onChange"),fieldCSSClasses:a,required:p,form:s.id},Gr):l("input",{className:a.text,id:c,form:s.id,type:u.type||"text",required:p,value:n[u.id],placeholder:u.placeholder,onInput:o(f=>r(f.target.value,u.id),"onInput"),"data-uppy-super-focusable":!0})]},u.id)})}o(Za,"RenderMetaFields");function el(i){let{files:e,fileCardFor:t,toggleFileCard:r,saveFileCard:s,metaFields:n,requiredMetaFields:a,openFileEditor:u,i18n:c,i18nArray:p,className:f,canEditFile:d}=i,v=o(()=>typeof n=="function"?n(e[t]):n,"getMetaFields"),_=e[t],k=v()??[],A=d(_),F={};k.forEach(K=>{F[K.id]=_.meta[K.id]??""});let[R,U]=it(F),C=rt(K=>{K.preventDefault(),s(R,t)},[s,R,t]),Y=o((K,Z)=>{U({...R,[Z]:K})},"updateMeta"),$=o(()=>{r(!1)},"handleCancel"),[H]=it(()=>{let K=document.createElement("form");return K.setAttribute("tabindex","-1"),K.id=Dt(),K}),Q=Ye(null);return ze(()=>{let K=Q.current?.getRootNode()??document;return K instanceof Document?K.body.appendChild(H):(K instanceof ShadowRoot,K.appendChild(H)),H.addEventListener("submit",C),()=>{H.removeEventListener("submit",C),H.parentNode&&H.parentNode.removeChild(H)}},[H,C]),l("div",{className:(0,Md.default)("uppy-Dashboard-FileCard",f),"data-uppy-panelType":"FileCard",onDragOver:Nt,onDragLeave:Nt,onDrop:Nt,onPaste:Nt,ref:Q,children:[l("div",{className:"uppy-DashboardContent-bar",children:[l("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:p("editing",{file:l("span",{className:"uppy-DashboardContent-titleFile",children:_.meta?_.meta.name:_.name})})}),l("button",{className:"uppy-DashboardContent-back",type:"button",form:H.id,title:c("finishEditingFile"),onClick:$,children:c("cancel")})]}),l("div",{className:"uppy-Dashboard-FileCard-inner",children:[l("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:Ei(_.type).color},children:[l(bs,{file:_}),A&&l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:o(K=>{C(K),u(_)},"onClick"),children:c("editImage")})]}),l("div",{className:"uppy-Dashboard-FileCard-info",children:l(Za,{computedMetaFields:k,requiredMetaFields:a,updateMeta:Y,form:H,formState:R})}),l("div",{className:"uppy-Dashboard-FileCard-actions",children:[l("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn",type:"submit",form:H.id,children:c("saveChanges")}),l("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:$,form:H.id,children:c("cancel")})]})]})]})}o(el,"FileCard");var zd=ae(Ge(),1);function Ld(i,e){if(i===e)return!0;if(!i||!e)return!1;let t=Object.keys(i),r=Object.keys(e),s=t.length;if(r.length!==s)return!1;for(let n=0;n<s;n++){let a=t[n];if(i[a]!==e[a]||!Object.prototype.hasOwnProperty.call(e,a))return!1}return!0}o(Ld,"shallowEqualObjects");function tl(i,e="Copy the URL below"){return new Promise(t=>{let r=document.createElement("textarea");r.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),r.value=i,document.body.appendChild(r),r.select();let s=o(()=>{document.body.removeChild(r),window.prompt(e,i),t()},"magicCopyFailed");try{return document.execCommand("copy")?(document.body.removeChild(r),t()):s()}catch{return document.body.removeChild(r),s()}})}o(tl,"copyToClipboard");function Q0({file:i,uploadInProgressOrComplete:e,metaFields:t,canEditFile:r,i18n:s,onClick:n}){return!e&&t&&t.length>0||!e&&r(i)?l("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-action uppy-Dashboard-Item-action--edit",type:"button","aria-label":s("editFileWithFilename",{file:i.meta.name}),title:s("editFileWithFilename",{file:i.meta.name}),onClick:o(()=>n(),"onClick"),children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14",children:l("g",{fillRule:"evenodd",children:[l("path",{d:"M1.5 10.793h2.793A1 1 0 0 0 5 10.5L11.5 4a1 1 0 0 0 0-1.414L9.707.793a1 1 0 0 0-1.414 0l-6.5 6.5A1 1 0 0 0 1.5 8v2.793zm1-1V8L9 1.5l1.793 1.793-6.5 6.5H2.5z",fillRule:"nonzero"}),l("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),l("path",{fillRule:"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})]})})}):null}o(Q0,"EditButton");function Z0({i18n:i,onClick:e,file:t}){return l("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--remove",type:"button","aria-label":i("removeFile",{file:t.meta.name}),title:i("removeFile",{file:t.meta.name}),onClick:o(()=>e(),"onClick"),children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18",children:[l("path",{d:"M9 0C4.034 0 0 4.034 0 9s4.034 9 9 9 9-4.034 9-9-4.034-9-9-9z"}),l("path",{fill:"#FFF",d:"M13 12.222l-.778.778L9 9.778 5.778 13 5 12.222 8.222 9 5 5.778 5.778 5 9 8.222 12.222 5l.778.778L9.778 9z"})]})})}o(Z0,"RemoveButton");function eb({file:i,uppy:e,i18n:t}){let r=o(s=>{tl(i.uploadURL,t("copyLinkToClipboardFallback")).then(()=>{e.log("Link copied to clipboard."),e.info(t("copyLinkToClipboardSuccess"),"info",3e3)}).catch(e.log).then(()=>s.target.focus({preventScroll:!0}))},"copyLinkToClipboard");return l("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--copyLink",type:"button","aria-label":t("copyLink"),title:t("copyLink"),onClick:o(s=>r(s),"onClick"),children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12",children:l("path",{d:"M7.94 7.703a2.613 2.613 0 0 1-.626 2.681l-.852.851a2.597 2.597 0 0 1-1.849.766A2.616 2.616 0 0 1 2.764 7.54l.852-.852a2.596 2.596 0 0 1 2.69-.625L5.267 7.099a1.44 1.44 0 0 0-.833.407l-.852.851a1.458 1.458 0 0 0 1.03 2.486c.39 0 .755-.152 1.03-.426l.852-.852c.231-.231.363-.522.406-.824l1.04-1.038zm4.295-5.937A2.596 2.596 0 0 0 10.387 1c-.698 0-1.355.272-1.849.766l-.852.851a2.614 2.614 0 0 0-.624 2.688l1.036-1.036c.041-.304.173-.6.407-.833l.852-.852c.275-.275.64-.426 1.03-.426a1.458 1.458 0 0 1 1.03 2.486l-.852.851a1.442 1.442 0 0 1-.824.406l-1.04 1.04a2.596 2.596 0 0 0 2.683-.628l.851-.85a2.616 2.616 0 0 0 0-3.697zm-6.88 6.883a.577.577 0 0 0 .82 0l3.474-3.474a.579.579 0 1 0-.819-.82L5.355 7.83a.579.579 0 0 0 0 .819z"})})})}o(eb,"CopyLinkButton");function il(i){let{uppy:e,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,showLinkToFileUploadResult:a,showRemoveButton:u,i18n:c,toggleFileCard:p,openFileEditor:f}=i;return l("div",{className:"uppy-Dashboard-Item-actionWrapper",children:[l(Q0,{i18n:c,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,onClick:o(()=>{n&&n.length>0?p(!0,t.id):f(t)},"editAction")}),a&&t.uploadURL?l(eb,{file:t,uppy:e,i18n:c}):null,u?l(Z0,{i18n:c,file:t,onClick:o(()=>e.removeFile(t.id),"onClick")}):null]})}o(il,"Buttons");var Bd=ae(Zi(),1);var tb=o((i,e)=>(typeof e=="function"?e():e).filter(s=>s.id===i)[0].name,"metaFieldIdToName");function ws(i){let{file:e,toggleFileCard:t,i18n:r,metaFields:s}=i,{missingRequiredMetaFields:n}=e;if(!n?.length)return null;let a=n.map(u=>tb(u,s)).join(", ");return l("div",{className:"uppy-Dashboard-Item-errorMessage",children:[r("missingRequiredMetaFields",{smart_count:n.length,fields:a})," ",l("button",{type:"button",class:"uppy-u-reset uppy-Dashboard-Item-errorMessageBtn",onClick:o(()=>t(!0,e.id),"onClick"),children:r("editFile")})]})}o(ws,"MetaErrorMessage");var ib=o(i=>{let{author:e,name:t}=i.file.meta;function r(){return i.isSingleFile&&i.containerHeight>=350?90:i.containerWidth<=352?35:i.containerWidth<=576?60:e?20:30}return o(r,"getMaxNameLength"),l("div",{className:"uppy-Dashboard-Item-name",title:t,children:Hr(t,r())})},"renderFileName"),rb=o(i=>{let{author:e}=i.file.meta,t="remote"in i.file?i.file.remote?.providerName:void 0,r="\xB7";return e?l("div",{className:"uppy-Dashboard-Item-author",children:[l("a",{href:`${e.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",children:Hr(e.name,13)}),t?l(Re,{children:[` ${r} `,t,` ${r} `]}):null]}):null},"renderAuthor"),sb=o(i=>i.file.size&&l("div",{className:"uppy-Dashboard-Item-statusSize",children:(0,Bd.default)(i.file.size)}),"renderFileSize"),ob=o(i=>i.file.isGhost&&l("span",{children:[" \u2022 ",l("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-reSelect",type:"button",onClick:o(()=>i.toggleAddFilesPanel(!0),"onClick"),children:i.i18n("reSelect")})]}),"ReSelectButton"),nb=o(({file:i,onClick:e})=>i.error?l("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-errorDetails","aria-label":i.error,"data-microtip-position":"bottom","data-microtip-size":"medium",onClick:e,type:"button",children:"?"}):null,"ErrorButton");function rl(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,toggleAddFilesPanel:n,isSingleFile:a,containerHeight:u,containerWidth:c}=i;return l("div",{className:"uppy-Dashboard-Item-fileInfo","data-uppy-file-source":e.source,children:[l("div",{className:"uppy-Dashboard-Item-fileName",children:[ib({file:e,isSingleFile:a,containerHeight:u,containerWidth:c}),l(nb,{file:e,onClick:o(()=>alert(e.error),"onClick")})]}),l("div",{className:"uppy-Dashboard-Item-status",children:[rb({file:e}),sb({file:e}),ob({file:e,toggleAddFilesPanel:n,i18n:t})]}),l(ws,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}o(rl,"FileInfo");function sl(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,showLinkToFileUploadResult:n}=i,u=e.preview?"rgba(255, 255, 255, 0.5)":Ei(e.type).color;return l("div",{className:"uppy-Dashboard-Item-previewInnerWrap",style:{backgroundColor:u},children:[n&&e.uploadURL&&l("a",{className:"uppy-Dashboard-Item-previewLink",href:e.uploadURL,rel:"noreferrer noopener",target:"_blank","aria-label":e.meta.name,children:l("span",{hidden:!0,children:e.meta.name})}),l(bs,{file:e}),l(ws,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}o(sl,"FilePreviewAndLink");function ab(i){if(!i.isUploaded){if(i.error&&!i.hideRetryButton){i.uppy.retryUpload(i.file.id);return}i.resumableUploads&&!i.hidePauseResumeButton?i.uppy.pauseResume(i.file.id):i.individualCancellation&&!i.hideCancelButton&&i.uppy.removeFile(i.file.id)}}o(ab,"onPauseResumeCancelRetry");function jd(i){return i.isUploaded?i.i18n("uploadComplete"):i.error?i.i18n("retryUpload"):i.resumableUploads?i.file.isPaused?i.i18n("resumeUpload"):i.i18n("pauseUpload"):i.individualCancellation?i.i18n("cancelUpload"):""}o(jd,"progressIndicatorTitle");function ol(i){return l("div",{className:"uppy-Dashboard-Item-progress",children:l("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-progressIndicator",type:"button","aria-label":jd(i),title:jd(i),onClick:o(()=>ab(i),"onClick"),children:i.children})})}o(ol,"ProgressIndicatorButton");function Ko({children:i}){return l("svg",{"aria-hidden":"true",focusable:"false",width:"70",height:"70",viewBox:"0 0 36 36",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--circle",children:i})}o(Ko,"ProgressCircleContainer");function nl({progress:i}){let e=2*Math.PI*15;return l("g",{children:[l("circle",{className:"uppy-Dashboard-Item-progressIcon--bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),l("circle",{className:"uppy-Dashboard-Item-progressIcon--progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)",fill:"none","stroke-width":"2","stroke-dasharray":e,"stroke-dashoffset":e-e/100*i})]})}o(nl,"ProgressCircle");function al(i){return!i.file.progress.uploadStarted||i.file.progress.percentage===void 0?null:i.isUploaded?l("div",{className:"uppy-Dashboard-Item-progress",children:l("div",{className:"uppy-Dashboard-Item-progressIndicator",children:l(Ko,{children:[l("circle",{r:"15",cx:"18",cy:"18",fill:"#1bb240"}),l("polygon",{className:"uppy-Dashboard-Item-progressIcon--check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"})]})})}):i.recoveredState?null:i.error&&!i.hideRetryButton?l(ol,{...i,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--retry",width:"28",height:"31",viewBox:"0 0 16 19",children:[l("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),l("path",{d:"M7.9 3H10v2H7.9z"}),l("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),l("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"})]})}):i.resumableUploads&&!i.hidePauseResumeButton?l(ol,{...i,children:l(Ko,{children:[l(nl,{progress:i.file.progress.percentage}),i.file.isPaused?l("polygon",{className:"uppy-Dashboard-Item-progressIcon--play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}):l("g",{className:"uppy-Dashboard-Item-progressIcon--pause",transform:"translate(14.5, 13)",children:[l("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),l("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})]})]})}):!i.resumableUploads&&i.individualCancellation&&!i.hideCancelButton?l(ol,{...i,children:l(Ko,{children:[l(nl,{progress:i.file.progress.percentage}),l("polygon",{className:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"})]})}):l("div",{className:"uppy-Dashboard-Item-progress",children:l("div",{className:"uppy-Dashboard-Item-progressIndicator",children:l(Ko,{children:l(nl,{progress:i.file.progress.percentage})})})})}o(al,"FileProgress");var Ss=class extends Se{static{o(this,"FileItem")}componentDidMount(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}shouldComponentUpdate(e){return!Ld(this.props,e)}componentDidUpdate(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}componentWillUnmount(){let{file:e}=this.props;e.preview||this.props.handleCancelThumbnail(e)}render(){let{file:e}=this.props,t=e.progress.preprocess||e.progress.postprocess,r=!!e.progress.uploadComplete&&!t&&!e.error,s=!!e.progress.uploadStarted||!!t,n=e.progress.uploadStarted&&!e.progress.uploadComplete||t,a=e.error||!1,{isGhost:u}=e,c=(this.props.individualCancellation||!n)&&!r;r&&this.props.showRemoveButtonAfterComplete&&(c=!0);let p=(0,zd.default)({"uppy-Dashboard-Item":!0,"is-inprogress":n&&!this.props.recoveredState,"is-processing":t,"is-complete":r,"is-error":!!a,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation,"is-ghost":u});return l("div",{className:p,id:`uppy_${e.id}`,role:this.props.role,children:[l("div",{className:"uppy-Dashboard-Item-preview",children:[l(sl,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),l(al,{uppy:this.props.uppy,file:e,error:a,isUploaded:r,hideRetryButton:this.props.hideRetryButton,hideCancelButton:this.props.hideCancelButton,hidePauseResumeButton:this.props.hidePauseResumeButton,recoveredState:this.props.recoveredState,resumableUploads:this.props.resumableUploads,individualCancellation:this.props.individualCancellation,i18n:this.props.i18n})]}),l("div",{className:"uppy-Dashboard-Item-fileInfoAndButtons",children:[l(rl,{file:e,containerWidth:this.props.containerWidth,containerHeight:this.props.containerHeight,i18n:this.props.i18n,toggleAddFilesPanel:this.props.toggleAddFilesPanel,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields,isSingleFile:this.props.isSingleFile}),l(il,{file:e,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:c,canEditFile:this.props.canEditFile,uploadInProgressOrComplete:s,toggleFileCard:this.props.toggleFileCard,openFileEditor:this.props.openFileEditor,uppy:this.props.uppy,i18n:this.props.i18n})]})]})}};function lb(i,e){let t=[],r=[];return i.forEach(s=>{r.length<e?r.push(s):(t.push(r),r=[s])}),r.length&&t.push(r),t}o(lb,"chunks");function ll({id:i,i18n:e,uppy:t,files:r,resumableUploads:s,hideRetryButton:n,hidePauseResumeButton:a,hideCancelButton:u,showLinkToFileUploadResult:c,showRemoveButtonAfterComplete:p,metaFields:f,isSingleFile:d,toggleFileCard:v,handleRequestThumbnail:_,handleCancelThumbnail:k,recoveredState:A,individualCancellation:F,itemsPerRow:R,openFileEditor:U,canEditFile:C,toggleAddFilesPanel:Y,containerWidth:$,containerHeight:H}){let Q=R===1?71:200,K=yi(()=>{let ye=o((we,me)=>Number(r[me].isGhost)-Number(r[we].isGhost),"sortByGhostComesFirst"),se=Object.keys(r);return A&&se.sort(ye),lb(se,R)},[r,R,A]),Z=o(ye=>l("div",{class:"uppy-Dashboard-filesInner",role:"presentation",children:ye.map(se=>l(Ss,{uppy:t,id:i,i18n:e,resumableUploads:s,individualCancellation:F,hideRetryButton:n,hidePauseResumeButton:a,hideCancelButton:u,showLinkToFileUploadResult:c,showRemoveButtonAfterComplete:p,metaFields:f,recoveredState:A,isSingleFile:d,containerWidth:$,containerHeight:H,toggleFileCard:v,handleRequestThumbnail:_,handleCancelThumbnail:k,role:"listitem",openFileEditor:U,canEditFile:C,toggleAddFilesPanel:Y,file:r[se]},se))},ye[0]),"renderRow");return d?l("div",{class:"uppy-Dashboard-files",children:Z(K[0])}):l(Qi,{class:"uppy-Dashboard-files",role:"list",data:K,renderRow:Z,rowHeight:Q})}o(ll,"FileList");var Hd=300,xs=class extends Se{static{o(this,"FadeIn")}ref=Zu();componentWillEnter(e){this.ref.current.style.opacity="1",this.ref.current.style.transform="none",setTimeout(e,Hd)}componentWillLeave(e){this.ref.current.style.opacity="0",this.ref.current.style.transform="translateY(350%)",setTimeout(e,Hd)}render(){let{children:e}=this.props;return l("div",{className:"uppy-Informer-animated",ref:this.ref,children:e})}};function ub(i,e){return Object.assign(i,e)}o(ub,"assign");function cb(i,e){return i?.key??e}o(cb,"getKey");function pb(i,e){let t=i._ptgLinkedRefs||(i._ptgLinkedRefs={});return t[e]||(t[e]=r=>{i.refs[e]=r})}o(pb,"linkRef");function Ps(i){let e={};for(let t=0;t<i.length;t++)if(i[t]!=null){let r=cb(i[t],t.toString(36));e[r]=i[t]}return e}o(Ps,"getChildMapping");function db(i,e){i=i||{},e=e||{};let t=o(a=>Object.hasOwn(e,a)?e[a]:i[a],"getValueForKey"),r={},s=[];for(let a in i)Object.hasOwn(e,a)?s.length&&(r[a]=s,s=[]):s.push(a);let n={};for(let a in e){if(Object.hasOwn(r,a))for(let u=0;u<r[a].length;u++){let c=r[a][u];n[r[a][u]]=t(c)}n[a]=t(a)}for(let a=0;a<s.length;a++)n[s[a]]=t(s[a]);return n}o(db,"mergeChildMappings");var hb=o(i=>i,"identity"),Xo=class extends Se{static{o(this,"TransitionGroup")}constructor(e,t){super(e,t),this.refs={},this.state={children:Ps(Ut(Ut(this.props.children))||[])},this.performAppear=this.performAppear.bind(this),this.performEnter=this.performEnter.bind(this),this.performLeave=this.performLeave.bind(this)}componentWillMount(){this.currentlyTransitioningKeys={},this.keysToAbortLeave=[],this.keysToEnter=[],this.keysToLeave=[]}componentDidMount(){let e=this.state.children;for(let t in e)e[t]&&this.performAppear(t)}componentWillReceiveProps(e){let t=Ps(Ut(e.children)||[]),r=this.state.children;this.setState(n=>({children:db(n.children,t)}));let s;for(s in t)if(Object.hasOwn(t,s)){let n=r&&Object.hasOwn(r,s);t[s]&&n&&this.currentlyTransitioningKeys[s]?(this.keysToEnter.push(s),this.keysToAbortLeave.push(s)):t[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToEnter.push(s)}for(s in r)if(Object.hasOwn(r,s)){let n=t&&Object.hasOwn(t,s);r[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToLeave.push(s)}}componentDidUpdate(){let{keysToEnter:e}=this;this.keysToEnter=[],e.forEach(this.performEnter);let{keysToLeave:t}=this;this.keysToLeave=[],t.forEach(this.performLeave)}_finishAbort(e){let t=this.keysToAbortLeave.indexOf(e);t!==-1&&this.keysToAbortLeave.splice(t,1)}performAppear(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillAppear?t.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)}_handleDoneAppearing(e){let t=this.refs[e];t?.componentDidAppear&&t.componentDidAppear(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=Ps(Ut(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performEnter(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillEnter?t.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)}_handleDoneEntering(e){let t=this.refs[e];t?.componentDidEnter&&t.componentDidEnter(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=Ps(Ut(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performLeave(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;this.currentlyTransitioningKeys[e]=!0;let r=this.refs[e];r?.componentWillLeave?r.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)}_handleDoneLeaving(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;let r=this.refs[e];r?.componentDidLeave&&r.componentDidLeave(),delete this.currentlyTransitioningKeys[e];let s=Ps(Ut(this.props.children)||[]);if(s&&Object.hasOwn(s,e))this.performEnter(e);else{let n=ub({},this.state.children);delete n[e],this.setState({children:n})}}render({childFactory:e,transitionLeave:t,transitionName:r,transitionAppear:s,transitionEnter:n,transitionLeaveTimeout:a,transitionEnterTimeout:u,transitionAppearTimeout:c,component:p,...f},{children:d}){let v=Object.entries(d).map(([_,k])=>{if(!k)return;let A=pb(this,_);return po(e(k),{ref:A,key:_})}).filter(Boolean);return Gr(p,f,v)}};Xo.defaultProps={component:"span",childFactory:hb};var qd=Xo;var fr=class extends Se{static{o(this,"Informer")}render(){let{info:e}=this.props.uppy.getState();return l("div",{className:"uppy uppy-Informer",children:l(qd,{children:e.map(t=>l(xs,{children:l("p",{role:"alert",children:[t.message," ",t.details&&l("span",{"aria-label":t.details,"data-microtip-position":"top-left","data-microtip-size":"medium",role:"tooltip",onClick:o(()=>alert(`${t.message}
${t.details}`),"onClick"),children:"?"})]})},t.message))})})}};var Vd=ae(Ge(),1);function fb({activePickerPanel:i,className:e,hideAllPanels:t,i18n:r,state:s,uppy:n}){let a=Ye(null);return l("div",{className:(0,Vd.default)("uppy-DashboardContent-panel",e),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${i.id}`,onDragOver:Nt,onDragLeave:Nt,onDrop:Nt,onPaste:Nt,children:[l("div",{className:"uppy-DashboardContent-bar",children:[l("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:r("importFrom",{name:i.name})}),l("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:r("cancel")})]}),l("div",{ref:a,className:"uppy-DashboardContent-panelBody",children:n.getPlugin(i.id).render(s,a.current)})]})}o(fb,"PickerPanelContent");var $d=fb;var Mt={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function mb(i,e,t,r={}){if(i)return Mt.STATE_ERROR;if(e)return Mt.STATE_COMPLETE;if(t)return Mt.STATE_PAUSED;let s=Mt.STATE_WAITING,n=Object.keys(r);for(let a=0;a<n.length;a++){let{progress:u}=r[n[a]];if(u.uploadStarted&&!u.uploadComplete)return Mt.STATE_UPLOADING;u.preprocess&&s!==Mt.STATE_UPLOADING&&(s=Mt.STATE_PREPROCESSING),u.postprocess&&s!==Mt.STATE_UPLOADING&&s!==Mt.STATE_PREPROCESSING&&(s=Mt.STATE_POSTPROCESSING)}return s}o(mb,"getUploadingState");function gb({files:i,i18n:e,isAllComplete:t,isAllErrored:r,isAllPaused:s,inProgressNotPausedFiles:n,newFiles:a,processingFiles:u}){switch(mb(r,t,s,i)){case"uploading":return e("uploadingXFiles",{smart_count:n.length});case"preprocessing":case"postprocessing":return e("processingXFiles",{smart_count:u.length});case"paused":return e("uploadPaused");case"waiting":return e("xFilesSelected",{smart_count:a.length});case"complete":return e("uploadComplete");case"error":return e("error");default:}}o(gb,"UploadStatus");function yb(i){let{i18n:e,isAllComplete:t,hideCancelButton:r,maxNumberOfFiles:s,toggleAddFilesPanel:n,uppy:a}=i,{allowNewUpload:u}=i;return u&&s&&(u=i.totalFileCount<i.maxNumberOfFiles),l("div",{className:"uppy-DashboardContent-bar",children:[!t&&!r?l("button",{className:"uppy-DashboardContent-back",type:"button",onClick:o(()=>a.cancelAll(),"onClick"),children:e("cancel")}):l("div",{}),l("div",{className:"uppy-DashboardContent-title",children:l(gb,{...i})}),u?l("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":e("addMoreFiles"),title:e("addMoreFiles"),onClick:o(()=>n(!0),"onClick"),children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15",children:l("path",{d:"M8 6.5h6a.5.5 0 0 1 .5.5v.5a.5.5 0 0 1-.5.5H8v6a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V8h-6a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h6v-6A.5.5 0 0 1 7 0h.5a.5.5 0 0 1 .5.5v6z"})}),l("span",{className:"uppy-DashboardContent-addMoreCaption",children:e("addMore")})]}):l("div",{})]})}o(yb,"PanelTopBar");var Wd=yb;var Kd=ae(Ge(),1);var mr="uppy-transition-slideDownUp",Gd=250;function vb({children:i}){let[e,t]=it(null),[r,s]=it(""),n=Ye(),a=Ye(),u=Ye(),c=rt(()=>{s(`${mr}-enter`),cancelAnimationFrame(u.current),clearTimeout(a.current),a.current=void 0,u.current=requestAnimationFrame(()=>{s(`${mr}-enter ${mr}-enter-active`),n.current=setTimeout(()=>{s("")},Gd)})},[]),p=rt(()=>{s(`${mr}-leave`),cancelAnimationFrame(u.current),clearTimeout(n.current),n.current=void 0,u.current=requestAnimationFrame(()=>{s(`${mr}-leave ${mr}-leave-active`),a.current=setTimeout(()=>{t(null),s("")},Gd)})},[]);return ze(()=>{let f=Ut(i)[0];e!==f&&(f&&!e?c():e&&!f&&!a.current&&p(),t(f))},[i,e,c,p]),ze(()=>()=>{clearTimeout(n.current),clearTimeout(a.current),cancelAnimationFrame(u.current)},[]),e?po(e,{className:(0,Kd.default)(r,e.props.className)}):null}o(vb,"Slide");var _s=vb;var gt={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};var hl=ae(Ge(),1);var ul=ae(Zi(),1);var cl=ae(Ge(),1);var bb="\xB7",Xd=o(()=>` ${bb} `,"renderDot");function Yd(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:a,startUpload:u}=i,c=(0,cl.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":n===gt.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":a}),p=e&&t&&!r?s("uploadXNewFiles",{smart_count:e}):s("uploadXFiles",{smart_count:e});return l("button",{type:"button",className:c,"aria-label":s("uploadXFiles",{smart_count:e}),onClick:u,disabled:a,"data-uppy-super-focusable":!0,children:p})}o(Yd,"UploadBtn");function Jd(i){let{i18n:e,uppy:t}=i;return l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e("retryUpload"),onClick:o(()=>t.retryAll().catch(()=>{}),"onClick"),"data-uppy-super-focusable":!0,"data-cy":"retry",children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10",children:l("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})}),e("retry")]})}o(Jd,"RetryBtn");function Qd(i){let{i18n:e,uppy:t}=i;return l("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e("cancel"),"aria-label":e("cancel"),onClick:o(()=>t.cancelAll(),"onClick"),"data-cy":"cancel","data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:l("g",{fill:"none",fillRule:"evenodd",children:[l("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),l("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"})]})})})}o(Qd,"CancelBtn");function Zd(i){let{isAllPaused:e,i18n:t,isAllComplete:r,resumableUploads:s,uppy:n}=i,a=t(e?"resume":"pause");function u(){if(!r){if(!s){n.cancelAll();return}if(e){n.resumeAll();return}n.pauseAll()}}return o(u,"togglePauseResume"),l("button",{title:a,"aria-label":a,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:u,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:l("g",{fill:"none",fillRule:"evenodd",children:[l("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),l("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"})]})})})}o(Zd,"PauseResumeButton");function eh(i){let{i18n:e,doneButtonHandler:t}=i;return l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:t,"data-uppy-super-focusable":!0,children:e("done")})}o(eh,"DoneBtn");function th(){return l("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14",children:l("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"})})}o(th,"LoadingSpinner");function ih(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return l("div",{className:"uppy-StatusBar-content",children:[l(th,{}),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s]})}o(ih,"ProgressBarProcessing");function wb(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:a}=i,u=e>1,c=(0,ul.default)(r);return l("div",{className:"uppy-StatusBar-statusSecondary",children:[u&&a("filesUploadedOfTotal",{complete:t,smart_count:e}),l("span",{className:"uppy-StatusBar-additionalInfo",children:[u&&Xd(),s!=null?a("dataUploadedOfTotal",{complete:c,total:(0,ul.default)(s)}):a("dataUploadedOfUnknown",{complete:c}),Xd(),n!=null&&a("xTimeLeft",{time:Xi(n)})]})]})}o(wb,"ProgressDetails");function rh(i){let{i18n:e,complete:t,numUploads:r}=i;return l("div",{className:"uppy-StatusBar-statusSecondary",children:e("filesUploadedOfTotal",{complete:t,smart_count:r})})}o(rh,"FileUploadCount");function Sb(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,cl.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return l("div",{className:"uppy-StatusBar-statusSecondary",children:[l("div",{className:"uppy-StatusBar-statusSecondaryHint",children:e("xMoreFilesAdded",{smart_count:t})}),l("button",{type:"button",className:s,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:r,children:e("upload")})]})}o(Sb,"UploadNewlyAddedFiles");function sh(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,hideProgressDetails:s,isUploadStarted:n,isAllComplete:a,isAllPaused:u,newFiles:c,numUploads:p,complete:f,totalUploadedSize:d,totalSize:v,totalETA:_,startUpload:k}=i,A=c&&n;if(!n||a)return null;let F=e(u?"paused":"uploading");function R(){return!u&&!A&&!s?t?l(wb,{numUploads:p,complete:f,totalUploadedSize:d,totalSize:v,totalETA:_,i18n:e}):l(rh,{i18n:e,complete:f,numUploads:p}):null}return o(R,"renderProgressDetails"),l("div",{className:"uppy-StatusBar-content",title:F,children:[u?null:l(th,{}),l("div",{className:"uppy-StatusBar-status",children:[l("div",{className:"uppy-StatusBar-statusPrimary",children:t&&r!==0?`${F}: ${r}%`:F}),R(),A?l(Sb,{i18n:e,newFiles:c,startUpload:k}):null]})]})}o(sh,"ProgressBarUploading");function oh(i){let{i18n:e}=i;return l("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete"),children:l("div",{className:"uppy-StatusBar-status",children:l("div",{className:"uppy-StatusBar-statusPrimary",children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11",children:l("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})}),e("complete")]})})})}o(oh,"ProgressBarComplete");function nh(i){let{error:e,i18n:t,complete:r,numUploads:s}=i;function n(){let a=`${t("uploadFailed")}
${e}`;alert(a)}return o(n,"displayErrorAlert"),l("div",{className:"uppy-StatusBar-content",title:t("uploadFailed"),children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11",children:l("path",{d:"M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z"})}),l("div",{className:"uppy-StatusBar-status",children:[l("div",{className:"uppy-StatusBar-statusPrimary",children:[t("uploadFailed"),l("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":t("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:n,type:"button",children:"?"})]}),l(rh,{i18n:t,complete:r,numUploads:s})]})]})}o(nh,"ProgressBarError");function ks(i){let e=[],t="indeterminate",r;for(let{progress:n}of Object.values(i)){let{preprocess:a,postprocess:u}=n;r==null&&(a||u)&&({mode:t,message:r}=a||u),a?.mode==="determinate"&&e.push(a.value),u?.mode==="determinate"&&e.push(u.value)}let s=e.reduce((n,a)=>n+a/e.length,0);return{mode:t,message:r,value:s}}o(ks,"calculateProcessingProgress");var{STATE_ERROR:ah,STATE_WAITING:xb,STATE_PREPROCESSING:pl,STATE_UPLOADING:Yo,STATE_POSTPROCESSING:dl,STATE_COMPLETE:Jo}=gt;function fl({newFiles:i,allowNewUpload:e,isUploadInProgress:t,isAllPaused:r,resumableUploads:s,error:n,hideUploadButton:a=void 0,hidePauseResumeButton:u=!1,hideCancelButton:c=!1,hideRetryButton:p=!1,recoveredState:f,uploadState:d,totalProgress:v,files:_,supportsUploadProgress:k,hideAfterFinish:A=!1,isSomeGhost:F,doneButtonHandler:R=void 0,isUploadStarted:U,i18n:C,startUpload:Y,uppy:$,isAllComplete:H,hideProgressDetails:Q=void 0,numUploads:K,complete:Z,totalSize:ye,totalETA:se,totalUploadedSize:we}){function me(){switch(d){case dl:case pl:{let ne=ks(_);return ne.mode==="determinate"?ne.value*100:v}case ah:return null;case Yo:return k?v:null;default:return v}}o(me,"getProgressValue");function _e(){switch(d){case dl:case pl:{let{mode:ne}=ks(_);return ne==="indeterminate"}case Yo:return!k;default:return!1}}o(_e,"getIsIndeterminate");let ve=me(),E=ve??100,w=!n&&i&&(!t&&!r||f)&&e&&!a,S=!c&&d!==xb&&d!==Jo,B=s&&!u&&d===Yo,q=n&&!H&&!p,j=R&&d===Jo,I=(0,hl.default)("uppy-StatusBar-progress",{"is-indeterminate":_e()}),T=(0,hl.default)("uppy-StatusBar",`is-${d}`,{"has-ghosts":F}),O=(()=>{switch(d){case pl:case dl:return l(ih,{progress:ks(_)});case Jo:return l(oh,{i18n:C});case ah:return l(nh,{error:n,i18n:C,numUploads:K,complete:Z});case Yo:return l(sh,{i18n:C,supportsUploadProgress:k,totalProgress:v,hideProgressDetails:Q,isUploadStarted:U,isAllComplete:H,isAllPaused:r,newFiles:i,numUploads:K,complete:Z,totalUploadedSize:we,totalSize:ye,totalETA:se,startUpload:Y});default:return null}})();return!(w||q||B||S||j)&&!O||d===Jo&&A?null:l("div",{className:T,children:[l("div",{className:I,style:{width:`${E}%`},role:"progressbar","aria-label":`${E}%`,"aria-valuetext":`${E}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":ve}),O,l("div",{className:"uppy-StatusBar-actions",children:[w?l(Yd,{newFiles:i,isUploadStarted:U,recoveredState:f,i18n:C,isSomeGhost:F,startUpload:Y,uploadState:d}):null,q?l(Jd,{i18n:C,uppy:$}):null,B?l(Zd,{isAllPaused:r,i18n:C,isAllComplete:H,resumableUploads:s,uppy:$}):null,S?l(Qd,{i18n:C,uppy:$}):null,j?l(eh,{i18n:C,doneButtonHandler:R}):null]})]})}o(fl,"StatusBarUI");var Pb=2e3,_b=2e3;function kb(i,e,t,r){if(i)return gt.STATE_ERROR;if(e)return gt.STATE_COMPLETE;if(t)return gt.STATE_WAITING;let s=gt.STATE_WAITING,n=Object.keys(r);for(let a=0;a<n.length;a++){let{progress:u}=r[n[a]];if(u.uploadStarted&&!u.uploadComplete)return gt.STATE_UPLOADING;u.preprocess&&(s=gt.STATE_PREPROCESSING),u.postprocess&&s!==gt.STATE_PREPROCESSING&&(s=gt.STATE_POSTPROCESSING)}return s}o(kb,"getUploadingState");var Es=class extends Se{static{o(this,"StatusBar")}#e;#t;#r;#i;componentDidMount(){this.#e=performance.now(),this.#t=this.props.uppy.getFiles().reduce((e,t)=>e+(t.progress.bytesUploaded||0),0),this.props.uppy.on("upload",this.#s)}componentWillUnmount(){this.props.uppy.off("upload",this.#s)}#s=o(()=>{let{recoveredState:e}=this.props.uppy.getState();if(this.#r=null,this.#i=null,e){this.#t=Object.values(e.files).reduce((t,{progress:r})=>t+(r.bytesUploaded||0),0);return}this.#e=performance.now(),this.#t=0},"#onUploadStart");#l(e){if(e.total==null||e.total===0)return null;let t=e.total-e.uploaded;if(t<=0)return null;this.#e??=performance.now();let r=performance.now()-this.#e;if(r===0)return Math.round((this.#i??0)/100)/10;if(this.#t==null)return this.#t=e.uploaded,null;let s=e.uploaded-this.#t;if(this.#t=e.uploaded,s<=0)return Math.round((this.#i??0)/100)/10;let n=s/r;if(!Number.isFinite(n)||n<=0)return null;let a=this.#r==null?n:Jt(n,this.#r,Pb,r);if(!Number.isFinite(a)||a<=0)return null;this.#r=a;let u=t/a;if(!Number.isFinite(u)||u<0)return null;let c=Math.max((this.#i??0)-r,0),p=this.#i==null?u:Jt(u,c,_b,r);return!Number.isFinite(p)||p<0?null:(this.#i=p,this.#e=performance.now(),Math.round(p/100)/10)}startUpload=o(()=>{let{recoveredState:e}=this.props.uppy.getState();e?this.props.uppy.emit("restore-confirmed"):this.props.uppy.upload().catch((()=>{}))},"startUpload");render(){let{capabilities:e,files:t,allowNewUpload:r,totalProgress:s,error:n,recoveredState:a}=this.props.uppy.getState(),{newFiles:u,startedFiles:c,completeFiles:p,isUploadStarted:f,isAllComplete:d,isAllPaused:v,isUploadInProgress:_,isSomeGhost:k}=this.props.uppy.getObjectOfFilesPerState(),A=a?Object.values(t):u,F=!!e.resumableUploads,R=e.uploadProgress!==!1,U=null,C=0;c.every($=>$.progress.bytesTotal!=null&&$.progress.bytesTotal!==0)?(U=0,c.forEach($=>{U+=$.progress.bytesTotal||0,C+=$.progress.bytesUploaded||0})):c.forEach($=>{C+=$.progress.bytesUploaded||0});let Y=this.#l({uploaded:C,total:U});return l(fl,{error:n,uploadState:kb(n,d,a,t||{}),allowNewUpload:r,totalProgress:s,totalSize:U,totalUploadedSize:C,isAllComplete:d,isAllPaused:v,isUploadStarted:f,isUploadInProgress:_,isSomeGhost:k,recoveredState:a,complete:p.length,newFiles:A.length,numUploads:c.length,totalETA:Y,files:t,i18n:this.props.i18n,uppy:this.props.uppy,startUpload:this.startUpload,doneButtonHandler:this.props.doneButtonHandler,resumableUploads:F,supportsUploadProgress:R,hideProgressDetails:this.props.hideProgressDetails,hideUploadButton:this.props.hideUploadButton,hideRetryButton:this.props.hideRetryButton,hidePauseResumeButton:this.props.hidePauseResumeButton,hideCancelButton:this.props.hideCancelButton,hideAfterFinish:this.props.hideAfterFinish})}};var lh=900,uh=700,ml=576,ch=330;function gl(i){let e=i.totalFileCount===0,t=i.totalFileCount===1,r=i.containerWidth>ml,s=i.containerHeight>ch,n=(0,ph.default)({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":i.disabled,"uppy-Dashboard--animateOpenClose":i.animateOpenClose,"uppy-Dashboard--isClosing":i.isClosing,"uppy-Dashboard--isDraggingOver":i.isDraggingOver,"uppy-Dashboard--modal":!i.inline,"uppy-size--md":i.containerWidth>ml,"uppy-size--lg":i.containerWidth>uh,"uppy-size--xl":i.containerWidth>lh,"uppy-size--height-md":i.containerHeight>ch,"uppy-Dashboard--isAddFilesPanelVisible":i.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":i.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":i.singleFileFullScreen&&t&&s}),a=1;i.containerWidth>lh?a=5:i.containerWidth>uh?a=4:i.containerWidth>ml&&(a=3);let u=i.showSelectedFiles&&!e,c=i.recoveredState?Object.keys(i.recoveredState.files).length:null,p=i.files?Object.keys(i.files).filter(v=>i.files[v].isGhost).length:0,f=o(()=>p>0?i.i18n("recoveredXFiles",{smart_count:p}):i.i18n("recoveredAllFiles"),"renderRestoredText");return l("div",{className:n,"data-uppy-theme":i.theme,"data-uppy-num-acquirers":i.acquirers.length,"data-uppy-drag-drop-supported":!i.disableLocalFiles&&Ki(),"aria-hidden":i.inline?"false":i.isHidden,"aria-disabled":i.disabled,"aria-label":i.inline?i.i18n("dashboardTitle"):i.i18n("dashboardWindowTitle"),onPaste:i.handlePaste,onDragOver:i.handleDragOver,onDragLeave:i.handleDragLeave,onDrop:i.handleDrop,children:[l("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:i.handleClickOutside}),l("div",{className:"uppy-Dashboard-inner",role:i.inline?void 0:"dialog",style:{width:i.inline&&i.width?i.width:"",height:i.inline&&i.height?i.height:""},children:[i.inline?null:l("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":i.i18n("closeModal"),title:i.i18n("closeModal"),onClick:i.closeModal,children:l("span",{"aria-hidden":"true",children:"\xD7"})}),l("div",{className:"uppy-Dashboard-innerWrap",children:[l("div",{className:"uppy-Dashboard-dropFilesHereHint",children:i.i18n("dropHint")}),u&&l(Wd,{...i}),c!=null&&c>0&&l("div",{className:"uppy-Dashboard-serviceMsg",children:[l("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19",children:l("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd",children:[l("path",{d:"M12.857 1.43l10.234 17.056A1 1 0 0122.234 20H1.766a1 1 0 01-.857-1.514L11.143 1.429a1 1 0 011.714 0z",fill:"#FFD300"}),l("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),l("circle",{fill:"#000",cx:"12",cy:"17",r:"1"})]})}),l("strong",{className:"uppy-Dashboard-serviceMsg-title",children:i.i18n("sessionRestored")}),l("div",{className:"uppy-Dashboard-serviceMsg-text",children:f()})]}),u?l(ll,{id:i.id,i18n:i.i18n,uppy:i.uppy,files:i.files,resumableUploads:i.resumableUploads,hideRetryButton:i.hideRetryButton,hidePauseResumeButton:i.hidePauseResumeButton,hideCancelButton:i.hideCancelButton,showLinkToFileUploadResult:i.showLinkToFileUploadResult,showRemoveButtonAfterComplete:i.showRemoveButtonAfterComplete,metaFields:i.metaFields,toggleFileCard:i.toggleFileCard,handleRequestThumbnail:i.handleRequestThumbnail,handleCancelThumbnail:i.handleCancelThumbnail,recoveredState:i.recoveredState,individualCancellation:i.individualCancellation,openFileEditor:i.openFileEditor,canEditFile:i.canEditFile,toggleAddFilesPanel:i.toggleAddFilesPanel,isSingleFile:t,itemsPerRow:a,containerWidth:i.containerWidth,containerHeight:i.containerHeight}):l(Go,{i18n:i.i18n,i18nArray:i.i18nArray,acquirers:i.acquirers,handleInputChange:i.handleInputChange,maxNumberOfFiles:i.maxNumberOfFiles,allowedFileTypes:i.allowedFileTypes,showNativePhotoCameraButton:i.showNativePhotoCameraButton,showNativeVideoCameraButton:i.showNativeVideoCameraButton,nativeCameraFacingMode:i.nativeCameraFacingMode,showPanel:i.showPanel,activePickerPanel:i.activePickerPanel,disableLocalFiles:i.disableLocalFiles,fileManagerSelectionType:i.fileManagerSelectionType,note:i.note,proudlyDisplayPoweredByUppy:i.proudlyDisplayPoweredByUppy}),l(_s,{children:i.showAddFilesPanel?l(Dd,{...i,isSizeMD:r},"AddFiles"):null}),l(_s,{children:i.fileCardFor?l(el,{...i},"FileCard"):null}),l(_s,{children:i.activePickerPanel?l($d,{...i},"Picker"):null}),l(_s,{children:i.showFileEditor?l(Nd,{...i},"Editor"):null}),l("div",{className:"uppy-Dashboard-progressindicators",children:[!i.disableInformer&&l(fr,{uppy:i.uppy}),!i.disableStatusBar&&l(Es,{uppy:i.uppy,i18n:i.i18n,hideProgressDetails:i.hideProgressDetails,hideUploadButton:i.hideUploadButton,hideRetryButton:i.hideRetryButton,hidePauseResumeButton:i.hidePauseResumeButton,hideCancelButton:i.hideCancelButton,hideAfterFinish:i.hideProgressAfterFinish,doneButtonHandler:i.doneButtonHandler}),!i.disableInformer&&l(fr,{uppy:i.uppy}),i.progressindicators.map(v=>i.uppy.getPlugin(v.id).render(i.state))]})]})]})]})}o(gl,"Dashboard");var dh={strings:{closeModal:"Close Modal",addMoreFiles:"Add more files",addingMoreFiles:"Adding more files",importFrom:"Import from %{name}",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard.",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",back:"Back",removeFile:"Remove file",editFile:"Edit file",editImage:"Edit image",editing:"Editing %{file}",error:"Error",finishEditingFile:"Finish editing file",saveChanges:"Save changes",myDevice:"My Device",dropHint:"Drop your files here",uploadComplete:"Upload complete",uploadPaused:"Upload paused",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},poweredBy:"Powered by %{uppy}",addMore:"Add more",editFileWithFilename:"Edit file %{file}",save:"Save",cancel:"Cancel",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",importFiles:"Import files from:",browseFiles:"browse files",browseFolders:"browse folders",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},recoveredAllFiles:"We restored all files. You can now resume the upload.",sessionRestored:"Session restored",reSelect:"Re-select",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},takePictureBtn:"Take Picture",recordVideoBtn:"Record Video",uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",paused:"Paused",retry:"Retry",pause:"Pause",resume:"Resume",done:"Done",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",dataUploadedOfUnknown:"%{complete} of unknown",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},upload:"Upload",xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},showErrorDetails:"Show error details"}};var hh=ae(yo(),1);function Fs(i,e){if(e){let t=i.querySelector(`[data-uppy-paneltype="${e}"]`);if(t)return t}return i}o(Fs,"getActiveOverlayEl");function yl(){let i=!1;return(0,hh.default)(o((t,r)=>{let s=Fs(t,r),n=s.contains(document.activeElement);if(n&&i)return;let a=s.querySelector("[data-uppy-super-focusable]");n&&!a||(a?(a.focus({preventScroll:!0}),i=!0):(s.querySelector(Or)?.focus({preventScroll:!0}),i=!1))},"superFocus"),260)}o(yl,"createSuperFocus");function fh(i,e){let t=e[0];t&&(t.focus(),i.preventDefault())}o(fh,"focusOnFirstNode");function Eb(i,e){let t=e[e.length-1];t&&(t.focus(),i.preventDefault())}o(Eb,"focusOnLastNode");function Fb(i){return i.contains(document.activeElement)}o(Fb,"isFocusInOverlay");function vl(i,e,t){let r=Fs(t,e),s=je(r.querySelectorAll(Or)),n=s.indexOf(document.activeElement);Fb(r)?i.shiftKey&&n===0?Eb(i,s):!i.shiftKey&&n===s.length-1&&fh(i,s):fh(i,s)}o(vl,"trapFocus");function mh(i,e,t){e===null||vl(i,e,t)}o(mh,"forInline");var gh=9,Cb=27;function yh(){let i={};return i.promise=new Promise((e,t)=>{i.resolve=e,i.reject=t}),i}o(yh,"createPromise");var Ab={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:nr,showLinkToFileUploadResult:!1,hideProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,singleFileFullScreen:!0,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,showNativePhotoCameraButton:!1,showNativeVideoCameraButton:!1,theme:"light",autoOpen:null,disabled:!1,disableLocalFiles:!1,nativeCameraFacingMode:"",onDragLeave:o(()=>{},"onDragLeave"),onDragOver:o(()=>{},"onDragOver"),onDrop:o(()=>{},"onDrop"),plugins:[],doneButtonHandler:void 0,onRequestCloseModal:null,inline:!1,animateOpenClose:!0,browserBackButtonClose:!1,closeAfterFinish:!1,closeModalOnClickOutside:!1,disablePageScrollWhenModalOpen:!0,trigger:null,width:750,height:550},Ts=class extends re{static{o(this,"Dashboard")}static VERSION=Ud.version;#e;modalName=`uppy-Dashboard-${Dt()}`;superFocus=yl();ifFocusedOnUppyRecently=!1;dashboardIsDisabled;savedScrollPosition;savedActiveElement;resizeObserver;darkModeMediaQuery;makeDashboardInsidesVisibleAnywayTimeout;constructor(e,t){let r=t?.autoOpen??null;super(e,{...Ab,...t,autoOpen:r}),this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=dh,this.opts.doneButtonHandler===void 0&&(this.opts.doneButtonHandler=()=>{this.uppy.clear(),this.requestCloseModal()}),this.opts.onRequestCloseModal??=()=>this.closeModal(),this.i18nInit()}removeTarget=o(e=>{let r=this.getPluginState().targets.filter(s=>s.id!==e.id);this.setPluginState({targets:r})},"removeTarget");addTarget=o(e=>{let t=e.id||e.constructor.name,r=e.title||t,s=e.type;if(s!=="acquirer"&&s!=="progressindicator"&&s!=="editor")return this.uppy.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;let n={id:t,name:r,type:s},u=this.getPluginState().targets.slice();return u.push(n),this.setPluginState({targets:u}),this.el},"addTarget");hideAllPanels=o(()=>{let e=this.getPluginState(),t={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};e.activePickerPanel===t.activePickerPanel&&e.showAddFilesPanel===t.showAddFilesPanel&&e.showFileEditor===t.showFileEditor&&e.activeOverlayType===t.activeOverlayType||(this.setPluginState(t),this.uppy.emit("dashboard:close-panel",e.activePickerPanel?.id))},"hideAllPanels");showPanel=o(e=>{let{targets:t}=this.getPluginState(),r=t.find(s=>s.type==="acquirer"&&s.id===e);this.setPluginState({activePickerPanel:r,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",e)},"showPanel");canEditFile=o(e=>{let{targets:t}=this.getPluginState();return this.#n(t).some(s=>this.uppy.getPlugin(s.id).canEditFile(e))},"canEditFile");openFileEditor=o(e=>{let{targets:t}=this.getPluginState(),r=this.#n(t);this.setPluginState({showFileEditor:!0,fileCardFor:e.id||null,activeOverlayType:"FileEditor"}),r.forEach(s=>{this.uppy.getPlugin(s.id).selectFile(e)})},"openFileEditor");closeFileEditor=o(()=>{let{metaFields:e}=this.getPluginState();e&&e.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})},"closeFileEditor");saveFileEditor=o(()=>{let{targets:e}=this.getPluginState();this.#n(e).forEach(r=>{this.uppy.getPlugin(r.id).save()}),this.closeFileEditor()},"saveFileEditor");openModal=o(()=>{let{promise:e,resolve:t}=yh();if(this.savedScrollPosition=window.pageYOffset,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing){let r=o(()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",r,!1),t()},"handler");this.el.addEventListener("animationend",r,!1)}else this.setPluginState({isHidden:!1}),t();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),e},"openModal");closeModal=o(e=>{let t=e?.manualClose??!0,{isHidden:r,isClosing:s}=this.getPluginState();if(r||s)return;let{promise:n,resolve:a}=yh();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});let u=o(()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",u,!1),a()},"handler");this.el.addEventListener("animationend",u,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),a();return document.removeEventListener("keydown",this.handleKeyDownInModal),t&&this.opts.browserBackButtonClose&&history.state?.[this.modalName]&&history.back(),this.uppy.emit("dashboard:modal-closed"),n},"closeModal");isModalOpen=o(()=>!this.getPluginState().isHidden||!1,"isModalOpen");requestCloseModal=o(()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal(),"requestCloseModal");setDarkModeCapability=o(e=>{let{capabilities:t}=this.uppy.getState();this.uppy.setState({capabilities:{...t,darkMode:e}})},"setDarkModeCapability");handleSystemDarkModeChange=o(e=>{let t=e.matches;this.uppy.log(`[Dashboard] Dark mode is ${t?"on":"off"}`),this.setDarkModeCapability(t)},"handleSystemDarkModeChange");toggleFileCard=o((e,t)=>{let r=this.uppy.getFile(t);e?this.uppy.emit("dashboard:file-edit-start",r):this.uppy.emit("dashboard:file-edit-complete",r),this.setPluginState({fileCardFor:e?t:null,activeOverlayType:e?"FileCard":null})},"toggleFileCard");toggleAddFilesPanel=o(e=>{this.setPluginState({showAddFilesPanel:e,activeOverlayType:e?"AddFiles":null})},"toggleAddFilesPanel");addFiles=o(e=>{let t=e.map(r=>({source:this.id,name:r.name,type:r.type,data:r,meta:{relativePath:r.relativePath||r.webkitRelativePath||null}}));try{this.uppy.addFiles(t)}catch(r){this.uppy.log(r)}},"addFiles");startListeningToResize=o(()=>{this.resizeObserver=new ResizeObserver(e=>{let t=e[0],{width:r,height:s}=t.contentRect;this.setPluginState({containerWidth:r,containerHeight:s,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{let e=this.getPluginState(),t=!this.opts.inline&&e.isHidden;!e.areInsidesReadyToBeVisible&&!t&&(this.uppy.log("[Dashboard] resize event didn\u2019t fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)},"startListeningToResize");stopListeningToResize=o(()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)},"stopListeningToResize");recordIfFocusedOnUppyRecently=o(e=>{this.el.contains(e.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())},"recordIfFocusedOnUppyRecently");disableInteractiveElements=o(e=>{let t=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],r=this.#e??je(this.el.querySelectorAll(t)).filter(s=>!s.classList.contains("uppy-Dashboard-close"));for(let s of r)s.tagName==="A"?s.setAttribute("aria-disabled",e):s.disabled=e;e?this.#e=r:this.#e=null,this.dashboardIsDisabled=e},"disableInteractiveElements");updateBrowserHistory=o(()=>{history.state?.[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)},"updateBrowserHistory");handlePopState=o(e=>{this.isModalOpen()&&(!e.state||!e.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&e.state?.[this.modalName]&&history.back()},"handlePopState");handleKeyDownInModal=o(e=>{e.keyCode===Cb&&this.requestCloseModal(),e.keyCode===gh&&vl(e,this.getPluginState().activeOverlayType,this.el)},"handleKeyDownInModal");handleClickOutside=o(()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()},"handleClickOutside");handlePaste=o(e=>{this.uppy.iteratePlugins(r=>{r.type==="acquirer"&&r.handleRootPaste?.(e)});let t=je(e.clipboardData.files);t.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(t))},"handlePaste");handleInputChange=o(e=>{e.preventDefault();let t=je(e.currentTarget.files||[]);t.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(t))},"handleInputChange");handleDragOver=o(e=>{e.preventDefault(),e.stopPropagation();let t=o(()=>{let a=!0;return this.uppy.iteratePlugins(u=>{u.canHandleRootDrop?.(e)&&(a=!0)}),a},"canSomePluginHandleRootDrop"),r=o(()=>{let{types:a}=e.dataTransfer;return a.some(u=>u==="Files")},"doesEventHaveFiles"),s=t(),n=r();if(!s&&!n||this.opts.disabled||this.opts.disableLocalFiles&&(n||!s)||!this.uppy.getState().allowNewUpload){e.dataTransfer.dropEffect="none";return}e.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver(e)},"handleDragOver");handleDragLeave=o(e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave(e)},"handleDragLeave");handleDrop=o(async e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(n=>{n.type==="acquirer"&&n.handleRootDrop?.(e)});let t=!1,r=o(n=>{this.uppy.log(n,"error"),t||(this.uppy.info(n.message,"error"),t=!0)},"logDropError");this.uppy.log("[Dashboard] Processing dropped files");let s=await Zt(e.dataTransfer,{logDropError:r});s.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(s)),this.opts.onDrop(e)},"handleDrop");handleRequestThumbnail=o(e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",e)},"handleRequestThumbnail");handleCancelThumbnail=o(e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",e)},"handleCancelThumbnail");handleKeyDownInInline=o(e=>{e.keyCode===gh&&mh(e,this.getPluginState().activeOverlayType,this.el)},"handleKeyDownInInline");handlePasteOnBody=o(e=>{this.el.contains(document.activeElement)&&this.handlePaste(e)},"handlePasteOnBody");handleComplete=o(({failed:e})=>{this.opts.closeAfterFinish&&!e?.length&&this.requestCloseModal()},"handleComplete");#t=o(()=>{if(this.opts.disableThumbnailGenerator)return;let e=600,t=this.uppy.getFiles();if(t.length===1){let r=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);r?.setOptions({thumbnailWidth:e});let s={...t[0],preview:void 0};r?.requestThumbnail(s).then(()=>{r?.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}},"#generateLargeThumbnailIfSingleFile");#r=o(e=>{let t=e[0],{metaFields:r}=this.getPluginState(),s=r&&r.length>0,n=this.canEditFile(t);s&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,t.id):n&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(t)},"#openFileEditorWhenFilesAdded");initEvents=o(()=>{if(this.opts.trigger&&!this.opts.inline){let e=no(this.opts.trigger);e?e.forEach(t=>t.addEventListener("click",this.openModal)):this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openModal()` method yourself","warning")}this.startListeningToResize(),document.addEventListener("paste",this.handlePasteOnBody),this.uppy.on("plugin-added",this.#u),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",this.hideAllPanels),this.uppy.on("dashboard:modal-closed",this.hideAllPanels),this.uppy.on("complete",this.handleComplete),this.uppy.on("files-added",this.#t),this.uppy.on("file-removed",this.#t),document.addEventListener("focus",this.recordIfFocusedOnUppyRecently,!0),document.addEventListener("click",this.recordIfFocusedOnUppyRecently,!0),this.opts.inline&&this.el.addEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.on("files-added",this.#r)},"initEvents");removeEvents=o(()=>{let e=no(this.opts.trigger);!this.opts.inline&&e&&e.forEach(t=>t.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",this.#u),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",this.hideAllPanels),this.uppy.off("dashboard:modal-closed",this.hideAllPanels),this.uppy.off("complete",this.handleComplete),this.uppy.off("files-added",this.#t),this.uppy.off("file-removed",this.#t),document.removeEventListener("focus",this.recordIfFocusedOnUppyRecently),document.removeEventListener("click",this.recordIfFocusedOnUppyRecently),this.opts.inline&&this.el.removeEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.off("files-added",this.#r)},"removeEvents");superFocusOnEachUpdate=o(()=>{let e=this.el.contains(document.activeElement),t=document.activeElement===document.body||document.activeElement===null,r=this.uppy.getState().info.length===0,s=!this.opts.inline;r&&(s||e||t&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()},"superFocusOnEachUpdate");afterUpdate=o(()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()},"afterUpdate");saveFileCard=o((e,t)=>{this.uppy.setFileMeta(t,e),this.toggleFileCard(!1,t)},"saveFileCard");#i=o(e=>{let t=this.uppy.getPlugin(e.id);return{...e,icon:t.icon||this.opts.defaultPickerIcon,render:t.render}},"#attachRenderFunctionToTarget");#s=o(e=>{let t=this.uppy.getPlugin(e.id);return typeof t.isSupported!="function"?!0:t.isSupported()},"#isTargetSupported");#l=o(e=>e.filter(t=>t.type==="acquirer"&&this.#s(t)).map(this.#i),"#getAcquirers");#o=o(e=>e.filter(t=>t.type==="progressindicator").map(this.#i),"#getProgressIndicators");#n=o(e=>e.filter(t=>t.type==="editor").map(this.#i),"#getEditors");render=o(e=>{let t=this.getPluginState(),{files:r,capabilities:s,allowNewUpload:n}=e,{newFiles:a,uploadStartedFiles:u,completeFiles:c,erroredFiles:p,inProgressFiles:f,inProgressNotPausedFiles:d,processingFiles:v,isUploadStarted:_,isAllComplete:k,isAllPaused:A}=this.uppy.getObjectOfFilesPerState(),F=this.#l(t.targets),R=this.#o(t.targets),U=this.#n(t.targets),C;return this.opts.theme==="auto"?C=s.darkMode?"dark":"light":C=this.opts.theme,["files","folders","both"].indexOf(this.opts.fileManagerSelectionType)<0&&(this.opts.fileManagerSelectionType="files",console.warn(`Unsupported option for "fileManagerSelectionType". Using default of "${this.opts.fileManagerSelectionType}".`)),gl({state:e,isHidden:t.isHidden,files:r,newFiles:a,uploadStartedFiles:u,completeFiles:c,erroredFiles:p,inProgressFiles:f,inProgressNotPausedFiles:d,processingFiles:v,isUploadStarted:_,isAllComplete:k,isAllPaused:A,totalFileCount:Object.keys(r).length,totalProgress:e.totalProgress,allowNewUpload:n,acquirers:F,theme:C,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:t.activePickerPanel,showFileEditor:t.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:t.isClosing,progressindicators:R,editors:U,autoProceed:this.uppy.opts.autoProceed,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,i18n:this.i18n,i18nArray:this.i18nArray,uppy:this.uppy,note:this.opts.note,recoveredState:e.recoveredState,metaFields:t.metaFields,resumableUploads:s.resumableUploads||!1,individualCancellation:s.individualCancellation,isMobileDevice:s.isMobileDevice,fileCardFor:t.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:t.showAddFilesPanel,saveFileCard:this.saveFileCard,openFileEditor:this.openFileEditor,canEditFile:this.canEditFile,width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,fileManagerSelectionType:this.opts.fileManagerSelectionType,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,showRemoveButtonAfterComplete:this.opts.showRemoveButtonAfterComplete,containerWidth:t.containerWidth,containerHeight:t.containerHeight,areInsidesReadyToBeVisible:t.areInsidesReadyToBeVisible,parentElement:this.el,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,requiredMetaFields:this.uppy.opts.restrictions.requiredMetaFields,showSelectedFiles:this.opts.showSelectedFiles,showNativePhotoCameraButton:this.opts.showNativePhotoCameraButton,showNativeVideoCameraButton:this.opts.showNativeVideoCameraButton,nativeCameraFacingMode:this.opts.nativeCameraFacingMode,singleFileFullScreen:this.opts.singleFileFullScreen,handleRequestThumbnail:this.handleRequestThumbnail,handleCancelThumbnail:this.handleCancelThumbnail,isDraggingOver:t.isDraggingOver,handleDragOver:this.handleDragOver,handleDragLeave:this.handleDragLeave,handleDrop:this.handleDrop,disableInformer:this.opts.disableInformer,disableStatusBar:this.opts.disableStatusBar,hideProgressDetails:this.opts.hideProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,hideProgressAfterFinish:this.opts.hideProgressAfterFinish,doneButtonHandler:this.opts.doneButtonHandler})},"render");#a=o(()=>{let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r?r.mount(this,r):this.uppy.log(`[Uppy] Dashboard could not find plugin '${t}', make sure to uppy.use() the plugins you are specifying`,"warning")})},"#addSpecifiedPluginsFromOptions");#c=o(()=>{this.uppy.iteratePlugins(this.#u)},"#autoDiscoverPlugins");#u=o(e=>{let t=["acquirer","editor"];e&&!e.opts?.target&&t.includes(e.type)&&(this.getPluginState().targets.some(s=>e.id===s.id)||e.mount(this,e))},"#addSupportedPluginIfNoTarget");#d(){let{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s}=this.opts;return{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s,lazy:!s}}setOptions(e){super.setOptions(e),this.uppy.getPlugin(this.#p())?.setOptions(this.#d())}#p(){return`${this.id}:ThumbnailGenerator`}install=o(()=>{this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});let{inline:e,closeAfterFinish:t}=this.opts;if(e&&t)throw new Error("[Dashboard] `closeAfterFinish: true` cannot be used on an inline Dashboard, because an inline Dashboard cannot be closed at all. Either set `inline: false`, or disable the `closeAfterFinish` option.");let{allowMultipleUploads:r,allowMultipleUploadBatches:s}=this.uppy.opts;(r||s)&&t&&this.uppy.log("[Dashboard] When using `closeAfterFinish`, we recommended setting the `allowMultipleUploadBatches` option to `false` in the Uppy constructor. See https://uppy.io/docs/uppy/#allowMultipleUploads-true","warning");let{target:n}=this.opts;n&&this.mount(n,this),this.opts.disableThumbnailGenerator||this.uppy.use(hr,{id:this.#p(),...this.#d()}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;let a=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;this.uppy.log(`[Dashboard] Dark mode is ${a?"on":"off"}`),this.setDarkModeCapability(a),this.opts.theme==="auto"&&this.darkModeMediaQuery?.addListener(this.handleSystemDarkModeChange),this.#a(),this.#c(),this.initEvents()},"install");uninstall=o(()=>{if(!this.opts.disableThumbnailGenerator){let t=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);t&&this.uppy.removePlugin(t)}let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r&&r.unmount()}),this.opts.theme==="auto"&&this.darkModeMediaQuery?.removeListener(this.handleSystemDarkModeChange),this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()},"uninstall")};var vh={name:"@uppy/drag-drop",description:"Droppable zone UI for Uppy. Drag and drop files into it to upload.",version:"5.1.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","drag-drop","drag","drop","dropzone","upload"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var bh={strings:{dropHereOr:"Drop here or %{browse}",browse:"browse"}};var Ub={inputName:"files[]",width:"100%",height:"100%"},Cs=class i extends re{static{o(this,"DragDrop")}static VERSION=vh.version;isDragDropSupported=Ki();fileInputRef;constructor(e,t){super(e,{...Ub,...t}),this.type="acquirer",this.id=this.opts.id||"DragDrop",this.title="Drag & Drop",this.defaultLocale=bh,this.i18nInit()}addFiles=o(e=>{let t=e.map(r=>({source:this.id,name:r.name,type:r.type,data:r,meta:{relativePath:r.relativePath||null}}));try{this.uppy.addFiles(t)}catch(r){this.uppy.log(r)}},"addFiles");onInputChange=o(e=>{let t=je(e.currentTarget.files||[]);t.length>0&&(this.uppy.log("[DragDrop] Files selected through input"),this.addFiles(t)),e.currentTarget.value=""},"onInputChange");handleDragOver=o(e=>{e.preventDefault(),e.stopPropagation();let{types:t}=e.dataTransfer,r=t.some(n=>n==="Files"),{allowNewUpload:s}=this.uppy.getState();if(!r||!s){e.dataTransfer.dropEffect="none";return}e.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver?.(e)},"handleDragOver");handleDragLeave=o(e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave?.(e)},"handleDragLeave");handleDrop=o(async e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1});let t=o(s=>{this.uppy.log(s,"error")},"logDropError"),r=await Zt(e.dataTransfer,{logDropError:t});r.length>0&&(this.uppy.log("[DragDrop] Files dropped"),this.addFiles(r)),this.opts.onDrop?.(e)},"handleDrop");renderHiddenFileInput(){let{restrictions:e}=this.uppy.opts;return l("input",{className:"uppy-DragDrop-input",type:"file",hidden:!0,ref:o(t=>{this.fileInputRef=t},"ref"),name:this.opts.inputName,multiple:e.maxNumberOfFiles!==1,accept:e.allowedFileTypes?.join(", "),onChange:this.onInputChange})}static renderArrowSvg(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-DragDrop-arrow",width:"16",height:"16",viewBox:"0 0 16 16",children:l("path",{d:"M11 10V0H5v10H2l6 6 6-6h-3zm0 0",fillRule:"evenodd"})})}renderLabel(){return l("div",{className:"uppy-DragDrop-label",children:this.i18nArray("dropHereOr",{browse:l("span",{className:"uppy-DragDrop-browse",children:this.i18n("browse")})})})}renderNote(){return l("span",{className:"uppy-DragDrop-note",children:this.opts.note})}render(){let e=`uppy-u-reset
uppy-DragDrop-container
${this.isDragDropSupported?"uppy-DragDrop--isDragDropSupported":""}
${this.getPluginState().isDraggingOver?"uppy-DragDrop--isDraggingOver":""}
`,t={width:this.opts.width,height:this.opts.height};return l("button",{type:"button",className:e,style:t,onClick:o(()=>this.fileInputRef.click(),"onClick"),onDragOver:this.handleDragOver,onDragLeave:this.handleDragLeave,onDrop:this.handleDrop,children:[this.renderHiddenFileInput(),l("div",{className:"uppy-DragDrop-inner",children:[i.renderArrowSvg(),this.renderLabel(),this.renderNote()]})]})}install(){let{target:e}=this.opts;this.setPluginState({isDraggingOver:!1}),e&&this.mount(e,this)}uninstall(){this.unmount()}};var wh={name:"@uppy/drop-target",description:"Lets your users drag and drop files on a DOM element",version:"4.1.0",license:"MIT",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","drag-drop","drag","drop","dropzone","upload"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var Db={target:null};function bl(i){return i.dataTransfer?.types?.some(e=>e==="Files")??!1}o(bl,"isFileTransfer");var Qo=class extends Pe{static{o(this,"DropTarget")}static VERSION=wh.version;nodes;constructor(e,t){super(e,{...Db,...t}),this.type="acquirer",this.id=this.opts.id||"DropTarget"}addFiles=o(e=>{let t=e.map(r=>({source:this.id,name:r.name,type:r.type,data:r,meta:{relativePath:r.relativePath||null}}));try{this.uppy.addFiles(t)}catch(r){this.uppy.log(r)}},"addFiles");handleDrop=o(async e=>{if(!bl(e))return;e.preventDefault(),e.stopPropagation(),e.currentTarget?.classList.remove("uppy-is-drag-over"),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(n=>{n.type==="acquirer"&&n.handleRootDrop?.(e)});let t=!1,r=o(n=>{this.uppy.log(n,"error"),t||(this.uppy.info(n.message,"error"),t=!0)},"logDropError"),s=await Zt(e.dataTransfer,{logDropError:r});s.length>0&&(this.uppy.log("[DropTarget] Files were dropped"),this.addFiles(s)),this.opts.onDrop?.(e)},"handleDrop");handleDragOver=o(e=>{bl(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",e.currentTarget.classList.add("uppy-is-drag-over"),this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver?.(e))},"handleDragOver");handleDragLeave=o(e=>{bl(e)&&(e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),e.currentTarget?.classList.remove("uppy-is-drag-over"),this.opts.onDragLeave?.(e))},"handleDragLeave");addListeners=o(()=>{let{target:e}=this.opts;if(e instanceof Element?this.nodes=[e]:typeof e=="string"&&(this.nodes=je(document.querySelectorAll(e))),!this.nodes||this.nodes.length===0)throw new Error(`"${e}" does not match any HTML elements`);this.nodes.forEach(t=>{t.addEventListener("dragover",this.handleDragOver,!1),t.addEventListener("dragleave",this.handleDragLeave,!1),t.addEventListener("drop",this.handleDrop,!1)})},"addListeners");removeListeners=o(()=>{this.nodes&&this.nodes.forEach(e=>{e.removeEventListener("dragover",this.handleDragOver,!1),e.removeEventListener("dragleave",this.handleDragLeave,!1),e.removeEventListener("drop",this.handleDrop,!1)})},"removeListeners");install(){this.setPluginState({isDraggingOver:!1}),this.addListeners()}uninstall(){this.removeListeners()}};var Sh={name:"@uppy/dropbox",description:"Import files from Dropbox, into Uppy.",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","dropbox"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var xh={strings:{pluginNameDropbox:"Dropbox"}};var Fi=class extends re{static{o(this,"Dropbox")}static VERSION=Sh.version;icon;provider;view;storage;files;rootFolderId=null;constructor(e,t){super(e,t),this.id=this.opts.id||"Dropbox",this.type="acquirer",this.storage=this.opts.storage||Te,this.files=[],this.icon=()=>l("svg",{className:"uppy-DashboardTab-iconDropbox","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("path",{d:"M10.5 7.5L5 10.955l5.5 3.454 5.5-3.454 5.5 3.454 5.5-3.454L21.5 7.5 16 10.955zM10.5 21.319L5 17.864l5.5-3.455 5.5 3.455zM16 17.864l5.5-3.455 5.5 3.455-5.5 3.455zM16 25.925l-5.5-3.455 5.5-3.454 5.5 3.454z",fill:"currentcolor",fillRule:"nonzero"})}),this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new qe(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionKeysParams:this.opts.companionKeysParams,companionCookiesRule:this.opts.companionCookiesRule,provider:"dropbox",pluginId:this.id,supportsRefreshToken:!0}),this.defaultLocale=xh,this.i18nInit(),this.title=this.i18n("pluginNameDropbox"),this.render=this.render.bind(this)}install(){this.view=new Ne(this,{provider:this.provider,loadAllFiles:!0,virtualList:!0,supportsSearch:!0});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.view.tearDown(),this.unmount()}render(e){return this.view.render(e)}};var Ph={name:"@uppy/facebook",description:"Import files from Facebook, into Uppy.",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","facebook"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var _h={strings:{pluginNameFacebook:"Facebook"}};var Ti=class extends re{static{o(this,"Facebook")}static VERSION=Ph.version;icon;provider;view;storage;files;rootFolderId=null;constructor(e,t){super(e,t),this.id=this.opts.id||"Facebook",this.type="acquirer",this.storage=this.opts.storage||Te,this.files=[],this.icon=()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("g",{fill:"none",fillRule:"evenodd",children:[l("path",{d:"M27 16c0-6.075-4.925-11-11-11S5 9.925 5 16c0 5.49 4.023 10.041 9.281 10.866V19.18h-2.793V16h2.793v-2.423c0-2.757 1.642-4.28 4.155-4.28 1.204 0 2.462.215 2.462.215v2.707h-1.387c-1.366 0-1.792.848-1.792 1.718V16h3.05l-.487 3.18h-2.563v7.686C22.977 26.041 27 21.49 27 16",fill:"#1777F2"}),l("path",{d:"M20.282 19.18L20.77 16h-3.051v-2.063c0-.87.426-1.718 1.792-1.718h1.387V9.512s-1.258-.215-2.462-.215c-2.513 0-4.155 1.523-4.155 4.28V16h-2.793v3.18h2.793v7.686a11.082 11.082 0 003.438 0V19.18h2.563",fill:"#FFFFFE"})]})}),this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new qe(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionKeysParams:this.opts.companionKeysParams,companionCookiesRule:this.opts.companionCookiesRule,provider:"facebook",pluginId:this.id,supportsRefreshToken:!1}),this.defaultLocale=_h,this.i18nInit(),this.title=this.i18n("pluginNameFacebook"),this.render=this.render.bind(this)}install(){this.view=new Ne(this,{provider:this.provider});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.view.tearDown(),this.unmount()}render(e){let{partialTree:t,currentFolderId:r}=this.getPluginState();return t.filter(n=>n.type==="folder"&&n.parentId===r).length===0?this.view.render(e,{viewType:"grid",showFilter:!1,showTitles:!1}):this.view.render(e)}};function Zo(){return Zo=Object.assign||function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Zo.apply(this,arguments)}o(Zo,"_extends");var Mb={"[object HTMLCollection]":!0,"[object NodeList]":!0,"[object RadioNodeList]":!0},Lb={button:!0,fieldset:!0,reset:!0,submit:!0},Bb={checkbox:!0,radio:!0},jb=/^\s+|\s+$/g,zb=Array.prototype.slice,kh=Object.prototype.toString;function en(i,e){if(!i)throw new Error("A form is required by getFormData, was given form="+i);e=Zo({includeDisabled:!1,trim:!1},e);for(var t={},r,s=[],n={},a=0,u=i.elements.length;a<u;a++){var c=i.elements[a];Lb[c.type]||c.disabled&&!e.includeDisabled||(r=c.name||c.id,r&&!n[r]&&(s.push(r),n[r]=!0))}for(var p=0,f=s.length;p<f;p++){r=s[p];var d=Fh(i,r,e);d!=null&&(t[r]=d)}return t}o(en,"getFormData");function Fh(i,e,t){if(!i)throw new Error("A form is required by getFieldData, was given form="+i);if(!e&&kh.call(e)!=="[object String]")throw new Error("A field name is required by getFieldData, was given fieldName="+e);t=Zo({includeDisabled:!1,trim:!1},t);var r=i.elements[e];if(!r||r.disabled&&!t.includeDisabled)return null;if(!Mb[kh.call(r)])return Eh(r,t.trim);for(var s=[],n=!0,a=0,u=r.length;a<u;a++)if(!(r[a].disabled&&!t.includeDisabled)){n&&r[a].type!=="radio"&&(n=!1);var c=Eh(r[a],t.trim);c!=null&&(s=s.concat(c))}return n&&s.length===1?s[0]:s.length>0?s:null}o(Fh,"getFieldData");function Eh(i,e){var t=null,r=i.type;if(r==="select-one")return i.options.length&&(t=i.options[i.selectedIndex].value),t;if(r==="select-multiple"){t=[];for(var s=0,n=i.options.length;s<n;s++)i.options[s].selected&&t.push(i.options[s].value);return t.length===0&&(t=null),t}return r==="file"&&"files"in i?(i.multiple?(t=zb.call(i.files),t.length===0&&(t=null)):t=i.files[0],t):(Bb[r]?i.checked&&(r==="checkbox"&&!i.hasAttribute("value")?t=!0:t=i.value):t=e?i.value.replace(jb,""):i.value,t)}o(Eh,"getFormElementValue");en.getFieldData=Fh;var Th={name:"@uppy/form",description:"Connect Uppy to an existing HTML <form>.",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","form"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^","get-form-data":"^3.0.0"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{typescript:"^5.8.3"}};var qb={resultName:"uppyResult",getMetaFromForm:!0,addResultToForm:!0,submitOnSuccess:!1,triggerUploadOnSubmit:!1};function Vb(i){if(i==null||i.nodeName!=="FORM")throw new Error("ASSERTION FAILED: the target is not a <form> element",{cause:i});return i}o(Vb,"assertHTMLFormElement");var tn=class extends Pe{static{o(this,"Form")}static VERSION=Th.version;#e;constructor(e,t){super(e,{...qb,...t}),this.type="acquirer",this.id=this.opts.id||"Form",this.handleFormSubmit=this.handleFormSubmit.bind(this),this.handleUploadStart=this.handleUploadStart.bind(this),this.handleSuccess=this.handleSuccess.bind(this),this.addResultToForm=this.addResultToForm.bind(this),this.getMetaFromForm=this.getMetaFromForm.bind(this)}handleUploadStart(){this.opts.getMetaFromForm&&this.getMetaFromForm()}handleSuccess(e){this.opts.addResultToForm&&this.addResultToForm(e),this.opts.submitOnSuccess&&this.#e.reportValidity()&&this.#e.submit()}handleFormSubmit(e){if(this.opts.triggerUploadOnSubmit){e.preventDefault();let t=je(e.target.elements),r=[];t.forEach(s=>{(s.tagName==="BUTTON"||s.tagName==="INPUT"&&s.type==="submit")&&!s.disabled&&(s.disabled=!0,r.push(s))}),this.uppy.upload().then(()=>{r.forEach(s=>{s.disabled=!1})},s=>(r.forEach(n=>{n.disabled=!1}),Promise.reject(s))).catch(s=>{this.uppy.log(s.stack||s.message||s)})}}addResultToForm(e){this.uppy.log("[Form] Adding result to the original form:"),this.uppy.log(e);let t=this.#e.querySelector(`[name="${this.opts.resultName}"]`);if(t){let r;try{r=JSON.parse(t.value)}catch{}Array.isArray(r)||(r=[]),r.push(e),t.value=JSON.stringify(r);return}t=document.createElement("input"),t.name=this.opts.resultName,t.type="hidden",t.value=JSON.stringify([e]),this.#e.appendChild(t)}getMetaFromForm(){let e=en(this.#e);delete e[this.opts.resultName],this.uppy.setMeta(e)}install(){this.#e=Vb(Ir(this.opts.target)),this.#e.addEventListener("submit",this.handleFormSubmit),this.uppy.on("upload",this.handleUploadStart),this.uppy.on("complete",this.handleSuccess)}uninstall(){this.#e.removeEventListener("submit",this.handleFormSubmit),this.uppy.off("upload",this.handleUploadStart),this.uppy.off("complete",this.handleSuccess)}};var Ch={name:"@uppy/golden-retriever",description:"The GoldenRetriever Uppy plugin saves selected files in browser cache to seamlessly resume uploding after browser crash or accidentally closed tab",version:"5.2.1",license:"MIT",type:"module",sideEffects:["lib/ServiceWorker.js"],scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --silent='passed-only'","test:e2e":"vitest run --project browser"},keywords:["file uploader","restore files","crash recovery","golden retriever","resumable uploads","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./lib/ServiceWorker.js":"./lib/ServiceWorker.js","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^",lodash:"^4.17.21"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^","@uppy/dashboard":"workspace:^","@uppy/xhr-upload":"workspace:^","@vitest/browser":"^3.2.4",typescript:"^5.8.3",vitest:"^3.2.4"}};var Dh=typeof window<"u"&&(window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.OIndexedDB||window.msIndexedDB),Wb=!!Dh,Ah="uppy-blobs",pt="files",Ih=1440*60*1e3,Gb=3,Rh=1048576;function Kb(i){let e=i.openCursor();e.onsuccess=t=>{let r=t.target.result;if(!r)return;let s=r.value;s.expires=Date.now()+Ih,r.update(s)}}o(Kb,"migrateExpiration");function Uh(i){let e=Dh.open(i,Gb);return new Promise((t,r)=>{e.onupgradeneeded=s=>{let n=s.target.result,a=s.currentTarget.transaction;if(s.oldVersion<2&&n.createObjectStore(pt,{keyPath:"id"}).createIndex("store","store",{unique:!1}),s.oldVersion<3){let u=a.objectStore(pt);u.createIndex("expires","expires",{unique:!1}),Kb(u)}a.oncomplete=()=>{t(n)}},e.onsuccess=s=>{t(s.target.result)},e.onerror=r})}o(Uh,"connect");function rn(i){return new Promise((e,t)=>{i.onsuccess=r=>{e(r.target.result)},i.onerror=t})}o(rn,"waitForRequest");var Oh=!1,sn=class i{static{o(this,"IndexedDBStore")}#e;opts;name;static isSupported;constructor(e){this.opts={dbName:Ah,storeName:"default",expires:Ih,maxFileSize:10*Rh,maxTotalSize:300*Rh,...e},this.name=this.opts.storeName;let t=o(async()=>{let r=await Uh(this.opts.dbName);return this.#e=r,r},"createConnection");Oh?this.#e=t():(Oh=!0,this.#e=i.cleanup().then(t,t))}get ready(){return Promise.resolve(this.#e)}key(e){return`${this.name}!${e}`}async list(){let s=(await this.#e).transaction([pt],"readonly").objectStore(pt).index("store").getAll(IDBKeyRange.only(this.name)),n=await rn(s);return Object.fromEntries(n.map(a=>[a.fileID,a.data]))}async get(e){let s=(await this.#e).transaction([pt],"readonly").objectStore(pt).get(this.key(e)),{data:n}=await rn(s);return{id:n.fileID,data:n.data}}async getSize(){let s=(await this.#e).transaction([pt],"readonly").objectStore(pt).index("store").openCursor(IDBKeyRange.only(this.name));return new Promise((n,a)=>{let u=0;s.onsuccess=c=>{let p=c.target.result;p?(u+=p.value.data.size,p.continue()):n(u)},s.onerror=()=>{a(new Error("Could not retrieve stored blobs size"))}})}async put(e){if(e.data.size!=null&&e.data.size>this.opts.maxFileSize)throw new Error("File is too big to store.");if(await this.getSize()>this.opts.maxTotalSize)throw new Error("No space left");let n=(await this.#e).transaction([pt],"readwrite").objectStore(pt).add({id:this.key(e.id),fileID:e.id,store:this.name,expires:Date.now()+this.opts.expires,data:e.data});return rn(n)}async delete(e){let s=(await this.#e).transaction([pt],"readwrite").objectStore(pt).delete(this.key(e));return rn(s)}static async cleanup(){let e=await Uh(Ah),s=e.transaction([pt],"readwrite").objectStore(pt).index("expires").openCursor(IDBKeyRange.upperBound(Date.now()));await new Promise((n,a)=>{s.onsuccess=u=>{let c=u.target.result;c?(c.delete(),c.continue()):n()},s.onerror=a}),e.close()}};sn.isSupported=Wb;var Nh=sn;var Mh=ae(oa(),1);function Lh(i){try{return JSON.parse(i)}catch{return null}}o(Lh,"maybeParse");var Bh="uppyState:",Xb=o(i=>`${Bh}${i}`,"getItemKey");function Yb(){let i=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r?.startsWith(Bh)&&i.push(r)}let e=Date.now();i.forEach(t=>{let r=localStorage.getItem(t);if(!r)return;let s=Lh(r);s?.expires&&s.expires<e&&localStorage.removeItem(t)})}o(Yb,"expireOldState");var As=class{static{o(this,"MetaDataStore")}opts;name;#e;constructor(e){this.opts={expires:1440*60*1e3,throttleTime:500,...e},this.name=Xb(e.storeName),this.#e=this.opts.throttleTime===0?this.save:(0,Mh.default)(this.save,this.opts.throttleTime,{leading:!0,trailing:!0})}#t;load=o(()=>{Yb();let e=localStorage.getItem(this.name);if(!e)return;let t=Lh(e);if(t)return this.#t=t,t.metadata},"load");get=o(()=>this.#t?.metadata,"get");save=o(()=>{if(this.#t===null){localStorage.removeItem(this.name);return}let e=JSON.stringify(this.#t);localStorage.setItem(this.name,e)},"save");set=o(e=>{this.#t=e===null?null:{metadata:e,expires:Date.now()+this.opts.expires},this.#e()},"set")};var jh=typeof navigator<"u"&&"serviceWorker"in navigator;function Jb(){return new Promise((i,e)=>{jh?navigator.serviceWorker.controller?i():navigator.serviceWorker.addEventListener("controllerchange",()=>{i()}):e(new Error("Unsupported"))})}o(Jb,"waitForServiceWorker");var on=class{static{o(this,"ServiceWorkerStore")}#e;name;static isSupported;constructor(e){this.#e=Jb().then(t=>{this.#e=t}),this.name=e.storeName}get ready(){return Promise.resolve(this.#e)}async list(){return await this.#e,new Promise((e,t)=>{let r=o(s=>{if(s.data.store===this.name)switch(s.data.type){case"uppy/ALL_FILES":e(s.data.files),navigator.serviceWorker.removeEventListener("message",r);break;default:t()}},"onMessage");navigator.serviceWorker.addEventListener("message",r),navigator.serviceWorker.controller.postMessage({type:"uppy/GET_FILES",store:this.name})})}async put(e){await this.#e,navigator.serviceWorker.controller.postMessage({type:"uppy/ADD_FILE",store:this.name,file:e})}async delete(e){await this.#e,navigator.serviceWorker.controller.postMessage({type:"uppy/REMOVE_FILE",store:this.name,fileID:e})}};on.isSupported=jh;var zh=on;var Qb={expires:1440*60*1e3,serviceWorker:!1},nn=class i extends Pe{static{o(this,"GoldenRetriever")}static VERSION=Ch.version;#e;#t;#r;static[Symbol.for("uppy test: throttleTime")];constructor(e,t){super(e,{...Qb,...t}),this.type="debugger",this.id=this.opts.id||"GoldenRetriever",this.#e=new As({expires:this.opts.expires,storeName:e.getID(),throttleTime:i[Symbol.for("uppy test: throttleTime")]??void 0}),this.opts.serviceWorker&&(this.#t=new zh({storeName:e.getID()})),this.#r=new Nh({expires:this.opts.expires,...this.opts.indexedDB||{},storeName:e.getID()})}async#i(){let e=this.#e.load();if(!e)return;let t=e.currentUploads||{},r=Object.entries(e.files||{}),s=Object.fromEntries(r.every(([,v])=>v.progress.complete&&!v.error)?[]:r),n=Object.entries(s);this.uppy.log(`[GoldenRetriever] Recovered ${Object.keys(t).length} current uploads and ${n.length} files from Local Storage`);let a=n.length>0;a||this.uppy.log("[GoldenRetriever] No files need to be loaded, restored only processing state...");let[u,c]=await Promise.all([this.#l(),this.#o()]),p={...u,...c},f=Object.fromEntries(n.map(([v,_])=>{if(_.isRemote)return[v,{..._,isRestored:!0,data:{size:null}}];let k=p[v];return[v,!_.progress.uploadComplete&&k==null?{..._,isRestored:!0,isGhost:!0,data:void 0}:{..._,isRestored:!0,isGhost:!1,data:k}]}));this.uppy.setState({recoveredState:a?e:null,currentUploads:a?t:{},files:f}),this.uppy.emit("restored",e.pluginData);let d=Object.keys(p).filter(v=>!s[v]);if(d.length)try{this.uppy.log(`[GoldenRetriever] Cleaning up ${d.length} old files`),await this.#n(d)}catch(v){this.uppy.log(`[GoldenRetriever] Could not clean up ${d.length} old files`,"warning"),this.uppy.log(v)}}#s=o(({pluginData:e,...t})=>{let r=this.#e.get();this.#e.set({...r??{currentUploads:{},files:{}},...t,pluginData:{...r?.pluginData,...e}})},"#patchMetadata");async#l(){if(!this.#t)return{};try{let e=await this.#t.list(),t=Object.keys(e).length;return this.uppy.log(t>0?`[GoldenRetriever] Successfully recovered ${t} blobs from Service Worker!`:"[GoldenRetriever] No blobs found in Service Worker"),e}catch(e){return this.uppy.log("[GoldenRetriever] Failed to recover blobs from Service Worker","warning"),this.uppy.log(e),{}}}async#o(){try{let e=await this.#r.list(),t=Object.keys(e).length;return this.uppy.log(t>0?`[GoldenRetriever] Successfully recovered ${t} blobs from IndexedDB!`:"[GoldenRetriever] No blobs found in IndexedDB"),e}catch(e){return this.uppy.log("[GoldenRetriever] Failed to recover blobs from IndexedDB","warning"),this.uppy.log(e),{}}}async#n(e){await Promise.all(e.map(async t=>{try{await Promise.all([this.#t?.delete(t),this.#r.delete(t)])}catch(r){this.uppy.log(`[GoldenRetriever] Could not remove file ${t} from all stores`,"warning"),this.uppy.log(r)}})),e.length>0&&this.uppy.log(`[GoldenRetriever] Removed ${e.length} blobs`)}async[Symbol.for("uppy test: deleteBlobs")](e){return this.#n(e)}#a=o(async e=>{let{id:t,data:r,isRemote:s}=e;s||r==null||await Promise.all([this.#t?.put({id:t,data:r}).catch(n=>{this.uppy.log("[GoldenRetriever] Could not store file in Service Worker","warning"),this.uppy.log(n)}),this.#r.put({id:t,data:r}).catch(n=>{n instanceof Event&&n.target instanceof IDBRequest&&n.target.error?.name==="ConstraintError"||(this.uppy.log("[GoldenRetriever] Could not store file in IndexedDB","warning"),this.uppy.log(n))})])},"#addBlobToStores");#c=o((e,t,r)=>{if(t.currentUploads!==e.currentUploads){let{currentUploads:s}=this.uppy.getState();this.#s({currentUploads:s})}if(t.files!==e.files){Object.values(e.files).some(f=>!f.progress.complete)&&(Object.values(t.files).length===0||Object.values(t.files).every(f=>f.progress.complete&&!f.error))&&(this.uppy.log("[GoldenRetriever] All files have been uploaded and processed successfully, clearing recovery state"),this.uppy.setState({recoveredState:null}));let s=Object.fromEntries(Object.entries(t.files).map(([f,{data:d,preview:v,..._}])=>[f,_]));this.#s({files:s});let n=Object.values(t.files).filter(f=>e.files[f.id]==null),a=Object.values(t.files).flatMap(f=>{let d=e.files[f.id];return d!=null&&f.data!==d.data?[f]:[]}),c=[...Object.values(e.files).filter(f=>{let d=t.files[f.id];return d==null||d.progress.uploadComplete&&!f.progress.uploadComplete}),...a],p=[...n,...a];(async()=>{await this.#n(c.map(f=>f.id));for(let f of p)await this.#a(f);p.length>0&&this.uppy.log(`[GoldenRetriever] Added ${p.length} blobs`)})()}},"#handleStateUpdate");#u=o(()=>{this.uppy.log("[GoldenRetriever] Restore confirmed, proceeding...");let{currentUploads:e}=this.uppy.getState();Object.keys(e).length>0?(this.uppy.resumeAll(),Object.keys(e).forEach(t=>{this.uppy.restore(t)})):this.uppy.upload(),this.uppy.setState({recoveredState:null})},"#handleRestoreConfirmed");#d=o(e=>{this.#s({pluginData:e})},"#handlePluginDataChanged");install(){this.#i(),this.uppy.on("state-update",this.#c),this.uppy.on("restore-confirmed",this.#u),this.uppy.on("restore:plugin-data-changed",this.#d)}uninstall(){this.uppy.off("state-update",this.#c),this.uppy.off("restore-confirmed",this.#u),this.uppy.off("restore:plugin-data-changed",this.#d)}};var Hh={name:"@uppy/google-drive",description:"The Google Drive plugin for Uppy lets users import files from their Google Drive account",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","google drive","cloud storage","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var Rs=class extends Ne{static{o(this,"DriveProviderViews")}toggleCheckbox(e,t){e.data.custom?.isSharedDrive||super.toggleCheckbox(e,t)}};var qh={strings:{pluginNameGoogleDrive:"Google Drive"}};var Ci=class extends re{static{o(this,"GoogleDrive")}static VERSION=Hh.version;icon;provider;view;storage;files;rootFolderId="root";constructor(e,t){super(e,t),this.type="acquirer",this.storage=this.opts.storage||Te,this.files=[],this.id=this.opts.id||"GoogleDrive",this.icon=()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("g",{fillRule:"nonzero",fill:"none",children:[l("path",{d:"M6.663 22.284l.97 1.62c.202.34.492.609.832.804l3.465-5.798H5c0 .378.1.755.302 1.096l1.361 2.278z",fill:"#0066DA"}),l("path",{d:"M16 12.09l-3.465-5.798c-.34.195-.63.463-.832.804l-6.4 10.718A2.15 2.15 0 005 18.91h6.93L16 12.09z",fill:"#00AC47"}),l("path",{d:"M23.535 24.708c.34-.195.63-.463.832-.804l.403-.67 1.928-3.228c.201-.34.302-.718.302-1.096h-6.93l1.474 2.802 1.991 2.996z",fill:"#EA4335"}),l("path",{d:"M16 12.09l3.465-5.798A2.274 2.274 0 0018.331 6h-4.662c-.403 0-.794.11-1.134.292L16 12.09z",fill:"#00832D"}),l("path",{d:"M20.07 18.91h-8.14l-3.465 5.798c.34.195.73.292 1.134.292h12.802c.403 0 .794-.11 1.134-.292L20.07 18.91z",fill:"#2684FC"}),l("path",{d:"M23.497 12.455l-3.2-5.359a2.252 2.252 0 00-.832-.804L16 12.09l4.07 6.82h6.917c0-.377-.1-.755-.302-1.096l-3.188-5.359z",fill:"#FFBA00"})]})}),this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new qe(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionKeysParams:this.opts.companionKeysParams,companionCookiesRule:this.opts.companionCookiesRule,provider:"drive",pluginId:this.id,supportsRefreshToken:!0}),this.defaultLocale=qh,this.i18nInit(),this.title=this.i18n("pluginNameGoogleDrive"),this.render=this.render.bind(this)}install(){this.view=new Rs(this,{provider:this.provider,loadAllFiles:!0,virtualList:!0});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.view.tearDown(),this.unmount()}render(e){return this.view.render(e)}};var Vh={name:"@uppy/google-drive-picker",description:"The Google Drive Picker plugin for Uppy lets users import files from their Google Drive account",version:"1.1.1",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","google drive","google picker","cloud storage","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var wl={strings:{pluginNameGoogleDrivePicker:"Google Drive"}};var Us=class i extends re{static{o(this,"GoogleDrivePicker")}static VERSION=Vh.version;static requestClientId=i.name;type="acquirer";icon=or;storage;defaultLocale=wl;constructor(e,t){super(e,t),this.id=this.opts.id||"GoogleDrivePicker",this.storage=this.opts.storage||Te,this.defaultLocale=wl,this.i18nInit(),this.title=this.i18n("pluginNameGoogleDrivePicker");let r=new Je(e,{pluginId:this.id,provider:"url",companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule});this.uppy.registerRequestClient(i.requestClientId,r)}install(){let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount()}handleFilesPicked=o(async(e,t)=>{this.uppy.addFiles(e.map(({id:r,mimeType:s,name:n,platform:a,...u})=>({source:this.id,name:n,type:s,data:{size:null},isRemote:!0,remote:{companionUrl:this.opts.companionUrl,url:`${this.opts.companionUrl}/google-picker/get`,body:{fileId:r,accessToken:t,platform:a,..."url"in u&&{url:u.url}},requestClientId:i.requestClientId},..."metadata"in u&&{meta:u.metadata}})))},"handleFilesPicked");render=o(()=>l(wi,{storage:this.storage,pickerType:"drive",uppy:this.uppy,i18n:this.i18n,clientId:this.opts.clientId,apiKey:this.opts.apiKey,appId:this.opts.appId,onFilesPicked:this.handleFilesPicked}),"render")};var $h={name:"@uppy/google-photos-picker",description:"The Google Photos Picker plugin for Uppy lets users import files from their Google Photos account",version:"1.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","google photos","google picker","cloud storage","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var Sl={strings:{pluginNameGooglePhotosPicker:"Google Photos"}};var Os=class i extends re{static{o(this,"GooglePhotosPicker")}static VERSION=$h.version;static requestClientId=i.name;type="acquirer";icon=sr;storage;defaultLocale=Sl;constructor(e,t){super(e,t),this.id=this.opts.id||"GooglePhotosPicker",this.storage=this.opts.storage||Te,this.defaultLocale=Sl,this.i18nInit(),this.title=this.i18n("pluginNameGooglePhotosPicker");let r=new Je(e,{pluginId:this.id,provider:"url",companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule});this.uppy.registerRequestClient(i.requestClientId,r)}install(){let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount()}handleFilesPicked=o(async(e,t)=>{this.uppy.addFiles(e.map(({id:r,mimeType:s,name:n,platform:a,...u})=>({source:this.id,name:n,type:s,data:{size:null},isRemote:!0,remote:{companionUrl:this.opts.companionUrl,url:`${this.opts.companionUrl}/google-picker/get`,body:{fileId:r,accessToken:t,platform:a,..."url"in u&&{url:u.url}},requestClientId:i.requestClientId},..."metadata"in u&&{meta:u.metadata}})))},"handleFilesPicked");render=o(()=>l(wi,{storage:this.storage,pickerType:"photos",uppy:this.uppy,i18n:this.i18n,clientId:this.opts.clientId,onFilesPicked:this.handleFilesPicked}),"render")};var Wh={name:"@uppy/image-editor",description:"Image editor and cropping UI",version:"4.1.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","upload","uppy","uppy-plugin","image editor","cropper","crop","rotate","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^",cropperjs:"^1.6.2",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var Qh=ae(Gh(),1);function r1(i,e){let t=i.width/e.width,r=i.height/e.height,s=Math.min(t,r),n=e.width*s,a=e.height*s,u=(i.width-n)/2,c=(i.height-a)/2;return{width:n,height:a,left:u,top:c}}o(r1,"getCanvasDataThatFitsPerfectlyIntoContainer");var Kh=r1;function s1(i){return i*(Math.PI/180)}o(s1,"toRadians");function o1(i,e,t){let r=Math.abs(s1(t));return Math.max((Math.sin(r)*i+Math.cos(r)*e)/e,(Math.sin(r)*e+Math.cos(r)*i)/i)}o(o1,"getScaleFactorThatRemovesDarkCorners");var Xh=o1;function n1(i,e,t){return e.left<i.left?{left:i.left,width:t.width}:e.top<i.top?{top:i.top,height:t.height}:e.left+e.width>i.left+i.width?{left:i.left+i.width-t.width,width:t.width}:e.top+e.height>i.top+i.height?{top:i.top+i.height-t.height,height:t.height}:null}o(n1,"limitCropboxMovementOnMove");var Yh=n1;function a1(i,e,t){return e.left<i.left?{left:i.left,width:t.left+t.width-i.left}:e.top<i.top?{top:i.top,height:t.top+t.height-i.top}:e.left+e.width>i.left+i.width?{left:t.left,width:i.left+i.width-t.left}:e.top+e.height>i.top+i.height?{top:t.top,height:i.top+i.height-t.top}:null}o(a1,"limitCropboxMovementOnResize");var Jh=a1;var Ds=class extends Se{static{o(this,"Editor")}imgElement;cropper;constructor(e){super(e),this.state={angle90Deg:0,angleGranular:0,prevCropboxData:null},this.storePrevCropboxData=this.storePrevCropboxData.bind(this),this.limitCropboxMovement=this.limitCropboxMovement.bind(this)}componentDidMount(){let{opts:e,storeCropperInstance:t}=this.props;this.cropper=new Qh.default(this.imgElement,e.cropperOptions),this.imgElement.addEventListener("cropstart",this.storePrevCropboxData),this.imgElement.addEventListener("cropend",this.limitCropboxMovement),t(this.cropper)}componentWillUnmount(){this.cropper.destroy(),this.imgElement.removeEventListener("cropstart",this.storePrevCropboxData),this.imgElement.removeEventListener("cropend",this.limitCropboxMovement)}storePrevCropboxData(){this.setState({prevCropboxData:this.cropper.getCropBoxData()})}limitCropboxMovement(e){let t=this.cropper.getCanvasData(),r=this.cropper.getCropBoxData(),{prevCropboxData:s}=this.state;if(e.detail.action==="all"){let n=Yh(t,r,s);n&&this.cropper.setCropBoxData(n)}else{let n=Jh(t,r,s);n&&this.cropper.setCropBoxData(n)}}onRotate90Deg=o(()=>{let{angle90Deg:e}=this.state,t=e-90;this.setState({angle90Deg:t,angleGranular:0}),this.cropper.scale(1),this.cropper.rotateTo(t);let r=this.cropper.getCanvasData(),s=this.cropper.getContainerData(),n=Kh(s,r);this.cropper.setCanvasData(n),this.cropper.setCropBoxData(n)},"onRotate90Deg");onRotateGranular=o(e=>{let t=Number(e.target.value);this.setState({angleGranular:t});let{angle90Deg:r}=this.state,s=r+t;this.cropper.rotateTo(s);let n=this.cropper.getImageData(),a=Xh(n.naturalWidth,n.naturalHeight,t),u=this.cropper.getImageData().scaleX<0?-a:a;this.cropper.scale(u,a)},"onRotateGranular");renderGranularRotate(){let{i18n:e}=this.props,{angleGranular:t}=this.state;return l("label",{role:"tooltip","aria-label":`${t}\xBA`,"data-microtip-position":"top",className:"uppy-ImageCropper-rangeWrapper",children:l("input",{className:"uppy-ImageCropper-range uppy-u-reset",type:"range",onInput:this.onRotateGranular,onChange:this.onRotateGranular,value:t,min:"-45",max:"45","aria-label":e("rotate")})})}renderRevert(){let{i18n:e,opts:t}=this.props;return l("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("revert"),onClick:o(()=>{this.cropper.reset(),this.cropper.setAspectRatio(t.cropperOptions.initialAspectRatio),this.setState({angle90Deg:0,angleGranular:0})},"onClick"),children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M0 0h24v24H0z",fill:"none"}),l("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"})]})})}renderRotate(){let{i18n:e}=this.props;return l("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("rotate"),onClick:this.onRotate90Deg,children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"}),l("path",{d:"M14 10a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h8zm0 1.75H6a.25.25 0 00-.243.193L5.75 12v7a.25.25 0 00.193.243L6 19.25h8a.25.25 0 00.243-.193L14.25 19v-7a.25.25 0 00-.193-.243L14 11.75zM12 .76V4c2.3 0 4.61.88 6.36 2.64a8.95 8.95 0 012.634 6.025L21 13a1 1 0 01-1.993.117L19 13h-.003a6.979 6.979 0 00-2.047-4.95 6.97 6.97 0 00-4.652-2.044L12 6v3.24L7.76 5 12 .76z"})]})})}renderFlip(){let{i18n:e}=this.props;return l("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("flipHorizontal"),onClick:o(()=>this.cropper.scaleX(-this.cropper.getData().scaleX||-1),"onClick"),children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M0 0h24v24H0z",fill:"none"}),l("path",{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"})]})})}renderZoomIn(){let{i18n:e}=this.props;return l("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomIn"),onClick:o(()=>this.cropper.zoom(.1),"onClick"),children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",height:"24",viewBox:"0 0 24 24",width:"24",children:[l("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),l("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})]})})}renderZoomOut(){let{i18n:e}=this.props;return l("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomOut"),onClick:o(()=>this.cropper.zoom(-.1),"onClick"),children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})]})})}renderCropSquare(){let{i18n:e}=this.props;return l("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioSquare"),onClick:o(()=>this.cropper.setAspectRatio(1),"onClick"),children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M0 0h24v24H0z",fill:"none"}),l("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})]})})}renderCropWidescreen(){let{i18n:e}=this.props;return l("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioLandscape"),onClick:o(()=>this.cropper.setAspectRatio(16/9),"onClick"),children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M 19,4.9999992 V 17.000001 H 4.9999998 V 6.9999992 H 19 m 0,-2 H 4.9999998 c -1.0999999,0 -1.9999999,0.9000001 -1.9999999,2 V 17.000001 c 0,1.1 0.9,2 1.9999999,2 H 19 c 1.1,0 2,-0.9 2,-2 V 6.9999992 c 0,-1.0999999 -0.9,-2 -2,-2 z"}),l("path",{fill:"none",d:"M0 0h24v24H0z"})]})})}renderCropWidescreenVertical(){let{i18n:e}=this.props;return l("button",{"data-microtip-position":"top",type:"button","aria-label":e("aspectRatioPortrait"),className:"uppy-u-reset uppy-c-btn",onClick:o(()=>this.cropper.setAspectRatio(9/16),"onClick"),children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M 19.000001,19 H 6.999999 V 5 h 10.000002 v 14 m 2,0 V 5 c 0,-1.0999999 -0.9,-1.9999999 -2,-1.9999999 H 6.999999 c -1.1,0 -2,0.9 -2,1.9999999 v 14 c 0,1.1 0.9,2 2,2 h 10.000002 c 1.1,0 2,-0.9 2,-2 z"}),l("path",{d:"M0 0h24v24H0z",fill:"none"})]})})}render(){let{currentImage:e,opts:t}=this.props,{actions:r}=t;if(e.data==null)throw new Error("File data is empty");let s=URL.createObjectURL(e.data);return l("div",{className:"uppy-ImageCropper",children:[l("div",{className:"uppy-ImageCropper-container",children:l("img",{className:"uppy-ImageCropper-image",alt:e.name,src:s,ref:o(n=>{this.imgElement=n},"ref")})}),l("div",{className:"uppy-ImageCropper-controls",children:[r.revert&&this.renderRevert(),r.rotate&&this.renderRotate(),r.granularRotate&&this.renderGranularRotate(),r.flip&&this.renderFlip(),r.zoomIn&&this.renderZoomIn(),r.zoomOut&&this.renderZoomOut(),r.cropSquare&&this.renderCropSquare(),r.cropWidescreen&&this.renderCropWidescreen(),r.cropWidescreenVertical&&this.renderCropWidescreenVertical()]})]})}};var Zh={strings:{revert:"Reset",rotate:"Rotate 90\xB0",zoomIn:"Zoom in",zoomOut:"Zoom out",flipHorizontal:"Flip horizontally",aspectRatioSquare:"Crop square",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)"}};var ef={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},tf={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},l1={quality:.8,actions:tf,cropperOptions:ef},Is=class extends re{static{o(this,"ImageEditor")}static VERSION=Wh.version;cropper;constructor(e,t){super(e,{...l1,...t,actions:{...tf,...t?.actions},cropperOptions:{...ef,...t?.cropperOptions}}),this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=Zh,this.i18nInit()}canEditFile(e){if(!e.type||e.isRemote)return!1;let t=e.type.split("/")[1];return!!/^(jpe?g|gif|png|bmp|webp)$/.test(t)}save=o(()=>{let e=o(s=>{let{currentImage:n}=this.getPluginState();this.uppy.setFileState(n.id,{data:new File([s],n.name??this.i18n("unnamed"),{type:s.type}),size:s.size,preview:void 0});let a=this.uppy.getFile(n.id);this.uppy.emit("thumbnail:request",a),this.setPluginState({currentImage:a}),this.uppy.emit("file-editor:complete",a)},"saveBlobCallback"),{currentImage:t}=this.getPluginState(),r=this.cropper.getCroppedCanvas({});r.width%2!==0&&this.cropper.setData({width:r.width-1}),r.height%2!==0&&this.cropper.setData({height:r.height-1}),this.cropper.getCroppedCanvas(this.opts.cropperOptions.croppedCanvasOptions).toBlob(e,t.type,this.opts.quality)},"save");storeCropperInstance=o(e=>{this.cropper=e},"storeCropperInstance");selectFile=o(e=>{this.uppy.emit("file-editor:start",e),this.setPluginState({currentImage:e})},"selectFile");install(){this.setPluginState({currentImage:null});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){let{currentImage:e}=this.getPluginState();if(e){let t=this.uppy.getFile(e.id);this.uppy.emit("file-editor:cancel",t)}this.unmount()}render(){let{currentImage:e}=this.getPluginState();return e===null||e.isRemote?null:l(Ds,{currentImage:e,storeCropperInstance:this.storeCropperInstance,save:this.save,opts:this.opts,i18n:this.i18n})}};var rf={name:"@uppy/instagram",description:"Import photos and videos from Instagram, into Uppy.",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","instagram","provider","photos","videos"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var sf={strings:{pluginNameInstagram:"Instagram"}};var Ai=class extends re{static{o(this,"Instagram")}static VERSION=rf.version;icon;provider;view;storage;files;rootFolderId="recent";constructor(e,t){super(e,t),this.type="acquirer",this.files=[],this.storage=this.opts.storage||Te,this.id=this.opts.id||"Instagram",this.icon=()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:[l("defs",{children:l("path",{d:"M16.825 5l.483-.001.799.002c1.168.005 1.598.021 2.407.057 1.17.05 1.97.235 2.67.506.725.28 1.34.655 1.951 1.265.613.61.99 1.223 1.273 1.946.273.7.46 1.498.516 2.67l.025.552.008.205c.029.748.037 1.51.042 3.777l.001.846v.703l-.001.398a50.82 50.82 0 01-.058 2.588c-.05 1.17-.235 1.97-.506 2.67a5.394 5.394 0 01-1.265 1.951c-.61.613-1.222.99-1.946 1.273-.699.273-1.498.46-2.668.516-.243.012-.451.022-.656.03l-.204.007c-.719.026-1.512.034-3.676.038l-.847.001h-1.1a50.279 50.279 0 01-2.587-.059c-1.171-.05-1.971-.235-2.671-.506a5.394 5.394 0 01-1.951-1.265 5.385 5.385 0 01-1.272-1.946c-.274-.699-.46-1.498-.517-2.668a88.15 88.15 0 01-.03-.656l-.007-.205c-.026-.718-.034-1.512-.038-3.674v-2.129c.006-1.168.022-1.597.058-2.406.051-1.171.235-1.971.506-2.672a5.39 5.39 0 011.265-1.95 5.381 5.381 0 011.946-1.272c.699-.274 1.498-.462 2.669-.517l.656-.03.204-.007c.718-.026 1.511-.034 3.674-.038zm.678 1.981h-1.226l-.295.001c-2.307.005-3.016.013-3.777.043l-.21.009-.457.02c-1.072.052-1.654.232-2.042.383-.513.2-.879.44-1.263.825a3.413 3.413 0 00-.82 1.267c-.15.388-.33.97-.375 2.043a48.89 48.89 0 00-.056 2.482v.398 1.565c.006 2.937.018 3.285.073 4.444.05 1.073.231 1.654.382 2.043.2.512.44.878.825 1.263.386.383.753.621 1.267.82.388.15.97.328 2.043.374.207.01.388.017.563.024l.208.007a63.28 63.28 0 002.109.026h1.564c2.938-.006 3.286-.019 4.446-.073 1.071-.051 1.654-.232 2.04-.383.514-.2.88-.44 1.264-.825.384-.386.622-.753.82-1.266.15-.389.328-.971.375-2.044.039-.88.054-1.292.057-2.723v-1.15-.572c-.006-2.936-.019-3.284-.074-4.445-.05-1.071-.23-1.654-.382-2.04-.2-.515-.44-.88-.825-1.264a3.405 3.405 0 00-1.267-.82c-.388-.15-.97-.328-2.042-.375a48.987 48.987 0 00-2.535-.056zm-1.515 3.37a5.65 5.65 0 11.021 11.299 5.65 5.65 0 01-.02-11.3zm.004 1.982a3.667 3.667 0 10.015 7.334 3.667 3.667 0 00-.015-7.334zm5.865-3.536a1.32 1.32 0 11.005 2.64 1.32 1.32 0 01-.005-2.64z",id:"a"})}),l("g",{fill:"none","fill-rule":"evenodd",children:[l("mask",{id:"b",fill:"#fff",children:l("use",{xlinkHref:"#a"})}),l("image",{mask:"url(#b)",x:"4",y:"4",width:"24",height:"24",xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAALKADAAQAAAABAAAALAAAAAD8buejAAALZklEQVRYCVWZC2LbNhAFCRKykvP0bD1506SxRKIzbwHJoU3jv5h9WICU3P7+6zlG2zZvr8s/rW1tN7U0rMll8aDYufdzbLfc1JHmpv3jpPy8tsO+3O2s/O6YMSjTl/qdCds4mIIG60m8vdq2Z+phm2V4vAb9+o7BbZeuoM0NyYazvTvbvlN1MGjHUAesZ/IWWOsCeF0BOwAK4ITR0WYd/QKHEPv2DEymmorZtiubjOHEMYEzXmC9GMxu+95Kz+kuwxjDBKb8iUoCAdqZoAeyALreW6ZNx9Y4Jz8cLwjTZOEoR+HU05k2RzgP2iafGgfZiEdZbEr94zpX/xkPtDtGAxF+LRcgTsp9CAZg0rnEnXmPqFshY5vLnVWxLXO/bah2sZQgBZppGSe8NbjNPN5kc/WbIYEn8U+jXCOezT4zfgS1eoVEhceVeK74Fe4N6CoYEoLWykzHsd+GMAUqdTTVvvqT1uWqB3lVCLb12/ORAe8/5Zu9mp7lqoEFUCAFDIxqz7i1bq2AY1U9jqq2QK/7DYl+1AeZlAFcEc+U/jkRUqsvCHQ/nyGvjrOl6EuZWRWVGCKUMCkntQ5o+u2AZ3OxakbTcoBZnY0xhgGCUM4Kp1xtBTnBnXM5ASRms/Fs7d9OpX8bXN45pibQY/ML1MmA5G9CINBuCpdftexr6i2c5qd9J441LNJm3zk1GVusJ7v6mPJ7HPxJR0Li/vg9O1XHTEgvsQoSgExU0NnlLF0paK+6d06aOMKE2nCKV0ofNw4WsWmLsWrv6lPLnhGpr9E137QkHOMB/jh/T8MOqOadXarR44zPBW5NvDccnBxVmdK81+7RQ5p6qnQoRDZPh9+xWj0N2XpqxX1HzMty9UlFnKya/h3gulziAsyxwkSmpTIPB8vagKLyktRdDuBEHNGZMm4oCFWgjq31WPHpaC93gGNqpOpP4Ez4spa+nMNvhTWcuPKAJ79fqIxVoUvdjEG9qSy2WhpQlz61yG/gnKEA25IrIOYK6DIsQs2EE9LR/sTKq38Nd1y/X//FXG0QDHkEqSz3EYVV2dhb00rgLPSDcqmrScs55NNOD2zVqKmYnYTFnkACp520dkW5vBxK99BVzr792/iZ+VVo92UkKU2oG5WFTb6mNiA1H2C8KC0E44qaQleR3EQvQNwLrECOVAiSwM5gpF7nvDND0lZvYuQ9JbZfqdTrqCgwMcVrRS0z9QkLu9NWmkgEHb8p2zDRylj9VWA3lXD2vObEdWpT3w5MiFqQ1W/lteG4eipastxv2w+TeTBP0ypK84HiOW9fUzLcjRDwCW2b2VxmnGSKTX6uRSwMnC9YX4l05Mh2uwI+QVWdWUOSTWd5Xjjf7/tPYk2stSh053XTGN5RJMCMSajMcS8Trn3j/E1ajthlxCkmJXVi47PSUsyyq+jyexsayQNuv5GVYJaszprNsQD3RkgYiy49kFl2JlJJxlf8Uu/lpkq7+aWqzEzjr5cTVpFaJvSVr8AKRtiTlVPFk5t1nO30W+o6jrbAk76kxFa/tX+dom4C1wDPk03gqCw8HTBSxx4FHxIA+mh2pM3rKu5SNqBAuOSZnHzsB9JwW7DV/ge8dlVsOh375PvH8YO8EALU1HuecIC6qQgXifNuSx9XAoLaoGIYDjkWFrawX1U1XrknuMFw7QBSPtg79XovmBvwqnDICrhClEO6wgKFj9vPqJWlthUvdgH1DOA8+wFMexzQc5BUS1d1IsdBSjEv4Fe1LgBO1CpFPTpV1JuPSFNt4y/trzbtaUfwBWwM3/6JsrL6MSQYwLKXAm9YJBxsM8992MblZ63Gami0+rnwOMyPykVpQsyl9eYNOfVC6kRBkwaop//LgcAKWivkHF791g0JK5kMmCgKPas2QRkUFQsuTvm6R1946Wg95k764ZRLW59yO5UVGsawwELupCfAbdCuAwvcz5Xk18rIVEdgSRBRgO77R206QdXHuA2goaGiCQ0GmUfN1JlmFayjv0IcKGkfYt4HAj0yuQBRGDjzuS/rTmAf29Gov1S+FF7QBayNcpoBOEsMt3vFcIUC7VxOnE+pxmkgqEzduzwsPykrjBszCusgdarsRIAL6CM/KqsqcAf1vj8P1TXFyN6e5G8ao48fjKfDQJYizIdIfb+Xwp6Z2fE2C7mUfUEzMKqSBp4VUV1A49Sz1M2LzVzahEfyHUAcQNltR0nADYkBvHXDZQo8H9dQvHF7qhjPtSolBJ0A/vaLwdRz5YFFGoWBy8E/4aKcjqimaUBXXnjBpzOZnMlIVXsTVEBBUa+dD0BR0xVopgAD70psY0KjMHpmHB2kApea9o23NS83mpsref5OZet4U/0CMhSEDpwnxB9lVKSfk5djllXRFPizQmKcqMpnyZ3ycPntf96Ym9ChzU8vCQnhgWZ2UuySArw+cVBG4gqNCS6YoSEEziRWVStKUpe4FfCd91V0XA/qgOJuF7FpGjjyQgsFoNDtibp8cm+cyXxbB6zh4pMUO4H06yzsv4E/A6rg/uRJRnMRmrhMDIhyOjABX9CMDFhBFxx19KujjqWeim5PwVFU6IBiewfyk7IPETcg52kjXN7nsbaoEykKf/cjUgVxpTZZVtnqFMgv4FHa8oSOisawinMLHfUBzJcK1j8BeqquedKDtgcgnA4bym4P6gBWYVM3W/pn41ku5L4RElFWtlk5SXHEThhOWDiIyVROlQNM+wyHimlgATI/PPIm4BB8qfqwHnhgL89gzs+Ww1xQb4821SZ/4IwOJiRqH/X9u7Hj08JLSZfawOQcpRzwgk1oBNzzcgLn1FBNHspMENik9OG4awIDaUjw9rKNT1KXPl9neua6sSbkgqfs/CNfBdNfDDhQuL4AKXEXeOgZID91eOiRUnEFOIA5rnTkBU0/IT05gByoq5KBJF4Hym4Pxh3UcxZ7HjdhEhKWURbhavNR9rjLBwk3ryDcrGzfvk9I69b1yhMGWQ4bqMwv/RMSplQkjjVKXzZX8wESVcuB7QG0YUCMjk/aOmWgc/vC4oMCVYfghIGP6MT1zpeUhM1rQzOnGxmFKwTCir1Xaj5vN7T7nDZvnbDGHbCKnwji2zofNsOvbold3zlUtKGosBun3PbJSrrReHEaCQVCIDEMaCCBs+P+AbybkbIhmbNecGwF+E5/L2ECuPKCWsUESQkKnyyJ93TGACk7OrAY9P8XG//fGCoM7DAEUGnj5Mw7aQfelySWOm9iPuFyvrL8rKQR6mM6qdCUDQsfNPVu4yv/HaPOT1e/yDaviMKmTkg/I/F7MUG9OlrmDrBLRVd3c8KBJlPEKoVRcIJuhoQAmZDUkPC00W5OI1dOpQ1F61kFNqr9SmFcaHdBheOaDHF6QZMOP6QyiZ804oj98wLiAMIgcWw4UDYkDAWfR+4d5s0zP2GgUZX04i+NeSgYGokvbDhIZYUWHgd9K8zZzir264NxZUFbsfM1jdqpV2naA48tx6hsvBSabE4IMtlcOGgq8PqCjoly2rw2soqy4RJWQtPZl6PUCU14ZUWENuZV2Honn3f+k6R6wrkqgTStyQ0bFY+XAaafMRFgUlVeXxXFUcpLEYfZz3FrVUzZrOOJK+4B/wnIZ8TGRvb9OB8EUM0w8uNYj/oa9iK9AMoy6gA72o02srMxpAPUD+EDnVEF7P5xw896VyAbFk8MgnpVpR3gfLnt/wECq3rYFvYLcKCpqvcI+/hVl8AumXDeApklDRRKJSS+KOaq1Rgg4igOYtiQK1hJy46TBtDjznDp3iqJff5j0/LfSZbYVdauqXccJ9W+czupp0sU9gMlqkQ52lU1E6tUwoDUukAD6YRpAwqDrAErzA8QCRvXm98KEep0xIdY1CN1ye27IP0IHvvYIW18qGz8S7VWUZuMkUOb3P8DHTl67ur/i1UAAAAASUVORK5CYII="})]})]}),this.defaultLocale=sf,this.i18nInit(),this.title=this.i18n("pluginNameInstagram"),this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new qe(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionKeysParams:this.opts.companionKeysParams,companionCookiesRule:this.opts.companionCookiesRule,provider:"instagram",pluginId:this.id,supportsRefreshToken:!1}),this.render=this.render.bind(this)}install(){this.view=new Ne(this,{provider:this.provider,viewType:"grid",showTitles:!1,showFilter:!1,showBreadcrumbs:!1});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.view.tearDown(),this.unmount()}render(e){return this.view.render(e)}};var of={name:"@uppy/onedrive",description:"Import files from OneDrive, into Uppy.",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","onedrive"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var nf={strings:{pluginNameOneDrive:"OneDrive"}};var Ri=class extends re{static{o(this,"OneDrive")}static VERSION=of.version;icon;provider;view;storage;files;rootFolderId=null;constructor(e,t){super(e,t),this.type="acquirer",this.files=[],this.storage=this.opts.storage||Te,this.id=this.opts.id||"OneDrive",this.icon=()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("g",{fill:"none",fillRule:"nonzero",children:[l("path",{d:"M13.39 12.888l4.618 2.747 2.752-1.15a4.478 4.478 0 012.073-.352 6.858 6.858 0 00-5.527-5.04 6.895 6.895 0 00-6.876 2.982l.07-.002a5.5 5.5 0 012.89.815z",fill:"#0364B8"}),l("path",{d:"M13.39 12.887v.001a5.5 5.5 0 00-2.89-.815l-.07.002a5.502 5.502 0 00-4.822 2.964 5.43 5.43 0 00.38 5.62l4.073-1.702 1.81-.757 4.032-1.685 2.105-.88-4.619-2.748z",fill:"#0078D4"}),l("path",{d:"M22.833 14.133a4.479 4.479 0 00-2.073.352l-2.752 1.15.798.475 2.616 1.556 1.141.68 3.902 2.321a4.413 4.413 0 00-.022-4.25 4.471 4.471 0 00-3.61-2.284z",fill:"#1490DF"}),l("path",{d:"M22.563 18.346l-1.141-.68-2.616-1.556-.798-.475-2.105.88L11.87 18.2l-1.81.757-4.073 1.702A5.503 5.503 0 0010.5 23h12.031a4.472 4.472 0 003.934-2.333l-3.902-2.321z",fill:"#28A8EA"})]})}),this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new qe(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionKeysParams:this.opts.companionKeysParams,companionCookiesRule:this.opts.companionCookiesRule,provider:"onedrive",pluginId:this.id,supportsRefreshToken:!0}),this.defaultLocale=nf,this.i18nInit(),this.title=this.i18n("pluginNameOneDrive"),this.render=this.render.bind(this)}install(){this.view=new Ne(this,{provider:this.provider,loadAllFiles:!0,virtualList:!0});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.view.tearDown(),this.unmount()}render(e){return this.view.render(e)}};var af={name:"@uppy/unsplash",description:"Import files from Unsplash, the free stock photography resource, into Uppy",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","unsplash"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var lf={strings:{pluginNameUnsplash:"Unsplash"}};var Ui=class extends re{static{o(this,"Unsplash")}static VERSION=af.version;icon;provider;view;storage;files;hostname;constructor(e,t){if(super(e,t),this.type="acquirer",this.files=[],this.storage=this.opts.storage||Te,this.id=this.opts.id||"Unsplash",this.defaultLocale=lf,this.i18nInit(),this.title=this.i18n("pluginNameUnsplash"),this.icon=()=>l("svg",{className:"uppy-DashboardTab-iconUnsplash",viewBox:"0 0 32 32",height:"32",width:"32","aria-hidden":"true",children:l("g",{fill:"currentcolor",children:[l("path",{d:"M46.575 10.883v-9h12v9zm12 5h10v18h-32v-18h10v9h12z"}),l("path",{d:"M13 12.5V8h6v4.5zm6 2.5h5v9H8v-9h5v4.5h6z"})]})}),!this.opts.companionUrl)throw new Error("Companion hostname is required, please consult https://uppy.io/docs/companion");this.hostname=this.opts.companionUrl,this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new bi(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule,provider:"unsplash",pluginId:this.id})}install(){this.view=new ii(this,{provider:this.provider,viewType:"unsplash",showFilter:!0,utmSource:this.opts.utmSource});let{target:e}=this.opts;e&&this.mount(e,this)}render(e){return this.view.render(e)}uninstall(){this.unmount()}};var uf={name:"@uppy/url",description:"The Url plugin lets users import files from the Internet. Paste any URL and it\u2019ll be added!",version:"5.1.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --silent='passed-only'","test:e2e":"vitest run --project browser"},keywords:["file uploader","url","import from url","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/utils":"workspace:^",nanoid:"^5.0.9",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^","@vitest/browser":"^3.2.4",cssnano:"^7.0.7",playwright:"1.57.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"}};var cf={strings:{pluginNameUrl:"Link",import:"Import",enterUrlToImport:"Enter URL to import a file",failedToFetch:"Companion failed to fetch this URL, please make sure it\u2019s correct",enterCorrectUrl:"Incorrect URL: Please make sure you are entering a direct link to a file"}};var _l=class extends Se{static{o(this,"UrlUI")}form=document.createElement("form");input;constructor(e){super(e),this.form.id=Dt()}componentDidMount(){this.input.value="",this.form.addEventListener("submit",this.#e),document.body.appendChild(this.form)}componentWillUnmount(){this.form.removeEventListener("submit",this.#e),document.body.removeChild(this.form)}#e=o(e=>{e.preventDefault();let{addFile:t}=this.props,r=this.input.value.trim();t(r)},"#handleSubmit");render(){let{i18n:e}=this.props;return l("div",{className:"uppy-Url",children:[l("input",{className:"uppy-u-reset uppy-c-textInput uppy-Url-input",type:"text","aria-label":e("enterUrlToImport"),placeholder:e("enterUrlToImport"),ref:o(t=>{this.input=t},"ref"),"data-uppy-super-focusable":!0,form:this.form.id}),l("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Url-importButton",type:"submit",form:this.form.id,children:e("import")})]})}},pf=_l;function an(i,e,t){let r=je(i.items),s;switch(e){case"paste":{if(r.some(a=>a.kind==="file"))return;s=r.filter(a=>a.kind==="string"&&a.type==="text/plain");break}case"drop":{s=r.filter(n=>n.kind==="string"&&n.type==="text/uri-list");break}default:throw new Error(`isDropOrPaste must be either 'drop' or 'paste', but it's ${e}`)}s.forEach(n=>{n.getAsString(a=>t(a))})}o(an,"forEachDroppedOrPastedUrl");function h1(){return l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("path",{d:"M23.637 15.312l-2.474 2.464a3.582 3.582 0 01-.577.491c-.907.657-1.897.986-2.968.986a4.925 4.925 0 01-3.959-1.971c-.248-.329-.164-.902.165-1.149.33-.247.907-.164 1.155.164 1.072 1.478 3.133 1.724 4.618.656a.642.642 0 00.33-.328l2.473-2.463c1.238-1.313 1.238-3.366-.082-4.597a3.348 3.348 0 00-4.618 0l-1.402 1.395a.799.799 0 01-1.154 0 .79.79 0 010-1.15l1.402-1.394a4.843 4.843 0 016.843 0c2.062 1.805 2.144 5.007.248 6.896zm-8.081 5.664l-1.402 1.395a3.348 3.348 0 01-4.618 0c-1.319-1.23-1.319-3.365-.082-4.596l2.475-2.464.328-.328c.743-.492 1.567-.739 2.475-.657.906.165 1.648.574 2.143 1.314.248.329.825.411 1.155.165.33-.248.412-.822.165-1.15-.825-1.068-1.98-1.724-3.216-1.888-1.238-.247-2.556.082-3.628.902l-.495.493-2.474 2.464c-1.897 1.969-1.814 5.09.083 6.977.99.904 2.226 1.396 3.463 1.396s2.473-.492 3.463-1.395l1.402-1.396a.79.79 0 000-1.15c-.33-.328-.908-.41-1.237-.082z",fill:"#FF753E","fill-rule":"nonzero"})})}o(h1,"UrlIcon");function f1(i){let e=/^[a-z0-9]+:\/\//,t="http://";return e.test(i)?i:t+i}o(f1,"addProtocolToURL");function m1(i){return je(i.dataTransfer.items).filter(r=>r.kind==="string"&&r.type==="text/uri-list").length>0}o(m1,"canHandleRootDrop");function g1(i){return i?.startsWith("http://")||i?.startsWith("https://")}o(g1,"checkIfCorrectURL");function y1(i){let{pathname:e}=new URL(i);return e.substring(e.lastIndexOf("/")+1)}o(y1,"getFileNameFromUrl");var si=class i extends re{static{o(this,"Url")}static VERSION=uf.version;static requestClientId=i.name;icon;hostname;client;canHandleRootDrop;constructor(e,t){if(super(e,t),this.id=this.opts.id||"Url",this.type="acquirer",this.icon=()=>l(h1,{}),this.defaultLocale=cf,this.i18nInit(),this.title=this.i18n("pluginNameUrl"),this.hostname=this.opts.companionUrl,!this.hostname)throw new Error("Companion hostname is required, please consult https://uppy.io/docs/companion");this.client=new Je(e,{pluginId:this.id,provider:"url",companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule}),this.uppy.registerRequestClient(i.requestClientId,this.client)}getMeta=o(e=>this.client.post("url/meta",{url:e}),"getMeta");addFile=o(async(e,t)=>{if(e.startsWith("blob"))return;let r=f1(e);if(!g1(r)){this.uppy.log(`[URL] Incorrect URL entered: ${r}`),this.uppy.info(this.i18n("enterCorrectUrl"),"error",4e3);return}this.uppy.log(`[URL] Adding file from dropped/pasted url: ${r}`);try{let s=await this.getMeta(r),n={meta:t,source:this.id,name:s.name||y1(r),type:s.type,data:{size:s.size},isRemote:!0,body:{url:r},remote:{companionUrl:this.opts.companionUrl,url:`${this.hostname}/url/get`,body:{fileId:r,url:r},requestClientId:i.requestClientId}};this.uppy.log("[Url] Adding remote file");try{return this.uppy.addFile(n)}catch(a){return a.isRestriction||this.uppy.log(a),a}}catch(s){return this.uppy.log(s),this.uppy.info({message:this.i18n("failedToFetch"),details:s},"error",4e3),s}},"addFile");handleRootDrop=o(e=>{an(e.dataTransfer,"drop",t=>{this.addFile(t)})},"handleRootDrop");handleRootPaste=o(e=>{an(e.clipboardData,"paste",t=>{this.addFile(t)})},"handleRootPaste");render(){return l(pf,{i18n:this.i18n,addFile:this.addFile})}install(){let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount()}};si.prototype.canHandleRootDrop=m1;var df={name:"@uppy/zoom",description:"Import files from zoom, into Uppy.",version:"4.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","zoom"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var hf={strings:{pluginNameZoom:"Zoom"}};var Oi=class extends re{static{o(this,"Zoom")}static VERSION=df.version;icon;provider;view;storage;files;rootFolderId=null;constructor(e,t){super(e,t),this.type="acquirer",this.files=[],this.storage=this.opts.storage||Te,this.id=this.opts.id||"Zoom",this.icon=()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("path",{d:"M24.5 11.125l-2.75 2.063c-.473.353-.75.91-.75 1.5v3.124c0 .59.277 1.147.75 1.5l2.75 2.063a.938.938 0 001.5-.75v-8.75a.938.938 0 00-1.5-.75zm-4.75 9.5c0 1.035-.84 1.875-1.875 1.875H9.75A3.75 3.75 0 016 18.75v-6.875C6 10.84 6.84 10 7.875 10H16a3.75 3.75 0 013.75 3.75v6.875z",fill:"#2E8CFF","fill-rule":"evenodd"})}),this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new qe(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionKeysParams:this.opts.companionKeysParams,companionCookiesRule:this.opts.companionCookiesRule,provider:"zoom",pluginId:this.id,supportsRefreshToken:!1}),this.defaultLocale=hf,this.i18nInit(),this.title=this.i18n("pluginNameZoom"),this.render=this.render.bind(this)}install(){this.view=new Ne(this,{provider:this.provider});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.view.tearDown(),this.unmount()}render(e){return this.view.render(e)}};var ff={name:"@uppy/remote-sources",description:"Uppy plugin that includes all remote sources that Uppy+Companion offer, like Instagram, Google Drive, Dropox, Box, Unsplash, Url etc",version:"3.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","instagram","google-drive","facebook","dropbox","onedrive","zoom","unsplash","box","url"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/box":"workspace:^","@uppy/dashboard":"workspace:^","@uppy/dropbox":"workspace:^","@uppy/facebook":"workspace:^","@uppy/google-drive":"workspace:^","@uppy/instagram":"workspace:^","@uppy/onedrive":"workspace:^","@uppy/unsplash":"workspace:^","@uppy/url":"workspace:^","@uppy/zoom":"workspace:^"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{"@uppy/core":"workspace:^",jsdom:"^26.1.0","resize-observer-polyfill":"^1.5.1",typescript:"^5.8.3",vitest:"^3.2.4"}};var kl={__proto__:null,Box:xi,Dropbox:Fi,Facebook:Ti,GoogleDrive:Ci,Instagram:Ai,OneDrive:Ri,Unsplash:Ui,Url:si,Zoom:Oi},w1={sources:Object.keys(kl)},ln=class extends Pe{static{o(this,"RemoteSources")}static VERSION=ff.version;#e=new Set;constructor(e,t){if(super(e,{...w1,...t}),this.id=this.opts.id||"RemoteSources",this.type="preset",this.opts.companionUrl==null)throw new Error("Please specify companionUrl for RemoteSources to work, see https://uppy.io/docs/remote-sources#companionUrl")}setOptions(e){this.uninstall(),super.setOptions(e),this.install()}install(){this.opts.sources.forEach(e=>{let{sources:t,...r}=this.opts,s={...r,companionKeysParams:this.opts.companionKeysParams?.[e]},n=kl[e];if(n==null){let a=Object.keys(kl),u=new Intl.ListFormat("en",{style:"long",type:"disjunction"});throw new Error(`Invalid plugin: "${e}" is not one of: ${u.format(a)}.`)}this.uppy.use(n,s),this.#e.add(this.uppy.getPlugin(e))})}uninstall(){for(let e of this.#e)this.uppy.removePlugin(e);this.#e.clear()}};var mf={name:"@uppy/screen-capture",description:"Uppy plugin that captures video from display or application.",version:"5.1.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","screen capture","video","record","mediarecorder"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var gf={strings:{pluginNameScreenCapture:"Screencast",startCapturing:"Begin screen capturing",stopCapturing:"Stop screen capturing",submitRecordedFile:"Submit recorded file",streamActive:"Stream active",streamPassive:"Stream passive",micDisabled:"Microphone access denied by user",recording:"Recording",takeScreenshot:"Take Screenshot",discardMediaFile:"Discard Media"}};function El({onDiscard:i,i18n:e}){return l("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--discard",type:"button",title:e("discardMediaFile"),"aria-label":e("discardMediaFile"),onClick:i,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[l("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}o(El,"DiscardButton");function Fl({recording:i,onStartRecording:e,onStopRecording:t,i18n:r}){return i?l("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video uppy-ScreenCapture-button--stop-rec",type:"button",title:r("stopCapturing"),"aria-label":r("stopCapturing"),onClick:t,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:l("rect",{x:"15",y:"15",width:"70",height:"70"})})}):l("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video",type:"button",title:r("startCapturing"),"aria-label":r("startCapturing"),onClick:e,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:l("path",{d:"M4.5 4.5a3 3 0 0 0-3 3v9a3 3 0 0 0 3 3h8.25a3 3 0 0 0 3-3v-9a3 3 0 0 0-3-3H4.5ZM19.94 18.75l-2.69-2.69V7.94l2.69-2.69c.944-.945 2.56-.276 2.56 1.06v11.38c0 1.336-1.616 2.005-2.56 1.06Z"})})})}o(Fl,"RecordButton");function Tl({onScreenshot:i,i18n:e}){return l("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--screenshot",type:"button",title:e("takeScreenshot"),"aria-label":e("takeScreenshot"),onClick:i,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:[l("path",{d:"M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z"}),l("path",{"fill-rule":"evenodd",d:"M9.344 3.071a49.52 49.52 0 0 1 5.312 0c.967.052 1.83.585 2.332 1.39l.821 1.317c.24.383.645.643 1.11.71.386.054.77.113 1.152.177 1.432.239 2.429 1.493 2.429 2.909V18a3 3 0 0 1-3 3h-15a3 3 0 0 1-3-3V9.574c0-1.416.997-2.67 2.429-2.909.382-.064.766-.123 1.151-.178a1.56 1.56 0 0 0 1.11-.71l.822-1.315a2.942 2.942 0 0 1 2.332-1.39ZM6.75 12.75a5.25 5.25 0 1 1 10.5 0 5.25 5.25 0 0 1-10.5 0Zm12-1.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z","clip-rule":"evenodd"})]})})}o(Tl,"ScreenshotButton");function x1(i){return(i-(i%=60))/60+(i>9?":":":0")+i}o(x1,"fmtMSS");var Cl=class extends Se{static{o(this,"StopWatch")}wrapperStyle={width:"100%",height:"100%",display:"flex"};overlayStyle={position:"absolute",width:"100%",height:"100%",background:"black",opacity:.7};infoContainerStyle={marginLeft:"auto",marginRight:"auto",marginTop:"auto",marginBottom:"auto",zIndex:1,color:"white"};infotextStyle={marginLeft:"auto",marginRight:"auto",marginBottom:"1rem",fontSize:"1.5rem"};timeStyle={display:"block",fontWeight:"bold",marginLeft:"auto",marginRight:"auto",fontSize:"3rem",fontFamily:"Courier New"};timerRunning=!1;timer;constructor(e){super(e),this.state={elapsedTime:0}}startTimer(){this.timerTick(),this.timerRunning=!0}resetTimer(){clearTimeout(this.timer),this.setState({elapsedTime:0}),this.timerRunning=!1}timerTick(){this.timer=setTimeout(()=>{this.setState(e=>({elapsedTime:e.elapsedTime+1})),this.timerTick()},1e3)}render(){let{recording:e,i18n:t}={...this.props},{elapsedTime:r}=this.state,s=x1(r);return e&&!this.timerRunning&&this.startTimer(),!e&&this.timerRunning&&this.resetTimer(),e?l("div",{style:this.wrapperStyle,children:[l("div",{style:this.overlayStyle}),l("div",{style:this.infoContainerStyle,children:[l("div",{style:this.infotextStyle,children:t("recording")}),l("div",{style:this.timeStyle,children:s})]})]}):null}},yf=Cl;function Al({streamActive:i,i18n:e}){return i?l("div",{title:e("streamActive"),className:"uppy-ScreenCapture-icon--stream uppy-ScreenCapture-icon--streamActive",children:l("svg",{"aria-hidden":"true",focusable:"false",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M0 0h24v24H0z",opacity:".1",fill:"none"}),l("path",{d:"M0 0h24v24H0z",fill:"none"}),l("path",{d:"M1 18v3h3c0-1.66-1.34-3-3-3zm0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7zm18-7H5v1.63c3.96 1.28 7.09 4.41 8.37 8.37H19V7zM1 10v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11zm20-7H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})]})}):l("div",{title:e("streamPassive"),className:"uppy-ScreenCapture-icon--stream",children:l("svg",{"aria-hidden":"true",focusable:"false",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M0 0h24v24H0z",opacity:".1",fill:"none"}),l("path",{d:"M0 0h24v24H0z",fill:"none"}),l("path",{d:"M21 3H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM1 18v3h3c0-1.66-1.34-3-3-3zm0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7zm0-4v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11z"})]})})}o(Al,"StreamStatus");function Rl({recording:i,recordedVideo:e,onSubmit:t,capturedScreenshotUrl:r,i18n:s}){return(e||r)&&!i?l("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--submit",type:"button",title:s("submitRecordedFile"),"aria-label":s("submitRecordedFile"),onClick:t,"data-uppy-super-focusable":!0,children:l("svg",{width:"12",height:"9",viewBox:"0 0 12 9",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon",children:l("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})})}):null}o(Rl,"SubmitButton");var Ul=class extends Se{static{o(this,"RecorderScreen")}videoElement=null;componentWillUnmount(){let{onStop:e}=this.props;e()}render(){let{recording:e,stream:t,recordedVideo:r,enableScreenshots:s,capturedScreenshotUrl:n}=this.props,a={playsinline:!0};return(e||!r&&!e)&&(a.muted=!0,a.autoplay=!0,a.srcObject=t),r&&!e&&(a.muted=!1,a.controls=!0,a.src=r,this.videoElement&&(this.videoElement.srcObject=null)),l("div",{className:"uppy uppy-ScreenCapture-container",children:[l("div",{className:"uppy-ScreenCapture-mediaContainer",children:[l(Al,{...this.props}),n&&!e&&!r?l("div",{className:"uppy-ScreenCapture-imageContainer",children:l("img",{src:n,className:"uppy-ScreenCapture-media",alt:"screenshotPreview"})}):l("video",{ref:o(u=>{this.videoElement=u},"ref"),className:"uppy-ScreenCapture-media",...a}),l("div",{children:l(yf,{...this.props})})]}),l("div",{className:"uppy-ScreenCapture-buttonContainer",children:r||n?l(Re,{children:[l(Rl,{...this.props}),l(El,{...this.props})]}):l(Re,{children:[s&&!e&&l(Tl,{...this.props}),l(Fl,{...this.props})]})})]})}},vf=Ul;function Ol(){return l("svg",{className:"uppy-DashboardTab-iconScreenRec","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("g",{fill:"currentcolor",fillRule:"evenodd",children:[l("path",{d:"M24.182 9H7.818C6.81 9 6 9.742 6 10.667v10c0 .916.81 1.666 1.818 1.666h4.546V24h7.272v-1.667h4.546c1 0 1.809-.75 1.809-1.666l.009-10C26 9.742 25.182 9 24.182 9zM24 21H8V11h16v10z"}),l("circle",{cx:"16",cy:"16",r:"2"})]})})}o(Ol,"ScreenRecIcon");function P1(){return window.MediaRecorder&&navigator.mediaDevices?.getDisplayMedia}o(P1,"isScreenRecordingSupported");function _1(){return window.MediaRecorder&&navigator.mediaDevices}o(_1,"getMediaDevices");var k1=["image/png","image/jpeg","image/webp"],E1={displayMediaConstraints:{video:{width:1280,height:720,frameRate:{ideal:3,max:5},cursor:"motion",displaySurface:"monitor"}},userMediaConstraints:{audio:!0},preferredVideoMimeType:"video/webm",preferredImageMimeType:"image/png",enableScreenshots:!0},Ns=class extends re{static{o(this,"ScreenCapture")}static VERSION=mf.version;mediaDevices;protocol;icon;streamInterrupted;captureActive;capturedMediaFile;videoStream=null;audioStream=null;userDenied=!1;recorder=null;outputStream=null;recordingChunks=null;constructor(e,t){super(e,{...E1,...t}),this.mediaDevices=_1(),this.protocol=location.protocol==="https:"?"https":"http",this.id=this.opts.id||"ScreenCapture",this.type="acquirer",this.icon=Ol,this.defaultLocale=gf,this.i18nInit(),this.title=this.i18n("pluginNameScreenCapture"),this.install=this.install.bind(this),this.setPluginState=this.setPluginState.bind(this),this.render=this.render.bind(this),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.startRecording=this.startRecording.bind(this),this.stopRecording=this.stopRecording.bind(this),this.submit=this.submit.bind(this),this.streamInterrupted=this.streamInactivated.bind(this),this.captureScreenshot=this.captureScreenshot.bind(this),this.discardRecordedMedia=this.discardRecordedMedia.bind(this),this.captureActive=!1,this.capturedMediaFile=null,this.setPluginState({streamActive:!1,audioStreamActive:!1,recording:!1,recordedVideo:null,screenRecError:null,capturedScreenshotUrl:null,status:"init"})}install(){if(!P1())return this.uppy.log("Screen recorder access is not supported","warning"),null;this.setPluginState({streamActive:!1,audioStreamActive:!1,status:"init"});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.videoStream&&this.stop(),this.unmount()}start(){return this.mediaDevices?(this.captureActive=!0,this.selectAudioStreamSource(),this.selectVideoStreamSource().then(e=>{e===!1&&this.parent?.hideAllPanels&&(this.parent.hideAllPanels(),this.captureActive=!1)})):Promise.reject(new Error("Screen recorder access not supported"))}selectVideoStreamSource(){return this.videoStream?new Promise(e=>e(this.videoStream)):this.mediaDevices.getDisplayMedia(this.opts.displayMediaConstraints).then(e=>(this.videoStream=e,this.videoStream.addEventListener("inactive",()=>{this.streamInactivated()}),this.setPluginState({streamActive:!0,status:"ready",screenRecError:null}),e)).catch(e=>(this.setPluginState({screenRecError:e,status:"error"}),this.userDenied=!0,setTimeout(()=>{this.userDenied=!1},1e3),!1))}selectAudioStreamSource(){return this.audioStream?new Promise(e=>e(this.audioStream)):this.mediaDevices.getUserMedia(this.opts.userMediaConstraints).then(e=>(this.audioStream=e,this.setPluginState({audioStreamActive:!0}),e)).catch(e=>(e.name==="NotAllowedError"&&(this.uppy.info(this.i18n("micDisabled"),"error",5e3),this.uppy.log(this.i18n("micDisabled"),"warning")),!1))}startRecording(){let e={};this.capturedMediaFile=null,this.recordingChunks=[];let{preferredVideoMimeType:t}=this.opts;this.selectVideoStreamSource().then(r=>{if(r===!1)throw new Error("No video stream available");t&&MediaRecorder.isTypeSupported(t)&&xt(t)&&(e.mimeType=t);let s=[r.getVideoTracks()[0]];this.audioStream&&s.push(this.audioStream.getAudioTracks()[0]),this.outputStream=new MediaStream(s),this.recorder=new MediaRecorder(this.outputStream,e),this.recorder.addEventListener("dataavailable",n=>{this.recordingChunks.push(n.data)}),this.recorder.start(),this.setPluginState({recording:!0,status:"recording"})}).catch(r=>{this.uppy.log(r,"error"),this.setPluginState({screenRecError:r,status:"error"})})}streamInactivated(){let{recordedVideo:e,recording:t}={...this.getPluginState()};!e&&!t?(this.parent?.hideAllPanels&&this.parent.hideAllPanels(),this.setPluginState({status:"init"})):t&&(this.uppy.log("Capture stream inactive \u2014 stop recording"),this.stopRecording()),this.videoStream=null,this.audioStream=null,this.setPluginState({streamActive:!1,audioStreamActive:!1})}stopRecording(){return new Promise(t=>{this.recorder.addEventListener("stop",()=>{t()}),this.recorder.stop()}).then(()=>(this.setPluginState({recording:!1}),this.getVideo())).then(t=>{this.capturedMediaFile=t,this.setPluginState({recordedVideo:URL.createObjectURL(t.data),status:"captured"})}).then(()=>{this.recordingChunks=null,this.recorder=null},t=>{throw this.recordingChunks=null,this.recorder=null,t})}discardRecordedMedia(){let{capturedScreenshotUrl:e,recordedVideo:t}=this.getPluginState();e&&URL.revokeObjectURL(e),t&&URL.revokeObjectURL(t),this.capturedMediaFile=null,this.setPluginState({recordedVideo:null,capturedScreenshotUrl:null,status:this.getPluginState().streamActive?"ready":"init"})}submit(){try{this.capturedMediaFile&&this.uppy.addFile(this.capturedMediaFile)}catch(e){e.isRestriction||this.uppy.log(e,"warning")}}stop(){this.videoStream&&(this.videoStream.getVideoTracks().forEach(r=>{r.stop()}),this.videoStream.getAudioTracks().forEach(r=>{r.stop()}),this.videoStream=null),this.audioStream&&(this.audioStream.getAudioTracks().forEach(r=>{r.stop()}),this.audioStream.getVideoTracks().forEach(r=>{r.stop()}),this.audioStream=null),this.outputStream&&(this.outputStream.getAudioTracks().forEach(r=>{r.stop()}),this.outputStream.getVideoTracks().forEach(r=>{r.stop()}),this.outputStream=null);let{capturedScreenshotUrl:e,recordedVideo:t}=this.getPluginState();e&&URL.revokeObjectURL(e),t&&URL.revokeObjectURL(t),this.setPluginState({recording:!1,streamActive:!1,audioStreamActive:!1,recordedVideo:null,capturedScreenshotUrl:null,status:"init"}),this.captureActive=!1}getVideo(){let e=this.recordingChunks[0].type,t=xt(e);if(!t)return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type "${e}"`));let r=`screencap-${Date.now()}.${t}`,s=new Blob(this.recordingChunks,{type:e}),n={source:this.id,name:r,data:new Blob([s],{type:e}),type:e};return Promise.resolve(n)}async captureScreenshot(){if(!this.mediaDevices?.getDisplayMedia)throw new Error("Screen capture is not supported");try{let e=this.videoStream;if(!e){let u=await this.selectVideoStreamSource();if(!u)throw new Error("Failed to get screen capture stream");e=u}let t=document.createElement("video");t.srcObject=e,await new Promise(u=>{t.onloadedmetadata=()=>{t.play(),u(null)}});let r=document.createElement("canvas");r.width=t.videoWidth,r.height=t.videoHeight;let s=r.getContext("2d");if(!s)throw new Error("Failed to get canvas context");s.drawImage(t,0,0,r.width,r.height);let n=this.opts.preferredImageMimeType;(!n||!k1.includes(n))&&(this.uppy.log(`Unsupported image type "${n}", falling back to image/png`,"warning"),n="image/png");let a=1;return new Promise((u,c)=>{r.toBlob(p=>{if(!p){c(new Error("Failed to create screenshot blob"));return}let f=xt(n)||"png",d={source:this.id,name:`Screenshot ${new Date().toISOString()}.${f}`,type:n,data:p};try{this.capturedMediaFile=d;let v=URL.createObjectURL(p);this.setPluginState({capturedScreenshotUrl:v,status:"captured"}),u()}catch(v){this.getPluginState().capturedScreenshotUrl&&this.setPluginState({capturedScreenshotUrl:null}),v.isRestriction||this.uppy.log(v,"error"),c(v)}finally{t.srcObject=null,r.remove(),t.remove()}},n,a)})}catch(e){throw this.uppy.log(e,"error"),e}}render(){let e=this.getPluginState();return!e.streamActive&&!this.captureActive&&!this.userDenied&&this.start(),l(vf,{...e,onStartRecording:this.startRecording,onStopRecording:this.stopRecording,enableScreenshots:this.opts.enableScreenshots,onScreenshot:this.captureScreenshot,onStop:this.stop,onSubmit:this.submit,i18n:this.i18n,stream:this.videoStream,onDiscard:this.discardRecordedMedia})}};var bf={name:"@uppy/status-bar",description:"A progress bar for Uppy, with many bells and whistles.",version:"5.1.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","progress bar","status bar","progress","upload","eta","speed"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/utils":"workspace:^",classnames:"^2.2.6",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var wf={strings:{uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",paused:"Paused",retry:"Retry",cancel:"Cancel",pause:"Pause",resume:"Resume",done:"Done",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",dataUploadedOfUnknown:"%{complete} of unknown",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},upload:"Upload",retryUpload:"Retry upload",xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},showErrorDetails:"Show error details",failedToAddFiles:"Failed to add files"}};var yt={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};var Ll=ae(Ge(),1);var Dl=ae(Zi(),1);var Il=ae(Ge(),1);var T1="\xB7",Sf=o(()=>` ${T1} `,"renderDot");function xf(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:a,startUpload:u}=i,c=(0,Il.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":n===yt.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":a}),p=e&&t&&!r?s("uploadXNewFiles",{smart_count:e}):s("uploadXFiles",{smart_count:e});return l("button",{type:"button",className:c,"aria-label":s("uploadXFiles",{smart_count:e}),onClick:u,disabled:a,"data-uppy-super-focusable":!0,children:p})}o(xf,"UploadBtn");function Pf(i){let{i18n:e,uppy:t}=i;return l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e("retryUpload"),onClick:o(()=>t.retryAll().catch(()=>{}),"onClick"),"data-uppy-super-focusable":!0,"data-cy":"retry",children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10",children:l("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})}),e("retry")]})}o(Pf,"RetryBtn");function _f(i){let{i18n:e,uppy:t}=i;return l("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e("cancel"),"aria-label":e("cancel"),onClick:o(()=>t.cancelAll(),"onClick"),"data-cy":"cancel","data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:l("g",{fill:"none",fillRule:"evenodd",children:[l("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),l("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"})]})})})}o(_f,"CancelBtn");function kf(i){let{isAllPaused:e,i18n:t,isAllComplete:r,resumableUploads:s,uppy:n}=i,a=t(e?"resume":"pause");function u(){if(!r){if(!s){n.cancelAll();return}if(e){n.resumeAll();return}n.pauseAll()}}return o(u,"togglePauseResume"),l("button",{title:a,"aria-label":a,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:u,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:l("g",{fill:"none",fillRule:"evenodd",children:[l("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),l("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"})]})})})}o(kf,"PauseResumeButton");function Ef(i){let{i18n:e,doneButtonHandler:t}=i;return l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:t,"data-uppy-super-focusable":!0,children:e("done")})}o(Ef,"DoneBtn");function Ff(){return l("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14",children:l("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"})})}o(Ff,"LoadingSpinner");function Tf(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return l("div",{className:"uppy-StatusBar-content",children:[l(Ff,{}),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s]})}o(Tf,"ProgressBarProcessing");function C1(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:a}=i,u=e>1,c=(0,Dl.default)(r);return l("div",{className:"uppy-StatusBar-statusSecondary",children:[u&&a("filesUploadedOfTotal",{complete:t,smart_count:e}),l("span",{className:"uppy-StatusBar-additionalInfo",children:[u&&Sf(),s!=null?a("dataUploadedOfTotal",{complete:c,total:(0,Dl.default)(s)}):a("dataUploadedOfUnknown",{complete:c}),Sf(),n!=null&&a("xTimeLeft",{time:Xi(n)})]})]})}o(C1,"ProgressDetails");function Cf(i){let{i18n:e,complete:t,numUploads:r}=i;return l("div",{className:"uppy-StatusBar-statusSecondary",children:e("filesUploadedOfTotal",{complete:t,smart_count:r})})}o(Cf,"FileUploadCount");function A1(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,Il.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return l("div",{className:"uppy-StatusBar-statusSecondary",children:[l("div",{className:"uppy-StatusBar-statusSecondaryHint",children:e("xMoreFilesAdded",{smart_count:t})}),l("button",{type:"button",className:s,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:r,children:e("upload")})]})}o(A1,"UploadNewlyAddedFiles");function Af(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,showProgressDetails:s,isUploadStarted:n,isAllComplete:a,isAllPaused:u,newFiles:c,numUploads:p,complete:f,totalUploadedSize:d,totalSize:v,totalETA:_,startUpload:k}=i,A=c&&n;if(!n||a)return null;let F=e(u?"paused":"uploading");function R(){return!u&&!A&&s?t?l(C1,{numUploads:p,complete:f,totalUploadedSize:d,totalSize:v,totalETA:_,i18n:e}):l(Cf,{i18n:e,complete:f,numUploads:p}):null}return o(R,"renderProgressDetails"),l("div",{className:"uppy-StatusBar-content",title:F,children:[u?null:l(Ff,{}),l("div",{className:"uppy-StatusBar-status",children:[l("div",{className:"uppy-StatusBar-statusPrimary",children:t&&r!==0?`${F}: ${r}%`:F}),R(),A?l(A1,{i18n:e,newFiles:c,startUpload:k}):null]})]})}o(Af,"ProgressBarUploading");function Rf(i){let{i18n:e}=i;return l("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete"),children:l("div",{className:"uppy-StatusBar-status",children:l("div",{className:"uppy-StatusBar-statusPrimary",children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11",children:l("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})}),e("complete")]})})})}o(Rf,"ProgressBarComplete");function Uf(i){let{error:e,i18n:t,complete:r,numUploads:s}=i;function n(){let a=`${t("uploadFailed")}
${e}`;alert(a)}return o(n,"displayErrorAlert"),l("div",{className:"uppy-StatusBar-content",title:t("uploadFailed"),children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11",children:l("path",{d:"M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z"})}),l("div",{className:"uppy-StatusBar-status",children:[l("div",{className:"uppy-StatusBar-statusPrimary",children:[t("uploadFailed"),l("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":t("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:n,type:"button",children:"?"})]}),l(Cf,{i18n:t,complete:r,numUploads:s})]})]})}o(Uf,"ProgressBarError");function Ms(i){let e=[],t="indeterminate",r;for(let{progress:n}of Object.values(i)){let{preprocess:a,postprocess:u}=n;r==null&&(a||u)&&({mode:t,message:r}=a||u),a?.mode==="determinate"&&e.push(a.value),u?.mode==="determinate"&&e.push(u.value)}let s=e.reduce((n,a)=>n+a/e.length,0);return{mode:t,message:r,value:s}}o(Ms,"calculateProcessingProgress");var{STATE_ERROR:Of,STATE_WAITING:R1,STATE_PREPROCESSING:Nl,STATE_UPLOADING:un,STATE_POSTPROCESSING:Ml,STATE_COMPLETE:cn}=yt;function Bl({newFiles:i,allowNewUpload:e,isUploadInProgress:t,isAllPaused:r,resumableUploads:s,error:n,hideUploadButton:a=void 0,hidePauseResumeButton:u=!1,hideCancelButton:c=!1,hideRetryButton:p=!1,recoveredState:f,uploadState:d,totalProgress:v,files:_,supportsUploadProgress:k,hideAfterFinish:A=!1,isSomeGhost:F,doneButtonHandler:R=void 0,isUploadStarted:U,i18n:C,startUpload:Y,uppy:$,isAllComplete:H,showProgressDetails:Q=void 0,numUploads:K,complete:Z,totalSize:ye,totalETA:se,totalUploadedSize:we}){function me(){switch(d){case Ml:case Nl:{let ne=Ms(_);return ne.mode==="determinate"?ne.value*100:v}case Of:return null;case un:return k?v:null;default:return v}}o(me,"getProgressValue");function _e(){switch(d){case Ml:case Nl:{let{mode:ne}=Ms(_);return ne==="indeterminate"}case un:return!k;default:return!1}}o(_e,"getIsIndeterminate");let ve=me(),E=ve??100,w=!n&&i&&(!t&&!r||f)&&e&&!a,S=!c&&d!==R1&&d!==cn,B=s&&!u&&d===un,q=n&&!H&&!p,j=R&&d===cn,I=(0,Ll.default)("uppy-StatusBar-progress",{"is-indeterminate":_e()}),T=(0,Ll.default)("uppy-StatusBar",`is-${d}`,{"has-ghosts":F}),O=(()=>{switch(d){case Nl:case Ml:return l(Tf,{progress:Ms(_)});case cn:return l(Rf,{i18n:C});case Of:return l(Uf,{error:n,i18n:C,numUploads:K,complete:Z});case un:return l(Af,{i18n:C,supportsUploadProgress:k,totalProgress:v,showProgressDetails:Q,isUploadStarted:U,isAllComplete:H,isAllPaused:r,newFiles:i,numUploads:K,complete:Z,totalUploadedSize:we,totalSize:ye,totalETA:se,startUpload:Y});default:return null}})();return!(w||q||B||S||j)&&!O||d===cn&&A?null:l("div",{className:T,children:[l("div",{className:I,style:{width:`${E}%`},role:"progressbar","aria-label":`${E}%`,"aria-valuetext":`${E}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":ve}),O,l("div",{className:"uppy-StatusBar-actions",children:[w?l(xf,{newFiles:i,isUploadStarted:U,recoveredState:f,i18n:C,isSomeGhost:F,startUpload:Y,uploadState:d}):null,q?l(Pf,{i18n:C,uppy:$}):null,B?l(kf,{isAllPaused:r,i18n:C,isAllComplete:H,resumableUploads:s,uppy:$}):null,S?l(_f,{i18n:C,uppy:$}):null,j?l(Ef,{i18n:C,doneButtonHandler:R}):null]})]})}o(Bl,"StatusBarUI");var U1=2e3,O1=2e3;function D1(i,e,t,r){if(i)return yt.STATE_ERROR;if(e)return yt.STATE_COMPLETE;if(t)return yt.STATE_WAITING;let s=yt.STATE_WAITING,n=Object.keys(r);for(let a=0;a<n.length;a++){let{progress:u}=r[n[a]];if(u.uploadStarted&&!u.uploadComplete)return yt.STATE_UPLOADING;u.preprocess&&(s=yt.STATE_PREPROCESSING),u.postprocess&&s!==yt.STATE_PREPROCESSING&&(s=yt.STATE_POSTPROCESSING)}return s}o(D1,"getUploadingState");var I1={hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideCancelButton:!1,showProgressDetails:!1,hideAfterFinish:!0,doneButtonHandler:null},Ls=class extends re{static{o(this,"StatusBar")}static VERSION=bf.version;#e;#t;#r;#i;constructor(e,t){super(e,{...I1,...t}),this.id=this.opts.id||"StatusBar",this.title="StatusBar",this.type="progressindicator",this.defaultLocale=wf,this.i18nInit(),this.render=this.render.bind(this),this.install=this.install.bind(this)}#s(e){if(e.total==null||e.total===0)return null;let t=e.total-e.uploaded;if(t<=0)return null;this.#e??=performance.now();let r=performance.now()-this.#e;if(r===0)return Math.round((this.#i??0)/100)/10;let s=e.uploaded-this.#t;if(this.#t=e.uploaded,s<=0)return Math.round((this.#i??0)/100)/10;let n=s/r,a=this.#r==null?n:Jt(n,this.#r,U1,r);this.#r=a;let u=t/a,c=Math.max(this.#i-r,0),p=this.#i==null?u:Jt(u,c,O1,r);return this.#i=p,this.#e=performance.now(),Math.round(p/100)/10}startUpload=o(()=>this.uppy.upload().catch((()=>{})),"startUpload");render(e){let{capabilities:t,files:r,allowNewUpload:s,totalProgress:n,error:a,recoveredState:u}=e,{newFiles:c,startedFiles:p,completeFiles:f,isUploadStarted:d,isAllComplete:v,isAllPaused:_,isUploadInProgress:k,isSomeGhost:A}=this.uppy.getObjectOfFilesPerState(),F=u?Object.values(r):c,R=!!t.resumableUploads,U=t.uploadProgress!==!1,C=null,Y=0;p.every(H=>H.progress.bytesTotal!=null&&H.progress.bytesTotal!==0)?(C=0,p.forEach(H=>{C+=H.progress.bytesTotal||0,Y+=H.progress.bytesUploaded||0})):p.forEach(H=>{Y+=H.progress.bytesUploaded||0});let $=this.#s({uploaded:Y,total:C});return Bl({error:a,uploadState:D1(a,v,u,e.files||{}),allowNewUpload:s,totalProgress:n,totalSize:C,totalUploadedSize:Y,isAllComplete:!1,isAllPaused:_,isUploadStarted:d,isUploadInProgress:k,isSomeGhost:A,recoveredState:u,complete:f.length,newFiles:F.length,numUploads:p.length,totalETA:$,files:r,i18n:this.i18n,uppy:this.uppy,startUpload:this.startUpload,doneButtonHandler:this.opts.doneButtonHandler,resumableUploads:R,supportsUploadProgress:U,showProgressDetails:this.opts.showProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,hideAfterFinish:this.opts.hideAfterFinish})}onMount(){let e=this.el;Mr(e)||(e.dir="ltr")}#l=o(()=>{let{recoveredState:e}=this.uppy.getState();if(this.#r=null,this.#i=null,e){this.#t=Object.values(e.files).reduce((t,{progress:r})=>t+r.bytesUploaded,0),this.uppy.emit("restore-confirmed");return}this.#e=performance.now(),this.#t=0},"#onUploadStart");install(){let{target:e}=this.opts;e&&this.mount(e,this),this.uppy.on("upload",this.#l),this.#e=performance.now(),this.#t=this.uppy.getFiles().reduce((t,r)=>t+r.progress.bytesUploaded,0)}uninstall(){this.unmount(),this.uppy.off("upload",this.#l)}};function gr(i){"@babel/helpers - typeof";return gr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gr(i)}o(gr,"_typeof");function Df(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,M1(r.key),r)}}o(Df,"_defineProperties");function N1(i,e,t){return e&&Df(i.prototype,e),t&&Df(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(N1,"_createClass");function M1(i){var e=L1(i,"string");return gr(e)=="symbol"?e:e+""}o(M1,"_toPropertyKey");function L1(i,e){if(gr(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(gr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(L1,"_toPrimitive");function B1(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(B1,"_classCallCheck");function j1(i,e,t){return e=js(e),z1(i,zl()?Reflect.construct(e,t||[],js(i).constructor):e.apply(i,t))}o(j1,"_callSuper");function z1(i,e){if(e&&(gr(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return H1(i)}o(z1,"_possibleConstructorReturn");function H1(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}o(H1,"_assertThisInitialized");function q1(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&Bs(i,e)}o(q1,"_inherits");function jl(i){var e=typeof Map=="function"?new Map:void 0;return jl=o(function(r){if(r===null||!$1(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,s)}function s(){return V1(r,arguments,js(this).constructor)}return o(s,"Wrapper"),s.prototype=Object.create(r.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),Bs(s,r)},"_wrapNativeSuper"),jl(i)}o(jl,"_wrapNativeSuper");function V1(i,e,t){if(zl())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var s=new(i.bind.apply(i,r));return t&&Bs(s,t.prototype),s}o(V1,"_construct");function zl(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zl=o(function(){return!!i},"_isNativeReflectConstruct"))()}o(zl,"_isNativeReflectConstruct");function $1(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}o($1,"_isNativeFunction");function Bs(i,e){return Bs=Object.setPrototypeOf?Object.setPrototypeOf.bind():o(function(r,s){return r.__proto__=s,r},"_setPrototypeOf"),Bs(i,e)}o(Bs,"_setPrototypeOf");function js(i){return js=Object.setPrototypeOf?Object.getPrototypeOf.bind():o(function(t){return t.__proto__||Object.getPrototypeOf(t)},"_getPrototypeOf"),js(i)}o(js,"_getPrototypeOf");var W1=(function(i){function e(t){var r,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(B1(this,e),r=j1(this,e,[t]),r.originalRequest=n,r.originalResponse=a,r.causingError=s,s!=null&&(t+=", caused by ".concat(s.toString())),n!=null){var u=n.getHeader("X-Request-ID")||"n/a",c=n.getMethod(),p=n.getURL(),f=a?a.getStatus():"n/a",d=a?a.getBody()||"":"n/a";t+=", originated from request (method: ".concat(c,", url: ").concat(p,", response code: ").concat(f,", response text: ").concat(d,", request id: ").concat(u,")")}return r.message=t,r}return o(e,"DetailedError"),q1(e,i),N1(e)})(jl(Error)),yr=W1;var G1=!1;function oi(i){G1&&console.log(i)}o(oi,"log");function zs(i){"@babel/helpers - typeof";return zs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zs(i)}o(zs,"_typeof");function K1(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(K1,"_classCallCheck");function If(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,Y1(r.key),r)}}o(If,"_defineProperties");function X1(i,e,t){return e&&If(i.prototype,e),t&&If(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(X1,"_createClass");function Y1(i){var e=J1(i,"string");return zs(e)=="symbol"?e:e+""}o(Y1,"_toPropertyKey");function J1(i,e){if(zs(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(zs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(J1,"_toPrimitive");var Nf=(function(){function i(){K1(this,i)}return o(i,"NoopUrlStorage"),X1(i,[{key:"listAllUploads",value:o(function(){return Promise.resolve([])},"listAllUploads")},{key:"findUploadsByFingerprint",value:o(function(t){return Promise.resolve([])},"findUploadsByFingerprint")},{key:"removeUpload",value:o(function(t){return Promise.resolve()},"removeUpload")},{key:"addUpload",value:o(function(t,r){return Promise.resolve(null)},"addUpload")}])})();var Hf="3.7.7",Q1=Hf,br=typeof Buffer=="function",Mf=typeof TextDecoder=="function"?new TextDecoder:void 0,Lf=typeof TextEncoder=="function"?new TextEncoder:void 0,Z1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Hs=Array.prototype.slice.call(Z1),pn=(i=>{let e={};return i.forEach((t,r)=>e[t]=r),e})(Hs),ew=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Qe=String.fromCharCode.bind(String),Bf=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):i=>new Uint8Array(Array.prototype.slice.call(i,0)),qf=o(i=>i.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),"_mkUriSafe"),Vf=o(i=>i.replace(/[^A-Za-z0-9\+\/]/g,""),"_tidyB64"),$f=o(i=>{let e,t,r,s,n="",a=i.length%3;for(let u=0;u<i.length;){if((t=i.charCodeAt(u++))>255||(r=i.charCodeAt(u++))>255||(s=i.charCodeAt(u++))>255)throw new TypeError("invalid character found");e=t<<16|r<<8|s,n+=Hs[e>>18&63]+Hs[e>>12&63]+Hs[e>>6&63]+Hs[e&63]}return a?n.slice(0,a-3)+"===".substring(a):n},"btoaPolyfill"),Vl=typeof btoa=="function"?i=>btoa(i):br?i=>Buffer.from(i,"binary").toString("base64"):$f,Hl=br?i=>Buffer.from(i).toString("base64"):i=>{let t=[];for(let r=0,s=i.length;r<s;r+=4096)t.push(Qe.apply(null,i.subarray(r,r+4096)));return Vl(t.join(""))},dn=o((i,e=!1)=>e?qf(Hl(i)):Hl(i),"fromUint8Array"),tw=o(i=>{if(i.length<2){var e=i.charCodeAt(0);return e<128?i:e<2048?Qe(192|e>>>6)+Qe(128|e&63):Qe(224|e>>>12&15)+Qe(128|e>>>6&63)+Qe(128|e&63)}else{var e=65536+(i.charCodeAt(0)-55296)*1024+(i.charCodeAt(1)-56320);return Qe(240|e>>>18&7)+Qe(128|e>>>12&63)+Qe(128|e>>>6&63)+Qe(128|e&63)}},"cb_utob"),iw=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Wf=o(i=>i.replace(iw,tw),"utob"),jf=br?i=>Buffer.from(i,"utf8").toString("base64"):Lf?i=>Hl(Lf.encode(i)):i=>Vl(Wf(i)),vr=o((i,e=!1)=>e?qf(jf(i)):jf(i),"encode"),zf=o(i=>vr(i,!0),"encodeURI"),rw=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,sw=o(i=>{switch(i.length){case 4:var e=(7&i.charCodeAt(0))<<18|(63&i.charCodeAt(1))<<12|(63&i.charCodeAt(2))<<6|63&i.charCodeAt(3),t=e-65536;return Qe((t>>>10)+55296)+Qe((t&1023)+56320);case 3:return Qe((15&i.charCodeAt(0))<<12|(63&i.charCodeAt(1))<<6|63&i.charCodeAt(2));default:return Qe((31&i.charCodeAt(0))<<6|63&i.charCodeAt(1))}},"cb_btou"),Gf=o(i=>i.replace(rw,sw),"btou"),Kf=o(i=>{if(i=i.replace(/\s+/g,""),!ew.test(i))throw new TypeError("malformed base64.");i+="==".slice(2-(i.length&3));let e,t="",r,s;for(let n=0;n<i.length;)e=pn[i.charAt(n++)]<<18|pn[i.charAt(n++)]<<12|(r=pn[i.charAt(n++)])<<6|(s=pn[i.charAt(n++)]),t+=r===64?Qe(e>>16&255):s===64?Qe(e>>16&255,e>>8&255):Qe(e>>16&255,e>>8&255,e&255);return t},"atobPolyfill"),$l=typeof atob=="function"?i=>atob(Vf(i)):br?i=>Buffer.from(i,"base64").toString("binary"):Kf,Xf=br?i=>Bf(Buffer.from(i,"base64")):i=>Bf($l(i).split("").map(e=>e.charCodeAt(0))),Yf=o(i=>Xf(Jf(i)),"toUint8Array"),ow=br?i=>Buffer.from(i,"base64").toString("utf8"):Mf?i=>Mf.decode(Xf(i)):i=>Gf($l(i)),Jf=o(i=>Vf(i.replace(/[-_]/g,e=>e=="-"?"+":"/")),"_unURI"),ql=o(i=>ow(Jf(i)),"decode"),nw=o(i=>{if(typeof i!="string")return!1;let e=i.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},"isValid"),Qf=o(i=>({value:i,enumerable:!1,writable:!0,configurable:!0}),"_noEnum"),Zf=o(function(){let i=o((e,t)=>Object.defineProperty(String.prototype,e,Qf(t)),"_add");i("fromBase64",function(){return ql(this)}),i("toBase64",function(e){return vr(this,e)}),i("toBase64URI",function(){return vr(this,!0)}),i("toBase64URL",function(){return vr(this,!0)}),i("toUint8Array",function(){return Yf(this)})},"extendString"),em=o(function(){let i=o((e,t)=>Object.defineProperty(Uint8Array.prototype,e,Qf(t)),"_add");i("toBase64",function(e){return dn(this,e)}),i("toBase64URI",function(){return dn(this,!0)}),i("toBase64URL",function(){return dn(this,!0)})},"extendUint8Array"),aw=o(()=>{Zf(),em()},"extendBuiltins"),tm={version:Hf,VERSION:Q1,atob:$l,atobPolyfill:Kf,btoa:Vl,btoaPolyfill:$f,fromBase64:ql,toBase64:vr,encode:vr,encodeURI:zf,encodeURL:zf,utob:Wf,btou:Gf,decode:ql,isValid:nw,fromUint8Array:dn,toUint8Array:Yf,extendString:Zf,extendUint8Array:em,extendBuiltins:aw};var Fm=ae(fm());function Xl(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var e=Math.random()*16|0,t=i==="x"?e:e&3|8;return t.toString(16)})}o(Xl,"uuid");function Yl(){"use strict";Yl=o(function(){return e},"_regeneratorRuntime");var i,e={},t=Object.prototype,r=t.hasOwnProperty,s=Object.defineProperty||function(E,w,S){E[w]=S.value},n=typeof Symbol=="function"?Symbol:{},a=n.iterator||"@@iterator",u=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function p(E,w,S){return Object.defineProperty(E,w,{value:S,enumerable:!0,configurable:!0,writable:!0}),E[w]}o(p,"define");try{p({},"")}catch{p=o(function(S,B,q){return S[B]=q},"define")}function f(E,w,S,B){var q=w&&w.prototype instanceof R?w:R,j=Object.create(q.prototype),I=new _e(B||[]);return s(j,"_invoke",{value:ye(E,S,I)}),j}o(f,"wrap");function d(E,w,S){try{return{type:"normal",arg:E.call(w,S)}}catch(B){return{type:"throw",arg:B}}}o(d,"tryCatch"),e.wrap=f;var v="suspendedStart",_="suspendedYield",k="executing",A="completed",F={};function R(){}o(R,"Generator");function U(){}o(U,"GeneratorFunction");function C(){}o(C,"GeneratorFunctionPrototype");var Y={};p(Y,a,function(){return this});var $=Object.getPrototypeOf,H=$&&$($(ve([])));H&&H!==t&&r.call(H,a)&&(Y=H);var Q=C.prototype=R.prototype=Object.create(Y);function K(E){["next","throw","return"].forEach(function(w){p(E,w,function(S){return this._invoke(w,S)})})}o(K,"defineIteratorMethods");function Z(E,w){function S(q,j,I,T){var O=d(E[q],E,j);if(O.type!=="throw"){var L=O.arg,X=L.value;return X&&Di(X)=="object"&&r.call(X,"__await")?w.resolve(X.__await).then(function(J){S("next",J,I,T)},function(J){S("throw",J,I,T)}):w.resolve(X).then(function(J){L.value=J,I(L)},function(J){return S("throw",J,I,T)})}T(O.arg)}o(S,"invoke");var B;s(this,"_invoke",{value:o(function(j,I){function T(){return new w(function(O,L){S(j,I,O,L)})}return o(T,"callInvokeWithMethodAndArg"),B=B?B.then(T,T):T()},"value")})}o(Z,"AsyncIterator");function ye(E,w,S){var B=v;return function(q,j){if(B===k)throw Error("Generator is already running");if(B===A){if(q==="throw")throw j;return{value:i,done:!0}}for(S.method=q,S.arg=j;;){var I=S.delegate;if(I){var T=se(I,S);if(T){if(T===F)continue;return T}}if(S.method==="next")S.sent=S._sent=S.arg;else if(S.method==="throw"){if(B===v)throw B=A,S.arg;S.dispatchException(S.arg)}else S.method==="return"&&S.abrupt("return",S.arg);B=k;var O=d(E,w,S);if(O.type==="normal"){if(B=S.done?A:_,O.arg===F)continue;return{value:O.arg,done:S.done}}O.type==="throw"&&(B=A,S.method="throw",S.arg=O.arg)}}}o(ye,"makeInvokeMethod");function se(E,w){var S=w.method,B=E.iterator[S];if(B===i)return w.delegate=null,S==="throw"&&E.iterator.return&&(w.method="return",w.arg=i,se(E,w),w.method==="throw")||S!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+S+"' method")),F;var q=d(B,E.iterator,w.arg);if(q.type==="throw")return w.method="throw",w.arg=q.arg,w.delegate=null,F;var j=q.arg;return j?j.done?(w[E.resultName]=j.value,w.next=E.nextLoc,w.method!=="return"&&(w.method="next",w.arg=i),w.delegate=null,F):j:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,F)}o(se,"maybeInvokeDelegate");function we(E){var w={tryLoc:E[0]};1 in E&&(w.catchLoc=E[1]),2 in E&&(w.finallyLoc=E[2],w.afterLoc=E[3]),this.tryEntries.push(w)}o(we,"pushTryEntry");function me(E){var w=E.completion||{};w.type="normal",delete w.arg,E.completion=w}o(me,"resetTryEntry");function _e(E){this.tryEntries=[{tryLoc:"root"}],E.forEach(we,this),this.reset(!0)}o(_e,"Context");function ve(E){if(E||E===""){var w=E[a];if(w)return w.call(E);if(typeof E.next=="function")return E;if(!isNaN(E.length)){var S=-1,B=o(function q(){for(;++S<E.length;)if(r.call(E,S))return q.value=E[S],q.done=!1,q;return q.value=i,q.done=!0,q},"next");return B.next=B}}throw new TypeError(Di(E)+" is not iterable")}return o(ve,"values"),U.prototype=C,s(Q,"constructor",{value:C,configurable:!0}),s(C,"constructor",{value:U,configurable:!0}),U.displayName=p(C,c,"GeneratorFunction"),e.isGeneratorFunction=function(E){var w=typeof E=="function"&&E.constructor;return!!w&&(w===U||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(E){return Object.setPrototypeOf?Object.setPrototypeOf(E,C):(E.__proto__=C,p(E,c,"GeneratorFunction")),E.prototype=Object.create(Q),E},e.awrap=function(E){return{__await:E}},K(Z.prototype),p(Z.prototype,u,function(){return this}),e.AsyncIterator=Z,e.async=function(E,w,S,B,q){q===void 0&&(q=Promise);var j=new Z(f(E,w,S,B),q);return e.isGeneratorFunction(w)?j:j.next().then(function(I){return I.done?I.value:j.next()})},K(Q),p(Q,c,"Generator"),p(Q,a,function(){return this}),p(Q,"toString",function(){return"[object Generator]"}),e.keys=function(E){var w=Object(E),S=[];for(var B in w)S.push(B);return S.reverse(),o(function q(){for(;S.length;){var j=S.pop();if(j in w)return q.value=j,q.done=!1,q}return q.done=!0,q},"next")},e.values=ve,_e.prototype={constructor:_e,reset:o(function(w){if(this.prev=0,this.next=0,this.sent=this._sent=i,this.done=!1,this.delegate=null,this.method="next",this.arg=i,this.tryEntries.forEach(me),!w)for(var S in this)S.charAt(0)==="t"&&r.call(this,S)&&!isNaN(+S.slice(1))&&(this[S]=i)},"reset"),stop:o(function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},"stop"),dispatchException:o(function(w){if(this.done)throw w;var S=this;function B(L,X){return I.type="throw",I.arg=w,S.next=L,X&&(S.method="next",S.arg=i),!!X}o(B,"handle");for(var q=this.tryEntries.length-1;q>=0;--q){var j=this.tryEntries[q],I=j.completion;if(j.tryLoc==="root")return B("end");if(j.tryLoc<=this.prev){var T=r.call(j,"catchLoc"),O=r.call(j,"finallyLoc");if(T&&O){if(this.prev<j.catchLoc)return B(j.catchLoc,!0);if(this.prev<j.finallyLoc)return B(j.finallyLoc)}else if(T){if(this.prev<j.catchLoc)return B(j.catchLoc,!0)}else{if(!O)throw Error("try statement without catch or finally");if(this.prev<j.finallyLoc)return B(j.finallyLoc)}}}},"dispatchException"),abrupt:o(function(w,S){for(var B=this.tryEntries.length-1;B>=0;--B){var q=this.tryEntries[B];if(q.tryLoc<=this.prev&&r.call(q,"finallyLoc")&&this.prev<q.finallyLoc){var j=q;break}}j&&(w==="break"||w==="continue")&&j.tryLoc<=S&&S<=j.finallyLoc&&(j=null);var I=j?j.completion:{};return I.type=w,I.arg=S,j?(this.method="next",this.next=j.finallyLoc,F):this.complete(I)},"abrupt"),complete:o(function(w,S){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&S&&(this.next=S),F},"complete"),finish:o(function(w){for(var S=this.tryEntries.length-1;S>=0;--S){var B=this.tryEntries[S];if(B.finallyLoc===w)return this.complete(B.completion,B.afterLoc),me(B),F}},"finish"),catch:o(function(w){for(var S=this.tryEntries.length-1;S>=0;--S){var B=this.tryEntries[S];if(B.tryLoc===w){var q=B.completion;if(q.type==="throw"){var j=q.arg;me(B)}return j}}throw Error("illegal catch attempt")},"_catch"),delegateYield:o(function(w,S,B){return this.delegate={iterator:ve(w),resultName:S,nextLoc:B},this.method==="next"&&(this.arg=i),F},"delegateYield")},e}o(Yl,"_regeneratorRuntime");function mm(i,e,t,r,s,n,a){try{var u=i[n](a),c=u.value}catch(p){t(p);return}u.done?e(c):Promise.resolve(c).then(r,s)}o(mm,"asyncGeneratorStep");function bw(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function a(c){mm(n,r,s,a,u,"next",c)}o(a,"_next");function u(c){mm(n,r,s,a,u,"throw",c)}o(u,"_throw"),a(void 0)})}}o(bw,"_asyncToGenerator");function _m(i,e){return xw(i)||Sw(i,e)||km(i,e)||ww()}o(_m,"_slicedToArray");function ww(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}o(ww,"_nonIterableRest");function Sw(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var r,s,n,a,u=[],c=!0,p=!1;try{if(n=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;c=!1}else for(;!(c=(r=n.call(t)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(f){p=!0,s=f}finally{try{if(!c&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(p)throw s}}return u}}o(Sw,"_iterableToArrayLimit");function xw(i){if(Array.isArray(i))return i}o(xw,"_arrayWithHoles");function Di(i){"@babel/helpers - typeof";return Di=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Di(i)}o(Di,"_typeof");function Pw(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=km(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var r=0,s=o(function(){},"F");return{s,n:o(function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},"n"),e:o(function(p){throw p},"e"),f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,a=!1,u;return{s:o(function(){t=t.call(i)},"s"),n:o(function(){var p=t.next();return n=p.done,p},"n"),e:o(function(p){a=!0,u=p},"e"),f:o(function(){try{!n&&t.return!=null&&t.return()}finally{if(a)throw u}},"f")}}o(Pw,"_createForOfIteratorHelper");function km(i,e){if(i){if(typeof i=="string")return gm(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return gm(i,e)}}o(km,"_unsupportedIterableToArray");function gm(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=i[t];return r}o(gm,"_arrayLikeToArray");function ym(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,r)}return t}o(ym,"ownKeys");function wr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ym(Object(t),!0).forEach(function(r){_w(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):ym(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}o(wr,"_objectSpread");function _w(i,e,t){return e=Em(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}o(_w,"_defineProperty");function kw(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(kw,"_classCallCheck");function vm(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,Em(r.key),r)}}o(vm,"_defineProperties");function Ew(i,e,t){return e&&vm(i.prototype,e),t&&vm(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(Ew,"_createClass");function Em(i){var e=Fw(i,"string");return Di(e)=="symbol"?e:e+""}o(Em,"_toPropertyKey");function Fw(i,e){if(Di(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Di(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(Fw,"_toPrimitive");var fn="tus-v1",mn="ietf-draft-03",qs="ietf-draft-05",Tw={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:Cm,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null,protocol:fn},Tm=(function(){function i(e,t){kw(this,i),"resume"in t&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=t,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=e,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return o(i,"BaseUpload"),Ew(i,[{key:"findPreviousUploads",value:o(function(){var t=this;return this.options.fingerprint(this.file,this.options).then(function(r){return t._urlStorage.findUploadsByFingerprint(r)})},"findPreviousUploads")},{key:"resumeFromPreviousUpload",value:o(function(t){this.url=t.uploadUrl||null,this._parallelUploadUrls=t.parallelUploadUrls||null,this._urlStorageKey=t.urlStorageKey},"resumeFromPreviousUpload")},{key:"start",value:o(function(){var t=this,r=this.file;if(!r){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![fn,mn,qs].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var s=this.options.retryDelays;if(s!=null&&Object.prototype.toString.call(s)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var n=0,a=["uploadUrl","uploadSize","uploadLengthDeferred"];n<a.length;n++){var u=a[n];if(this.options[u]){this._emitError(new Error("tus: cannot use the ".concat(u," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(r,this.options).then(function(c){return c==null?oi("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):oi("Calculated fingerprint: ".concat(c)),t._fingerprint=c,t._source?t._source:t.options.fileReader.openFile(r,t.options.chunkSize)}).then(function(c){if(t._source=c,t.options.uploadLengthDeferred)t._size=null;else if(t.options.uploadSize!=null){if(t._size=Number(t.options.uploadSize),Number.isNaN(t._size)){t._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(t._size=t._source.size,t._size==null){t._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}t.options.parallelUploads>1||t._parallelUploadUrls!=null?t._startParallelUpload():t._startSingleUpload()}).catch(function(c){t._emitError(c)})},"start")},{key:"_startParallelUpload",value:o(function(){var t,r=this,s=this._size,n=0;this._parallelUploads=[];var a=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,u=(t=this.options.parallelUploadBoundaries)!==null&&t!==void 0?t:Aw(this._source.size,a);this._parallelUploadUrls&&u.forEach(function(f,d){f.uploadUrl=r._parallelUploadUrls[d]||null}),this._parallelUploadUrls=new Array(u.length);var c=u.map(function(f,d){var v=0;return r._source.slice(f.start,f.end).then(function(_){var k=_.value;return new Promise(function(A,F){var R=wr(wr({},r.options),{},{uploadUrl:f.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:r.options.metadataForPartialUploads,headers:wr(wr({},r.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:A,onError:F,onProgress:o(function(Y){n=n-v+Y,v=Y,r._emitProgress(n,s)},"onProgress"),onUploadUrlAvailable:o(function(){r._parallelUploadUrls[d]=U.url,r._parallelUploadUrls.filter(function(Y){return!!Y}).length===u.length&&r._saveUploadInUrlStorage()},"onUploadUrlAvailable")}),U=new i(k,R);U.start(),r._parallelUploads.push(U)})})}),p;Promise.all(c).then(function(){p=r._openRequest("POST",r.options.endpoint),p.setHeader("Upload-Concat","final;".concat(r._parallelUploadUrls.join(" ")));var f=bm(r.options.metadata);return f!==""&&p.setHeader("Upload-Metadata",f),r._sendRequest(p,null)}).then(function(f){if(!Sr(f.getStatus(),200)){r._emitHttpError(p,f,"tus: unexpected response while creating upload");return}var d=f.getHeader("Location");if(d==null){r._emitHttpError(p,f,"tus: invalid or missing Location header");return}r.url=Pm(r.options.endpoint,d),oi("Created upload at ".concat(r.url)),r._emitSuccess(f)}).catch(function(f){r._emitError(f)})},"_startParallelUpload")},{key:"_startSingleUpload",value:o(function(){if(this._aborted=!1,this.url!=null){oi("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){oi("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}oi("Creating a new upload"),this._createUpload()},"_startSingleUpload")},{key:"abort",value:o(function(t){var r=this;if(this._parallelUploads!=null){var s=Pw(this._parallelUploads),n;try{for(s.s();!(n=s.n()).done;){var a=n.value;a.abort(t)}}catch(u){s.e(u)}finally{s.f()}}return this._req!==null&&this._req.abort(),this._aborted=!0,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!t||this.url==null?Promise.resolve():i.terminate(this.url,this.options).then(function(){return r._removeFromUrlStorage()})},"abort")},{key:"_emitHttpError",value:o(function(t,r,s,n){this._emitError(new yr(s,n,t,r))},"_emitHttpError")},{key:"_emitError",value:o(function(t){var r=this;if(!this._aborted){if(this.options.retryDelays!=null){var s=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(s&&(this._retryAttempt=0),xm(t,this._retryAttempt,this.options)){var n=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){r.start()},n);return}}if(typeof this.options.onError=="function")this.options.onError(t);else throw t}},"_emitError")},{key:"_emitSuccess",value:o(function(t){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:t})},"_emitSuccess")},{key:"_emitProgress",value:o(function(t,r){typeof this.options.onProgress=="function"&&this.options.onProgress(t,r)},"_emitProgress")},{key:"_emitChunkComplete",value:o(function(t,r,s){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(t,r,s)},"_emitChunkComplete")},{key:"_createUpload",value:o(function(){var t=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var r=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?r.setHeader("Upload-Defer-Length","1"):r.setHeader("Upload-Length","".concat(this._size));var s=bm(this.options.metadata);s!==""&&r.setHeader("Upload-Metadata",s);var n;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,n=this._addChunkToRequest(r)):((this.options.protocol===mn||this.options.protocol===qs)&&r.setHeader("Upload-Complete","?0"),n=this._sendRequest(r,null)),n.then(function(a){if(!Sr(a.getStatus(),200)){t._emitHttpError(r,a,"tus: unexpected response while creating upload");return}var u=a.getHeader("Location");if(u==null){t._emitHttpError(r,a,"tus: invalid or missing Location header");return}if(t.url=Pm(t.options.endpoint,u),oi("Created upload at ".concat(t.url)),typeof t.options.onUploadUrlAvailable=="function"&&t.options.onUploadUrlAvailable(),t._size===0){t._emitSuccess(a),t._source.close();return}t._saveUploadInUrlStorage().then(function(){t.options.uploadDataDuringCreation?t._handleUploadResponse(r,a):(t._offset=0,t._performUpload())})}).catch(function(a){t._emitHttpError(r,null,"tus: failed to create upload",a)})},"_createUpload")},{key:"_resumeUpload",value:o(function(){var t=this,r=this._openRequest("HEAD",this.url),s=this._sendRequest(r,null);s.then(function(n){var a=n.getStatus();if(!Sr(a,200)){if(a===423){t._emitHttpError(r,n,"tus: upload is currently locked; retry later");return}if(Sr(a,400)&&t._removeFromUrlStorage(),!t.options.endpoint){t._emitHttpError(r,n,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}t.url=null,t._createUpload();return}var u=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(u)){t._emitHttpError(r,n,"tus: invalid or missing offset value");return}var c=Number.parseInt(n.getHeader("Upload-Length"),10);if(Number.isNaN(c)&&!t.options.uploadLengthDeferred&&t.options.protocol===fn){t._emitHttpError(r,n,"tus: invalid or missing length value");return}typeof t.options.onUploadUrlAvailable=="function"&&t.options.onUploadUrlAvailable(),t._saveUploadInUrlStorage().then(function(){if(u===c){t._emitProgress(c,c),t._emitSuccess(n);return}t._offset=u,t._performUpload()})}).catch(function(n){t._emitHttpError(r,null,"tus: failed to resume upload",n)})},"_resumeUpload")},{key:"_performUpload",value:o(function(){var t=this;if(!this._aborted){var r;this.options.overridePatchMethod?(r=this._openRequest("POST",this.url),r.setHeader("X-HTTP-Method-Override","PATCH")):r=this._openRequest("PATCH",this.url),r.setHeader("Upload-Offset","".concat(this._offset));var s=this._addChunkToRequest(r);s.then(function(n){if(!Sr(n.getStatus(),200)){t._emitHttpError(r,n,"tus: unexpected response while uploading chunk");return}t._handleUploadResponse(r,n)}).catch(function(n){t._aborted||t._emitHttpError(r,null,"tus: failed to upload chunk at offset ".concat(t._offset),n)})}},"_performUpload")},{key:"_addChunkToRequest",value:o(function(t){var r=this,s=this._offset,n=this._offset+this.options.chunkSize;return t.setProgressHandler(function(a){r._emitProgress(s+a,r._size)}),this.options.protocol===fn?t.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===qs&&t.setHeader("Content-Type","application/partial-upload"),(n===Number.POSITIVE_INFINITY||n>this._size)&&!this.options.uploadLengthDeferred&&(n=this._size),this._source.slice(s,n).then(function(a){var u=a.value,c=a.done,p=u!=null&&u.size?u.size:0;r.options.uploadLengthDeferred&&c&&(r._size=r._offset+p,t.setHeader("Upload-Length","".concat(r._size)));var f=r._offset+p;return!r.options.uploadLengthDeferred&&c&&f!==r._size?Promise.reject(new Error("upload was configured with a size of ".concat(r._size," bytes, but the source is done after ").concat(f," bytes"))):u===null?r._sendRequest(t):((r.options.protocol===mn||r.options.protocol===qs)&&t.setHeader("Upload-Complete",c?"?1":"?0"),r._emitProgress(r._offset,r._size),r._sendRequest(t,u))})},"_addChunkToRequest")},{key:"_handleUploadResponse",value:o(function(t,r){var s=Number.parseInt(r.getHeader("Upload-Offset"),10);if(Number.isNaN(s)){this._emitHttpError(t,r,"tus: invalid or missing offset value");return}if(this._emitProgress(s,this._size),this._emitChunkComplete(s-this._offset,s,this._size),this._offset=s,s===this._size){this._emitSuccess(r),this._source.close();return}this._performUpload()},"_handleUploadResponse")},{key:"_openRequest",value:o(function(t,r){var s=wm(t,r,this.options);return this._req=s,s},"_openRequest")},{key:"_removeFromUrlStorage",value:o(function(){var t=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(r){t._emitError(r)}),this._urlStorageKey=null)},"_removeFromUrlStorage")},{key:"_saveUploadInUrlStorage",value:o(function(){var t=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var r={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?r.parallelUploadUrls=this._parallelUploadUrls:r.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,r).then(function(s){t._urlStorageKey=s})},"_saveUploadInUrlStorage")},{key:"_sendRequest",value:o(function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return Sm(t,r,this.options)},"_sendRequest")}],[{key:"terminate",value:o(function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=wm("DELETE",t,r);return Sm(s,null,r).then(function(n){if(n.getStatus()!==204)throw new yr("tus: unexpected response while terminating upload",null,s,n)}).catch(function(n){if(n instanceof yr||(n=new yr("tus: failed to terminate upload",n,s,null)),!xm(n,0,r))throw n;var a=r.retryDelays[0],u=r.retryDelays.slice(1),c=wr(wr({},r),{},{retryDelays:u});return new Promise(function(p){return setTimeout(p,a)}).then(function(){return i.terminate(t,c)})})},"terminate")}])})();function bm(i){return Object.entries(i).map(function(e){var t=_m(e,2),r=t[0],s=t[1];return"".concat(r," ").concat(tm.encode(String(s)))}).join(",")}o(bm,"encodeMetadata");function Sr(i,e){return i>=e&&i<e+100}o(Sr,"inStatusCategory");function wm(i,e,t){var r=t.httpStack.createRequest(i,e);t.protocol===mn?r.setHeader("Upload-Draft-Interop-Version","5"):t.protocol===qs?r.setHeader("Upload-Draft-Interop-Version","6"):r.setHeader("Tus-Resumable","1.0.0");for(var s=t.headers||{},n=0,a=Object.entries(s);n<a.length;n++){var u=_m(a[n],2),c=u[0],p=u[1];r.setHeader(c,p)}if(t.addRequestId){var f=Xl();r.setHeader("X-Request-ID",f)}return r}o(wm,"openRequest");function Sm(i,e,t){return Jl.apply(this,arguments)}o(Sm,"sendRequest");function Jl(){return Jl=bw(Yl().mark(o(function i(e,t,r){var s;return Yl().wrap(o(function(a){for(;;)switch(a.prev=a.next){case 0:if(typeof r.onBeforeRequest!="function"){a.next=3;break}return a.next=3,r.onBeforeRequest(e);case 3:return a.next=5,e.send(t);case 5:if(s=a.sent,typeof r.onAfterResponse!="function"){a.next=9;break}return a.next=9,r.onAfterResponse(e,s);case 9:return a.abrupt("return",s);case 10:case"end":return a.stop()}},"_callee$"),i)},"_callee"))),Jl.apply(this,arguments)}o(Jl,"_sendRequest2");function Cw(){var i=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(i=!1),i}o(Cw,"isOnline");function xm(i,e,t){return t.retryDelays==null||e>=t.retryDelays.length||i.originalRequest==null?!1:t&&typeof t.onShouldRetry=="function"?t.onShouldRetry(i,e,t):Cm(i)}o(xm,"shouldRetry");function Cm(i){var e=i.originalResponse?i.originalResponse.getStatus():0;return(!Sr(e,400)||e===409||e===423)&&Cw()}o(Cm,"defaultOnShouldRetry");function Pm(i,e){return new Fm.default(e,i).toString()}o(Pm,"resolveUrl");function Aw(i,e){for(var t=Math.floor(i/e),r=[],s=0;s<e;s++)r.push({start:t*s,end:t*(s+1)});return r[e-1].end=i,r}o(Aw,"splitSizeIntoParts");Tm.defaultOptions=Tw;var gn=Tm;var Rw=o(function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"},"isReactNative"),yn=Rw;function Ql(i){return new Promise(function(e,t){var r=new XMLHttpRequest;r.responseType="blob",r.onload=function(){var s=r.response;e(s)},r.onerror=function(s){t(s)},r.open("GET",i),r.send()})}o(Ql,"uriToBlob");var Uw=o(function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")},"isCordova"),Am=Uw;function Zl(i){return new Promise(function(e,t){var r=new FileReader;r.onload=function(){var s=new Uint8Array(r.result);e({value:s})},r.onerror=function(s){t(s)},r.readAsArrayBuffer(i)})}o(Zl,"readAsByteArray");function Vs(i){"@babel/helpers - typeof";return Vs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vs(i)}o(Vs,"_typeof");function Ow(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(Ow,"_classCallCheck");function Rm(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,Iw(r.key),r)}}o(Rm,"_defineProperties");function Dw(i,e,t){return e&&Rm(i.prototype,e),t&&Rm(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(Dw,"_createClass");function Iw(i){var e=Nw(i,"string");return Vs(e)=="symbol"?e:e+""}o(Iw,"_toPropertyKey");function Nw(i,e){if(Vs(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Vs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(Nw,"_toPrimitive");var eu=(function(){function i(e){Ow(this,i),this._file=e,this.size=e.size}return o(i,"FileSource"),Dw(i,[{key:"slice",value:o(function(t,r){if(Am())return Zl(this._file.slice(t,r));var s=this._file.slice(t,r),n=r>=this.size;return Promise.resolve({value:s,done:n})},"slice")},{key:"close",value:o(function(){},"close")}])})();function $s(i){"@babel/helpers - typeof";return $s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$s(i)}o($s,"_typeof");function Mw(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(Mw,"_classCallCheck");function Um(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,Bw(r.key),r)}}o(Um,"_defineProperties");function Lw(i,e,t){return e&&Um(i.prototype,e),t&&Um(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(Lw,"_createClass");function Bw(i){var e=jw(i,"string");return $s(e)=="symbol"?e:e+""}o(Bw,"_toPropertyKey");function jw(i,e){if($s(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if($s(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(jw,"_toPrimitive");function Om(i){return i===void 0?0:i.size!==void 0?i.size:i.length}o(Om,"len");function zw(i,e){if(i.concat)return i.concat(e);if(i instanceof Blob)return new Blob([i,e],{type:i.type});if(i.set){var t=new i.constructor(i.length+e.length);return t.set(i),t.set(e,i.length),t}throw new Error("Unknown data type")}o(zw,"concat");var Dm=(function(){function i(e){Mw(this,i),this._buffer=void 0,this._bufferOffset=0,this._reader=e,this._done=!1}return o(i,"StreamSource"),Lw(i,[{key:"slice",value:o(function(t,r){return t<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(t,r)},"slice")},{key:"_readUntilEnoughDataOrDone",value:o(function(t,r){var s=this,n=r<=this._bufferOffset+Om(this._buffer);if(this._done||n){var a=this._getDataFromBuffer(t,r),u=a==null?this._done:!1;return Promise.resolve({value:a,done:u})}return this._reader.read().then(function(c){var p=c.value,f=c.done;return f?s._done=!0:s._buffer===void 0?s._buffer=p:s._buffer=zw(s._buffer,p),s._readUntilEnoughDataOrDone(t,r)})},"_readUntilEnoughDataOrDone")},{key:"_getDataFromBuffer",value:o(function(t,r){t>this._bufferOffset&&(this._buffer=this._buffer.slice(t-this._bufferOffset),this._bufferOffset=t);var s=Om(this._buffer)===0;return this._done&&s?null:this._buffer.slice(0,r-t)},"_getDataFromBuffer")},{key:"close",value:o(function(){this._reader.cancel&&this._reader.cancel()},"close")}])})();function Ii(i){"@babel/helpers - typeof";return Ii=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ii(i)}o(Ii,"_typeof");function tu(){"use strict";tu=o(function(){return e},"_regeneratorRuntime");var i,e={},t=Object.prototype,r=t.hasOwnProperty,s=Object.defineProperty||function(E,w,S){E[w]=S.value},n=typeof Symbol=="function"?Symbol:{},a=n.iterator||"@@iterator",u=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function p(E,w,S){return Object.defineProperty(E,w,{value:S,enumerable:!0,configurable:!0,writable:!0}),E[w]}o(p,"define");try{p({},"")}catch{p=o(function(S,B,q){return S[B]=q},"define")}function f(E,w,S,B){var q=w&&w.prototype instanceof R?w:R,j=Object.create(q.prototype),I=new _e(B||[]);return s(j,"_invoke",{value:ye(E,S,I)}),j}o(f,"wrap");function d(E,w,S){try{return{type:"normal",arg:E.call(w,S)}}catch(B){return{type:"throw",arg:B}}}o(d,"tryCatch"),e.wrap=f;var v="suspendedStart",_="suspendedYield",k="executing",A="completed",F={};function R(){}o(R,"Generator");function U(){}o(U,"GeneratorFunction");function C(){}o(C,"GeneratorFunctionPrototype");var Y={};p(Y,a,function(){return this});var $=Object.getPrototypeOf,H=$&&$($(ve([])));H&&H!==t&&r.call(H,a)&&(Y=H);var Q=C.prototype=R.prototype=Object.create(Y);function K(E){["next","throw","return"].forEach(function(w){p(E,w,function(S){return this._invoke(w,S)})})}o(K,"defineIteratorMethods");function Z(E,w){function S(q,j,I,T){var O=d(E[q],E,j);if(O.type!=="throw"){var L=O.arg,X=L.value;return X&&Ii(X)=="object"&&r.call(X,"__await")?w.resolve(X.__await).then(function(J){S("next",J,I,T)},function(J){S("throw",J,I,T)}):w.resolve(X).then(function(J){L.value=J,I(L)},function(J){return S("throw",J,I,T)})}T(O.arg)}o(S,"invoke");var B;s(this,"_invoke",{value:o(function(j,I){function T(){return new w(function(O,L){S(j,I,O,L)})}return o(T,"callInvokeWithMethodAndArg"),B=B?B.then(T,T):T()},"value")})}o(Z,"AsyncIterator");function ye(E,w,S){var B=v;return function(q,j){if(B===k)throw Error("Generator is already running");if(B===A){if(q==="throw")throw j;return{value:i,done:!0}}for(S.method=q,S.arg=j;;){var I=S.delegate;if(I){var T=se(I,S);if(T){if(T===F)continue;return T}}if(S.method==="next")S.sent=S._sent=S.arg;else if(S.method==="throw"){if(B===v)throw B=A,S.arg;S.dispatchException(S.arg)}else S.method==="return"&&S.abrupt("return",S.arg);B=k;var O=d(E,w,S);if(O.type==="normal"){if(B=S.done?A:_,O.arg===F)continue;return{value:O.arg,done:S.done}}O.type==="throw"&&(B=A,S.method="throw",S.arg=O.arg)}}}o(ye,"makeInvokeMethod");function se(E,w){var S=w.method,B=E.iterator[S];if(B===i)return w.delegate=null,S==="throw"&&E.iterator.return&&(w.method="return",w.arg=i,se(E,w),w.method==="throw")||S!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+S+"' method")),F;var q=d(B,E.iterator,w.arg);if(q.type==="throw")return w.method="throw",w.arg=q.arg,w.delegate=null,F;var j=q.arg;return j?j.done?(w[E.resultName]=j.value,w.next=E.nextLoc,w.method!=="return"&&(w.method="next",w.arg=i),w.delegate=null,F):j:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,F)}o(se,"maybeInvokeDelegate");function we(E){var w={tryLoc:E[0]};1 in E&&(w.catchLoc=E[1]),2 in E&&(w.finallyLoc=E[2],w.afterLoc=E[3]),this.tryEntries.push(w)}o(we,"pushTryEntry");function me(E){var w=E.completion||{};w.type="normal",delete w.arg,E.completion=w}o(me,"resetTryEntry");function _e(E){this.tryEntries=[{tryLoc:"root"}],E.forEach(we,this),this.reset(!0)}o(_e,"Context");function ve(E){if(E||E===""){var w=E[a];if(w)return w.call(E);if(typeof E.next=="function")return E;if(!isNaN(E.length)){var S=-1,B=o(function q(){for(;++S<E.length;)if(r.call(E,S))return q.value=E[S],q.done=!1,q;return q.value=i,q.done=!0,q},"next");return B.next=B}}throw new TypeError(Ii(E)+" is not iterable")}return o(ve,"values"),U.prototype=C,s(Q,"constructor",{value:C,configurable:!0}),s(C,"constructor",{value:U,configurable:!0}),U.displayName=p(C,c,"GeneratorFunction"),e.isGeneratorFunction=function(E){var w=typeof E=="function"&&E.constructor;return!!w&&(w===U||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(E){return Object.setPrototypeOf?Object.setPrototypeOf(E,C):(E.__proto__=C,p(E,c,"GeneratorFunction")),E.prototype=Object.create(Q),E},e.awrap=function(E){return{__await:E}},K(Z.prototype),p(Z.prototype,u,function(){return this}),e.AsyncIterator=Z,e.async=function(E,w,S,B,q){q===void 0&&(q=Promise);var j=new Z(f(E,w,S,B),q);return e.isGeneratorFunction(w)?j:j.next().then(function(I){return I.done?I.value:j.next()})},K(Q),p(Q,c,"Generator"),p(Q,a,function(){return this}),p(Q,"toString",function(){return"[object Generator]"}),e.keys=function(E){var w=Object(E),S=[];for(var B in w)S.push(B);return S.reverse(),o(function q(){for(;S.length;){var j=S.pop();if(j in w)return q.value=j,q.done=!1,q}return q.done=!0,q},"next")},e.values=ve,_e.prototype={constructor:_e,reset:o(function(w){if(this.prev=0,this.next=0,this.sent=this._sent=i,this.done=!1,this.delegate=null,this.method="next",this.arg=i,this.tryEntries.forEach(me),!w)for(var S in this)S.charAt(0)==="t"&&r.call(this,S)&&!isNaN(+S.slice(1))&&(this[S]=i)},"reset"),stop:o(function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},"stop"),dispatchException:o(function(w){if(this.done)throw w;var S=this;function B(L,X){return I.type="throw",I.arg=w,S.next=L,X&&(S.method="next",S.arg=i),!!X}o(B,"handle");for(var q=this.tryEntries.length-1;q>=0;--q){var j=this.tryEntries[q],I=j.completion;if(j.tryLoc==="root")return B("end");if(j.tryLoc<=this.prev){var T=r.call(j,"catchLoc"),O=r.call(j,"finallyLoc");if(T&&O){if(this.prev<j.catchLoc)return B(j.catchLoc,!0);if(this.prev<j.finallyLoc)return B(j.finallyLoc)}else if(T){if(this.prev<j.catchLoc)return B(j.catchLoc,!0)}else{if(!O)throw Error("try statement without catch or finally");if(this.prev<j.finallyLoc)return B(j.finallyLoc)}}}},"dispatchException"),abrupt:o(function(w,S){for(var B=this.tryEntries.length-1;B>=0;--B){var q=this.tryEntries[B];if(q.tryLoc<=this.prev&&r.call(q,"finallyLoc")&&this.prev<q.finallyLoc){var j=q;break}}j&&(w==="break"||w==="continue")&&j.tryLoc<=S&&S<=j.finallyLoc&&(j=null);var I=j?j.completion:{};return I.type=w,I.arg=S,j?(this.method="next",this.next=j.finallyLoc,F):this.complete(I)},"abrupt"),complete:o(function(w,S){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&S&&(this.next=S),F},"complete"),finish:o(function(w){for(var S=this.tryEntries.length-1;S>=0;--S){var B=this.tryEntries[S];if(B.finallyLoc===w)return this.complete(B.completion,B.afterLoc),me(B),F}},"finish"),catch:o(function(w){for(var S=this.tryEntries.length-1;S>=0;--S){var B=this.tryEntries[S];if(B.tryLoc===w){var q=B.completion;if(q.type==="throw"){var j=q.arg;me(B)}return j}}throw Error("illegal catch attempt")},"_catch"),delegateYield:o(function(w,S,B){return this.delegate={iterator:ve(w),resultName:S,nextLoc:B},this.method==="next"&&(this.arg=i),F},"delegateYield")},e}o(tu,"_regeneratorRuntime");function Im(i,e,t,r,s,n,a){try{var u=i[n](a),c=u.value}catch(p){t(p);return}u.done?e(c):Promise.resolve(c).then(r,s)}o(Im,"asyncGeneratorStep");function Hw(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function a(c){Im(n,r,s,a,u,"next",c)}o(a,"_next");function u(c){Im(n,r,s,a,u,"throw",c)}o(u,"_throw"),a(void 0)})}}o(Hw,"_asyncToGenerator");function qw(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(qw,"_classCallCheck");function Nm(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,$w(r.key),r)}}o(Nm,"_defineProperties");function Vw(i,e,t){return e&&Nm(i.prototype,e),t&&Nm(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(Vw,"_createClass");function $w(i){var e=Ww(i,"string");return Ii(e)=="symbol"?e:e+""}o($w,"_toPropertyKey");function Ww(i,e){if(Ii(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Ii(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(Ww,"_toPrimitive");var Mm=(function(){function i(){qw(this,i)}return o(i,"FileReader"),Vw(i,[{key:"openFile",value:(function(){var e=Hw(tu().mark(o(function r(s,n){var a;return tu().wrap(o(function(c){for(;;)switch(c.prev=c.next){case 0:if(!(yn()&&s&&typeof s.uri<"u")){c.next=11;break}return c.prev=1,c.next=4,Ql(s.uri);case 4:return a=c.sent,c.abrupt("return",new eu(a));case 8:throw c.prev=8,c.t0=c.catch(1),new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(c.t0));case 11:if(!(typeof s.slice=="function"&&typeof s.size<"u")){c.next=13;break}return c.abrupt("return",Promise.resolve(new eu(s)));case 13:if(typeof s.read!="function"){c.next=18;break}if(n=Number(n),Number.isFinite(n)){c.next=17;break}return c.abrupt("return",Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));case 17:return c.abrupt("return",Promise.resolve(new Dm(s,n)));case 18:return c.abrupt("return",Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment")));case 19:case"end":return c.stop()}},"_callee$"),r,null,[[1,8]])},"_callee")));function t(r,s){return e.apply(this,arguments)}return o(t,"openFile"),t})()}])})();function iu(i,e){return yn()?Promise.resolve(Gw(i,e)):Promise.resolve(["tus-br",i.name,i.type,i.size,i.lastModified,e.endpoint].join("-"))}o(iu,"fingerprint");function Gw(i,e){var t=i.exif?Kw(JSON.stringify(i.exif)):"noexif";return["tus-rn",i.name||"noname",i.size||"nosize",t,e.endpoint].join("/")}o(Gw,"reactNativeFingerprint");function Kw(i){var e=0;if(i.length===0)return e;for(var t=0;t<i.length;t++){var r=i.charCodeAt(t);e=(e<<5)-e+r,e&=e}return e}o(Kw,"hashCode");function Ws(i){"@babel/helpers - typeof";return Ws=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ws(i)}o(Ws,"_typeof");function ru(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(ru,"_classCallCheck");function Lm(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,Xw(r.key),r)}}o(Lm,"_defineProperties");function su(i,e,t){return e&&Lm(i.prototype,e),t&&Lm(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(su,"_createClass");function Xw(i){var e=Yw(i,"string");return Ws(e)=="symbol"?e:e+""}o(Xw,"_toPropertyKey");function Yw(i,e){if(Ws(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Ws(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(Yw,"_toPrimitive");var Bm=(function(){function i(){ru(this,i)}return o(i,"XHRHttpStack"),su(i,[{key:"createRequest",value:o(function(t,r){return new Jw(t,r)},"createRequest")},{key:"getName",value:o(function(){return"XHRHttpStack"},"getName")}])})();var Jw=(function(){function i(e,t){ru(this,i),this._xhr=new XMLHttpRequest,this._xhr.open(e,t,!0),this._method=e,this._url=t,this._headers={}}return o(i,"Request"),su(i,[{key:"getMethod",value:o(function(){return this._method},"getMethod")},{key:"getURL",value:o(function(){return this._url},"getURL")},{key:"setHeader",value:o(function(t,r){this._xhr.setRequestHeader(t,r),this._headers[t]=r},"setHeader")},{key:"getHeader",value:o(function(t){return this._headers[t]},"getHeader")},{key:"setProgressHandler",value:o(function(t){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(r){r.lengthComputable&&t(r.loaded)})},"setProgressHandler")},{key:"send",value:o(function(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(s,n){t._xhr.onload=function(){s(new Qw(t._xhr))},t._xhr.onerror=function(a){n(a)},t._xhr.send(r)})},"send")},{key:"abort",value:o(function(){return this._xhr.abort(),Promise.resolve()},"abort")},{key:"getUnderlyingObject",value:o(function(){return this._xhr},"getUnderlyingObject")}])})(),Qw=(function(){function i(e){ru(this,i),this._xhr=e}return o(i,"Response"),su(i,[{key:"getStatus",value:o(function(){return this._xhr.status},"getStatus")},{key:"getHeader",value:o(function(t){return this._xhr.getResponseHeader(t)},"getHeader")},{key:"getBody",value:o(function(){return this._xhr.responseText},"getBody")},{key:"getUnderlyingObject",value:o(function(){return this._xhr},"getUnderlyingObject")}])})();function Gs(i){"@babel/helpers - typeof";return Gs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gs(i)}o(Gs,"_typeof");function Zw(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(Zw,"_classCallCheck");function jm(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,t2(r.key),r)}}o(jm,"_defineProperties");function e2(i,e,t){return e&&jm(i.prototype,e),t&&jm(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(e2,"_createClass");function t2(i){var e=i2(i,"string");return Gs(e)=="symbol"?e:e+""}o(t2,"_toPropertyKey");function i2(i,e){if(Gs(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Gs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(i2,"_toPrimitive");var nu=!1;try{nu="localStorage"in window,vn="tusSupport",ou=localStorage.getItem(vn),localStorage.setItem(vn,ou),ou===null&&localStorage.removeItem(vn)}catch(i){if(i.code===i.SECURITY_ERR||i.code===i.QUOTA_EXCEEDED_ERR)nu=!1;else throw i}var vn,ou,zm=nu,Hm=(function(){function i(){Zw(this,i)}return o(i,"WebStorageUrlStorage"),e2(i,[{key:"findAllUploads",value:o(function(){var t=this._findEntries("tus::");return Promise.resolve(t)},"findAllUploads")},{key:"findUploadsByFingerprint",value:o(function(t){var r=this._findEntries("tus::".concat(t,"::"));return Promise.resolve(r)},"findUploadsByFingerprint")},{key:"removeUpload",value:o(function(t){return localStorage.removeItem(t),Promise.resolve()},"removeUpload")},{key:"addUpload",value:o(function(t,r){var s=Math.round(Math.random()*1e12),n="tus::".concat(t,"::").concat(s);return localStorage.setItem(n,JSON.stringify(r)),Promise.resolve(n)},"addUpload")},{key:"_findEntries",value:o(function(t){for(var r=[],s=0;s<localStorage.length;s++){var n=localStorage.key(s);if(n.indexOf(t)===0)try{var a=JSON.parse(localStorage.getItem(n));a.urlStorageKey=n,r.push(a)}catch{}}return r},"_findEntries")}])})();function Pr(i){"@babel/helpers - typeof";return Pr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pr(i)}o(Pr,"_typeof");function r2(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(r2,"_classCallCheck");function qm(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,Wm(r.key),r)}}o(qm,"_defineProperties");function s2(i,e,t){return e&&qm(i.prototype,e),t&&qm(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(s2,"_createClass");function o2(i,e,t){return e=bn(e),n2(i,$m()?Reflect.construct(e,t||[],bn(i).constructor):e.apply(i,t))}o(o2,"_callSuper");function n2(i,e){if(e&&(Pr(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return a2(i)}o(n2,"_possibleConstructorReturn");function a2(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}o(a2,"_assertThisInitialized");function $m(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($m=o(function(){return!!i},"_isNativeReflectConstruct"))()}o($m,"_isNativeReflectConstruct");function bn(i){return bn=Object.setPrototypeOf?Object.getPrototypeOf.bind():o(function(t){return t.__proto__||Object.getPrototypeOf(t)},"_getPrototypeOf"),bn(i)}o(bn,"_getPrototypeOf");function l2(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&au(i,e)}o(l2,"_inherits");function au(i,e){return au=Object.setPrototypeOf?Object.setPrototypeOf.bind():o(function(r,s){return r.__proto__=s,r},"_setPrototypeOf"),au(i,e)}o(au,"_setPrototypeOf");function Vm(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,r)}return t}o(Vm,"ownKeys");function xr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vm(Object(t),!0).forEach(function(r){u2(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Vm(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}o(xr,"_objectSpread");function u2(i,e,t){return e=Wm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}o(u2,"_defineProperty");function Wm(i){var e=c2(i,"string");return Pr(e)=="symbol"?e:e+""}o(Wm,"_toPropertyKey");function c2(i,e){if(Pr(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Pr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(c2,"_toPrimitive");var wn=xr(xr({},gn.defaultOptions),{},{httpStack:new Bm,fileReader:new Mm,urlStorage:zm?new Hm:new Nf,fingerprint:iu}),Gm=(function(i){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return r2(this,e),r=xr(xr({},wn),r),o2(this,e,[t,r])}return o(e,"Upload"),l2(e,i),s2(e,null,[{key:"terminate",value:o(function(r){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return s=xr(xr({},wn),s),gn.terminate(r,s)},"terminate")}])})(gn),hD=typeof XMLHttpRequest=="function"&&typeof Blob=="function"&&typeof Blob.prototype.slice=="function";var Xm={name:"@uppy/tus",description:"Resumable uploads for Uppy using Tus.io",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin","upload","resumable","tus"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/utils":"workspace:^","tus-js-client":"^4.2.3"},devDependencies:{"@uppy/core":"workspace:^",jsdom:"^26.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"}};function d2(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")}o(d2,"isCordova");function h2(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"}o(h2,"isReactNative");function lu(i){return(e,t)=>{if(d2()||h2())return wn.fingerprint(e,t);let r=["tus",i.id,t.endpoint].join("-");return Promise.resolve(r)}}o(lu,"getFingerprint");var Ym={endpoint:"",uploadUrl:null,metadata:{},uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,overridePatchMethod:!1,headers:{},addRequestId:!1,chunkSize:1/0,retryDelays:[100,1e3,3e3,5e3],parallelUploads:1,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1},f2={limit:20,retryDelays:Ym.retryDelays,withCredentials:!1,allowedMetaFields:!0},Ni=class extends Pe{static{o(this,"Tus")}static VERSION=Xm.version;#e;requests;uploaders;uploaderEvents;constructor(e,t){if(super(e,{...f2,...t}),this.type="uploader",this.id=this.opts.id||"Tus",t?.allowedMetaFields===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");if("autoRetry"in t)throw new Error("The `autoRetry` option was deprecated and has been removed.");this.requests=this.opts.rateLimitedQueue??new ft(this.opts.limit),this.#e=this.opts.retryDelays?.values(),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null)}resetUploaderReferences(e,t){let r=this.uploaders[e];r&&(r.abort(),t?.abort&&r.abort(!0),this.uploaders[e]=null),this.uploaderEvents[e]&&(this.uploaderEvents[e].remove(),this.uploaderEvents[e]=null)}async#t(e){return this.resetUploaderReferences(e.id),new Promise((t,r)=>{let s,n,a,u={...this.opts,...e.tus||{}};typeof u.headers=="function"&&(u.headers=u.headers(e));let{onShouldRetry:c,onBeforeRequest:p,...f}=u,d={...Ym,...f};d.fingerprint=lu(e),d.onBeforeRequest=async R=>{let U=R.getUnderlyingObject();U.withCredentials=!!u.withCredentials;let C;if(typeof p=="function"&&(C=p(R,e)),ut(s,"shouldBeRequeued")){if(!s.shouldBeRequeued)return Promise.reject();let Y,$=new Promise(H=>{Y=H});s=this.requests.run(()=>(e.isPaused&&s.abort(),Y(),()=>{})),await Promise.all([$,C]);return}return C},d.onError=R=>{this.uppy.log(R);let U=R.originalRequest!=null?R.originalRequest.getUnderlyingObject():null;Lr(U)&&(R=new St(R,U)),this.resetUploaderReferences(e.id),s?.abort(),typeof u.onError=="function"&&u.onError(R),r(R)},d.onProgress=(R,U)=>{this.onReceiveUploadUrl(e,a.url),typeof u.onProgress=="function"&&u.onProgress(R,U);let C=this.uppy.getFile(e.id);this.uppy.emit("upload-progress",C,{uploadStarted:C.progress.uploadStarted??0,bytesUploaded:R,bytesTotal:U})},d.onSuccess=R=>{let U={uploadURL:a.url??void 0,status:200,body:{xhr:R.lastResponse.getUnderlyingObject()}};this.uppy.emit("upload-success",this.uppy.getFile(e.id),U),this.resetUploaderReferences(e.id),s.done(),a.url&&this.uppy.log(`Download ${a.url}`),typeof u.onSuccess=="function"&&u.onSuccess(R),t(a)};let v=o(R=>{let U=R?.originalResponse?.getStatus();if(U===429){if(!this.requests.isPaused){let C=this.#e?.next();if(C==null||C.done)return!1;this.requests.rateLimit(C.value)}}else{if(U!=null&&U>=400&&U<500&&U!==409&&U!==423)return!1;typeof navigator<"u"&&navigator.onLine===!1&&(this.requests.isPaused||(this.requests.pause(),window.addEventListener("online",()=>{this.requests.resume()},{once:!0})))}return s.abort(),s={shouldBeRequeued:!0,abort(){this.shouldBeRequeued=!1},done(){throw new Error("Cannot mark a queued request as done: this indicates a bug")},fn(){throw new Error("Cannot run a queued request: this indicates a bug")}},!0},"defaultOnShouldRetry");c!=null?d.onShouldRetry=(R,U)=>c(R,U,u,v):d.onShouldRetry=v;let _=o((R,U,C)=>{ut(R,U)&&!ut(R,C)&&(R[C]=R[U])},"copyProp"),k={};if(At(u.allowedMetaFields,e.meta).forEach(R=>{k[R]=String(e.meta[R])}),_(k,"type","filetype"),_(k,"name","filename"),d.metadata=k,e.data==null)throw new Error("File data is empty");a=new Gm(e.data,d),this.uploaders[e.id]=a;let F=new Ot(this.uppy);this.uploaderEvents[e.id]=F,n=o(()=>(e.isPaused||a.start(),()=>{}),"qRequest"),a.findPreviousUploads().then(R=>{let U=R[0];U&&(this.uppy.log(`[Tus] Resuming upload of ${e.id} started at ${U.creationTime}`),a.resumeFromPreviousUpload(U)),s=this.requests.run(n)}),F.onFileRemove(e.id,R=>{s.abort(),this.resetUploaderReferences(e.id,{abort:!!a.url}),t(`upload ${R} was removed`)}),F.onPause(e.id,R=>{s.abort(),R?a.abort():s=this.requests.run(n)}),F.onPauseAll(e.id,()=>{s.abort(),a.abort()}),F.onCancelAll(e.id,()=>{s.abort(),this.resetUploaderReferences(e.id,{abort:!!a.url}),t(`upload ${e.id} was canceled`)}),F.onResumeAll(e.id,()=>{s.abort(),e.error&&a.abort(),s=this.requests.run(n)})}).catch(t=>{throw this.uppy.emit("upload-error",e,t),t})}onReceiveUploadUrl(e,t){let r=this.uppy.getFile(e.id);r&&(!r.tus||r.tus.uploadUrl!==t)&&(this.uppy.log("[Tus] Storing upload url"),this.uppy.setFileState(r.id,{tus:{...r.tus,uploadUrl:t}}))}#r(e){let t={...this.opts};return e.tus&&Object.assign(t,e.tus),typeof t.headers=="function"&&(t.headers=t.headers(e)),{..."remote"in e&&e.remote.body,endpoint:t.endpoint,uploadUrl:t.uploadUrl,protocol:"tus",size:e.data.size,headers:t.headers,metadata:e.meta}}async#i(e){let t=hi(e),r=fi(t);this.uppy.emit("upload-start",r),await Promise.allSettled(t.map(s=>{if(s.isRemote){let n=o(()=>this.requests,"getQueue"),a=new AbortController,u=o(p=>{p.id===s.id&&a.abort()},"removedHandler");this.uppy.on("file-removed",u);let c=this.uppy.getRequestClientForFile(s).uploadRemoteFile(s,this.#r(s),{signal:a.signal,getQueue:n});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",u)},{priority:-1})(),c}return this.#t(s)}))}#s=o(async e=>{if(e.length===0){this.uppy.log("[Tus] No files to upload");return}this.opts.limit===0&&this.uppy.log("[Tus] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/tus/#limit-0","warning"),this.uppy.log("[Tus] Uploading...");let t=this.uppy.getFilesByIds(e);await this.#i(t)},"#handleUpload");install(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!0}}),this.uppy.addUploader(this.#s)}uninstall(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!1}}),this.uppy.removeUploader(this.#s)}};var Jm={name:"@uppy/transloadit",description:"The Transloadit plugin can be used to upload files to Transloadit for all kinds of processing, such as transcoding video, resizing images, zipping/unzipping, and more",version:"5.4.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","transloadit","file encoding","encoding","file processing","video encoding","crop","resize","watermark","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/tus":"workspace:^","@uppy/utils":"workspace:^","component-emitter":"^2.0.0",transloadit:"^4.0.2"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",jsdom:"^26.1.0",msw:"^2.10.4",typescript:"^5.8.3",vitest:"^3.2.4","whatwg-fetch":"^3.6.2"}};var Zm=ae(cu(),1);var y2="ASSEMBLY_UPLOADING",pu="ASSEMBLY_EXECUTING",du="ASSEMBLY_COMPLETED",Qm=[y2,pu,du];function Sn(i,e){return typeof i!="string"?!1:Qm.indexOf(i)>=Qm.indexOf(e)}o(Sn,"isStatus");var hu=class extends Zm.default{static{o(this,"TransloaditAssembly")}#e;#t;#r=!1;#i=null;#s;pollInterval;closed;constructor(e,t){super(),this.#s=e,this.pollInterval=null,this.closed=!1,this.#e=t,this.#t=t.wrapPromiseFunction(Qt)}connect(){this.#o(),this.#a()}#l(){this.emit("finished"),this.close()}get status(){return this.#s}set status(e){this.#s=e,this.emit("status",e)}#o(){this.#i=new EventSource(`${this.status.websocket_url}?assembly=${this.status.assembly_id}`),this.#i.addEventListener("open",()=>{clearInterval(this.pollInterval),this.pollInterval=null}),this.#i.addEventListener("message",e=>{e.data==="assembly_finished"&&this.#l(),e.data==="assembly_uploading_finished"&&this.emit("executing"),e.data==="assembly_upload_meta_data_extracted"&&(this.emit("metadata"),this.#c({diff:!1}))}),this.#i.addEventListener("assembly_upload_finished",e=>{let t=JSON.parse(e.data);this.status={...this.status,uploads:[...this.status.uploads??[],t]},this.emit("upload",t)}),this.#i.addEventListener("assembly_result_finished",e=>{let[t,r]=JSON.parse(e.data);this.status={...this.status,results:{...this.status.results,[t]:[...this.status.results?.[t]??[],r]}},this.emit("result",t,r)}),this.#i.addEventListener("assembly_execution_progress",e=>{let t=JSON.parse(e.data);this.emit("execution-progress",t)}),this.#i.addEventListener("assembly_error",e=>{try{this.#n(JSON.parse(e.data))}catch{this.#n(new Error(e.data))}this.#c({diff:!1})})}#n(e){this.emit("error",Object.assign(new Error(e.message),e)),this.close()}#a(){this.pollInterval=setInterval(()=>{this.#c()},2e3)}async#c({diff:e=!0}={}){if(!(this.closed||this.#e.isPaused||this.#r))try{this.#r=!0;let t=Mi(this.status),r=await this.#t(t);if(this.#r=!1,this.closed)return;if(r.status===429){this.#e.rateLimit(2e3);return}if(!r.ok){this.#n(new St(r.statusText));return}let s=await r.json();if(this.closed)return;e?this.updateStatus(s):this.status=s}catch(t){this.#n(t)}}update(){return this.#c({diff:!0})}updateStatus(e){this.#u(this.status,e),this.status=e}#u(e,t){let r=e.ok,s=t.ok;if(t.error&&!e.error)return this.#n(t);let n=Sn(s,pu)&&!Sn(r,pu);n&&this.emit("executing");let a=e.uploads,u=t.uploads;u!=null&&a!=null&&Object.keys(u).filter(f=>!ut(a,f)).forEach(f=>{this.emit("upload",u[f])}),n&&this.emit("metadata");let c=t.results,p=e.results;c!=null&&p!=null&&Object.keys(c).forEach(f=>{let d=c[f]??[],v=p[f]??[];d.filter(_=>!v||!v.some(k=>k.id===_.id)).forEach(_=>{this.emit("result",f,_)})}),Sn(s,du)&&!Sn(r,du)&&this.emit("finished")}close(){this.closed=!0,this.#i&&(this.#i.close(),this.#i=null),clearInterval(this.pollInterval),this.pollInterval=null}},fu=hu;var eg=ae(cu(),1);var mu=class extends eg.default{static{o(this,"TransloaditAssemblyWatcher")}#e;#t;promise;#r;#i;#s;constructor(e,t){super(),this.#s=e,this.#e=t,this.#t=t.length,this.promise=new Promise((r,s)=>{this.#r=r,this.#i=s}),this.#p()}#l(e){return this.#e.indexOf(e)!==-1}#o=o(e=>{let t=e.assembly_id;t==null||!this.#l(t)||(this.#s.log(`[Transloadit] AssemblyWatcher: Got Assembly finish ${t}`),this.emit("assembly-complete",t),this.#u())},"#onAssemblyComplete");#n=o(e=>{let t=e.assembly_id;t==null||!this.#l(t)||this.#u()},"#onAssemblyCancel");#a=o((e,t)=>{let r=e.assembly_id;r==null||!this.#l(r)||(this.#s.log(`[Transloadit] AssemblyWatcher: Got Assembly error ${r}`),this.#s.log(t),this.emit("assembly-error",r,t),this.#u())},"#onAssemblyError");#c=o((e,t,r)=>{let s=e.assembly_id;s==null||!this.#l(s)||this.#a(e,r)},"#onImportError");#u(){this.#t-=1,this.#t===0&&(this.#d(),this.#r())}#d(){this.#s.off("transloadit:complete",this.#o),this.#s.off("transloadit:assembly-cancel",this.#n),this.#s.off("transloadit:assembly-error",this.#a),this.#s.off("transloadit:import-error",this.#c)}#p(){this.#s.on("transloadit:complete",this.#o),this.#s.on("transloadit:assembly-cancel",this.#n),this.#s.on("transloadit:assembly-error",this.#a),this.#s.on("transloadit:import-error",this.#c)}},tg=mu;var ig="/assemblies",gu=class extends Error{static{o(this,"AssemblyError")}details;assembly;constructor(e,t,r){super(e),this.details=t,this.assembly=r}},Ks=class{static{o(this,"Client")}#e={};#t;opts;constructor(e){this.opts=e,this.opts.client!=null&&(this.#e["Transloadit-Client"]=this.opts.client),this.#t=this.opts.rateLimitedQueue.wrapPromiseFunction(Qt)}async#r(...e){let t=await this.#t(...e);if(t.status===429)return this.opts.rateLimitedQueue.rateLimit(2e3),this.#r(...e);if(!t.ok){let r=new Error(t.statusText);return r.statusCode=t.status,`${e[0]}`.endsWith(ig)?t.json().then(s=>{if(!s.error)throw r;let n=new gu(s.error,s.message,s);throw s.assembly_id&&(n.details+=` Assembly ID: ${s.assembly_id}`),n},s=>{throw s.cause=r,s}):Promise.reject(r)}return t.json()}async createAssembly({params:e,fields:t,signature:r,expectedFiles:s}){let n=new FormData;n.append("params",typeof e=="string"?e:JSON.stringify(e)),r&&n.append("signature",r),Object.keys(t).forEach(u=>{n.append(u,String(t[u]))}),n.append("num_expected_upload_files",String(s));let a=new URL(ig,`${this.opts.service}`).href;return this.#r(a,{method:"POST",headers:this.#e,body:n}).catch(u=>this.#i(u,{url:a,type:"API_ERROR"}))}async reserveFile(e,t){let r=encodeURIComponent(t.size),n=`${Mi(e)}/reserve_file?size=${r}`;return this.#r(n,{method:"POST",headers:this.#e}).catch(a=>this.#i(a,{assembly:e,file:t,url:n,type:"API_ERROR"}))}async addFile(e,t){if(!t.uploadURL)return Promise.reject(new Error("File does not have an `uploadURL`."));let r=encodeURIComponent(t.size),s=encodeURIComponent(t.uploadURL),n=encodeURIComponent(t.name??"Unnamed"),u=`size=${r}&filename=${n}&fieldname=file&s3Url=${s}`,p=`${Mi(e)}/add_file?${u}`;return this.#r(p,{method:"POST",headers:this.#e}).catch(f=>this.#i(f,{assembly:e,file:t,url:p,type:"API_ERROR"}))}async cancelAssembly(e){let t=Mi(e);await this.#t(t,{method:"DELETE",headers:this.#e}).catch(r=>this.#i(r,{url:t,type:"API_ERROR"}))}async getAssemblyStatus(e){return this.#r(e,{headers:this.#e}).catch(t=>this.#i(t,{url:e,type:"STATUS_ERROR"}))}async submitError(e,{endpoint:t,instance:r,assembly:s}={}){let n=e.details?`${e.message} (${e.details})`:e.message;return this.#r("https://transloaditstatus.com/client_error",{method:"POST",body:JSON.stringify({endpoint:t,instance:r,assembly_id:s,agent:typeof navigator<"u"?navigator.userAgent:"",client:this.opts.client,error:n})})}#i=o((e,t)=>{if(this.opts.errorReporting===!1)throw e;let r={type:t.type};throw t.assembly&&(r.assembly=t.assembly.assembly_id,r.instance=t.assembly.instance),t.url&&(r.endpoint=t.url),this.submitError(e,r).catch(()=>{}),e},"#reportError")};var rg={strings:{creatingAssembly:"Preparing upload...",creatingAssemblyFailed:"Transloadit: Could not create Assembly",encoding:"Encoding..."}};var v2={service:"https://api2.transloadit.com",errorReporting:!0,waitForEncoding:!1,waitForMetadata:!1,alwaysRunAssembly:!1,importFromUploadURLs:!1,limit:20,retryDelays:[7e3,1e4,15e3,2e4],clientName:null},sg=o(i=>e=>{let t=new di("Failed to send error to the client",{cause:e});console.error(t,i)},"sendErrorToConsole");function b2(i){if(i==null)throw new Error("Transloadit: The `params` option is required.");let e;if(typeof i=="string")try{e=JSON.parse(i)}catch(t){throw new di("Transloadit: The `params` option is a malformed JSON string.",{cause:t})}else e=i;if(!e.auth||!e.auth.key)throw new Error("Transloadit: The `params.auth.key` option is required. You can find your Transloadit API key at https://transloadit.com/c/template-credentials")}o(b2,"validateParams");function Li(i){if(!i.assembly_id)throw console.warn("Assembly status is missing `assembly_id`.",i),new Error("Transloadit: Assembly status is missing `assembly_id`.");return i.assembly_id}o(Li,"ensureAssemblyId");function yu(i,...e){for(let t of e)if(typeof t=="string"&&t.length>0)return t;throw new Error(`Transloadit: Assembly status is missing ${i}.`)}o(yu,"ensureUrl");function w2(i){return yu("`assembly_url`",i.assembly_url,i.assembly_ssl_url)}o(w2,"getAssemblyUrl");function Mi(i){return yu("`assembly_ssl_url`",i.assembly_ssl_url,i.assembly_url)}o(Mi,"getAssemblyUrlSsl");var og="https://api2.transloadit.com/companion",ng=/\.transloadit\.com$/,S2=/https?:\/\/api2(?:-\w+)?\.transloadit\.com\/companion/,Bi=class extends Pe{static{o(this,"Transloadit")}static VERSION=Jm.version;#e;client;#t;#r;completedFiles;restored=null;constructor(e,t){super(e,{...v2,...t}),this.type="uploader",this.id=this.opts.id||"Transloadit",this.defaultLocale=rg,this.#e=new ft(this.opts.limit),this.i18nInit(),this.client=new Ks({service:this.opts.service,client:this.#i(),errorReporting:this.opts.errorReporting,rateLimitedQueue:this.#e}),this.completedFiles=Object.create(null)}#i(){let e=[`uppy-core:${this.uppy.constructor.VERSION}`,`uppy-transloadit:${this.constructor.VERSION}`,`uppy-tus:${Ni.VERSION}`],t=o((r,s)=>{let n=this.uppy.getPlugin(r);n&&e.push(`${s}:${n.constructor.VERSION}`)},"addPluginVersion");return this.opts.importFromUploadURLs&&(t("XHRUpload","uppy-xhr-upload"),t("AwsS3","uppy-aws-s3"),t("AwsS3Multipart","uppy-aws-s3-multipart")),t("Dropbox","uppy-dropbox"),t("Box","uppy-box"),t("Facebook","uppy-facebook"),t("GoogleDrive","uppy-google-drive"),t("GoogleDrivePicker","uppy-google-drive-picker"),t("GooglePhotosPicker","uppy-google-photos-picker"),t("Instagram","uppy-instagram"),t("OneDrive","uppy-onedrive"),t("Zoom","uppy-zoom"),t("Url","uppy-url"),this.opts.clientName!=null&&e.push(this.opts.clientName),e.join(",")}#s(e,t){let r=w2(t),s=yu("`tus_url`",t.tus_url),n=Li(t),a={...e.meta,assembly_url:r,filename:e.name,fieldname:"file"},u={...e.tus,endpoint:s,addRequestId:!0},c;if("remote"in e&&e.remote&&({remote:c}=e,t.companion_url&&S2.test(e.remote.companionUrl))){let f=t.companion_url.replace(/\/$/,""),d=e.remote.url.replace(e.remote.companionUrl,"").replace(/^\//,"");c={...e.remote,companionUrl:f,url:`${f}/${d}`}}let p={...e,transloadit:{assembly:n}};return this.opts.importFromUploadURLs||Object.assign(p,{meta:a,tus:u,remote:c}),p}async#l(e,t){this.uppy.log("[Transloadit] Create Assembly");try{let r=await this.client.createAssembly({...t,expectedFiles:e.length}),s=this.uppy.getFiles().filter(({id:p})=>e.includes(p));if(s.length===0&&e.length!==0)return await this.client.cancelAssembly(r),null;let n=new fu(r,this.#e),{status:a}=n,u=Li(a),c={};return s.forEach(p=>{c[p.id]=this.#s(p,a)}),this.uppy.setState({files:{...this.uppy.getState().files,...c}}),this.uppy.emit("transloadit:assembly-created",a,e),this.uppy.log(`[Transloadit] Created Assembly ${u}`),n}catch(r){let s=new di(`${this.i18n("creatingAssemblyFailed")}: ${r.message}`,{cause:r});throw"details"in r&&(s.details=r.details),"assembly"in r&&(s.assembly=r.assembly),s}}#o(e){let t=Array.isArray(e)?e:[e],r=new tg(this.uppy,t);r.on("assembly-complete",s=>{this.getAssemblyFiles(s).forEach(a=>{this.completedFiles[a.id]=!0,this.uppy.emit("postprocess-complete",a)})}),r.on("assembly-error",(s,n)=>{let a=this.getAssemblyFiles(s);a.forEach(c=>{this.uppy.emit("upload-error",c,n),this.uppy.emit("postprocess-complete",c)});let u={...this.uppy.getState().files};a.forEach(c=>delete u[c.id].tus),this.uppy.setState({files:u}),this.uppy.emit("error",n)}),this.#r=r}#n(){return this.opts.waitForEncoding||this.opts.waitForMetadata}#a(e,t){return Promise.all(t.map(r=>{let s=this.uppy.getFile(r);return this.client.reserveFile(e.status,s)}))}#c=o(e=>{this.uppy.emit("restore:plugin-data-changed",{[this.id]:e?{assemblyResponse:e}:void 0})},"#handleAssemblyStatusUpdate");get assembly(){return this.#t}set assembly(e){!e&&this.assembly&&this.assembly.off("status",this.#c),this.#t=e,this.#c(e?.status),e&&e.on("status",this.#c)}#u=o(e=>{let t=this.uppy.getFile(e.id);if(!t?.transloadit?.assembly)return;let{status:r}=this.assembly;this.client.addFile(r,t).catch(s=>{this.uppy.log(s),this.uppy.emit("transloadit:import-error",r,t.id,s)})},"#onFileUploadURLAvailable");#d(e){let t=this.uppy.getFiles();for(let r=0;r<t.length;r++){let s=t[r];if(s.uploadURL===e.tus_upload_url||s.tus&&s.tus.uploadUrl===e.tus_upload_url||!e.is_tus_file&&s.name===e.name&&s.size===e.size)return s}}#p(e,t){let r=this.getPluginState(),s=this.#d(t);if(!s){this.uppy.log("[Transloadit] Couldn\u2019t find the file, it was likely removed in the process");return}this.setPluginState({files:{...r.files,[t.id]:{assembly:e,id:s.id,uploadedFile:t}}}),this.uppy.emit("transloadit:upload",t,this.getAssembly())}#h(e,t,r){let s=this.getPluginState();if(!("id"in r)){console.warn("Result has no id",r);return}if(typeof r.id!="string"){console.warn("Result has no id of type string",r);return}let n={result:r,stepName:t,id:r.id,assembly:e};this.setPluginState({results:[...s.results,n]}),this.uppy.emit("transloadit:result",t,n.result,this.getAssembly())}#f(e){let t=Mi(e.status);this.client.getAssemblyStatus(t).then(r=>{e.status=r,this.uppy.emit("transloadit:complete",r)})}async#g(e){await this.client.cancelAssembly(e),this.uppy.emit("transloadit:assembly-cancelled",e),this.assembly=void 0}#b=o(async()=>{if(this.assembly)try{await this.#g(this.assembly.status)}catch(e){this.uppy.log(e)}},"#onCancelAll");#m=o(e=>{let r=(e?.[this.id]?e[this.id]:{}).assemblyResponse;if(!r)return;let s=o(()=>{let u={},c=[],p=Li(r);r.uploads?.forEach(_=>{let k=this.#d(_);u[_.id]={id:k.id,assembly:p,uploadedFile:_}});let f=this.getPluginState(),d=r.results??{};Object.keys(d).forEach(_=>{let k=d[_]??[];for(let A of k){if(!("id"in A)){console.warn("Result has no id",A);continue}if(typeof A.id!="string"){console.warn("Result has no id of type string",A);continue}if(!("original_id"in A)){console.warn("Result has no original_id",A);continue}if(typeof A.original_id!="string"){console.warn("Result has no original_id of type string",A);continue}let F=f.files[A.original_id];c.push({id:A.id,result:{...A,localId:F?F.id:null},stepName:_,assembly:p})}});let v=new fu(r,this.#e);return v.status=r,this.assembly=v,this.setPluginState({files:u,results:c}),u},"restoreState"),n=o(u=>{this.#o(Li(r)),this.#y(this.assembly,u)},"restoreAssemblies"),a=o(()=>this.assembly?.update(),"updateAssembly");this.restored=(async()=>{let u=s();n(Object.keys(u)),await a(),this.restored=null})(),this.restored.catch(u=>{this.uppy.log("Failed to restore",u)})},"#onRestored");#y(e,t){let{status:r}=e,s=Li(r);return e.on("upload",n=>{this.#p(s,n)}),e.on("error",n=>{n.assembly=e.status,this.uppy.emit("transloadit:assembly-error",e.status,n)}),e.on("executing",()=>{this.uppy.emit("transloadit:assembly-executing",e.status)}),e.on("execution-progress",n=>{if(this.uppy.emit("transloadit:execution-progress",n),n.progress_combined!=null)for(let a of this.uppy.getFilesByIds(t))this.uppy.emit("postprocess-progress",a,{mode:"determinate",value:n.progress_combined/100,message:this.i18n("encoding")})}),this.opts.waitForEncoding&&e.on("result",(n,a)=>{this.#h(s,n,a)}),this.opts.waitForEncoding?e.on("finished",()=>{this.#f(e)}):this.opts.waitForMetadata&&e.on("metadata",()=>{this.#f(e)}),e.ok==="ASSEMBLY_COMPLETE"||e.connect(),e}#P=o(async e=>{let t=typeof this.opts.assemblyOptions=="function"?await this.opts.assemblyOptions():this.opts.assemblyOptions;t.fields={...t.fields??{}},b2(t.params);try{let r=this.assembly??await this.#l(e,t);if(r==null)throw new Error("All files were canceled after assembly was created");this.opts.importFromUploadURLs&&await this.#a(r,e),e.forEach(s=>{let n=this.uppy.getFile(s);this.uppy.emit("preprocess-complete",n)}),this.#o(Li(r.status)),this.assembly=r,this.#y(r,e)}catch(r){throw e.forEach(s=>{let n=this.uppy.getFile(s);this.uppy.emit("preprocess-complete",n),this.uppy.emit("upload-error",n,r)}),r}},"#prepareUpload");#S=o(async(e,t)=>{try{await this.restored;let r=e.map(c=>this.uppy.getFile(c)).filter(c=>!c.error),s=this.assembly?Li(this.assembly.status):void 0,n=o(()=>{this.assembly?.close()},"closeSocketConnections");if(!this.#n()){n();let c=this.assembly?.status;c!=null&&this.uppy.addResultData(t,{transloadit:[c]});return}if(!s){this.uppy.addResultData(t,{transloadit:[]});return}r.filter(c=>!ut(this.completedFiles,c.id)).forEach(c=>{this.uppy.emit("postprocess-progress",c,{mode:"indeterminate",message:this.i18n("encoding")})}),await this.#r.promise,n();let u=this.assembly?.status;u!=null&&this.uppy.addResultData(t,{transloadit:[u]})}finally{this.assembly=void 0}},"#afterUpload");#v=o(()=>{this.assembly?.close()},"#closeAssemblyIfExists");#x=o(e=>{this.#v(),this.assembly=void 0,this.client.submitError(e).catch(sg(e))},"#onError");#w=o((e,t)=>{if(this.#v(),t?.message?.startsWith("tus: ")){let r=t.originalRequest?.getUnderlyingObject()?.responseURL;this.client.submitError(t,{endpoint:r}).catch(sg(t))}},"#onTusError");install(){this.uppy.addPreProcessor(this.#P),this.uppy.addPostProcessor(this.#S),this.uppy.on("error",this.#x),this.uppy.on("cancel-all",this.#b),this.uppy.on("upload-error",this.#w),this.opts.importFromUploadURLs?this.uppy.on("upload-success",this.#u):this.uppy.use(Ni,{storeFingerprintForResuming:!1,allowedMetaFields:!0,limit:this.opts.limit,rateLimitedQueue:this.#e,retryDelays:this.opts.retryDelays}),this.uppy.on("restored",this.#m),this.setPluginState({files:{},results:[]});let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}uninstall(){this.uppy.removePreProcessor(this.#P),this.uppy.removePostProcessor(this.#S),this.uppy.off("error",this.#x),this.opts.importFromUploadURLs&&this.uppy.off("upload-success",this.#u);let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}getAssembly(){return this.assembly?.status}getAssemblyFiles(e){return this.uppy.getFiles().filter(t=>t?.transloadit?.assembly===e)}};var fg=ae(ag(),1);var lg={name:"@uppy/webcam",description:"Uppy plugin that takes photos or records videos using the device's camera.",version:"5.1.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin","webcam","picture","photo","video","record","mediarecorder"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^","is-mobile":"^4.0.0",preact:"^10.5.13"},devDependencies:{cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"}};function Xs(){return l("svg",{"aria-hidden":"true",focusable:"false",fill:"#0097DC",width:"66",height:"55",viewBox:"0 0 66 55",children:l("path",{d:"M57.3 8.433c4.59 0 8.1 3.51 8.1 8.1v29.7c0 4.59-3.51 8.1-8.1 8.1H8.7c-4.59 0-8.1-3.51-8.1-8.1v-29.7c0-4.59 3.51-8.1 8.1-8.1h9.45l4.59-7.02c.54-.54 1.35-1.08 2.16-1.08h16.2c.81 0 1.62.54 2.16 1.08l4.59 7.02h9.45zM33 14.64c-8.62 0-15.393 6.773-15.393 15.393 0 8.62 6.773 15.393 15.393 15.393 8.62 0 15.393-6.773 15.393-15.393 0-8.62-6.773-15.393-15.393-15.393zM33 40c-5.648 0-9.966-4.319-9.966-9.967 0-5.647 4.318-9.966 9.966-9.966s9.966 4.319 9.966 9.966C42.966 35.681 38.648 40 33 40z",fillRule:"evenodd"})})}o(Xs,"CameraIcon");function E2({onDiscard:i,i18n:e}){return l("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--discard",type:"button",title:e("discardRecordedFile"),"aria-label":e("discardRecordedFile"),onClick:i,"data-uppy-super-focusable":!0,children:l("svg",{width:"13",height:"13",viewBox:"0 0 13 13",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon",children:l("g",{fill:"#FFF",fillRule:"evenodd",children:[l("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),l("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"})]})})})}o(E2,"DiscardButton");var ug=E2;function bu({recording:i,onStartRecording:e,onStopRecording:t,i18n:r}){return i?l("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:r("stopRecording"),"aria-label":r("stopRecording"),onClick:t,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:l("rect",{x:"15",y:"15",width:"70",height:"70"})})}):l("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:r("startRecording"),"aria-label":r("startRecording"),onClick:e,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:l("circle",{cx:"50",cy:"50",r:"40"})})})}o(bu,"RecordButton");function wu(i){return`${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`}o(wu,"formatSeconds");function Su({recordingLengthSeconds:i}){let e=wu(i);return l("span",{children:e})}o(Su,"RecordingLength");function xu({onSnapshot:i,i18n:e}){return l("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture",type:"button",title:e("takePicture"),"aria-label":e("takePicture"),onClick:i,"data-uppy-super-focusable":!0,children:Xs()})}o(xu,"SnapshotButton");function F2({onSubmit:i,i18n:e}){return l("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--submit",type:"button",title:e("submitRecordedFile"),"aria-label":e("submitRecordedFile"),onClick:i,"data-uppy-super-focusable":!0,children:l("svg",{width:"12",height:"9",viewBox:"0 0 12 9",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon",children:l("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})})})}o(F2,"SubmitButton");var cg=F2;function Pu({currentDeviceId:i,videoSources:e,onChangeVideoSource:t}){return l("div",{className:"uppy-Webcam-videoSource",children:l("select",{className:"uppy-u-reset uppy-Webcam-videoSource-select",onChange:o(r=>{t(r.target.value)},"onChange"),children:e.map(r=>l("option",{value:r.deviceId,selected:r.deviceId===i,children:r.label},r.deviceId))})})}o(Pu,"VideoSourceSelect");function Pn(i,e){return i.includes(e)}o(Pn,"isModeAvailable");var _u=class extends Se{static{o(this,"CameraScreen")}videoElement;refs;componentDidMount(){let{onFocus:e}=this.props;e()}componentWillUnmount(){let{onStop:e}=this.props;e()}render(){let{src:e,recordedVideo:t,capturedSnapshot:r,recording:s,modes:n,supportsRecording:a,videoSources:u,showVideoSourceDropdown:c,showRecordingLength:p,onSubmit:f,i18n:d,mirror:v,onSnapshot:_,onStartRecording:k,onStopRecording:A,onDiscardRecordedMedia:F,recordingLengthSeconds:R}=this.props,U=!!t,C=!!r,Y=U||C,$=!Y&&a&&(Pn(n,"video-only")||Pn(n,"audio-only")||Pn(n,"video-audio")),H=!Y&&Pn(n,"picture"),Q=a&&p&&!U,K=c&&u&&u.length>1,Z={playsInline:!0};return t?(Z.muted=!1,Z.controls=!0,Z.src=t,this.videoElement&&(this.videoElement.srcObject=null)):(Z.muted=!0,Z.autoPlay=!0,Z.srcObject=e),l("div",{className:"uppy uppy-Webcam-container",children:[l("div",{className:"uppy-Webcam-videoContainer",children:r&&!s&&!t?l("div",{className:"uppy-Webcam-imageContainer",children:l("img",{src:r,className:"uppy-Webcam-video",alt:"capturedSnapshot"})}):l("video",{ref:o(ye=>{this.videoElement=ye},"ref"),className:`uppy-Webcam-video ${v?"uppy-Webcam-video--mirrored":""}`,...Z})}),l("div",{className:"uppy-Webcam-footer",children:[l("div",{className:"uppy-Webcam-videoSourceContainer",children:K?Pu(this.props):null}),l("div",{className:"uppy-Webcam-buttonContainer",children:[H&&l(xu,{onSnapshot:_,i18n:d}),$&&l(bu,{recording:s,onStartRecording:k,onStopRecording:A,i18n:d}),(U||C)&&l(cg,{onSubmit:f,i18n:d}),(U||C)&&l(ug,{onDiscard:F,i18n:d})]}),l("div",{className:"uppy-Webcam-recordingLength",children:Q&&l(Su,{recordingLengthSeconds:R})})]})]})}},pg=_u;var dg={strings:{pluginNameCamera:"Camera",noCameraTitle:"Camera Not Available",noCameraDescription:"In order to take pictures or record video, please connect a camera device",recordingStoppedMaxSize:"Recording stopped because the file size is about to exceed the limit",submitRecordedFile:"Submit recorded file",discardRecordedFile:"Discard recorded file",smile:"Smile!",takePicture:"Take a picture",startRecording:"Begin video recording",stopRecording:"Stop video recording",recordingLength:"Recording length %{recording_length}",allowAccessTitle:"Please allow access to your camera",allowAccessDescription:"In order to take pictures or record video with your camera, please allow camera access for this site."}};function ku({icon:i,i18n:e,hasCamera:t}){return l("div",{className:"uppy-Webcam-permissons",children:[l("div",{className:"uppy-Webcam-permissonsIcon",children:i()}),l("div",{className:"uppy-Webcam-title",children:e(t?"allowAccessTitle":"noCameraTitle")}),l("p",{children:e(t?"allowAccessDescription":"noCameraDescription")})]})}o(ku,"PermissionsScreen");function Eu(){return typeof MediaRecorder=="function"&&!!MediaRecorder.prototype&&typeof MediaRecorder.prototype.start=="function"}o(Eu,"supportsMediaRecorder");function hg(i){return i[0]==="."?Wi[i.slice(1)]:i}o(hg,"toMimeType");function T2(i){return/^video\/[^*]+$/.test(i)}o(T2,"isVideoMimeType");function C2(i){return/^image\/[^*]+$/.test(i)}o(C2,"isImageMimeType");function A2(){return navigator.mediaDevices}o(A2,"getMediaDevices");function Fu(i,e){return i.includes(e)}o(Fu,"isModeAvailable");var mg={onBeforeSnapshot:o(()=>Promise.resolve(),"onBeforeSnapshot"),countdown:!1,modes:["video-audio","video-only","audio-only","picture"],mirror:!0,showVideoSourceDropdown:!1,preferredImageMimeType:null,preferredVideoMimeType:null,showRecordingLength:!1,mobileNativeCamera:(0,fg.isMobile)({tablet:!0})},Ys=class extends re{static{o(this,"Webcam")}static VERSION=lg.version;#e;mediaDevices;supportsUserMedia;protocol;capturedMediaFile;icon;webcamActive;stream=null;recorder=null;recordingChunks=null;recordingLengthTimer;captureInProgress=!1;constructor(e,t){super(e,{...mg,...t}),this.mediaDevices=A2(),this.supportsUserMedia=!!this.mediaDevices,this.protocol=location.protocol.match(/https/i)?"https":"http",this.id=this.opts.id||"Webcam",this.type="acquirer",this.capturedMediaFile=null,this.icon=()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383",fillRule:"nonzero"})}),this.defaultLocale=dg,this.i18nInit(),this.title=this.i18n("pluginNameCamera"),this.#e=this.opts.mirror,this.install=this.install.bind(this),this.setPluginState=this.setPluginState.bind(this),this.render=this.render.bind(this),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.takeSnapshot=this.takeSnapshot.bind(this),this.startRecording=this.startRecording.bind(this),this.stopRecording=this.stopRecording.bind(this),this.discardRecordedMedia=this.discardRecordedMedia.bind(this),this.submit=this.submit.bind(this),this.oneTwoThreeSmile=this.oneTwoThreeSmile.bind(this),this.focus=this.focus.bind(this),this.changeVideoSource=this.changeVideoSource.bind(this),this.webcamActive=!1,this.opts.countdown&&(this.opts.onBeforeSnapshot=this.oneTwoThreeSmile),this.setPluginState({hasCamera:!1,cameraReady:!1,cameraError:null,recordingLengthSeconds:0,videoSources:[],currentDeviceId:null,capturedSnapshot:null})}getStatus(){let{recordedVideo:e,capturedSnapshot:t,isRecording:r,cameraReady:s,cameraError:n}=this.getPluginState();return r?"recording":e!=null||t!=null?"captured":s?"ready":n?"error":"init"}setOptions(e){super.setOptions({...e,videoConstraints:{...this.opts.videoConstraints,...e?.videoConstraints}})}hasCameraCheck(){return this.mediaDevices?this.mediaDevices.enumerateDevices().then(e=>e.some(t=>t.kind==="videoinput")):Promise.resolve(!1)}isAudioOnly(){return this.opts.modes.length===1&&this.opts.modes[0]==="audio-only"}getConstraints(e=null){let t=this.opts.modes.indexOf("video-audio")!==-1||this.opts.modes.indexOf("audio-only")!==-1,r=!this.isAudioOnly()&&(this.opts.modes.indexOf("video-audio")!==-1||this.opts.modes.indexOf("video-only")!==-1||this.opts.modes.indexOf("picture")!==-1),s={...this.opts.videoConstraints||{},...e!=null&&{deviceId:e}};return{audio:t,video:r?s:!1}}start(e=null){if(!this.supportsUserMedia)return Promise.reject(new Error("Webcam access not supported"));this.webcamActive=!0,this.opts.mirror&&(this.#e=!0);let t=this.getConstraints(e?.deviceId);this.hasCameraCheck().then(r=>(this.setPluginState({hasCamera:r}),this.mediaDevices.getUserMedia(t).then(s=>{this.stream=s;let n=null,a=this.isAudioOnly()?s.getAudioTracks():s.getVideoTracks();!e||!e.deviceId?n=a[0].getSettings().deviceId:a.forEach(u=>{u.getSettings().deviceId===e.deviceId&&(n=u.getSettings().deviceId)}),this.updateVideoSources(),this.setPluginState({currentDeviceId:n,cameraReady:!0})}).catch(s=>{this.setPluginState({cameraReady:!1,cameraError:s}),this.uppy.info(s.message,"error")})))}getMediaRecorderOptions(){let e={};if(MediaRecorder.isTypeSupported){let{restrictions:t}=this.uppy.opts,r=[];this.opts.preferredVideoMimeType?r=[this.opts.preferredVideoMimeType]:t.allowedFileTypes&&(r=t.allowedFileTypes.map(hg).filter(T2));let s=o(a=>MediaRecorder.isTypeSupported(a)&&xt(a),"filterSupportedTypes"),n=r.filter(s);n.length>0&&(e.mimeType=n[0])}return e}startRecording(){this.recorder=new MediaRecorder(this.stream,this.getMediaRecorderOptions()),this.recordingChunks=[];let e=!1;this.recorder.addEventListener("dataavailable",t=>{this.recordingChunks.push(t.data);let{restrictions:r}=this.uppy.opts;if(this.recordingChunks.length>1&&r.maxFileSize!=null&&!e){let s=this.recordingChunks.reduce((c,p)=>c+p.size,0),a=(s-this.recordingChunks[0].size)/(this.recordingChunks.length-1)*3,u=Math.max(0,r.maxFileSize-a);s>u&&(e=!0,this.uppy.info(this.i18n("recordingStoppedMaxSize"),"warning",4e3),this.stopRecording())}}),this.recorder.start(500),this.opts.showRecordingLength&&(this.recordingLengthTimer=setInterval(()=>{let t=this.getPluginState().recordingLengthSeconds;this.setPluginState({recordingLengthSeconds:t+1})},1e3)),this.setPluginState({isRecording:!0})}stopRecording(){return new Promise(t=>{this.recorder.addEventListener("stop",()=>{t()}),this.recorder.stop(),this.opts.showRecordingLength&&(clearInterval(this.recordingLengthTimer),this.setPluginState({recordingLengthSeconds:0}))}).then(()=>(this.setPluginState({isRecording:!1}),this.getVideo())).then(t=>{try{this.capturedMediaFile=t,this.setPluginState({recordedVideo:URL.createObjectURL(t.data)}),this.#e=!1}catch(r){r.isRestriction||this.uppy.log(r)}}).then(()=>{this.recordingChunks=null,this.recorder=null},t=>{throw this.recordingChunks=null,this.recorder=null,t})}discardRecordedMedia(){let{recordedVideo:e,capturedSnapshot:t}=this.getPluginState();e&&URL.revokeObjectURL(e),t&&URL.revokeObjectURL(t),this.setPluginState({recordedVideo:null,capturedSnapshot:null}),this.opts.mirror&&(this.#e=!0),this.capturedMediaFile=null}submit(){try{this.capturedMediaFile&&this.uppy.addFile(this.capturedMediaFile)}catch(e){e.isRestriction||this.uppy.log(e,"error")}}async stop(){if(this.stream){let e=this.stream.getAudioTracks(),t=this.stream.getVideoTracks();e.concat(t).forEach(r=>r.stop())}this.recorder&&await new Promise(e=>{this.recorder.addEventListener("stop",e,{once:!0}),this.recorder.stop(),this.opts.showRecordingLength&&clearInterval(this.recordingLengthTimer)}),this.recordingChunks=null,this.recorder=null,this.webcamActive=!1,this.stream=null,this.setPluginState({recordedVideo:null,capturedSnapshot:null,isRecording:!1,recordingLengthSeconds:0})}getVideoElement(){return this.el.querySelector(".uppy-Webcam-video")}oneTwoThreeSmile(){return new Promise((e,t)=>{let r=this.opts.countdown,s=setInterval(()=>{if(!this.webcamActive)return clearInterval(s),this.captureInProgress=!1,t(new Error("Webcam is not active"));r?(this.uppy.info(`${r}...`,"warning",800),r--):(clearInterval(s),this.uppy.info(this.i18n("smile"),"success",1500),setTimeout(()=>e(),1500))},1e3)})}async takeSnapshot(){if(!this.captureInProgress){this.captureInProgress=!0;try{await this.opts.onBeforeSnapshot()}catch(e){let t=typeof e=="object"?e.message:e;throw this.uppy.info(t,"error",5e3),new Error(`onBeforeSnapshot: ${t}`)}try{let e=await this.getImage();if(this.capturedMediaFile=e,e.data==null)throw new Error("File data is empty");let t=URL.createObjectURL(e.data);this.setPluginState({capturedSnapshot:t}),this.captureInProgress=!1}catch(e){this.captureInProgress=!1,e.isRestriction||this.uppy.log(e)}}}async getImage(){let e=this.getVideoElement();if(!e)return Promise.reject(new Error("No video element found, likely due to the Webcam tab being closed."));let t=e.videoWidth,r=e.videoHeight,s=document.createElement("canvas");s.width=t,s.height=r,s.getContext("2d").drawImage(e,0,0);let{restrictions:a}=this.uppy.opts,u=[];this.opts.preferredImageMimeType?u=[this.opts.preferredImageMimeType]:a.allowedFileTypes&&(u=a.allowedFileTypes.map(hg).filter(C2));let c=u[0]||"image/jpeg",p=xt(c)||"jpg",f=`cam-${Date.now()}.${p}`;return so(s,c).then(d=>({source:this.id,name:f,data:new Blob([d],{type:c}),type:c}))}getVideo(){let e=this.recordingChunks.find(a=>a.type?.length>0).type,t=xt(e);if(!t)return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type "${e}"`));let r=`webcam-${Date.now()}.${t}`,s=new Blob(this.recordingChunks,{type:e}),n={source:this.id,name:r,data:new Blob([s],{type:e}),type:e};return Promise.resolve(n)}focus(){this.opts.countdown&&setTimeout(()=>{this.uppy.info(this.i18n("smile"),"success",1500)},1e3)}changeVideoSource(e){this.stop(),this.start({deviceId:e})}updateVideoSources(){this.mediaDevices.enumerateDevices().then(e=>{this.setPluginState({videoSources:e.filter(t=>t.kind==="videoinput")})})}render(){this.webcamActive||this.start();let e=this.getPluginState();return!e.cameraReady||!e.hasCamera?l(ku,{icon:Xs,i18n:this.i18n,hasCamera:e.hasCamera}):l(pg,{...e,onChangeVideoSource:this.changeVideoSource,onSnapshot:this.takeSnapshot,onStartRecording:this.startRecording,onStopRecording:this.stopRecording,onDiscardRecordedMedia:this.discardRecordedMedia,onSubmit:this.submit,onFocus:this.focus,onStop:this.stop,i18n:this.i18n,modes:this.opts.modes,showRecordingLength:this.opts.showRecordingLength,showVideoSourceDropdown:this.opts.showVideoSourceDropdown,supportsRecording:Eu(),recording:e.isRecording,mirror:this.#e,src:this.stream})}install(){let{mobileNativeCamera:e,modes:t,videoConstraints:r}=this.opts,{target:s}=this.opts;if(e&&s){this.getTargetPlugin(s)?.setOptions({showNativeVideoCameraButton:Fu(t,"video-only")||Fu(t,"video-audio"),showNativePhotoCameraButton:Fu(t,"picture"),nativeCameraFacingMode:r?.facingMode});return}this.setPluginState({cameraReady:!1,recordingLengthSeconds:0}),s&&this.mount(s,this),this.mediaDevices&&(this.updateVideoSources(),this.mediaDevices.ondevicechange=()=>{if(this.updateVideoSources(),this.stream){let n=!0,{videoSources:a,currentDeviceId:u}=this.getPluginState();a.forEach(c=>{u===c.deviceId&&(n=!1)}),n&&(this.stop(),this.start())}})}uninstall(){this.stop(),this.unmount()}onUnmount(){this.stop()}};var gg={name:"@uppy/xhr-upload",description:"Plain and simple classic HTML multipart form uploads with Uppy, as well as uploads using the HTTP PUT method.",version:"5.1.1",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","xhr","xhr upload","XMLHttpRequest","ajax","fetch","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/utils":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",jsdom:"^26.1.0",nock:"^13.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"}};var yg={strings:{uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it."}};function U2(i,e){let t=e;return t||(t=new Error("Upload error")),typeof t=="string"&&(t=new Error(t)),t instanceof Error||(t=Object.assign(new Error("Upload error"),{data:t})),Lr(i)?(t=new St(t,i),t):(t.request=i,t)}o(U2,"buildResponseError");function vg(i){return i.data.slice(0,i.data.size,i.meta.type)}o(vg,"setTypeInBlob");var O2={formData:!0,fieldName:"file",method:"post",allowedMetaFields:!0,bundle:!1,headers:{},timeout:30*1e3,limit:5,withCredentials:!1,responseType:""},_n=class extends Pe{static{o(this,"XHRUpload")}static VERSION=gg.version;#e;requests;uploaderEvents;constructor(e,t){if(super(e,{...O2,fieldName:t.bundle?"files[]":"file",...t}),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.defaultLocale=yg,this.i18nInit(),zr in this.opts?this.requests=this.opts[zr]:this.requests=new ft(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");if(this.opts.bundle&&typeof this.opts.headers=="function")throw new Error("`opts.headers` can not be a function when the `bundle: true` option is set.");if(t?.allowedMetaFields===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");this.uploaderEvents=Object.create(null),this.#e=r=>async(s,n)=>{try{let a=await In(s,{...n,onBeforeRequest:o((p,f)=>this.opts.onBeforeRequest?.(p,f,r),"onBeforeRequest"),shouldRetry:this.opts.shouldRetry,onAfterResponse:this.opts.onAfterResponse,onTimeout:o(p=>{let f=Math.ceil(p/1e3),d=new Error(this.i18n("uploadStalled",{seconds:f}));this.uppy.emit("upload-stalled",d,r)},"onTimeout"),onUploadProgress:o(p=>{if(p.lengthComputable)for(let{id:f}of r){let d=this.uppy.getFile(f);d!=null&&this.uppy.emit("upload-progress",d,{uploadStarted:d.progress.uploadStarted??0,bytesUploaded:p.loaded/p.total*d.size,bytesTotal:d.size})}},"onUploadProgress")}),u=await this.opts.getResponseData?.(a);if(a.responseType==="json")u??=a.response;else try{u??=JSON.parse(a.responseText)}catch(p){throw new Error("@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.",{cause:p})}let c=typeof u?.url=="string"?u.url:void 0;for(let{id:p}of r)this.uppy.emit("upload-success",this.uppy.getFile(p),{status:a.status,body:u,uploadURL:c});return a}catch(a){if(a.name==="AbortError")return;let u=a.request;for(let c of r)this.uppy.emit("upload-error",this.uppy.getFile(c.id),U2(u,a),u);throw a}}}getOptions(e){let t=this.uppy.getState().xhrUpload,{headers:r}=this.opts,s={...this.opts,...t||{},...e.xhrUpload||{},headers:{}};return typeof r=="function"?s.headers=r(e):Object.assign(s.headers,this.opts.headers),t&&Object.assign(s.headers,t.headers),e.xhrUpload&&Object.assign(s.headers,e.xhrUpload.headers),s}addMetadata(e,t,r){At(r.allowedMetaFields,t).forEach(n=>{let a=t[n];Array.isArray(a)?a.forEach(u=>e.append(n,u)):e.append(n,a)})}createFormDataUpload(e,t){let r=new FormData;this.addMetadata(r,e.meta,t);let s=vg(e);return e.name?r.append(t.fieldName,s,e.meta.name):r.append(t.fieldName,s),r}createBundledUpload(e,t){let r=new FormData,{meta:s}=this.uppy.getState();return this.addMetadata(r,s,t),e.forEach(n=>{let a=this.getOptions(n),u=vg(n);n.name?r.append(a.fieldName,u,n.name):r.append(a.fieldName,u)}),r}async#t(e){let t=new Ot(this.uppy),r=new AbortController,s=this.requests.wrapPromiseFunction(async()=>{let n=this.getOptions(e),a=this.#e([e]),u=n.formData?this.createFormDataUpload(e,n):e.data,c=typeof n.endpoint=="string"?n.endpoint:await n.endpoint(e);return a(c,{...n,body:u,signal:r.signal})});t.onFileRemove(e.id,()=>r.abort()),t.onCancelAll(e.id,()=>{r.abort()});try{await s()}catch(n){if(n.message!=="Cancelled")throw n}finally{t.remove()}}async#r(e){let t=new AbortController,r=this.requests.wrapPromiseFunction(async()=>{let n=this.uppy.getState().xhrUpload??{},a=this.#e(e),u=this.createBundledUpload(e,{...this.opts,...n}),c=typeof this.opts.endpoint=="string"?this.opts.endpoint:await this.opts.endpoint(e);return a(c,{...this.opts,body:u,signal:t.signal})});function s(){t.abort()}o(s,"abort"),this.uppy.once("cancel-all",s);try{await r()}catch(n){if(n.message!=="Cancelled")throw n}finally{this.uppy.off("cancel-all",s)}}#i(e){let t=this.getOptions(e),r=At(t.allowedMetaFields,e.meta);return{...e.remote?.body,protocol:"multipart",endpoint:t.endpoint,size:e.data.size,fieldname:t.fieldName,metadata:Object.fromEntries(r.map(s=>[s,e.meta[s]])),httpMethod:t.method,useFormData:t.formData,headers:t.headers}}async#s(e){await Promise.allSettled(e.map(t=>{if(t.isRemote){let r=o(()=>this.requests,"getQueue"),s=new AbortController,n=o(u=>{u.id===t.id&&s.abort()},"removedHandler");this.uppy.on("file-removed",n);let a=this.uppy.getRequestClientForFile(t).uploadRemoteFile(t,this.#i(t),{signal:s.signal,getQueue:r});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",n)},{priority:-1})(),a}return this.#t(t)}))}#l=o(async e=>{if(e.length===0){this.uppy.log("[XHRUpload] No files to upload!");return}this.opts.limit===0&&!this.opts[zr]&&this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");let t=this.uppy.getFilesByIds(e),r=hi(t),s=fi(r);if(this.uppy.emit("upload-start",s),this.opts.bundle){if(r.some(a=>a.isRemote))throw new Error("Can\u2019t upload remote files when the `bundle: true` option is set");if(typeof this.opts.headers=="function")throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");await this.#r(r)}else await this.#s(r)},"#handleUpload");install(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}this.uppy.addUploader(this.#l)}uninstall(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(this.#l)}};function a9(){throw new Error("Core has been renamed to Uppy")}o(a9,"Core");var l9={ProviderView:Ea};Bi.COMPANION_URL=og;Bi.COMPANION_ALLOWED_HOSTS=ng;var c9={};export{as as Audio,Lo as AwsS3,Pe as BasePlugin,xi as Box,Bo as Compressor,a9 as Core,Ts as Dashboard,ta as DefaultStore,Cs as DragDrop,Qo as DropTarget,Fi as Dropbox,Ti as Facebook,tn as Form,nn as GoldenRetriever,Ci as GoogleDrive,Us as GoogleDrivePicker,Os as GooglePhotosPicker,Is as ImageEditor,Ai as Instagram,Ri as OneDrive,ln as RemoteSources,Ns as ScreenCapture,Ls as StatusBar,hr as ThumbnailGenerator,Bi as Transloadit,Ni as Tus,re as UIPlugin,Ui as Unsplash,ua as Uppy,si as Url,Ys as Webcam,_n as XHRUpload,Oi as Zoom,fo as debugLogger,c9 as locales,xp as server,l9 as views};
/**
* Takes a string with placeholder variables like `%{smart_count} file selected`
* and replaces it with values from options `{smart_count: 5}`
*
* @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
* taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
*
* @param phrase that needs interpolation, with placeholders
* @param options with values that will be used to replace placeholders
*/
/*! Bundled license information:
classnames/index.js:
(*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*)
compressorjs/dist/compressor.js:
(*!
* Compressor.js v1.2.1
* https://fengyuanchen.github.io/compressorjs
*
* Copyright 2018-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2023-02-28T14:09:41.732Z
*)
cropperjs/dist/cropper.js:
(*!
* Cropper.js v1.6.2
* https://fengyuanchen.github.io/cropperjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2024-04-21T07:43:05.335Z
*)
tus-js-client/lib.esm/upload.js:
tus-js-client/lib.esm/browser/fileReader.js:
(*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE *)
*/
//# sourceMappingURL=uppy.min.mjs.map