uppy
Version:
Extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Dropbox, Google Drive, S3 and more :dog:
69 lines • 593 kB
JavaScript
var hy=Object.create;var no=Object.defineProperty;var fy=Object.getOwnPropertyDescriptor;var my=Object.getOwnPropertyNames;var gy=Object.getPrototypeOf,yy=Object.prototype.hasOwnProperty;var o=(i,e)=>no(i,"name",{value:e,configurable:!0});var ye=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},jn=(i,e)=>{for(var t in e)no(i,t,{get:e[t],enumerable:!0})},vy=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of my(e))!yy.call(i,s)&&s!==t&&no(i,s,{get:()=>e[s],enumerable:!(r=fy(e,s))||r.enumerable});return i};var he=(i,e,t)=>(t=i!=null?hy(gy(i)):{},vy(e||!i||!i.__esModule?no(t,"default",{value:i,enumerable:!0}):t,i));var Dc=ye((mE,Ic)=>{"use strict";function Oc(i,e){this.text=i=i||"",this.hasWild=~i.indexOf("*"),this.separator=e,this.parts=i.split(e)}o(Oc,"WildcardMatcher");Oc.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};Ic.exports=function(i,e,t){var r=new Oc(i,t||/[\/\.]/);return typeof e<"u"?r.match(e):r}});var Mc=ye((yE,Nc)=>{var Wy=Dc(),Gy=/[\/\+\.]/;Nc.exports=function(i,e){function t(r){var s=Wy(r,i,Gy);return s&&s.length>=2}return o(t,"test"),e?t(e.split(";")[0]):t}});var _o=ye((kE,jc)=>{function Ky(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}o(Ky,"isObject");jc.exports=Ky});var Hc=ye((FE,zc)=>{var Yy=typeof global=="object"&&global&&global.Object===Object&&global;zc.exports=Yy});var ca=ye((RE,qc)=>{var Jy=Hc(),Qy=typeof self=="object"&&self&&self.Object===Object&&self,Zy=Jy||Qy||Function("return this")();qc.exports=Zy});var Vc=ye((AE,$c)=>{var ev=ca(),tv=o(function(){return ev.Date.now()},"now");$c.exports=tv});var Gc=ye((OE,Wc)=>{var iv=/\s/;function rv(i){for(var e=i.length;e--&&iv.test(i.charAt(e)););return e}o(rv,"trimmedEndIndex");Wc.exports=rv});var Kc=ye((DE,Xc)=>{var sv=Gc(),ov=/^\s+/;function nv(i){return i&&i.slice(0,sv(i)+1).replace(ov,"")}o(nv,"baseTrim");Xc.exports=nv});var pa=ye((ME,Yc)=>{var av=ca(),lv=av.Symbol;Yc.exports=lv});var ep=ye((LE,Zc)=>{var Jc=pa(),Qc=Object.prototype,uv=Qc.hasOwnProperty,cv=Qc.toString,ts=Jc?Jc.toStringTag:void 0;function pv(i){var e=uv.call(i,ts),t=i[ts];try{i[ts]=void 0;var r=!0}catch{}var s=cv.call(i);return r&&(e?i[ts]=t:delete i[ts]),s}o(pv,"getRawTag");Zc.exports=pv});var ip=ye((jE,tp)=>{var dv=Object.prototype,hv=dv.toString;function fv(i){return hv.call(i)}o(fv,"objectToString");tp.exports=fv});var np=ye((HE,op)=>{var rp=pa(),mv=ep(),gv=ip(),yv="[object Null]",vv="[object Undefined]",sp=rp?rp.toStringTag:void 0;function bv(i){return i==null?i===void 0?vv:yv:sp&&sp in Object(i)?mv(i):gv(i)}o(bv,"baseGetTag");op.exports=bv});var lp=ye(($E,ap)=>{function wv(i){return i!=null&&typeof i=="object"}o(wv,"isObjectLike");ap.exports=wv});var cp=ye((WE,up)=>{var Sv=np(),xv=lp(),_v="[object Symbol]";function Ev(i){return typeof i=="symbol"||xv(i)&&Sv(i)==_v}o(Ev,"isSymbol");up.exports=Ev});var fp=ye((XE,hp)=>{var Pv=Kc(),pp=_o(),Tv=cp(),dp=NaN,kv=/^[-+]0x[0-9a-f]+$/i,Cv=/^0b[01]+$/i,Fv=/^0o[0-7]+$/i,Rv=parseInt;function Av(i){if(typeof i=="number")return i;if(Tv(i))return dp;if(pp(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=pp(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=Pv(i);var t=Cv.test(i);return t||Fv.test(i)?Rv(i.slice(2),t?2:8):kv.test(i)?dp:+i}o(Av,"toNumber");hp.exports=Av});var Eo=ye((YE,gp)=>{var Uv=_o(),da=Vc(),mp=fp(),Ov="Expected a function",Iv=Math.max,Dv=Math.min;function Nv(i,e,t){var r,s,n,a,l,c,p=0,h=!1,g=!1,y=!0;if(typeof i!="function")throw new TypeError(Ov);e=mp(e)||0,Uv(t)&&(h=!!t.leading,g="maxWait"in t,n=g?Iv(mp(t.maxWait)||0,e):n,y="trailing"in t?!!t.trailing:y);function S(B){var Q=r,K=s;return r=s=void 0,p=B,a=i.apply(K,Q),a}o(S,"invokeFunc");function P(B){return p=B,l=setTimeout(q,e),h?S(B):a}o(P,"leadingEdge");function F(B){var Q=B-c,K=B-p,ee=e-Q;return g?Dv(ee,n-K):ee}o(F,"remainingWait");function D(B){var Q=B-c,K=B-p;return c===void 0||Q>=e||Q<0||g&&K>=n}o(D,"shouldInvoke");function q(){var B=da();if(D(B))return R(B);l=setTimeout(q,F(B))}o(q,"timerExpired");function R(B){return l=void 0,y&&r?S(B):(r=s=void 0,a)}o(R,"trailingEdge");function C(){l!==void 0&&clearTimeout(l),p=0,r=c=s=l=void 0}o(C,"cancel");function j(){return l===void 0?a:R(da())}o(j,"flush");function W(){var B=da(),Q=D(B);if(r=arguments,s=this,c=B,Q){if(l===void 0)return P(c);if(g)return clearTimeout(l),l=setTimeout(q,e),S(c)}return l===void 0&&(l=setTimeout(q,e)),a}return o(W,"debounced"),W.cancel=C,W.flush=j,W}o(Nv,"debounce");gp.exports=Nv});var Po=ye((QE,yp)=>{var Mv=Eo(),Lv=_o(),Bv="Expected a function";function jv(i,e,t){var r=!0,s=!0;if(typeof i!="function")throw new TypeError(Bv);return Lv(t)&&(r="leading"in t?!!t.leading:r,s="trailing"in t?!!t.trailing:s),Mv(i,e,{leading:r,maxWait:e,trailing:s})}o(jv,"throttle");yp.exports=jv});var bp=ye((e5,vp)=>{vp.exports=o(function(){var e={},t=e._fns={};e.emit=o(function(a,l,c,p,h,g,y){var S=r(a);S.length&&s(a,S,[l,c,p,h,g,y])},"emit"),e.on=o(function(a,l){t[a]||(t[a]=[]),t[a].push(l)},"on"),e.once=o(function(a,l){function c(){l.apply(this,arguments),e.off(a,c)}o(c,"one"),this.on(a,c)},"once"),e.off=o(function(a,l){var c=[];if(a&&l){var p=this._fns[a],h=0,g=p?p.length:0;for(h;h<g;h++)p[h]!==l&&c.push(p[h])}c.length?this._fns[a]=c:delete this._fns[a]},"off");function r(n){var a=t[n]?t[n]:[],l=n.indexOf(":"),c=l===-1?[n]:[n.substring(0,l),n.substring(l+1)],p=Object.keys(t),h=0,g=p.length;for(h;h<g;h++){var y=p[h];if(y==="*"&&(a=a.concat(t[y])),c.length===2&&c[0]===y){a=a.concat(t[y]);break}}return a}o(r,"getListeners");function s(n,a,l){var c=0,p=a.length;for(c;c<p&&a[c];c++)a[c].event=n,a[c].apply(a[c],l)}return o(s,"emitAll"),e},"createNamespaceEmitter")});var Fp=ye((D5,Cp)=>{function _t(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(_t,"RetryOperation");Cp.exports=_t;_t.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};_t.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};_t.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};_t.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)};_t.prototype.try=function(i){console.log("Using RetryOperation.try() is deprecated"),this.attempt(i)};_t.prototype.start=function(i){console.log("Using RetryOperation.start() is deprecated"),this.attempt(i)};_t.prototype.start=_t.prototype.try;_t.prototype.errors=function(){return this._errors};_t.prototype.attempts=function(){return this._attempts};_t.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 Rp=ye(Pi=>{var Zv=Fp();Pi.operation=function(i){var e=Pi.timeouts(i);return new Zv(e,{forever:i&&(i.forever||i.retries===1/0),unref:i&&i.unref,maxRetryTime:i&&i.maxRetryTime})};Pi.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};Pi.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};Pi.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=Pi.operation(e),h=Array.prototype.slice.call(arguments,1),g=h.pop();h.push(function(y){p.retry(y)||(y&&(arguments[0]=p.mainError()),g.apply(this,arguments))}),p.attempt(function(){c.apply(i,h)})},"retryWrapper").bind(i,a),i[n].options=e}}});var Up=ye((B5,Ap)=>{Ap.exports=Rp()});var Ve=ye((GP,Uo)=>{(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 Uo<"u"&&Uo.exports?(e.default=e,Uo.exports=e):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return e}):window.classNames=e})()});var sd=ye((LT,Ca)=>{"use strict";var jb=Object.prototype.hasOwnProperty,at="~";function ss(){}o(ss,"Events");Object.create&&(ss.prototype=Object.create(null),new ss().__proto__||(at=!1));function zb(i,e,t){this.fn=i,this.context=e,this.once=t||!1}o(zb,"EE");function rd(i,e,t,r,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var n=new zb(t,r||i,s),a=at?at+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(rd,"addListener");function Lo(i,e){--i._eventsCount===0?i._events=new ss:delete i._events[e]}o(Lo,"clearEvent");function it(){this._events=new ss,this._eventsCount=0}o(it,"EventEmitter");it.prototype.eventNames=o(function(){var e=[],t,r;if(this._eventsCount===0)return e;for(r in t=this._events)jb.call(t,r)&&e.push(at?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},"eventNames");it.prototype.listeners=o(function(e){var t=at?at+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");it.prototype.listenerCount=o(function(e){var t=at?at+e:e,r=this._events[t];return r?r.fn?1:r.length:0},"listenerCount");it.prototype.emit=o(function(e,t,r,s,n,a){var l=at?at+e:e;if(!this._events[l])return!1;var c=this._events[l],p=arguments.length,h,g;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(g=1,h=new Array(p-1);g<p;g++)h[g-1]=arguments[g];c.fn.apply(c.context,h)}else{var y=c.length,S;for(g=0;g<y;g++)switch(c[g].once&&this.removeListener(e,c[g].fn,void 0,!0),p){case 1:c[g].fn.call(c[g].context);break;case 2:c[g].fn.call(c[g].context,t);break;case 3:c[g].fn.call(c[g].context,t,r);break;case 4:c[g].fn.call(c[g].context,t,r,s);break;default:if(!h)for(S=1,h=new Array(p-1);S<p;S++)h[S-1]=arguments[S];c[g].fn.apply(c[g].context,h)}}return!0},"emit");it.prototype.on=o(function(e,t,r){return rd(this,e,t,r,!1)},"on");it.prototype.once=o(function(e,t,r){return rd(this,e,t,r,!0)},"once");it.prototype.removeListener=o(function(e,t,r,s){var n=at?at+e:e;if(!this._events[n])return this;if(!t)return Lo(this,n),this;var a=this._events[n];if(a.fn)a.fn===t&&(!s||a.once)&&(!r||a.context===r)&&Lo(this,n);else{for(var l=0,c=[],p=a.length;l<p;l++)(a[l].fn!==t||s&&!a[l].once||r&&a[l].context!==r)&&c.push(a[l]);c.length?this._events[n]=c.length===1?c[0]:c:Lo(this,n)}return this},"removeListener");it.prototype.removeAllListeners=o(function(e){var t;return e?(t=at?at+e:e,this._events[t]&&Lo(this,t)):(this._events=new ss,this._eventsCount=0),this},"removeAllListeners");it.prototype.off=it.prototype.removeListener;it.prototype.addListener=it.prototype.on;it.prefixed=at;it.EventEmitter=it;typeof Ca<"u"&&(Ca.exports=it)});var $d=ye((el,tl)=>{(function(i,e){typeof el=="object"&&typeof tl<"u"?tl.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Compressor=e())})(el,(function(){"use strict";function i(N,k){if(!(N instanceof k))throw new TypeError("Cannot call a class as a function")}o(i,"_classCallCheck");function e(N,k){for(var U=0;U<k.length;U++){var M=k[U];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(N,c(M.key),M)}}o(e,"_defineProperties");function t(N,k,U){return k&&e(N.prototype,k),U&&e(N,U),Object.defineProperty(N,"prototype",{writable:!1}),N}o(t,"_createClass");function r(N,k,U){return(k=c(k))in N?Object.defineProperty(N,k,{value:U,enumerable:!0,configurable:!0,writable:!0}):N[k]=U,N}o(r,"_defineProperty");function s(){return s=Object.assign?Object.assign.bind():function(N){for(var k=1;k<arguments.length;k++){var U=arguments[k];for(var M in U)({}).hasOwnProperty.call(U,M)&&(N[M]=U[M])}return N},s.apply(null,arguments)}o(s,"_extends");function n(N,k){var U=Object.keys(N);if(Object.getOwnPropertySymbols){var M=Object.getOwnPropertySymbols(N);k&&(M=M.filter(function(Y){return Object.getOwnPropertyDescriptor(N,Y).enumerable})),U.push.apply(U,M)}return U}o(n,"ownKeys");function a(N){for(var k=1;k<arguments.length;k++){var U=arguments[k]!=null?arguments[k]:{};k%2?n(Object(U),!0).forEach(function(M){r(N,M,U[M])}):Object.getOwnPropertyDescriptors?Object.defineProperties(N,Object.getOwnPropertyDescriptors(U)):n(Object(U)).forEach(function(M){Object.defineProperty(N,M,Object.getOwnPropertyDescriptor(U,M))})}return N}o(a,"_objectSpread2");function l(N,k){if(typeof N!="object"||!N)return N;var U=N[Symbol.toPrimitive];if(U!==void 0){var M=U.call(N,k||"default");if(typeof M!="object")return M;throw new TypeError("@@toPrimitive must return a primitive value.")}return(k==="string"?String:Number)(N)}o(l,"_toPrimitive");function c(N){var k=l(N,"string");return typeof k=="symbol"?k:k+""}o(c,"_toPropertyKey");var p={exports:{}};(function(N){typeof window>"u"||(function(k){var U=k.HTMLCanvasElement&&k.HTMLCanvasElement.prototype,M=k.Blob&&(function(){try{return!!new Blob}catch{return!1}})(),Y=M&&k.Uint8Array&&(function(){try{return new Blob([new Uint8Array(100)]).size===100}catch{return!1}})(),J=k.BlobBuilder||k.WebKitBlobBuilder||k.MozBlobBuilder||k.MSBlobBuilder,we=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,ce=(M||J)&&k.atob&&k.ArrayBuffer&&k.Uint8Array&&function(se){var re,Se,Te,st,Ae,te,Qe,De,Bt;if(re=se.match(we),!re)throw new Error("invalid data URI");for(Se=re[2]?re[1]:"text/plain"+(re[3]||";charset=US-ASCII"),Te=!!re[4],st=se.slice(re[0].length),Te?Ae=atob(st):Ae=decodeURIComponent(st),te=new ArrayBuffer(Ae.length),Qe=new Uint8Array(te),De=0;De<Ae.length;De+=1)Qe[De]=Ae.charCodeAt(De);return M?new Blob([Y?Qe:te],{type:Se}):(Bt=new J,Bt.append(te),Bt.getBlob(Se))};k.HTMLCanvasElement&&!U.toBlob&&(U.mozGetAsFile?U.toBlob=function(se,re,Se){var Te=this;setTimeout(function(){Se&&U.toDataURL&&ce?se(ce(Te.toDataURL(re,Se))):se(Te.mozGetAsFile("blob",re))})}:U.toDataURL&&ce&&(U.msToBlob?U.toBlob=function(se,re,Se){var Te=this;setTimeout(function(){(re&&re!=="image/png"||Se)&&U.toDataURL&&ce?se(ce(Te.toDataURL(re,Se))):se(Te.msToBlob(re))})}:U.toBlob=function(se,re,Se){var Te=this;setTimeout(function(){se(ce(Te.toDataURL(re,Se)))})})),N.exports?N.exports=ce:k.dataURLtoBlob=ce})(window)})(p);var h=p.exports,g=o(function(k){return typeof Blob>"u"?!1:k instanceof Blob||Object.prototype.toString.call(k)==="[object Blob]"},"isBlob"),y={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},S=typeof window<"u"&&typeof window.document<"u",P=S?window:{},F=o(function(k){return k>0&&k<1/0},"isPositiveNumber"),D=Array.prototype.slice;function q(N){return Array.from?Array.from(N):D.call(N)}o(q,"toArray");var R=/^image\/.+$/;function C(N){return R.test(N)}o(C,"isImageType");function j(N){var k=C(N)?N.substr(6):"";return k==="jpeg"&&(k="jpg"),".".concat(k)}o(j,"imageTypeToExtension");var W=String.fromCharCode;function B(N,k,U){var M="",Y;for(U+=k,Y=k;Y<U;Y+=1)M+=W(N.getUint8(Y));return M}o(B,"getStringFromCharCode");function Q(){try{var N=document.createElement("canvas");N.width=2,N.height=1;var k=N.getContext("2d");if(!k)return!1;var U=k.createImageData(2,1);U.data[0]=12,U.data[1]=23,U.data[2]=34,U.data[3]=255,U.data[4]=45,U.data[5]=56,U.data[6]=67,U.data[7]=255,k.putImageData(U,0,0);var M=k.getImageData(0,0,2,1),Y=[12,23,34,255,45,56,67,255];return M.data.every(function(J,we){return J===Y[we]})}catch{return!1}}o(Q,"isCanvasAvailable");var K=P.btoa;function ee(N,k){for(var U=[],M=8192,Y=new Uint8Array(N);Y.length>0;)U.push(W.apply(null,q(Y.subarray(0,M)))),Y=Y.subarray(M);return"data:".concat(k,";base64,").concat(K(U.join("")))}o(ee,"arrayBufferToDataURL");function ne(N){var k=new DataView(N),U;try{var M,Y,J;if(k.getUint8(0)===255&&k.getUint8(1)===216)for(var we=k.byteLength,ce=2;ce+1<we;){if(k.getUint8(ce)===255&&k.getUint8(ce+1)===225){Y=ce;break}ce+=1}if(Y){var se=Y+4,re=Y+10;if(B(k,se,4)==="Exif"){var Se=k.getUint16(re);if(M=Se===18761,(M||Se===19789)&&k.getUint16(re+2,M)===42){var Te=k.getUint32(re+4,M);Te>=8&&(J=re+Te)}}}if(J){var st=k.getUint16(J,M),Ae,te;for(te=0;te<st;te+=1)if(Ae=J+te*12+2,k.getUint16(Ae,M)===274){Ae+=8,U=k.getUint16(Ae,M),k.setUint16(Ae,1,M);break}}}catch{U=1}return U}o(ne,"resetAndGetOrientation");function le(N){var k=0,U=1,M=1;switch(N){case 2:U=-1;break;case 3:k=-180;break;case 4:M=-1;break;case 5:k=90,M=-1;break;case 6:k=90;break;case 7:k=90,U=-1;break;case 8:k=-90;break}return{rotate:k,scaleX:U,scaleY:M}}o(le,"parseOrientation");var Fe=/\.\d*(?:0|9){12}\d*$/;function be(N){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Fe.test(N)?Math.round(N*k)/k:N}o(be,"normalizeDecimalNumber");function fe(N){var k=N.aspectRatio,U=N.height,M=N.width,Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"none",J=F(M),we=F(U);if(J&&we){var ce=U*k;(Y==="contain"||Y==="none")&&ce>M||Y==="cover"&&ce<M?U=M/k:M=U*k}else J?U=M/k:we&&(M=U*k);return{width:M,height:U}}o(fe,"getAdjustedSizes");function _e(N){for(var k=q(new Uint8Array(N)),U=k.length,M=[],Y=0;Y+3<U;){var J=k[Y],we=k[Y+1];if(J===255&&we===218)break;if(J===255&&we===216)Y+=2;else{var ce=k[Y+2]*256+k[Y+3],se=Y+ce+2,re=k.slice(Y,se);M.push(re),Y=se}}return M.reduce(function(Se,Te){return Te[0]===255&&Te[1]===225?Se.concat(Te):Se},[])}o(_e,"getExif");function T(N,k){var U=q(new Uint8Array(N));if(U[2]!==255||U[3]!==224)return N;var M=U[4]*256+U[5],Y=[255,216].concat(k,U.slice(4+M));return new Uint8Array(Y)}o(T,"insertExif");var w=P.ArrayBuffer,_=P.FileReader,L=P.URL||P.webkitURL,$=/\.\w+$/,z=P.Compressor,Z=(function(){function N(k,U){i(this,N),this.file=k,this.exif=[],this.image=new Image,this.options=a(a({},y),U),this.aborted=!1,this.result=null,this.init()}return o(N,"Compressor"),t(N,[{key:"init",value:o(function(){var U=this,M=this.file,Y=this.options;if(!g(M)){this.fail(new Error("The first argument must be a File or Blob object."));return}var J=M.type;if(!C(J)){this.fail(new Error("The first argument must be an image File or Blob object."));return}if(!L||!_){this.fail(new Error("The current browser does not support image compression."));return}w||(Y.checkOrientation=!1,Y.retainExif=!1);var we=J==="image/jpeg",ce=we&&Y.checkOrientation,se=we&&Y.retainExif;if(L&&!ce&&!se)this.load({url:L.createObjectURL(M)});else{var re=new _;this.reader=re,re.onload=function(Se){var Te=Se.target,st=Te.result,Ae={},te=1;ce&&(te=ne(st),te>1&&s(Ae,le(te))),se&&(U.exif=_e(st)),ce||se?!L||te>1?Ae.url=ee(st,J):Ae.url=L.createObjectURL(M):Ae.url=st,U.load(Ae)},re.onabort=function(){U.fail(new Error("Aborted to read the image with FileReader."))},re.onerror=function(){U.fail(new Error("Failed to read the image with FileReader."))},re.onloadend=function(){U.reader=null},ce||se?re.readAsArrayBuffer(M):re.readAsDataURL(M)}},"init")},{key:"load",value:o(function(U){var M=this,Y=this.file,J=this.image;J.onload=function(){Q()?M.draw(a(a({},U),{},{naturalWidth:J.naturalWidth,naturalHeight:J.naturalHeight})):M.done({naturalWidth:J.naturalWidth,naturalHeight:J.naturalHeight,result:null})},J.onabort=function(){M.fail(new Error("Aborted to load the image."))},J.onerror=function(){M.fail(new Error("Failed to load the image."))},P.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(P.navigator.userAgent)&&(J.crossOrigin="anonymous"),J.alt=Y.name,J.src=U.url},"load")},{key:"draw",value:o(function(U){var M=this,Y=U.naturalWidth,J=U.naturalHeight,we=U.rotate,ce=we===void 0?0:we,se=U.scaleX,re=se===void 0?1:se,Se=U.scaleY,Te=Se===void 0?1:Se,st=this.file,Ae=this.image,te=this.options,Qe=document.createElement("canvas"),De=Qe.getContext("2d"),Bt=Math.abs(ce)%180===90,Wi=(te.resize==="contain"||te.resize==="cover")&&F(te.width)&&F(te.height),jt=Math.max(te.maxWidth,0)||1/0,Xt=Math.max(te.maxHeight,0)||1/0,fi=Math.max(te.minWidth,0)||0,mi=Math.max(te.minHeight,0)||0,Kt=Y/J,qe=te.width,Le=te.height;if(Bt){var Ir=[Xt,jt];jt=Ir[0],Xt=Ir[1];var Dr=[mi,fi];fi=Dr[0],mi=Dr[1];var Qs=[Le,qe];qe=Qs[0],Le=Qs[1]}Wi&&(Kt=qe/Le);var Zs=fe({aspectRatio:Kt,width:jt,height:Xt},"contain");jt=Zs.width,Xt=Zs.height;var oe=fe({aspectRatio:Kt,width:fi,height:mi},"cover");if(fi=oe.width,mi=oe.height,Wi){var Nr=fe({aspectRatio:Kt,width:qe,height:Le},te.resize);qe=Nr.width,Le=Nr.height}else{var Gi=fe({aspectRatio:Kt,width:qe,height:Le}),Ct=Gi.width;qe=Ct===void 0?Y:Ct;var eo=Gi.height;Le=eo===void 0?J:eo}qe=Math.floor(be(Math.min(Math.max(qe,fi),jt))),Le=Math.floor(be(Math.min(Math.max(Le,mi),Xt)));var Yt=-qe/2,Ze=-Le/2,Nn=qe,to=Le,ke=[];if(Wi){var xe=0,io=0,Ft=Y,Mr=J,Et=fe({aspectRatio:Kt,width:Y,height:J},{contain:"cover",cover:"contain"}[te.resize]);Ft=Et.width,Mr=Et.height,xe=(Y-Ft)/2,io=(J-Mr)/2,ke.push(xe,io,Ft,Mr)}if(ke.push(Yt,Ze,Nn,to),Bt){var ro=[Le,qe];qe=ro[0],Le=ro[1]}Qe.width=qe,Qe.height=Le,C(te.mimeType)||(te.mimeType=st.type);var Oe="transparent";st.size>te.convertSize&&te.convertTypes.indexOf(te.mimeType)>=0&&(te.mimeType="image/jpeg");var ht=te.mimeType==="image/jpeg";if(ht&&(Oe="#fff"),De.fillStyle=Oe,De.fillRect(0,0,qe,Le),te.beforeDraw&&te.beforeDraw.call(this,De,Qe),!this.aborted&&(De.save(),De.translate(qe/2,Le/2),De.rotate(ce*Math.PI/180),De.scale(re,Te),De.drawImage.apply(De,[Ae].concat(ke)),De.restore(),te.drew&&te.drew.call(this,De,Qe),!this.aborted)){var zt=o(function(Ht){if(!M.aborted){var Xi=o(function(Zt){return M.done({naturalWidth:Y,naturalHeight:J,result:Zt})},"done");if(Ht&&ht&&te.retainExif&&M.exif&&M.exif.length>0){var Jt=o(function(Zt){return Xi(h(ee(T(Zt,M.exif),te.mimeType)))},"next");if(Ht.arrayBuffer)Ht.arrayBuffer().then(Jt).catch(function(){M.fail(new Error("Failed to read the compressed image with Blob.arrayBuffer()."))});else{var Qt=new _;M.reader=Qt,Qt.onload=function(Ki){var Zt=Ki.target;Jt(Zt.result)},Qt.onabort=function(){M.fail(new Error("Aborted to read the compressed image with FileReader."))},Qt.onerror=function(){M.fail(new Error("Failed to read the compressed image with FileReader."))},Qt.onloadend=function(){M.reader=null},Qt.readAsArrayBuffer(Ht)}}else Xi(Ht)}},"callback");Qe.toBlob?Qe.toBlob(zt,te.mimeType,te.quality):zt(h(Qe.toDataURL(te.mimeType,te.quality)))}},"draw")},{key:"done",value:o(function(U){var M=U.naturalWidth,Y=U.naturalHeight,J=U.result,we=this.file,ce=this.image,se=this.options;if(L&&ce.src.indexOf("blob:")===0&&L.revokeObjectURL(ce.src),J)if(se.strict&&!se.retainExif&&J.size>we.size&&se.mimeType===we.type&&!(se.width>M||se.height>Y||se.minWidth>M||se.minHeight>Y||se.maxWidth<M||se.maxHeight<Y))J=we;else{var re=we.name;re&&J.type!==we.type&&(re=re.replace($,j(J.type)));try{J=new File([J],re,{type:J.type})}catch{var Se=new Date;J.name=re,J.lastModified=Se.getTime(),J.lastModifiedDate=Se}}else J=we;this.result=J,se.success&&se.success.call(this,J)},"done")},{key:"fail",value:o(function(U){var M=this.options;if(M.error)M.error.call(this,U);else throw U},"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=z,N},"noConflict")},{key:"setDefaults",value:o(function(U){s(y,U)},"setDefaults")}])})();return Z}))});var Pf=ye((Ll,Bl)=>{(function(i,e){typeof Ll=="object"&&typeof Bl<"u"?Bl.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Cropper=e())})(Ll,(function(){"use strict";function i(v,d){var m=Object.keys(v);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(v);d&&(f=f.filter(function(E){return Object.getOwnPropertyDescriptor(v,E).enumerable})),m.push.apply(m,f)}return m}o(i,"ownKeys");function e(v){for(var d=1;d<arguments.length;d++){var m=arguments[d]!=null?arguments[d]:{};d%2?i(Object(m),!0).forEach(function(f){c(v,f,m[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(m)):i(Object(m)).forEach(function(f){Object.defineProperty(v,f,Object.getOwnPropertyDescriptor(m,f))})}return v}o(e,"_objectSpread2");function t(v,d){if(typeof v!="object"||!v)return v;var m=v[Symbol.toPrimitive];if(m!==void 0){var f=m.call(v,d||"default");if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(v)}o(t,"_toPrimitive");function r(v){var d=t(v,"string");return typeof d=="symbol"?d:d+""}o(r,"_toPropertyKey");function s(v){"@babel/helpers - typeof";return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},s(v)}o(s,"_typeof");function n(v,d){if(!(v instanceof d))throw new TypeError("Cannot call a class as a function")}o(n,"_classCallCheck");function a(v,d){for(var m=0;m<d.length;m++){var f=d[m];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(v,r(f.key),f)}}o(a,"_defineProperties");function l(v,d,m){return d&&a(v.prototype,d),m&&a(v,m),Object.defineProperty(v,"prototype",{writable:!1}),v}o(l,"_createClass");function c(v,d,m){return d=r(d),d in v?Object.defineProperty(v,d,{value:m,enumerable:!0,configurable:!0,writable:!0}):v[d]=m,v}o(c,"_defineProperty");function p(v){return h(v)||g(v)||y(v)||P()}o(p,"_toConsumableArray");function h(v){if(Array.isArray(v))return S(v)}o(h,"_arrayWithoutHoles");function g(v){if(typeof Symbol<"u"&&v[Symbol.iterator]!=null||v["@@iterator"]!=null)return Array.from(v)}o(g,"_iterableToArray");function y(v,d){if(v){if(typeof v=="string")return S(v,d);var m=Object.prototype.toString.call(v).slice(8,-1);if(m==="Object"&&v.constructor&&(m=v.constructor.name),m==="Map"||m==="Set")return Array.from(v);if(m==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m))return S(v,d)}}o(y,"_unsupportedIterableToArray");function S(v,d){(d==null||d>v.length)&&(d=v.length);for(var m=0,f=new Array(d);m<d;m++)f[m]=v[m];return f}o(S,"_arrayLikeToArray");function P(){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(P,"_nonIterableSpread");var F=typeof window<"u"&&typeof window.document<"u",D=F?window:{},q=F&&D.document.documentElement?"ontouchstart"in D.document.documentElement:!1,R=F?"PointerEvent"in D:!1,C="cropper",j="all",W="crop",B="move",Q="zoom",K="e",ee="w",ne="s",le="n",Fe="ne",be="nw",fe="se",_e="sw",T="".concat(C,"-crop"),w="".concat(C,"-disabled"),_="".concat(C,"-hidden"),L="".concat(C,"-hide"),$="".concat(C,"-invisible"),z="".concat(C,"-modal"),Z="".concat(C,"-move"),N="".concat(C,"Action"),k="".concat(C,"Preview"),U="crop",M="move",Y="none",J="crop",we="cropend",ce="cropmove",se="cropstart",re="dblclick",Se=q?"touchstart":"mousedown",Te=q?"touchmove":"mousemove",st=q?"touchend touchcancel":"mouseup",Ae=R?"pointerdown":Se,te=R?"pointermove":Te,Qe=R?"pointerup pointercancel":st,De="ready",Bt="resize",Wi="wheel",jt="zoom",Xt="image/jpeg",fi=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,mi=/^data:/,Kt=/^data:image\/jpeg;base64,/,qe=/^img|canvas$/i,Le=200,Ir=100,Dr={viewMode:0,dragMode:U,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:Le,minContainerHeight:Ir,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},Qs='<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>',Zs=Number.isNaN||D.isNaN;function oe(v){return typeof v=="number"&&!Zs(v)}o(oe,"isNumber");var Nr=o(function(d){return d>0&&d<1/0},"isPositiveNumber");function Gi(v){return typeof v>"u"}o(Gi,"isUndefined");function Ct(v){return s(v)==="object"&&v!==null}o(Ct,"isObject");var eo=Object.prototype.hasOwnProperty;function Yt(v){if(!Ct(v))return!1;try{var d=v.constructor,m=d.prototype;return d&&m&&eo.call(m,"isPrototypeOf")}catch{return!1}}o(Yt,"isPlainObject");function Ze(v){return typeof v=="function"}o(Ze,"isFunction");var Nn=Array.prototype.slice;function to(v){return Array.from?Array.from(v):Nn.call(v)}o(to,"toArray");function ke(v,d){return v&&Ze(d)&&(Array.isArray(v)||oe(v.length)?to(v).forEach(function(m,f){d.call(v,m,f,v)}):Ct(v)&&Object.keys(v).forEach(function(m){d.call(v,v[m],m,v)})),v}o(ke,"forEach");var xe=Object.assign||o(function(d){for(var m=arguments.length,f=new Array(m>1?m-1:0),E=1;E<m;E++)f[E-1]=arguments[E];return Ct(d)&&f.length>0&&f.forEach(function(b){Ct(b)&&Object.keys(b).forEach(function(x){d[x]=b[x]})}),d},"assign"),io=/\.\d*(?:0|9){12}\d*$/;function Ft(v){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return io.test(v)?Math.round(v*d)/d:v}o(Ft,"normalizeDecimalNumber");var Mr=/^width|height|left|top|marginLeft|marginTop$/;function Et(v,d){var m=v.style;ke(d,function(f,E){Mr.test(E)&&oe(f)&&(f="".concat(f,"px")),m[E]=f})}o(Et,"setStyle");function ro(v,d){return v.classList?v.classList.contains(d):v.className.indexOf(d)>-1}o(ro,"hasClass");function Oe(v,d){if(d){if(oe(v.length)){ke(v,function(f){Oe(f,d)});return}if(v.classList){v.classList.add(d);return}var m=v.className.trim();m?m.indexOf(d)<0&&(v.className="".concat(m," ").concat(d)):v.className=d}}o(Oe,"addClass");function ht(v,d){if(d){if(oe(v.length)){ke(v,function(m){ht(m,d)});return}if(v.classList){v.classList.remove(d);return}v.className.indexOf(d)>=0&&(v.className=v.className.replace(d,""))}}o(ht,"removeClass");function zt(v,d,m){if(d){if(oe(v.length)){ke(v,function(f){zt(f,d,m)});return}m?Oe(v,d):ht(v,d)}}o(zt,"toggleClass");var qu=/([a-z\d])([A-Z])/g;function Ht(v){return v.replace(qu,"$1-$2").toLowerCase()}o(Ht,"toParamCase");function Xi(v,d){return Ct(v[d])?v[d]:v.dataset?v.dataset[d]:v.getAttribute("data-".concat(Ht(d)))}o(Xi,"getData");function Jt(v,d,m){Ct(m)?v[d]=m:v.dataset?v.dataset[d]=m:v.setAttribute("data-".concat(Ht(d)),m)}o(Jt,"setData");function Qt(v,d){if(Ct(v[d]))try{delete v[d]}catch{v[d]=void 0}else if(v.dataset)try{delete v.dataset[d]}catch{v.dataset[d]=void 0}else v.removeAttribute("data-".concat(Ht(d)))}o(Qt,"removeData");var Ki=/\s\s*/,Zt=(function(){var v=!1;if(F){var d=!1,m=o(function(){},"listener"),f=Object.defineProperty({},"once",{get:o(function(){return v=!0,d},"get"),set:o(function(b){d=b},"set")});D.addEventListener("test",m,f),D.removeEventListener("test",m,f)}return v})();function Pt(v,d,m){var f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},E=m;d.trim().split(Ki).forEach(function(b){if(!Zt){var x=v.listeners;x&&x[b]&&x[b][m]&&(E=x[b][m],delete x[b][m],Object.keys(x[b]).length===0&&delete x[b],Object.keys(x).length===0&&delete v.listeners)}v.removeEventListener(b,E,f)})}o(Pt,"removeListener");function vt(v,d,m){var f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},E=m;d.trim().split(Ki).forEach(function(b){if(f.once&&!Zt){var x=v.listeners,A=x===void 0?{}:x;E=o(function(){delete A[b][m],v.removeEventListener(b,E,f);for(var H=arguments.length,O=new Array(H),I=0;I<H;I++)O[I]=arguments[I];m.apply(v,O)},"handler"),A[b]||(A[b]={}),A[b][m]&&v.removeEventListener(b,A[b][m],f),A[b][m]=E,v.listeners=A}v.addEventListener(b,E,f)})}o(vt,"addListener");function Yi(v,d,m){var f;return Ze(Event)&&Ze(CustomEvent)?f=new CustomEvent(d,{detail:m,bubbles:!0,cancelable:!0}):(f=document.createEvent("CustomEvent"),f.initCustomEvent(d,!0,!0,m)),v.dispatchEvent(f)}o(Yi,"dispatchEvent");function $u(v){var d=v.getBoundingClientRect();return{left:d.left+(window.pageXOffset-document.documentElement.clientLeft),top:d.top+(window.pageYOffset-document.documentElement.clientTop)}}o($u,"getOffset");var Mn=D.location,Gg=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function Vu(v){var d=v.match(Gg);return d!==null&&(d[1]!==Mn.protocol||d[2]!==Mn.hostname||d[3]!==Mn.port)}o(Vu,"isCrossOriginURL");function Wu(v){var d="timestamp=".concat(new Date().getTime());return v+(v.indexOf("?")===-1?"?":"&")+d}o(Wu,"addTimestamp");function Lr(v){var d=v.rotate,m=v.scaleX,f=v.scaleY,E=v.translateX,b=v.translateY,x=[];oe(E)&&E!==0&&x.push("translateX(".concat(E,"px)")),oe(b)&&b!==0&&x.push("translateY(".concat(b,"px)")),oe(d)&&d!==0&&x.push("rotate(".concat(d,"deg)")),oe(m)&&m!==1&&x.push("scaleX(".concat(m,")")),oe(f)&&f!==1&&x.push("scaleY(".concat(f,")"));var A=x.length?x.join(" "):"none";return{WebkitTransform:A,msTransform:A,transform:A}}o(Lr,"getTransforms");function Xg(v){var d=e({},v),m=0;return ke(v,function(f,E){delete d[E],ke(d,function(b){var x=Math.abs(f.startX-b.startX),A=Math.abs(f.startY-b.startY),G=Math.abs(f.endX-b.endX),H=Math.abs(f.endY-b.endY),O=Math.sqrt(x*x+A*A),I=Math.sqrt(G*G+H*H),V=(I-O)/O;Math.abs(V)>Math.abs(m)&&(m=V)})}),m}o(Xg,"getMaxZoomRatio");function so(v,d){var m=v.pageX,f=v.pageY,E={endX:m,endY:f};return d?E:e({startX:m,startY:f},E)}o(so,"getPointer");function Kg(v){var d=0,m=0,f=0;return ke(v,function(E){var b=E.startX,x=E.startY;d+=b,m+=x,f+=1}),d/=f,m/=f,{pageX:d,pageY:m}}o(Kg,"getPointersCenter");function ei(v){var d=v.aspectRatio,m=v.height,f=v.width,E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",b=Nr(f),x=Nr(m);if(b&&x){var A=m*d;E==="contain"&&A>f||E==="cover"&&A<f?m=f/d:f=m*d}else b?m=f/d:x&&(f=m*d);return{width:f,height:m}}o(ei,"getAdjustedSizes");function Yg(v){var d=v.width,m=v.height,f=v.degree;if(f=Math.abs(f)%180,f===90)return{width:m,height:d};var E=f%90*Math.PI/180,b=Math.sin(E),x=Math.cos(E),A=d*x+m*b,G=d*b+m*x;return f>90?{width:G,height:A}:{width:A,height:G}}o(Yg,"getRotatedSizes");function Jg(v,d,m,f){var E=d.aspectRatio,b=d.naturalWidth,x=d.naturalHeight,A=d.rotate,G=A===void 0?0:A,H=d.scaleX,O=H===void 0?1:H,I=d.scaleY,V=I===void 0?1:I,pe=m.aspectRatio,ue=m.naturalWidth,Ce=m.naturalHeight,me=f.fillColor,Be=me===void 0?"transparent":me,$e=f.imageSmoothingEnabled,Ne=$e===void 0?!0:$e,qt=f.imageSmoothingQuality,ft=qt===void 0?"low":qt,X=f.maxWidth,ge=X===void 0?1/0:X,je=f.maxHeight,bt=je===void 0?1/0:je,$t=f.minWidth,gi=$t===void 0?0:$t,yi=f.minHeight,ti=yi===void 0?0:yi,Rt=document.createElement("canvas"),ut=Rt.getContext("2d"),vi=ei({aspectRatio:pe,width:ge,height:bt}),oo=ei({aspectRatio:pe,width:gi,height:ti},"cover"),Ln=Math.min(vi.width,Math.max(oo.width,ue)),Bn=Math.min(vi.height,Math.max(oo.height,Ce)),Ku=ei({aspectRatio:E,width:ge,height:bt}),Yu=ei({aspectRatio:E,width:gi,height:ti},"cover"),Ju=Math.min(Ku.width,Math.max(Yu.width,b)),Qu=Math.min(Ku.height,Math.max(Yu.height,x)),py=[-Ju/2,-Qu/2,Ju,Qu];return Rt.width=Ft(Ln),Rt.height=Ft(Bn),ut.fillStyle=Be,ut.fillRect(0,0,Ln,Bn),ut.save(),ut.translate(Ln/2,Bn/2),ut.rotate(G*Math.PI/180),ut.scale(O,V),ut.imageSmoothingEnabled=Ne,ut.imageSmoothingQuality=ft,ut.drawImage.apply(ut,[v].concat(p(py.map(function(dy){return Math.floor(Ft(dy))})))),ut.restore(),Rt}o(Jg,"getSourceCanvas");var Gu=String.fromCharCode;function Qg(v,d,m){var f="";m+=d;for(var E=d;E<m;E+=1)f+=Gu(v.getUint8(E));return f}o(Qg,"getStringFromCharCode");var Zg=/^data:.*,/;function ey(v){var d=v.replace(Zg,""),m=atob(d),f=new ArrayBuffer(m.length),E=new Uint8Array(f);return ke(E,function(b,x){E[x]=m.charCodeAt(x)}),f}o(ey,"dataURLToArrayBuffer");function ty(v,d){for(var m=[],f=8192,E=new Uint8Array(v);E.length>0;)m.push(Gu.apply(null,to(E.subarray(0,f)))),E=E.subarray(f);return"data:".concat(d,";base64,").concat(btoa(m.join("")))}o(ty,"arrayBufferToDataURL");function iy(v){var d=new DataView(v),m;try{var f,E,b;if(d.getUint8(0)===255&&d.getUint8(1)===216)for(var x=d.byteLength,A=2;A+1<x;){if(d.getUint8(A)===255&&d.getUint8(A+1)===225){E=A;break}A+=1}if(E){var G=E+4,H=E+10;if(Qg(d,G,4)==="Exif"){var O=d.getUint16(H);if(f=O===18761,(f||O===19789)&&d.getUint16(H+2,f)===42){var I=d.getUint32(H+4,f);I>=8&&(b=H+I)}}}if(b){var V=d.getUint16(b,f),pe,ue;for(ue=0;ue<V;ue+=1)if(pe=b+ue*12+2,d.getUint16(pe,f)===274){pe+=8,m=d.getUint16(pe,f),d.setUint16(pe,1,f);break}}}catch{m=1}return m}o(iy,"resetAndGetOrientation");function ry(v){var d=0,m=1,f=1;switch(v){case 2:m=-1;break;case 3:d=-180;break;case 4:f=-1;break;case 5:d=90,f=-1;break;case 6:d=90;break;case 7:d=90,m=-1;break;case 8:d=-90;break}return{rotate:d,scaleX:m,scaleY:f}}o(ry,"parseOrientation");var sy={render:o(function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},"render"),initContainer:o(function(){var d=this.element,m=this.options,f=this.container,E=this.cropper,b=Number(m.minContainerWidth),x=Number(m.minContainerHeight);Oe(E,_),ht(d,_);var A={width:Math.max(f.offsetWidth,b>=0?b:Le),height:Math.max(f.offsetHeight,x>=0?x:Ir)};this.containerData=A,Et(E,{width:A.width,height:A.height}),Oe(d,_),ht(E,_)},"initContainer"),initCanvas:o(function(){var d=this.containerData,m=this.imageData,f=this.options.viewMode,E=Math.abs(m.rotate)%180===90,b=E?m.naturalHeight:m.naturalWidth,x=E?m.naturalWidth:m.naturalHeight,A=b/x,G=d.width,H=d.height;d.height*A>d.width?f===3?G=d.height*A:H=d.width/A:f===3?H=d.width/A:G=d.height*A;var O={aspectRatio:A,naturalWidth:b,naturalHeight:x,width:G,height:H};this.canvasData=O,this.limited=f===1||f===2,this.limitCanvas(!0,!0),O.width=Math.min(Math.max(O.width,O.minWidth),O.maxWidth),O.height=Math.min(Math.max(O.height,O.minHeight),O.maxHeight),O.left=(d.width-O.width)/2,O.top=(d.height-O.height)/2,O.oldLeft=O.left,O.oldTop=O.top,this.initialCanvasData=xe({},O)},"initCanvas"),limitCanvas:o(function(d,m){var f=this.options,E=this.containerData,b=this.canvasData,x=this.cropBoxData,A=f.viewMode,G=b.aspectRatio,H=this.cropped&&x;if(d){var O=Number(f.minCanvasWidth)||0,I=Number(f.minCanvasHeight)||0;A>1?(O=Math.max(O,E.width),I=Math.max(I,E.height),A===3&&(I*G>O?O=I*G:I=O/G)):A>0&&(O?O=Math.max(O,H?x.width:0):I?I=Math.max(I,H?x.height:0):H&&(O=x.width,I=x.height,I*G>O?O=I*G:I=O/G));var V=ei({aspectRatio:G,width:O,height:I});O=V.width,I=V.height,b.minWidth=O,b.minHeight=I,b.maxWidth=1/0,b.maxHeight=1/0}if(m)if(A>(H?0:1)){var pe=E.width-b.width,ue=E.height-b.height;b.minLeft=Math.min(0,pe),b.minTop=Math.min(0,ue),b.maxLeft=Math.max(0,pe),b.maxTop=Math.max(0,ue),H&&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,A===2&&(b.width>=E.width&&(b.minLeft=Math.min(0,pe),b.maxLeft=Math.max(0,pe)),b.height>=E.height&&(b.minTop=Math.min(0,ue),b.maxTop=Math.max(0,ue))))}else b.minLeft=-b.width,b.minTop=-b.height,b.maxLeft=E.width,b.maxTop=E.height},"limitCanvas"),renderCanvas:o(function(d,m){var f=this.canvasData,E=this.imageData;if(m){var b=Yg({width:E.naturalWidth*Math.abs(E.scaleX||1),height:E.naturalHeight*Math.abs(E.scaleY||1),degree:E.rotate||0}),x=b.width,A=b.height,G=f.width*(x/f.naturalWidth),H=f.height*(A/f.naturalHeight);f.left-=(G-f.width)/2,f.top-=(H-f.height)/2,f.width=G,f.height=H,f.aspectRatio=x/A,f.naturalWidth=x,f.naturalHeight=A,this.limitCanvas(!0,!1)}(f.width>f.maxWidth||f.width<f.minWidth)&&(f.left=f.oldLeft),(f.height>f.maxHeight||f.height<f.minHeight)&&(f.top=f.oldTop),f.width=Math.min(Math.max(f.width,f.minWidth),f.maxWidth),f.height=Math.min(Math.max(f.height,f.minHeight),f.maxHeight),this.limitCanvas(!1,!0),f.left=Math.min(Math.max(f.left,f.minLeft),f.maxLeft),f.top=Math.min(Math.max(f.top,f.minTop),f.maxTop),f.oldLeft=f.left,f.oldTop=f.top,Et(this.canvas,xe({width:f.width,height:f.height},Lr({translateX:f.left,translateY:f.top}))),this.renderImage(d),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},"renderCanvas"),renderImage:o(function(d){var m=this.canvasData,f=this.imageData,E=f.naturalWidth*(m.width/m.naturalWidth),b=f.naturalHeight*(m.height/m.naturalHeight);xe(f,{width:E,height:b,left:(m.width-E)/2,top:(m.height-b)/2}),Et(this.image,xe({width:f.width,height:f.height},Lr(xe({translateX:f.left,translateY:f.top},f)))),d&&this.output()},"renderImage"),initCropBox:o(function(){var d=this.options,m=this.canvasData,f=d.aspectRatio||d.initialAspectRatio,E=Number(d.autoCropArea)||.8,b={width:m.width,height:m.height};f&&(m.height*f>m.width?b.height=b.width/f:b.width=b.height*f),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*E),b.height=Math.max(b.minHeight,b.height*E),b.left=m.left+(m.width-b.width)/2,b.top=m.top+(m.height-b.height)/2,b.oldLeft=b.left,b.oldTop=b.top,this.initialCropBoxData=xe({},b)},"initCropBox"),limitCropBox:o(function(d,m){var f=this.options,E=this.containerData,b=this.canvasData,x=this.cropBoxData,A=this.limited,G=f.aspectRatio;if(d){var H=Number(f.minCropBoxWidth)||0,O=Number(f.minCropBoxHeight)||0,I=A?Math.min(E.width,b.width,b.width+b.left,E.width-b.left):E.width,V=A?Math.min(E.height,b.height,b.height+b.top,E.height-b.top):E.height;H=Math.min(H,E.width),O=Math.min(O,E.height),G&&(H&&O?O*G>H?O=H/G:H=O*G:H?O=H/G:O&&(H=O*G),V*G>I?V=I/G:I=V*G),x.minWidth=Math.min(H,I),x.minHeight=Math.min(O,V),x.maxWidth=I,x.maxHeight=V}m&&(A?(x.minLeft=Math.max(0,b.left),x.minTop=Math.max(0,b.top),x.maxLeft=Math.min(E.width,b.left+b.width)-x.width,x.maxTop=Math.min(E.height,b.top+b.height)-x.height):(x.minLeft=0,x.minTop=0,x.maxLeft=E.width-x.width,x.maxTop=E.height-x.height))},"limitCropBox"),renderCropBox:o(function(){var d=this.options,m=this.containerData,f=this.cropBoxData;(f.width>f.maxWidth||f.width<f.minWidth)&&(f.left=f.oldLeft),(f.height>f.maxHeight||f.height<f.minHeight)&&(f.top=f.oldTop),f.width=Math.min(Math.max(f.width,f.minWidth),f.maxWidth),f.height=Math.min(Math.max(f.height,f.minHeight),f.maxHeight),this.limitCropBox(!1,!0),f.left=Math.min(Math.max(f.left,f.minLeft),f.maxLeft),f.top=Math.min(Math.max(f.top,f.minTop),f.maxTop),f.oldLeft=f.left,f.oldTop=f.top,d.movable&&d.cropBoxMovable&&Jt(this.face,N,f.width>=m.width&&f.height>=m.height?B:j),Et(this.cropBox,xe({width:f.width,height:f.height},Lr({translateX:f.left,translateY:f.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},"renderCropBox"),output:o(function(){this.preview(),Yi(this.element,J,this.getData())},"output")},oy={initPreview:o(function(){var d=this.element,m=this.crossOrigin,f=this.options.preview,E=m?this.crossOriginUrl:this.url,b=d.alt||"The image to preview",x=document.createElement("img");if(m&&(x.crossOrigin=m),x.src=E,x.alt=b,this.viewBox.appendChild(x),this.viewBoxImage=x,!!f){var A=f;typeof f=="string"?A=d.ownerDocument.querySelectorAll(f):f.querySelector&&(A=[f]),this.previews=A,ke(A,function(G){var H=document.createElement("img");Jt(G,k,{width:G.offsetWidth,height:G.offsetHeight,html:G.innerHTML}),m&&(H.crossOrigin=m),H.src=E,H.alt=b,H.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;"',G.innerHTML="",G.appendChild(H)})}},"initPreview"),resetPreview:o(function(){ke(this.previews,function(d){var m=Xi(d,k);Et(d,{width:m.width,height:m.height}),d.innerHTML=m.html,Qt(d,k)})},"resetPreview"),preview:o(function(){var d=this.imageData,m=this.canvasData,f=this.cropBoxData,E=f.width,b=f.height,x=d.width,A=d.height,G=f.left-m.left-d.left,H=f.top-m.top-d.top;!this.cropped||this.disabled||(Et(this.viewBoxImage,xe({width:x,height:A},Lr(xe({translateX:-G,translateY:-H},d)))),ke(this.previews,function(O){var I=Xi(O,k),V=I.width,pe=I.height,ue=V,Ce=pe,me=1;E&&(me=V/E,Ce=b*me),b&&Ce>pe&&(me=pe/b,ue=E*me,Ce=pe),Et(O,{width:ue,height:Ce}),Et(O.getElementsByTagName("img")[0],xe({width:x*me,height:A*me},Lr(xe({translateX:-G*me,translateY:-H*me},d))))}))},"preview")},ny={bind:o(function(){var d=this.element,m=this.options,f=this.cropper;Ze(m.cropstart)&&vt(d,se,m.cropstart),Ze(m.cropmove)&&vt(d,ce,m.cropmove),Ze(m.cropend)&&vt(d,we,m.cropend),Ze(m.crop)&&vt(d,J,m.crop),Ze(m.zoom)&&vt(d,jt,m.zoom),vt(f,Ae,this.onCropStart=this.cropStart.bind(this)),m.zoomable&&m.zoomOnWheel&&vt(f,Wi,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),m.toggleDragModeOnDblclick&&vt(f,re,this.onDblclick=this.dblclick.bind(this)),vt(d.ownerDocument,te,this.onCropMove=this.cropMove.bind(this)),vt(d.ownerDocument,Qe,this.onCropEnd=this.cropEnd.bind(this)),m.responsive&&vt(window,Bt,this.onResize=this.resize.bind(this))},"bind"),unbind:o(function(){var d=this.element,m=this.options,f=this.cropper;Ze(m.cropstart)&&Pt(d,se,m.cropstart),Ze(m.cropmove)&&Pt(d,ce,m.cropmove),Ze(m.cropend)&&Pt(d,we,m.cropend),Ze(m.crop)&&Pt(d,J,m.crop),Ze(m.zoom)&&Pt(d,jt,m.zoom),Pt(f,Ae,this.onCropStart),m.zoomable&&m.zoomOnWheel&&Pt(f,Wi,this.onWheel,{passive:!1,capture:!0}),m.toggleDragModeOnDblclick&&Pt(f,re,this.onDblclick),Pt(d.ownerDocument,te,this.onCropMove),Pt(d.ownerDocument,Qe,this.onCropEnd),m.responsive&&Pt(window,Bt,this.onResize)},"unbind")},ay={resize:o(function(){if(!this.disabled){var d=this.options,m=this.container,f=this.containerData,E=m.offsetWidth/f.width,b=m.offsetHeight/f.height,x=Math.abs(E-1)>Math.abs(b-1)?E:b;if(x!==1){var A,G;d.restore&&(A=this.getCanvasData(),G=this.getCropBoxData()),this.render(),d.restore&&(this.setCanvasData(ke(A,function(H,O){A[O]=H*x})),this.setCropBoxData(ke(G,function(H,O){G[O]=H*x})))}}},"resize"),dblclick:o(function(){this.disabled||this.options.dragMode===Y||this.setDragMode(ro(this.dragBox,T)?M:U)},"dblclick"),wheel:o(function(d){var m=this,f=Number(this.options.wheelZoomRatio)||.1,E=1;this.disabled||(d.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){m.wheeling=!1},50),d.deltaY?E=d.deltaY>0?1:-1:d.wheelDelta?E=-d.wheelDelta/120:d.detail&&(E=d.detail>0?1:-1),this.zoom(-E*f,d)))},"wheel"),cropStart:o(function(d){var m=d.buttons,f=d.button;if(!(this.disabled||(d.type==="mousedown"||d.type==="pointerdown"&&d.pointerType==="mouse")&&(oe(m)&&m!==1||oe(f)&&f!==0||d.ctrlKey))){var E=this.options,b=this.pointers,x;d.changedTouches?ke(d.changedTouches,function(A){b[A.identifier]=so(A)}):b[d.pointerId||0]=so(d),Object.keys(b).length>1&&E.zoomable&&E.zoomOnTouch?x=Q:x=Xi(d.target,N),fi.test(x)&&Yi(this.element,se,{originalEvent:d,action:x})!==!1&&(d.preventDefault(),this.action=x,this.cropping=!1,x===W&&(this.cropping=!0,Oe(this.dragBox,z)))}},"cropStart"),cropMove:o(function(d){var m=this.action;if(!(this.disabled||!m)){var f=this.pointers;d.preventDefault(),Yi(this.element,ce,{originalEvent:d,action:m})!==!1&&(d.changedTouches?ke(d.changedTouches,function(E){xe(f[E.identifier]||{},so(E,!0))}):xe(f[d.pointerId||0]||{},so(d,!0)),this.change(d))}},"cropMove"),cropEnd:o(function(d){if(!this.disabled){var m=this.action,f=this.pointers;d.changedTouches?ke(d.changedTouches,function(E){delete f[E.identifier]}):delete f[d.pointerId||0],m&&(d.preventDefault(),Object.keys(f).length||(this.action=""),this.cropping&&(this.cropping=!1,zt(this.dragBox,z,this.cropped&&this.options.modal)),Yi(this.element,we,{originalEvent:d,action:m}))}},"cropEnd")},ly={change:o(function(d){var m=this.options,f=this.canvasData,E=this.containerData,b=this.cropBoxData,x=this.pointers,A=this.action,G=m.aspectRatio,H=b.left,O=b.top,I=b.width,V=b.height,pe=H+I,ue=O+V,Ce=0,me=0,Be=E.width,$e=E.height,Ne=!0,qt;!G&&d.shiftKey&&(G=I&&V?I/V:1),this.limited&&(Ce=b.minLeft,me=b.minTop,Be=Ce+Math.min(E.width,f.width,f.left+f.width),$e=me+Math.min(E.height,f.height,f.top+f.height));var ft=x[Object.keys(x)[0]],X={x:ft.endX-ft.startX,y:ft.endY-ft.startY},ge=o(function(bt){switch(bt){case K:pe+X.x>Be&&(X.x=Be-pe);break;case ee:H+X.x<Ce&&(X.x=Ce-H);break;case le:O+X.y<me&&(X.y=me-O);break;case ne:ue+X.y>$e&&(X.y=$e-ue);break}},"check");switch(A){case j:H+=X.x,O+=X.y;break;case K:if(X.x>=0&&(pe>=Be||G&&(O<=me||ue>=$e))){Ne=!1;break}ge(K),I+=X.x,I<0&&(A=ee,I=-I,H-=I),G&&(V=I/G,O+=(b.height-V)/2);break;case le:if(X.y<=0&&(O<=me||G&&(H<=Ce||pe>=Be))){Ne=!1;break}ge(le),V-=X.y,O+=X.y,V<0&&(A=ne,V=-V,O-=V),G&&(I=V*G,H+=(b.width-I)/2);break;case ee:if(X.x<=0&&(H<=Ce||G&&(O<=me||ue>=$e))){Ne=!1;break}ge(ee),I-=X.x,H+=X.x,I<0&&(A=K,I=-I,H-=I),G&&(V=I/G,O+=(b.height-V)/2);break;case ne:if(X.y>=0&&(ue>=$e||G&&(H<=Ce||pe>=Be))){Ne=!1;break}ge(ne),V+=X.y,V<0&&(A=le,V=-V,O-=V),G&&(I=V*G,H+=(b.width-I)/2);break;case Fe:if(G){if(X.y<=0&&(O<=me||pe>=Be)){Ne=!1;break}ge(le),V-=X.y,O+=X.y,I=V*G}else ge(le),ge(K),X.x>=0?pe<Be?I+=X.x:X.y<=0&&O<=me&&(Ne=!1):I+=X.x,X.y<=0?O>me&&(V-=X.y,O+=X.y):(V-=X.y,O+=X.y);I<0&&V<0?(A=_e,V=-V,I=-I,O-=V,H-=I):I<0?(A=be,I=-I,H-=I):V<0&&(A=fe,V=-V,O-=V);break;case be:if(G){if(X.y<=0&&(O<=me||H<=Ce)){Ne=!1;break}ge(le),V-=X.y,O+=X.y,I=V*G,H+=b.width-I}else ge(le),ge(ee),X.x<=0?H>Ce?(I-=X.x,H+=X.x):X.y<=0&&O<=me&&(Ne=!1):(I-=X.x,H+=X.x),X.y<=0?O>me&&(V-=X.y,O+=X.y):(V-=X.y,O+=X.y);I<0&&V<0?(A=fe,V=-V,I=-I,O-=V,H-=I):I<0?(A=Fe,I=-I,H-=I):V<0&&(A=_e,V=-V,O-=V);break;case _e:if(G){if(X.x<=0&&(H<=Ce||ue>=$e)){Ne=!1;break}ge(ee),I-=X.x,H+=X.x,V=I/G}else ge(ne),ge(ee),X.x<=0?H>Ce?(I-=X.x,H+=X.x):X.y>=0&&ue>=$e&&(Ne=!1):(I-=X.x,H+=X.x),X.y>=0?ue<$e&&(V+=X.y):V+=X.y;I<0&&V<0?(A=Fe,V=-V,I=-I,O-=V,H-=I):I<0?(A=fe,I=-I,H-=I):V<0&&(A=be,V=-V,O-=V);break;case fe:if(G){if(X.x>=0&&(pe>=Be||ue>=$e)){Ne=!1;break}ge(K),I+=X.x,V=I/G}else ge(ne),ge(K),X.x>=0?pe<Be?I+=X.x:X.y>=0&&ue>=$e&&(Ne=!1):I+=X.x,X.y>=0?ue<$e&&(V+=X.y):V+=X.y;I<0&&V<0?(A=be,V=-V,I=-I,O-=V,H-=I):I<0?(A=_e,I=-I,H-=I):V<0&&(A=Fe,V=-V,O-=V);break;case B:this.move(X.x,X.y),Ne=!1;break;case Q:this.zoom(Xg(x),d),Ne=!1;break;case W:if(!X.x||!X.y){Ne=!1;break}qt=$u(this.cropper),H=ft.startX-qt.left,O=ft.startY-qt.top,I=b.minWidth,V=b.minHeight,X.x>0?A=X.y>0?fe:Fe:X.x<0&&(H-=I,A=X.y>0?_e:be),X.y<0&&(O-=V),this.cropped||(ht(this.cropBox,_),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}Ne&&(b.width=I,b.height=V,b.left=H,b.top=O,this.action=A,this.renderCropBox()),ke(x,function(je){je.startX=je.endX,je.startY=je.endY})},"change")},uy={crop:o(function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Oe(this.dragBox,z),ht(this.cropBox,_),this.setCropBoxData(this.initialCropBoxData)),this},"crop"),reset:o(function(){return this.ready&&!this.disabled&&(this.imageData=xe({},this.initialImageData),this.canvasData=xe({},this.initialCanvasData),this.cropBoxData=xe({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},"reset"),clear:o(function(){return this.cropped&&!this.disabled&&(xe(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),ht(this.dragBox,z),Oe(this.cropBox,_)),this},"clear"),replace:o(function(d){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&d&&(this.isImg&&(this.element.src=d),m?(this.url=d,this.image.src=d,this.ready&&(this.viewBoxImage.src=d,ke(this.previews,function(f){f.getElementsByTagName("img")[0].src=d}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(d))),this},"replace"),enable:o(function(){return this.ready&&this.disabled&&(this.disabled=!1,ht(this.cropper,w)),this},"enable"),disable:o(function(){return this.ready&&!this.disabled&&(this.disabled=!0,Oe(this.cropper,w)),this},"disable"),destroy:o(function(){var d=this.element;return d[C]?(d[C]=void 0,this.isImg&&this.replaced&&(d.src=this.originalUrl),this.uncreate(),this):this},"destroy"),move:o(function(d){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d,f=this.canvasData,E=f.left,b=f.top;return this.moveTo(Gi(d)?d:E+Number(d),Gi(m)?m:b+Number(m))},"move"),moveTo:o(function(d){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d,f=this.canvasData,E=!1;return d=Number(d),m=Number(m),this.ready&&!this.disabled&&this.options.movable&&(oe(d)&&(f.left=d,E=!0),oe(m)&&(f.top=m,E=!0),E&&this.renderCanvas(!0)),this},"moveTo"),zoom:o(function(d,m){var f=this.canvasData;return d=Number(d),d<0?d=1/(1-d):d=1+d,this.zoomTo(f.width*d/f.naturalWidth,null,m)},"zoom"),zoomTo:o(function(d,m,f){var E=this.options,b=this.canvasData,x=b.width,A=b.height,G=b.naturalWidth,H=b.naturalHeight;if(d=Number(d),d>=0&&this.ready&&!this.disabled&&E.zoomable){var O=G*d,I=H*d;if(Yi(this.element,jt,{ratio:d,oldRatio:x/G,originalEvent:f})===!1)return this;if(f){var V=this.pointers,pe=$u(this.cropper),ue=V&&Object.keys(V).length?Kg(V):{pageX:f.pageX,pageY:f.pageY};b.left-=(O-x)*((ue.pageX-pe.left-b.left)/x),b.top-=(I-A)*((ue.pageY-pe.top-b.top)/A)}else Yt(m)&&oe(m.x)&&oe(m.y)?(b.left-=(O-x)*((m.x-b.left)/x),b.top-=(I-A)*((m.y-b.top)/A)):(b.left-=(O-x)/2,b.top-=(I-A)/2);b.width=O,b.height=I,this.renderCanvas(!0)}return this},"zoomTo"),rotate:o(function(d){return this.rotateTo((this.imageData.rotate||0)+Number(d))},"rotate"),rotateTo:o(function(d){return d=Number(d),oe(d)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=d%360,this.renderCanvas(!0,!0)),this},"rotateTo"),scaleX:o(function(d){var m=this.imageData.scaleY;return this.scale(d,oe(m)?m:1)},"scaleX"),scaleY:o(function(d){var m=this.imageData.scaleX;return this.scale(oe(m)?m:1,d)},"scaleY"),scale:o(function(d){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d,f=this.imageData,E=!1;return d=Number(d),m=Number(m),this.ready&&!this.disabled&&this.options.scalable&&(oe(d)&&(f.scaleX=d,E=!0),oe(m)&&(f.scaleY=m,E=!0),E&&this.renderCanvas(!0,!0)),this},"scale"),getData:o(function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,m=this.options,f=this.imageData,E=this.canvasData,b=this.cropBoxData,x;if(this.ready&&this.cropped){x={x:b.left-E.left,y:b.top-E.top,width:b.width,height:b.height};var A=f.width/f.naturalWidth;if(ke(x,function(O,I){x[I]=O/A}),d){var G=Math.round(x.y+x.height),H=Math.round(x.x+x.width);x.x=Math.round(x.x),x.y=Math.round(x.y),x.width=H-x.x,x.height=G-x.y}}else x={x:0,y:0,width:0,height:0};return m.rotatable&&(x.rotate=f.rotate||0),m.scalable&&(x.scaleX=f.scaleX||1,x.scaleY=f.scaleY||1),x},"getData"),setData:o(function(d){var m=this.options,f=this.imageData,E=this.canvasData,b={};if(this.ready&&!this.disabled&&Yt(d)){var x=!1;m.rotatable&&oe(d.rotate)&&d.rotate!==f.rotate&&(f.rotate=d.rotate,x=!0),m.scalable&&(oe(d.scaleX)&&d.scaleX!==f.scaleX&&(f.scaleX=d.scaleX,x=!0),oe(d.scaleY)&&d.scaleY!==f.scaleY&&(f.scaleY=d.scaleY,x=!0)),x&&this.renderCanvas(!0,!0);var A=f.width/f.naturalWidth;oe(d.x)&&(b.left=d.x*A+E.left),oe(d.y)&&(b.top=d.y*A+E.top),oe(d.width)&&(b.width=d.width*A),oe(d.height)&&(b.height=d.height*A),this.setCropBoxData(b)}return this},"setData"),getContainerData:o(function(){return this.ready?xe({},this.containerData):{}},"getContainerData"),getImageData:o(function(){return this.sized?xe({},this.imageData):{}},"getImageData"),getCanvasData:o(function(){var d=this.canvasData,m={};return this.ready&&ke(["left","top","width","height","naturalWidth","naturalHeight"],function(f){m[f]=d[f]}),m},"getCanvasData"),setCanvasData:o(function(d){var m=this.canvasData,f=m.aspectRatio;return this.ready&&!this.disabled&&Yt(d)&&(oe(d.left)&&(m.left=d.left),oe(d.top)&&(m.top=d.top),oe(d.width)?(m.width=d.width,m.height=d.width/f):oe(d.height)&&(m.height=d.height,m.width=d.height*f),this.renderCanvas(!0)),this},"setCanvasData"),getCropBoxData:o(function(){var d=this.cropBoxData,m;return this.ready&&this.cropped&&(m={left:d.left,top:d.top,width:d.width,height:d.height}),m||{}},"getCropBoxData"),setCropBoxData:o(function(d){var m=this.cropBoxData,f=this.options.aspectRatio,E,b;return this.ready&&this.cropped&&!this.disabled&&Yt(d)&&(oe(d.left)&&(m.left=d.left),oe(d.top)&&(m.top=d.top),oe(d.width)&&d.width!==m.width&&(E=!0,m.width=d.width),oe(d.height)&&d.height!==m.height&&(b=!0,m.height=d.height),f&&(E?m.height=m.width/f:b&&(m.width=m.height*f)),this.renderCropBox()),this},"setCropBoxData"),getCroppedCanvas:o(function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var m=this.canvasData,f=Jg(this.image,this.imageData,m,d);if(!this.cropped)return f;var E=this.getData(d.rounded),b=E.x,x=E.y,A=E.width,G=E.height,H=f.width/Math.floor(m.naturalWidth);H!==1&&(b*=H,x*=H,A*=H,G*=H);var O=A/G,I=ei({aspectRatio:O,width:d.maxWidth||1/0,height:d.maxHeight||1/0}),V=ei({aspectRatio:O,width:d.minWidth||0,height:d.minHeight||0},"cover"),pe=ei({aspectRatio:O,width:d.width||(H!==1?f.width:A),height:d.height||(H!==1?f.height:G)}),ue=pe.width,Ce=pe.height;ue=Math.min(I.width,Math.max(V.width,ue)),Ce=Math.min(I.height,Math.max(V.height,Ce));var me=document.createElement("canvas"),Be=me.getContext("2d");me.width=Ft(ue),me.height=Ft(Ce),Be.fillStyle=d.fillColor||"transparent",Be.fillRect(0,0,ue,Ce);var $e=d.imageSmoothingEnabled,Ne=$e===void 0?!0:$e,qt=d.imageSmoothingQuality;Be.imageSmoothingEnabled=Ne,qt&&(Be.imageSmoothingQuality=qt);var ft=f.width,X=f.height,ge=b,je=x,bt,$t,gi,yi,ti,Rt;ge<=-A||ge>ft?(ge=0,bt=0,gi=0,ti=0):ge<=0?(gi=-ge,ge=0,bt=Math.min(ft,A+ge),ti=bt):ge<=ft&&(gi=0,bt=Math.min(A,ft-ge),ti=bt),bt<=0||je<=-G||je>X?(je=0,$t=0,yi=0,Rt=0):je<=0?(yi=-je,je=0,$t=Math.min(X,G+je),Rt=$t):je<=X&&(yi=0,$t=Math.min(G,X-je),Rt=$t);var ut=[ge,je,bt,$t];if(ti>0&&Rt>0){var vi=ue/A;ut.push(gi*vi,yi*vi,ti*vi,Rt*vi)}return Be.drawImage.apply(Be,[f].concat(p(ut.map(function(oo){return Math.floor(Ft(oo))})))),me},"getCroppedCanvas"),setAspectRatio:o(function(d){var m=this.options;return!this.disabled&&!Gi(d)&&(m.aspectRatio=Math.max(0,d)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},"setAspectRatio"),setDragMode:o(function(d){var m=this.options,f=this.dragBox,E=this.face;if(this.ready&&!this.disabled){var b=d===U,x=m.movable&&d===M;d=b||x?d:Y,m.dragMode=d,Jt(f,N,d),zt(f,T,b),zt(f,Z,x),m.cropBoxMovable||(Jt(E,N,d),zt(E,T,b),zt(E,Z,x))}return this},"setDragMode")},cy=D.Cropper,Xu=(function(){function v(d){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n(this,v),!d||!qe.test(d.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=d,this.options=xe({},Dr,Yt(m)&&m),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(v,"Cropper"),l(v,[{key:"init",value:o(function(){var m=this.element,f=m.tagName.toLowerCase(),E;if(!m[C]){if(m[C]=this,f==="img"){if(this.isImg=!0,E=m.getAttribute("src")||"",this.originalUrl=E,!E)return;E=m.src}else f==="canvas"&&window.HTMLCanvasElement&&(E=m.toDataURL());this.load(E)}},"init")},{key:"load",value:o(function(m){var f=this;if(m){this.url=m,this.imageData={};var E=this.element,b=this.options;if(!b.rotatable&&!b.scalable&&(b.checkOrientation=!1),!b.checkOrientation||!window.ArrayBuffer){this.clone();return}if(mi.test(m)){Kt.test(m)?this.read(ey(m)):this.clone();return}var x=new XMLHttpRequest,A=this.clone.bind(this);this.reloading=!0,this.xhr=x,x.onabort=A,x.onerror=A,x.ontimeout=A,x.onprogress=function(){x.getResponseHeader("content-type")!==Xt&&x.abort()},x.onload=function(){f.read(x.response)},x.onloadend=function(){f.reloading=!1,f.xhr=null},b.checkCrossOrigin&&Vu(m)&&E.crossOrigin&&(m=Wu(m)),x.open("GET",m,!0),x.responseType="arraybuffer",x.withCredentials=E.crossOrigin==="use-credentials",x.send()}},"load")},{key:"read",value:o(function(m){var f=this.options,E=this.imageData,b=iy(m),x=0,A=1,G=1;if(b>1){this.url=ty(m,Xt);var H=ry(b);x=H.rotate,A=H.scaleX,G=H.scaleY}f.rotatable&&(E.rotate=x),f.scalable&&(E.scaleX=A,E.scaleY=G),this.clone()},"read")},{key:"clone",value:o(function(){var m=this.element,f=this.url,E=m.crossOrigin,b=f;this.options.checkCrossOrigin&&Vu(f)&&(E||(E="anonymous"),b=Wu(f)),this.crossOrigin=E,this.crossOriginUrl=b;var x=document.createElement("img");E&&(x.crossOrigin=E),x.src=b||f,x.alt=m.alt||"The image to crop",this.image=x,x.onload=this.start.bind(this),x.onerror=this.stop.bind(this),Oe(x,L),m.parentNode.insertBefore(x,m.nextSibling)},"clone")},{key:"start",value:o(function(){var m=this,f=this.image;f.onload=null,f.onerror=null,this.sizing=!0;var E=D.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(D.navigator.userAgent),b=o(function(H,O){xe(m.imageData,{naturalWidth:H,naturalHeight:O,aspectRatio:H/O}),m.initialImageData=xe({},m.imageData),m.sizing=!1,m.sized=!0,m.build()},"done");if(f.naturalWidth&&!E){b(f.naturalWidth,f.naturalHeight);return}var x=document.createElement("img"),A=document.body||document.documentElement;this.sizingImage=x,x.onload=function(){b(x.width,x.height),E||A.removeChild(x)},x.src=f.src,E||(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;",A.appendChild(x))},"start")},{key:"stop",value:o(function(){var m=this.image;m.onload=null,m.onerror=null,m.parentNode.removeChild(m),this.image=null},"stop")},{key:"build",value:o(function(){if(!(!this.sized||this.ready)){var m=this.element,f=this.options,E=this.image,b=m.parentNode,x=document.createElement("div");x.innerHTML=Qs;var A=x.querySelector(".".concat(C,"-container")),G=A.querySelector(".".concat(C,"-canvas")),H=A.querySelector(".".concat(C,"-drag-box")),O=A.querySelector(".".concat(C,"-crop-box")),I=O.querySelector(".".concat(C,"-face"));this.container=b,this.cropper=A,this.canvas=G,this.dragBox=H,this.cropBox=O,this.viewBox=A.querySelector(".".concat(C,"-view-box")),this.face=I,G.appendChild(E),Oe(m,_),b.insertBefore(A,m.nextSibling),ht(E,L),this.initPreview(),this.bind(),f.initialAspectRatio=Math.max(0,f.initialAspectRatio)||NaN,f.aspectRatio=Math.max(0,f.aspectRatio)||NaN,f.viewMode=Math.max(0,Math.min(3,Math.round(f.viewMode)))||0,Oe(O,_),f.guides||Oe(O.getElementsByClassName("".concat(C,"-dashed")),_),f.center||Oe(O.getElementsByClassName("".concat(C,"-center")),_),f.background&&Oe(A,"".concat(C,"-bg")),f.highlight||Oe(I,$),f.cropBoxMovable&&(Oe(I,Z),Jt(I,N,j)),f.cropBoxResizable||(Oe(O.getElementsByClassName("".concat(C,"-line")),_),Oe(O.getElementsByClassName("".concat(C,"-point")),_)),this.render(),this.ready=!0,this.setDragMode(f.dragMode),f.autoCrop&&this.crop(),this.setData(f.data),Ze(f.ready)&&vt(m,De,f.ready,{once:!0}),Yi(m,De)}},"build")},{key:"unbuild",value:o(function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var m=this.cropper.parentNode;m&&m.removeChild(this.cropper),ht(this.element,_)}},"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=cy,v},"noConflict")},{key:"setDefaults",value:o(function(m){xe(Dr,Yt(m)&&m)},"setDefaults")}])})();return xe(Xu.prototype,sy,oy,ny,ay,ly,uy),Xu}))});var Om=ye((JI,Um)=>{"use strict";Um.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=ye(au=>{"use strict";var eS=Object.prototype.hasOwnProperty,tS;function Im(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return null}}o(Im,"decode");function Dm(i){try{return encodeURIComponent(i)}catch{return null}}o(Dm,"encode");function iS(i){for(var e=/([^=?#&]+)=?([^&]*)/g,t={},r;r=e.exec(i);){var s=Im(r[1]),n=Im(r[2]);s===null||n===null||s in t||(t[s]=n)}return t}o(iS,"querystring");function rS(i,e){e=e||"";var t=[],r,s;typeof e!="string"&&(e="?");for(s in i)if(eS.call(i,s)){if(r=i[s],!r&&(r===null||r===tS||isNaN(r))&&(r=""),s=Dm(s),r=Dm(r),s===null||r===null)continue;t.push(s+"="+r)}return t.length?e+t.join("&"):""}o(rS,"querystringify");au.stringify=rS;au.parse=iS});var $m=ye((tD,qm)=>{"use strict";var Lm=Om(),_n=Nm(),sS=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Bm=/[\n\r\t]/g,oS=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,jm=/:\d+$/,nS=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,aS=/^[a-zA-Z]:/;function uu(i){return(i||"").toString().replace(sS,"")}o(uu,"trimLeft");var lu=[["#","hash"],["?","query"],o(function(e,t){return Mt(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]],Mm={hash:1,query:1};function zm(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 Lt(unescape(i.pathname),{});else if(s==="string"){r=new Lt(i,{});for(n in Mm)delete r[n]}else if(s==="object"){for(n in i)n in Mm||(r[n]=i[n]);r.slashes===void 0&&(r.slashes=oS.test(i.href))}return r}o(zm,"lolcation");function Mt(i){return i==="file:"||i==="ftp:"||i==="http:"||i==="https:"||i==="ws:"||i==="wss:"}o(Mt,"isSpecial");function Hm(i,e){i=uu(i),i=i.replace(Bm,""),e=e||{};var t=nS.exec(i),r=t[1]?t[1].toLowerCase():"",s=!!t[2],n=!!t[3],a=0,l;return s?n?(l=t[2]+t[3]+t[4],a=t[2].length+t[3].length):(l=t[2]+t[4],a=t[2].length):n?(l=t[3]+t[4],a=t[3].length):l=t[4],r==="file:"?a>=2&&(l=l.slice(2)):Mt(r)?l=t[4]:r?s&&(l=l.slice(2)):a>=2&&Mt(e.protocol)&&(l=t[4]),{protocol:r,slashes:s||Mt(r),slashesCount:a,rest:l}}o(Hm,"extractProtocol");function lS(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(lS,"resolve");function Lt(i,e,t){if(i=uu(i),i=i.replace(Bm,""),!(this instanceof Lt))return new Lt(i,e,t);var r,s,n,a,l,c,p=lu.slice(),h=typeof e,g=this,y=0;for(h!=="object"&&h!=="string"&&(t=e,e=null),t&&typeof t!="function"&&(t=_n.parse),e=zm(e),s=Hm(i||"",e),r=!s.protocol&&!s.slashes,g.slashes=s.slashes||r&&e.slashes,g.protocol=s.protocol||e.protocol||"",i=s.rest,(s.protocol==="file:"&&(s.slashesCount!==2||aS.test(i))||!s.slashes&&(s.protocol||s.slashesCount<2||!Mt(g.protocol)))&&(p[3]=[/(.*)/,"pathname"]);y<p.length;y++){if(a=p[y],typeof a=="function"){i=a(i,g);continue}n=a[0],c=a[1],n!==n?g[c]=i:typeof n=="string"?(l=n==="@"?i.lastIndexOf(n):i.indexOf(n),~l&&(typeof a[2]=="number"?(g[c]=i.slice(0,l),i=i.slice(l+a[2])):(g[c]=i.slice(l),i=i.slice(0,l)))):(l=n.exec(i))&&(g[c]=l[1],i=i.slice(0,l.index)),g[c]=g[c]||r&&a[3]&&e[c]||"",a[4]&&(g[c]=g[c].toLowerCase())}t&&(g.query=t(g.query)),r&&e.slashes&&g.pathname.charAt(0)!=="/"&&(g.pathname!==""||e.pathname!=="")&&(g.pathname=lS(g.pathname,e.pathname)),g.pathname.charAt(0)!=="/"&&Mt(g.protocol)&&(g.pathname="/"+g.pathname),Lm(g.port,g.protocol)||(g.host=g.hostname,g.port=""),g.username=g.password="",g.auth&&(l=g.auth.indexOf(":"),~l?(g.username=g.auth.slice(0,l),g.username=encodeURIComponent(decodeURIComponent(g.username)),g.password=g.auth.slice(l+1),g.password=encodeURIComponent(decodeURIComponent(g.password))):g.username=encodeURIComponent(decodeURIComponent(g.auth)),g.auth=g.password?g.username+":"+g.password:g.username),g.origin=g.protocol!=="file:"&&Mt(g.protocol)&&g.host?g.protocol+"//"+g.host:"null",g.href=g.toString()}o(Lt,"Url");function uS(i,e,t){var r=this;switch(i){case"query":typeof e=="string"&&e.length&&(e=(t||_n.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,jm.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<lu.length;a++){var l=lu[a];l[4]&&(r[l[1]]=r[l[1]].toLowerCase())}return r.auth=r.password?r.username+":"+r.password:r.username,r.origin=r.protocol!=="file:"&&Mt(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r}o(uS,"set");function cS(i){(!i||typeof i!="function")&&(i=_n.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||Mt(t.protocol)?"//":"");return t.username?(n+=t.username,t.password&&(n+=":"+t.password),n+="@"):t.password?(n+=":"+t.password,n+="@"):t.protocol!=="file:"&&Mt(t.protocol)&&!r&&t.pathname!=="/"&&(n+="@"),(r[r.length-1]===":"||jm.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(cS,"toString");Lt.prototype={set:uS,toString:cS};Lt.extractProtocol=Hm;Lt.location=zm;Lt.trimLeft=uu;Lt.qs=_n;qm.exports=Lt});var Pu=ye((oN,Eu)=>{function Je(i){if(i)return l2(i);this._callbacks=new Map}o(Je,"Emitter");function l2(i){return Object.assign(i,Je.prototype),i._callbacks=new Map,i}o(l2,"mixin");Je.prototype.on=function(i,e){let t=this._callbacks.get(i)??[];return t.push(e),this._callbacks.set(i,t),this};Je.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};Je.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};Je.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};Je.prototype.listeners=function(i){return this._callbacks.get(i)??[]};Je.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};Je.prototype.hasListeners=function(i){return this.listenerCount(i)>0};Je.prototype.addEventListener=Je.prototype.on;Je.prototype.removeListener=Je.prototype.off;Je.prototype.removeEventListener=Je.prototype.off;Je.prototype.removeAllListeners=Je.prototype.off;typeof Eu<"u"&&(Eu.exports=Je)});var Dg=ye((CN,On)=>{"use strict";On.exports=Ou;On.exports.isMobile=Ou;On.exports.default=Ou;var g2=/(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|redmi|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,y2=/CrOS/,v2=/android|ipad|playbook|silk/i;function Ou(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=g2.test(e)&&!y2.test(e)||!!i.tablet&&v2.test(e);return!t&&i.tablet&&i.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.indexOf("Macintosh")!==-1&&e.indexOf("Safari")!==-1&&(t=!0),t}o(Ou,"isMobile")});function ao(i,e,t){return new Promise(r=>{i.toBlob(r,e,t)})}o(ao,"canvasToBlob");var by=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function wy(i,e,t){let r=by.exec(i),s=e.mimeType??r?.[1]??"plain/text",n;if(r?.[2]!=null){let a=atob(decodeURIComponent(r[3])),l=new Uint8Array(a.length);for(let c=0;c<a.length;c++)l[c]=a.charCodeAt(c);n=[l]}else r?.[3]!=null&&(n=[decodeURIComponent(r[3])]);return t?new File(n,e.name||"",{type:s}):new Blob(n,{type:s})}o(wy,"dataURItoBlob");var zn=wy;var Hn=class extends Error{static{o(this,"ErrorWithCause")}isNetworkError;cause;constructor(e,t){super(e),this.cause=t?.cause,this.cause&&Object.hasOwn(this.cause,"isNetworkError")?this.isNetworkError=this.cause.isNetworkError:this.isNetworkError=!1}},bi=Hn;function ii(i,e,t,r){return t===0||i===e?i:r===0?e:i+(e-i)*2**(-r/t)}o(ii,"emaFilter");var Br=['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 qn=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}},wt=qn;var $n=class{static{o(this,"ProgressTimeout")}#e;#t=!1;#i;#r;constructor(e,t){this.#r=e,this.#i=()=>t(e)}progress(){this.#t||this.#r>0&&(clearTimeout(this.#e),this.#e=setTimeout(this.#i,this.#r))}done(){this.#t||(clearTimeout(this.#e),this.#e=void 0,this.#t=!0)}},Zu=$n;var lo=o(()=>{},"noop");function jr(i,e={}){let{body:t=null,headers:r={},method:s="GET",onBeforeRequest:n=lo,onUploadProgress:a=lo,shouldRetry:l=o(()=>!0,"shouldRetry"),onAfterResponse:c=lo,onTimeout:p=lo,responseType:h,retries:g=3,signal:y=null,timeout:S=3e4,withCredentials:P=!1}=e,F=o(R=>.3*2**(R-1)*1e3,"delay"),D=new Zu(S,p);function q(R=0){return new Promise(async(C,j)=>{let W=new XMLHttpRequest,B=o(K=>{l(W)&&R<g?setTimeout(()=>{q(R+1).then(C,j)},F(R)):(D.done(),j(K))},"onError");W.open(s,i,!0),W.withCredentials=P,h&&(W.responseType=h),W.onload=async()=>{try{await c(W,R)}catch(K){K.request=W,B(K);return}W.status>=200&&W.status<300?(D.done(),C(W)):l(W)&&R<g?setTimeout(()=>{q(R+1).then(C,j)},F(R)):(D.done(),j(new wt(W.statusText,W)))},W.onerror=()=>B(new wt(W.statusText,W)),W.upload.onprogress=K=>{D.progress(),a(K)},r&&Object.keys(r).forEach(K=>{W.setRequestHeader(K,r[K])});function Q(){W.abort(),j(new DOMException("Aborted","AbortError"))}if(o(Q,"abort"),y?.addEventListener("abort",Q),y?.aborted){Q();return}await n(W,R),W.send(t)})}return o(q,"requestWithRetry"),q()}o(jr,"fetcher");function ri(...i){return fetch(...i).catch(e=>{throw e.name==="AbortError"?e:new wt(e)})}o(ri,"fetchWithNetworkError");var Sy=o(i=>"error"in i&&!!i.error,"hasError"),xy=o(i=>i.progress.uploadComplete,"isCompleted");function wi(i){return i.filter(e=>!Sy(e)&&!xy(e))}o(wi,"filterFilesToUpload");function Si(i){return i.filter(e=>!e.progress?.uploadStarted||!e.isRestored)}o(Si,"filterFilesToEmitUploadStarted");function zr(i){return typeof i!="object"||i===null||!("nodeType"in i)?!1:i.nodeType===Node.ELEMENT_NODE}o(zr,"isDOMElement");function _y(i){if(typeof i=="string"){let e=document.querySelectorAll(i);return e.length===0?null:Array.from(e)}return typeof i=="object"&&zr(i)?[i]:null}o(_y,"findAllDOMElements");var uo=_y;function Ey(i,e=document){return typeof i=="string"?e.querySelector(i):zr(i)?i:null}o(Ey,"findDOMElement");var Hr=Ey;function Tt(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(Tt,"getFileNameAndExtension");var Ji={__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 Qi(i){if(i.type)return i.type;let e=i.name?Tt(i.name).extension?.toLowerCase():null;return e&&e in Ji?Ji[e]:"application/octet-stream"}o(Qi,"getFileType");function Py(i){return i.charCodeAt(0).toString(32)}o(Py,"encodeCharacter");function ec(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${Py(t)}`,"/"))+e}o(ec,"encodeFilename");function Vn(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${ec(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${ec(i.meta.relativePath.toLowerCase())}`),i.data?.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}o(Vn,"generateFileID");function Ty(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}o(Ty,"hasFileStableId");function qr(i,e){if(Ty(i))return i.id;let t=Qi(i);return Vn({...i,type:t},e)}o(qr,"getSafeFileId");function Vt(i,e){return i===!0?Object.keys(e):Array.isArray(i)?i:[]}o(Vt,"getAllowedMetaFields");var ze=Array.from;function Wn(i){let e=ze(i.files);return Promise.resolve(e)}o(Wn,"fallbackApi");function co(i,e,t,{onSuccess:r}){i.readEntries(s=>{let n=[...e,...s];s.length?queueMicrotask(()=>{co(i,n,t,{onSuccess:r})}):r(n)},s=>{t(s),r(e)})}o(co,"getFilesAndDirectoriesFromDirectory");function tc(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=>{co(t,[],e,{onSuccess:o(n=>s(n.map(a=>tc(a,e))),"onSuccess")})})},isSameEntry:void 0}}o(tc,"getAsFileSystemHandleFromEntry");async function*ic(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*ic(s,e?r():i.name);else t!=null&&(yield t)}o(ic,"createPromiseToAddFileOrParseDirectory");async function*Gn(i,e){let t=await Promise.all(Array.from(i.items,async r=>{let s;return s??=tc(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*ic(s,"",r)}catch(n){r!=null?yield r:e(n)}else r!=null&&(yield r)}o(Gn,"getFilesFromDataTransfer");async function si(i,e){let t=e?.logDropError??Function.prototype;try{let r=[];for await(let s of Gn(i,t))r.push(s);return r}catch{return Wn(i)}}o(si,"getDroppedFiles");var ky={__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 St(i){return[i]=i.split(";",1),ky[i]||null}o(St,"getFileTypeExtension");function Zi(i){let t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?([^\n]+)/i.exec(i)?.[1];return`${/^http:\/\//i.test(i)?"ws":"wss"}://${t}`}o(Zi,"getSocketHost");function Cy(i){for(;i&&!i.dir;)i=i.parentNode;return i?.dir}o(Cy,"getTextDirection");var $r=Cy;function Xn(i){return i<10?`0${i}`:i.toString()}o(Xn,"pad");function xi(){let i=new Date,e=Xn(i.getHours()),t=Xn(i.getMinutes()),r=Xn(i.getSeconds());return`${e}:${t}:${r}`}o(xi,"getTimeStamp");function er(){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(er,"isDragDropSupported");function Fy(i){return i?i.readyState===4&&i.status===0:!1}o(Fy,"isNetworkError");var Vr=Fy;function Wr(i){return i.startsWith("blob:")}o(Wr,"isObjectURL");function Gr(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}o(Gr,"isPreviewSupported");function Kn(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(Kn,"secondsToTime");function tr(i){let e=Kn(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(tr,"prettyETA");function Ry(i){return new Error("Cancelled",{cause:i})}o(Ry,"createCancelError");function rc(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(rc,"abortOn");var Wt=class{static{o(this,"RateLimitedQueue")}#e=0;#t=[];#i=!1;#r;#s=1;#o;#n;limit;constructor(e){typeof e!="number"||e===0?this.limit=1/0:this.limit=e}#a(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.#u())},"abort"),done:o(()=>{t||(t=!0,this.#e-=1,this.#u())},"done")}}#u(){queueMicrotask(()=>this.#l())}#l(){if(this.#i||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.#a(e.fn);e.abort=t.abort,e.done=t.done}#c(e,t){let r={fn:e,priority:t?.priority||0,abort:o(()=>{this.#p(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}#p(e){let t=this.#t.indexOf(e);t!==-1&&this.#t.splice(t,1)}run(e,t){return!this.#i&&this.#e<this.limit?this.#a(e):this.#c(e,t)}wrapSyncFunction(e,t){return(...r)=>{let s=this.run(()=>(e(...r),queueMicrotask(()=>s.done()),()=>{}),t);return{abortOn:rc,abort(){s.abort()}}}}wrapPromiseFunction(e,t){return(...r)=>{let s,n=new Promise((a,l)=>{s=this.run(()=>{let c,p;try{p=Promise.resolve(e(...r))}catch(h){p=Promise.reject(h)}return p.then(h=>{c?l(c):(s.done(),a(h))},h=>{c?l(c):(s.done(),l(h))}),h=>{c=Ry(h)}},t)});return n.abort=a=>{s.abort(a)},n.abortOn=rc,n}}resume(){this.#i=!1,clearTimeout(this.#r);for(let e=0;e<this.limit;e++)this.#u()}#h=o(()=>this.resume(),"#resume");pause(e=null){this.#i=!0,clearTimeout(this.#r),e!=null&&(this.#r=setTimeout(this.#h,e))}rateLimit(e){clearTimeout(this.#n),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(this.#o=this.limit-1,this.limit=this.#s,this.#n=setTimeout(this.#d,e))}#d=o(()=>{if(this.#i){this.#n=setTimeout(this.#d,0);return}this.#s=this.limit,this.limit=Math.ceil((this.#o+this.#s)/2);for(let e=this.#s;e<=this.limit;e++)this.#u();this.#o-this.#s>3?this.#n=setTimeout(this.#d,2e3):this.#s=Math.floor(this.#s/2)},"#increaseLimit");get isPaused(){return this.#i}};function ir(i){return{...i,type:i.mimeType,extension:i.name?Tt(i.name).extension:null}}o(ir,"remoteFileObjToLocal");var _i=class{static{o(this,"TaskQueue")}#e=[];#t=0;#i;#r=!1;constructor(e){let t=e?.concurrency;this.#i=typeof t!="number"||t===0?1/0:t}add(e){let t=new AbortController,r,s,n=new Promise((l,c)=>{r=l,s=c}),a={run:o(()=>e(t.signal),"run"),resolve:r,reject:s,controller:t};return t.signal.addEventListener("abort",()=>{let l=this.#e.indexOf(a);l!==-1&&(this.#e.splice(l,1),s(t.signal.reason??new DOMException("Aborted","AbortError")))},{once:!0}),n.abort=l=>{t.abort(l??new DOMException("Aborted","AbortError"))},n.abortOn=l=>{if(l){let c=o(()=>n.abort(l.reason),"onAbort");l.addEventListener("abort",c,{once:!0}),n.then(()=>l.removeEventListener("abort",c),()=>l.removeEventListener("abort",c))}return n},!this.#r&&this.#t<this.#i?this.#s(a):this.#e.push(a),n}#s(e){if(this.#t++,e.controller.signal.aborted){this.#t--,e.reject(e.controller.signal.reason??new DOMException("Aborted","AbortError")),this.#o();return}let t;try{t=e.run()}catch(r){t=Promise.reject(r)}t.then(r=>{e.controller.signal.aborted?e.reject(e.controller.signal.reason??new DOMException("Aborted","AbortError")):e.resolve(r)},r=>{e.reject(r)}).finally(()=>{this.#t--,this.#o()})}#o(){queueMicrotask(()=>{if(!(this.#r||this.#t>=this.#i))for(;this.#e.length>0;){let e=this.#e.shift();if(!e.controller.signal.aborted){this.#s(e);return}}})}pause(){this.#r=!0}resume(){this.#r=!1;let e=this.#i-this.#t;for(let t=0;t<e;t++)this.#o()}clear(e){let t=this.#e.splice(0),r=e??new DOMException("Cleared","AbortError");for(let s of t)s.controller.abort(r),s.reject(r)}get concurrency(){return this.#i}set concurrency(e){if(this.#i=typeof e!="number"||e===0?1/0:e,!this.#r){let t=this.#i-this.#t;for(let r=0;r<t;r++)this.#o()}}get pending(){return this.#e.length}get running(){return this.#t}get isPaused(){return this.#r}wrapPromiseFunction(e){return(...t)=>this.add(r=>e(...t))}};function Ay(i,e,t){let r=[];return i.forEach(s=>{if(typeof s!="string"){r.push(s);return}e[Symbol.split](s).forEach((n,a,l)=>{n!==""&&r.push(n),a<l.length-1&&r.push(t)})}),r}o(Ay,"insertReplacement");function sc(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=Ay(s,new RegExp(`%\\{${n}\\}`,"g"),a)}return s}o(sc,"interpolate");var Uy=o(i=>{throw new Error(`missing string: ${i}`)},"defaultOnMissingKey"),oi=class{static{o(this,"Translator")}locale;constructor(e,{onMissingKey:t=Uy}={}){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 sc(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 sc(r,t)}};function Xr(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(Xr,"truncateString");var Yn=class extends Error{static{o(this,"UserFacingApiError")}name="UserFacingApiError"},Jn=Yn;var Jr,ie,uc,Oy,ni,oc,cc,pc,Qn,ho,Kr,dc,ta,Zn,ea,Iy,fo={},mo=[],Dy=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Qr=Array.isArray;function At(i,e){for(var t in e)i[t]=e[t];return i}o(At,"m");function ia(i){i&&i.parentNode&&i.parentNode.removeChild(i)}o(ia,"b");function Gt(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?Jr.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 Yr(i,a,r,s,null)}o(Gt,"k");function Yr(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??++uc,__i:-1,__u:0};return s==null&&ie.vnode!=null&&ie.vnode(n),n}o(Yr,"x");function yo(){return{current:null}}o(yo,"M");function Ee(i){return i.children}o(Ee,"S");function de(i,e){this.props=i,this.context=e}o(de,"C");function rr(i,e){if(e==null)return i.__?rr(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"?rr(i):null}o(rr,"$");function Ny(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,r=[],s=[],n=At({},e);n.__v=e.__v+1,ie.vnode&&ie.vnode(n),ra(i.__P,n,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,r,t??rr(e),!!(32&e.__u),s),n.__v=e.__v,n.__.__k[n.__i]=n,yc(r,n,s),e.__e=e.__=null,n.__e!=t&&hc(n)}}o(Ny,"I");function hc(i){if((i=i.__)!=null&&i.__c!=null)return i.__e=i.__c.base=null,i.__k.some(function(e){if(e!=null&&e.__e!=null)return i.__e=i.__c.base=e.__e}),hc(i)}o(hc,"P");function nc(i){(!i.__d&&(i.__d=!0)&&ni.push(i)&&!go.__r++||oc!=ie.debounceRendering)&&((oc=ie.debounceRendering)||cc)(go)}o(nc,"A");function go(){try{for(var i,e=1;ni.length;)ni.length>e&&ni.sort(pc),i=ni.shift(),e=ni.length,Ny(i)}finally{ni.length=go.__r=0}}o(go,"H");function fc(i,e,t,r,s,n,a,l,c,p,h){var g,y,S,P,F,D,q,R=r&&r.__k||mo,C=e.length;for(c=My(t,e,R,c,C),g=0;g<C;g++)(S=t.__k[g])!=null&&(y=S.__i!=-1&&R[S.__i]||fo,S.__i=g,D=ra(i,S,y,s,n,a,l,c,p,h),P=S.__e,S.ref&&y.ref!=S.ref&&(y.ref&&sa(y.ref,null,S),h.push(S.ref,S.__c||P,S)),F==null&&P!=null&&(F=P),(q=!!(4&S.__u))||y.__k===S.__k?(c=mc(S,c,i,q),q&&y.__e&&(y.__e=null)):typeof S.type=="function"&&D!==void 0?c=D:P&&(c=P.nextSibling),S.__u&=-7);return t.__e=F,c}o(fc,"L");function My(i,e,t,r,s){var n,a,l,c,p,h=t.length,g=h,y=0;for(i.__k=new Array(s),n=0;n<s;n++)(a=e[n])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=i.__k[n]=Yr(null,a,null,null,null):Qr(a)?a=i.__k[n]=Yr(Ee,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=i.__k[n]=Yr(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):i.__k[n]=a,c=n+y,a.__=i,a.__b=i.__b+1,l=null,(p=a.__i=Ly(a,t,c,g))!=-1&&(g--,(l=t[p])&&(l.__u|=2)),l==null||l.__v==null?(p==-1&&(s>h?y--:s<h&&y++),typeof a.type!="function"&&(a.__u|=4)):p!=c&&(p==c-1?y--:p==c+1?y++:(p>c?y--:y++,a.__u|=4))):i.__k[n]=null;if(g)for(n=0;n<h;n++)(l=t[n])!=null&&(2&l.__u)==0&&(l.__e==r&&(r=rr(l)),bc(l,l));return r}o(My,"T");function mc(i,e,t,r){var s,n;if(typeof i.type=="function"){for(s=i.__k,n=0;s&&n<s.length;n++)s[n]&&(s[n].__=i,e=mc(s[n],e,t,r));return e}i.__e!=e&&(r&&(e&&i.type&&!e.parentNode&&(e=rr(i)),t.insertBefore(i.__e,e||null)),e=i.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}o(mc,"j");function ct(i,e){return e=e||[],i==null||typeof i=="boolean"||(Qr(i)?i.some(function(t){ct(t,e)}):e.push(i)),e}o(ct,"F");function Ly(i,e,t,r){var s,n,a,l=i.key,c=i.type,p=e[t],h=p!=null&&(2&p.__u)==0;if(p===null&&l==null||h&&l==p.key&&c==p.type)return t;if(r>(h?1:0)){for(s=t-1,n=t+1;s>=0||n<e.length;)if((p=e[a=s>=0?s--:n++])!=null&&(2&p.__u)==0&&l==p.key&&c==p.type)return a}return-1}o(Ly,"O");function ac(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||Dy.test(e)?t:t+"px"}o(ac,"z");function po(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||ac(i.style,e,"");if(t)for(e in t)r&&t[e]==r[e]||ac(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(dc,"$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[Kr]=r[Kr]:(t[Kr]=ta,i.addEventListener(e,n?ea:Zn,n)):i.removeEventListener(e,n?ea:Zn,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(po,"N");function lc(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[ho]==null)e[ho]=ta++;else if(e[ho]<t[Kr])return;return t(ie.event?ie.event(e):e)}}}o(lc,"V");function ra(i,e,t,r,s,n,a,l,c,p){var h,g,y,S,P,F,D,q,R,C,j,W,B,Q,K,ee,ne=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),n=[l=e.__e=t.__e]),(h=ie.__b)&&h(e);e:if(typeof ne=="function"){g=a.length;try{if(R=e.props,C=ne.prototype&&ne.prototype.render,j=(h=ne.contextType)&&r[h.__c],W=h?j?j.props.value:h.__:r,t.__c?q=(y=e.__c=t.__c).__=y.__E:(C?e.__c=y=new ne(R,W):(e.__c=y=new de(R,W),y.constructor=ne,y.render=jy),j&&j.sub(y),y.state||(y.state={}),y.__n=r,S=y.__d=!0,y.__h=[],y._sb=[]),C&&y.__s==null&&(y.__s=y.state),C&&ne.getDerivedStateFromProps!=null&&(y.__s==y.state&&(y.__s=At({},y.__s)),At(y.__s,ne.getDerivedStateFromProps(R,y.__s))),P=y.props,F=y.state,y.__v=e,S)C&&ne.getDerivedStateFromProps==null&&y.componentWillMount!=null&&y.componentWillMount(),C&&y.componentDidMount!=null&&y.__h.push(y.componentDidMount);else{if(C&&ne.getDerivedStateFromProps==null&&R!==P&&y.componentWillReceiveProps!=null&&y.componentWillReceiveProps(R,W),e.__v==t.__v||!y.__e&&y.shouldComponentUpdate!=null&&y.shouldComponentUpdate(R,y.__s,W)===!1){e.__v!=t.__v&&(y.props=R,y.state=y.__s,y.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(le){le&&(le.__=e)}),mo.push.apply(y.__h,y._sb),y._sb=[],y.__h.length&&a.push(y);break e}y.componentWillUpdate!=null&&y.componentWillUpdate(R,y.__s,W),C&&y.componentDidUpdate!=null&&y.__h.push(function(){y.componentDidUpdate(P,F,D)})}if(y.context=W,y.props=R,y.__P=i,y.__e=!1,B=ie.__r,Q=0,C)y.state=y.__s,y.__d=!1,B&&B(e),h=y.render(y.props,y.state,y.context),mo.push.apply(y.__h,y._sb),y._sb=[];else do y.__d=!1,B&&B(e),h=y.render(y.props,y.state,y.context),y.state=y.__s;while(y.__d&&++Q<25);y.state=y.__s,y.getChildContext!=null&&(r=At(At({},r),y.getChildContext())),C&&!S&&y.getSnapshotBeforeUpdate!=null&&(D=y.getSnapshotBeforeUpdate(P,F)),K=h!=null&&h.type===Ee&&h.key==null?vc(h.props.children):h,l=fc(i,Qr(K)?K:[K],e,t,r,s,n,a,l,c,p),y.base=e.__e,e.__u&=-161,y.__h.length&&a.push(y),q&&(y.__E=y.__=null)}catch(le){if(a.length=g,e.__v=null,c||n!=null){if(le.then){for(e.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;n!=null&&(n[n.indexOf(l)]=null),e.__e=l}else if(n!=null)for(ee=n.length;ee--;)ia(n[ee])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),le.then||gc(e),ie.__e(le,e,t)}}else n==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):l=e.__e=By(t.__e,e,t,r,s,n,a,c,p);return(h=ie.diffed)&&h(e),128&e.__u?void 0:l}o(ra,"q");function gc(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(gc))}o(gc,"B");function yc(i,e,t){for(var r=0;r<t.length;r++)sa(t[r],t[++r],t[++r]);ie.__c&&ie.__c(e,i),i.some(function(s){try{i=s.__h,s.__h=[],i.some(function(n){n.call(s)})}catch(n){ie.__e(n,s.__v)}})}o(yc,"D");function vc(i){return typeof i!="object"||i==null||i.__b>0?i:Qr(i)?i.map(vc):i.constructor!==void 0?null:At({},i)}o(vc,"E");function By(i,e,t,r,s,n,a,l,c){var p,h,g,y,S,P,F,D=t.props||fo,q=e.props,R=e.type;if(R=="svg"?s="http://www.w3.org/2000/svg":R=="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((S=n[p])&&"setAttribute"in S==!!R&&(R?S.localName==R:S.nodeType==3)){i=S,n[p]=null;break}}if(i==null){if(R==null)return document.createTextNode(q);i=document.createElementNS(s,R,q.is&&q),l&&(ie.__m&&ie.__m(e,n),l=!1),n=null}if(R==null)D===q||l&&i.data==q||(i.data=q);else{if(n=R=="textarea"&&q.defaultValue!=null?null:n&&Jr.call(i.childNodes),!l&&n!=null)for(D={},p=0;p<i.attributes.length;p++)D[(S=i.attributes[p]).name]=S.value;for(p in D)S=D[p],p=="dangerouslySetInnerHTML"?g=S:p=="children"||p in q||p=="value"&&"defaultValue"in q||p=="checked"&&"defaultChecked"in q||po(i,p,null,S,s);for(p in q)S=q[p],p=="children"?y=S:p=="dangerouslySetInnerHTML"?h=S:p=="value"?P=S:p=="checked"?F=S:l&&typeof S!="function"||D[p]===S||po(i,p,S,D[p],s);if(h)l||g&&(h.__html==g.__html||h.__html==i.innerHTML)||(i.innerHTML=h.__html),e.__k=[];else if(g&&(i.innerHTML=""),fc(e.type=="template"?i.content:i,Qr(y)?y:[y],e,t,r,R=="foreignObject"?"http://www.w3.org/1999/xhtml":s,n,a,n?n[0]:t.__k&&rr(t,0),l,c),n!=null)for(p=n.length;p--;)ia(n[p]);l&&R!="textarea"||(p="value",R=="progress"&&P==null?i.removeAttribute("value"):P!=null&&(P!==i[p]||R=="progress"&&!P||R=="option"&&P!=D[p])&&po(i,p,P,D[p],s),p="checked",F!=null&&F!=i[p]&&po(i,p,F,D[p],s))}return i}o(By,"G");function sa(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){ie.__e(s,t)}}o(sa,"J");function bc(i,e,t){var r,s;if(ie.unmount&&ie.unmount(i),(r=i.ref)&&(r.current&&r.current!=i.__e||sa(r,null,e)),(r=i.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(n){ie.__e(n,e)}r.base=r.__P=r.__n=null}if(r=i.__k)for(s=0;s<r.length;s++)r[s]&&bc(r[s],e,t||typeof i.type!="function");t||ia(i.__e),i.__c=i.__=i.__e=void 0}o(bc,"K");function jy(i,e,t){return this.constructor(i,t)}o(jy,"Q");function vo(i,e,t){var r,s,n,a;e==document&&(e=document.documentElement),ie.__&&ie.__(i,e),s=(r=typeof t=="function")?null:t&&t.__k||e.__k,n=[],a=[],ra(e,i=(!r&&t||e).__k=Gt(Ee,null,[i]),s||fo,fo,e.namespaceURI,!r&&t?[t]:s?null:e.firstChild?Jr.call(e.childNodes):null,n,!r&&t?t:s?s.__e:e.firstChild,r,a),yc(n,i,a),i.props.children=null}o(vo,"R");function Zr(i,e,t){var r,s,n,a,l=At({},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]:l[n]=e[n]===void 0&&a!=null?a[n]:e[n];return arguments.length>2&&(l.children=arguments.length>3?Jr.call(arguments,2):t),Yr(i.type,l,r||i.key,s||i.ref,null)}o(Zr,"W");Jr=mo.slice,ie={__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(l){i=l}throw i},"__e")},uc=0,Oy=o(function(i){return i!=null&&i.constructor===void 0},"t"),de.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=At({},this.state),typeof i=="function"&&(i=i(At({},t),this.props)),i&&At(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),nc(this))},de.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),nc(this))},de.prototype.render=Ee,ni=[],cc=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,pc=o(function(i,e){return i.__v.__b-e.__v.__b},"e"),go.__r=0,Qn=Math.random().toString(8),ho="__d"+Qn,Kr="__a"+Qn,dc=/(PointerCapture)$|Capture$/i,ta=0,Zn=lc(!1),ea=lc(!0),Iy=0;var zy=0;function u(i,e,t,r,s,n){e||(e={});var a,l,c=e;if("ref"in c)for(l in c={},e)l=="ref"?a=e[l]:c[l]=e[l];var p={type:i,props:c,key:t,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--zy,__i:-1,__u:0,__source:s,__self:n};if(typeof i=="function"&&(a=i.defaultProps))for(l in a)c[l]===void 0&&(c[l]=a[l]);return ie.vnode&&ie.vnode(p),p}o(u,"u");var sr,Ue,oa,wc,es=0,Cc=[],Ie=ie,Sc=Ie.__b,xc=Ie.__r,_c=Ie.diffed,Ec=Ie.__c,Pc=Ie.unmount,Tc=Ie.__;function wo(i,e){Ie.__h&&Ie.__h(Ue,i,es||e),es=0;var t=Ue.__H||(Ue.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}o(wo,"s");function ot(i){return es=1,Fc(Ac,i)}o(ot,"d");function Fc(i,e,t){var r=wo(sr++,2);if(r.t=i,!r.__c&&(r.__=[t?t(e):Ac(void 0,e),function(l){var c=r.__N?r.__N[0]:r.__[0],p=r.t(c,l);c!==p&&(r.__N=[p,r.__[1]],r.__c.setState({}))}],r.__c=Ue,!Ue.__f)){var s=o(function(l,c,p){if(!r.__c.__H)return!0;var h=!1,g=r.__c.props!==l;if(r.__c.__H.__.some(function(S){if(S.__N){h=!0;var P=S.__[0];S.__=S.__N,S.__N=void 0,P!==S.__[0]&&(g=!0)}}),n){var y=n.call(this,l,c,p);return h?y||g:y}return!h||g},"f");Ue.__f=!0;var n=Ue.shouldComponentUpdate,a=Ue.componentWillUpdate;Ue.componentWillUpdate=function(l,c,p){if(this.__e){var h=n;n=void 0,s(l,c,p),n=h}a&&a.call(this,l,c,p)},Ue.shouldComponentUpdate=s}return r.__N||r.__}o(Fc,"y");function He(i,e){var t=wo(sr++,3);!Ie.__s&&aa(t.__H,e)&&(t.__=i,t.u=e,Ue.__H.__h.push(t))}o(He,"h");function Rc(i,e){var t=wo(sr++,4);!Ie.__s&&aa(t.__H,e)&&(t.__=i,t.u=e,Ue.__h.push(t))}o(Rc,"_");function et(i){return es=5,kt(function(){return{current:i}},[])}o(et,"A");function kt(i,e){var t=wo(sr++,7);return aa(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}o(kt,"T");function xt(i,e){return es=8,kt(function(){return i},e)}o(xt,"q");function Hy(){for(var i;i=Cc.shift();){var e=i.__H;if(i.__P&&e)try{e.__h.some(bo),e.__h.some(na),e.__h=[]}catch(t){e.__h=[],Ie.__e(t,i.__v)}}}o(Hy,"j");Ie.__b=function(i){Ue=null,Sc&&Sc(i)},Ie.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),Tc&&Tc(i,e)},Ie.__r=function(i){xc&&xc(i),sr=0;var e=(Ue=i.__c).__H;e&&(oa===Ue?(e.__h=[],Ue.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.some(bo),e.__h.some(na),e.__h=[],sr=0)),oa=Ue},Ie.diffed=function(i){_c&&_c(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(Cc.push(e)!==1&&wc===Ie.requestAnimationFrame||((wc=Ie.requestAnimationFrame)||qy)(Hy)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),oa=Ue=null},Ie.__c=function(i,e){e.some(function(t){try{t.__h.some(bo),t.__h=t.__h.filter(function(r){return!r.__||na(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],Ie.__e(r,t.__v)}}),Ec&&Ec(i,e)},Ie.unmount=function(i){Pc&&Pc(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.some(function(r){try{bo(r)}catch(s){e=s}}),t.__H=void 0,e&&Ie.__e(e,t.__v))};var kc=typeof requestAnimationFrame=="function";function qy(i){var e,t=o(function(){clearTimeout(r),kc&&cancelAnimationFrame(e),setTimeout(i)},"r"),r=setTimeout(t,35);kc&&(e=requestAnimationFrame(t))}o(qy,"w");function bo(i){var e=Ue,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),Ue=e}o(bo,"z");function na(i){var e=Ue;i.__c=i.__(),Ue=e}o(na,"B");function aa(i,e){return!i||i.length!==e.length||e.some(function(t,r){return t!==i[r]})}o(aa,"C");function Ac(i,e){return typeof e=="function"?e(i):e}o(Ac,"D");var $y={position:"relative",width:"100%",minHeight:"100%"},Vy={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"};function or({data:i,rowHeight:e,renderRow:t,overscanCount:r=10,padding:s=4,...n}){let a=et(null),[l,c]=ot(0),[p,h]=ot(0);He(()=>{function R(){a.current!=null&&p!==a.current.offsetHeight&&h(a.current.offsetHeight)}return o(R,"resize"),R(),window.addEventListener("resize",R),()=>{window.removeEventListener("resize",R)}},[p]);let g=xt(()=>{a.current&&c(a.current.scrollTop)},[]),y=Math.floor(l/e),S=Math.floor(p/e);r&&(y=Math.max(0,y-y%r),S+=r);let P=y+S+s,F=i.slice(y,P),D={...$y,height:i.length*e},q={...Vy,top:y*e};return u("div",{onScroll:g,ref:a,...n,children:u("div",{role:"presentation",style:D,children:u("div",{role:"presentation",style:q,children:F.map(t)})})})}o(or,"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 oi([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 Ut=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 Uc={debug:o(()=>{},"debug"),warn:o(()=>{},"warn"),error:o((...i)=>console.error(`[Uppy] [${xi()}]`,...i),"error")},So={debug:o((...i)=>console.debug(`[Uppy] [${xi()}]`,...i),"debug"),warn:o((...i)=>console.warn(`[Uppy] [${xi()}]`,...i),"warn"),error:o((...i)=>console.error(`[Uppy] [${xi()}]`,...i),"error")};var la=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];function tt(i,e){if(typeof i!="number"||Number.isNaN(i))throw new TypeError(`Expected a number, got ${typeof i}`);let t=i<0,r=Math.abs(i);if(t&&(r=-r),r===0)return"0 B";let s=e?la.indexOf(e):Math.min(Math.floor(Math.log(r)/Math.log(1024)),la.length-1),n=Number(r/1024**s),a=la[s];return s>=3?n%1===0?`${Math.round(n)} ${a}`:`${n.toFixed(2)} ${a}`:`${n>=10||n%1===0?Math.round(n):n.toFixed(1)} ${a}`}o(tt,"prettierBytes");var Lc=he(Mc(),1);var Bc={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]},pt=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},xo=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 pt(`${this.getI18n()("youCanOnlyUploadX",{smart_count:s})}`);if(r){let n=[...e,...t].reduce((a,l)=>a+(l.size??0),0);if(n>r)throw new pt(this.getI18n()("aggregateExceedsSize",{sizeAllowed:tt(r),size:tt(n)}))}}validateSingleFile(e){let{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(a=>a.includes("/")?e.type?(0,Lc.default)(e.type.replace(/;.*?$/,""),a):!1:a[0]==="."&&e.extension?e.extension.toLowerCase()===a.slice(1).toLowerCase():!1)){let a=s.join(", ");throw new pt(this.getI18n()("youCanOnlyUploadFileTypes",{types:a}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new pt(this.getI18n()("exceedsSize",{size:tt(t),file:e.name??this.getI18n()("unnamed")}),{file:e});if(r&&e.size!=null&&e.size<r)throw new pt(this.getI18n()("inferiorSize",{size:tt(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 pt(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){let t=new pt(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 Xy(i){let e=null,t;return(...r)=>(t=r,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e)}o(Xy,"debounce");var ua=class i extends Pe{static{o(this,"UIPlugin")}#e;isTargetDOMEl;el=null;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=Hr(e);if(s){this.isTargetDOMEl=!0;let l=document.createElement("div");return l.classList.add("uppy-Root"),this.#e=Xy(c=>{this.uppy.getPlugin(this.id)&&(vo(this.render(c,l),l),this.afterUpdate())}),this.uppy.log(`Installing ${r} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(s.innerHTML=""),vo(this.render(this.uppy.getState(),l),l),this.el=l,s.appendChild(l),l.dir=this.opts.direction||$r(l)||"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(){}},ae=ua;var Sp=he(Po(),1),xp=he(bp(),1);var zv="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Ot=o((i=21)=>{let e="",t=i|0;for(;t--;)e+=zv[Math.random()*64|0];return e},"nanoid");var It={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 Dropbox, Google Drive, S3 and more :dog:",version:"6.0.1",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 && sass --load-path=../../ src/provider-views/style.scss dist/provider-views.css && postcss dist/style.css -u cssnano -o dist/style.min.css && postcss dist/provider-views.css -u cssnano -o dist/provider-views.min.css",typecheck:"tsc --build",test:"vitest run --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","./store-default":"./lib/store/index.js","./utils":"./lib/utils/index.js","./utils/preact":"./lib/utils/preact/index.js","./utils/preact/hooks":"./lib/utils/preact/hooks.js","./companion-client":"./lib/companion-client/index.js","./provider-views":"./lib/provider-views/index.js","./provider-views/css/style.min.css":"./dist/provider-views.min.css","./provider-views/css/style.css":"./dist/provider-views.css","./provider-views/css/style.scss":"./src/provider-views/style.scss","./package.json":"./package.json"},dependencies:{"@transloadit/prettier-bytes":"^2.0.0",classnames:"^2.5.1",lodash:"^4.18.1","mime-match":"^1.0.2","namespace-emitter":"^2.0.1",nanoid:"^5.1.11","p-queue":"^9.3.3","p-retry":"^6.1.0",preact:"^10.29.2"},devDependencies:{"@types/deep-freeze":"^0","@types/gapi":"^0.0.47","@types/google.accounts":"^0.0.18","@types/google.picker":"^0.0.52","@types/lodash":"^4.17.25","@types/mime-match":"^1.0.0","@types/namespace-emitter":"^2.0.0","@types/node":"^22.20.1","@vitest/browser-playwright":"^4.1.6",cssnano:"^8.0.1","deep-freeze":"^0.0.1",playwright:"1.61.1",postcss:"^8.5.23","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^6.0.3",vite:"^8.2.2",vitest:"^4.1.6"}};function ha(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}o(ha,"getFileName");var wp={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};var fa=class{static{o(this,"DefaultStore")}static VERSION=It.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)})}},ma=fa;function ga(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(ga,"supportsUploadProgress");var To={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},ya=class i{static{o(this,"Uppy")}static VERSION=It.version;#e=Object.create(null);#t;#i;#r=(0,xp.default)();#s=new Set;#o=new Set;#n=new Set;defaultLocale;locale;opts;store;i18n;i18nArray;scheduledAutoProceed=null;wasOffline=!1;constructor(e){this.defaultLocale=wp;let t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:Bc,meta:{},onBeforeFileAdded:o((s,n)=>!Object.hasOwn(n,s.id),"onBeforeFileAdded"),onBeforeUpload:o(s=>s,"onBeforeUpload"),store:new ma,logger:Uc,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=So),this.log(`Using Core v${i.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...To,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:ga(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),this.#t=new xo(()=>this.opts,()=>this.i18n),this.#i=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.#r.emit(e,...t)}on(e,t){return this.#r.on(e,t),this}once(e,t){return this.#r.once(e,t),this}off(e,t){return this.#r.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 oi([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,s3Multipart:void 0}}),this.setState({files:r,...To})}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({...To,files:{}})}addPreProcessor(e){this.#s.add(e)}removePreProcessor(e){return this.#s.delete(e)}addPostProcessor(e){this.#n.add(e)}removePostProcessor(e){return this.#n.delete(e)}addUploader(e){this.#o.add(e)}removeUploader(e){return this.#o.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=[],l=[],c=[],p=[],h=[],g=[],y=[],S=[];for(let P of s){let{progress:F}=P;!F.uploadComplete&&F.uploadStarted&&(n.push(P),P.isPaused||y.push(P)),F.uploadStarted||a.push(P),(F.uploadStarted||F.preprocess||F.postprocess)&&l.push(P),F.uploadStarted&&c.push(P),P.isPaused&&p.push(P),F.uploadComplete&&h.push(P),P.error&&g.push(P),(F.preprocess||F.postprocess)&&S.push(P)}return{newFiles:a,startedFiles:l,uploadStartedFiles:c,pausedFiles:p,completeFiles:h,erroredFiles:g,inProgressFiles:n,inProgressNotPausedFiles:y,processingFiles:S,isUploadStarted:c.length>0,isAllComplete:t===100&&h.length===s.length&&S.length===0,isAllErrored:!!r&&g.length===s.length,isAllPaused:n.length!==0&&p.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:s.some(P=>P.isGhost)}}#a(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:l=""})=>{this.info({message:a,details:l},"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}#u(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)}#l(e){let t=!0;for(let r of Object.values(e))this.#u(r)||(t=!1);return t}#c(e){let{allowNewUpload:t}=this.getState();if(t===!1){let r=new pt(this.i18n("noMoreFilesAllowed"),{file:e});throw this.#a([r]),r}}checkIfFileAlreadyExists(e){let{files:t}=this.getState();return!!(t[e]&&!t[e].isGhost)}#p(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=Qi(t),s=ha(r,t),n=Tt(s).extension,a=qr(t,this.getID()),l={...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,...l},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}}#h(){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))}#d(e){let{files:t}=this.getState(),r={...t},s=[],n=[];for(let a of e)try{let l=this.#p(a);this.#c(l);let c=t[l.id],p=c?.isGhost;if(p&&!l.isRemote){if(l.data==null)throw new Error("File data is missing");l={...c,isGhost:!1,data:l.data},this.log(`Replaced the blob in the restored ghost file: ${l.name}, ${l.id}`)}let h=this.opts.onBeforeFileAdded(l,r);if(t=this.getState().files,r={...t,...r},!h&&this.checkIfFileAlreadyExists(l.id))throw new pt(this.i18n("noDuplicates",{fileName:l.name??this.i18n("unnamed")}),{file:l});if(h===!1&&!p)throw new pt("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:l});typeof h=="object"&&h!==null&&(l=h),this.#t.validateSingleFile(l),r[l.id]=l,s.push(l)}catch(l){n.push(l)}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.#d([e]),n=s.filter(l=>l.isRestriction);if(this.#a(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.#h(),a.id}addFiles(e){let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#d(e),n=s.filter(l=>l.isRestriction);this.#a(n);let a=s.filter(l=>!l.isRestriction);if(a.length>0){let l=`Multiple errors occurred while adding files:
`;if(a.forEach(c=>{l+=`
* ${c.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:a.length}),details:l},"error",this.opts.infoTimeout),typeof AggregateError=="function")throw new AggregateError(a,l);{let c=new Error(l);throw c.errors=a,c}}this.setState({files:t}),r.forEach(l=>{this.emit("file-added",l)}),this.emit("files-added",r),r.length>5?this.log(`Added batch of ${r.length} files`):Object.values(r).forEach(l=>{this.log(`Added file: ${l.name}
id: ${l.id}
type: ${l.type}`)}),r.length>0&&this.#h()}removeFiles(e){let{files:t,currentUploads:r}=this.getState(),s={...t},n={...r},a=Object.create(null);e.forEach(h=>{t[h]&&(a[h]=t[h],delete s[h])});function l(h){return a[h]===void 0}o(l,"fileIsNotRemoved"),Object.keys(n).forEach(h=>{let g=r[h].fileIDs.filter(l);if(g.length===0){delete n[h];return}let{capabilities:y}=this.getState();if(g.length!==r[h].fileIDs.length&&!y.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");n[h]={...r[h],fileIDs:g}});let c={currentUploads:n,files:s};Object.keys(s).length===0&&(c.allowNewUpload=!0,c.error=null,c.recoveredState=null),this.setState(c),this.#b();let p=Object.keys(a);p.forEach(h=>{this.emit("file-removed",a[h])}),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")}#y(){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#f(){let e=this.#y(),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.#x(e,{forceAllowNewUpload:!0});return this.#E(r)}async retryAll(){let e=await this.#f();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(To)}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(e));let t=this.#x([e],{forceAllowNewUpload:!0});return this.#E(t)}logout(){this.iteratePlugins(e=>{e.provider?.logout?.()})}#g=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.#b()},"#handleUploadProgress");#m(){let e=this.#w(),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})}#b=(0,Sp.default)(()=>this.#m(),500,{leading:!0,trailing:!0});[Symbol.for("uppy test: updateTotalProgress")](){return this.#m()}#w(){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),l=s.reduce((c,p)=>c+(p.progress.bytesUploaded||0),0);return a===0?0:l/a}#S(){let e=o((s,n,a)=>{let l=s.message||"Unknown error";s.details&&(l+=` ${s.details}`),this.setState({error:l}),n!=null&&n.id in this.getState().files&&this.setFileState(n.id,{error:l,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 l=new Error(this.i18n("failedToUpload",{file:s?.name??""}));l.isUserFacing=!0,l.details=n.message,n.details&&(l.details+=` ${n.details}`),this.#a([l])}else this.#a([n])});let t=null;this.on("upload-stalled",(s,n)=>{let{message:a}=s,l=n.map(c=>c.meta.name).join(", ");t||(this.info({message:a,details:l},"warning",this.opts.infoTimeout),t=setTimeout(()=>{t=null},this.opts.infoTimeout)),this.log(`${a} ${l}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});let r=o(s=>{let n=s.filter(l=>{let c=l!=null&&this.getFile(l.id);return c||this.log(`Not setting progress for a file that has been removed: ${l?.id}`),c}),a=Object.fromEntries(n.map(l=>[l.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:l.size}}]));this.patchFilesState(a)},"onUploadStarted");this.on("upload-start",r),this.on("upload-progress",this.#g),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,l=this.#n.size>0;this.setFileState(s.id,{progress:{...a,postprocess:l?{mode:"indeterminate"}:void 0,uploadComplete:!0,...!l&&{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.#b()}),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,...l}=n.progress;this.patchFilesState({[n.id]:{progress:{...l,complete:!0}}})}),this.on("restored",()=>{this.#b()}),this.on("dashboard:file-edit-complete",s=>{s&&this.#u(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.#i(),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}}#_=new Map;registerRequestClient(e,t){this.#_.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.#_.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.#E(e);return this.emit("complete",t),t}#x(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=Ot();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.#x(...e)}#T(e){let{currentUploads:t}=this.getState();return t[e]}addResultData(e,t){if(!this.#T(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}})}#C(e){let{[e]:t,...r}=this.getState().currentUploads;this.setState({currentUploads:r})}async#E(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.#o,...this.#n];try{for(let a=r.step||0;a<s.length;a++){let l=s[a];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...r,step:a}}});let{fileIDs:c}=r;if(await l(c,e),r=t(),!r)break}}catch(a){throw this.#C(e),a}if(r){r.fileIDs.forEach(p=>{let h=this.getFile(p);h?.progress.postprocess&&this.emit("postprocess-complete",h)});let a=r.fileIDs.map(p=>this.getFile(p)),l=a.filter(p=>!p.error),c=a.filter(p=>p.error);this.addResultData(e,{successful:l,failed:c,uploadID:e}),r=t()}let n;return r&&(n=r.result,this.#C(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.#y().length>0){let s=await this.#f();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.#l(e))throw new pt(this.i18n("missingRequiredMetaField"));let{currentUploads:s}=this.getState(),n=Object.values(s).flatMap(p=>p.fileIDs),a=Object.keys(e).filter(p=>{let h=this.getFile(p);return h&&!h.progress.uploadStarted&&!n.includes(p)}),l=this.#x(a),c=await this.#E(l);return this.emit("complete",c),c}catch(s){throw this.#a([s]),s}}},va=ya;var Mp={};jn(Mp,{InvalidTokenError:()=>Ei,Provider:()=>Ke,RequestClient:()=>nt,SearchProvider:()=>Ti,createGooglePickerController:()=>Fo,createGooglePickerStoreAdapter:()=>Co,getAllowedHosts:()=>Xe,tokenStorage:()=>Re});function qv(i){return i.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}o(qv,"escapeRegex");function $v(i){if(typeof i=="string")return new RegExp(i);if(i instanceof RegExp)return i}o($v,"wrapInRegex");function Xe(i,e){if(i){let r=o(s=>{if(!(typeof s=="string"&&$v(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=qv(t),t}o(Xe,"getAllowedHosts");var ko=o(i=>({authorization:`Bearer ${i}`}),"getAuthHeader"),_p=new Set,Ep=!1;async function Pp(i){_p.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)}),_p.add(i))}o(Pp,"injectScript");async function Vv(i){await Promise.all([Pp("https://accounts.google.com/gsi/client"),(async()=>{await Pp("https://apis.google.com/js/api.js"),i==="drive"&&!Ep&&(await new Promise(e=>gapi.load("client:picker",()=>e())),await gapi.client.load("https://www.googleapis.com/discovery/v1/apis/drive/v3/rest"),Ep=!0)})()])}o(Vv,"ensureScriptsInjected");async function Wv(i,e){return!!(await fetch(`https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=${encodeURIComponent(i)}`,{signal:e})).ok}o(Wv,"isTokenValid");async function Tp({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"],l=google.accounts.oauth2.initTokenClient({client_id:e,scope:a.join(" "),callback:s,error_callback:n});t===null?l.requestAccessToken({prompt:"consent"}):l.requestAccessToken({prompt:""})});if(r.error)throw new Error(`OAuth2 error: ${r.error}`);return r.access_token}o(Tp,"authorize");async function Gv(i){await new Promise(e=>google.accounts.oauth2.revoke(i,e))}o(Gv,"doLogout");var Ei=class extends Error{static{o(this,"InvalidTokenError")}constructor(){super("Invalid or expired token"),this.name="InvalidTokenError"}};async function kp({doc:i,token:e,signal:t}){if(i.mimeType==="application/vnd.google-apps.shortcut")return i.shortcutDetails?.targetMimeType==="application/vnd.google-apps.folder"?[]:[{platform:"drive",id:i.id,name:i.name,mimeType:i.mimeType}];if(i.mimeType!=="application/vnd.google-apps.folder")return[{platform:"drive",id:i.id,name:i.name,mimeType:i.mimeType}];let r=ko(e),s=[],n;do{let a=new URLSearchParams({q:`'${i.id.replace(/'/g,"\\'")}' in parents and trashed = false`,fields:"nextPageToken, files(id, name, mimeType, shortcutDetails(targetMimeType))",includeItemsFromAllDrives:"true",supportsAllDrives:"true",pageSize:"1000",...n&&{pageToken:n}}),l=await fetch(`https://www.googleapis.com/drive/v3/files?${a.toString()}`,{headers:r,signal:t});if(!l.ok)throw new Error(`Failed to list folder contents for '${i.name}' (${i.id}): ${l.status} ${l.statusText}`);let c=await l.json();n=c.nextPageToken;for(let p of c.files)s.push(...await kp({doc:p,token:e,signal:t}))}while(n);return s}o(kp,"handleDocObjectRecursively");async function Xv({token:i,apiKey:e,appId:t,onFilesPicked:r,signal:s,onLoadingChange:n,onError:a}){if(!await Wv(i,s))throw new Ei;let l=o(async p=>{if(p.action===google.picker.Action.PICKED)try{n(!0);let h=[];for(let g of p.docs??[])h.push(...await kp({doc:g,token:i,signal:s}));r(h,i)}catch(h){a(h)}finally{n(!1)}},"onPicked"),c=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(l).build();c.setVisible(!0),s?.addEventListener("abort",()=>c.dispose())}o(Xv,"showDrivePicker");async function Kv({token:i,pickingSession:e,onPickingSessionChange:t,signal:r}){let s=ko(i),n=e;if(n==null){let l=await fetch("https://photospicker.googleapis.com/v1/sessions",{method:"post",headers:s,signal:r});if(l.status===401&&(await l.json()).error?.status==="UNAUTHENTICATED")throw new Ei;if(!l.ok)throw new Error("Failed to create a session");n=await l.json(),t(n)}let a=window.open(n.pickerUri);r?.addEventListener("abort",()=>a?.close())}o(Kv,"showPhotosPicker");async function Yv({accessToken:i,pickingSession:e,signal:t}){let r=ko(i),s,n=[];do{let l=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(!l.ok)throw new Error("Failed to get a media items");let{mediaItems:c,nextPageToken:p}=await l.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:l,type:c,mediaFile:{mimeType:p,filename:h,baseUrl:g}}=a;return{platform:"photos",id:l,mimeType:p,url:c==="VIDEO"?`${g}=dv`:`${g}=d`,name:h,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(Yv,"resolvePickedPhotos");async function Jv({getPickingSession:i,getAccessToken:e,onPickingSessionClear:t,signal:r,onFilesPicked:s,onError:n}){for(let a=1;;)try{r.throwIfAborted();let l=i();l!=null?a=parseFloat(l.pollingConfig.pollInterval):a=1,await new Promise((p,h)=>{setTimeout(()=>{r.removeEventListener("abort",h),p()},a*1e3),r.addEventListener("abort",h,{once:!0})});let c=e();if(l=i(),l!=null&&c!=null){let p=ko(c),h=await fetch(`https://photospicker.googleapis.com/v1/sessions/${encodeURIComponent(l.id)}`,{headers:p,signal:r});if(!h.ok)throw new Error("Failed to get session");if((await h.json()).mediaItemsSet){let y=await Yv({accessToken:c,pickingSession:l,signal:r});t(),s(y,c)}l.pollingConfig.timeoutIn==="0s"&&t()}}catch(l){if(l instanceof Error&&l.name==="AbortError")return;n(l)}}o(Jv,"pollPickingSession");var Qv=o(({requestClientId:i,accessToken:e,companionUrl:t},{id:r,mimeType:s,name:n,platform:a,...l})=>({name:n,type:s,data:{size:null},isRemote:!0,remote:{companionUrl:t,url:`${t}/google-picker/get`,body:{fileId:r,accessToken:e,platform:a,..."url"in l&&{url:l.url}},requestClientId:i},..."metadata"in l&&{meta:l.metadata}}),"mapPickerFile");function Co({uppy:i,getPluginState:e,setPluginState:t}){return{getSnapshot:o(()=>e(),"getSnapshot"),setState:o(r=>{let s=typeof r=="function"?r(e()):r;t(s)},"setState"),subscribe:o(r=>{let s=o((n,a,l)=>{let c=l?.plugins?.GoogleDrivePicker??l?.plugins?.GooglePhotosPicker;c&&r(c)},"onStateUpdate");return i.on("state-update",s),()=>i.off("state-update",s)},"subscribe")}}o(Co,"createGooglePickerStoreAdapter");function Fo({uppy:i,store:e,storage:t=Re,pickerType:r,companionUrl:s,requestClientId:n=r==="drive"?"GoogleDrivePicker":"GooglePhotosPicker",clientId:a,apiKey:l,appId:c}){let p=`uppy:google-${r}-picker:accessToken`,h=new AbortController,g,y,S=o(async(j,W)=>{i.addFiles(j.map(B=>Qv({requestClientId:n,accessToken:W,companionUrl:s},B)))},"handleFilesPicked");function P(j){return e.setState(W=>({...W,accessToken:j})),j==null?t.removeItem(p):t.setItem(p,j)}o(P,"setAccessToken");function F(j){e.setState(W=>({...W,loading:j}))}o(F,"setLoading");async function D(){g==null&&(g=(async()=>{h=new AbortController,P(await t.getItem(p)),h.signal.throwIfAborted(),r==="photos"&&Jv({getPickingSession:o(()=>y,"getPickingSession"),getAccessToken:o(()=>e.getSnapshot().accessToken,"getAccessToken"),onPickingSessionClear:o(()=>{y=void 0},"onPickingSessionClear"),signal:h.signal,onFilesPicked:S,onError:o(j=>i.log(j),"onError")})})()),await g}o(D,"init");async function q(){await D();let j=e.getSnapshot().accessToken,W=o(async B=>{if(r==="drive"){if(l==null||c==null)throw new TypeError("apiKey and appId are required for Google Drive picker");await Xv({token:B,apiKey:l,appId:c,onFilesPicked:S,signal:h.signal,onLoadingChange:o(Q=>F(Q),"onLoadingChange"),onError:o(Q=>{i.log(Q),i.info(i.i18n("failedToAddFiles"),"error")},"onError")})}else await Kv({token:B,pickingSession:y,onPickingSessionChange:o(K=>{y=K},"onPickingSessionChange"),signal:h.signal})},"doShowPicker");F(!0);try{try{if(await Vv(r),j==null&&(j=await Tp({clientId:a,pickerType:r})),j==null)throw new Error;await W(j),P(j)}catch(B){if(B instanceof Ei)i.log("Token is invalid or expired, reauthenticating"),j=await Tp({pickerType:r,accessToken:j,clientId:a}),await W(j),P(j);else throw B}}catch(B){B instanceof Error&&"type"in B&&B.type==="popup_closed"||(P(null),i.log(B))}finally{F(!1)}}o(q,"showPicker");async function R(){let{accessToken:j}=e.getSnapshot();j&&(await Gv(j),P(null),y=void 0)}o(R,"logout");function C(){h.abort(),y=void 0,g=void 0,e.setState(j=>({...j,accessToken:void 0,loading:!1}))}return o(C,"reset"),{init:D,show:q,reset:C,logout:R}}o(Fo,"createGooglePickerController");var Ip=he(Up(),1);var eb=Object.prototype.toString,tb=o(i=>eb.call(i)==="[object Error]","isError"),ib=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 ba(i){return i&&tb(i)&&i.name==="TypeError"&&typeof i.message=="string"?i.message==="Load failed"?i.stack===void 0:ib.has(i.message):!1}o(ba,"isNetworkError");var nr=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}},Op=o((i,e,t)=>{let r=t.retries-(e-1);return i.attemptNumber=e,i.retriesLeft=r,i},"decorateErrorWithCounts");async function Ro(i,e){return new Promise((t,r)=>{e={onFailedAttempt(){},retries:10,shouldRetry:o(()=>!0,"shouldRetry"),...e};let s=Ip.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 l=>{try{let c=await i(l);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 nr)throw c.originalError;if(c instanceof TypeError&&!ba(c))throw c;if(Op(c,l,e),await e.shouldRetry(c)||(s.stop(),r(c)),await e.onFailedAttempt(c),!s.retry(c))throw s.mainError()}catch(p){Op(p,l,e),a(),r(p)}}})})}o(Ro,"pRetry");var wa=class extends Error{static{o(this,"AuthError")}isAuthError;constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}},Dp=wa;function rb(i){return i.replace(/\/$/,"")}o(rb,"stripSlash");var Np=10,sb=300*1e3,xa=401,Sa=class extends Error{static{o(this,"HttpError")}statusCode;constructor({statusCode:e,message:t}){super(t),this.name="HttpError",this.statusCode=e}};async function ob(i){if(i.status===xa)throw new Dp;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 Jn(t.message):new Sa({statusCode:i.status,message:e})}o(ob,"handleJSONResponse");function nb(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(nb,"emitSocketProgress");var nt=class{static{o(this,"RequestClient")}static VERSION=It.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 rb(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),l=await ri(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(l),await ob(l)}catch(a){throw a.isAuthError||a.name==="UserFacingApiError"||a.name==="AbortError"?a:new bi(`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||{},a=n();return await Ro(async()=>a.wrapPromiseFunction(async()=>{let c=this.uppy.getFile(e.id);if(c==null)return;let p=c.serverToken;if(p!=null)this.uppy.log(`Connecting to exiting websocket ${p}`);else{if(p=await this.#r({file:c,postBody:t,signal:s}),!this.uppy.getFile(e.id))return;this.uppy.setFileState(e.id,{serverToken:p})}let h=this.uppy.getFile(e.id);if(h!=null)return this.#s({file:h,signal:s})})().abortOn(s),{retries:Np,signal:s,onFailedAttempt:o(l=>this.uppy.log(`Retrying upload due to: ${l.message}`,"warning"),"onFailedAttempt")})}catch(s){if(s.name==="AbortError")return;throw this.uppy.emit("upload-error",e,s),s}}#i=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");#r=o(async({file:e,postBody:t,signal:r})=>{try{return await this.#i({file:e,postBody:t,signal:r})}catch(s){if(s.isAuthError)throw new nr(s);if(s.cause==null)throw s;let n=s.cause,a=o(()=>[408,409,429,418,423].includes(n.statusCode)||n.statusCode>=500&&n.statusCode<=599&&![501,505].includes(n.statusCode),"isRetryableHttpError");throw n.name==="HttpError"&&!a()?new nr(n):n}},"#requestSocketTokenWithRetryStrategy");async#s({file:e,signal:t}){let r,{capabilities:s}=this.uppy.getState();try{return await new Promise((n,a)=>{let l=e.serverToken,c=Zi(e.remote.companionUrl),p,h,g,{isPaused:y}=e,S=o((B,Q)=>{if(p==null||p.readyState!==p.OPEN){this.uppy.log(`Cannot send "${B}" to socket ${e.id} because the socket state was ${String(p?.readyState)}`,"warning");return}p.send(JSON.stringify({action:B,payload:Q??{}}))},"socketSend");function P(){s.resumableUploads&&S(y?"pause":"resume")}o(P,"sendState");let F=o(async()=>{h&&h.abort(),h=new AbortController;let B=o(K=>{this.uppy.setFileState(e.id,{serverToken:null}),h?.abort?.(),a(K)},"onFatalError");function Q(){clearTimeout(g),!y&&(g=setTimeout(()=>{B(new Error("Timeout waiting for message from Companion socket"))},sb))}o(Q,"resetActivityTimeout");try{await Ro(o(async()=>new Promise((ee,ne)=>{p=new WebSocket(`${c}/api/${l}`),Q(),p.addEventListener("close",()=>{p=void 0,ne(new Error("Socket closed unexpectedly"))}),p.addEventListener("error",Fe=>{this.uppy.log(`Companion socket error ${JSON.stringify(Fe)}, closing socket`,"warning"),p?.close()}),p.addEventListener("open",()=>{P()}),p.addEventListener("message",Fe=>{Q();try{let{action:be,payload:fe}=JSON.parse(Fe.data);switch(be){case"progress":{nb(this,fe,this.uppy.getFile(e.id));break}case"success":{let _e=fe.response?.responseText;this.uppy.emit("upload-success",this.uppy.getFile(e.id),{uploadURL:fe.url,status:fe.response?.status??200,body:_e?JSON.parse(_e):void 0}),h?.abort?.(),n();break}case"error":{let{message:_e}=fe.error;throw Object.assign(new Error(_e),{cause:fe.error})}default:this.uppy.log(`Companion socket unknown action ${be}`,"warning")}}catch(be){B(be)}});let le=o(()=>{this.uppy.log(`Closing socket ${e.id}`),clearTimeout(g),p&&p.close(),p=void 0},"closeSocket");h.signal.addEventListener("abort",()=>{le()})}),"reconnectWebsocket"),{retries:Np,signal:h.signal,onFailedAttempt:o(()=>{h.signal.aborted||this.uppy.log(`Retrying websocket ${e.id}`)},"onFailedAttempt")})}catch(K){if(h.signal.aborted)return;B(K)}},"createWebsocket"),D=o(B=>{s.resumableUploads&&(y=B,p&&P())},"pause"),q=o(B=>{s.individualCancellation&&B.id===e.id&&(S("cancel"),h?.abort?.(),this.uppy.log(`upload ${e.id} was removed`),n())},"onFileRemove"),R=o(()=>{S("cancel"),h?.abort?.(),this.uppy.log(`upload ${e.id} was canceled`),n()},"onCancelAll"),C=o((B,Q)=>{B?.id===e.id&&D(Q)},"onFilePausedChange"),j=o(()=>D(!0),"onPauseAll"),W=o(()=>D(!1),"onResumeAll");this.uppy.on("file-removed",q),this.uppy.on("cancel-all",R),this.uppy.on("upload-pause",C),this.uppy.on("pause-all",j),this.uppy.on("resume-all",W),r=o(()=>{this.uppy.off("file-removed",q),this.uppy.off("cancel-all",R),this.uppy.off("upload-pause",C),this.uppy.off("pause-all",j),this.uppy.off("resume-all",W)},"removeEventHandlers"),t.addEventListener("abort",()=>{h?.abort()}),F()})}finally{r?.()}}};var ab=o(i=>i.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),"getName");function lb(){return location.origin}o(lb,"getOrigin");var Ke=class extends nt{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=t.name||ab(this.id),this.pluginId=t.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.#i(),s=t.getPluginState().authenticated?e.status!==xa:e.status<400;return t.setPluginState({authenticated:s}),e}async setAuthToken(e){return this.#i().storage.setItem(this.tokenKey,e)}async#t(){return this.#i().storage.getItem(this.tokenKey)}async removeAuthToken(){return this.#i().storage.removeItem(this.tokenKey)}#i(){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,authCallbackToken:r}){let s=new URLSearchParams({...t,state:btoa(JSON.stringify({origin:lb()})),...this.authQuery({authFormData:e})});return this.preAuthToken&&s.set("uppyPreAuthToken",this.preAuthToken),r&&s.set("authCallbackToken",r),`${this.hostname}/${this.id}/connect?${s}`}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=crypto.randomUUID(),n=this.authUrl({query:{uppyVersions:e},authFormData:t,authCallbackToken:s}),a=window.open(n,"_blank"),l,c;try{let p=Zi(this.opts.companionUrl),h=await new Promise((g,y)=>{c=new WebSocket(`${p}/api2/auth-callback/token/${s}`),c.addEventListener("close",()=>{y(new Error("Socket closed"))}),c.addEventListener("error",S=>{this.uppy.log(`Companion socket error ${JSON.stringify(S)}, closing socket`,"warning"),c?.close()}),c.addEventListener("message",S=>{try{let{token:P,error:F}=JSON.parse(S.data);F?y(new Error("Authentication reported error")):P?g(P):y(new Error("Authentication did not return a token"))}catch(P){y(P)}}),r.addEventListener("abort",()=>y(new Error("Authentication was aborted"))),a&&(l=window.setInterval(()=>{a.closed&&y(new Error("Auth window was closed by the user"))},500))});this.setAuthToken(h)}catch(p){let h=this.uppy.i18n("authAborted");throw this.uppy.info({message:h},"warning",5e3),this.uppy.log(`Authentication failed: ${p.message}`,"warning"),p}finally{setTimeout(()=>a?.close(),1),this.uppy.log(`Closing auth callback socket ${s}`),c?.close(),clearInterval(l)}}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 ub=o(i=>i.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),"getName"),Ti=class extends nt{static{o(this,"SearchProvider")}provider;id;name;pluginId;constructor(e,t){super(e,t),this.provider=t.provider,this.id=this.provider,this.name=t.name||ub(this.id),this.pluginId=t.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 Re={};jn(Re,{getItem:()=>pb,removeItem:()=>db,setItem:()=>cb});async function cb(i,e){localStorage.setItem(i,e)}o(cb,"setItem");async function pb(i){return localStorage.getItem(i)}o(pb,"getItem");async function db(i){localStorage.removeItem(i)}o(db,"removeItem");var Na={};jn(Na,{FilterInput:()=>lr,GoogleDriveIcon:()=>cr,GooglePhotosIcon:()=>ur,GooglePickerView:()=>ki,ProviderViews:()=>We,SearchProviderViews:()=>li,SearchView:()=>zo,defaultPickerIcon:()=>dr,useSearchForm:()=>ar});function ar(i){let e=xt(r=>{r.preventDefault(),i()},[i]),[t]=ot(()=>{let r=document.createElement("form");return r.setAttribute("tabindex","-1"),r.id=Ot(),r});return He(()=>(document.body.appendChild(t),t.addEventListener("submit",e),()=>{t.removeEventListener("submit",e),document.body.removeChild(t)}),[t,e]),{formId:t.id}}o(ar,"useSearchForm");function hb({value:i,onChange:e,onSubmit:t,inputLabel:r,i18n:s}){let{formId:n}=ar(t);return u("section",{className:"uppy-ProviderBrowser-searchFilter",children:[u("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}),u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-ProviderBrowser-searchFilterIcon",width:"12",height:"12",viewBox:"0 0 12 12",children:u("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&&u("button",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterReset",type:"button","aria-label":s("resetFilter"),onClick:o(()=>e(""),"onClick"),children:u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",viewBox:"0 0 19 19",children:u("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(hb,"FilterInput");var lr=hb;function mb(i,e){for(var t in e)i[t]=e[t];return i}o(mb,"g");function Lp(i,e){for(var t in i)if(t!=="__source"&&!(t in e))return!0;for(var r in e)if(r!=="__source"&&i[r]!==e[r])return!0;return!1}o(Lp,"E");function Gp(i,e){var t=e(),r=ot({t:{__:t,u:e}}),s=r[0].t,n=r[1];return Rc(function(){s.__=t,s.u=e,_a(s)&&n({t:s})},[i,t,e]),He(function(){return _a(s)&&n({t:s}),i(function(){_a(s)&&n({t:s})})},[i]),t}o(Gp,"C");function _a(i){try{return!((e=i.__)===(t=i.u())&&(e!==0||1/e==1/t)||e!=e&&t!=t)}catch{return!0}var e,t}o(_a,"R");function Bp(i,e){this.props=i,this.context=e}o(Bp,"M");(Bp.prototype=new de).isPureReactComponent=!0,Bp.prototype.shouldComponentUpdate=function(i,e){return Lp(this.props,i)||Lp(this.state,e)};var jp=ie.__b;ie.__b=function(i){i.type&&i.type.__f&&i.ref&&(i.props.ref=i.ref,i.ref=null),jp&&jp(i)};var kP=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var gb=ie.__e;ie.__e=function(i,e,t,r){if(i.then){for(var s,n=e;n=n.__;)if((s=n.__c)&&s.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k||[]),s.__c(i,e)}gb(i,e,t,r)};var zp=ie.unmount;function Xp(i,e,t){return i&&(i.__c&&i.__c.__H&&(i.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),i.__c.__H=null),(i=mb({},i)).__c!=null&&(i.__c.__P===t&&(i.__c.__P=e),i.__c.__e=!0,i.__c=null),i.__k=i.__k&&i.__k.map(function(r){return Xp(r,e,t)})),i}o(Xp,"V");function Kp(i,e,t){return i&&t&&(i.__v=null,i.__k=i.__k&&i.__k.map(function(r){return Kp(r,e,t)}),i.__c&&i.__c.__P===e&&(i.__e&&t.appendChild(i.__e),i.__c.__e=!0,i.__c.__P=t)),i}o(Kp,"W");function Ea(){this.__u=0,this.o=null,this.__b=null}o(Ea,"P");function Yp(i){var e=i.__&&i.__.__c;return e&&e.__a&&e.__a(i)}o(Yp,"j");function Ao(){this.i=null,this.l=null}o(Ao,"B");ie.unmount=function(i){var e=i.__c;e&&(e.__z=!0),e&&e.__R&&e.__R(),e&&32&i.__u&&(i.type=null),zp&&zp(i)},(Ea.prototype=new de).__c=function(i,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var s=Yp(r.__v),n=!1,a=o(function(){n||r.__z||(n=!0,t.__R=null,s?s(c):c())},"i");t.__R=a;var l=t.__P;t.__P=null;var c=o(function(){if(!--r.__u){if(r.state.__a){var p=r.state.__a;r.__v.__k[0]=Kp(p,p.__c.__P,p.__c.__O)}var h;for(r.setState({__a:r.__b=null});h=r.o.pop();)h.__P=l,h.forceUpdate()}},"c");r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),i.then(a,a)},Ea.prototype.componentWillUnmount=function(){this.o=[]},Ea.prototype.render=function(i,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Xp(this.__b,t,r.__O=r.__P)}this.__b=null}var s=e.__a&&Gt(Ee,null,i.fallback);return s&&(s.__u&=-33),[Gt(Ee,null,e.__a?null:i.children),s]};var Hp=o(function(i,e,t){if(++t[1]===t[0]&&i.l.delete(e),i.props.revealOrder&&(i.props.revealOrder[0]!=="t"||!i.l.size))for(t=i.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;i.i=t=t[2]}},"H");(Ao.prototype=new de).__a=function(i){var e=this,t=Yp(e.__v),r=e.l.get(i);return r[0]++,function(s){var n=o(function(){e.props.revealOrder?(r.push(s),Hp(e,i,r)):s()},"o");t?t(n):n()}},Ao.prototype.render=function(i){this.i=null,this.l=new Map;var e=ct(i.children);i.revealOrder&&i.revealOrder[0]==="b"&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return i.children},Ao.prototype.componentDidUpdate=Ao.prototype.componentDidMount=function(){var i=this;this.l.forEach(function(e,t){Hp(i,t,e)})};var yb=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,vb=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,bb=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,wb=/[A-Z0-9]/g,Sb=typeof document<"u",xb=o(function(i){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(i)},"X");de.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(i){Object.defineProperty(de.prototype,i,{configurable:!0,get:o(function(){return this["UNSAFE_"+i]},"get"),set:o(function(e){Object.defineProperty(this,i,{configurable:!0,writable:!0,value:e})},"set")})});var qp=ie.event;ie.event=function(i){return qp&&(i=qp(i)),i.persist=function(){},i.isPropagationStopped=function(){return this.cancelBubble},i.isDefaultPrevented=function(){return this.defaultPrevented},i.nativeEvent=i};var Jp,_b={configurable:!0,get:o(function(){return this.class},"get")},$p=ie.vnode;ie.vnode=function(i){typeof i.type=="string"&&(function(e){var t=e.props,r=e.type,s={},n=r.indexOf("-")==-1;for(var a in t){var l=t[a];if(!(a==="value"&&"defaultValue"in t&&l==null||Sb&&a==="children"&&r==="noscript"||a==="class"||a==="className")){var c=a.toLowerCase();a==="defaultValue"&&"value"in t&&t.value==null?a="value":a==="download"&&l===!0?l="":c==="translate"&&l==="no"?l=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?a="ondblclick":c!=="onchange"||r!=="input"&&r!=="textarea"||xb(t.type)?c==="onfocus"?a="onfocusin":c==="onblur"?a="onfocusout":bb.test(a)&&(a=c):c=a="oninput":n&&vb.test(a)?a=a.replace(wb,"-$&").toLowerCase():l===null&&(l=void 0),c==="oninput"&&s[a=c]&&(a="oninputCapture"),s[a]=l}}r=="select"&&(s.multiple&&Array.isArray(s.value)&&(s.value=ct(t.children).forEach(function(p){p.props.selected=s.value.indexOf(p.props.value)!=-1})),s.defaultValue!=null&&(s.value=ct(t.children).forEach(function(p){p.props.selected=s.multiple?s.defaultValue.indexOf(p.props.value)!=-1:s.defaultValue==p.props.value}))),t.class&&!t.className?(s.class=t.class,Object.defineProperty(s,"className",_b)):t.className&&(s.class=s.className=t.className),e.props=s})(i),i.$$typeof=yb,$p&&$p(i)};var Vp=ie.__r;ie.__r=function(i){Vp&&Vp(i),Jp=i.__c};var Wp=ie.diffed;ie.diffed=function(i){Wp&&Wp(i);var e=i.props,t=i.__e;t!=null&&i.type==="textarea"&&"value"in e&&e.value!==t.value&&(t.value=e.value==null?"":e.value),Jp=null};function Eb(){return u("svg",{width:"26",height:"26",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg",children:u("g",{fill:"none","fill-rule":"evenodd",children:[u("circle",{fill:"#FFF",cx:"13",cy:"13",r:"13"}),u("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"}),u("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"}),u("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"}),u("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"}),u("path",{d:"M4 4h18v18H4z"})]})})}o(Eb,"GoogleIcon");function Pb({pluginName:i,i18n:e,onAuth:t}){let r=i==="Google Drive",s=xt(n=>{n.preventDefault(),t()},[t]);return u("form",{onSubmit:s,children:r?u("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:[u(Eb,{}),e("signInWithGoogle")]}):u("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(Pb,"DefaultForm");var Tb=o(({pluginName:i,i18n:e,onAuth:t})=>u(Pb,{pluginName:i,i18n:e,onAuth:t}),"defaultRenderForm");function is({loading:i,pluginName:e,pluginIcon:t,i18n:r,handleAuth:s,renderForm:n=Tb}){return u("div",{className:"uppy-Provider-auth",children:[u("div",{className:"uppy-Provider-authIcon",children:t()}),u("div",{className:"uppy-Provider-authTitle",children:r("authenticateWithTitle",{pluginName:e})}),n({pluginName:e,i18n:r,loading:i,onAuth:s})]})}o(is,"AuthView");var ur=o(()=>u("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"-7 -7 73 73",children:u("g",{fill:"none","fill-rule":"evenodd",children:[u("path",{d:"M-3-3h64v64H-3z"}),u("g",{"fill-rule":"nonzero",children:[u("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"}),u("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"}),u("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"}),u("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"),cr=o(()=>u("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:u("g",{fillRule:"nonzero",fill:"none",children:[u("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"}),u("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"}),u("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"}),u("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"}),u("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"}),u("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 kb({uppy:i,requestClientId:e,companionUrl:t,pickerType:r,clientId:s,apiKey:n,appId:a,storage:l,store:c}){let{subscribe:p,getSnapshot:h}=c,{reset:g,init:y,...S}=kt(()=>Fo({uppy:i,requestClientId:e,companionUrl:t,pickerType:r,clientId:s,apiKey:n,appId:a,storage:l,store:c}),[i,e,s,t,r,n,a,l,c]);return He(()=>(y(),()=>{g()}),[g,y]),{...Gp(p,h),...S}}o(kb,"useGooglePicker");function ki({getPluginState:i,setPluginState:e,uppy:t,i18n:r,clientId:s,pickerType:n,apiKey:a,appId:l,storage:c,requestClientId:p,companionUrl:h}){let g=kt(()=>Co({uppy:t,getPluginState:i,setPluginState:e}),[t,i,e]),y=kb({uppy:t,requestClientId:p,companionUrl:h,pickerType:n,clientId:s,apiKey:a,appId:l,storage:c,store:g}),S=et(!1);return He(()=>{y.accessToken===void 0||S.current||(S.current=!0,y.show())},[y.show,y.accessToken]),y.loading?u("div",{children:[r("pleaseWait"),"..."]}):y.accessToken==null?u(is,{pluginName:r(n==="drive"?"pluginNameGoogleDrivePicker":"pluginNameGooglePhotosPicker"),pluginIcon:n==="drive"?cr:ur,handleAuth:y.show,i18n:r,loading:y.loading}):u("div",{style:{textAlign:"center"},children:[u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary",style:{display:"block",marginBottom:"1em"},disabled:y.loading,onClick:y.show,children:r(n==="drive"?"pickFiles":"pickPhotos")}),u("button",{type:"button",className:"uppy-u-reset uppy-c-btn",disabled:y.loading,onClick:y.logout,children:r("logOut")})]})}o(ki,"GooglePickerView");var vd=he(Ve(),1),bd=he(Eo(),1);var Qp=he(Ve(),1);function Cb(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:11,height:14.5,viewBox:"0 0 44 58",children:u("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(Cb,"FileIcon");function Fb(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",style:{minWidth:16,marginRight:3},viewBox:"0 0 276.157 276.157",children:u("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(Fb,"FolderIcon");function Rb(){return u("svg",{"aria-hidden":"true",focusable:"false",style:{width:16,marginRight:4},viewBox:"0 0 58 58",children:[u("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"}),u("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(Rb,"VideoIcon");function ai({itemIconString:i,alt:e=void 0}){if(i===null)return null;switch(i){case"file":return u(Cb,{});case"folder":return u(Fb,{});case"video":return u(Rb,{});default:return u("img",{src:i,alt:e,referrerPolicy:"no-referrer",loading:"lazy",width:16,height:16})}}o(ai,"ItemIcon");function Ab({file:i,toggleCheckbox:e,className:t,isDisabled:r,restrictionError:s,showTitles:n,children:a=null,i18n:l}){return u("li",{className:t,title:r&&s?s:void 0,children:[u("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}),u("label",{htmlFor:i.id,"aria-label":i.data.name??l("unnamed"),className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[u(ai,{itemIconString:i.data.thumbnail||i.data.icon}),n&&(i.data.name??l("unnamed")),a]})]})}o(Ab,"GridItem");var Pa=Ab;function Ta({file:i,openFolder:e,className:t,isDisabled:r,restrictionError:s,toggleCheckbox:n,showTitles:a,i18n:l}){return u("li",{className:t,title:i.status!=="checked"&&s?s:void 0,children:[u("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?l("allFilesFromFolderNamed",{name:i.data.name??l("unnamed")}):null,disabled:r,"data-uppy-super-focusable":!0}),i.data.isFolder?u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",onClick:o(()=>e(i.id),"onClick"),"aria-label":l("openFolderNamed",{name:i.data.name??l("unnamed")}),children:[u("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:u(ai,{itemIconString:i.data.icon})}),a&&i.data.name?u("span",{className:"uppy-truncate-text",children:i.data.name}):l("unnamed")]}):u("label",{htmlFor:i.id,className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[u("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:u(ai,{itemIconString:i.data.icon})}),a&&u("span",{className:"uppy-truncate-text",children:i.data.name??l("unnamed")})]})]})}o(Ta,"ListItem");function ka(i){let{viewType:e,toggleCheckbox:t,showTitles:r,i18n:s,openFolder:n,file:a,utmSource:l}=i,c=a.type==="folder"?null:a.restrictionError,p=!!c&&a.status!=="checked",h={file:a,openFolder:n,toggleCheckbox:t,utmSource:l,i18n:s,viewType:e,showTitles:r,className:(0,Qp.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 u(Pa,{...h});case"list":return u(Ta,{...h});case"unsplash":return u(Pa,{...h,children:u("a",{href:`${a.data.author.url}?utm_source=${l}&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(ka,"Item");function Ub(i){let{displayedPartialTree:e,viewType:t,toggleCheckbox:r,handleScroll:s,showTitles:n,i18n:a,isLoading:l,openFolder:c,noResultsLabel:p,virtualList:h,utmSource:g}=i,[y,S]=ot(!1);if(He(()=>{let F=o(q=>{q.key==="Shift"&&S(!1)},"handleKeyUp"),D=o(q=>{q.key==="Shift"&&S(!0)},"handleKeyDown");return document.addEventListener("keyup",F),document.addEventListener("keydown",D),()=>{document.removeEventListener("keyup",F),document.removeEventListener("keydown",D)}},[]),l)return u("div",{className:"uppy-Provider-loading",children:typeof l=="string"?l:a("loading")});if(e.length===0)return u("div",{className:"uppy-Provider-empty",children:p});let P=o(F=>u(ka,{viewType:t,toggleCheckbox:o(D=>{D.stopPropagation(),D.preventDefault(),document.getSelection()?.removeAllRanges(),r(F,y)},"toggleCheckbox"),showTitles:n,i18n:a,openFolder:c,file:F,utmSource:g},F.id),"renderItem");return h?u("div",{className:"uppy-ProviderBrowser-body",children:u(or,{className:"uppy-ProviderBrowser-list",data:e,renderRow:P,rowHeight:35.5})}):u("div",{className:"uppy-ProviderBrowser-body",children:u("ul",{className:"uppy-ProviderBrowser-list",onScroll:s,tabIndex:-1,children:e.map(P)})})}o(Ub,"Browser");var Oo=Ub;var Zp=he(Ve(),1);var Ob=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"),Io=Ob;function rs({cancelSelection:i,donePicking:e,i18n:t,partialTree:r,validateAggregateRestrictions:s}){let n=kt(()=>s(r),[r,s]),a=kt(()=>Io(r),[r]);return a===0?null:u("div",{className:"uppy-ProviderBrowser-footer",children:[u("div",{className:"uppy-ProviderBrowser-footer-buttons",children:[u("button",{className:(0,Zp.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})}),u("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:i,type:"button",children:t("cancel")})]}),n&&u("div",{className:"uppy-ProviderBrowser-footer-error",children:n})]})}o(rs,"FooterActions");var Ib=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"),ed=Ib;var Db=o((i,e,t)=>{let r=i.map(a=>ed(a,e,t)),s=[],n=[];r.forEach(a=>{e.uppy.checkIfFileAlreadyExists(qr(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"),Do=Db;var Nb=o((i,e,t,r)=>{let s=e.findIndex(n=>n.id===r);if(s!==-1&&t){let n=e.findIndex(l=>l.id===i);return e.slice(Math.min(s,n),Math.max(s,n)+1).map(l=>l.id)}return[i]},"getClickedRange"),No=Nb;var Mb=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"),Dt=Mb;var Lb=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"),td=Lb;var id=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=[...id(i,s.parentId,t),s];return t[r]=n,n},"getPath"),Bb=o(i=>{let e=Object.create(null);return i.filter(s=>s.type==="file"&&s.status==="checked").map(s=>{let n=id(i,s.id,e),a=n.findIndex(h=>h.type==="folder"&&h.status==="checked"),l=n.slice(a),c=`/${n.map(h=>h.data.name).join("/")}`,p=l.length===1?void 0:l.map(h=>h.data.name).join("/");return{...s.data,absDirPath:c,relDirPath:p}})},"getCheckedFilesWithPaths"),Mo=Bb;var Fa=he(sd(),1);var Ra=class i extends Error{static{o(this,"TimeoutError")}name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,i)}},od=o(i=>i.reason??new DOMException("This operation was aborted.","AbortError"),"getAbortedReason");function Aa(i,e){let{milliseconds:t,fallback:r,message:s,customTimers:n={setTimeout,clearTimeout},signal:a}=e,l,c,h=new Promise((g,y)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(a?.aborted){y(od(a));return}if(a&&(c=o(()=>{y(od(a))},"abortHandler"),a.addEventListener("abort",c,{once:!0})),i.then(g,y),t===Number.POSITIVE_INFINITY)return;let S=new Ra;l=n.setTimeout.call(void 0,()=>{if(r){try{g(r())}catch(P){y(P)}return}typeof i.cancel=="function"&&i.cancel(),s===!1?g():s instanceof Error?y(s):(S.message=s??`Promise timed out after ${t} milliseconds`,y(S))},t)}).finally(()=>{h.clear(),c&&a&&a.removeEventListener("abort",c)});return h.clear=()=>{n.clearTimeout.call(void 0,l),l=void 0},h}o(Aa,"pTimeout");function Ua(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(Ua,"lowerBound");var Hb=100,pr=class{static{o(this,"PriorityQueue")}#e=[];#t=0;enqueue(e,t){let{priority:r=0,id:s}=t??{},{size:n}=this,a={priority:r,id:s,run:e};if(n===0){this.#e.length=0,this.#t=0,this.#e.push(a);return}if(this.#e.at(-1).priority>=r){this.#e.push(a);return}this.#i();let l=Ua(this.#e,a,(c,p)=>p.priority-c.priority);this.#e.splice(l,0,a)}setPriority(e,t){let r=this.#e.findIndex((n,a)=>a>=this.#t&&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})}remove(e){let t=this.#e.findIndex((r,s)=>s<this.#t?!1:typeof e=="string"?r.id===e:r.run===e);t!==-1&&this.#e.splice(t,1)}dequeue(){if(this.#t===this.#e.length)return;let e=this.#e[this.#t];return this.#t++,this.#t===this.#e.length?(this.#e.length=0,this.#t=0):this.#t>Hb&&this.#t>this.#e.length/2&&this.#i(),e?.run}filter(e){let t=[];for(let r=this.#t;r<this.#e.length;r++){let s=this.#e[r];s.priority===e.priority&&t.push(s.run)}return t}get size(){return this.#e.length-this.#t}#i(){this.#t!==0&&(this.#e.splice(0,this.#t),this.#t=0)}};var os=class extends Fa.default{static{o(this,"PQueue")}#e;#t;#i=0;#r;#s=!1;#o=!1;#n;#a=0;#u;#l;#c;#p=[];#h=0;#d;#y;#f=0;#g;#m;#b=1n;#w=new Map;#S=new Set;timeout;constructor(e){if(super(),e={carryoverIntervalCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:pr,strict:!1,...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})`);if(e.strict&&e.interval===0)throw new TypeError("The `strict` option requires a non-zero `interval`");if(e.strict&&e.intervalCap===Number.POSITIVE_INFINITY)throw new TypeError("The `strict` option requires a finite `intervalCap`");if(this.#e=e.carryoverIntervalCount??e.carryoverConcurrencyCount??!1,this.#t=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#r=e.intervalCap,this.#n=e.interval,this.#c=e.strict,this.#d=new e.queueClass,this.#y=e.queueClass,this.concurrency=e.concurrency,e.timeout!==void 0&&!(Number.isFinite(e.timeout)&&e.timeout>0))throw new TypeError(`Expected \`timeout\` to be a positive finite number, got \`${e.timeout}\` (${typeof e.timeout})`);this.timeout=e.timeout,this.#m=e.autoStart===!1,this.#j()}#v(e){for(;this.#h<this.#p.length;){let r=this.#p[this.#h];if(r!==void 0&&e-r>=this.#n)this.#h++;else break}(this.#h>100&&this.#h>this.#p.length/2||this.#h===this.#p.length)&&(this.#p=this.#p.slice(this.#h),this.#h=0)}#_(e){this.#c?this.#p.push(e):this.#i++}#x(){this.#c?this.#p.length>this.#h&&this.#p.pop():this.#i>0&&this.#i--}#T(){return this.#p.length-this.#h}get#C(){return this.#t?!0:this.#c?this.#T()<this.#r:this.#i<this.#r}get#E(){return this.#f<this.#g}#M(){this.#f--,this.#f===0&&this.emit("pendingZero"),this.#F(),this.emit("next")}#L(){this.#l=void 0,this.#D(),this.#I()}#B(e){if(this.#c){if(this.#v(e),this.#T()>=this.#r){let r=this.#p[this.#h],s=this.#n-(e-r);return this.#U(s),!0}return!1}if(this.#u===void 0){let t=this.#a-e;if(t<0)this.#i=this.#e?this.#f:0;else return this.#U(t),!0}return!1}#U(e){this.#l===void 0&&(this.#l=setTimeout(()=>{this.#L()},e))}#R(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}#O(){this.#l&&(clearTimeout(this.#l),this.#l=void 0)}#F(){if(this.#d.size===0){if(this.#R(),this.emit("empty"),this.#f===0){if(this.#O(),this.#c&&this.#h>0){let t=Date.now();this.#v(t)}this.emit("idle")}return!1}let e=!1;if(!this.#m){let t=Date.now(),r=!this.#B(t);if(this.#C&&this.#E){let s=this.#d.dequeue();this.#t||(this.#_(t),this.#k()),r&&this.#I(),this.emit("active"),s(),e=!0}}return e}#I(){this.#t||this.#u!==void 0||this.#c||(this.#u=setInterval(()=>{this.#D()},this.#n),this.#a=Date.now()+this.#n)}#D(){this.#c||(this.#u!==void 0&&(this.#i===0&&this.#f===0?this.#R():this.#a=Date.now()+this.#n),this.#i=this.#e?this.#f:0),this.#A(),this.#k()}#A(){for(;this.#F(););}get concurrency(){return this.#g}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.#g=e,this.#A()}setPriority(e,t){if(typeof t!="number"||!Number.isFinite(t))throw new TypeError(`Expected \`priority\` to be a finite number, got \`${t}\` (${typeof t})`);this.#d.setPriority(e,t)}async add(e,t={}){if(t={timeout:this.timeout,...t,id:t.id??(this.#b++).toString()},t.timeout!==void 0&&!(Number.isFinite(t.timeout)&&t.timeout>0))throw new TypeError(`Expected \`timeout\` to be a positive finite number, got \`${t.timeout}\` (${typeof t.timeout})`);return new Promise((r,s)=>{let n=Symbol(`task-${t.id}`),a=o(()=>{},"cleanupQueueAbortHandler"),l=o(async()=>{a(),this.#f++,this.#w.set(n,{id:t.id,priority:t.priority??0,startTime:Date.now(),timeout:t.timeout});let p;try{try{t.signal?.throwIfAborted()}catch(y){throw this.#z(),this.#w.delete(n),y}let h=e({signal:t.signal});if(t.timeout!==void 0&&(h=Aa(Promise.resolve(h),{milliseconds:t.timeout,message:`Task timed out after ${t.timeout}ms (queue has ${this.#f} running, ${this.#d.size} waiting)`})),t.signal){let{signal:y}=t;h=Promise.race([h,new Promise((S,P)=>{p=o(()=>{P(y.reason)},"eventListener"),y.addEventListener("abort",p,{once:!0})})])}let g=await h;r(g),this.emit("completed",g)}catch(h){s(h),this.emit("error",h)}finally{p&&t.signal?.removeEventListener("abort",p),this.#w.delete(n),queueMicrotask(()=>{this.#M()})}},"run");this.#d.enqueue(l,t);let c=o(()=>{if(this.#d instanceof pr){this.#d.remove(l);return}this.#d.remove?.(t.id)},"removeQueuedTask");if(t.signal){let{signal:p}=t,h=o(()=>{a(),c(),s(p.reason),this.#F(),this.emit("next")},"queueAbortHandler");if(a=o(()=>{p.removeEventListener("abort",h),this.#S.delete(a)},"cleanupQueueAbortHandler"),p.aborted){h();return}p.addEventListener("abort",h,{once:!0}),this.#S.add(a)}this.emit("add"),this.#F()})}async addAll(e,t){return Promise.all(e.map(async r=>this.add(r,t)))}start(){return this.#m?(this.#m=!1,this.#A(),this):this}pause(){this.#m=!0}clear(){for(let e of this.#S)e();this.#d=new this.#y,this.#R(),this.#N(),this.emit("empty"),this.#f===0&&(this.#O(),this.emit("idle")),this.emit("next")}async onEmpty(){this.#d.size!==0&&await this.#P("empty")}async onSizeLessThan(e){this.#d.size<e||await this.#P(["next","active"],()=>this.#d.size<e)}async onIdle(){this.#f===0&&this.#d.size===0||await this.#P("idle")}async onPendingZero(){this.#f!==0&&await this.#P("pendingZero")}async onRateLimit(){this.isRateLimited||await this.#P("rateLimit")}async onRateLimitCleared(){this.isRateLimited&&await this.#P("rateLimitCleared")}onError(){return new Promise((e,t)=>{let r=o(s=>{this.off("error",r),t(s)},"handleError");this.on("error",r)})}async#P(e,t){let r=Array.isArray(e)?e:[e];return new Promise(s=>{let n=o(()=>{if(!(t&&!t())){for(let a of r)this.off(a,n);s()}},"listener");for(let a of r)this.on(a,n)})}get size(){return this.#d.size}sizeBy(e){return this.#d.filter(e).length}get pending(){return this.#f}get isPaused(){return this.#m}#j(){this.#t||(this.on("add",()=>{this.#d.size>0&&this.#k()}),this.on("next",()=>{this.#k()}))}#k(){this.#t||this.#o||(this.#o=!0,queueMicrotask(()=>{this.#o=!1,this.#N()}))}#z(){this.#t||(this.#x(),this.#k())}#N(){let e=this.#s;if(this.#t||this.#d.size===0){e&&(this.#s=!1,this.emit("rateLimitCleared"));return}let t;if(this.#c){let s=Date.now();this.#v(s),t=this.#T()}else t=this.#i;let r=t>=this.#r;r!==e&&(this.#s=r,this.emit(r?"rateLimit":"rateLimitCleared"))}get isRateLimited(){return this.#s}get isSaturated(){return this.#f===this.#g&&this.#d.size>0||this.isRateLimited&&this.#d.size>0}get runningTasks(){return[...this.#w.values()].map(e=>({...e,timeoutRemaining:e.timeout?Math.max(0,e.startTime+e.timeout-Date.now()):void 0}))}};var qb=o(i=>i.map(e=>({...e})),"shallowClone"),Bo=qb;var nd=o(async(i,e,t,r,s)=>{let n=[],a=t.cached?t.nextPagePath:t.id;for(;a;){let g=await r(a);n=n.concat(g.items),a=g.nextPagePath}let l=n.filter(g=>g.isFolder===!0),c=n.filter(g=>g.isFolder===!1),p=l.map(g=>({type:"folder",id:g.requestPath,cached:!1,nextPagePath:null,status:"checked",parentId:t.id,data:g})),h=c.map(g=>{let y=s(g);return{type:"file",id:g.requestPath,restrictionError:y,status:y?"unchecked":"checked",parentId:t.id,data:g}});t.cached=!0,t.nextPagePath=null,e.push(...h,...p),p.forEach(async g=>{i.add(()=>nd(i,e,g,r,s))})},"recursivelyFetch"),$b=o(async(i,e,t,r)=>{let s=new os({concurrency:6}),n=Bo(i);return n.filter(l=>l.type==="folder"&&l.status==="checked"&&(l.cached===!1||l.nextPagePath)).forEach(l=>{s.add(()=>nd(s,n,l,e,t))}),s.on("completed",()=>{let l=n.filter(c=>c.type==="file"&&c.status==="checked").length;r(l)}),await s.onIdle(),n},"afterFill"),ad=$b;var Vb=o((i,e,t,r,s)=>{let n=e.filter(P=>!i.find(F=>F.id===P.requestPath)),a=n.filter(P=>P.isFolder===!0),l=n.filter(P=>P.isFolder===!1),c=t.type==="folder"&&t.status==="checked",p=a.map(P=>({type:"folder",id:P.requestPath,cached:!1,nextPagePath:null,status:c?"checked":"unchecked",parentId:t.id,data:P})),h=l.map(P=>{let F=s(P);return{type:"file",id:P.requestPath,restrictionError:F,status:c&&!F?"checked":"unchecked",parentId:t.id,data:P}}),g={...t,cached:!0,nextPagePath:r};return[...i.map(P=>P.id===g.id?g:P),...p,...h]},"afterOpenFolder"),ld=Vb;var Wb=o((i,e,t,r,s)=>{let n=i.find(P=>P.id===e),a=t.filter(P=>P.isFolder===!0),l=t.filter(P=>P.isFolder===!1),c={...n,nextPagePath:r},p=i.map(P=>P.id===c.id?c:P),h=c.type==="folder"&&c.status==="checked",g=a.map(P=>({type:"folder",id:P.requestPath,cached:!1,nextPagePath:null,status:h?"checked":"unchecked",parentId:c.id,data:P})),y=l.map(P=>{let F=s(P);return{type:"file",id:P.requestPath,restrictionError:F,status:h&&!F?"checked":"unchecked",parentId:c.id,data:P}});return[...p,...g,...y]},"afterScrollFolder"),ud=Wb;var cd=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",cd(i,s.id,t)})},"percolateDown"),pd=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",pd(i,t.parentId)},"percolateUp"),Gb=o((i,e)=>{let t=Bo(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,cd(t,s.id,s.status==="checked")}),pd(t,r[0].parentId),t},"afterToggleCheckbox"),dd=Gb;var Ci={afterOpenFolder:ld,afterScrollFolder:ud,afterToggleCheckbox:dd,afterFill:ad};var Xb=o(i=>{let{scrollHeight:e,scrollTop:t,offsetHeight:r}=i.target;return e-(t+r)<50},"shouldHandleScroll"),jo=Xb;var hd=he(Ve(),1);var Kb=o(({i18n:i,item:e,toggleCheckbox:t,openFolder:r})=>{let s="restrictionError"in e&&e.restrictionError!=null&&e.status!=="checked";return u("li",{className:(0,hd.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:[u("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}),u("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:[u("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:u(ai,{itemIconString:e.data.icon})}),e.data.name??i("unnamed")]})]})},"SearchResultItem"),fd=Kb;var Yb=o(({searchResults:i,toggleCheckbox:e,openFolder:t,i18n:r})=>i.length===0?u("div",{className:"uppy-Provider-empty",children:r("noFilesFound")}):u("div",{className:"uppy-ProviderBrowser-body",children:u("ul",{className:"uppy-ProviderBrowser-list",children:i.map(s=>u(fd,{i18n:r,item:s,toggleCheckbox:e,openFolder:t},s.id))})}),"GlobalSearchView"),md=Yb;var gd=he(Ve(),1);function Oa(i){let{openFolder:e,title:t,breadcrumbsIcon:r,breadcrumbs:s,i18n:n}=i;return u("div",{className:"uppy-Provider-breadcrumbs",children:[u("div",{className:"uppy-Provider-breadcrumbsIcon",children:r}),s.map((a,l)=>{let c=a.type==="root"?t:a.data.name??n("unnamed"),p=s.length===l+1;return u(Ee,{children:[u("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:p?void 0:()=>e(a.id),"aria-current":p?"page":void 0,title:c,children:c}),!p&&u("span",{"aria-hidden":"true",className:"uppy-Provider-breadcrumbsSeparator",children:"/"})]},a.id)})]})}o(Oa,"Breadcrumbs");function Ia({i18n:i,logout:e,username:t}){return u(Ee,{children:[t&&u("span",{className:"uppy-ProviderBrowser-user",children:t},"username"),u("button",{type:"button",onClick:e,className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-userLogout",children:i("logOut")},"logout")]})}o(Ia,"User");function Da(i){return u("div",{className:"uppy-ProviderBrowser-header",children:u("div",{className:(0,gd.default)("uppy-ProviderBrowser-headerBar",!i.showBreadcrumbs&&"uppy-ProviderBrowser-headerBar--simple"),children:[i.showBreadcrumbs&&u(Oa,{openFolder:i.openFolder,breadcrumbs:i.breadcrumbs,breadcrumbsIcon:i.pluginIcon?.(),title:i.title,i18n:i.i18n}),u(Ia,{logout:i.logout,username:i.username,i18n:i.i18n})]})})}o(Da,"Header");function dr(){return u("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30",children:u("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(dr,"defaultPickerIcon");var yd=o(i=>({authenticated:void 0,partialTree:[{type:"root",id:i,cached:!1,nextPagePath:null}],currentFolderId:i,searchString:"",didFirstRender:!1,username:null,loading:!1}),"getDefaultState"),We=class i{static{o(this,"ProviderView")}static VERSION=It.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 n=i[Symbol.for("uppy test: searchDebounceMs")],a=n??500,l=n===0?{leading:!0,trailing:!0}:void 0;this.#e=(0,bd.default)(this.#r,a,l)}resetPluginState(){this.plugin.setPluginState(yd(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#i(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#r(){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.#i(async n=>{let a=s.type==="root"?void 0:t,{items:l}=await this.provider.search(r,{signal:n,path:a}),{partialTree:c}=this.plugin.getPluginState(),p=[...c];for(let h of l){let y=decodeURIComponent(h.requestPath).split("/").filter(F=>F.length>0),S=this.plugin.rootFolderId,P;y.forEach((F,D,q)=>{let R=y.slice(0,D+1),C=encodeURIComponent(`/${R.join("/")}`),j=p.find(K=>K.id===C&&K.type!=="root");if(j){S=C,P=j.status==="checked";return}let W=D===q.length-1,B,Q=P?"checked":"unchecked";if(W)if(h.isFolder)B={type:"folder",id:C,cached:!1,nextPagePath:null,status:Q,parentId:S,data:h};else{let K=this.validateSingleFile(h);B={type:"file",id:C,restrictionError:K,status:K?"unchecked":Q,parentId:S,data:h}}else B={type:"folder",id:C,cached:!1,nextPagePath:null,status:Q,parentId:S,data:{name:decodeURIComponent(F),icon:"folder",isFolder:!0}};p.push(B),S=C,P=Q==="checked"})}this.plugin.setPluginState({partialTree:p,searchResults:l.map(h=>h.requestPath)})}).catch(Dt(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.#i(async s=>{let n=e,a=[];do{let{username:c,nextPagePath:p,items:h}=await this.provider.list(n,{signal:s});this.plugin.setPluginState({username:c}),n=p,a=a.concat(h),this.setLoading(this.plugin.uppy.i18n("loadedXFiles",{numFiles:a.length}))}while(this.opts.loadAllFiles&&n);let l=Ci.afterOpenFolder(t,a,r,n,this.validateSingleFile);this.plugin.setPluginState({partialTree:l,currentFolderId:e,searchString:""})}).catch(Dt(this.plugin.uppy)),this.setLoading(!1)}async logout(){await this.#i(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({...yd(this.plugin.rootFolderId),authenticated:!1})}}).catch(Dt(this.plugin.uppy))}async handleAuth(e){await this.#i(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(Dt(this.plugin.uppy)),this.setLoading(!1)}async handleScroll(e){let{partialTree:t,currentFolderId:r}=this.plugin.getPluginState(),s=t.find(n=>n.id===r);jo(e)&&!this.isHandlingScroll&&s.nextPagePath&&(this.isHandlingScroll=!0,await this.#i(async n=>{let{nextPagePath:a,items:l}=await this.provider.list(s.nextPagePath,{signal:n}),c=Ci.afterScrollFolder(t,r,l,a,this.validateSingleFile);this.plugin.setPluginState({partialTree:c})}).catch(Dt(this.plugin.uppy)),this.isHandlingScroll=!1)}validateSingleFile=o(e=>{let t=ir(e);return this.plugin.uppy.validateSingleFile(t)},"validateSingleFile");async donePicking(){let{partialTree:e}=this.plugin.getPluginState();this.isLoading||(this.setLoading(!0),await this.#i(async t=>{let r=await Ci.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=Mo(r);Do(n,this.plugin,this.provider),this.resetPluginState()}).catch(Dt(this.plugin.uppy)),this.setLoading(!1))}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=No(e.id,this.getDisplayedPartialTree(),t,this.previousCheckbox),n=Ci.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 td(e,t)},"getBreadcrumbs");getSelectedAmount=o(()=>{let{partialTree:e}=this.plugin.getPluginState();return Io(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 l=s.get(a);if(l==null)throw new Error("Partial tree not complete");return l});return u(md,{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:l}=this.plugin.getPluginState(),c=this.plugin.icon||dr;if(a===!1)return u(is,{pluginName:this.plugin.title,pluginIcon:c,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18n,renderForm:n.renderAuthForm,loading:l});let{partialTree:p,username:h,searchString:g,searchResults:y}=this.plugin.getPluginState(),S=this.getBreadcrumbs();return u("div",{className:(0,vd.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${n.viewType}`),children:[u(Da,{showBreadcrumbs:n.showBreadcrumbs,openFolder:this.openFolder,breadcrumbs:S,pluginIcon:c,title:this.plugin.title,logout:this.logout,username:h,i18n:s}),n.showFilter&&u(lr,{value:g,onChange:o(P=>this.onSearchInput(P),"onChange"),onSubmit:o(()=>{},"onSubmit"),inputLabel:s("filter"),i18n:s}),y?this.#s():u(Oo,{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:l,utmSource:"Companion"}),u(rs,{partialTree:p,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:s,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};var wd=he(Ve(),1);function Jb({value:i,onChange:e,onSubmit:t,inputLabel:r,loading:s=!1,children:n}){let{formId:a}=ar(t);return u("section",{className:"uppy-SearchProvider",children:[u("input",{className:"uppy-u-reset uppy-c-textInput uppy-SearchProvider-input",type:"search","aria-label":r,placeholder:r,value:i,onInput:o(l=>e(l.target.value),"onInput"),form:a,disabled:s,"data-uppy-super-focusable":!0}),u("button",{disabled:s,className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-SearchProvider-searchButton",type:"submit",form:a,children:n})]})}o(Jb,"SearchView");var zo=Jb;var Qb={loading:!1,searchString:"",partialTree:[{type:"root",id:null,cached:!1,nextPagePath:null}],currentFolderId:null,isInputMode:!0},Zb={viewType:"grid",showTitles:!0,showFilter:!0,utmSource:"Companion"},li=class{static{o(this,"SearchProviderView")}static VERSION=It.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider,this.opts={...Zb,...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(Qb)}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){Dt(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(jo(e)&&!this.isHandlingScroll&&s.nextPagePath){this.isHandlingScroll=!0;try{let n=await this.provider.search(r,s.nextPagePath),a={...s,nextPagePath:n.nextPageQuery},l=t.filter(p=>p.type!=="root"),c=[a,...l,...n.items.map(p=>({type:"file",id:p.requestPath,status:"unchecked",parentId:null,data:p}))];this.plugin.setPluginState({partialTree:c})}catch(n){Dt(this.plugin.uppy)(n)}this.isHandlingScroll=!1}}async donePicking(){let{partialTree:e}=this.plugin.getPluginState(),t=Mo(e);Do(t,this.plugin,this.provider),this.resetPluginState()}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=No(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=Ci.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}validateSingleFile=o(e=>{let t=ir(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:l}=this.plugin.uppy,c={...this.opts,...t};return r?u(zo,{value:s,onChange:this.setSearchString,onSubmit:this.search,inputLabel:l("enterTextToSearch"),children:l("searchImages")}):u("div",{className:(0,wd.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${c.viewType}`),children:[c.showFilter&&u(lr,{value:s,onChange:this.setSearchString,onSubmit:this.search,inputLabel:l("search"),i18n:l}),u(Oo,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),handleScroll:this.handleScroll,openFolder:o(async()=>{},"openFolder"),noResultsLabel:l("noSearchResults"),viewType:c.viewType,showTitles:c.showTitles,isLoading:n,i18n:l,virtualList:!1,utmSource:this.opts.utmSource}),u(rs,{partialTree:a,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:l,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};var Sd={name:"@uppy/audio",description:"Uppy plugin that records audio using the device\u2019s microphone.",version:"4.0.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:{preact:"^10.29.2"},devDependencies:{"@vitest/browser-playwright":"^4.1.6",cssnano:"^8.0.1",playwright:"1.61.1",postcss:"^8.5.23","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^6.0.3",vitest:"^4.1.6"},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 --silent='passed-only'"}};var xd={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 _d=o(i=>{let{icon:e,hasAudio:t,i18n:r}=i;return u("div",{className:"uppy-Audio-permissons",children:[u("div",{className:"uppy-Audio-permissonsIcon",children:e()}),u("div",{className:"uppy-Audio-title",children:r(t?"allowAudioAccessTitle":"noAudioTitle")}),u("p",{children:r(t?"allowAudioAccessDescription":"noAudioDescription")})]})},"default");var Ed=o(({currentDeviceId:i,audioSources:e,onChangeSource:t})=>u("div",{className:"uppy-Audio-videoSource",children:u("select",{className:"uppy-u-reset uppy-Audio-audioSource-select",onChange:o(r=>{t(r.target.value)},"onChange"),children:e.map(r=>u("option",{value:r.deviceId,selected:r.deviceId===i,children:r.label},r.deviceId))})}),"default");function Pd(i){return typeof i=="function"}o(Pd,"isFunction");function ns(i){return Pd(i)?i():i}o(ns,"result");var as=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=ns(r.width)||this.canvas.width,this.height=ns(r.height)||this.canvas.height,this.canvas.width=this.width,this.canvas.height=this.height,this.canvasContext=this.canvas.getContext("2d"),this.canvasContext.fillStyle=ns(s.fillStyle)||"rgb(255, 255, 255)",this.canvasContext.strokeStyle=ns(s.strokeStyle)||"rgb(0, 0, 0)",this.canvasContext.lineWidth=ns(s.lineWidth)||1,this.onDrawFrame=Pd(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 l=n*1/r,c=0;r||s.moveTo(0,this.height/2);for(let p=0;p<r;p++){let g=t[p]/128*(a/2);p===0?s.moveTo(c,g):s.lineTo(c,g),c+=l}s.lineTo(n,a/2),s.stroke(),this.onDrawFrame(this),requestAnimationFrame(this.#e)}#e=o(()=>this.draw(),"#draw")};function t0({onDiscard:i,i18n:e}){return u("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:u("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:u("g",{fill:"#FFF",fillRule:"evenodd",children:[u("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),u("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"})]})})})}o(t0,"DiscardButton");var Td=t0;function Ma({recording:i,onStartRecording:e,onStopRecording:t,i18n:r}){return i?u("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:u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:u("rect",{x:"15",y:"15",width:"70",height:"70"})})}):u("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:u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14px",height:"20px",viewBox:"0 0 14 20",children:u("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(Ma,"RecordButton");function La(i){return`${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`}o(La,"formatSeconds");function Ba({recordingLengthSeconds:i}){let e=La(i);return u("span",{children:e})}o(Ba,"RecordingLength");function i0({onSubmit:i,i18n:e}){return u("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:u("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:u("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})})})}o(i0,"SubmitButton");var kd=i0;function ja(i){let{stream:e,recordedAudio:t,onStop:r,recording:s,supportsRecording:n,audioSources:a,showAudioSourceDropdown:l,onSubmit:c,i18n:p,onStartRecording:h,onStopRecording:g,onDiscardRecordedAudio:y,recordingLengthSeconds:S}=i,P=et(null),F=et();He(()=>()=>{F.current=null,r()},[r]),He(()=>{if(!t&&(F.current=new as(P.current,{canvas:{width:600,height:600},canvasContext:{lineWidth:2,fillStyle:"rgb(0,0,0)",strokeStyle:"green"}}),F.current.draw(),e)){let j=new AudioContext().createMediaStreamSource(e);F.current.addSource(j)}},[t,e]);let D=t!=null,q=!D&&n,R=l&&!D&&a&&a.length>1;return u("div",{className:"uppy-Audio-container",children:[u("div",{className:"uppy-Audio-audioContainer",children:D?u("audio",{className:"uppy-Audio-player",controls:!0,src:t}):u("canvas",{ref:P,className:"uppy-Audio-canvas"})}),u("div",{className:"uppy-Audio-footer",children:[u("div",{className:"uppy-Audio-audioSourceContainer",children:R?Ed(i):null}),u("div",{className:"uppy-Audio-buttonContainer",children:[q&&u(Ma,{recording:s,onStartRecording:h,onStopRecording:g,i18n:p}),D&&u(kd,{onSubmit:c,i18n:p}),D&&u(Td,{onDiscard:y,i18n:p})]}),u("div",{className:"uppy-Audio-recordingLength",children:!D&&u(Ba,{recordingLengthSeconds:S})})]})]})}o(ja,"RecordingScreen");function za(){return typeof MediaRecorder=="function"&&typeof MediaRecorder.prototype?.start=="function"}o(za,"supportsMediaRecorder");var ls=class extends ae{static{o(this,"Audio")}static VERSION=Sd.version;#e;icon;#t=null;#i=!1;#r=null;#s=null;#o=null;#n;#a;constructor(e,t){super(e,t),this.#n=navigator.mediaDevices,this.#a=this.#n!=null,this.id=this.opts.id||"Audio",this.type="acquirer",this.icon=()=>u("svg",{className:"uppy-DashboardTab-iconAudio","aria-hidden":"true",focusable:"false",width:"32px",height:"32px",viewBox:"0 0 32 32",children:u("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=xd,this.opts={...t},this.i18nInit(),this.title=this.i18n("pluginNameAudio"),this.setPluginState({hasAudio:!1,audioReady:!1,cameraError:null,recordingLengthSeconds:0,audioSources:[],currentDeviceId:null})}#u(){return this.#n?this.#n.enumerateDevices().then(e=>e.some(t=>t.kind==="audioinput")):Promise.resolve(!1)}#l=o(e=>{if(!this.#a)return Promise.reject(new Error("Microphone access not supported"));this.#i=!0,this.#u().then(t=>(this.setPluginState({hasAudio:t}),this.#n.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");#c=o(()=>{this.#s=new MediaRecorder(this.#t),this.#r=[];let e=!1;this.#s.addEventListener("dataavailable",t=>{this.#r.push(t.data);let{restrictions:r}=this.uppy.opts;if(this.#r.length>1&&r.maxFileSize!=null&&!e){let s=this.#r.reduce((c,p)=>c+p.size,0),a=(s-this.#r[0].size)/(this.#r.length-1)*3,l=Math.max(0,r.maxFileSize-a);s>l&&(e=!0,this.uppy.info(this.i18n("recordingStoppedMaxSize"),"warning",4e3),this.#p())}}),this.#s.start(500),this.#e=setInterval(()=>{let t=this.getPluginState().recordingLengthSeconds;this.setPluginState({recordingLengthSeconds:t+1})},1e3),this.setPluginState({isRecording:!0})},"#startRecording");#p=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.#f())).then(t=>{try{this.#o=t,this.setPluginState({recordedAudio:URL.createObjectURL(t.data)})}catch(r){r.isRestriction||this.uppy.log(r)}}).then(()=>{this.#r=null,this.#s=null},t=>{throw this.#r=null,this.#s=null,t}),"#stopRecording");#h=o(()=>{this.setPluginState({recordedAudio:null}),this.#o=null},"#discardRecordedAudio");#d=o(()=>{try{this.#o&&this.uppy.addFile(this.#o)}catch(e){e.isRestriction||this.uppy.log(e,"warning")}},"#submit");#y=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.#r=null,this.#s=null,this.#i=!1,this.#t=null,this.setPluginState({recordedAudio:null,isRecording:!1,recordingLengthSeconds:0})},"#stop");#f(){let e=this.#r.find(a=>a.type?.length>0).type,t=St(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.#r,{type:e}),n={source:this.id,name:r,data:new Blob([s],{type:e}),type:e};return Promise.resolve(n)}#g=o(e=>{this.#y(),this.#l({deviceId:e})},"#changeSource");#m=o(()=>{this.#n.enumerateDevices().then(e=>{this.setPluginState({audioSources:e.filter(t=>t.kind==="audioinput")})})},"#updateSources");render(){this.#i||this.#l();let e=this.getPluginState();return!e.audioReady||!e.hasAudio?u(_d,{icon:this.icon,i18n:this.i18n,hasAudio:e.hasAudio}):u(ja,{...e,onChangeSource:this.#g,onStartRecording:this.#c,onStopRecording:this.#p,onDiscardRecordedAudio:this.#h,onSubmit:this.#d,onStop:this.#y,i18n:this.i18n,showAudioSourceDropdown:this.opts.showAudioSourceDropdown,supportsRecording:za(),recording:e.isRecording,stream:this.#t})}install(){this.setPluginState({audioReady:!1,recordingLengthSeconds:0});let{target:e}=this.opts;e&&this.mount(e,this),this.#n&&(this.#m(),this.#n.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.#y(),this.#l())}})}uninstall(){this.#t&&this.#y(),this.unmount()}};var Cd={name:"@uppy/aws-s3",description:"Upload to Amazon S3 with Uppy",version:"6.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --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"},devDependencies:{"@aws-sdk/client-s3":"^3.362.0","@aws-sdk/client-sts":"^3.362.0","@aws-sdk/s3-request-presigner":"^3.362.0","@types/node":"^22.20.1","@uppy/core":"workspace:^","@vitest/browser-playwright":"^4.1.6",playwright:"1.61.1",typescript:"^6.0.3",vitest:"^4.1.6"},peerDependencies:{"@uppy/core":"workspace:^"}};var s0=1024*1024,Fd=5*s0,Ha=1e4,us=class{static{o(this,"S3Uploader")}#e;#t;#i;#r;#s=[];#o=[];#n=!1;#a;#u=!1;#l;constructor(e){if(e.file.data==null)throw new Error(`File data is missing for file ${e.file.id}`);this.#i=e,this.#e=e.file.data,this.#r=new Ut(e.uppy);let t=e.file.s3Multipart;t&&(this.#t=t.key,this.#a=t.uploadId,this.#u=!0);let r=e.file.data.size;if(this.#n=!!t||this.#i.shouldUseMultipart===!0&&r>Fd,this.#n){let n=this.#c(r);n=Math.max(n,Fd),Math.ceil(r/n)>Ha&&(n=Math.ceil(r/Ha));for(let a=0,l=0;a<r;a+=n,l++){let c=Math.min(a+n,r);this.#s.push({index:l,start:a,end:c,size:c-a})}}else this.#s=[{index:0,start:0,end:r,size:r}];this.#o=this.#s.map(()=>({uploaded:0}));let s=this.#i.file.id;this.#r.onFileRemove(s,()=>{this.abort(),this.#i.onAbort?.()}),this.#r.onCancelAll(s,()=>{this.abort(),this.#i.onAbort?.()}),this.#r.onFilePause(s,n=>{n?this.#p():this.start()}),this.#r.onPauseAll(s,()=>{this.#p()}),this.#r.onResumeAll(s,()=>{this.start()}),this.#r.onRetry(s,()=>{this.start()}),this.#r.onRetryAll(s,()=>{this.start()})}#c(e){return this.#i.getChunkSize?this.#i.getChunkSize({size:e}):Math.ceil(e/Ha)}async start(){this.#l?.abort(),this.#l=new AbortController;let e=this.#l.signal;try{let t=this.#a;this.#u&&t?await this.#h(t,e):(this.#u=!0,this.#n?await this.#y(e):await this.#d(e))}catch(t){this.#b(t instanceof Error?t:new Error(t))}}#p(){this.#l?.abort()}abort(e){if(this.#l?.abort(),this.#r.remove(),e?.abortInS3!==!1&&this.#a){if(!this.#t)throw new Error("Missing S3 object key for aborting upload");this.#i.s3Client.abortMultipartUpload({key:this.#t,uploadId:this.#a}).catch(t=>{this.#i.log?.(t,"warning")})}this.#t=void 0,this.#a=void 0,this.#u=!1}async#h(e,t){if(!this.#t)throw new Error("Missing S3 object key for resuming upload");let r=await this.#i.s3Client.listParts({uploadId:e,key:this.#t,signal:t});for(let s of r){let n=s.partNumber-1;n>=0&&n<this.#o.length&&(this.#o[n].uploaded=this.#s[n].size,this.#o[n].etag=s.etag)}this.#g(),await this.#f(t)}async#d(e){let{location:t,key:r}=await this.#i.s3Client.putObject({key:this.#i.key,data:this.#e,fileType:this.#i.file.type||"application/octet-stream",metadata:this.#i.metadata,onProgress:o(s=>{this.#o[0].uploaded=s,this.#g()},"onProgress"),signal:e});this.#m({location:t,key:r})}async#y(e){let{uploadId:t,key:r}=await this.#i.s3Client.createMultipartUpload({key:this.#i.key,fileType:this.#i.file.type||"application/octet-stream",metadata:this.#i.metadata,signal:e});this.#t=r,this.#a=t,this.#i.uppy.setFileState(this.#i.file.id,{s3Multipart:{uploadId:t,key:r}}),await this.#f(e)}async#f(e){for(let n=0;n<this.#s.length;n++){if(e.throwIfAborted(),this.#o[n].etag)continue;let a=this.#s[n],l=n+1,c=this.#e.slice(a.start,a.end),p=n;if(this.#t==null)throw new Error("Missing S3 object key for uploading part");let{etag:h}=await this.#i.s3Client.uploadPart({key:this.#t,uploadId:this.#a,data:c,partNumber:l,onProgress:o(g=>{this.#o[p].uploaded=g,this.#g()},"onProgress"),signal:e});this.#o[n].uploaded=a.size,this.#o[n].etag=h,this.#g(),this.#i.onPartComplete&&this.#i.onPartComplete({PartNumber:l,ETag:h})}let t=this.#o.flatMap((n,a)=>n.etag?[{partNumber:a+1,etag:n.etag}]:[]);if(this.#t==null)throw new Error("Missing S3 object key for completing multipart upload");let{location:r,key:s}=await this.#i.s3Client.completeMultipartUpload({key:this.#t,uploadId:this.#a,parts:t,signal:e});this.#m({location:r,key:s,uploadId:this.#a})}#g(){if(!this.#i.onProgress)return;let e=this.#o.reduce((t,r)=>t+r.uploaded,0);this.#i.onProgress(e,this.#e.size)}#m(e){this.#r.remove(),this.#i.uppy.setFileState(this.#i.file.id,{s3Multipart:void 0}),this.#i.onSuccess?.(e)}#b(e){e.name!=="AbortError"&&(this.#r.remove(),this.#i.onError?.(e))}};var qa="AWS4-HMAC-SHA256",Ho="aws4_request";var $a="UNSIGNED-PAYLOAD",hr="application/octet-stream",Rd="application/xml";var rt="[s3mini] ",Ad=`${rt}endpoint must be a non-empty string`,Ud=`${rt}endpoint must be a valid URL. Expected format: https://<host>[:port][/base-path]`,Od=`${rt}key must be a non-empty string`,fr=`${rt}uploadId must be a non-empty string`;var Wa=class{static{o(this,"S3Client")}requestAbortTimeout;constructor({requestAbortTimeout:e}){this.requestAbortTimeout=e}isOffline(){return typeof navigator<"u"&&navigator.onLine===!1}waitForOnline(e){return new Promise((t,r)=>{if(!this.isOffline()){t();return}if(typeof navigator>"u"||navigator.onLine===!0||navigator.onLine===void 0){t();return}if(e?.aborted){r(new DOMException("Upload aborted","AbortError"));return}let s=o(()=>{window.removeEventListener("online",n),e?.removeEventListener("abort",a)},"cleanup"),n=o(()=>{s(),t()},"onOnline"),a=o(()=>{s(),r(new DOMException("Upload aborted","AbortError"))},"onAbort");window.addEventListener("online",n),e?.addEventListener("abort",a)})}async xhr({url:e,method:t,data:r,onProgress:s,signal:n,contentType:a}){if(n?.aborted)throw new DOMException("Request aborted","AbortError");return jr(e,{method:t,body:["GET","HEAD"].includes(t)?void 0:r,headers:a?{"Content-Type":a}:{},signal:n,timeout:this.requestAbortTimeout,retries:3,shouldRetry:o(l=>!(this.isOffline()||l.status>=400&&l.status<500&&l.status!==429),"shouldRetry"),onUploadProgress:o(l=>{l.lengthComputable&&s&&s(l.loaded,l.total)},"onUploadProgress")})}async putObject(e){throw new Error("Not implemented")}async createMultipartUpload(e){throw new Error("Not implemented")}async uploadPart(e){throw new Error("Not implemented")}async listParts(e){throw new Error("Not implemented")}async completeMultipartUpload(e){throw new Error("Not implemented")}async abortMultipartUpload(e){throw new Error("Not implemented")}async deleteObject(e){throw new Error("Not implemented")}},qo=Wa;var Xa=o(i=>i.replace(/^("|")+|("|")+$/g,""),"sanitizeXmlETag"),mr=o(i=>i?.replace(/^"+|"+$/g,""),"sanitizeETag");function Nd(i){let e=new URL(i);return e.search="",e.hash="",e.href}o(Nd,"removeQueryString");var Ga=new TextEncoder,Id="0123456789abcdef",Ka=o(i=>{let e=new Uint8Array(i),t="";for(let r of e)t+=Id[r>>4]+Id[r&15];return t},"hexFromBuffer"),Md=o(async i=>{let e=Ga.encode(i);return await globalThis.crypto.subtle.digest("SHA-256",e)},"sha256"),gr=o(async(i,e)=>{let t=await globalThis.crypto.subtle.importKey("raw",typeof i=="string"?Ga.encode(i):i,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),r=Ga.encode(e);return await globalThis.crypto.subtle.sign("HMAC",t,r)},"hmac"),o0={""":'"',"'":"'","<":"<",">":">","&":"&"},Dd=o(i=>i.replaceAll(/&(quot|apos|lt|gt|amp);/g,e=>o0[e]??e),"unescapeXml"),Fi=o(i=>{let e=i.replace(/<\?xml[^?]*\?>\s*/,""),t=/<([A-Za-z_][\w\-.]*)[^>]*>([\s\S]*?)<\/\1>/gm,r={},s;for(;(s=t.exec(e))!==null;){let n=s[1],a=s[2],l=a?Fi(a):Dd(a?.trim()||"");if(!n)continue;let c=r[n];c===void 0?r[n]=l:Array.isArray(c)?c.push(l):r[n]=[c,l]}return Object.keys(r).length>0?r:Dd(e.trim())},"parseXml"),n0=o(i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`,"encodeAsHex"),a0=o(i=>encodeURIComponent(i).replace(/[!'()*]/g,n0),"uriEscape"),Ld=o(i=>a0(i).replaceAll("%2F","/"),"uriResourceEscape"),$o=class extends Error{static{o(this,"S3Error")}code;constructor(e,t,r){super(e),this.name=new.target.name,this.code=t,this.cause=r}},Vo=class extends $o{static{o(this,"S3NetworkError")}},Wo=class extends $o{static{o(this,"S3ServiceError")}status;serviceCode;body;constructor(e,t,r,s){super(e,r),this.status=t,this.serviceCode=r,this.body=s}};var Ja=class extends qo{static{o(this,"S3Companion")}companionEndpoint;constructor({companionEndpoint:e,requestAbortTimeout:t}){super({requestAbortTimeout:t}),this.companionEndpoint=e}async _fetch(e,t){let r=await fetch(`${this.companionEndpoint}/s3${e}`,t);if(!r.ok)throw new Error(`Companion request failed: ${r.statusText}`);return r}async _request({url:e,method:t,data:r,onProgress:s,signal:n,contentType:a}){return await this.waitForOnline(n),this.xhr({url:e,method:t,data:r,onProgress:s,signal:n,contentType:a})}async putObject({key:e,data:t,fileType:r=hr,metadata:s={},onProgress:n,signal:a}){let l=new URLSearchParams({filename:e,type:r,...Object.fromEntries(Object.entries(s).map(([S,P])=>[`metadata[${S}]`,String(P)]))}),c=await this._fetch(`/params?${l}`),{url:p,fields:h}=await c.json(),g=new FormData;Object.entries(h).forEach(([S,P])=>{g.set(S,P)}),g.set("file",t);let y=await this._request({url:p,method:"POST",data:g,onProgress:n,signal:a});return{location:`${p}${h.key}`,etag:mr(y.getResponseHeader("etag")),key:h.key}}async createMultipartUpload({key:e,fileType:t=hr,metadata:r,signal:s}){if(typeof t!="string")throw new TypeError(`${rt}fileType must be a string`);let a=await this._fetch("/multipart",{method:"POST",body:JSON.stringify({filename:e,metadata:r,type:t}),headers:{"content-type":"application/json"},signal:s}),{key:l,uploadId:c}=await a.json();if(c==null)throw new Error("No uploadId returned");if(l==null)throw new Error("No key returned");return{uploadId:c,key:l}}async uploadPart({key:e,uploadId:t,data:r,partNumber:s,onProgress:n,signal:a}){let l=await this._fetch(`/multipart/${encodeURIComponent(t)}/${encodeURIComponent(s)}?${new URLSearchParams({key:e})}`,{method:"GET",signal:a}),{url:c}=await l.json(),p=await this._request({url:c,method:"PUT",data:r,onProgress:n,signal:a}),h=mr(p.getResponseHeader("etag"));if(h==null)throw new Error(`${rt}Missing ETag in uploadPart response headers`);return{etag:h}}async listParts({uploadId:e,key:t,signal:r}){if(!e)throw new TypeError(fr);return(await(await this._fetch(`/multipart/${encodeURIComponent(e)}?${new URLSearchParams({key:t})}`,{method:"GET",signal:r})).json()).map(a=>({partNumber:parseInt(String(a.PartNumber),10),etag:String(a.ETag)}))}async completeMultipartUpload({key:e,uploadId:t,parts:r,signal:s}){let n=await this._fetch(`/multipart/${encodeURIComponent(t)}/complete?${new URLSearchParams({key:e})}`,{method:"POST",body:JSON.stringify({parts:r.map(p=>({PartNumber:p.partNumber,ETag:p.etag}))}),headers:{"content-type":"application/json"},signal:s}),{location:a,bucket:l,key:c}=await n.json();return{location:a,bucket:l,key:c}}async abortMultipartUpload({key:e,uploadId:t,signal:r}){await this._fetch(`/multipart/${encodeURIComponent(t)}?${new URLSearchParams({key:e})}`,{method:"DELETE",signal:r})}},Bd=Ja;var u0=3600;function c0(i){let{accessKeyId:e,secretAccessKey:t,sessionToken:r,region:s,endpoint:n,service:a="s3"}=i,l=null,c=null;async function p(h){let g=await gr(`AWS4${t}`,h),y=await gr(g,s),S=await gr(y,a);return gr(S,Ho)}return o(p,"getSignatureKey"),o(async function(g){let{method:y,key:S,expiresIn:P=u0}=g,F=new URL(n),D=S?S.replace(/^\/+/,""):"",q=D?Ld(D):"",R=F.pathname;q&&(R=R.endsWith("/")?`${R}${q}`:`${R}/${q}`);let C=new Date,j=C.toISOString().slice(0,10).replace(/-/g,""),W=`${j}T${C.toISOString().slice(11,19).replace(/:/g,"")}Z`,B=`${e}/${j}/${s}/${a}/${Ho}`;F.searchParams.set("X-Amz-Algorithm",qa),F.searchParams.set("X-Amz-Content-Sha256",$a),F.searchParams.set("X-Amz-Credential",B),F.searchParams.set("X-Amz-Date",W),F.searchParams.set("X-Amz-Expires",String(P)),F.searchParams.set("X-Amz-SignedHeaders","host"),r&&F.searchParams.set("X-Amz-Security-Token",r),"uploadId"in g&&F.searchParams.set("uploadId",g.uploadId),"partNumber"in g&&F.searchParams.set("partNumber",String(g.partNumber)),y==="POST"&&!("uploadId"in g)&&F.searchParams.set("uploads",""),F.searchParams.sort();let Q=F.searchParams.toString().replace(/\+/g,"%20"),K=`host:${F.host}`,ne=[y,R,Q,K,"","host",$a].join(`
`),le=`${j}/${s}/${a}/${Ho}`,Fe=[qa,W,le,Ka(await Md(ne))].join(`
`);(j!==l||!c)&&(l=j,c=await p(j));let be=Ka(await gr(c,Fe));return{url:`${F.origin}${R}?${Q}&X-Amz-Signature=${be}`}},"presign")}o(c0,"createSigV4Presigner");var jd=c0;var Qa=class extends qo{static{o(this,"S3mini")}endpoint;region;requestSizeInBytes;getCredentials;cachedCredentials;cachedCredentialsPromise;signRequest;constructor({region:e="auto",requestSizeInBytes:t=8388608,requestAbortTimeout:r,...s}){if(super({requestAbortTimeout:r}),"signRequest"in s){let{signRequest:n}=s;if(!n)throw new TypeError("Either signRequest or getCredentials must be provided");if(n&&typeof n!="function")throw new TypeError("signRequest must be a function");this.signRequest=n}else if("getCredentials"in s){let{getCredentials:n,endpoint:a}=s;if(typeof a!="string"||a.trim().length===0)throw new TypeError(Ad);if(n&&typeof n!="function")throw new TypeError("getCredentials must be a function");this.endpoint=new URL(this._ensureValidUrl(a)),this.getCredentials=n,this.signRequest=this._createCredentialBasedSigner()}else throw new TypeError("Either signRequest or getCredentials must be provided");this.region=e,this.requestSizeInBytes=t}_createCredentialBasedSigner(){return async e=>{let t=await this._getCachedCredentials();if(this.endpoint==null)throw new Error("Endpoint is required for credential-based signing");return jd({accessKeyId:t.credentials.accessKeyId,secretAccessKey:t.credentials.secretAccessKey,sessionToken:t.credentials.sessionToken,region:t.region||this.region,endpoint:this.endpoint.toString()})(e)}}async _getCachedCredentials(){return this.cachedCredentials!=null?this.cachedCredentials:(this.cachedCredentialsPromise==null&&(this.cachedCredentialsPromise=(async()=>{try{let e=await this.getCredentials({});return this.cachedCredentials=e,e}finally{this.cachedCredentialsPromise=void 0}})()),this.cachedCredentialsPromise)}_ensureValidUrl(e){let t=/^(https?:)?\/\//i.test(e)?e:`https://${e}`;try{new URL(t);let r=t.length;for(;r>0&&t[r-1]==="/";)r--;return r===t.length?t:t.substring(0,r)}catch{let r=`${Ud} But provided: "${e}"`;throw new TypeError(r)}}_checkKey(e){if(typeof e!="string"||e.trim().length===0)throw new TypeError(Od)}_validateUploadPartParams(e,t,r){if(this._checkKey(e),typeof t!="string"||t.trim().length===0)throw new TypeError(fr);if(!Number.isInteger(r)||r<=0)throw new TypeError(`${rt}partNumber must be a positive integer`)}async putObject({key:e,data:t,fileType:r=hr,onProgress:s,signal:n}){this._checkKey(e);let{xhr:a,url:l,signedKey:c}=await this.request({request:{method:"PUT",key:e},data:t,onProgress:s,signal:n,contentType:r});return{location:Nd(l),etag:mr(a.getResponseHeader("etag")),key:c}}async createMultipartUpload({key:e,fileType:t=hr,signal:r}){if(this._checkKey(e),typeof t!="string")throw new TypeError(`${rt}fileType must be a string`);let{xhr:s,signedKey:n}=await this.request({request:{method:"POST",key:e},contentType:t,signal:r}),a=Fi(s.responseText);if(a&&typeof a=="object"){let l=a.initiateMultipartUploadResult||a.InitiateMultipartUploadResult;if(l&&typeof l=="object"){let c=l.uploadId||l.UploadId;if(c&&typeof c=="string")return{uploadId:c,key:n}}}throw new Error(`${rt}Failed to create multipart upload: ${JSON.stringify(a)}`)}async uploadPart({key:e,uploadId:t,data:r,partNumber:s,onProgress:n,signal:a}){this._validateUploadPartParams(e,t,s);let{xhr:l}=await this.request({request:{method:"PUT",key:e,uploadId:t,partNumber:s},data:r,onProgress:n,signal:a}),c=mr(l.getResponseHeader("etag"));if(c==null)throw new Error(`${rt}Missing ETag in uploadPart response headers`);return{etag:c}}async request({request:e,data:t,onProgress:r,signal:s,contentType:n,shouldRetryCredentials:a=!0}){if(await this.waitForOnline(s),s?.aborted)throw new DOMException("Request aborted","AbortError");try{let{url:l,key:c}=await this.signRequest(e);return{xhr:await this.xhr({url:l,method:e.method,data:t,onProgress:r,signal:s,contentType:n}),url:l,signedKey:c||e.key}}catch(l){if(l instanceof Error&&"request"in l&&l.request instanceof XMLHttpRequest){let c=l.request;if(c.status===0)throw new Vo("Network error during S3 request","NETWORK",l);let p=this._parseErrorXml(g=>c.getResponseHeader(g),c.responseText),h=c.getResponseHeader("x-amz-error-code")??p.svcCode;if(a&&this.getCredentials!=null&&h!=null&&["ExpiredToken","InvalidAccessKeyId"].includes(h))return this.clearCachedCredentials(),this.request({request:e,data:t,onProgress:r,signal:s,contentType:n,shouldRetryCredentials:!1});throw new Wo(`S3 returned ${c.status}${h?` \u2013 ${h}`:""}`,c.status,h,c.responseText)}throw l}}async listParts({uploadId:e,key:t,signal:r}){if(this._checkKey(t),!e)throw new TypeError(fr);let{xhr:s}=await this.request({request:{method:"GET",key:t,uploadId:e},signal:r}),n=Fi(s.responseText),a=n.listPartsResult||n.ListPartsResult||n;if(a&&typeof a=="object"){let l=a.Part||a.part||[];return(Array.isArray(l)?l:[l]).filter(p=>p!=null&&typeof p=="object"&&"PartNumber"in p&&"ETag"in p).map(p=>({partNumber:parseInt(String(p.PartNumber),10),etag:Xa(String(p.ETag))}))}return[]}async completeMultipartUpload({key:e,uploadId:t,parts:r,signal:s}){let n=this._buildCompleteMultipartUploadXml(r),{xhr:a}=await this.request({request:{method:"POST",key:e,uploadId:t},contentType:Rd,data:n,signal:s}),l=Fi(a.responseText);if(l&&typeof l=="object"){let c=l.completeMultipartUploadResult||l.CompleteMultipartUploadResult||l;if(c&&typeof c=="object"){let p=c,h=p.Location||p.location,g=p.Bucket||p.bucket,y=p.Key||p.key,S=p.ETag||p.eTag||p.etag;if(!h||!y)throw new Error(`${rt}CompleteMultipartUpload response missing Location or Key: ${JSON.stringify(p)}`);let P=S?Xa(S):void 0;return{location:h,bucket:g,key:y,etag:P}}}throw new Error(`${rt}Failed to complete multipart upload: ${JSON.stringify(l)}`)}async abortMultipartUpload({key:e,uploadId:t,signal:r}){if(this._checkKey(e),!t)throw new TypeError(fr);let{xhr:s}=await this.request({request:{method:"DELETE",key:e,uploadId:t},signal:r}),n=Fi(s.responseText);if(n&&"error"in n&&typeof n.error=="object"&&n.error!==null&&"message"in n.error)throw new Error(`${rt}Failed to abort multipart upload: ${String(n.error.message)}`)}_buildCompleteMultipartUploadXml(e){let t="<CompleteMultipartUpload>";for(let r of e)t+=`<Part><PartNumber>${r.partNumber}</PartNumber><ETag>${r.etag}</ETag></Part>`;return t+="</CompleteMultipartUpload>",t}async deleteObject({key:e,signal:t}){let{xhr:r}=await this.request({request:{method:"DELETE",key:e},signal:t});if(r.status!==200&&r.status!==204)throw new Error(`${rt}Failed to delete object. HTTP status: ${r.status}`)}clearCachedCredentials(){this.cachedCredentials=void 0,this.cachedCredentialsPromise=void 0}_parseErrorXml(e,t){if(e("content-type")!=="application/xml")return{};let r=Fi(t);if(!r||typeof r!="object"||!("Error"in r)||!r.Error||typeof r.Error!="object")return{};let s=r.Error;return{svcCode:"Code"in s&&typeof s.Code=="string"?s.Code:void 0,errorMessage:"Message"in s&&typeof s.Message=="string"?s.Message:void 0}}};var Za=Qa;var zd=1024*1024,d0={shouldUseMultipart:o(i=>(i.size||0)>100*zd,"shouldUseMultipart"),allowedMetaFields:!0,limit:6},Go=class extends Pe{static{o(this,"AwsS3")}static VERSION=Cd.version;#e;#t;#i={};constructor(e,t){super(e,{...d0,...t}),this.type="uploader",this.id=this.opts.id||"AwsS3"}install(){this.#r(!0),this.#o(),this.#t=new _i({concurrency:this.opts.limit}),this.uppy.addUploader(this.#n),this.uppy.on("cancel-all",this.#s)}uninstall(){this.#r(!1),this.uppy.removeUploader(this.#n),this.uppy.off("cancel-all",this.#s),this.#t.clear();for(let e of Object.keys(this.#i)){let t=this.#i[e];t&&t.abort()}}#r=o(e=>{let{capabilities:t}=this.uppy.getState();this.uppy.setState({capabilities:{...t,resumableUploads:e}})},"#setResumableUploadsCapability");#s=o(()=>{this.#r(!0),this.#t.clear()},"#handleCancelAll");#o(){if("companionEndpoint"in this.opts){if(typeof this.opts.companionEndpoint!="string")throw new TypeError("companionEndpoint must be a string");this.#e=new Bd({companionEndpoint:this.opts.companionEndpoint})}else if("getCredentials"in this.opts){if(typeof this.opts.s3Endpoint!="string")throw new TypeError("s3Endpoint must be a string");if(typeof this.opts.getCredentials!="function")throw new TypeError("getCredentials must be a function");if(this.opts.region!=null&&typeof this.opts.region!="string")throw new TypeError("region must be a string");this.#e=new Za({endpoint:this.opts.s3Endpoint,getCredentials:this.opts.getCredentials,region:this.opts.region})}else if("signRequest"in this.opts){if(typeof this.opts.signRequest!="function")throw new TypeError("signRequest must be a function");this.#e=new Za({signRequest:this.opts.signRequest})}else throw new TypeError("One of options `companionEndpoint`, `signRequest`, or `getCredentials` is required")}#n=o(async e=>{if(e.length===0)return;let t=this.uppy.getFilesByIds(e),r=wi(t),s=Si(r);this.uppy.emit("upload-start",s);let n=r.map(a=>a.isRemote?this.#h(a):this.#t.add(async()=>{let l=this.uppy.getFile(a.id);if(l)return this.#a(l)}));await Promise.allSettled(n),this.#r(!0)},"#upload");async#a(e){try{return await new Promise((t,r)=>{let s=new us({uppy:this.uppy,s3Client:this.#e,file:e,metadata:this.#c(e),key:this.#l(e),shouldUseMultipart:this.#u(e),getChunkSize:this.opts.getChunkSize,log:o((...n)=>this.uppy.log(...n),"log"),onProgress:o((n,a)=>{this.uppy.emit("upload-progress",e,{uploadStarted:e.progress.uploadStarted??Date.now(),bytesUploaded:n,bytesTotal:a})},"onProgress"),onPartComplete:o(n=>{this.uppy.emit("s3-multipart:part-uploaded",e,n)},"onPartComplete"),onSuccess:o(n=>{this.uppy.emit("upload-success",e,{status:200,body:{location:n.location,key:n.key},uploadURL:n.location}),t()},"onSuccess"),onError:o(n=>{this.uppy.emit("upload-error",e,n),r(n)},"onError"),onAbort:o(()=>{t()},"onAbort")});this.#i[e.id]=s,s.start()})}finally{delete this.#i[e.id]}}#u(e){let{shouldUseMultipart:t}=this.opts;return typeof t=="function"?t(e):typeof t=="boolean"?t:(e.size??0)>100*zd}#l(e){return"companionEndpoint"in this.opts?e.name:this.opts.generateObjectKey?.(e)??`${crypto.randomUUID()}-${e.name}`}#c(e){let t=Vt(this.opts.allowedMetaFields,e.meta);return Object.fromEntries(t.map(r=>[r,e.meta[r]]))}#p(e){return{...e.remote.body,protocol:"s3-multipart",size:e.data.size,metadata:this.#c(e)}}async#h(e){this.#r(!1);let t=new AbortController,r=o(s=>{s.id===e.id&&t.abort()},"removedHandler");this.uppy.on("file-removed",r);try{await this.uppy.getRequestClientForFile(e).uploadRemoteFile(e,this.#p(e),{signal:t.signal,getQueue:o(()=>this.#t,"getQueue")})}finally{this.uppy.off("file-removed",r)}}};var Hd={name:"@uppy/box",description:"Import files from Box, into Uppy.",version:"5.0.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:{preact:"^10.29.2"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^6.0.3"}};var qd={strings:{pluginNameBox:"Box"}};var Ri=class extends ae{static{o(this,"Box")}static VERSION=Hd.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||Re,this.files=[],this.icon=()=>u("svg",{className:"uppy-DashboardTab-iconBox","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:u("g",{fill:"currentcolor",fillRule:"nonzero",children:[u("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"}),u("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=Xe(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new Ke(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=qd,this.i18nInit(),this.title=this.i18n("pluginNameBox"),this.render=this.render.bind(this)}install(){this.view=new We(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 Wd=he($d(),1);var Vd={strings:{compressingImages:"Compressing images...",compressedX:"Saved %{size} by compressing images"}};var f0={quality:.6,limit:10},Xo=class extends Pe{static{o(this,"Compressor")}#e;constructor(e,t){super(e,{...f0,...t}),this.id=this.opts.id||"Compressor",this.type="modifier",this.defaultLocale=Vd,this.#e=new Wt(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 Wd.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 l=await this.compress(a.data),c=a.data.size-l.size;this.uppy.log(`[Image Compressor] Image ${a.id} compressed by ${tt(c)}`),t+=c;let{name:p,type:h,size:g}=l,y=Tt(p),P=`${Tt(a.meta.name).name}.${y.extension}`;this.uppy.setFileState(a.id,{...p&&{name:p},...y.extension&&{extension:y.extension},...h&&{type:h},...g&&{size:g},data:l,meta:{...a.meta,type:h,name:P}}),r.push(a)}catch(l){this.uppy.log(`[Image Compressor] Failed to compress ${a.id}:`,"warning"),this.uppy.log(l,"warning")}}),n=e.map(a=>{let l=this.uppy.getFile(a);return this.uppy.emit("preprocess-progress",l,{mode:"indeterminate",message:this.i18n("compressingImages")}),l.isRemote||(l.data.type||(l.data=l.data.slice(0,l.data.size,l.type)),!l.type?.startsWith("image/"))?Promise.resolve():s(l)});await Promise.all(n),this.uppy.emit("compressor:complete",r),t>1024&&this.uppy.info(this.i18n("compressedX",{size:tt(t)}),"info");for(let a of e){let l=this.uppy.getFile(a);this.uppy.emit("preprocess-complete",l)}}install(){this.uppy.addPreProcessor(this.prepareUpload)}uninstall(){this.uppy.removePreProcessor(this.prepareUpload)}};function ve(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}o(ve,"e");var th=typeof self<"u"?self:global,hs=typeof navigator<"u",m0=hs&&typeof HTMLImageElement>"u",Gd=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),ih=th.Buffer,rh=!!ih,g0=o(i=>i!==void 0,"h");function sh(i){return i===void 0||(i instanceof Map?i.size===0:Object.values(i).filter(g0).length===0)}o(sh,"f");function Ge(i){let e=new Error(i);throw delete e.stack,e}o(Ge,"l");function Xd(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(Xd,"o");var il=o(i=>String.fromCharCode.apply(null,i),"u"),Kd=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0,Ui=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&&Ge("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 Ge("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||Ge("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),Kd?Kd.decode(s):rh?Buffer.from(s).toString("utf8"):decodeURIComponent(escape(il(s)));var s}getLatin1String(e=0,t=this.byteLength){let r=this.getUint8Array(e,t);return il(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 il(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 sl(i,e){Ge(`${i} '${e}' was not loaded, try using full build of exifr.`)}o(sl,"p");var fs=class extends Map{static{o(this,"g")}constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||sl(this.kind,e),t&&(e in t||(function(r,s){Ge(`Unknown ${r} '${s}'.`)})(this.kind,e),t[e].enabled||sl(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}},Zo=new fs("file parser"),mt=new fs("segment parser"),ys=new fs("file reader"),y0=th.fetch;function Yd(i,e){return(t=i).startsWith("data:")||t.length>1e4?nl(i,e,"base64"):Gd&&i.includes("://")?ol(i,e,"url",Ko):Gd?nl(i,e,"fs"):hs?ol(i,e,"url",Ko):void Ge("Invalid input argument");var t}o(Yd,"k");async function ol(i,e,t,r){return ys.has(t)?nl(i,e,t):r?(async function(s,n){let a=await n(s);return new Ui(a)})(i,r):void Ge(`Parser ${t} is not loaded`)}o(ol,"O");async function nl(i,e,t){let r=new(ys.get(t))(i,e);return await r.read(),r}o(nl,"v");var Ko=o(i=>y0(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"),al=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 oh(i,e,t){let r=new al;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(oh,"x");function nh(i,e,t){let r,s=i.get(e);for(r of t)s.set(r[0],r[1])}o(nh,"C");var vs=new Map,dl=new Map,hl=new Map,yr=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],en=["jfif","xmp","icc","iptc","ihdr"],gs=["tiff",...en],Me=["ifd0","ifd1","exif","gps","interop"],vr=[...gs,...Me],br=["makerNote","userComment"],tn=["translateKeys","translateValues","reviveValues","multiSegment"],wr=[...tn,"sanitize","mergeOutput","silentErrors"],Yo=class{static{o(this,"_")}get translate(){return this.translateKeys||this.translateValues||this.reviveValues}},Ai=class extends Yo{static{o(this,"D")}get needed(){return this.enabled||this.deps.size>0}constructor(e,t,r,s){if(super(),ve(this,"enabled",!1),ve(this,"skip",new Set),ve(this,"pick",new Set),ve(this,"deps",new Set),ve(this,"translateKeys",!1),ve(this,"translateValues",!1),ve(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:Ge(`Invalid options argument: ${r}`)}applyInheritables(e){let t,r;for(t of tn)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,Jo(this.pick,this.deps)):this.enabled&&this.pick.size>0&&Jo(this.pick,this.deps)}},lt={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},Jd=new Map,Oi=class extends Yo{static{o(this,"R")}static useCached(e){let t=Jd.get(e);return t!==void 0||(t=new this(e),Jd.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):Ge(`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 yr)this[e]=lt[e];for(e of wr)this[e]=lt[e];for(e of br)this[e]=lt[e];for(e of vr)this[e]=new Ai(e,lt[e],void 0,this)}setupFromTrue(){let e;for(e of yr)this[e]=lt[e];for(e of wr)this[e]=lt[e];for(e of br)this[e]=!0;for(e of vr)this[e]=new Ai(e,!0,void 0,this)}setupFromArray(e){let t;for(t of yr)this[t]=lt[t];for(t of wr)this[t]=lt[t];for(t of br)this[t]=lt[t];for(t of vr)this[t]=new Ai(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),yr))this[t]=rl(e[t],lt[t]);for(t of wr)this[t]=rl(e[t],lt[t]);for(t of br)this[t]=rl(e[t],lt[t]);for(t of gs)this[t]=new Ai(t,lt[t],e[t],this);for(t of Me)this[t]=new Ai(t,lt[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,Me,vr),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=Qd(e,r);for(let[a,l]of n)Jo(this[a].pick,l),this[a].enabled=!0}else if(t&&t.length){let n=Qd(t,r);for(let[a,l]of n)Jo(this[a].skip,l)}}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!en.map((e=>this[e].enabled)).some((e=>e===!0))&&this.tiff.enabled}checkLoadedPlugins(){for(let e of gs)this[e].enabled&&!mt.has(e)&&sl("segment parser",e)}};function Qd(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(Qd,"K");function rl(i,e){return i!==void 0?i:e!==void 0?e:void 0}o(rl,"W");function Jo(i,e){for(let t of e)i.add(t)}o(Jo,"X");ve(Oi,"default",lt);var Sr=class{static{o(this,"H")}constructor(e){ve(this,"parsers",{}),ve(this,"output",{}),ve(this,"errors",[]),ve(this,"pushToErrors",(t=>this.errors.push(t))),this.options=Oi.useCached(e)}async read(e){this.file=await(function(t,r){return typeof t=="string"?Yd(t,r):hs&&!m0&&t instanceof HTMLImageElement?Yd(t.src,r):t instanceof Uint8Array||t instanceof ArrayBuffer||t instanceof DataView?new Ui(t):hs&&t instanceof Blob?ol(t,r,"blob",ms):void Ge("Invalid input argument")})(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[r,s]of Zo)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(),Ge("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),sh(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),l=await a.extractThumbnail();return t.close&&t.close(),l}};async function ah(i,e){let t=new Sr(e);return await t.read(i),t.parse()}o(ah,"Y");var v0=Object.freeze({__proto__:null,parse:ah,Exifr:Sr,fileParsers:Zo,segmentParsers:mt,fileReaders:ys,tagKeys:vs,tagValues:dl,tagRevivers:hl,createDictionary:oh,extendDictionary:nh,fetchUrlAsArrayBuffer:Ko,readBlobAsArrayBuffer:ms,chunkedProps:yr,otherSegments:en,segments:gs,tiffBlocks:Me,segmentsAndBlocks:vr,tiffExtractables:br,inheritables:tn,allFormatters:wr,Options:Oi}),ui=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 Oi({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof Ui?e:new Ui(e)}constructor(e,t={},r){ve(this,"errors",[]),ve(this,"raw",new Map),ve(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=hl.get(t),s=dl.get(t),n=vs.get(t),a=this.options[t],l=a.reviveValues&&!!r,c=a.translateValues&&!!s,p=a.translateKeys&&!!n,h={};for(let[g,y]of e)l&&r.has(g)?y=r.get(g)(y):c&&s.has(g)&&(y=this.translateValue(y,s.get(g))),p&&n.has(g)&&(g=n.get(g)||g),h[g]=y;return h}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}};ve(ui,"headerLength",4),ve(ui,"type",void 0),ve(ui,"multiSegment",!1),ve(ui,"canHandle",(()=>!1));function b0(i){return i===192||i===194||i===196||i===219||i===221||i===218||i===254}o(b0,"q");function w0(i){return i>=224&&i<=239}o(w0,"Q");function S0(i,e,t){for(let[r,s]of mt)if(s.canHandle(i,e,t))return r}o(S0,"Z");var Qo=class extends class{constructor(e,t,r){ve(this,"errors",[]),ve(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(l){Ge(`Couldn't read segment: ${JSON.stringify(s)}. ${l.message}`)}else this.file.byteLength>n+a?s.chunk=this.file.subarray(n,a):s.size===void 0?s.chunk=this.file.subarray(n):Ge("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),ve(this,"appSegments",[]),ve(this,"jpegSegments",[]),ve(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((l=>{let c=mt.get(l),p=this.options[l];return c.multiSegment&&p.multiSegment})),s&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,r.byteLength),!this.options.onlyTiff&&r.chunked){let l=!1;for(;a.size>0&&!l&&(r.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:c}=r,p=this.appSegments.some((h=>!this.file.available(h.offset||h.start,h.length||h.size)));if(l=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,l,c,{file:p,findAll:h,wanted:g,remaining:y,options:S}=this;for(;e<t;e++)if(p.getUint8(e)===255){if(r=p.getUint8(e+1),w0(r)){if(s=p.getUint16(e+2),n=S0(p,e,s),n&&g.has(n)&&(a=mt.get(n),l=a.findPosition(p,e),c=S[n],l.type=n,this.appSegments.push(l),!h&&(a.multiSegment&&c.multiSegment?(this.unfinishedMultiSegment=l.chunkNumber<l.chunkCount,this.unfinishedMultiSegment||y.delete(n)):y.delete(n),y.size===0)))break;S.recordUnknownSegments&&(l=ui.findPosition(p,e),l.marker=r,this.unknownSegments.push(l)),e+=s+1}else if(b0(r)){if(s=p.getUint16(e+2),r===218&&S.stopAfterSos!==!1)return;S.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,l=new Map;for(let c=0;c<t.length;c++)s=t[c],n=s[r],l.has(n)?a=l.get(n):l.set(n,a=[]),a.push(s);return Array.from(l)})(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}};ve(Qo,"type","jpeg"),Zo.set("jpeg",Qo);var x0=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4],ll=class extends ui{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,l=n.size===0,c=this.chunk.getUint16(e);e+=2;for(let p=0;p<c;p++){let h=this.chunk.getUint16(e);if(a){if(s.has(h)&&(r.set(h,this.parseTag(e,h,t)),s.delete(h),s.size===0))break}else!l&&n.has(h)||r.set(h,this.parseTag(e,h,t));e+=12}return r}parseTag(e,t,r){let{chunk:s}=this,n=s.getUint16(e+2),a=s.getUint32(e+4),l=x0[n];if(l*a<=4?e+=8:e=s.getUint32(e+8),(n<1||n>13)&&Ge(`Invalid TIFF value type. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e}`),e>s.byteLength&&Ge(`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(g){switch(g){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),h=l;for(let g=0;g<a;g++)p[g]=this.parseTagValue(n,e),e+=h;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:Ge(`Invalid tiff type ${e}`)}}},ds=class extends ll{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&&Ge("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&Ge(`IFD0 offset points to outside of file.
this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,Xd(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,Xd(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",Zd(...e.get(2),e.get(1))),e.set("longitude",Zd(...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],!sh(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 Zd(i,e,t,r){var s=i+e/60+t/3600;return r!=="S"&&r!=="W"||(s*=-1),s}o(Zd,"ne");ve(ds,"type","tiff"),ve(ds,"headerLength",10),mt.set("tiff",ds);var SF=Object.freeze({__proto__:null,default:v0,Exifr:Sr,fileParsers:Zo,segmentParsers:mt,fileReaders:ys,tagKeys:vs,tagValues:dl,tagRevivers:hl,createDictionary:oh,extendDictionary:nh,fetchUrlAsArrayBuffer:Ko,readBlobAsArrayBuffer:ms,chunkedProps:yr,otherSegments:en,segments:gs,tiffBlocks:Me,segmentsAndBlocks:vr,tiffExtractables:br,inheritables:tn,allFormatters:wr,Options:Oi,parse:ah}),fl={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1},xF=Object.assign({},fl,{firstChunkSize:4e4,gps:[1,2,3,4]});var _F=Object.assign({},fl,{tiff:!1,ifd1:!0,mergeOutput:!1});var _0=Object.assign({},fl,{firstChunkSize:4e4,ifd0:[274]});async function E0(i){let e=new Sr(_0);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}o(E0,"ce");var P0=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 lh(i){let e=await E0(i);return Object.assign({canvas:cs,css:ps},P0[e])}o(lh,"ye");var ul=class extends Ui{static{o(this,"be")}constructor(...e){super(...e),ve(this,"ranges",new cl),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=rh?ih.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)}},cl=class{static{o(this,"we")}constructor(){ve(this,"list",[])}get length(){return this.list.length}add(e,t,r=0){let s=e+t,n=this.list.filter((a=>eh(e,a.offset,s)||eh(e,a.end,s)));if(n.length>0){e=Math.min(e,...n.map((l=>l.offset))),s=Math.max(s,...n.map((l=>l.end))),t=s-e;let a=n.shift();a.offset=e,a.length=t,a.end=s,this.list=this.list.filter((l=>!n.includes(l)))}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 eh(i,e,t){return i<=e&&e<=t}o(eh,"ke");var pl=class extends ul{static{o(this,"Oe")}constructor(e,t){super(0),ve(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 pl{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 uh={name:"@uppy/thumbnail-generator",description:"Uppy plugin that generates small previews of images to show on your upload UI.",version:"6.0.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --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:{exifr:"^7.1.3"},devDependencies:{"@vitest/browser-playwright":"^4.1.6","namespace-emitter":"2.0.1",playwright:"1.61.1",typescript:"^6.0.3",vitest:"^4.1.6"},peerDependencies:{"@uppy/core":"workspace:^"}};var ch={strings:{generatingThumbnails:"Generating thumbnails..."}};function k0(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(()=>zn(i.toDataURL(e,t),{})).then(r=>{if(r===null)throw new Error("could not extract blob, probably an old browser");return r})}o(k0,"canvasToBlob");function C0(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(C0,"rotateImage");function F0(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(F0,"protect");var R0={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1},xr=class extends ae{static{o(this,"ThumbnailGenerator")}static VERSION=uh.version;queue;queueProcessing;defaultThumbnailDimension;thumbnailType;constructor(e,t){if(super(e,{...R0,...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=ch,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((l,c)=>{let p=new Image;p.src=s,p.addEventListener("load",()=>{URL.revokeObjectURL(s),l(p)}),p.addEventListener("error",h=>{URL.revokeObjectURL(s),c(h.error||new Error("Could not create thumbnail"))})}),a=lh(e.data).catch(()=>1);return Promise.all([n,a]).then(([l,c])=>{let p=this.getProportionalDimensions(l,t,r,c.deg),h=C0(l,c),g=this.resizeImage(h,p.width,p.height);return k0(g,this.thumbnailType,80)}).then(l=>URL.createObjectURL(l))}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=F0(e),n=Math.ceil(Math.log2(s.width/t));n<1&&(n=1);let a=t*2**(n-1),l=r*2**(n-1),c=2;for(;n--;){let p=document.createElement("canvas");p.width=a,p.height=l,p.getContext("2d").drawImage(s,0,0,a,l),s=p,a=Math.round(a/c),l=Math.round(l/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 Gr(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&&Gr(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&&Wr(e.preview)&&URL.revokeObjectURL(e.preview)},"onFileRemoved");onRestored=o(()=>{this.uppy.getFiles().filter(t=>t.isRestored).forEach(t=>{(!t.preview||Wr(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 ph={name:"@uppy/dashboard",description:"Universal UI plugin for Uppy.",version:"6.0.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'"},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":"^2.0.0","@uppy/thumbnail-generator":"workspace:^",classnames:"^2.5.1",lodash:"^4.18.1",nanoid:"^5.1.11",preact:"^10.29.2","shallow-equal":"^3.1.0"},devDependencies:{"@uppy/core":"workspace:^","@uppy/dropbox":"workspace:^","@uppy/google-drive":"workspace:^","@uppy/url":"workspace:^","@uppy/webcam":"workspace:^","@vitest/browser-playwright":"^4.1.6",cssnano:"^8.0.1",playwright:"1.61.1",postcss:"^8.5.23","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^6.0.3",vitest:"^4.1.6"},peerDependencies:{"@uppy/core":"workspace:^"}};var $h=he(Ve(),1);var ml=class extends de{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)=>u("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 u("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(()=>{let e=this.props.fileManagerSelectionType==="folders"?this.triggerFolderInputClick:this.triggerFileInputClick;return u("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MyDevice",children:u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:e,children:[u("div",{className:"uppy-DashboardTab-inner",children:u("svg",{className:"uppy-DashboardTab-iconMyDevice","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:u("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"})})}),u("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("myDevice")})]})})},"renderMyDeviceAcquirer");renderPhotoCamera=o(()=>u("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobilePhotoCamera",children:u("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:[u("div",{className:"uppy-DashboardTab-inner",children:u("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:u("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"})})}),u("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("takePictureBtn")})]})}),"renderPhotoCamera");renderVideoCamera=o(()=>u("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobileVideoCamera",children:u("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:[u("div",{className:"uppy-DashboardTab-inner",children:u("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32",children:u("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 "})})}),u("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("recordVideoBtn")})]})}),"renderVideoCamera");renderBrowseButton=o((e,t)=>{let r=this.props.acquirers.length;return u("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 u("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=>u("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":e.id,children:u("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:[u("div",{className:"uppy-DashboardTab-inner",children:e.icon()}),u("div",{className:"uppy-DashboardTab-name",children:e.name})]})}),"renderAcquirer");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(h=>({key:h.id,elements:this.renderAcquirer(h)}))),n.length===1&&n[0].key===a&&(n=[]);let c=[...n],p=c.splice(n.length-2,n.length);return u(Ee,{children:[this.renderDropPasteBrowseTagline(n.length),u("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist",children:[c.map(({key:h,elements:g})=>u(Ee,{children:g},h)),u("span",{role:"presentation",style:{"white-space":"nowrap"},children:p.map(({key:h,elements:g})=>u(Ee,{children:g},h))})]})]})},"renderSourcesList");renderPoweredByUppy(){let{i18nArray:e}=this.props,t=u("span",{children:[u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11",children:u("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z",fillRule:"evenodd"})}),u("span",{className:"uppy-Dashboard-poweredByUppy",children:"Uppy"})]}),r=e("poweredBy",{uppy:t});return u("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 u("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),u("div",{className:"uppy-Dashboard-AddFiles-info",children:[this.props.note&&u("div",{className:"uppy-Dashboard-note",children:this.props.note}),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy()]})]})}},rn=ml;var dh=he(Ve(),1);var U0=o(i=>u("div",{className:(0,dh.default)("uppy-Dashboard-AddFilesPanel",i.className),"data-uppy-panelType":"AddFiles","aria-hidden":!i.showAddFilesPanel,children:[u("div",{className:"uppy-DashboardContent-bar",children:[u("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18n("addingMoreFiles")}),u("button",{className:"uppy-DashboardContent-back",type:"button",onClick:o(()=>i.toggleAddFilesPanel(!1),"onClick"),children:i.i18n("back")})]}),u(rn,{...i})]}),"AddFilesPanel"),hh=U0;var fh=he(Ve(),1);function O0(i){let e=i.fileCardFor?i.files[i.fileCardFor]:void 0;if(!e)return null;let t=o(()=>{i.uppy.emit("file-editor:cancel",e),i.closeFileEditor()},"handleCancel");return u("div",{className:(0,fh.default)("uppy-DashboardContent-panel",i.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor",children:[u("div",{className:"uppy-DashboardContent-bar",children:[u("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18nArray("editing",{file:u("span",{className:"uppy-DashboardContent-titleFile",children:e.meta?e.meta.name:e.name})})}),u("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:i.i18n("cancel")}),u("button",{className:"uppy-DashboardContent-save",type:"button",onClick:i.saveFileEditor,children:i.i18n("save")})]}),u("div",{className:"uppy-DashboardContent-panelBody",children:i.editors.map(r=>i.uppy.getPlugin(r.id).render(i.state))})]})}o(O0,"EditorPanel");var mh=O0;var gh=he(Ve(),1);function I0(){return u("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:u("g",{fill:"#686DE0",fillRule:"evenodd",children:[u("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"}),u("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"}),u("circle",{cx:"7.5",cy:"9.5",r:"1.5"})]})})}o(I0,"iconImage");function D0(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:u("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(D0,"iconAudio");function N0(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:u("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(N0,"iconVideo");function M0(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:u("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(M0,"iconPDF");function L0(){return u("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:u("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(L0,"iconArchive");function B0(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:u("g",{fill:"#A7AFB7",fillRule:"nonzero",children:[u("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"}),u("path",{d:"M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z"})]})})}o(B0,"iconFile");function j0(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:u("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(j0,"iconText");function Ii(i){let e={color:"#838999",icon:B0()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:j0()}:t==="image"?{color:"#686de0",icon:I0()}:t==="audio"?{color:"#068dbb",icon:D0()}:t==="video"?{color:"#19af67",icon:N0()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:M0()}: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:L0()}:e}o(Ii,"getIconByMime");function z0(i){let{tagName:e}=i.target;if(e==="INPUT"||e==="TEXTAREA"){i.stopPropagation();return}i.preventDefault(),i.stopPropagation()}o(z0,"ignoreEvent");var Nt=z0;function bs(i){let{file:e}=i;if(e.preview)return u("img",{draggable:!1,className:"uppy-Dashboard-Item-previewImg",alt:e.name,src:e.preview});let{color:t,icon:r}=Ii(e.type);return u("div",{className:"uppy-Dashboard-Item-previewIconWrap",children:[u("span",{className:"uppy-Dashboard-Item-previewIcon",style:{color:t},children:r}),u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-Dashboard-Item-previewIconBg",width:"58",height:"76",viewBox:"0 0 58 76",children:u("rect",{fill:"#FFF",width:"58",height:"76",rx:"3",fillRule:"evenodd"})})]})}o(bs,"FilePreview");function gl(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(l=>{let c=`uppy-Dashboard-FileCard-input-${l.id}`,p=t.includes(l.id);return u("fieldset",{className:"uppy-Dashboard-FileCard-fieldset",children:[u("label",{className:"uppy-Dashboard-FileCard-label",htmlFor:c,children:l.name}),l.render!==void 0?l.render({value:n[l.id],onChange:o(h=>r(h,l.id),"onChange"),fieldCSSClasses:a,required:p,form:s.id},Gt):u("input",{className:a.text,id:c,form:s.id,type:l.type||"text",required:p,value:n[l.id],placeholder:l.placeholder,onInput:o(h=>r(h.target.value,l.id),"onInput"),"data-uppy-super-focusable":!0})]},l.id)})}o(gl,"RenderMetaFields");function yl(i){let{files:e,fileCardFor:t,toggleFileCard:r,saveFileCard:s,metaFields:n,requiredMetaFields:a,openFileEditor:l,i18n:c,i18nArray:p,className:h,canEditFile:g}=i,y=o(()=>typeof n=="function"?n(e[t]):n,"getMetaFields"),S=e[t],P=y()??[],F=g(S),D={};P.forEach(K=>{D[K.id]=S.meta[K.id]??""});let[q,R]=ot(D),C=xt(K=>{K.preventDefault(),s(q,t)},[s,q,t]),j=o((K,ee)=>{R({...q,[ee]:K})},"updateMeta"),W=o(()=>{r(!1,t)},"handleCancel"),[B]=ot(()=>{let K=document.createElement("form");return K.setAttribute("tabindex","-1"),K.id=Ot(),K}),Q=et(null);return He(()=>{let K=Q.current?.getRootNode()??document;return K instanceof Document?K.body.appendChild(B):(K instanceof ShadowRoot,K.appendChild(B)),B.addEventListener("submit",C),()=>{B.removeEventListener("submit",C),B.parentNode&&B.parentNode.removeChild(B)}},[B,C]),u("div",{className:(0,gh.default)("uppy-Dashboard-FileCard",h),"data-uppy-panelType":"FileCard",onDragOver:Nt,onDragLeave:Nt,onDrop:Nt,onPaste:Nt,ref:Q,children:[u("div",{className:"uppy-DashboardContent-bar",children:[u("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:p("editing",{file:u("span",{className:"uppy-DashboardContent-titleFile",children:S.meta?S.meta.name:S.name})})}),u("button",{className:"uppy-DashboardContent-back",type:"button",form:B.id,title:c("finishEditingFile"),onClick:W,children:c("cancel")})]}),u("div",{className:"uppy-Dashboard-FileCard-inner",children:[u("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:Ii(S.type).color},children:[u(bs,{file:S}),F&&u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:o(K=>{C(K),l(S)},"onClick"),children:c("editImage")})]}),u("div",{className:"uppy-Dashboard-FileCard-info",children:u(gl,{computedMetaFields:P,requiredMetaFields:a,updateMeta:j,form:B,formState:q})}),u("div",{className:"uppy-Dashboard-FileCard-actions",children:[u("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn",type:"submit",form:B.id,children:c("saveChanges")}),u("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:W,form:B.id,children:c("cancel")})]})]})]})}o(yl,"FileCard");var bh=he(Ve(),1);function yh(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(yh,"shallowEqualObjects");function vl(i,e="Copy the URL below"){return new Promise(t=>{let r=document.createElement("textarea");r.style.position="fixed",r.style.top="0",r.style.left="0",r.style.width="2em",r.style.height="2em",r.style.padding="0",r.style.border="none",r.style.outline="none",r.style.boxShadow="none",r.style.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{if(!document.execCommand("copy"))return s();document.body.removeChild(r),t()}catch{return document.body.removeChild(r),s()}})}o(vl,"copyToClipboard");function H0({file:i,uploadInProgressOrComplete:e,metaFields:t,canEditFile:r,i18n:s,onClick:n}){return!e&&t&&t.length>0||!e&&r(i)?u("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:u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14",children:u("g",{fillRule:"evenodd",children:[u("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"}),u("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),u("path",{fillRule:"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})]})})}):null}o(H0,"EditButton");function q0({i18n:i,onClick:e,file:t}){return u("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:u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18",children:[u("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"}),u("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(q0,"RemoveButton");function $0({file:i,uppy:e,i18n:t}){let r=o(s=>{let{currentTarget:n}=s;vl(i.uploadURL,t("copyLinkToClipboardFallback")).then(()=>{e.log("Link copied to clipboard."),e.info(t("copyLinkToClipboardSuccess"),"info",3e3)}).catch(e.log).then(()=>n.focus({preventScroll:!0}))},"copyLinkToClipboard");return u("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:u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12",children:u("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($0,"CopyLinkButton");function bl(i){let{uppy:e,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,showLinkToFileUploadResult:a,showRemoveButton:l,i18n:c,toggleFileCard:p,openFileEditor:h}=i;return u("div",{className:"uppy-Dashboard-Item-actionWrapper",children:[u(H0,{i18n:c,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,onClick:o(()=>{n&&n.length>0?p(!0,t.id):h(t)},"editAction")}),a&&t.uploadURL?u($0,{file:t,uppy:e,i18n:c}):null,l?u(q0,{i18n:c,file:t,onClick:o(()=>e.removeFile(t.id),"onClick")}):null]})}o(bl,"Buttons");function V0(i,e,t){return(typeof e=="function"?e(t):e)?.find(n=>n.id===i)?.name??i}o(V0,"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(l=>V0(l,s,e)).join(", ");return u("div",{className:"uppy-Dashboard-Item-errorMessage",children:[r("missingRequiredMetaFields",{smart_count:n.length,fields:a})," ",u("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 W0=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"),u("div",{className:"uppy-Dashboard-Item-name",title:t,children:Xr(t,r())})},"renderFileName"),G0=o(i=>{let{author:e}=i.file.meta,t="remote"in i.file?i.file.remote?.providerName:void 0,r="\xB7";return e?u("div",{className:"uppy-Dashboard-Item-author",children:[u("a",{href:`${e.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",children:Xr(e.name,13)}),t?u(Ee,{children:[` ${r} `,t,` ${r} `]}):null]}):null},"renderAuthor"),X0=o(i=>i.file.size&&u("div",{className:"uppy-Dashboard-Item-statusSize",children:tt(i.file.size)}),"renderFileSize"),K0=o(i=>i.file.isGhost&&u("span",{children:[" \u2022 ",u("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"),Y0=o(({file:i,onClick:e})=>i.error?u("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 wl(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,toggleAddFilesPanel:n,isSingleFile:a,containerHeight:l,containerWidth:c}=i;return u("div",{className:"uppy-Dashboard-Item-fileInfo","data-uppy-file-source":e.source,children:[u("div",{className:"uppy-Dashboard-Item-fileName",children:[W0({file:e,isSingleFile:a,containerHeight:l,containerWidth:c}),u(Y0,{file:e,onClick:o(()=>alert(e.error),"onClick")})]}),u("div",{className:"uppy-Dashboard-Item-status",children:[G0({file:e}),X0({file:e}),K0({file:e,toggleAddFilesPanel:n,i18n:t})]}),u(ws,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}o(wl,"FileInfo");function Sl(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,showLinkToFileUploadResult:n}=i,l=e.preview?"rgba(255, 255, 255, 0.5)":Ii(e.type).color;return u("div",{className:"uppy-Dashboard-Item-previewInnerWrap",style:{backgroundColor:l},children:[n&&e.uploadURL&&u("a",{className:"uppy-Dashboard-Item-previewLink",href:e.uploadURL,rel:"noreferrer noopener",target:"_blank","aria-label":e.meta.name,children:u("span",{hidden:!0,children:e.meta.name})}),u(bs,{file:e}),u(ws,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}o(Sl,"FilePreviewAndLink");function J0(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(J0,"onPauseResumeCancelRetry");function vh(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(vh,"progressIndicatorTitle");function xl(i){return u("div",{className:"uppy-Dashboard-Item-progress",children:u("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-progressIndicator",type:"button","aria-label":vh(i),title:vh(i),onClick:o(()=>J0(i),"onClick"),children:i.children})})}o(xl,"ProgressIndicatorButton");function sn({children:i}){return u("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(sn,"ProgressCircleContainer");function _l({progress:i}){let e=2*Math.PI*15;return u("g",{children:[u("circle",{className:"uppy-Dashboard-Item-progressIcon--bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),u("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(_l,"ProgressCircle");function El(i){return!i.file.progress.uploadStarted||i.file.progress.percentage===void 0?null:i.isUploaded?u("div",{className:"uppy-Dashboard-Item-progress",children:u("div",{className:"uppy-Dashboard-Item-progressIndicator",children:u(sn,{children:[u("circle",{r:"15",cx:"18",cy:"18",fill:"#1bb240"}),u("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?u(xl,{...i,children:u("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:[u("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),u("path",{d:"M7.9 3H10v2H7.9z"}),u("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),u("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"})]})}):i.resumableUploads&&!i.hidePauseResumeButton?u(xl,{...i,children:u(sn,{children:[u(_l,{progress:i.file.progress.percentage}),i.file.isPaused?u("polygon",{className:"uppy-Dashboard-Item-progressIcon--play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}):u("g",{className:"uppy-Dashboard-Item-progressIcon--pause",transform:"translate(14.5, 13)",children:[u("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),u("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})]})]})}):!i.resumableUploads&&i.individualCancellation&&!i.hideCancelButton?u(xl,{...i,children:u(sn,{children:[u(_l,{progress:i.file.progress.percentage}),u("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"})]})}):u("div",{className:"uppy-Dashboard-Item-progress",children:u("div",{className:"uppy-Dashboard-Item-progressIndicator",children:u(sn,{children:u(_l,{progress:i.file.progress.percentage})})})})}o(El,"FileProgress");var Ss=class extends de{static{o(this,"FileItem")}componentDidMount(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}shouldComponentUpdate(e){return!yh(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:l}=e,c=(this.props.individualCancellation||!n)&&!r;r&&this.props.showRemoveButtonAfterComplete&&(c=!0);let p=(0,bh.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":l});return u("div",{className:p,id:`uppy_${e.id}`,role:this.props.role,children:[u("div",{className:"uppy-Dashboard-Item-preview",children:[u(Sl,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),u(El,{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})]}),u("div",{className:"uppy-Dashboard-Item-fileInfoAndButtons",children:[u(wl,{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}),u(bl,{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 Q0(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(Q0,"chunks");function Pl({id:i,i18n:e,uppy:t,files:r,resumableUploads:s,hideRetryButton:n,hidePauseResumeButton:a,hideCancelButton:l,showLinkToFileUploadResult:c,showRemoveButtonAfterComplete:p,metaFields:h,isSingleFile:g,toggleFileCard:y,handleRequestThumbnail:S,handleCancelThumbnail:P,recoveredState:F,individualCancellation:D,itemsPerRow:q,openFileEditor:R,canEditFile:C,toggleAddFilesPanel:j,containerWidth:W,containerHeight:B}){let Q=q===1?71:200,K=kt(()=>{let ne=o((Fe,be)=>Number(r[be].isGhost)-Number(r[Fe].isGhost),"sortByGhostComesFirst"),le=Object.keys(r);return F&&le.sort(ne),Q0(le,q)},[r,q,F]),ee=o(ne=>u("div",{class:"uppy-Dashboard-filesInner",role:"presentation",children:ne.map(le=>u(Ss,{uppy:t,id:i,i18n:e,resumableUploads:s,individualCancellation:D,hideRetryButton:n,hidePauseResumeButton:a,hideCancelButton:l,showLinkToFileUploadResult:c,showRemoveButtonAfterComplete:p,metaFields:h,recoveredState:F,isSingleFile:g,containerWidth:W,containerHeight:B,toggleFileCard:y,handleRequestThumbnail:S,handleCancelThumbnail:P,role:"listitem",openFileEditor:R,canEditFile:C,toggleAddFilesPanel:j,file:r[le]},le))},ne[0]),"renderRow");return g?u("div",{class:"uppy-Dashboard-files",children:ee(K[0])}):u(or,{class:"uppy-Dashboard-files",role:"list",data:K,renderRow:ee,rowHeight:Q})}o(Pl,"FileList");var wh=300,xs=class extends de{static{o(this,"FadeIn")}ref=yo();componentWillEnter(e){this.ref.current.style.opacity="1",this.ref.current.style.transform="none",setTimeout(e,wh)}componentWillLeave(e){this.ref.current.style.opacity="0",this.ref.current.style.transform="translateY(350%)",setTimeout(e,wh)}render(){let{children:e}=this.props;return u("div",{className:"uppy-Informer-animated",ref:this.ref,children:e})}};function Z0(i,e){return Object.assign(i,e)}o(Z0,"assign");function e1(i,e){return i?.key??e}o(e1,"getKey");function t1(i,e){let t=i._ptgLinkedRefs||(i._ptgLinkedRefs={});return t[e]||(t[e]=r=>{i.refs[e]=r})}o(t1,"linkRef");function _s(i){let e={};for(let t=0;t<i.length;t++)if(i[t]!=null){let r=e1(i[t],t.toString(36));e[r]=i[t]}return e}o(_s,"getChildMapping");function i1(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 l=0;l<r[a].length;l++){let c=r[a][l];n[r[a][l]]=t(c)}n[a]=t(a)}for(let a=0;a<s.length;a++)n[s[a]]=t(s[a]);return n}o(i1,"mergeChildMappings");var r1=o(i=>i,"identity"),on=class extends de{static{o(this,"TransitionGroup")}constructor(e,t){super(e,t),this.refs={},this.state={children:_s(ct(ct(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=_s(ct(e.children)||[]),r=this.state.children;this.setState(n=>({children:i1(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=_s(ct(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=_s(ct(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=_s(ct(this.props.children)||[]);if(s&&Object.hasOwn(s,e))this.performEnter(e);else{let n=Z0({},this.state.children);delete n[e],this.setState({children:n})}}render({childFactory:e,transitionLeave:t,transitionName:r,transitionAppear:s,transitionEnter:n,transitionLeaveTimeout:a,transitionEnterTimeout:l,transitionAppearTimeout:c,component:p,...h},{children:g}){let y=Object.entries(g).map(([S,P])=>{if(!P)return;let F=t1(this,S);return Zr(e(P),{ref:F,key:S})}).filter(Boolean);return Gt(p,h,y)}};on.defaultProps={component:"span",childFactory:r1};var Sh=on;var _r=class extends de{static{o(this,"Informer")}render(){let{info:e}=this.props.uppy.getState();return u("div",{className:"uppy uppy-Informer",children:u(Sh,{children:e.map(t=>u(xs,{children:u("p",{role:"alert",children:[t.message," ",t.details&&u("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 xh=he(Ve(),1);function s1({activePickerPanel:i,className:e,hideAllPanels:t,i18n:r,state:s,uppy:n}){let a=et(null);return u("div",{className:(0,xh.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:[u("div",{className:"uppy-DashboardContent-bar",children:[u("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:r("importFrom",{name:i.name})}),u("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:r("cancel")})]}),u("div",{ref:a,className:"uppy-DashboardContent-panelBody",children:n.getPlugin(i.id).render(s,a.current)})]})}o(s1,"PickerPanelContent");var _h=s1;var ci={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function o1(i,e,t,r={}){if(i)return ci.STATE_ERROR;if(e)return ci.STATE_COMPLETE;if(t)return ci.STATE_PAUSED;let s=ci.STATE_WAITING,n=Object.keys(r);for(let a=0;a<n.length;a++){let{progress:l}=r[n[a]];if(l.uploadStarted&&!l.uploadComplete)return ci.STATE_UPLOADING;l.preprocess&&(s=ci.STATE_PREPROCESSING),l.postprocess&&s!==ci.STATE_PREPROCESSING&&(s=ci.STATE_POSTPROCESSING)}return s}o(o1,"getUploadingState");function n1({files:i,i18n:e,isAllComplete:t,isAllErrored:r,isAllPaused:s,inProgressNotPausedFiles:n,newFiles:a,processingFiles:l}){switch(o1(r,t,s,i)){case"uploading":return e("uploadingXFiles",{smart_count:n.length});case"preprocessing":case"postprocessing":return e("processingXFiles",{smart_count:l.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(n1,"UploadStatus");function a1(i){let{i18n:e,isAllComplete:t,hideCancelButton:r,maxNumberOfFiles:s,toggleAddFilesPanel:n,totalFileCount:a,uppy:l}=i,{allowNewUpload:c}=i;return c&&s&&(c=a<s),u("div",{className:"uppy-DashboardContent-bar",children:[!t&&!r?u("button",{className:"uppy-DashboardContent-back",type:"button",onClick:o(()=>l.cancelAll(),"onClick"),children:e("cancel")}):u("div",{}),u("div",{className:"uppy-DashboardContent-title",children:u(n1,{...i})}),c?u("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":e("addMoreFiles"),title:e("addMoreFiles"),onClick:o(()=>n(!0),"onClick"),children:[u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15",children:u("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"})}),u("span",{className:"uppy-DashboardContent-addMoreCaption",children:e("addMore")})]}):u("div",{})]})}o(a1,"PanelTopBar");var Eh=a1;var Th=he(Ve(),1);var Er="uppy-transition-slideDownUp",Ph=250;function l1({children:i}){let[e,t]=ot(null),[r,s]=ot(""),n=et(),a=et(),l=et(),c=xt(()=>{s(`${Er}-enter`),cancelAnimationFrame(l.current),clearTimeout(a.current),a.current=void 0,l.current=requestAnimationFrame(()=>{s(`${Er}-enter ${Er}-enter-active`),n.current=setTimeout(()=>{s("")},Ph)})},[]),p=xt(()=>{s(`${Er}-leave`),cancelAnimationFrame(l.current),clearTimeout(n.current),n.current=void 0,l.current=requestAnimationFrame(()=>{s(`${Er}-leave ${Er}-leave-active`),a.current=setTimeout(()=>{t(null),s("")},Ph)})},[]);return He(()=>{let h=ct(i)[0];e!==h&&(h&&!e?c():e&&!h&&!a.current&&p(),t(h))},[i,e,c,p]),He(()=>()=>{clearTimeout(n.current),clearTimeout(a.current),cancelAnimationFrame(l.current)},[]),e?Zr(e,{className:(0,Th.default)(r,e.props.className)}):null}o(l1,"Slide");var Es=l1;var gt={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};var Fl=he(Ve(),1);var Tl=he(Ve(),1);var u1="\xB7",kh=o(()=>` ${u1} `,"renderDot");function Ch(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:a,startUpload:l}=i,c=(0,Tl.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 u("button",{type:"button",className:c,"aria-label":s("uploadXFiles",{smart_count:e}),onClick:l,disabled:a,"data-uppy-super-focusable":!0,children:p})}o(Ch,"UploadBtn");function Fh(i){let{i18n:e,uppy:t}=i;return u("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:[u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10",children:u("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(Fh,"RetryBtn");function Rh(i){let{i18n:e,uppy:t}=i;return u("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:u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:u("g",{fill:"none",fillRule:"evenodd",children:[u("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),u("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(Rh,"CancelBtn");function Ah(i){let{isAllPaused:e,i18n:t,isAllComplete:r,resumableUploads:s,uppy:n}=i,a=t(e?"resume":"pause");function l(){if(!r){if(!s){n.cancelAll();return}if(e){n.resumeAll();return}n.pauseAll()}}return o(l,"togglePauseResume"),u("button",{title:a,"aria-label":a,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:l,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0,children:u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:u("g",{fill:"none",fillRule:"evenodd",children:[u("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),u("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"})]})})})}o(Ah,"PauseResumeButton");function Uh(i){let{i18n:e,doneButtonHandler:t}=i;return u("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(Uh,"DoneBtn");function Oh(){return u("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14",children:u("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(Oh,"LoadingSpinner");function Ih(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return u("div",{className:"uppy-StatusBar-content",children:[u(Oh,{}),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s]})}o(Ih,"ProgressBarProcessing");function c1(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:a}=i,l=e>1,c=tt(r);return u("div",{className:"uppy-StatusBar-statusSecondary",children:[l&&a("filesUploadedOfTotal",{complete:t,smart_count:e}),u("span",{className:"uppy-StatusBar-additionalInfo",children:[l&&kh(),s!=null?a("dataUploadedOfTotal",{complete:c,total:tt(s)}):a("dataUploadedOfUnknown",{complete:c}),kh(),n!=null&&a("xTimeLeft",{time:tr(n)})]})]})}o(c1,"ProgressDetails");function Dh(i){let{i18n:e,complete:t,numUploads:r}=i;return u("div",{className:"uppy-StatusBar-statusSecondary",children:e("filesUploadedOfTotal",{complete:t,smart_count:r})})}o(Dh,"FileUploadCount");function p1(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,Tl.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return u("div",{className:"uppy-StatusBar-statusSecondary",children:[u("div",{className:"uppy-StatusBar-statusSecondaryHint",children:e("xMoreFilesAdded",{smart_count:t})}),u("button",{type:"button",className:s,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:r,children:e("upload")})]})}o(p1,"UploadNewlyAddedFiles");function Nh(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,hideProgressDetails:s,isUploadStarted:n,isAllComplete:a,isAllPaused:l,newFiles:c,numUploads:p,complete:h,totalUploadedSize:g,totalSize:y,totalETA:S,startUpload:P}=i,F=c&&n;if(!n||a)return null;let D=e(l?"paused":"uploading");function q(){return!l&&!F&&!s?t?u(c1,{numUploads:p,complete:h,totalUploadedSize:g,totalSize:y,totalETA:S,i18n:e}):u(Dh,{i18n:e,complete:h,numUploads:p}):null}return o(q,"renderProgressDetails"),u("div",{className:"uppy-StatusBar-content",title:D,children:[l?null:u(Oh,{}),u("div",{className:"uppy-StatusBar-status",children:[u("div",{className:"uppy-StatusBar-statusPrimary",children:t&&r!==0?`${D}: ${r}%`:D}),q(),F?u(p1,{i18n:e,newFiles:c,startUpload:P}):null]})]})}o(Nh,"ProgressBarUploading");function Mh(i){let{i18n:e}=i;return u("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete"),children:u("div",{className:"uppy-StatusBar-status",children:u("div",{className:"uppy-StatusBar-statusPrimary",children:[u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11",children:u("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})}),e("complete")]})})})}o(Mh,"ProgressBarComplete");function Lh(i){let{error:e,i18n:t,complete:r,numUploads:s}=i;function n(){let a=`${t("uploadFailed")}
${e}`;alert(a)}return o(n,"displayErrorAlert"),u("div",{className:"uppy-StatusBar-content",title:t("uploadFailed"),children:[u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11",children:u("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"})}),u("div",{className:"uppy-StatusBar-status",children:[u("div",{className:"uppy-StatusBar-statusPrimary",children:[t("uploadFailed"),u("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:"?"})]}),u(Dh,{i18n:t,complete:r,numUploads:s})]})]})}o(Lh,"ProgressBarError");function Ps(i){let e=[],t="indeterminate",r;for(let{progress:n}of Object.values(i)){let{preprocess:a,postprocess:l}=n;r==null&&(a||l)&&({mode:t,message:r}=a||l),a?.mode==="determinate"&&e.push(a.value),l?.mode==="determinate"&&e.push(l.value)}let s=e.reduce((n,a)=>n+a/e.length,0);return{mode:t,message:r,value:s}}o(Ps,"calculateProcessingProgress");var{STATE_ERROR:Bh,STATE_WAITING:d1,STATE_PREPROCESSING:kl,STATE_UPLOADING:nn,STATE_POSTPROCESSING:Cl,STATE_COMPLETE:an}=gt;function Rl({newFiles:i,allowNewUpload:e,isUploadInProgress:t,isAllPaused:r,resumableUploads:s,error:n,hideUploadButton:a=void 0,hidePauseResumeButton:l=!1,hideCancelButton:c=!1,hideRetryButton:p=!1,recoveredState:h,uploadState:g,totalProgress:y,files:S,supportsUploadProgress:P,hideAfterFinish:F=!1,isSomeGhost:D,doneButtonHandler:q=void 0,isUploadStarted:R,i18n:C,startUpload:j,uppy:W,isAllComplete:B,hideProgressDetails:Q=void 0,numUploads:K,complete:ee,totalSize:ne,totalETA:le,totalUploadedSize:Fe}){function be(){switch(g){case Cl:case kl:{let J=Ps(S);return J.mode==="determinate"?J.value*100:y}case Bh:return null;case nn:return P?y:null;default:return y}}o(be,"getProgressValue");function fe(){switch(g){case Cl:case kl:{let{mode:J}=Ps(S);return J==="indeterminate"}case nn:return!P;default:return!1}}o(fe,"getIsIndeterminate");let _e=be(),T=_e??100,w=!n&&i&&(!t&&!r||h)&&e&&!a,_=!c&&g!==d1&&g!==an,L=s&&!l&&g===nn,$=n&&!B&&!p,z=q&&g===an,Z=(0,Fl.default)("uppy-StatusBar-progress",{"is-indeterminate":fe()}),N=(0,Fl.default)("uppy-StatusBar",`is-${g}`,{"has-ghosts":D}),k=(()=>{switch(g){case kl:case Cl:return u(Ih,{progress:Ps(S)});case an:return u(Mh,{i18n:C});case Bh:return u(Lh,{error:n,i18n:C,numUploads:K,complete:ee});case nn:return u(Nh,{i18n:C,supportsUploadProgress:P,totalProgress:y,hideProgressDetails:Q,isUploadStarted:R,isAllComplete:B,isAllPaused:r,newFiles:i,numUploads:K,complete:ee,totalUploadedSize:Fe,totalSize:ne,totalETA:le,startUpload:j});default:return null}})();return!(w||$||L||_||z)&&!k||g===an&&F?null:u("div",{className:N,children:[u("div",{className:Z,style:{width:`${T}%`},role:"progressbar","aria-label":`${T}%`,"aria-valuetext":`${T}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":_e}),k,u("div",{className:"uppy-StatusBar-actions",children:[w?u(Ch,{newFiles:i,isUploadStarted:R,recoveredState:h,i18n:C,isSomeGhost:D,startUpload:j,uploadState:g}):null,$?u(Fh,{i18n:C,uppy:W}):null,L?u(Ah,{isAllPaused:r,i18n:C,isAllComplete:B,resumableUploads:s,uppy:W}):null,_?u(Rh,{i18n:C,uppy:W}):null,z?u(Uh,{i18n:C,doneButtonHandler:q}):null]})]})}o(Rl,"StatusBarUI");var h1=2e3,f1=2e3;function m1(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:l}=r[n[a]];if(l.uploadStarted&&!l.uploadComplete)return gt.STATE_UPLOADING;l.preprocess&&(s=gt.STATE_PREPROCESSING),l.postprocess&&s!==gt.STATE_PREPROCESSING&&(s=gt.STATE_POSTPROCESSING)}return s}o(m1,"getUploadingState");var Ts=class extends de{static{o(this,"StatusBar")}#e;#t;#i;#r;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.#i=null,this.#r=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");#o(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.#r??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.#r??0)/100)/10;let n=s/r;if(!Number.isFinite(n)||n<=0)return null;let a=this.#i==null?n:ii(n,this.#i,h1,r);if(!Number.isFinite(a)||a<=0)return null;this.#i=a;let l=t/a;if(!Number.isFinite(l)||l<0)return null;let c=Math.max((this.#r??0)-r,0),p=this.#r==null?l:ii(l,c,f1,r);return!Number.isFinite(p)||p<0?null:(this.#r=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:l,startedFiles:c,completeFiles:p,isUploadStarted:h,isAllComplete:g,isAllPaused:y,isUploadInProgress:S,isSomeGhost:P}=this.props.uppy.getObjectOfFilesPerState(),F=a?Object.values(t):l,D=!!e.resumableUploads,q=e.uploadProgress!==!1,R=null,C=0;c.every(W=>W.progress.bytesTotal!=null&&W.progress.bytesTotal!==0)?(R=0,c.forEach(W=>{R+=W.progress.bytesTotal||0,C+=W.progress.bytesUploaded||0})):c.forEach(W=>{C+=W.progress.bytesUploaded||0});let j=this.#o({uploaded:C,total:R});return u(Rl,{error:n,uploadState:m1(n,g,a,t||{}),allowNewUpload:r,totalProgress:s,totalSize:R,totalUploadedSize:C,isAllComplete:g,isAllPaused:y,isUploadStarted:h,isUploadInProgress:S,isSomeGhost:P,recoveredState:a,complete:p.length,newFiles:F.length,numUploads:c.length,totalETA:j,files:t,i18n:this.props.i18n,uppy:this.props.uppy,startUpload:this.startUpload,doneButtonHandler:this.props.doneButtonHandler,resumableUploads:D,supportsUploadProgress:q,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 jh=900,zh=700,Hh=576,qh=330;function Al(i){let{activePickerPanel:e,fileCardFor:t}=i,r=i.totalFileCount===0,s=i.totalFileCount===1,n=i.containerHeight>qh,a=(0,$h.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>Hh,"uppy-size--lg":i.containerWidth>zh,"uppy-size--xl":i.containerWidth>jh,"uppy-size--height-md":i.containerHeight>qh,"uppy-Dashboard--isAddFilesPanelVisible":i.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":i.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":i.singleFileFullScreen&&s&&n}),l=1;i.containerWidth>jh?l=5:i.containerWidth>zh?l=4:i.containerWidth>Hh&&(l=3);let c=i.showSelectedFiles&&!r,p=i.recoveredState?Object.keys(i.recoveredState.files).length:null,h=i.files?Object.keys(i.files).filter(S=>i.files[S].isGhost).length:0,g=o(()=>h>0?i.i18n("recoveredXFiles",{smart_count:h}):i.i18n("recoveredAllFiles"),"renderRestoredText");return u("div",{className:a,"data-uppy-theme":i.theme,"data-uppy-num-acquirers":i.acquirers.length,"data-uppy-drag-drop-supported":!i.disableLocalFiles&&er(),"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:[u("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:i.handleClickOutside}),u("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:u("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":i.i18n("closeModal"),title:i.i18n("closeModal"),onClick:i.closeModal,children:u("span",{"aria-hidden":"true",children:"\xD7"})}),u("div",{className:"uppy-Dashboard-innerWrap",children:[u("div",{className:"uppy-Dashboard-dropFilesHereHint",children:i.i18n("dropHint")}),c&&u(Eh,{...i}),p!=null&&p>0&&u("div",{className:"uppy-Dashboard-serviceMsg",children:[u("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19",children:u("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd",children:[u("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"}),u("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),u("circle",{fill:"#000",cx:"12",cy:"17",r:"1"})]})}),u("strong",{className:"uppy-Dashboard-serviceMsg-title",children:i.i18n("sessionRestored")}),u("div",{className:"uppy-Dashboard-serviceMsg-text",children:g()})]}),c?u(Pl,{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:s,itemsPerRow:l,containerWidth:i.containerWidth,containerHeight:i.containerHeight}):u(rn,{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}),u(Es,{children:i.showAddFilesPanel?u(hh,{...i},"AddFiles"):null}),u(Es,{children:t?u(yl,{...i,fileCardFor:t},"FileCard"):null}),u(Es,{children:e?u(_h,{...i,activePickerPanel:e},"Picker"):null}),u(Es,{children:i.showFileEditor?u(mh,{...i},"Editor"):null}),u("div",{className:"uppy-Dashboard-progressindicators",children:[!i.disableInformer&&u(_r,{uppy:i.uppy}),!i.disableStatusBar&&u(Ts,{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&&u(_r,{uppy:i.uppy}),i.progressindicators.map(S=>i.uppy.getPlugin(S.id).render(i.state))]})]})]})]})}o(Al,"Dashboard");var Vh={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 Wh=he(Eo(),1);function ks(i,e){if(e){let t=i.querySelector(`[data-uppy-paneltype="${e}"]`);if(t)return t}return i}o(ks,"getActiveOverlayEl");function Ul(){let i=!1;return(0,Wh.default)((e,t)=>{let r=ks(e,t),s=r.contains(document.activeElement);if(s&&i)return;let n=r.querySelector("[data-uppy-super-focusable]");s&&!n||(n?(n.focus({preventScroll:!0}),i=!0):(r.querySelector(Br.join(","))?.focus({preventScroll:!0}),i=!1))},260)}o(Ul,"createSuperFocus");function Gh(i,e){let t=e[0];t&&(t.focus(),i.preventDefault())}o(Gh,"focusOnFirstNode");function g1(i,e){let t=e[e.length-1];t&&(t.focus(),i.preventDefault())}o(g1,"focusOnLastNode");function y1(i){return i.contains(document.activeElement)}o(y1,"isFocusInOverlay");function Ol(i,e,t){let r=ks(t,e),s=ze(r.querySelectorAll(Br.join(","))),n=s.indexOf(document.activeElement);y1(r)?i.shiftKey&&n===0?g1(i,s):!i.shiftKey&&n===s.length-1&&Gh(i,s):Gh(i,s)}o(Ol,"trapFocus");function Xh(i,e,t){e===null||Ol(i,e,t)}o(Xh,"forInline");var Kh=9,b1=27;function Yh(){let i={};return i.promise=new Promise((e,t)=>{i.resolve=e,i.reject=t}),i}o(Yh,"createPromise");var w1={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:dr,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},Cs=class extends ae{static{o(this,"Dashboard")}static VERSION=ph.version;#e;modalName=`uppy-Dashboard-${Ot()}`;superFocus=Ul();ifFocusedOnUppyRecently=!1;dashboardIsDisabled;savedScrollPosition;savedActiveElement;resizeObserver;darkModeMediaQuery;makeDashboardInsidesVisibleAnywayTimeout;constructor(e,t){let r=t?.autoOpen??null;super(e,{...w1,...t,autoOpen:r}),this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=Vh,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},l=this.getPluginState().targets.slice();return l.push(n),this.setPluginState({targets:l}),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.#a(t).some(s=>this.uppy.getPlugin(s.id).canEditFile(e))},"canEditFile");openFileEditor=o(e=>{let{targets:t}=this.getPluginState(),r=this.#a(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.#a(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 l=o(()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",l,!1),a()},"handler");this.el.addEventListener("animationend",l,!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??ze(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?.[this.modalName]&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&e.state?.[this.modalName]&&history.back()},"handlePopState");handleKeyDownInModal=o(e=>{e.keyCode===b1&&this.requestCloseModal(),e.keyCode===Kh&&Ol(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=ze(e.clipboardData.files);t.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(t))},"handlePaste");handleInputChange=o(e=>{e.preventDefault();let t=ze(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(l=>{l.canHandleRootDrop?.(e)&&(a=!0)}),a},"canSomePluginHandleRootDrop"),r=o(()=>{let{types:a}=e.dataTransfer;return a.some(l=>l==="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 si(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===Kh&&Xh(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");#i=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=uo(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.#c),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.#i)},"initEvents");removeEvents=o(()=>{let e=uo(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.#c),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,!0),document.removeEventListener("click",this.recordIfFocusedOnUppyRecently,!0),this.opts.inline&&this.el.removeEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.off("files-added",this.#i)},"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");#r=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");#o=o(e=>e.filter(t=>t.type==="acquirer"&&this.#s(t)).map(this.#r),"#getAcquirers");#n=o(e=>e.filter(t=>t.type==="progressindicator").map(this.#r),"#getProgressIndicators");#a=o(e=>e.filter(t=>t.type==="editor").map(this.#r),"#getEditors");render=o(e=>{let t=this.getPluginState(),{files:r,capabilities:s,allowNewUpload:n}=e,{newFiles:a,uploadStartedFiles:l,completeFiles:c,erroredFiles:p,inProgressFiles:h,inProgressNotPausedFiles:g,processingFiles:y,isUploadStarted:S,isAllComplete:P,isAllPaused:F}=this.uppy.getObjectOfFilesPerState(),D=this.#o(t.targets),q=this.#n(t.targets),R=this.#a(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}".`)),Al({state:e,isHidden:t.isHidden,files:r,newFiles:a,uploadStartedFiles:l,completeFiles:c,erroredFiles:p,inProgressFiles:h,inProgressNotPausedFiles:g,processingFiles:y,isUploadStarted:S,isAllComplete:P,isAllPaused:F,totalFileCount:Object.keys(r).length,totalProgress:e.totalProgress,allowNewUpload:n,acquirers:D,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:q,editors:R,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");#u=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");#l=o(()=>{this.uppy.iteratePlugins(this.#c)},"#autoDiscoverPlugins");#c=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");#p(){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.#h())?.setOptions(this.#p())}#h(){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(xr,{id:this.#h(),...this.#p()}),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.#u(),this.#l(),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 Jh={name:"@uppy/drag-drop",description:"Droppable zone UI for Uppy. Drag and drop files into it to upload.",version:"6.0.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:{preact:"^10.29.2"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{cssnano:"^8.0.1",postcss:"^8.5.23","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^6.0.3"}};var Qh={strings:{dropHereOr:"Drop here or %{browse}",browse:"browse"}};var x1={inputName:"files[]",width:"100%",height:"100%"},Fs=class i extends ae{static{o(this,"DragDrop")}static VERSION=Jh.version;isDragDropSupported=er();fileInputRef;constructor(e,t){super(e,{...x1,...t}),this.type="acquirer",this.id=this.opts.id||"DragDrop",this.title="Drag & Drop",this.defaultLocale=Qh,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=ze(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 si(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 u("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 u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-DragDrop-arrow",width:"16",height:"16",viewBox:"0 0 16 16",children:u("path",{d:"M11 10V0H5v10H2l6 6 6-6h-3zm0 0",fillRule:"evenodd"})})}renderLabel(){return u("div",{className:"uppy-DragDrop-label",children:this.i18nArray("dropHereOr",{browse:u("span",{className:"uppy-DragDrop-browse",children:this.i18n("browse")})})})}renderNote(){return u("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 u("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(),u("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 Zh={name:"@uppy/drop-target",description:"Lets your users drag and drop files on a DOM element",version:"5.0.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"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{cssnano:"^8.0.1",postcss:"^8.5.23","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^6.0.3"}};var E1={target:null};function Il(i){return i.dataTransfer?.types?.some(e=>e==="Files")??!1}o(Il,"isFileTransfer");var ln=class extends Pe{static{o(this,"DropTarget")}static VERSION=Zh.version;nodes;constructor(e,t){super(e,{...E1,...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(!Il(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 si(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=>{Il(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=>{Il(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=ze(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 ef={name:"@uppy/dropbox",description:"Import files from Dropbox, into Uppy.",version:"6.0.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:{preact:"^10.29.2"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^6.0.3"}};var tf={strings:{pluginNameDropbox:"Dropbox"}};var Di=class extends ae{static{o(this,"Dropbox")}static VERSION=ef.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||Re,this.files=[],this.icon=()=>u("svg",{className:"uppy-DashboardTab-iconDropbox","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:u("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=Xe(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new Ke(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=tf,this.i18nInit(),this.title=this.i18n("pluginNameDropbox"),this.render=this.render.bind(this)}install(){this.view=new We(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 rf={name:"@uppy/facebook",description:"Import files from Facebook, into Uppy.",version:"6.0.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:{preact:"^10.29.2"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^6.0.3"}};var sf={strings:{pluginNameFacebook:"Facebook"}};var Ni=class extends ae{static{o(this,"Facebook")}static VERSION=rf.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||Re,this.files=[],this.icon=()=>u("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:u("g",{fill:"none",fillRule:"evenodd",children:[u("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"}),u("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=Xe(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new Ke(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=sf,this.i18nInit(),this.title=this.i18n("pluginNameFacebook"),this.render=this.render.bind(this)}install(){this.view=new We(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 un(){return un=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},un.apply(this,arguments)}o(un,"_extends");var k1={"[object HTMLCollection]":!0,"[object NodeList]":!0,"[object RadioNodeList]":!0},C1={button:!0,fieldset:!0,reset:!0,submit:!0},F1={checkbox:!0,radio:!0},R1=/^\s+|\s+$/g,A1=Array.prototype.slice,of=Object.prototype.toString;function cn(i,e){if(!i)throw new Error("A form is required by getFormData, was given form="+i);e=un({includeDisabled:!1,trim:!1},e);for(var t={},r,s=[],n={},a=0,l=i.elements.length;a<l;a++){var c=i.elements[a];C1[c.type]||c.disabled&&!e.includeDisabled||(r=c.name||c.id,r&&!n[r]&&(s.push(r),n[r]=!0))}for(var p=0,h=s.length;p<h;p++){r=s[p];var g=af(i,r,e);g!=null&&(t[r]=g)}return t}o(cn,"getFormData");function af(i,e,t){if(!i)throw new Error("A form is required by getFieldData, was given form="+i);if(!e&&of.call(e)!=="[object String]")throw new Error("A field name is required by getFieldData, was given fieldName="+e);t=un({includeDisabled:!1,trim:!1},t);var r=i.elements[e];if(!r||r.disabled&&!t.includeDisabled)return null;if(!k1[of.call(r)])return nf(r,t.trim);for(var s=[],n=!0,a=0,l=r.length;a<l;a++)if(!(r[a].disabled&&!t.includeDisabled)){n&&r[a].type!=="radio"&&(n=!1);var c=nf(r[a],t.trim);c!=null&&(s=s.concat(c))}return n&&s.length===1?s[0]:s.length>0?s:null}o(af,"getFieldData");function nf(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=A1.call(i.files),t.length===0&&(t=null)):t=i.files[0],t):(F1[r]?i.checked&&(r==="checkbox"&&!i.hasAttribute("value")?t=!0:t=i.value):t=e?i.value.replace(R1,""):i.value,t)}o(nf,"getFormElementValue");cn.getFieldData=af;var lf={name:"@uppy/form",description:"Connect Uppy to an existing HTML <form>.",version:"6.0.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:{"get-form-data":"^3.0.0"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@types/get-form-data":"^3.0.0",typescript:"^6.0.3"}};function O1(i){return"default"in i?i.default:i}o(O1,"defaultInterop");var I1=O1(cn),D1={resultName:"uppyResult",getMetaFromForm:!0,addResultToForm:!0,submitOnSuccess:!1,triggerUploadOnSubmit:!1};function N1(i){if(i==null||i.nodeName!=="FORM")throw new Error("ASSERTION FAILED: the target is not a <form> element",{cause:i});return i}o(N1,"assertHTMLFormElement");var pn=class extends Pe{static{o(this,"Form")}static VERSION=lf.version;#e;constructor(e,t){super(e,{...D1,...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=ze(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=I1(this.#e);delete e[this.opts.resultName],this.uppy.setMeta(e)}install(){this.#e=N1(Hr(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 uf={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:"6.0.0",license:"MIT",type:"module",sideEffects:["lib/ServiceWorker.js"],scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --silent='passed-only'"},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:{lodash:"^4.18.1"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^","@uppy/dashboard":"workspace:^","@uppy/xhr-upload":"workspace:^","@vitest/browser-playwright":"^4.1.6",playwright:"1.61.1",typescript:"^6.0.3",vitest:"^4.1.6"}};var mf=he(Po(),1);var hf=typeof window<"u"&&(window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.OIndexedDB||window.msIndexedDB),L1=!!hf,dn="uppy-blobs",dt="files",pi="metadata",ff=1440*60*1e3,B1=4,cf=1048576;function j1(i){let e=i.openCursor();e.onsuccess=t=>{let r=t.target.result;if(!r)return;let s=r.value;s.expires=Date.now()+ff,r.update(s)}}o(j1,"migrateExpiration");function hn(i){let e=hf.open(i,B1);return new Promise((t,r)=>{e.onupgradeneeded=s=>{let n=s.target.result;pf(n);let a=s.currentTarget.transaction;if(s.oldVersion<2&&n.createObjectStore(dt,{keyPath:"id"}).createIndex("store","store",{unique:!1}),s.oldVersion<3){let l=a.objectStore(dt);l.createIndex("expires","expires",{unique:!1}),j1(l)}s.oldVersion<4&&n.createObjectStore(pi,{keyPath:"id"}).createIndex("expires","expires",{unique:!1}),a.oncomplete=()=>{t(n)}},e.onsuccess=s=>{let n=s.target.result;pf(n),t(n)},e.onerror=r})}o(hn,"connect");function pf(i){i.onversionchange=()=>i.close()}o(pf,"closeOnVersionChange");function Pr(i){return new Promise((e,t)=>{i.onsuccess=r=>{e(r.target.result)},i.onerror=t})}o(Pr,"waitForRequest");var df=!1,fn=class i{static{o(this,"IndexedDBStore")}#e;opts;name;static isSupported;constructor(e){this.opts={dbName:dn,storeName:"default",expires:ff,maxFileSize:10*cf,maxTotalSize:300*cf,...e},this.name=this.opts.storeName;let t=o(async()=>{let r=await hn(this.opts.dbName);return this.#e=r,r},"createConnection");df?this.#e=t():(df=!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([dt],"readonly").objectStore(dt).index("store").getAll(IDBKeyRange.only(this.name)),n=await Pr(s);return Object.fromEntries(n.map(a=>[a.fileID,a.data]))}async get(e){let s=(await this.#e).transaction([dt],"readonly").objectStore(dt).get(this.key(e)),{data:n}=await Pr(s);return{id:n.fileID,data:n.data}}async getSize(){let s=(await this.#e).transaction([dt],"readonly").objectStore(dt).index("store").openCursor(IDBKeyRange.only(this.name));return new Promise((n,a)=>{let l=0;s.onsuccess=c=>{let p=c.target.result;p?(l+=p.value.data.size,p.continue()):n(l)},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([dt],"readwrite").objectStore(dt).add({id:this.key(e.id),fileID:e.id,store:this.name,expires:Date.now()+this.opts.expires,data:e.data});return Pr(n)}async delete(e){let s=(await this.#e).transaction([dt],"readwrite").objectStore(dt).delete(this.key(e));return Pr(s)}static#t(e){let t=e.index("expires").openCursor(IDBKeyRange.upperBound(Date.now()));return new Promise((r,s)=>{t.onsuccess=n=>{let a=n.target.result;a?(a.delete(),a.continue()):r()},t.onerror=s})}static async cleanup(){let e=await hn(dn);try{let t=e.transaction([dt,pi],"readwrite");await Promise.all([i.#t(t.objectStore(dt)),i.#t(t.objectStore(pi))])}finally{e.close()}}};fn.isSupported=L1;var Dl=fn;var Rs=class{static{o(this,"IndexedDBMetaDataStore")}#e;#t;#i;#r;#s;constructor(e){this.#e=hn(dn),this.#e.catch(()=>{}),this.#i=e.storeName,this.#r=e.expires,this.#s=e.throttleTime===0?this.#o:(0,mf.default)(this.#o,e.throttleTime??500,{leading:!0,trailing:!0})}async load(){try{let e=await this.#e,t=await Pr(e.transaction([pi]).objectStore(pi).get(this.#i));return!t||t.expires<Date.now()?void 0:(this.#t=JSON.parse(t.metadata),this.#t??void 0)}catch{return}}get(){return this.#t??void 0}set(e){this.#t=e,this.#s()}#o=o(async()=>{try{let t=(await this.#e).transaction([pi],"readwrite").objectStore(pi);this.#t==null?t.delete(this.#i):t.put({id:this.#i,expires:Date.now()+this.#r,metadata:JSON.stringify(this.#t)})}catch{}},"#save")};var gf=he(Po(),1);function yf(i){try{return JSON.parse(i)}catch{return null}}o(yf,"maybeParse");var vf="uppyState:",z1=o(i=>`${vf}${i}`,"getItemKey");function H1(){let i=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r?.startsWith(vf)&&i.push(r)}let e=Date.now();i.forEach(t=>{let r=localStorage.getItem(t);if(!r)return;let s=yf(r);s?.expires&&s.expires<e&&localStorage.removeItem(t)})}o(H1,"expireOldState");var As=class{static{o(this,"MetaDataStore")}opts;name;#e;constructor(e){this.opts={expires:1440*60*1e3,throttleTime:500,...e},this.name=z1(e.storeName),this.#e=this.opts.throttleTime===0?this.save:(0,gf.default)(this.save,this.opts.throttleTime,{leading:!0,trailing:!0})}#t;load=o(()=>{H1();let e=localStorage.getItem(this.name);if(!e)return;let t=yf(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}try{localStorage.setItem(this.name,JSON.stringify(this.#t))}catch{}},"save");set=o(e=>{this.#t=e===null?null:{metadata:e,expires:Date.now()+this.opts.expires},this.#e()},"set")};var bf=typeof navigator<"u"&&"serviceWorker"in navigator;function q1(){return new Promise((i,e)=>{bf?navigator.serviceWorker.controller?i():navigator.serviceWorker.addEventListener("controllerchange",()=>{i()}):e(new Error("Unsupported"))})}o(q1,"waitForServiceWorker");var mn=class{static{o(this,"ServiceWorkerStore")}#e;name;static isSupported;constructor(e){this.#e=q1().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=>{s.data.store===this.name&&(s.data.type==="uppy/ALL_FILES"?(e(s.data.files),navigator.serviceWorker.removeEventListener("message",r)):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})}};mn.isSupported=bf;var wf=mn;var $1={expires:1440*60*1e3,serviceWorker:!1},gn=class i extends Pe{static{o(this,"GoldenRetriever")}static VERSION=uf.version;#e;#t;#i;static[Symbol.for("uppy test: throttleTime")];constructor(e,t){super(e,{...$1,...t}),this.type="debugger",this.id=this.opts.id||"GoldenRetriever";let r={expires:this.opts.expires,storeName:e.getID(),throttleTime:i[Symbol.for("uppy test: throttleTime")]??void 0};this.#e=Dl.isSupported?new Rs(r):new As(r),this.opts.serviceWorker&&(this.#t=new wf({storeName:e.getID()})),this.#i=new Dl({expires:this.opts.expires,...this.opts.indexedDB||{},storeName:e.getID()})}async#r(){let e=await this.#e.load();if(!e)return;let t=e.currentUploads||{},r=Object.entries(e.files||{}),s=Object.fromEntries(r.every(([,y])=>y.progress.complete&&!y.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[l,c]=await Promise.all([this.#o(),this.#n()]),p={...l,...c},h=Object.fromEntries(n.map(([y,S])=>{if(S.isRemote)return[y,{...S,isRestored:!0,data:{size:null}}];let P=p[y];return[y,!S.progress.uploadComplete&&P==null?{...S,isRestored:!0,isGhost:!0,data:void 0}:{...S,isRestored:!0,isGhost:!1,data:P}]}));this.uppy.setState({recoveredState:a?e:null,currentUploads:a?t:{},files:h}),this.uppy.emit("restored",e.pluginData);let g=Object.keys(p).filter(y=>!s[y]);if(g.length)try{this.uppy.log(`[GoldenRetriever] Cleaning up ${g.length} old files`),await this.#a(g)}catch(y){this.uppy.log(`[GoldenRetriever] Could not clean up ${g.length} old files`,"warning"),this.uppy.log(y)}}#s=o(({pluginData:e,...t})=>{let r=this.#e.get();this.#e.set({...r??{currentUploads:{},files:{}},...t,pluginData:{...r?.pluginData,...e}})},"#patchMetadata");async#o(){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#n(){try{let e=await this.#i.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#a(e){await Promise.all(e.map(async t=>{try{await Promise.all([this.#t?.delete(t),this.#i.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.#a(e)}#u=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.#i.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");#l=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(h=>!h.progress.complete)&&(Object.values(t.files).length===0||Object.values(t.files).every(h=>h.progress.complete&&!h.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(([h,{data:g,preview:y,...S}])=>[h,S]));this.#s({files:s});let n=Object.values(t.files).filter(h=>e.files[h.id]==null),a=Object.values(t.files).flatMap(h=>{let g=e.files[h.id];return g!=null&&h.data!==g.data?[h]:[]}),c=[...Object.values(e.files).filter(h=>{let g=t.files[h.id];return g==null||g.progress.uploadComplete&&!h.progress.uploadComplete}),...a],p=[...n,...a];(async()=>{await this.#a(c.map(h=>h.id));for(let h of p)await this.#u(h);p.length>0&&this.uppy.log(`[GoldenRetriever] Added ${p.length} blobs`)})()}},"#handleStateUpdate");#c=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");#p=o(e=>{this.#s({pluginData:e})},"#handlePluginDataChanged");install(){this.#r().catch(e=>{this.uppy.log("[GoldenRetriever] Could not restore from a previous session","warning"),this.uppy.log(e)}),this.uppy.on("state-update",this.#l),this.uppy.on("restore-confirmed",this.#c),this.uppy.on("restore:plugin-data-changed",this.#p)}uninstall(){this.uppy.off("state-update",this.#l),this.uppy.off("restore-confirmed",this.#c),this.uppy.off("restore:plugin-data-changed",this.#p)}};var Sf={name:"@uppy/google-drive",description:"The Google Drive plugin for Uppy lets users import files from their Google Drive account",version:"6.0.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:{preact:"^10.29.2"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^6.0.3"}};var Us=class extends We{static{o(this,"DriveProviderViews")}toggleCheckbox(e,t){e.data.custom?.isSharedDrive||super.toggleCheckbox(e,t)}};var xf={strings:{pluginNameGoogleDrive:"Google Drive"}};var Mi=class extends ae{static{o(this,"GoogleDrive")}static VERSION=Sf.version;icon;provider;view;storage;files;rootFolderId="root";constructor(e,t){super(e,t),this.type="acquirer",this.storage=this.opts.storage||Re,this.files=[],this.id=this.opts.id||"GoogleDrive",this.icon=()=>u("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:u("g",{fillRule:"nonzero",fill:"none",children:[u("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"}),u("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"}),u("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"}),u("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"}),u("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"}),u("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=Xe(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new Ke(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=xf,this.i18nInit(),this.title=this.i18n("pluginNameGoogleDrive"),this.render=this.render.bind(this)}install(){this.view=new Us(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 _f={name:"@uppy/google-drive-picker",description:"The Google Drive Picker plugin for Uppy lets users import files from their Google Drive account",version:"2.0.0",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:{preact:"^10.29.2"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^6.0.3"}};var Nl={strings:{pluginNameGoogleDrivePicker:"Google Drive"}};var Os=class i extends ae{static{o(this,"GoogleDrivePicker")}static VERSION=_f.version;static requestClientId=i.name;type="acquirer";icon=cr;storage;defaultLocale=Nl;requestClientId=i.requestClientId;constructor(e,t){super(e,t),this.id=this.opts.id||"GoogleDrivePicker",this.storage=this.opts.storage||Re,this.defaultLocale=Nl,this.i18nInit(),this.title=this.i18n("pluginNameGoogleDrivePicker"),this.setPluginState({loading:!1,accessToken:void 0}),this.getPluginState=this.getPluginState.bind(this),this.setPluginState=this.setPluginState.bind(this);let r=new nt(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule,companionKeysParams:this.opts.companionKeysParams});this.uppy.registerRequestClient(i.requestClientId,r)}install(){let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount()}render=o(()=>u(ki,{getPluginState:this.getPluginState,setPluginState:this.setPluginState,storage:this.storage,pickerType:"drive",uppy:this.uppy,i18n:this.i18n,clientId:this.opts.clientId,apiKey:this.opts.apiKey,appId:this.opts.appId,requestClientId:i.requestClientId,companionUrl:this.opts.companionUrl}),"render")};var Ef={name:"@uppy/google-photos-picker",description:"The Google Photos Picker plugin for Uppy lets users import files from their Google Photos account",version:"2.0.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:{preact:"^10.29.2"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^6.0.3"}};var Ml={strings:{pluginNameGooglePhotosPicker:"Google Photos"}};var Is=class i extends ae{static{o(this,"GooglePhotosPicker")}static VERSION=Ef.version;static requestClientId=i.name;type="acquirer";icon=ur;storage;defaultLocale=Ml;requestClientId=i.requestClientId;constructor(e,t){super(e,t),this.id=this.opts.id||"GooglePhotosPicker",this.storage=this.opts.storage||Re,this.defaultLocale=Ml,this.i18nInit(),this.title=this.i18n("pluginNameGooglePhotosPicker"),this.setPluginState({loading:!1,accessToken:void 0}),this.getPluginState=this.getPluginState.bind(this),this.setPluginState=this.setPluginState.bind(this);let r=new nt(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule,companionKeysParams:this.opts.companionKeysParams});this.uppy.registerRequestClient(i.requestClientId,r)}install(){let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount()}render=o(()=>u(ki,{getPluginState:this.getPluginState,setPluginState:this.setPluginState,storage:this.storage,pickerType:"photos",uppy:this.uppy,i18n:this.i18n,clientId:this.opts.clientId,requestClientId:i.requestClientId,companionUrl:this.opts.companionUrl}),"render")};var Uf=he(Pf(),1);var Tf={name:"@uppy/image-editor",description:"Image editor and cropping UI",version:"5.0.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:{cropperjs:"^1.6.2",preact:"^10.29.2"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{cssnano:"^8.0.1",postcss:"^8.5.23","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^6.0.3"}};var Ds=class extends de{static{o(this,"Editor")}imgElement;componentDidMount(){let{initCropper:e}=this.props;this.imgElement&&e(this.imgElement)}onRotate90Deg=o(()=>{this.props.rotateBy(-90)},"onRotate90Deg");onRotateGranular=o(e=>{let t=Number(e.target.value);this.props.rotateGranular(t)},"onRotateGranular");renderGranularRotate(){let{i18n:e}=this.props,{angleGranular:t}=this.props;return u("label",{role:"tooltip","aria-label":`${t}\xBA`,"data-microtip-position":"top",className:"uppy-ImageCropper-rangeWrapper",children:u("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}=this.props;return u("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("revert"),onClick:o(()=>{this.props.reset()},"onClick"),children:u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[u("path",{d:"M0 0h24v24H0z",fill:"none"}),u("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 u("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("rotate"),onClick:this.onRotate90Deg,children:u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[u("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"}),u("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 u("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("flipHorizontal"),onClick:o(()=>this.props.flipHorizontal(),"onClick"),children:u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[u("path",{d:"M0 0h24v24H0z",fill:"none"}),u("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 u("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomIn"),onClick:o(()=>this.props.zoom(.1),"onClick"),children:u("svg",{"aria-hidden":"true",className:"uppy-c-icon",height:"24",viewBox:"0 0 24 24",width:"24",children:[u("path",{d:"M0 0h24v24H0V0z",fill:"none"}),u("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"}),u("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})]})})}renderZoomOut(){let{i18n:e}=this.props;return u("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomOut"),onClick:o(()=>this.props.zoom(-.1),"onClick"),children:u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[u("path",{d:"M0 0h24v24H0V0z",fill:"none"}),u("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 u("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioSquare"),onClick:o(()=>this.props.setAspectRatio("1:1"),"onClick"),children:u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[u("path",{d:"M0 0h24v24H0z",fill:"none"}),u("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 u("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioLandscape"),onClick:o(()=>this.props.setAspectRatio("16:9"),"onClick"),children:u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[u("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"}),u("path",{fill:"none",d:"M0 0h24v24H0z"})]})})}renderCropWidescreenVertical(){let{i18n:e}=this.props;return u("button",{"data-microtip-position":"top",type:"button","aria-label":e("aspectRatioPortrait"),className:"uppy-u-reset uppy-c-btn",onClick:o(()=>this.props.setAspectRatio("9:16"),"onClick"),children:u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[u("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"}),u("path",{d:"M0 0h24v24H0z",fill:"none"})]})})}render(){let{currentImage:e,objectUrl:t,opts:r}=this.props,{actions:s}=r;return u("div",{className:"uppy-ImageCropper",children:[u("div",{className:"uppy-ImageCropper-container",children:u("img",{className:"uppy-ImageCropper-image",alt:e.name,src:t,ref:o(n=>{this.imgElement=n},"ref")})}),u("div",{className:"uppy-ImageCropper-controls",children:[s.revert&&this.renderRevert(),s.rotate&&this.renderRotate(),s.granularRotate&&this.renderGranularRotate(),s.flip&&this.renderFlip(),s.zoomIn&&this.renderZoomIn(),s.zoomOut&&this.renderZoomOut(),s.cropSquare&&this.renderCropSquare(),s.cropWidescreen&&this.renderCropWidescreen(),s.cropWidescreenVertical&&this.renderCropWidescreenVertical()]})]})}};var kf={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)"}};function K1(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,l=(i.width-n)/2,c=(i.height-a)/2;return{width:n,height:a,left:l,top:c}}o(K1,"getCanvasDataThatFitsPerfectlyIntoContainer");var Cf=K1;function Y1(i){return i*(Math.PI/180)}o(Y1,"toRadians");function J1(i,e,t){let r=Math.abs(Y1(t));return Math.max((Math.sin(r)*i+Math.cos(r)*e)/e,(Math.sin(r)*e+Math.cos(r)*i)/i)}o(J1,"getScaleFactorThatRemovesDarkCorners");var Ff=J1;function Q1(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(Q1,"limitCropboxMovementOnMove");var Rf=Q1;function Z1(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(Z1,"limitCropboxMovementOnResize");var Af=Z1;var ew={angle:0,angleGranular:0,isFlippedHorizontally:!1,aspectRatio:"free",cropperReady:!1},Of={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},If={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},tw={quality:.8,actions:If,cropperOptions:Of},Ns=class extends ae{static{o(this,"ImageEditor")}static VERSION=Tf.version;cropper=null;objectUrl=null;prevCropboxData=null;imgElement=null;cropstartHandler=null;cropendHandler=null;cropperReadyHandler=null;constructor(e,t){super(e,{...tw,...t,actions:{...If,...t?.actions},cropperOptions:{...Of,...t?.cropperOptions}}),this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=kf,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{currentImage:e}=this.getPluginState();if(!e||!this.cropper)return;let t=o(s=>{if(!s)return;let n=e.id;if(!this.uppy.getFile(n))return;this.uppy.setFileState(n,{data:new File([s],e.name??this.i18n("unnamed"),{type:s.type}),size:s.size,preview:void 0});let a=this.uppy.getFile(n);a&&(this.uppy.emit("thumbnail:request",a),this.setPluginState({currentImage:a}),this.uppy.emit("file-editor:complete",a))},"saveBlobCallback"),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(t,e.type,this.opts.quality)},"save");storeCropperInstance=o(e=>{this.cropper=e},"storeCropperInstance");selectFile=o(e=>{this.start(e)},"selectFile");resetEditorState=o((e=this.getPluginState().currentImage)=>{this.setPluginState({currentImage:e,...ew,cropperReady:!!this.cropper})},"resetEditorState");rotateBy=o(e=>{if(!this.cropper)return;let{angle:t,angleGranular:r,isFlippedHorizontally:s}=this.getPluginState(),a=t-r+e;this.cropper.scale(s?-1:1),this.cropper.rotateTo(a);let l=this.cropper.getCanvasData(),c=this.cropper.getContainerData(),p=Cf(c,l);this.cropper.setCanvasData(p),this.cropper.setCropBoxData(p),this.setPluginState({angle:a,angleGranular:0})},"rotateBy");rotateGranular=o(e=>{if(!this.cropper)return;let{angle:t,angleGranular:r,isFlippedHorizontally:s}=this.getPluginState(),a=t-r+e;this.cropper.rotateTo(a);let l=this.cropper.getImageData(),c=Ff(l.naturalWidth,l.naturalHeight,e),p=s?-c:c;this.cropper.scale(p,c),this.setPluginState({angle:a,angleGranular:e})},"rotateGranular");flipHorizontal=o(()=>{if(!this.cropper)return;let{isFlippedHorizontally:e}=this.getPluginState();this.cropper.scaleX(-this.cropper.getData().scaleX||-1),this.setPluginState({isFlippedHorizontally:!e})},"flipHorizontal");zoom=o(e=>{this.cropper&&this.cropper.zoom(e)},"zoom");setAspectRatio=o(e=>{if(!this.cropper)return;let t={free:0,"1:1":1,"16:9":16/9,"9:16":9/16};this.cropper.setAspectRatio(t[e]),this.setPluginState({aspectRatio:e})},"setAspectRatio");reset=o(()=>{this.cropper&&(this.cropper.reset(),this.cropper.setAspectRatio(this.opts.cropperOptions.initialAspectRatio||0),this.resetEditorState())},"reset");start=o(e=>{this.stop();let t=e.data;t instanceof Blob||(t=this.uppy.getFile(e.id)?.data),t instanceof Blob?this.objectUrl=URL.createObjectURL(t):console.warn("[Uppy ImageEditor] Cannot edit file: file.data is not a Blob.","File:",e,"file.data:",e.data,"typeof file.data:",typeof e.data),this.uppy.emit("file-editor:start",e),this.resetEditorState(e)},"start");stop=o(()=>{this.destroyCropper(),this.objectUrl&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=null),this.resetEditorState(null)},"stop");initCropper=o(e=>{this.cropper||(this.imgElement=e,this.cropper=new Uf.default(e,this.opts.cropperOptions),this.cropstartHandler=()=>{this.cropper&&(this.prevCropboxData=this.cropper.getCropBoxData())},this.cropendHandler=(t=>{if(!this.cropper||!this.prevCropboxData)return;let r=this.cropper.getCanvasData(),s=this.cropper.getCropBoxData();if(t.detail.action==="all"){let n=Rf(r,s,this.prevCropboxData);n&&this.cropper.setCropBoxData(n)}else{let n=Af(r,s,this.prevCropboxData);n&&this.cropper.setCropBoxData(n)}}),this.cropperReadyHandler=()=>{this.setPluginState({cropperReady:!0})},e.addEventListener("cropstart",this.cropstartHandler),e.addEventListener("cropend",this.cropendHandler),e.addEventListener("ready",this.cropperReadyHandler,{once:!0}))},"initCropper");destroyCropper=o(()=>{this.cropper&&(this.setPluginState({cropperReady:!1}),this.cropstartHandler&&this.imgElement&&this.imgElement.removeEventListener("cropstart",this.cropstartHandler),this.cropendHandler&&this.imgElement&&this.imgElement.removeEventListener("cropend",this.cropendHandler),this.cropperReadyHandler&&this.imgElement&&this.imgElement.removeEventListener("ready",this.cropperReadyHandler),this.cropper.destroy(),this.cropper=null,this.imgElement=null,this.cropstartHandler=null,this.cropendHandler=null,this.cropperReadyHandler=null,this.prevCropboxData=null)},"destroyCropper");getObjectUrl=o(()=>this.objectUrl,"getObjectUrl");handleFileRemoved=o(e=>{let{currentImage:t}=this.getPluginState();t&&t.id===e.id&&this.stop()},"handleFileRemoved");install(){this.resetEditorState(null),this.uppy.on("file-removed",this.handleFileRemoved);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.uppy.off("file-removed",this.handleFileRemoved),this.stop(),this.unmount()}render(){let{currentImage:e,angleGranular:t}=this.getPluginState();return e===null||e.isRemote?null:u(Ds,{currentImage:e,objectUrl:this.objectUrl??"",initCropper:this.initCropper,save:this.save,opts:this.opts,i18n:this.i18n,angleGranular:t,rotateBy:this.rotateBy,rotateGranular:this.rotateGranular,flipHorizontal:this.flipHorizontal,zoom:this.zoom,setAspectRatio:this.setAspectRatio,reset:this.reset})}};var Df={name:"@uppy/onedrive",description:"Import files from OneDrive, into Uppy.",version:"6.0.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:{preact:"^10.29.2"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^6.0.3"}};var Nf={strings:{pluginNameOneDrive:"OneDrive"}};var Li=class extends ae{static{o(this,"OneDrive")}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||Re,this.id=this.opts.id||"OneDrive",this.icon=()=>u("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:u("g",{fill:"none",fillRule:"nonzero",children:[u("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"}),u("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"}),u("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"}),u("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=Xe(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new Ke(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 We(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 Mf={name:"@uppy/unsplash",description:"Import files from Unsplash, the free stock photography resource, into Uppy",version:"6.0.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:{preact:"^10.29.2"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^6.0.3"}};var Lf={strings:{pluginNameUnsplash:"Unsplash"}};var Bi=class extends ae{static{o(this,"Unsplash")}static VERSION=Mf.version;icon;provider;view;storage;files;hostname;constructor(e,t){if(super(e,t),this.type="acquirer",this.files=[],this.storage=this.opts.storage||Re,this.id=this.opts.id||"Unsplash",this.defaultLocale=Lf,this.i18nInit(),this.title=this.i18n("pluginNameUnsplash"),this.icon=()=>u("svg",{className:"uppy-DashboardTab-iconUnsplash",viewBox:"0 0 32 32",height:"32",width:"32","aria-hidden":"true",children:u("g",{fill:"currentcolor",children:[u("path",{d:"M46.575 10.883v-9h12v9zm12 5h10v18h-32v-18h10v9h12z"}),u("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=Xe(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new Ti(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule,provider:"unsplash",pluginId:this.id})}install(){this.view=new li(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 Bf={name:"@uppy/url",description:"The Url plugin lets users import files from the Internet. Paste any URL and it\u2019ll be added!",version:"6.0.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",pretest:"yarn workspace @uppy/companion 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:{nanoid:"^5.1.11",preact:"^10.29.2"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^","@vitest/browser-playwright":"^4.1.6",cssnano:"^8.0.1",playwright:"1.61.1",postcss:"^8.5.23","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^6.0.3",vitest:"^4.1.6"}};var jf={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 jl=class extends de{static{o(this,"UrlUI")}form=document.createElement("form");input;constructor(e){super(e),this.form.id=Ot()}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 u("div",{className:"uppy-Url",children:[u("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}),u("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Url-importButton",type:"submit",form:this.form.id,children:e("import")})]})}},zf=jl;function yn(i,e,t){let r=ze(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(yn,"forEachDroppedOrPastedUrl");function ow(){return u("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:u("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(ow,"UrlIcon");function nw(i){let e=/^[a-z0-9]+:\/\//,t="http://";return e.test(i)?i:t+i}o(nw,"addProtocolToURL");function aw(i){return ze(i.dataTransfer.items).filter(r=>r.kind==="string"&&r.type==="text/uri-list").length>0}o(aw,"canHandleRootDrop");function lw(i){return i?.startsWith("http://")||i?.startsWith("https://")}o(lw,"checkIfCorrectURL");function uw(i){let{pathname:e}=new URL(i);return e.substring(e.lastIndexOf("/")+1)}o(uw,"getFileNameFromUrl");var di=class i extends ae{static{o(this,"Url")}static VERSION=Bf.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=()=>u(ow,{}),this.defaultLocale=jf,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 nt(e,{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=nw(e);if(!lw(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||uw(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=>{yn(e.dataTransfer,"drop",t=>{this.addFile(t)})},"handleRootDrop");handleRootPaste=o(e=>{yn(e.clipboardData,"paste",t=>{this.addFile(t)})},"handleRootPaste");render(){return u(zf,{i18n:this.i18n,addFile:this.addFile})}install(){let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount()}};di.prototype.canHandleRootDrop=aw;var Hf={name:"@uppy/zoom",description:"Import files from zoom, into Uppy.",version:"5.0.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:{preact:"^10.29.2"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^6.0.3"}};var qf={strings:{pluginNameZoom:"Zoom"}};var ji=class extends ae{static{o(this,"Zoom")}static VERSION=Hf.version;icon;provider;view;storage;files;rootFolderId=null;constructor(e,t){super(e,t),this.type="acquirer",this.files=[],this.storage=this.opts.storage||Re,this.id=this.opts.id||"Zoom",this.icon=()=>u("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:u("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=Xe(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new Ke(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=qf,this.i18nInit(),this.title=this.i18n("pluginNameZoom"),this.render=this.render.bind(this)}install(){this.view=new We(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 $f={name:"@uppy/remote-sources",description:"Uppy plugin that includes all remote sources that Uppy+Companion offer, like Google Drive, Dropbox, Box, Unsplash, Url etc",version:"4.0.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --silent='passed-only'"},keywords:["file uploader","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/onedrive":"workspace:^","@uppy/unsplash":"workspace:^","@uppy/url":"workspace:^","@uppy/zoom":"workspace:^"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{"@uppy/core":"workspace:^","@vitest/browser-playwright":"^4.1.6",playwright:"1.61.1",typescript:"^6.0.3",vitest:"^4.1.6"}};var zl={__proto__:null,Box:Ri,Dropbox:Di,Facebook:Ni,GoogleDrive:Mi,OneDrive:Li,Unsplash:Bi,Url:di,Zoom:ji},dw={sources:Object.keys(zl)},vn=class extends Pe{static{o(this,"RemoteSources")}static VERSION=$f.version;#e=new Set;constructor(e,t){if(super(e,{...dw,...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=zl[e];if(n==null){let a=Object.keys(zl),l=new Intl.ListFormat("en",{style:"long",type:"disjunction"});throw new Error(`Invalid plugin: "${e}" is not one of: ${l.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 Vf={name:"@uppy/screen-capture",description:"Uppy plugin that captures video from display or application.",version:"6.0.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:{preact:"^10.29.2"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{cssnano:"^8.0.1",postcss:"^8.5.23","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^6.0.3"}};var Wf={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 Hl({onDiscard:i,i18n:e}){return u("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:u("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:[u("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}o(Hl,"DiscardButton");function ql({recording:i,onStartRecording:e,onStopRecording:t,i18n:r}){return i?u("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:u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:u("rect",{x:"15",y:"15",width:"70",height:"70"})})}):u("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:u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:u("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(ql,"RecordButton");function $l({onScreenshot:i,i18n:e}){return u("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:u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:[u("path",{d:"M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z"}),u("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($l,"ScreenshotButton");function fw(i){return(i-(i%=60))/60+(i>9?":":":0")+i}o(fw,"fmtMSS");var Vl=class extends de{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=fw(r);return e&&!this.timerRunning&&this.startTimer(),!e&&this.timerRunning&&this.resetTimer(),e?u("div",{style:this.wrapperStyle,children:[u("div",{style:this.overlayStyle}),u("div",{style:this.infoContainerStyle,children:[u("div",{style:this.infotextStyle,children:t("recording")}),u("div",{style:this.timeStyle,children:s})]})]}):null}},Gf=Vl;function Wl({streamActive:i,i18n:e}){return i?u("div",{title:e("streamActive"),className:"uppy-ScreenCapture-icon--stream uppy-ScreenCapture-icon--streamActive",children:u("svg",{"aria-hidden":"true",focusable:"false",width:"24",height:"24",viewBox:"0 0 24 24",children:[u("path",{d:"M0 0h24v24H0z",opacity:".1",fill:"none"}),u("path",{d:"M0 0h24v24H0z",fill:"none"}),u("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"})]})}):u("div",{title:e("streamPassive"),className:"uppy-ScreenCapture-icon--stream",children:u("svg",{"aria-hidden":"true",focusable:"false",width:"24",height:"24",viewBox:"0 0 24 24",children:[u("path",{d:"M0 0h24v24H0z",opacity:".1",fill:"none"}),u("path",{d:"M0 0h24v24H0z",fill:"none"}),u("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(Wl,"StreamStatus");function Gl({recording:i,recordedVideo:e,onSubmit:t,capturedScreenshotUrl:r,i18n:s}){return(e||r)&&!i?u("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:u("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:u("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(Gl,"SubmitButton");var Xl=class extends de{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)),u("div",{className:"uppy uppy-ScreenCapture-container",children:[u("div",{className:"uppy-ScreenCapture-mediaContainer",children:[u(Wl,{...this.props}),n&&!e&&!r?u("div",{className:"uppy-ScreenCapture-imageContainer",children:u("img",{src:n,className:"uppy-ScreenCapture-media",alt:"screenshotPreview"})}):u("video",{ref:o(l=>{this.videoElement=l},"ref"),className:"uppy-ScreenCapture-media",...a}),u("div",{children:u(Gf,{...this.props})})]}),u("div",{className:"uppy-ScreenCapture-buttonContainer",children:r||n?u(Ee,{children:[u(Gl,{...this.props}),u(Hl,{...this.props})]}):u(Ee,{children:[s&&!e&&u($l,{...this.props}),u(ql,{...this.props})]})})]})}},Xf=Xl;function Kl(){return u("svg",{className:"uppy-DashboardTab-iconScreenRec","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:u("g",{fill:"currentcolor",fillRule:"evenodd",children:[u("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"}),u("circle",{cx:"16",cy:"16",r:"2"})]})})}o(Kl,"ScreenRecIcon");function mw(){return window.MediaRecorder&&navigator.mediaDevices?.getDisplayMedia}o(mw,"isScreenRecordingSupported");function gw(){return window.MediaRecorder&&navigator.mediaDevices}o(gw,"getMediaDevices");var yw=["image/png","image/jpeg","image/webp"],vw={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},Ms=class extends ae{static{o(this,"ScreenCapture")}static VERSION=Vf.version;mediaDevices;protocol;icon;streamInterrupted;captureActive;capturedMediaFile;videoStream=null;audioStream=null;userDenied=!1;recorder=null;outputStream=null;recordingChunks=null;constructor(e,t){super(e,{...vw,...t}),this.mediaDevices=gw(),this.protocol=location.protocol==="https:"?"https":"http",this.id=this.opts.id||"ScreenCapture",this.type="acquirer",this.icon=Kl,this.defaultLocale=Wf,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(!mw())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)&&St(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=St(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 l=await this.selectVideoStreamSource();if(!l)throw new Error("Failed to get screen capture stream");e=l}let t=document.createElement("video");t.srcObject=e,await new Promise(l=>{t.onloadedmetadata=()=>{t.play(),l(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||!yw.includes(n))&&(this.uppy.log(`Unsupported image type "${n}", falling back to image/png`,"warning"),n="image/png");let a=1;return new Promise((l,c)=>{r.toBlob(p=>{if(!p){c(new Error("Failed to create screenshot blob"));return}let h=St(n)||"png",g={source:this.id,name:`Screenshot ${new Date().toISOString()}.${h}`,type:n,data:p};try{this.capturedMediaFile=g;let y=URL.createObjectURL(p);this.setPluginState({capturedScreenshotUrl:y,status:"captured"}),l()}catch(y){this.getPluginState().capturedScreenshotUrl&&this.setPluginState({capturedScreenshotUrl:null}),y.isRestriction||this.uppy.log(y,"error"),c(y)}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(),u(Xf,{...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 Kf={name:"@uppy/status-bar",description:"A progress bar for Uppy, with many bells and whistles.",version:"6.0.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":"^2.0.0",classnames:"^2.5.1",preact:"^10.29.2"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{cssnano:"^8.0.1",postcss:"^8.5.23","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^6.0.3"}};var Yf={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 Zl=he(Ve(),1);var Yl=he(Ve(),1);var ww="\xB7",Jf=o(()=>` ${ww} `,"renderDot");function Qf(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:a,startUpload:l}=i,c=(0,Yl.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 u("button",{type:"button",className:c,"aria-label":s("uploadXFiles",{smart_count:e}),onClick:l,disabled:a,"data-uppy-super-focusable":!0,children:p})}o(Qf,"UploadBtn");function Zf(i){let{i18n:e,uppy:t}=i;return u("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:[u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10",children:u("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(Zf,"RetryBtn");function em(i){let{i18n:e,uppy:t}=i;return u("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:u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:u("g",{fill:"none",fillRule:"evenodd",children:[u("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),u("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(em,"CancelBtn");function tm(i){let{isAllPaused:e,i18n:t,isAllComplete:r,resumableUploads:s,uppy:n}=i,a=t(e?"resume":"pause");function l(){if(!r){if(!s){n.cancelAll();return}if(e){n.resumeAll();return}n.pauseAll()}}return o(l,"togglePauseResume"),u("button",{title:a,"aria-label":a,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:l,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0,children:u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:u("g",{fill:"none",fillRule:"evenodd",children:[u("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),u("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"})]})})})}o(tm,"PauseResumeButton");function im(i){let{i18n:e,doneButtonHandler:t}=i;return u("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(im,"DoneBtn");function rm(){return u("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14",children:u("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(rm,"LoadingSpinner");function sm(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return u("div",{className:"uppy-StatusBar-content",children:[u(rm,{}),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s]})}o(sm,"ProgressBarProcessing");function Sw(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:a}=i,l=e>1,c=tt(r);return u("div",{className:"uppy-StatusBar-statusSecondary",children:[l&&a("filesUploadedOfTotal",{complete:t,smart_count:e}),u("span",{className:"uppy-StatusBar-additionalInfo",children:[l&&Jf(),s!=null?a("dataUploadedOfTotal",{complete:c,total:tt(s)}):a("dataUploadedOfUnknown",{complete:c}),Jf(),n!=null&&a("xTimeLeft",{time:tr(n)})]})]})}o(Sw,"ProgressDetails");function om(i){let{i18n:e,complete:t,numUploads:r}=i;return u("div",{className:"uppy-StatusBar-statusSecondary",children:e("filesUploadedOfTotal",{complete:t,smart_count:r})})}o(om,"FileUploadCount");function xw(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,Yl.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return u("div",{className:"uppy-StatusBar-statusSecondary",children:[u("div",{className:"uppy-StatusBar-statusSecondaryHint",children:e("xMoreFilesAdded",{smart_count:t})}),u("button",{type:"button",className:s,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:r,children:e("upload")})]})}o(xw,"UploadNewlyAddedFiles");function nm(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,showProgressDetails:s,isUploadStarted:n,isAllComplete:a,isAllPaused:l,newFiles:c,numUploads:p,complete:h,totalUploadedSize:g,totalSize:y,totalETA:S,startUpload:P}=i,F=c&&n;if(!n||a)return null;let D=e(l?"paused":"uploading");function q(){return!l&&!F&&s?t?u(Sw,{numUploads:p,complete:h,totalUploadedSize:g,totalSize:y,totalETA:S,i18n:e}):u(om,{i18n:e,complete:h,numUploads:p}):null}return o(q,"renderProgressDetails"),u("div",{className:"uppy-StatusBar-content",title:D,children:[l?null:u(rm,{}),u("div",{className:"uppy-StatusBar-status",children:[u("div",{className:"uppy-StatusBar-statusPrimary",children:t&&r!==0?`${D}: ${r}%`:D}),q(),F?u(xw,{i18n:e,newFiles:c,startUpload:P}):null]})]})}o(nm,"ProgressBarUploading");function am(i){let{i18n:e}=i;return u("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete"),children:u("div",{className:"uppy-StatusBar-status",children:u("div",{className:"uppy-StatusBar-statusPrimary",children:[u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11",children:u("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})}),e("complete")]})})})}o(am,"ProgressBarComplete");function lm(i){let{error:e,i18n:t,complete:r,numUploads:s}=i;function n(){let a=`${t("uploadFailed")}
${e}`;alert(a)}return o(n,"displayErrorAlert"),u("div",{className:"uppy-StatusBar-content",title:t("uploadFailed"),children:[u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11",children:u("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"})}),u("div",{className:"uppy-StatusBar-status",children:[u("div",{className:"uppy-StatusBar-statusPrimary",children:[t("uploadFailed"),u("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:"?"})]}),u(om,{i18n:t,complete:r,numUploads:s})]})]})}o(lm,"ProgressBarError");function Ls(i){let e=[],t="indeterminate",r;for(let{progress:n}of Object.values(i)){let{preprocess:a,postprocess:l}=n;r==null&&(a||l)&&({mode:t,message:r}=a||l),a?.mode==="determinate"&&e.push(a.value),l?.mode==="determinate"&&e.push(l.value)}let s=e.reduce((n,a)=>n+a/e.length,0);return{mode:t,message:r,value:s}}o(Ls,"calculateProcessingProgress");var{STATE_ERROR:um,STATE_WAITING:_w,STATE_PREPROCESSING:Jl,STATE_UPLOADING:bn,STATE_POSTPROCESSING:Ql,STATE_COMPLETE:wn}=yt;function eu({newFiles:i,allowNewUpload:e,isUploadInProgress:t,isAllPaused:r,resumableUploads:s,error:n,hideUploadButton:a=void 0,hidePauseResumeButton:l=!1,hideCancelButton:c=!1,hideRetryButton:p=!1,recoveredState:h,uploadState:g,totalProgress:y,files:S,supportsUploadProgress:P,hideAfterFinish:F=!1,isSomeGhost:D,doneButtonHandler:q=void 0,isUploadStarted:R,i18n:C,startUpload:j,uppy:W,isAllComplete:B,showProgressDetails:Q=void 0,numUploads:K,complete:ee,totalSize:ne,totalETA:le,totalUploadedSize:Fe}){function be(){switch(g){case Ql:case Jl:{let J=Ls(S);return J.mode==="determinate"?J.value*100:y}case um:return null;case bn:return P?y:null;default:return y}}o(be,"getProgressValue");function fe(){switch(g){case Ql:case Jl:{let{mode:J}=Ls(S);return J==="indeterminate"}case bn:return!P;default:return!1}}o(fe,"getIsIndeterminate");let _e=be(),T=_e??100,w=!n&&i&&(!t&&!r||h)&&e&&!a,_=!c&&g!==_w&&g!==wn,L=s&&!l&&g===bn,$=n&&!B&&!p,z=q&&g===wn,Z=(0,Zl.default)("uppy-StatusBar-progress",{"is-indeterminate":fe()}),N=(0,Zl.default)("uppy-StatusBar",`is-${g}`,{"has-ghosts":D}),k=(()=>{switch(g){case Jl:case Ql:return u(sm,{progress:Ls(S)});case wn:return u(am,{i18n:C});case um:return u(lm,{error:n,i18n:C,numUploads:K,complete:ee});case bn:return u(nm,{i18n:C,supportsUploadProgress:P,totalProgress:y,showProgressDetails:Q,isUploadStarted:R,isAllComplete:B,isAllPaused:r,newFiles:i,numUploads:K,complete:ee,totalUploadedSize:Fe,totalSize:ne,totalETA:le,startUpload:j});default:return null}})();return!(w||$||L||_||z)&&!k||g===wn&&F?null:u("div",{className:N,children:[u("div",{className:Z,style:{width:`${T}%`},role:"progressbar","aria-label":`${T}%`,"aria-valuetext":`${T}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":_e}),k,u("div",{className:"uppy-StatusBar-actions",children:[w?u(Qf,{newFiles:i,isUploadStarted:R,recoveredState:h,i18n:C,isSomeGhost:D,startUpload:j,uploadState:g}):null,$?u(Zf,{i18n:C,uppy:W}):null,L?u(tm,{isAllPaused:r,i18n:C,isAllComplete:B,resumableUploads:s,uppy:W}):null,_?u(em,{i18n:C,uppy:W}):null,z?u(im,{i18n:C,doneButtonHandler:q}):null]})]})}o(eu,"StatusBarUI");var Ew=2e3,Pw=2e3;function Tw(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:l}=r[n[a]];if(l.uploadStarted&&!l.uploadComplete)return yt.STATE_UPLOADING;l.preprocess&&(s=yt.STATE_PREPROCESSING),l.postprocess&&s!==yt.STATE_PREPROCESSING&&(s=yt.STATE_POSTPROCESSING)}return s}o(Tw,"getUploadingState");var kw={hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideCancelButton:!1,showProgressDetails:!1,hideAfterFinish:!0,doneButtonHandler:null},Bs=class extends ae{static{o(this,"StatusBar")}static VERSION=Kf.version;#e;#t;#i;#r;constructor(e,t){super(e,{...kw,...t}),this.id=this.opts.id||"StatusBar",this.title="StatusBar",this.type="progressindicator",this.defaultLocale=Yf,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.#r??0)/100)/10;let s=e.uploaded-this.#t;if(this.#t=e.uploaded,s<=0)return Math.round((this.#r??0)/100)/10;let n=s/r,a=this.#i==null?n:ii(n,this.#i,Ew,r);this.#i=a;let l=t/a,c=Math.max(this.#r-r,0),p=this.#r==null?l:ii(l,c,Pw,r);return this.#r=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:l}=e,{newFiles:c,startedFiles:p,completeFiles:h,isUploadStarted:g,isAllComplete:y,isAllPaused:S,isUploadInProgress:P,isSomeGhost:F}=this.uppy.getObjectOfFilesPerState(),D=l?Object.values(r):c,q=!!t.resumableUploads,R=t.uploadProgress!==!1,C=null,j=0;p.every(B=>B.progress.bytesTotal!=null&&B.progress.bytesTotal!==0)?(C=0,p.forEach(B=>{C+=B.progress.bytesTotal||0,j+=B.progress.bytesUploaded||0})):p.forEach(B=>{j+=B.progress.bytesUploaded||0});let W=this.#s({uploaded:j,total:C});return eu({error:a,uploadState:Tw(a,y,l,e.files||{}),allowNewUpload:s,totalProgress:n,totalSize:C,totalUploadedSize:j,isAllComplete:!1,isAllPaused:S,isUploadStarted:g,isUploadInProgress:P,isSomeGhost:F,recoveredState:l,complete:h.length,newFiles:D.length,numUploads:p.length,totalETA:W,files:r,i18n:this.i18n,uppy:this.uppy,startUpload:this.startUpload,doneButtonHandler:this.opts.doneButtonHandler,resumableUploads:q,supportsUploadProgress:R,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;$r(e)||(e.dir="ltr")}#o=o(()=>{let{recoveredState:e}=this.uppy.getState();if(this.#i=null,this.#r=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.#o),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.#o)}};function Tr(i){"@babel/helpers - typeof";return Tr=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},Tr(i)}o(Tr,"_typeof");function cm(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,Fw(r.key),r)}}o(cm,"_defineProperties");function Cw(i,e,t){return e&&cm(i.prototype,e),t&&cm(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(Cw,"_createClass");function Fw(i){var e=Rw(i,"string");return Tr(e)=="symbol"?e:e+""}o(Fw,"_toPropertyKey");function Rw(i,e){if(Tr(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Tr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(Rw,"_toPrimitive");function Aw(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(Aw,"_classCallCheck");function Uw(i,e,t){return e=zs(e),Ow(i,iu()?Reflect.construct(e,t||[],zs(i).constructor):e.apply(i,t))}o(Uw,"_callSuper");function Ow(i,e){if(e&&(Tr(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Iw(i)}o(Ow,"_possibleConstructorReturn");function Iw(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}o(Iw,"_assertThisInitialized");function Dw(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&&js(i,e)}o(Dw,"_inherits");function tu(i){var e=typeof Map=="function"?new Map:void 0;return tu=o(function(r){if(r===null||!Mw(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 Nw(r,arguments,zs(this).constructor)}return o(s,"Wrapper"),s.prototype=Object.create(r.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),js(s,r)},"_wrapNativeSuper"),tu(i)}o(tu,"_wrapNativeSuper");function Nw(i,e,t){if(iu())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var s=new(i.bind.apply(i,r));return t&&js(s,t.prototype),s}o(Nw,"_construct");function iu(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(iu=o(function(){return!!i},"_isNativeReflectConstruct"))()}o(iu,"_isNativeReflectConstruct");function Mw(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}o(Mw,"_isNativeFunction");function js(i,e){return js=Object.setPrototypeOf?Object.setPrototypeOf.bind():o(function(r,s){return r.__proto__=s,r},"_setPrototypeOf"),js(i,e)}o(js,"_setPrototypeOf");function zs(i){return zs=Object.setPrototypeOf?Object.getPrototypeOf.bind():o(function(t){return t.__proto__||Object.getPrototypeOf(t)},"_getPrototypeOf"),zs(i)}o(zs,"_getPrototypeOf");var Lw=(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(Aw(this,e),r=Uw(this,e,[t]),r.originalRequest=n,r.originalResponse=a,r.causingError=s,s!=null&&(t+=", caused by ".concat(s.toString())),n!=null){var l=n.getHeader("X-Request-ID")||"n/a",c=n.getMethod(),p=n.getURL(),h=a?a.getStatus():"n/a",g=a?a.getBody()||"":"n/a";t+=", originated from request (method: ".concat(c,", url: ").concat(p,", response code: ").concat(h,", response text: ").concat(g,", request id: ").concat(l,")")}return r.message=t,r}return o(e,"DetailedError"),Dw(e,i),Cw(e)})(tu(Error)),kr=Lw;var Bw=!1;function hi(i){Bw&&console.log(i)}o(hi,"log");function Hs(i){"@babel/helpers - typeof";return Hs=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},Hs(i)}o(Hs,"_typeof");function jw(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(jw,"_classCallCheck");function pm(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,Hw(r.key),r)}}o(pm,"_defineProperties");function zw(i,e,t){return e&&pm(i.prototype,e),t&&pm(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(zw,"_createClass");function Hw(i){var e=qw(i,"string");return Hs(e)=="symbol"?e:e+""}o(Hw,"_toPropertyKey");function qw(i,e){if(Hs(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Hs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(qw,"_toPrimitive");var dm=(function(){function i(){jw(this,i)}return o(i,"NoopUrlStorage"),zw(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 vm="3.7.7",$w=vm,Fr=typeof Buffer=="function",hm=typeof TextDecoder=="function"?new TextDecoder:void 0,fm=typeof TextEncoder=="function"?new TextEncoder:void 0,Vw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",qs=Array.prototype.slice.call(Vw),Sn=(i=>{let e={};return i.forEach((t,r)=>e[t]=r),e})(qs),Ww=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Ye=String.fromCharCode.bind(String),mm=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):i=>new Uint8Array(Array.prototype.slice.call(i,0)),bm=o(i=>i.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),"_mkUriSafe"),wm=o(i=>i.replace(/[^A-Za-z0-9\+\/]/g,""),"_tidyB64"),Sm=o(i=>{let e,t,r,s,n="",a=i.length%3;for(let l=0;l<i.length;){if((t=i.charCodeAt(l++))>255||(r=i.charCodeAt(l++))>255||(s=i.charCodeAt(l++))>255)throw new TypeError("invalid character found");e=t<<16|r<<8|s,n+=qs[e>>18&63]+qs[e>>12&63]+qs[e>>6&63]+qs[e&63]}return a?n.slice(0,a-3)+"===".substring(a):n},"btoaPolyfill"),ou=typeof btoa=="function"?i=>btoa(i):Fr?i=>Buffer.from(i,"binary").toString("base64"):Sm,ru=Fr?i=>Buffer.from(i).toString("base64"):i=>{let t=[];for(let r=0,s=i.length;r<s;r+=4096)t.push(Ye.apply(null,i.subarray(r,r+4096)));return ou(t.join(""))},xn=o((i,e=!1)=>e?bm(ru(i)):ru(i),"fromUint8Array"),Gw=o(i=>{if(i.length<2){var e=i.charCodeAt(0);return e<128?i:e<2048?Ye(192|e>>>6)+Ye(128|e&63):Ye(224|e>>>12&15)+Ye(128|e>>>6&63)+Ye(128|e&63)}else{var e=65536+(i.charCodeAt(0)-55296)*1024+(i.charCodeAt(1)-56320);return Ye(240|e>>>18&7)+Ye(128|e>>>12&63)+Ye(128|e>>>6&63)+Ye(128|e&63)}},"cb_utob"),Xw=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,xm=o(i=>i.replace(Xw,Gw),"utob"),gm=Fr?i=>Buffer.from(i,"utf8").toString("base64"):fm?i=>ru(fm.encode(i)):i=>ou(xm(i)),Cr=o((i,e=!1)=>e?bm(gm(i)):gm(i),"encode"),ym=o(i=>Cr(i,!0),"encodeURI"),Kw=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Yw=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 Ye((t>>>10)+55296)+Ye((t&1023)+56320);case 3:return Ye((15&i.charCodeAt(0))<<12|(63&i.charCodeAt(1))<<6|63&i.charCodeAt(2));default:return Ye((31&i.charCodeAt(0))<<6|63&i.charCodeAt(1))}},"cb_btou"),_m=o(i=>i.replace(Kw,Yw),"btou"),Em=o(i=>{if(i=i.replace(/\s+/g,""),!Ww.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=Sn[i.charAt(n++)]<<18|Sn[i.charAt(n++)]<<12|(r=Sn[i.charAt(n++)])<<6|(s=Sn[i.charAt(n++)]),t+=r===64?Ye(e>>16&255):s===64?Ye(e>>16&255,e>>8&255):Ye(e>>16&255,e>>8&255,e&255);return t},"atobPolyfill"),nu=typeof atob=="function"?i=>atob(wm(i)):Fr?i=>Buffer.from(i,"base64").toString("binary"):Em,Pm=Fr?i=>mm(Buffer.from(i,"base64")):i=>mm(nu(i).split("").map(e=>e.charCodeAt(0))),Tm=o(i=>Pm(km(i)),"toUint8Array"),Jw=Fr?i=>Buffer.from(i,"base64").toString("utf8"):hm?i=>hm.decode(Pm(i)):i=>_m(nu(i)),km=o(i=>wm(i.replace(/[-_]/g,e=>e=="-"?"+":"/")),"_unURI"),su=o(i=>Jw(km(i)),"decode"),Qw=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"),Cm=o(i=>({value:i,enumerable:!1,writable:!0,configurable:!0}),"_noEnum"),Fm=o(function(){let i=o((e,t)=>Object.defineProperty(String.prototype,e,Cm(t)),"_add");i("fromBase64",function(){return su(this)}),i("toBase64",function(e){return Cr(this,e)}),i("toBase64URI",function(){return Cr(this,!0)}),i("toBase64URL",function(){return Cr(this,!0)}),i("toUint8Array",function(){return Tm(this)})},"extendString"),Rm=o(function(){let i=o((e,t)=>Object.defineProperty(Uint8Array.prototype,e,Cm(t)),"_add");i("toBase64",function(e){return xn(this,e)}),i("toBase64URI",function(){return xn(this,!0)}),i("toBase64URL",function(){return xn(this,!0)})},"extendUint8Array"),Zw=o(()=>{Fm(),Rm()},"extendBuiltins"),Am={version:vm,VERSION:$w,atob:nu,atobPolyfill:Em,btoa:ou,btoaPolyfill:Sm,fromBase64:su,toBase64:Cr,encode:Cr,encodeURI:ym,encodeURL:ym,utob:xm,btou:_m,decode:su,isValid:Qw,fromUint8Array:xn,toUint8Array:Tm,extendString:Fm,extendUint8Array:Rm,extendBuiltins:Zw};var rg=he($m());function cu(){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(cu,"uuid");function pu(){"use strict";pu=o(function(){return e},"_regeneratorRuntime");var i,e={},t=Object.prototype,r=t.hasOwnProperty,s=Object.defineProperty||function(T,w,_){T[w]=_.value},n=typeof Symbol=="function"?Symbol:{},a=n.iterator||"@@iterator",l=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function p(T,w,_){return Object.defineProperty(T,w,{value:_,enumerable:!0,configurable:!0,writable:!0}),T[w]}o(p,"define");try{p({},"")}catch{p=o(function(_,L,$){return _[L]=$},"define")}function h(T,w,_,L){var $=w&&w.prototype instanceof q?w:q,z=Object.create($.prototype),Z=new fe(L||[]);return s(z,"_invoke",{value:ne(T,_,Z)}),z}o(h,"wrap");function g(T,w,_){try{return{type:"normal",arg:T.call(w,_)}}catch(L){return{type:"throw",arg:L}}}o(g,"tryCatch"),e.wrap=h;var y="suspendedStart",S="suspendedYield",P="executing",F="completed",D={};function q(){}o(q,"Generator");function R(){}o(R,"GeneratorFunction");function C(){}o(C,"GeneratorFunctionPrototype");var j={};p(j,a,function(){return this});var W=Object.getPrototypeOf,B=W&&W(W(_e([])));B&&B!==t&&r.call(B,a)&&(j=B);var Q=C.prototype=q.prototype=Object.create(j);function K(T){["next","throw","return"].forEach(function(w){p(T,w,function(_){return this._invoke(w,_)})})}o(K,"defineIteratorMethods");function ee(T,w){function _($,z,Z,N){var k=g(T[$],T,z);if(k.type!=="throw"){var U=k.arg,M=U.value;return M&&zi(M)=="object"&&r.call(M,"__await")?w.resolve(M.__await).then(function(Y){_("next",Y,Z,N)},function(Y){_("throw",Y,Z,N)}):w.resolve(M).then(function(Y){U.value=Y,Z(U)},function(Y){return _("throw",Y,Z,N)})}N(k.arg)}o(_,"invoke");var L;s(this,"_invoke",{value:o(function(z,Z){function N(){return new w(function(k,U){_(z,Z,k,U)})}return o(N,"callInvokeWithMethodAndArg"),L=L?L.then(N,N):N()},"value")})}o(ee,"AsyncIterator");function ne(T,w,_){var L=y;return function($,z){if(L===P)throw Error("Generator is already running");if(L===F){if($==="throw")throw z;return{value:i,done:!0}}for(_.method=$,_.arg=z;;){var Z=_.delegate;if(Z){var N=le(Z,_);if(N){if(N===D)continue;return N}}if(_.method==="next")_.sent=_._sent=_.arg;else if(_.method==="throw"){if(L===y)throw L=F,_.arg;_.dispatchException(_.arg)}else _.method==="return"&&_.abrupt("return",_.arg);L=P;var k=g(T,w,_);if(k.type==="normal"){if(L=_.done?F:S,k.arg===D)continue;return{value:k.arg,done:_.done}}k.type==="throw"&&(L=F,_.method="throw",_.arg=k.arg)}}}o(ne,"makeInvokeMethod");function le(T,w){var _=w.method,L=T.iterator[_];if(L===i)return w.delegate=null,_==="throw"&&T.iterator.return&&(w.method="return",w.arg=i,le(T,w),w.method==="throw")||_!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+_+"' method")),D;var $=g(L,T.iterator,w.arg);if($.type==="throw")return w.method="throw",w.arg=$.arg,w.delegate=null,D;var z=$.arg;return z?z.done?(w[T.resultName]=z.value,w.next=T.nextLoc,w.method!=="return"&&(w.method="next",w.arg=i),w.delegate=null,D):z:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}o(le,"maybeInvokeDelegate");function Fe(T){var w={tryLoc:T[0]};1 in T&&(w.catchLoc=T[1]),2 in T&&(w.finallyLoc=T[2],w.afterLoc=T[3]),this.tryEntries.push(w)}o(Fe,"pushTryEntry");function be(T){var w=T.completion||{};w.type="normal",delete w.arg,T.completion=w}o(be,"resetTryEntry");function fe(T){this.tryEntries=[{tryLoc:"root"}],T.forEach(Fe,this),this.reset(!0)}o(fe,"Context");function _e(T){if(T||T===""){var w=T[a];if(w)return w.call(T);if(typeof T.next=="function")return T;if(!isNaN(T.length)){var _=-1,L=o(function $(){for(;++_<T.length;)if(r.call(T,_))return $.value=T[_],$.done=!1,$;return $.value=i,$.done=!0,$},"next");return L.next=L}}throw new TypeError(zi(T)+" is not iterable")}return o(_e,"values"),R.prototype=C,s(Q,"constructor",{value:C,configurable:!0}),s(C,"constructor",{value:R,configurable:!0}),R.displayName=p(C,c,"GeneratorFunction"),e.isGeneratorFunction=function(T){var w=typeof T=="function"&&T.constructor;return!!w&&(w===R||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(T){return Object.setPrototypeOf?Object.setPrototypeOf(T,C):(T.__proto__=C,p(T,c,"GeneratorFunction")),T.prototype=Object.create(Q),T},e.awrap=function(T){return{__await:T}},K(ee.prototype),p(ee.prototype,l,function(){return this}),e.AsyncIterator=ee,e.async=function(T,w,_,L,$){$===void 0&&($=Promise);var z=new ee(h(T,w,_,L),$);return e.isGeneratorFunction(w)?z:z.next().then(function(Z){return Z.done?Z.value:z.next()})},K(Q),p(Q,c,"Generator"),p(Q,a,function(){return this}),p(Q,"toString",function(){return"[object Generator]"}),e.keys=function(T){var w=Object(T),_=[];for(var L in w)_.push(L);return _.reverse(),o(function $(){for(;_.length;){var z=_.pop();if(z in w)return $.value=z,$.done=!1,$}return $.done=!0,$},"next")},e.values=_e,fe.prototype={constructor:fe,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(be),!w)for(var _ in this)_.charAt(0)==="t"&&r.call(this,_)&&!isNaN(+_.slice(1))&&(this[_]=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 _=this;function L(U,M){return Z.type="throw",Z.arg=w,_.next=U,M&&(_.method="next",_.arg=i),!!M}o(L,"handle");for(var $=this.tryEntries.length-1;$>=0;--$){var z=this.tryEntries[$],Z=z.completion;if(z.tryLoc==="root")return L("end");if(z.tryLoc<=this.prev){var N=r.call(z,"catchLoc"),k=r.call(z,"finallyLoc");if(N&&k){if(this.prev<z.catchLoc)return L(z.catchLoc,!0);if(this.prev<z.finallyLoc)return L(z.finallyLoc)}else if(N){if(this.prev<z.catchLoc)return L(z.catchLoc,!0)}else{if(!k)throw Error("try statement without catch or finally");if(this.prev<z.finallyLoc)return L(z.finallyLoc)}}}},"dispatchException"),abrupt:o(function(w,_){for(var L=this.tryEntries.length-1;L>=0;--L){var $=this.tryEntries[L];if($.tryLoc<=this.prev&&r.call($,"finallyLoc")&&this.prev<$.finallyLoc){var z=$;break}}z&&(w==="break"||w==="continue")&&z.tryLoc<=_&&_<=z.finallyLoc&&(z=null);var Z=z?z.completion:{};return Z.type=w,Z.arg=_,z?(this.method="next",this.next=z.finallyLoc,D):this.complete(Z)},"abrupt"),complete:o(function(w,_){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"&&_&&(this.next=_),D},"complete"),finish:o(function(w){for(var _=this.tryEntries.length-1;_>=0;--_){var L=this.tryEntries[_];if(L.finallyLoc===w)return this.complete(L.completion,L.afterLoc),be(L),D}},"finish"),catch:o(function(w){for(var _=this.tryEntries.length-1;_>=0;--_){var L=this.tryEntries[_];if(L.tryLoc===w){var $=L.completion;if($.type==="throw"){var z=$.arg;be(L)}return z}}throw Error("illegal catch attempt")},"_catch"),delegateYield:o(function(w,_,L){return this.delegate={iterator:_e(w),resultName:_,nextLoc:L},this.method==="next"&&(this.arg=i),D},"delegateYield")},e}o(pu,"_regeneratorRuntime");function Vm(i,e,t,r,s,n,a){try{var l=i[n](a),c=l.value}catch(p){t(p);return}l.done?e(c):Promise.resolve(c).then(r,s)}o(Vm,"asyncGeneratorStep");function pS(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function a(c){Vm(n,r,s,a,l,"next",c)}o(a,"_next");function l(c){Vm(n,r,s,a,l,"throw",c)}o(l,"_throw"),a(void 0)})}}o(pS,"_asyncToGenerator");function eg(i,e){return fS(i)||hS(i,e)||tg(i,e)||dS()}o(eg,"_slicedToArray");function dS(){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(dS,"_nonIterableRest");function hS(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var r,s,n,a,l=[],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)&&(l.push(r.value),l.length!==e);c=!0);}catch(h){p=!0,s=h}finally{try{if(!c&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(p)throw s}}return l}}o(hS,"_iterableToArrayLimit");function fS(i){if(Array.isArray(i))return i}o(fS,"_arrayWithHoles");function zi(i){"@babel/helpers - typeof";return zi=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},zi(i)}o(zi,"_typeof");function mS(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=tg(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,l;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,l=p},"e"),f:o(function(){try{!n&&t.return!=null&&t.return()}finally{if(a)throw l}},"f")}}o(mS,"_createForOfIteratorHelper");function tg(i,e){if(i){if(typeof i=="string")return Wm(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 Wm(i,e)}}o(tg,"_unsupportedIterableToArray");function Wm(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(Wm,"_arrayLikeToArray");function Gm(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(Gm,"ownKeys");function Rr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Gm(Object(t),!0).forEach(function(r){gS(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Gm(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}o(Rr,"_objectSpread");function gS(i,e,t){return e=ig(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}o(gS,"_defineProperty");function yS(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(yS,"_classCallCheck");function Xm(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,ig(r.key),r)}}o(Xm,"_defineProperties");function vS(i,e,t){return e&&Xm(i.prototype,e),t&&Xm(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(vS,"_createClass");function ig(i){var e=bS(i,"string");return zi(e)=="symbol"?e:e+""}o(ig,"_toPropertyKey");function bS(i,e){if(zi(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(zi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(bS,"_toPrimitive");var En="tus-v1",Pn="ietf-draft-03",$s="ietf-draft-05",wS={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:og,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:En},sg=(function(){function i(e,t){yS(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"),vS(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(![En,Pn,$s].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 l=a[n];if(this.options[l]){this._emitError(new Error("tus: cannot use the ".concat(l," 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?hi("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):hi("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,l=(t=this.options.parallelUploadBoundaries)!==null&&t!==void 0?t:xS(this._source.size,a);this._parallelUploadUrls&&l.forEach(function(h,g){h.uploadUrl=r._parallelUploadUrls[g]||null}),this._parallelUploadUrls=new Array(l.length);var c=l.map(function(h,g){var y=0;return r._source.slice(h.start,h.end).then(function(S){var P=S.value;return new Promise(function(F,D){var q=Rr(Rr({},r.options),{},{uploadUrl:h.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:r.options.metadataForPartialUploads,headers:Rr(Rr({},r.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:F,onError:D,onProgress:o(function(j){n=n-y+j,y=j,r._emitProgress(n,s)},"onProgress"),onUploadUrlAvailable:o(function(){r._parallelUploadUrls[g]=R.url,r._parallelUploadUrls.filter(function(j){return!!j}).length===l.length&&r._saveUploadInUrlStorage()},"onUploadUrlAvailable")}),R=new i(P,q);R.start(),r._parallelUploads.push(R)})})}),p;Promise.all(c).then(function(){p=r._openRequest("POST",r.options.endpoint),p.setHeader("Upload-Concat","final;".concat(r._parallelUploadUrls.join(" ")));var h=Km(r.options.metadata);return h!==""&&p.setHeader("Upload-Metadata",h),r._sendRequest(p,null)}).then(function(h){if(!Ar(h.getStatus(),200)){r._emitHttpError(p,h,"tus: unexpected response while creating upload");return}var g=h.getHeader("Location");if(g==null){r._emitHttpError(p,h,"tus: invalid or missing Location header");return}r.url=Zm(r.options.endpoint,g),hi("Created upload at ".concat(r.url)),r._emitSuccess(h)}).catch(function(h){r._emitError(h)})},"_startParallelUpload")},{key:"_startSingleUpload",value:o(function(){if(this._aborted=!1,this.url!=null){hi("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){hi("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}hi("Creating a new upload"),this._createUpload()},"_startSingleUpload")},{key:"abort",value:o(function(t){var r=this;if(this._parallelUploads!=null){var s=mS(this._parallelUploads),n;try{for(s.s();!(n=s.n()).done;){var a=n.value;a.abort(t)}}catch(l){s.e(l)}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 kr(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),Qm(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=Km(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===Pn||this.options.protocol===$s)&&r.setHeader("Upload-Complete","?0"),n=this._sendRequest(r,null)),n.then(function(a){if(!Ar(a.getStatus(),200)){t._emitHttpError(r,a,"tus: unexpected response while creating upload");return}var l=a.getHeader("Location");if(l==null){t._emitHttpError(r,a,"tus: invalid or missing Location header");return}if(t.url=Zm(t.options.endpoint,l),hi("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(!Ar(a,200)){if(a===423){t._emitHttpError(r,n,"tus: upload is currently locked; retry later");return}if(Ar(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 l=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(l)){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===En){t._emitHttpError(r,n,"tus: invalid or missing length value");return}typeof t.options.onUploadUrlAvailable=="function"&&t.options.onUploadUrlAvailable(),t._saveUploadInUrlStorage().then(function(){if(l===c){t._emitProgress(c,c),t._emitSuccess(n);return}t._offset=l,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(!Ar(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===En?t.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===$s&&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 l=a.value,c=a.done,p=l!=null&&l.size?l.size:0;r.options.uploadLengthDeferred&&c&&(r._size=r._offset+p,t.setHeader("Upload-Length","".concat(r._size)));var h=r._offset+p;return!r.options.uploadLengthDeferred&&c&&h!==r._size?Promise.reject(new Error("upload was configured with a size of ".concat(r._size," bytes, but the source is done after ").concat(h," bytes"))):l===null?r._sendRequest(t):((r.options.protocol===Pn||r.options.protocol===$s)&&t.setHeader("Upload-Complete",c?"?1":"?0"),r._emitProgress(r._offset,r._size),r._sendRequest(t,l))})},"_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=Ym(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 Jm(t,r,this.options)},"_sendRequest")}],[{key:"terminate",value:o(function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=Ym("DELETE",t,r);return Jm(s,null,r).then(function(n){if(n.getStatus()!==204)throw new kr("tus: unexpected response while terminating upload",null,s,n)}).catch(function(n){if(n instanceof kr||(n=new kr("tus: failed to terminate upload",n,s,null)),!Qm(n,0,r))throw n;var a=r.retryDelays[0],l=r.retryDelays.slice(1),c=Rr(Rr({},r),{},{retryDelays:l});return new Promise(function(p){return setTimeout(p,a)}).then(function(){return i.terminate(t,c)})})},"terminate")}])})();function Km(i){return Object.entries(i).map(function(e){var t=eg(e,2),r=t[0],s=t[1];return"".concat(r," ").concat(Am.encode(String(s)))}).join(",")}o(Km,"encodeMetadata");function Ar(i,e){return i>=e&&i<e+100}o(Ar,"inStatusCategory");function Ym(i,e,t){var r=t.httpStack.createRequest(i,e);t.protocol===Pn?r.setHeader("Upload-Draft-Interop-Version","5"):t.protocol===$s?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 l=eg(a[n],2),c=l[0],p=l[1];r.setHeader(c,p)}if(t.addRequestId){var h=cu();r.setHeader("X-Request-ID",h)}return r}o(Ym,"openRequest");function Jm(i,e,t){return du.apply(this,arguments)}o(Jm,"sendRequest");function du(){return du=pS(pu().mark(o(function i(e,t,r){var s;return pu().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"))),du.apply(this,arguments)}o(du,"_sendRequest2");function SS(){var i=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(i=!1),i}o(SS,"isOnline");function Qm(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):og(i)}o(Qm,"shouldRetry");function og(i){var e=i.originalResponse?i.originalResponse.getStatus():0;return(!Ar(e,400)||e===409||e===423)&&SS()}o(og,"defaultOnShouldRetry");function Zm(i,e){return new rg.default(e,i).toString()}o(Zm,"resolveUrl");function xS(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(xS,"splitSizeIntoParts");sg.defaultOptions=wS;var Tn=sg;var _S=o(function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"},"isReactNative"),kn=_S;function hu(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(hu,"uriToBlob");var ES=o(function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")},"isCordova"),ng=ES;function fu(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(fu,"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 PS(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(PS,"_classCallCheck");function ag(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,kS(r.key),r)}}o(ag,"_defineProperties");function TS(i,e,t){return e&&ag(i.prototype,e),t&&ag(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(TS,"_createClass");function kS(i){var e=CS(i,"string");return Vs(e)=="symbol"?e:e+""}o(kS,"_toPropertyKey");function CS(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(CS,"_toPrimitive");var mu=(function(){function i(e){PS(this,i),this._file=e,this.size=e.size}return o(i,"FileSource"),TS(i,[{key:"slice",value:o(function(t,r){if(ng())return fu(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 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 FS(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(FS,"_classCallCheck");function lg(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,AS(r.key),r)}}o(lg,"_defineProperties");function RS(i,e,t){return e&&lg(i.prototype,e),t&&lg(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(RS,"_createClass");function AS(i){var e=US(i,"string");return Ws(e)=="symbol"?e:e+""}o(AS,"_toPropertyKey");function US(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(US,"_toPrimitive");function ug(i){return i===void 0?0:i.size!==void 0?i.size:i.length}o(ug,"len");function OS(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(OS,"concat");var cg=(function(){function i(e){FS(this,i),this._buffer=void 0,this._bufferOffset=0,this._reader=e,this._done=!1}return o(i,"StreamSource"),RS(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+ug(this._buffer);if(this._done||n){var a=this._getDataFromBuffer(t,r),l=a==null?this._done:!1;return Promise.resolve({value:a,done:l})}return this._reader.read().then(function(c){var p=c.value,h=c.done;return h?s._done=!0:s._buffer===void 0?s._buffer=p:s._buffer=OS(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=ug(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 Hi(i){"@babel/helpers - typeof";return Hi=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},Hi(i)}o(Hi,"_typeof");function gu(){"use strict";gu=o(function(){return e},"_regeneratorRuntime");var i,e={},t=Object.prototype,r=t.hasOwnProperty,s=Object.defineProperty||function(T,w,_){T[w]=_.value},n=typeof Symbol=="function"?Symbol:{},a=n.iterator||"@@iterator",l=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function p(T,w,_){return Object.defineProperty(T,w,{value:_,enumerable:!0,configurable:!0,writable:!0}),T[w]}o(p,"define");try{p({},"")}catch{p=o(function(_,L,$){return _[L]=$},"define")}function h(T,w,_,L){var $=w&&w.prototype instanceof q?w:q,z=Object.create($.prototype),Z=new fe(L||[]);return s(z,"_invoke",{value:ne(T,_,Z)}),z}o(h,"wrap");function g(T,w,_){try{return{type:"normal",arg:T.call(w,_)}}catch(L){return{type:"throw",arg:L}}}o(g,"tryCatch"),e.wrap=h;var y="suspendedStart",S="suspendedYield",P="executing",F="completed",D={};function q(){}o(q,"Generator");function R(){}o(R,"GeneratorFunction");function C(){}o(C,"GeneratorFunctionPrototype");var j={};p(j,a,function(){return this});var W=Object.getPrototypeOf,B=W&&W(W(_e([])));B&&B!==t&&r.call(B,a)&&(j=B);var Q=C.prototype=q.prototype=Object.create(j);function K(T){["next","throw","return"].forEach(function(w){p(T,w,function(_){return this._invoke(w,_)})})}o(K,"defineIteratorMethods");function ee(T,w){function _($,z,Z,N){var k=g(T[$],T,z);if(k.type!=="throw"){var U=k.arg,M=U.value;return M&&Hi(M)=="object"&&r.call(M,"__await")?w.resolve(M.__await).then(function(Y){_("next",Y,Z,N)},function(Y){_("throw",Y,Z,N)}):w.resolve(M).then(function(Y){U.value=Y,Z(U)},function(Y){return _("throw",Y,Z,N)})}N(k.arg)}o(_,"invoke");var L;s(this,"_invoke",{value:o(function(z,Z){function N(){return new w(function(k,U){_(z,Z,k,U)})}return o(N,"callInvokeWithMethodAndArg"),L=L?L.then(N,N):N()},"value")})}o(ee,"AsyncIterator");function ne(T,w,_){var L=y;return function($,z){if(L===P)throw Error("Generator is already running");if(L===F){if($==="throw")throw z;return{value:i,done:!0}}for(_.method=$,_.arg=z;;){var Z=_.delegate;if(Z){var N=le(Z,_);if(N){if(N===D)continue;return N}}if(_.method==="next")_.sent=_._sent=_.arg;else if(_.method==="throw"){if(L===y)throw L=F,_.arg;_.dispatchException(_.arg)}else _.method==="return"&&_.abrupt("return",_.arg);L=P;var k=g(T,w,_);if(k.type==="normal"){if(L=_.done?F:S,k.arg===D)continue;return{value:k.arg,done:_.done}}k.type==="throw"&&(L=F,_.method="throw",_.arg=k.arg)}}}o(ne,"makeInvokeMethod");function le(T,w){var _=w.method,L=T.iterator[_];if(L===i)return w.delegate=null,_==="throw"&&T.iterator.return&&(w.method="return",w.arg=i,le(T,w),w.method==="throw")||_!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+_+"' method")),D;var $=g(L,T.iterator,w.arg);if($.type==="throw")return w.method="throw",w.arg=$.arg,w.delegate=null,D;var z=$.arg;return z?z.done?(w[T.resultName]=z.value,w.next=T.nextLoc,w.method!=="return"&&(w.method="next",w.arg=i),w.delegate=null,D):z:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}o(le,"maybeInvokeDelegate");function Fe(T){var w={tryLoc:T[0]};1 in T&&(w.catchLoc=T[1]),2 in T&&(w.finallyLoc=T[2],w.afterLoc=T[3]),this.tryEntries.push(w)}o(Fe,"pushTryEntry");function be(T){var w=T.completion||{};w.type="normal",delete w.arg,T.completion=w}o(be,"resetTryEntry");function fe(T){this.tryEntries=[{tryLoc:"root"}],T.forEach(Fe,this),this.reset(!0)}o(fe,"Context");function _e(T){if(T||T===""){var w=T[a];if(w)return w.call(T);if(typeof T.next=="function")return T;if(!isNaN(T.length)){var _=-1,L=o(function $(){for(;++_<T.length;)if(r.call(T,_))return $.value=T[_],$.done=!1,$;return $.value=i,$.done=!0,$},"next");return L.next=L}}throw new TypeError(Hi(T)+" is not iterable")}return o(_e,"values"),R.prototype=C,s(Q,"constructor",{value:C,configurable:!0}),s(C,"constructor",{value:R,configurable:!0}),R.displayName=p(C,c,"GeneratorFunction"),e.isGeneratorFunction=function(T){var w=typeof T=="function"&&T.constructor;return!!w&&(w===R||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(T){return Object.setPrototypeOf?Object.setPrototypeOf(T,C):(T.__proto__=C,p(T,c,"GeneratorFunction")),T.prototype=Object.create(Q),T},e.awrap=function(T){return{__await:T}},K(ee.prototype),p(ee.prototype,l,function(){return this}),e.AsyncIterator=ee,e.async=function(T,w,_,L,$){$===void 0&&($=Promise);var z=new ee(h(T,w,_,L),$);return e.isGeneratorFunction(w)?z:z.next().then(function(Z){return Z.done?Z.value:z.next()})},K(Q),p(Q,c,"Generator"),p(Q,a,function(){return this}),p(Q,"toString",function(){return"[object Generator]"}),e.keys=function(T){var w=Object(T),_=[];for(var L in w)_.push(L);return _.reverse(),o(function $(){for(;_.length;){var z=_.pop();if(z in w)return $.value=z,$.done=!1,$}return $.done=!0,$},"next")},e.values=_e,fe.prototype={constructor:fe,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(be),!w)for(var _ in this)_.charAt(0)==="t"&&r.call(this,_)&&!isNaN(+_.slice(1))&&(this[_]=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 _=this;function L(U,M){return Z.type="throw",Z.arg=w,_.next=U,M&&(_.method="next",_.arg=i),!!M}o(L,"handle");for(var $=this.tryEntries.length-1;$>=0;--$){var z=this.tryEntries[$],Z=z.completion;if(z.tryLoc==="root")return L("end");if(z.tryLoc<=this.prev){var N=r.call(z,"catchLoc"),k=r.call(z,"finallyLoc");if(N&&k){if(this.prev<z.catchLoc)return L(z.catchLoc,!0);if(this.prev<z.finallyLoc)return L(z.finallyLoc)}else if(N){if(this.prev<z.catchLoc)return L(z.catchLoc,!0)}else{if(!k)throw Error("try statement without catch or finally");if(this.prev<z.finallyLoc)return L(z.finallyLoc)}}}},"dispatchException"),abrupt:o(function(w,_){for(var L=this.tryEntries.length-1;L>=0;--L){var $=this.tryEntries[L];if($.tryLoc<=this.prev&&r.call($,"finallyLoc")&&this.prev<$.finallyLoc){var z=$;break}}z&&(w==="break"||w==="continue")&&z.tryLoc<=_&&_<=z.finallyLoc&&(z=null);var Z=z?z.completion:{};return Z.type=w,Z.arg=_,z?(this.method="next",this.next=z.finallyLoc,D):this.complete(Z)},"abrupt"),complete:o(function(w,_){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"&&_&&(this.next=_),D},"complete"),finish:o(function(w){for(var _=this.tryEntries.length-1;_>=0;--_){var L=this.tryEntries[_];if(L.finallyLoc===w)return this.complete(L.completion,L.afterLoc),be(L),D}},"finish"),catch:o(function(w){for(var _=this.tryEntries.length-1;_>=0;--_){var L=this.tryEntries[_];if(L.tryLoc===w){var $=L.completion;if($.type==="throw"){var z=$.arg;be(L)}return z}}throw Error("illegal catch attempt")},"_catch"),delegateYield:o(function(w,_,L){return this.delegate={iterator:_e(w),resultName:_,nextLoc:L},this.method==="next"&&(this.arg=i),D},"delegateYield")},e}o(gu,"_regeneratorRuntime");function pg(i,e,t,r,s,n,a){try{var l=i[n](a),c=l.value}catch(p){t(p);return}l.done?e(c):Promise.resolve(c).then(r,s)}o(pg,"asyncGeneratorStep");function IS(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function a(c){pg(n,r,s,a,l,"next",c)}o(a,"_next");function l(c){pg(n,r,s,a,l,"throw",c)}o(l,"_throw"),a(void 0)})}}o(IS,"_asyncToGenerator");function DS(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(DS,"_classCallCheck");function dg(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,MS(r.key),r)}}o(dg,"_defineProperties");function NS(i,e,t){return e&&dg(i.prototype,e),t&&dg(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(NS,"_createClass");function MS(i){var e=LS(i,"string");return Hi(e)=="symbol"?e:e+""}o(MS,"_toPropertyKey");function LS(i,e){if(Hi(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Hi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(LS,"_toPrimitive");var hg=(function(){function i(){DS(this,i)}return o(i,"FileReader"),NS(i,[{key:"openFile",value:(function(){var e=IS(gu().mark(o(function r(s,n){var a;return gu().wrap(o(function(c){for(;;)switch(c.prev=c.next){case 0:if(!(kn()&&s&&typeof s.uri<"u")){c.next=11;break}return c.prev=1,c.next=4,hu(s.uri);case 4:return a=c.sent,c.abrupt("return",new mu(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 mu(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 cg(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 yu(i,e){return kn()?Promise.resolve(BS(i,e)):Promise.resolve(["tus-br",i.name,i.type,i.size,i.lastModified,e.endpoint].join("-"))}o(yu,"fingerprint");function BS(i,e){var t=i.exif?jS(JSON.stringify(i.exif)):"noexif";return["tus-rn",i.name||"noname",i.size||"nosize",t,e.endpoint].join("/")}o(BS,"reactNativeFingerprint");function jS(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(jS,"hashCode");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 vu(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(vu,"_classCallCheck");function fg(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,zS(r.key),r)}}o(fg,"_defineProperties");function bu(i,e,t){return e&&fg(i.prototype,e),t&&fg(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(bu,"_createClass");function zS(i){var e=HS(i,"string");return Gs(e)=="symbol"?e:e+""}o(zS,"_toPropertyKey");function HS(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(HS,"_toPrimitive");var mg=(function(){function i(){vu(this,i)}return o(i,"XHRHttpStack"),bu(i,[{key:"createRequest",value:o(function(t,r){return new qS(t,r)},"createRequest")},{key:"getName",value:o(function(){return"XHRHttpStack"},"getName")}])})();var qS=(function(){function i(e,t){vu(this,i),this._xhr=new XMLHttpRequest,this._xhr.open(e,t,!0),this._method=e,this._url=t,this._headers={}}return o(i,"Request"),bu(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 $S(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")}])})(),$S=(function(){function i(e){vu(this,i),this._xhr=e}return o(i,"Response"),bu(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 Xs(i){"@babel/helpers - typeof";return Xs=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},Xs(i)}o(Xs,"_typeof");function VS(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(VS,"_classCallCheck");function gg(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,GS(r.key),r)}}o(gg,"_defineProperties");function WS(i,e,t){return e&&gg(i.prototype,e),t&&gg(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(WS,"_createClass");function GS(i){var e=XS(i,"string");return Xs(e)=="symbol"?e:e+""}o(GS,"_toPropertyKey");function XS(i,e){if(Xs(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Xs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(XS,"_toPrimitive");var Su=!1;try{Su="localStorage"in window,Cn="tusSupport",wu=localStorage.getItem(Cn),localStorage.setItem(Cn,wu),wu===null&&localStorage.removeItem(Cn)}catch(i){if(i.code===i.SECURITY_ERR||i.code===i.QUOTA_EXCEEDED_ERR)Su=!1;else throw i}var Cn,wu,yg=Su,vg=(function(){function i(){VS(this,i)}return o(i,"WebStorageUrlStorage"),WS(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 Or(i){"@babel/helpers - typeof";return Or=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},Or(i)}o(Or,"_typeof");function KS(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(KS,"_classCallCheck");function bg(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,xg(r.key),r)}}o(bg,"_defineProperties");function YS(i,e,t){return e&&bg(i.prototype,e),t&&bg(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(YS,"_createClass");function JS(i,e,t){return e=Fn(e),QS(i,Sg()?Reflect.construct(e,t||[],Fn(i).constructor):e.apply(i,t))}o(JS,"_callSuper");function QS(i,e){if(e&&(Or(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ZS(i)}o(QS,"_possibleConstructorReturn");function ZS(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}o(ZS,"_assertThisInitialized");function Sg(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Sg=o(function(){return!!i},"_isNativeReflectConstruct"))()}o(Sg,"_isNativeReflectConstruct");function Fn(i){return Fn=Object.setPrototypeOf?Object.getPrototypeOf.bind():o(function(t){return t.__proto__||Object.getPrototypeOf(t)},"_getPrototypeOf"),Fn(i)}o(Fn,"_getPrototypeOf");function e2(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&&xu(i,e)}o(e2,"_inherits");function xu(i,e){return xu=Object.setPrototypeOf?Object.setPrototypeOf.bind():o(function(r,s){return r.__proto__=s,r},"_setPrototypeOf"),xu(i,e)}o(xu,"_setPrototypeOf");function wg(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(wg,"ownKeys");function Ur(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wg(Object(t),!0).forEach(function(r){t2(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):wg(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}o(Ur,"_objectSpread");function t2(i,e,t){return e=xg(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}o(t2,"_defineProperty");function xg(i){var e=i2(i,"string");return Or(e)=="symbol"?e:e+""}o(xg,"_toPropertyKey");function i2(i,e){if(Or(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Or(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(i2,"_toPrimitive");var Rn=Ur(Ur({},Tn.defaultOptions),{},{httpStack:new mg,fileReader:new hg,urlStorage:yg?new vg:new dm,fingerprint:yu}),_g=(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 KS(this,e),r=Ur(Ur({},Rn),r),JS(this,e,[t,r])}return o(e,"Upload"),e2(e,i),YS(e,null,[{key:"terminate",value:o(function(r){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return s=Ur(Ur({},Rn),s),Tn.terminate(r,s)},"terminate")}])})(Tn),GD=typeof XMLHttpRequest=="function"&&typeof Blob=="function"&&typeof Blob.prototype.slice=="function";var Pg={name:"@uppy/tus",description:"Resumable uploads for Uppy using Tus.io",version:"6.0.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --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:{"tus-js-client":"^4.3.1"},devDependencies:{"@uppy/core":"workspace:^","@vitest/browser-playwright":"^4.1.6",playwright:"1.61.1",typescript:"^6.0.3",vitest:"^4.1.6"},peerDependencies:{"@uppy/core":"workspace:^"}};function s2(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")}o(s2,"isCordova");function o2(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"}o(o2,"isReactNative");function _u(i){return(e,t)=>{if(s2()||o2())return Rn.fingerprint(e,t);let r=["tus",i.id,t.endpoint].join("-");return Promise.resolve(r)}}o(_u,"getFingerprint");var Tg={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},n2={limit:20,retryDelays:Tg.retryDelays,withCredentials:!1,allowedMetaFields:!0},qi=class extends Pe{static{o(this,"Tus")}static VERSION=Pg.version;#e;requests;uploaders;uploaderEvents;constructor(e,t){if(super(e,{...n2,...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 Wt(this.opts.limit),this.#e=this.opts.retryDelays?.values(),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null)}#t(e,t){this.uploaders[e]?.abort(t)}#i(e){this.uploaders[e]&&(this.uploaders[e]=null),this.uploaderEvents[e]&&(this.uploaderEvents[e].remove(),this.uploaderEvents[e]=null)}async#r(e){this.#t(e.id),this.#i(e.id);let t;return new Promise((r,s)=>{let n,a,l,c={...this.opts,...e.tus||{}};typeof c.headers=="function"&&(c.headers=c.headers(e));let{onShouldRetry:p,onBeforeRequest:h,...g}=c,y={...Tg,...g};y.fingerprint=_u(e),y.onBeforeRequest=async R=>{let C=R.getUnderlyingObject();C&&(C.withCredentials=!!c.withCredentials);let j;if(typeof h=="function"&&(j=h(R,e)),Object.hasOwn(n,"shouldBeRequeued")){if(!n.shouldBeRequeued)return Promise.reject();let W,B=new Promise(Q=>{W=Q});n=this.requests.run(()=>(e.isPaused&&n.abort(),W(),()=>{})),await Promise.all([B,j]);return}return j},y.onError=R=>{this.uppy.log(R);let C=R.originalResponse;C!=null&&(t={status:C.getStatus(),body:{xhr:C.getUnderlyingObject()}});let j=R.originalRequest!=null?R.originalRequest.getUnderlyingObject():null;Vr(j)&&(R=new wt(R,j)),this.#i(e.id),n?.abort(),typeof c.onError=="function"&&c.onError(R),s(R)},y.onProgress=(R,C)=>{this.onReceiveUploadUrl(e,l.url),typeof c.onProgress=="function"&&c.onProgress(R,C);let j=this.uppy.getFile(e.id);this.uppy.emit("upload-progress",j,{uploadStarted:j.progress.uploadStarted??0,bytesUploaded:R,bytesTotal:C})},y.onSuccess=R=>{let C={uploadURL:l.url??void 0,status:200,body:{xhr:R.lastResponse.getUnderlyingObject()}};this.uppy.emit("upload-success",this.uppy.getFile(e.id),C),this.#t(e.id),this.#i(e.id),n.done(),l.url&&this.uppy.log(`Download ${l.url}`),typeof c.onSuccess=="function"&&c.onSuccess(R),r(l)};let S=o(R=>{let C=R?.originalResponse?.getStatus();if(C===429){if(!this.requests.isPaused){let j=this.#e?.next();if(j==null||j.done)return!1;this.requests.rateLimit(j.value)}}else{if(C!=null&&C>=400&&C<500&&C!==409&&C!==423)return!1;typeof navigator<"u"&&navigator.onLine===!1&&(this.requests.isPaused||(this.requests.pause(),window.addEventListener("online",()=>{this.requests.resume()},{once:!0})))}return n.abort(),n={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");p!=null?y.onShouldRetry=(R,C)=>p(R,C,c,S):y.onShouldRetry=S;let P=o((R,C,j)=>{Object.hasOwn(R,C)&&!Object.hasOwn(R,j)&&(R[j]=R[C])},"copyProp"),F={};if(Vt(c.allowedMetaFields,e.meta).forEach(R=>{F[R]=String(e.meta[R])}),P(F,"type","filetype"),P(F,"name","filename"),y.metadata=F,e.data==null)throw new Error("File data is empty");l=new _g(e.data,y),this.uploaders[e.id]=l;let q=new Ut(this.uppy);this.uploaderEvents[e.id]=q,a=o(()=>(e.isPaused||l.start(),()=>{}),"qRequest"),l.findPreviousUploads().then(R=>{let C=R[0];C&&(this.uppy.log(`[Tus] Resuming upload of ${e.id} started at ${C.creationTime}`),l.resumeFromPreviousUpload(C)),n=this.requests.run(a)}),q.onFileRemove(e.id,R=>{n.abort(),this.#t(e.id,!!l.url),this.#i(e.id),r(`upload ${R} was removed`)}),q.onPause(e.id,R=>{n.abort(),R?l.abort():n=this.requests.run(a)}),q.onPauseAll(e.id,()=>{n.abort(),l.abort()}),q.onCancelAll(e.id,()=>{n.abort(),this.#t(e.id,!!l.url),this.#i(e.id),r(`upload ${e.id} was canceled`)}),q.onResumeAll(e.id,()=>{n.abort(),e.error&&l.abort(),n=this.requests.run(a)})}).catch(r=>{throw this.uppy.emit("upload-error",e,r,t),r})}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}}))}#s(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#o(e){let t=wi(e),r=Si(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,l=o(p=>{p.id===s.id&&a.abort()},"removedHandler");this.uppy.on("file-removed",l);let c=this.uppy.getRequestClientForFile(s).uploadRemoteFile(s,this.#s(s),{signal:a.signal,getQueue:n});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",l)},{priority:-1})(),c}return this.#r(s)}))}#n=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.#o(t)},"#handleUpload");install(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!0}}),this.uppy.addUploader(this.#n)}uninstall(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!1}}),this.uppy.removeUploader(this.#n)}};var kg={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:"6.0.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --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:{"@transloadit/types":"^4.3.1","@uppy/tus":"workspace:^","component-emitter":"^2.0.0"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^","@vitest/browser-playwright":"^4.1.6",msw:"^2.10.4",playwright:"1.61.1",typescript:"^6.0.3",vitest:"^4.1.6"}};var Fg=he(Pu(),1);var u2="ASSEMBLY_UPLOADING",Tu="ASSEMBLY_EXECUTING",ku="ASSEMBLY_COMPLETED",Cg=[u2,Tu,ku];function An(i,e){return typeof i!="string"?!1:Cg.indexOf(i)>=Cg.indexOf(e)}o(An,"isStatus");var Cu=class extends Fg.default{static{o(this,"TransloaditAssembly")}#e;#t;#i=!1;#r=null;#s;pollInterval;closed;constructor(e,t){super(),this.#s=e,this.pollInterval=null,this.closed=!1,this.#e=t,this.#t=t.wrapPromiseFunction(ri)}connect(){this.#n(),this.#u()}#o(){this.emit("finished"),this.close()}get status(){return this.#s}set status(e){this.#s=e,this.emit("status",e)}#n(){this.#r=new EventSource(`${this.status.websocket_url}?assembly=${this.status.assembly_id}`),this.#r.addEventListener("open",()=>{clearInterval(this.pollInterval),this.pollInterval=null}),this.#r.addEventListener("message",e=>{e.data==="assembly_finished"&&this.#o(),e.data==="assembly_uploading_finished"&&this.emit("executing"),e.data==="assembly_upload_meta_data_extracted"&&(this.emit("metadata"),this.#l({diff:!1}))}),this.#r.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.#r.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.#r.addEventListener("assembly_execution_progress",e=>{let t=JSON.parse(e.data);typeof t.progress_combined=="number"&&(this.status={...this.status,progress_combined:t.progress_combined}),this.emit("execution-progress",t)}),this.#r.addEventListener("assembly_error",e=>{try{this.#a(JSON.parse(e.data))}catch{this.#a(new Error(e.data))}this.#l({diff:!1})})}#a(e){this.emit("error",Object.assign(new Error(e.message),e)),this.close()}#u(){this.pollInterval=setInterval(()=>{this.#l()},2e3)}async#l({diff:e=!0}={}){if(!(this.closed||this.#e.isPaused||this.#i))try{this.#i=!0;let t=$i(this.status),r=await this.#t(t);if(this.#i=!1,this.closed)return;if(r.status===429){this.#e.rateLimit(2e3);return}if(!r.ok){this.#a(new wt(r.statusText));return}let s=await r.json();if(this.closed)return;e?this.updateStatus(s):this.status=s}catch(t){this.#a(t)}}update(){return this.#l({diff:!0})}updateStatus(e){this.#c(this.status,e),this.status=e}#c(e,t){let r=e.ok,s=t.ok;if(t.error&&!e.error)return this.#a(t);let n=An(s,Tu)&&!An(r,Tu);n&&this.emit("executing");let a=e.uploads,l=t.uploads;l!=null&&a!=null&&Object.keys(l).filter(h=>!Object.hasOwn(a,h)).forEach(h=>{this.emit("upload",l[h])}),n&&this.emit("metadata");let c=t.results,p=e.results;c!=null&&p!=null&&Object.keys(c).forEach(h=>{let g=c[h]??[],y=p[h]??[];g.filter(S=>!y?.some(P=>P.id===S.id)).forEach(S=>{this.emit("result",h,S)})}),An(s,ku)&&!An(r,ku)&&this.emit("finished")}close(){this.closed=!0,this.#r&&(this.#r.close(),this.#r=null),clearInterval(this.pollInterval),this.pollInterval=null}},Fu=Cu;var Rg=he(Pu(),1);var Ru=class extends Rg.default{static{o(this,"TransloaditAssemblyWatcher")}#e;#t;promise;#i;#r;#s;constructor(e,t){super(),this.#s=e,this.#e=t,this.#t=t.length,this.promise=new Promise((r,s)=>{this.#i=r,this.#r=s}),this.#h()}#o(e){return this.#e.indexOf(e)!==-1}#n=o(e=>{let t=e.assembly_id;t==null||!this.#o(t)||(this.#s.log(`[Transloadit] AssemblyWatcher: Got Assembly finish ${t}`),this.emit("assembly-complete",t),this.#c())},"#onAssemblyComplete");#a=o(e=>{let t=e.assembly_id;t==null||!this.#o(t)||this.#c()},"#onAssemblyCancel");#u=o((e,t)=>{let r=e.assembly_id;r==null||!this.#o(r)||(this.#s.log(`[Transloadit] AssemblyWatcher: Got Assembly error ${r}`),this.#s.log(t),this.emit("assembly-error",r,t),this.#c())},"#onAssemblyError");#l=o((e,t,r)=>{let s=e.assembly_id;s==null||!this.#o(s)||this.#u(e,r)},"#onImportError");#c(){this.#t-=1,this.#t===0&&(this.#p(),this.#i())}#p(){this.#s.off("transloadit:complete",this.#n),this.#s.off("transloadit:assembly-cancel",this.#a),this.#s.off("transloadit:assembly-error",this.#u),this.#s.off("transloadit:import-error",this.#l)}#h(){this.#s.on("transloadit:complete",this.#n),this.#s.on("transloadit:assembly-cancel",this.#a),this.#s.on("transloadit:assembly-error",this.#u),this.#s.on("transloadit:import-error",this.#l)}},Ag=Ru;var Ug="/assemblies",Au=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(ri)}async#i(...e){let t=await this.#t(...e);if(t.status===429)return this.opts.rateLimitedQueue.rateLimit(2e3),this.#i(...e);if(!t.ok){let r=new Error(t.statusText);return r.statusCode=t.status,`${e[0]}`.endsWith(Ug)?t.json().then(s=>{if(!s.error)throw r;let n=new Au(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(l=>{n.append(l,String(t[l]))}),n.append("num_expected_upload_files",String(s));let a=new URL(Ug,`${this.opts.service}`).href;return this.#i(a,{method:"POST",headers:this.#e,body:n}).catch(l=>this.#r(l,{url:a,type:"API_ERROR"}))}async reserveFile(e,t){let r=encodeURIComponent(t.size),n=`${$i(e)}/reserve_file?size=${r}`;return this.#i(n,{method:"POST",headers:this.#e}).catch(a=>this.#r(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"),l=`size=${r}&filename=${n}&fieldname=file&s3Url=${s}`,p=`${$i(e)}/add_file?${l}`;return this.#i(p,{method:"POST",headers:this.#e}).catch(h=>this.#r(h,{assembly:e,file:t,url:p,type:"API_ERROR"}))}async cancelAssembly(e){let t=$i(e);await this.#t(t,{method:"DELETE",headers:this.#e}).catch(r=>this.#r(r,{url:t,type:"API_ERROR"}))}async getAssemblyStatus(e){return this.#i(e,{headers:this.#e}).catch(t=>this.#r(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.#i("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})})}#r=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 Og={strings:{creatingAssembly:"Preparing upload...",creatingAssemblyFailed:"Transloadit: Could not create Assembly",encoding:"Encoding..."}};var c2={service:"https://api2.transloadit.com",errorReporting:!0,waitForEncoding:!1,waitForMetadata:!1,alwaysRunAssembly:!1,importFromUploadURLs:!1,limit:20,retryDelays:[7e3,1e4,15e3,2e4],clientName:null},Ig=o(i=>e=>{let t=new bi("Failed to send error to the client",{cause:e});console.error(t,i)},"sendErrorToConsole");function p2(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 bi("Transloadit: The `params` option is a malformed JSON string.",{cause:t})}else e=i;if(!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(p2,"validateParams");function Vi(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(Vi,"ensureAssemblyId");function Uu(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(Uu,"ensureUrl");function d2(i){return Uu("`assembly_url`",i.assembly_url,i.assembly_ssl_url)}o(d2,"getAssemblyUrl");function $i(i){return Uu("`assembly_ssl_url`",i.assembly_ssl_url,i.assembly_url)}o($i,"getAssemblyUrlSsl");var h2="https://api2.transloadit.com/companion",f2=/\.transloadit\.com$/,m2=/https?:\/\/api2(?:-\w+)?\.transloadit\.com\/companion/,Un=class extends Pe{static{o(this,"Transloadit")}static VERSION=kg.version;static COMPANION_URL=h2;static COMPANION_ALLOWED_HOSTS=f2;#e;client;#t;#i;completedFiles;restored=null;constructor(e,t){super(e,{...c2,...t}),this.type="uploader",this.id=this.opts.id||"Transloadit",this.defaultLocale=Og,this.#e=new Wt(this.opts.limit),this.i18nInit(),this.client=new Ks({service:this.opts.service,client:this.#r(),errorReporting:this.opts.errorReporting,rateLimitedQueue:this.#e}),this.completedFiles=Object.create(null)}#r(){let e=[`uppy-core:${this.uppy.constructor.VERSION}`,`uppy-transloadit:${this.constructor.VERSION}`,`uppy-tus:${qi.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("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=d2(t),s=Uu("`tus_url`",t.tus_url),n=Vi(t),a={...e.meta,assembly_url:r,filename:e.name,fieldname:"file"},l={...e.tus,endpoint:s,addRequestId:!0},c;if("remote"in e&&e.remote&&({remote:c}=e,t.companion_url&&m2.test(e.remote.companionUrl))){let h=t.companion_url.replace(/\/$/,""),g=e.remote.url.replace(e.remote.companionUrl,"").replace(/^\//,"");c={...e.remote,companionUrl:h,url:`${h}/${g}`}}let p={...e,transloadit:{assembly:n}};return this.opts.importFromUploadURLs||Object.assign(p,{meta:a,tus:l,remote:c}),p}async#o(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,l=Vi(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 ${l}`),n}catch(r){let s=new bi(`${this.i18n("creatingAssemblyFailed")}: ${r.message}`,{cause:r});throw"details"in r&&(s.details=r.details),"assembly"in r&&(s.assembly=r.assembly),s}}#n(e){let t=Array.isArray(e)?e:[e],r=new Ag(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 l={...this.uppy.getState().files};a.forEach(c=>{delete l[c.id].tus}),this.uppy.setState({files:l}),this.uppy.emit("error",n)}),this.#i=r}#a(){return this.opts.waitForEncoding||this.opts.waitForMetadata}#u(e,t){return Promise.all(t.map(r=>{let s=this.uppy.getFile(r);return this.client.reserveFile(e.status,s)}))}#l=o(e=>{e!=null&&this.setPluginState({lastAssemblyStatus:e}),this.setPluginState({assemblyStatus: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.#l),this.#t=e,this.#l(e?.status),e&&e.on("status",this.#l)}#c=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");#p(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}}#h(e,t){let r=this.getPluginState(),s=this.#p(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())}#d(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())}#y(e){let t=$i(e.status);this.client.getAssemblyStatus(t).then(r=>{e.status=r,this.uppy.emit("transloadit:complete",r)})}async#f(e){await this.client.cancelAssembly(e);let t=this.assembly?.status??e;this.uppy.emit("transloadit:assembly-cancelled",t),this.assembly=void 0}#g=o(async()=>{if(this.assembly)try{await this.#f(this.assembly.status)}catch(e){this.uppy.log(e)}this.uppy.setState({allowNewUpload:!0})},"#onCancelAll");#m=o(e=>{let r=(e?.[this.id]?e[this.id]:{}).assemblyResponse;if(!r)return;let s=o(()=>{let l={},c=[],p=Vi(r);r.uploads?.forEach(S=>{let P=this.#p(S);l[S.id]={id:P.id,assembly:p,uploadedFile:S}});let h=this.getPluginState(),g=r.results??{};Object.keys(g).forEach(S=>{let P=g[S]??[];for(let F of P){if(!("id"in F)){console.warn("Result has no id",F);continue}if(typeof F.id!="string"){console.warn("Result has no id of type string",F);continue}if(!("original_id"in F)){console.warn("Result has no original_id",F);continue}if(typeof F.original_id!="string"){console.warn("Result has no original_id of type string",F);continue}let D=h.files[F.original_id];c.push({id:F.id,result:{...F,localId:D?D.id:null},stepName:S,assembly:p})}});let y=new Fu(r,this.#e);return y.status=r,this.assembly=y,this.setPluginState({files:l,results:c}),l},"restoreState"),n=o(l=>{this.#n(Vi(r)),this.#b(this.assembly,l)},"restoreAssemblies"),a=o(()=>this.assembly?.update(),"updateAssembly");this.restored=(async()=>{let l=s();n(Object.keys(l)),await a(),this.restored=null})(),this.restored.catch(l=>{this.uppy.log("Failed to restore",l)})},"#onRestored");#b(e,t){let{status:r}=e,s=Vi(r);return e.on("upload",n=>{this.#h(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.#d(s,n,a)}),this.opts.waitForEncoding?e.on("finished",()=>{this.#y(e)}):this.opts.waitForMetadata&&e.on("metadata",()=>{this.#y(e)}),e.ok==="ASSEMBLY_COMPLETE"||e.connect(),e}#w=o(async e=>{this.uppy.setState({allowNewUpload:!1});let t=typeof this.opts.assemblyOptions=="function"?await this.opts.assemblyOptions():this.opts.assemblyOptions;t.fields={...t.fields??{}},p2(t.params);try{let r=this.assembly??await this.#o(e,t);if(r==null)throw new Error("All files were canceled after assembly was created");this.opts.importFromUploadURLs&&await this.#u(r,e),e.forEach(s=>{let n=this.uppy.getFile(s);this.uppy.emit("preprocess-complete",n)}),this.#n(Vi(r.status)),this.assembly=r,this.#b(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)}),this.uppy.setState({allowNewUpload:!0}),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?Vi(this.assembly.status):void 0,n=o(()=>{this.assembly?.close()},"closeSocketConnections");if(!this.#a()){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=>!Object.hasOwn(this.completedFiles,c.id)).forEach(c=>{this.uppy.emit("postprocess-progress",c,{mode:"indeterminate",message:this.i18n("encoding")})}),await this.#i.promise,n();let l=this.assembly?.status;l!=null&&this.uppy.addResultData(t,{transloadit:[l]})}finally{this.assembly=void 0,this.uppy.setState({allowNewUpload:!0})}},"#afterUpload");#v=o(()=>{this.assembly?.close()},"#closeAssemblyIfExists");#_=o(e=>{this.#v(),this.assembly=void 0,this.client.submitError(e).catch(Ig(e)),this.uppy.setState({allowNewUpload:!0})},"#onError");#x=o((e,t)=>{if(this.#v(),t?.message?.startsWith("tus: ")){let r=t.originalRequest?.getUnderlyingObject()?.responseURL;this.client.submitError(t,{endpoint:r}).catch(Ig(t))}},"#onTusError");install(){this.uppy.addPreProcessor(this.#w),this.uppy.addPostProcessor(this.#S),this.uppy.on("error",this.#_),this.uppy.on("cancel-all",this.#g),this.uppy.on("upload-error",this.#x),this.opts.importFromUploadURLs?this.uppy.on("upload-success",this.#c):this.uppy.use(qi,{storeFingerprintForResuming:!1,allowedMetaFields:!0,limit:this.opts.limit,rateLimitedQueue:this.#e,retryDelays:this.opts.retryDelays}),this.uppy.on("restored",this.#m),this.setPluginState({assemblyStatus:void 0,lastAssemblyStatus:void 0,files:{},results:[]});let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}uninstall(){this.uppy.removePreProcessor(this.#w),this.uppy.removePostProcessor(this.#S),this.uppy.off("error",this.#_),this.uppy.off("cancel-all",this.#g),this.opts.importFromUploadURLs&&this.uppy.off("upload-success",this.#c);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 Hg=he(Dg(),1);var Ng={name:"@uppy/webcam",description:"Uppy plugin that takes photos or records videos using the device's camera.",version:"6.0.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'"},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:{"is-mobile":"^5.0.0",preact:"^10.29.2"},devDependencies:{"@vitest/browser-playwright":"^4.1.6",cssnano:"^8.0.1",playwright:"1.61.1",postcss:"^8.5.23","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^6.0.3",vitest:"^4.1.6"},peerDependencies:{"@uppy/core":"workspace:^"}};function Ys(){return u("svg",{"aria-hidden":"true",focusable:"false",fill:"#0097DC",width:"66",height:"55",viewBox:"0 0 66 55",children:u("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(Ys,"CameraIcon");function w2({onDiscard:i,i18n:e}){return u("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:u("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:u("g",{fill:"#FFF",fillRule:"evenodd",children:[u("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),u("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"})]})})})}o(w2,"DiscardButton");var Mg=w2;function Iu({recording:i,onStartRecording:e,onStopRecording:t,i18n:r}){return i?u("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:u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:u("rect",{x:"15",y:"15",width:"70",height:"70"})})}):u("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:u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:u("circle",{cx:"50",cy:"50",r:"40"})})})}o(Iu,"RecordButton");function Du(i){return`${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`}o(Du,"formatSeconds");function Nu({recordingLengthSeconds:i}){let e=Du(i);return u("span",{children:e})}o(Nu,"RecordingLength");function Mu({onSnapshot:i,i18n:e}){return u("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:Ys()})}o(Mu,"SnapshotButton");function S2({onSubmit:i,i18n:e}){return u("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:u("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:u("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})})})}o(S2,"SubmitButton");var Lg=S2;function Lu({currentDeviceId:i,videoSources:e,onChangeVideoSource:t}){return u("div",{className:"uppy-Webcam-videoSource",children:u("select",{className:"uppy-u-reset uppy-Webcam-videoSource-select",onChange:o(r=>{t(r.target.value)},"onChange"),children:e.map(r=>u("option",{value:r.deviceId,selected:r.deviceId===i,children:r.label},r.deviceId))})})}o(Lu,"VideoSourceSelect");function In(i,e){return i.includes(e)}o(In,"isModeAvailable");var Bu=class extends de{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:l,showVideoSourceDropdown:c,showRecordingLength:p,onSubmit:h,i18n:g,mirror:y,onSnapshot:S,onStartRecording:P,onStopRecording:F,onDiscardRecordedMedia:D,recordingLengthSeconds:q}=this.props,R=!!t,C=!!r,j=R||C,W=!j&&a&&(In(n,"video-only")||In(n,"audio-only")||In(n,"video-audio")),B=!j&&In(n,"picture"),Q=a&&p&&!R,K=c&&l&&l.length>1,ee={playsInline:!0};return t?(ee.muted=!1,ee.controls=!0,ee.src=t,this.videoElement&&(this.videoElement.srcObject=null)):(ee.muted=!0,ee.autoPlay=!0,ee.srcObject=e),u("div",{className:"uppy uppy-Webcam-container",children:[u("div",{className:"uppy-Webcam-videoContainer",children:r&&!s&&!t?u("div",{className:"uppy-Webcam-imageContainer",children:u("img",{src:r,className:"uppy-Webcam-video",alt:"capturedSnapshot"})}):u("video",{ref:o(ne=>{this.videoElement=ne},"ref"),className:`uppy-Webcam-video ${y?"uppy-Webcam-video--mirrored":""}`,...ee})}),u("div",{className:"uppy-Webcam-footer",children:[u("div",{className:"uppy-Webcam-videoSourceContainer",children:K?Lu(this.props):null}),u("div",{className:"uppy-Webcam-buttonContainer",children:[B&&u(Mu,{onSnapshot:S,i18n:g}),W&&u(Iu,{recording:s,onStartRecording:P,onStopRecording:F,i18n:g}),(R||C)&&u(Lg,{onSubmit:h,i18n:g}),(R||C)&&u(Mg,{onDiscard:D,i18n:g})]}),u("div",{className:"uppy-Webcam-recordingLength",children:Q&&u(Nu,{recordingLengthSeconds:q})})]})]})}},Bg=Bu;var jg={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 ju({icon:i,i18n:e,hasCamera:t}){return u("div",{className:"uppy-Webcam-permissons",children:[u("div",{className:"uppy-Webcam-permissonsIcon",children:i()}),u("div",{className:"uppy-Webcam-title",children:e(t?"allowAccessTitle":"noCameraTitle")}),u("p",{children:e(t?"allowAccessDescription":"noCameraDescription")})]})}o(ju,"PermissionsScreen");function zu(){return typeof MediaRecorder=="function"&&!!MediaRecorder.prototype&&typeof MediaRecorder.prototype.start=="function"}o(zu,"supportsMediaRecorder");function zg(i){return i[0]==="."?Ji[i.slice(1)]:i}o(zg,"toMimeType");function x2(i){return/^video\/[^*]+$/.test(i)}o(x2,"isVideoMimeType");function _2(i){return/^image\/[^*]+$/.test(i)}o(_2,"isImageMimeType");function E2(){return navigator.mediaDevices}o(E2,"getMediaDevices");function Hu(i,e){return i.includes(e)}o(Hu,"isModeAvailable");var qg={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,Hg.isMobile)({tablet:!0})},Js=class extends ae{static{o(this,"Webcam")}static VERSION=Ng.version;#e;mediaDevices;supportsUserMedia;protocol;capturedMediaFile;icon;webcamActive;stream=null;recorder=null;recordingChunks=null;recordingLengthTimer;captureInProgress=!1;constructor(e,t){super(e,{...qg,...t}),this.mediaDevices=E2(),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=()=>u("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:u("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=jg,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?.deviceId?a.forEach(l=>{l.getSettings().deviceId===e.deviceId&&(n=l.getSettings().deviceId)}):n=a[0].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(zg).filter(x2));let s=o(a=>MediaRecorder.isTypeSupported(a)&&St(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,l=Math.max(0,r.maxFileSize-a);s>l&&(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,l=[];this.opts.preferredImageMimeType?l=[this.opts.preferredImageMimeType]:a.allowedFileTypes&&(l=a.allowedFileTypes.map(zg).filter(_2));let c=l[0]||"image/jpeg",p=St(c)||"jpg",h=`cam-${Date.now()}.${p}`;return ao(s,c).then(g=>({source:this.id,name:h,data:new Blob([g],{type:c}),type:c}))}getVideo(){let e=this.recordingChunks.find(a=>a.type?.length>0).type,t=St(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?u(ju,{icon:Ys,i18n:this.i18n,hasCamera:e.hasCamera}):u(Bg,{...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:zu(),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:Hu(t,"video-only")||Hu(t,"video-audio"),showNativePhotoCameraButton:Hu(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:l}=this.getPluginState();a.forEach(c=>{l===c.deviceId&&(n=!1)}),n&&(this.stop(),this.start())}})}uninstall(){this.stop(),this.unmount()}onUnmount(){this.stop()}};var $g={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:"6.0.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --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"},devDependencies:{"@uppy/core":"workspace:^","@uppy/dashboard":"workspace:^","@vitest/browser-playwright":"^4.1.6",msw:"^2.10.4",playwright:"1.61.1",typescript:"^6.0.3",vitest:"^4.1.6"},peerDependencies:{"@uppy/core":"workspace:^"}};var Vg={strings:{uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it."}};function T2(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})),Vr(i)?(t=new wt(t,i),t):(t.request=i,t)}o(T2,"buildResponseError");function Wg(i){return i.data.slice(0,i.data.size,i.meta.type)}o(Wg,"setTypeInBlob");var k2={formData:!0,fieldName:"file",method:"post",allowedMetaFields:!0,bundle:!1,headers:{},timeout:30*1e3,limit:5,withCredentials:!1,responseType:""},Dn=class extends Pe{static{o(this,"XHRUpload")}static VERSION=$g.version;#e;#t;uploaderEvents;constructor(e,t){if(super(e,{...k2,fieldName:t.bundle?"files[]":"file",...t}),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.defaultLocale=Vg,this.i18nInit(),this.#t=new _i({concurrency: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 jr(s,{...n,onBeforeRequest:o((p,h)=>this.opts.onBeforeRequest?.(p,h,r),"onBeforeRequest"),shouldRetry:this.opts.shouldRetry,onAfterResponse:this.opts.onAfterResponse,onTimeout:o(p=>{let h=Math.ceil(p/1e3),g=new Error(this.i18n("uploadStalled",{seconds:h}));this.uppy.emit("upload-stalled",g,r)},"onTimeout"),onUploadProgress:o(p=>{if(p.lengthComputable)for(let{id:h}of r){let g=this.uppy.getFile(h);g!=null&&this.uppy.emit("upload-progress",g,{uploadStarted:g.progress.uploadStarted??0,bytesUploaded:p.loaded/p.total*g.size,bytesTotal:g.size})}},"onUploadProgress")}),l=await this.opts.getResponseData?.(a);if(a.responseType==="json")l??=a.response;else try{l??=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 l?.url=="string"?l.url:void 0;for(let{id:p}of r)this.uppy.emit("upload-success",this.uppy.getFile(p),{status:a.status,body:l,uploadURL:c});return a}catch(a){if(a.name==="AbortError")return;let l=a.request;for(let c of r)this.uppy.emit("upload-error",this.uppy.getFile(c.id),T2(l,a),l);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){Vt(r.allowedMetaFields,t).forEach(n=>{let a=t[n];Array.isArray(a)?a.forEach(l=>{e.append(n,l)}):e.append(n,a)})}createFormDataUpload(e,t){let r=new FormData;this.addMetadata(r,e.meta,t);let s=Wg(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),l=Wg(n);n.name?r.append(a.fieldName,l,n.name):r.append(a.fieldName,l)}),r}async#i(e){let t=new Ut(this.uppy),r=new AbortController;t.onFileRemove(e.id,()=>r.abort()),t.onCancelAll(e.id,()=>r.abort());try{await this.#t.add(async s=>{let n=this.getOptions(e),a=this.#e([e]),l=n.formData?this.createFormDataUpload(e,n):e.data,c=typeof n.endpoint=="string"?n.endpoint:await n.endpoint(e);return a(c,{...n,body:l,signal:AbortSignal.any([s,r.signal])})})}catch(s){if(s.name==="AbortError")return;throw s}finally{t.remove()}}async#r(e){let t=new AbortController;function r(){t.abort()}o(r,"abort"),this.uppy.once("cancel-all",r);try{await this.#t.add(async s=>{let n=this.uppy.getState().xhrUpload??{},a=this.#e(e),l=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:l,signal:AbortSignal.any([s,t.signal])})})}catch(s){if(s.name==="AbortError")return;throw s}finally{this.uppy.off("cancel-all",r)}}#s(e){let t=this.getOptions(e),r=Vt(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#o(e){await Promise.allSettled(e.map(t=>{if(t.isRemote){let r=o(()=>this.#t,"getQueue"),s=new AbortController,n=o(a=>{a.id===t.id&&s.abort()},"removedHandler");return this.uppy.on("file-removed",n),this.uppy.getRequestClientForFile(t).uploadRemoteFile(t,this.#s(t),{signal:s.signal,getQueue:r}).finally(()=>{this.uppy.off("file-removed",n)})}return this.#i(t)}))}#n=o(async e=>{if(e.length===0){this.uppy.log("[XHRUpload] No files to upload!");return}this.opts.limit===0&&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=wi(t),s=Si(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.#o(r)},"#handleUpload");install(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}this.uppy.addUploader(this.#n)}uninstall(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(this.#n)}};function B7(){throw new Error("Core has been renamed to Uppy")}o(B7,"Core");var j7={ProviderView:Na},z7={};export{ls as Audio,Go as AwsS3,Pe as BasePlugin,Ri as Box,Xo as Compressor,B7 as Core,Cs as Dashboard,ma as DefaultStore,Fs as DragDrop,ln as DropTarget,Di as Dropbox,Ni as Facebook,pn as Form,gn as GoldenRetriever,Mi as GoogleDrive,Os as GoogleDrivePicker,Is as GooglePhotosPicker,Ns as ImageEditor,Li as OneDrive,vn as RemoteSources,Ms as ScreenCapture,Bs as StatusBar,xr as ThumbnailGenerator,Un as Transloadit,qi as Tus,ae as UIPlugin,Bi as Unsplash,va as Uppy,di as Url,Js as Webcam,Dn as XHRUpload,ji as Zoom,So as debugLogger,z7 as locales,Mp as server,j7 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.3.0
* https://fengyuanchen.github.io/compressorjs
*
* Copyright 2018-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2026-04-06T07:12:45.816Z
*)
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