UNPKG

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 • 613 kB
var Uy=Object.create;var fo=Object.defineProperty;var Dy=Object.getOwnPropertyDescriptor;var Ny=Object.getOwnPropertyNames;var My=Object.getPrototypeOf,Ly=Object.prototype.hasOwnProperty;var o=(i,e)=>fo(i,"name",{value:e,configurable:!0});var Pe=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},Zn=(i,e)=>{for(var t in e)fo(i,t,{get:e[t],enumerable:!0})},By=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Ny(e))!Ly.call(i,s)&&s!==t&&fo(i,s,{get:()=>e[s],enumerable:!(r=Dy(e,s))||r.enumerable});return i};var ce=(i,e,t)=>(t=i!=null?Uy(My(i)):{},By(e||!i||!i.__esModule?fo(t,"default",{value:i,enumerable:!0}):t,i));var ip=Pe((eP,tp)=>{"use strict";function ep(i,e){this.text=i=i||"",this.hasWild=~i.indexOf("*"),this.separator=e,this.parts=i.split(e)}o(ep,"WildcardMatcher");ep.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};tp.exports=function(i,e,t){var r=new ep(i,t||/[\/\.]/);return typeof e<"u"?r.match(e):r}});var sp=Pe((iP,rp)=>{var fv=ip(),mv=/[\/\+\.]/;rp.exports=function(i,e){function t(r){var s=fv(r,i,mv);return s&&s.length>=2}return o(t,"test"),e?t(e.split(";")[0]):t}});var Ao=Pe((dP,ap)=>{function yv(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}o(yv,"isObject");ap.exports=yv});var up=Pe((fP,lp)=>{var vv=typeof global=="object"&&global&&global.Object===Object&&global;lp.exports=vv});var _a=Pe((mP,cp)=>{var bv=up(),wv=typeof self=="object"&&self&&self.Object===Object&&self,Sv=bv||wv||Function("return this")();cp.exports=Sv});var dp=Pe((gP,pp)=>{var xv=_a(),_v=o(function(){return xv.Date.now()},"now");pp.exports=_v});var fp=Pe((vP,hp)=>{var Ev=/\s/;function Pv(i){for(var e=i.length;e--&&Ev.test(i.charAt(e)););return e}o(Pv,"trimmedEndIndex");hp.exports=Pv});var gp=Pe((wP,mp)=>{var Tv=fp(),kv=/^\s+/;function Fv(i){return i&&i.slice(0,Tv(i)+1).replace(kv,"")}o(Fv,"baseTrim");mp.exports=Fv});var Ea=Pe((xP,yp)=>{var Cv=_a(),Rv=Cv.Symbol;yp.exports=Rv});var Sp=Pe((_P,wp)=>{var vp=Ea(),bp=Object.prototype,Av=bp.hasOwnProperty,Iv=bp.toString,ns=vp?vp.toStringTag:void 0;function Ov(i){var e=Av.call(i,ns),t=i[ns];try{i[ns]=void 0;var r=!0}catch{}var s=Iv.call(i);return r&&(e?i[ns]=t:delete i[ns]),s}o(Ov,"getRawTag");wp.exports=Ov});var _p=Pe((PP,xp)=>{var Uv=Object.prototype,Dv=Uv.toString;function Nv(i){return Dv.call(i)}o(Nv,"objectToString");xp.exports=Nv});var kp=Pe((kP,Tp)=>{var Ep=Ea(),Mv=Sp(),Lv=_p(),Bv="[object Null]",jv="[object Undefined]",Pp=Ep?Ep.toStringTag:void 0;function zv(i){return i==null?i===void 0?jv:Bv:Pp&&Pp in Object(i)?Mv(i):Lv(i)}o(zv,"baseGetTag");Tp.exports=zv});var Cp=Pe((CP,Fp)=>{function Hv(i){return i!=null&&typeof i=="object"}o(Hv,"isObjectLike");Fp.exports=Hv});var Ap=Pe((AP,Rp)=>{var qv=kp(),$v=Cp(),Vv="[object Symbol]";function Wv(i){return typeof i=="symbol"||$v(i)&&qv(i)==Vv}o(Wv,"isSymbol");Rp.exports=Wv});var Dp=Pe((OP,Up)=>{var Gv=gp(),Ip=Ao(),Xv=Ap(),Op=NaN,Kv=/^[-+]0x[0-9a-f]+$/i,Yv=/^0b[01]+$/i,Jv=/^0o[0-7]+$/i,Qv=parseInt;function Zv(i){if(typeof i=="number")return i;if(Xv(i))return Op;if(Ip(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Ip(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=Gv(i);var t=Yv.test(i);return t||Jv.test(i)?Qv(i.slice(2),t?2:8):Kv.test(i)?Op:+i}o(Zv,"toNumber");Up.exports=Zv});var Io=Pe((DP,Mp)=>{var eb=Ao(),Pa=dp(),Np=Dp(),tb="Expected a function",ib=Math.max,rb=Math.min;function sb(i,e,t){var r,s,n,a,l,c,p=0,h=!1,m=!1,y=!0;if(typeof i!="function")throw new TypeError(tb);e=Np(e)||0,eb(t)&&(h=!!t.leading,m="maxWait"in t,n=m?ib(Np(t.maxWait)||0,e):n,y="trailing"in t?!!t.trailing:y);function S(L){var J=r,G=s;return r=s=void 0,p=L,a=i.apply(G,J),a}o(S,"invokeFunc");function b(L){return p=L,l=setTimeout(j,e),h?S(L):a}o(b,"leadingEdge");function k(L){var J=L-c,G=L-p,Z=e-J;return m?rb(Z,n-G):Z}o(k,"remainingWait");function A(L){var J=L-c,G=L-p;return c===void 0||J>=e||J<0||m&&G>=n}o(A,"shouldInvoke");function j(){var L=Pa();if(A(L))return R(L);l=setTimeout(j,k(L))}o(j,"timerExpired");function R(L){return l=void 0,y&&r?S(L):(r=s=void 0,a)}o(R,"trailingEdge");function T(){l!==void 0&&clearTimeout(l),p=0,r=c=s=l=void 0}o(T,"cancel");function M(){return l===void 0?a:R(Pa())}o(M,"flush");function $(){var L=Pa(),J=A(L);if(r=arguments,s=this,c=L,J){if(l===void 0)return b(c);if(m)return clearTimeout(l),l=setTimeout(j,e),S(c)}return l===void 0&&(l=setTimeout(j,e)),a}return o($,"debounced"),$.cancel=T,$.flush=M,$}o(sb,"debounce");Mp.exports=sb});var Oo=Pe((MP,Lp)=>{var ob=Io(),nb=Ao(),ab="Expected a function";function lb(i,e,t){var r=!0,s=!0;if(typeof i!="function")throw new TypeError(ab);return nb(t)&&(r="leading"in t?!!t.leading:r,s="trailing"in t?!!t.trailing:s),ob(i,e,{leading:r,maxWait:e,trailing:s})}o(lb,"throttle");Lp.exports=lb});var jp=Pe((BP,Bp)=>{Bp.exports=o(function(){var e={},t=e._fns={};e.emit=o(function(a,l,c,p,h,m,y){var S=r(a);S.length&&s(a,S,[l,c,p,h,m,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,m=p?p.length:0;for(h;h<m;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,m=p.length;for(h;h<m;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 Me=Pe((RT,qo)=>{(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 qo<"u"&&qo.exports?(e.default=e,qo.exports=e):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return e}):window.classNames=e})()});var Td=Pe((u3,Ka)=>{"use strict";var c0=Object.prototype.hasOwnProperty,pt="~";function ps(){}o(ps,"Events");Object.create&&(ps.prototype=Object.create(null),new ps().__proto__||(pt=!1));function p0(i,e,t){this.fn=i,this.context=e,this.once=t||!1}o(p0,"EE");function Pd(i,e,t,r,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var n=new p0(t,r||i,s),a=pt?pt+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(Pd,"addListener");function Jo(i,e){--i._eventsCount===0?i._events=new ps:delete i._events[e]}o(Jo,"clearEvent");function at(){this._events=new ps,this._eventsCount=0}o(at,"EventEmitter");at.prototype.eventNames=o(function(){var e=[],t,r;if(this._eventsCount===0)return e;for(r in t=this._events)c0.call(t,r)&&e.push(pt?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},"eventNames");at.prototype.listeners=o(function(e){var t=pt?pt+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");at.prototype.listenerCount=o(function(e){var t=pt?pt+e:e,r=this._events[t];return r?r.fn?1:r.length:0},"listenerCount");at.prototype.emit=o(function(e,t,r,s,n,a){var l=pt?pt+e:e;if(!this._events[l])return!1;var c=this._events[l],p=arguments.length,h,m;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(m=1,h=new Array(p-1);m<p;m++)h[m-1]=arguments[m];c.fn.apply(c.context,h)}else{var y=c.length,S;for(m=0;m<y;m++)switch(c[m].once&&this.removeListener(e,c[m].fn,void 0,!0),p){case 1:c[m].fn.call(c[m].context);break;case 2:c[m].fn.call(c[m].context,t);break;case 3:c[m].fn.call(c[m].context,t,r);break;case 4:c[m].fn.call(c[m].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[m].fn.apply(c[m].context,h)}}return!0},"emit");at.prototype.on=o(function(e,t,r){return Pd(this,e,t,r,!1)},"on");at.prototype.once=o(function(e,t,r){return Pd(this,e,t,r,!0)},"once");at.prototype.removeListener=o(function(e,t,r,s){var n=pt?pt+e:e;if(!this._events[n])return this;if(!t)return Jo(this,n),this;var a=this._events[n];if(a.fn)a.fn===t&&(!s||a.once)&&(!r||a.context===r)&&Jo(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:Jo(this,n)}return this},"removeListener");at.prototype.removeAllListeners=o(function(e){var t;return e?(t=pt?pt+e:e,this._events[t]&&Jo(this,t)):(this._events=new ps,this._eventsCount=0),this},"removeAllListeners");at.prototype.off=at.prototype.removeListener;at.prototype.addListener=at.prototype.on;at.prefixed=pt;at.EventEmitter=at;typeof Ka<"u"&&(Ka.exports=at)});var ph=Pe((xl,_l)=>{(function(i,e){typeof xl=="object"&&typeof _l<"u"?_l.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Compressor=e())})(xl,(function(){"use strict";function i(N,C){if(!(N instanceof C))throw new TypeError("Cannot call a class as a function")}o(i,"_classCallCheck");function e(N,C){for(var O=0;O<C.length;O++){var B=C[O];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(N,c(B.key),B)}}o(e,"_defineProperties");function t(N,C,O){return C&&e(N.prototype,C),O&&e(N,O),Object.defineProperty(N,"prototype",{writable:!1}),N}o(t,"_createClass");function r(N,C,O){return(C=c(C))in N?Object.defineProperty(N,C,{value:O,enumerable:!0,configurable:!0,writable:!0}):N[C]=O,N}o(r,"_defineProperty");function s(){return s=Object.assign?Object.assign.bind():function(N){for(var C=1;C<arguments.length;C++){var O=arguments[C];for(var B in O)({}).hasOwnProperty.call(O,B)&&(N[B]=O[B])}return N},s.apply(null,arguments)}o(s,"_extends");function n(N,C){var O=Object.keys(N);if(Object.getOwnPropertySymbols){var B=Object.getOwnPropertySymbols(N);C&&(B=B.filter(function(Y){return Object.getOwnPropertyDescriptor(N,Y).enumerable})),O.push.apply(O,B)}return O}o(n,"ownKeys");function a(N){for(var C=1;C<arguments.length;C++){var O=arguments[C]!=null?arguments[C]:{};C%2?n(Object(O),!0).forEach(function(B){r(N,B,O[B])}):Object.getOwnPropertyDescriptors?Object.defineProperties(N,Object.getOwnPropertyDescriptors(O)):n(Object(O)).forEach(function(B){Object.defineProperty(N,B,Object.getOwnPropertyDescriptor(O,B))})}return N}o(a,"_objectSpread2");function l(N,C){if(typeof N!="object"||!N)return N;var O=N[Symbol.toPrimitive];if(O!==void 0){var B=O.call(N,C||"default");if(typeof B!="object")return B;throw new TypeError("@@toPrimitive must return a primitive value.")}return(C==="string"?String:Number)(N)}o(l,"_toPrimitive");function c(N){var C=l(N,"string");return typeof C=="symbol"?C:C+""}o(c,"_toPropertyKey");var p={exports:{}};(function(N){typeof window>"u"||(function(C){var O=C.HTMLCanvasElement&&C.HTMLCanvasElement.prototype,B=C.Blob&&(function(){try{return!!new Blob}catch{return!1}})(),Y=B&&C.Uint8Array&&(function(){try{return new Blob([new Uint8Array(100)]).size===100}catch{return!1}})(),Q=C.BlobBuilder||C.WebKitBlobBuilder||C.MozBlobBuilder||C.MSBlobBuilder,Se=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,pe=(B||Q)&&C.atob&&C.ArrayBuffer&&C.Uint8Array&&function(ne){var se,_e,Fe,ut,De,te,rt,je,qt;if(se=ne.match(Se),!se)throw new Error("invalid data URI");for(_e=se[2]?se[1]:"text/plain"+(se[3]||";charset=US-ASCII"),Fe=!!se[4],ut=ne.slice(se[0].length),Fe?De=atob(ut):De=decodeURIComponent(ut),te=new ArrayBuffer(De.length),rt=new Uint8Array(te),je=0;je<De.length;je+=1)rt[je]=De.charCodeAt(je);return B?new Blob([Y?rt:te],{type:_e}):(qt=new Q,qt.append(te),qt.getBlob(_e))};C.HTMLCanvasElement&&!O.toBlob&&(O.mozGetAsFile?O.toBlob=function(ne,se,_e){var Fe=this;setTimeout(function(){_e&&O.toDataURL&&pe?ne(pe(Fe.toDataURL(se,_e))):ne(Fe.mozGetAsFile("blob",se))})}:O.toDataURL&&pe&&(O.msToBlob?O.toBlob=function(ne,se,_e){var Fe=this;setTimeout(function(){(se&&se!=="image/png"||_e)&&O.toDataURL&&pe?ne(pe(Fe.toDataURL(se,_e))):ne(Fe.msToBlob(se))})}:O.toBlob=function(ne,se,_e){var Fe=this;setTimeout(function(){ne(pe(Fe.toDataURL(se,_e)))})})),N.exports?N.exports=pe:C.dataURLtoBlob=pe})(window)})(p);var h=p.exports,m=o(function(C){return typeof Blob>"u"?!1:C instanceof Blob||Object.prototype.toString.call(C)==="[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",b=S?window:{},k=o(function(C){return C>0&&C<1/0},"isPositiveNumber"),A=Array.prototype.slice;function j(N){return Array.from?Array.from(N):A.call(N)}o(j,"toArray");var R=/^image\/.+$/;function T(N){return R.test(N)}o(T,"isImageType");function M(N){var C=T(N)?N.substr(6):"";return C==="jpeg"&&(C="jpg"),".".concat(C)}o(M,"imageTypeToExtension");var $=String.fromCharCode;function L(N,C,O){var B="",Y;for(O+=C,Y=C;Y<O;Y+=1)B+=$(N.getUint8(Y));return B}o(L,"getStringFromCharCode");function J(){try{var N=document.createElement("canvas");N.width=2,N.height=1;var C=N.getContext("2d");if(!C)return!1;var O=C.createImageData(2,1);O.data[0]=12,O.data[1]=23,O.data[2]=34,O.data[3]=255,O.data[4]=45,O.data[5]=56,O.data[6]=67,O.data[7]=255,C.putImageData(O,0,0);var B=C.getImageData(0,0,2,1),Y=[12,23,34,255,45,56,67,255];return B.data.every(function(Q,Se){return Q===Y[Se]})}catch{return!1}}o(J,"isCanvasAvailable");var G=b.btoa;function Z(N,C){for(var O=[],B=8192,Y=new Uint8Array(N);Y.length>0;)O.push($.apply(null,j(Y.subarray(0,B)))),Y=Y.subarray(B);return"data:".concat(C,";base64,").concat(G(O.join("")))}o(Z,"arrayBufferToDataURL");function ie(N){var C=new DataView(N),O;try{var B,Y,Q;if(C.getUint8(0)===255&&C.getUint8(1)===216)for(var Se=C.byteLength,pe=2;pe+1<Se;){if(C.getUint8(pe)===255&&C.getUint8(pe+1)===225){Y=pe;break}pe+=1}if(Y){var ne=Y+4,se=Y+10;if(L(C,ne,4)==="Exif"){var _e=C.getUint16(se);if(B=_e===18761,(B||_e===19789)&&C.getUint16(se+2,B)===42){var Fe=C.getUint32(se+4,B);Fe>=8&&(Q=se+Fe)}}}if(Q){var ut=C.getUint16(Q,B),De,te;for(te=0;te<ut;te+=1)if(De=Q+te*12+2,C.getUint16(De,B)===274){De+=8,O=C.getUint16(De,B),C.setUint16(De,1,B);break}}}catch{O=1}return O}o(ie,"resetAndGetOrientation");function oe(N){var C=0,O=1,B=1;switch(N){case 2:O=-1;break;case 3:C=-180;break;case 4:B=-1;break;case 5:C=90,B=-1;break;case 6:C=90;break;case 7:C=90,O=-1;break;case 8:C=-90;break}return{rotate:C,scaleX:O,scaleY:B}}o(oe,"parseOrientation");var Ie=/\.\d*(?:0|9){12}\d*$/;function be(N){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Ie.test(N)?Math.round(N*C)/C:N}o(be,"normalizeDecimalNumber");function me(N){var C=N.aspectRatio,O=N.height,B=N.width,Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"none",Q=k(B),Se=k(O);if(Q&&Se){var pe=O*C;(Y==="contain"||Y==="none")&&pe>B||Y==="cover"&&pe<B?O=B/C:B=O*C}else Q?O=B/C:Se&&(B=O*C);return{width:B,height:O}}o(me,"getAdjustedSizes");function Te(N){for(var C=j(new Uint8Array(N)),O=C.length,B=[],Y=0;Y+3<O;){var Q=C[Y],Se=C[Y+1];if(Q===255&&Se===218)break;if(Q===255&&Se===216)Y+=2;else{var pe=C[Y+2]*256+C[Y+3],ne=Y+pe+2,se=C.slice(Y,ne);B.push(se),Y=ne}}return B.reduce(function(_e,Fe){return Fe[0]===255&&Fe[1]===225?_e.concat(Fe):_e},[])}o(Te,"getExif");function F(N,C){var O=j(new Uint8Array(N));if(O[2]!==255||O[3]!==224)return N;var B=O[4]*256+O[5],Y=[255,216].concat(C,O.slice(4+B));return new Uint8Array(Y)}o(F,"insertExif");var x=b.ArrayBuffer,E=b.FileReader,z=b.URL||b.webkitURL,V=/\.\w+$/,H=b.Compressor,ee=(function(){function N(C,O){i(this,N),this.file=C,this.exif=[],this.image=new Image,this.options=a(a({},y),O),this.aborted=!1,this.result=null,this.init()}return o(N,"Compressor"),t(N,[{key:"init",value:o(function(){var O=this,B=this.file,Y=this.options;if(!m(B)){this.fail(new Error("The first argument must be a File or Blob object."));return}var Q=B.type;if(!T(Q)){this.fail(new Error("The first argument must be an image File or Blob object."));return}if(!z||!E){this.fail(new Error("The current browser does not support image compression."));return}x||(Y.checkOrientation=!1,Y.retainExif=!1);var Se=Q==="image/jpeg",pe=Se&&Y.checkOrientation,ne=Se&&Y.retainExif;if(z&&!pe&&!ne)this.load({url:z.createObjectURL(B)});else{var se=new E;this.reader=se,se.onload=function(_e){var Fe=_e.target,ut=Fe.result,De={},te=1;pe&&(te=ie(ut),te>1&&s(De,oe(te))),ne&&(O.exif=Te(ut)),pe||ne?!z||te>1?De.url=Z(ut,Q):De.url=z.createObjectURL(B):De.url=ut,O.load(De)},se.onabort=function(){O.fail(new Error("Aborted to read the image with FileReader."))},se.onerror=function(){O.fail(new Error("Failed to read the image with FileReader."))},se.onloadend=function(){O.reader=null},pe||ne?se.readAsArrayBuffer(B):se.readAsDataURL(B)}},"init")},{key:"load",value:o(function(O){var B=this,Y=this.file,Q=this.image;Q.onload=function(){J()?B.draw(a(a({},O),{},{naturalWidth:Q.naturalWidth,naturalHeight:Q.naturalHeight})):B.done({naturalWidth:Q.naturalWidth,naturalHeight:Q.naturalHeight,result:null})},Q.onabort=function(){B.fail(new Error("Aborted to load the image."))},Q.onerror=function(){B.fail(new Error("Failed to load the image."))},b.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(b.navigator.userAgent)&&(Q.crossOrigin="anonymous"),Q.alt=Y.name,Q.src=O.url},"load")},{key:"draw",value:o(function(O){var B=this,Y=O.naturalWidth,Q=O.naturalHeight,Se=O.rotate,pe=Se===void 0?0:Se,ne=O.scaleX,se=ne===void 0?1:ne,_e=O.scaleY,Fe=_e===void 0?1:_e,ut=this.file,De=this.image,te=this.options,rt=document.createElement("canvas"),je=rt.getContext("2d"),qt=Math.abs(pe)%180===90,Yi=(te.resize==="contain"||te.resize==="cover")&&k(te.width)&&k(te.height),$t=Math.max(te.maxWidth,0)||1/0,Zt=Math.max(te.maxHeight,0)||1/0,wi=Math.max(te.minWidth,0)||0,Si=Math.max(te.minHeight,0)||0,ei=Y/Q,Ge=te.width,qe=te.height;if(qt){var Mr=[Zt,$t];$t=Mr[0],Zt=Mr[1];var Lr=[Si,wi];wi=Lr[0],Si=Lr[1];var oo=[qe,Ge];Ge=oo[0],qe=oo[1]}Yi&&(ei=Ge/qe);var no=me({aspectRatio:ei,width:$t,height:Zt},"contain");$t=no.width,Zt=no.height;var ae=me({aspectRatio:ei,width:wi,height:Si},"cover");if(wi=ae.width,Si=ae.height,Yi){var Br=me({aspectRatio:ei,width:Ge,height:qe},te.resize);Ge=Br.width,qe=Br.height}else{var Ji=me({aspectRatio:ei,width:Ge,height:qe}),It=Ji.width;Ge=It===void 0?Y:It;var ao=Ji.height;qe=ao===void 0?Q:ao}Ge=Math.floor(be(Math.min(Math.max(Ge,wi),$t))),qe=Math.floor(be(Math.min(Math.max(qe,Si),Zt)));var ti=-Ge/2,st=-qe/2,Kn=Ge,lo=qe,Ce=[];if(Yi){var Ee=0,uo=0,Ot=Y,jr=Q,Ft=me({aspectRatio:ei,width:Y,height:Q},{contain:"cover",cover:"contain"}[te.resize]);Ot=Ft.width,jr=Ft.height,Ee=(Y-Ot)/2,uo=(Q-jr)/2,Ce.push(Ee,uo,Ot,jr)}if(Ce.push(ti,st,Kn,lo),qt){var co=[qe,Ge];Ge=co[0],qe=co[1]}rt.width=Ge,rt.height=qe,T(te.mimeType)||(te.mimeType=ut.type);var Le="transparent";ut.size>te.convertSize&&te.convertTypes.indexOf(te.mimeType)>=0&&(te.mimeType="image/jpeg");var yt=te.mimeType==="image/jpeg";if(yt&&(Le="#fff"),je.fillStyle=Le,je.fillRect(0,0,Ge,qe),te.beforeDraw&&te.beforeDraw.call(this,je,rt),!this.aborted&&(je.save(),je.translate(Ge/2,qe/2),je.rotate(pe*Math.PI/180),je.scale(se,Fe),je.drawImage.apply(je,[De].concat(Ce)),je.restore(),te.drew&&te.drew.call(this,je,rt),!this.aborted)){var Vt=o(function(Wt){if(!B.aborted){var Qi=o(function(si){return B.done({naturalWidth:Y,naturalHeight:Q,result:si})},"done");if(Wt&&yt&&te.retainExif&&B.exif&&B.exif.length>0){var ii=o(function(si){return Qi(h(Z(F(si,B.exif),te.mimeType)))},"next");if(Wt.arrayBuffer)Wt.arrayBuffer().then(ii).catch(function(){B.fail(new Error("Failed to read the compressed image with Blob.arrayBuffer()."))});else{var ri=new E;B.reader=ri,ri.onload=function(Zi){var si=Zi.target;ii(si.result)},ri.onabort=function(){B.fail(new Error("Aborted to read the compressed image with FileReader."))},ri.onerror=function(){B.fail(new Error("Failed to read the compressed image with FileReader."))},ri.onloadend=function(){B.reader=null},ri.readAsArrayBuffer(Wt)}}else Qi(Wt)}},"callback");rt.toBlob?rt.toBlob(Vt,te.mimeType,te.quality):Vt(h(rt.toDataURL(te.mimeType,te.quality)))}},"draw")},{key:"done",value:o(function(O){var B=O.naturalWidth,Y=O.naturalHeight,Q=O.result,Se=this.file,pe=this.image,ne=this.options;if(z&&pe.src.indexOf("blob:")===0&&z.revokeObjectURL(pe.src),Q)if(ne.strict&&!ne.retainExif&&Q.size>Se.size&&ne.mimeType===Se.type&&!(ne.width>B||ne.height>Y||ne.minWidth>B||ne.minHeight>Y||ne.maxWidth<B||ne.maxHeight<Y))Q=Se;else{var se=Se.name;se&&Q.type!==Se.type&&(se=se.replace(V,M(Q.type)));try{Q=new File([Q],se,{type:Q.type})}catch{var _e=new Date;Q.name=se,Q.lastModified=_e.getTime(),Q.lastModifiedDate=_e}}else Q=Se;this.result=Q,ne.success&&ne.success.call(this,Q)},"done")},{key:"fail",value:o(function(O){var B=this.options;if(B.error)B.error.call(this,O);else throw O},"fail")},{key:"abort",value:o(function(){this.aborted||(this.aborted=!0,this.reader?this.reader.abort():this.image.complete?this.fail(new Error("The compression process has been aborted.")):(this.image.onload=null,this.image.onabort()))},"abort")}],[{key:"noConflict",value:o(function(){return window.Compressor=H,N},"noConflict")},{key:"setDefaults",value:o(function(O){s(y,O)},"setDefaults")}])})();return ee}))});var Wf=Pe((nu,au)=>{(function(i,e){typeof nu=="object"&&typeof au<"u"?au.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Cropper=e())})(nu,(function(){"use strict";function i(v,d){var g=Object.keys(v);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(v);d&&(f=f.filter(function(P){return Object.getOwnPropertyDescriptor(v,P).enumerable})),g.push.apply(g,f)}return g}o(i,"ownKeys");function e(v){for(var d=1;d<arguments.length;d++){var g=arguments[d]!=null?arguments[d]:{};d%2?i(Object(g),!0).forEach(function(f){c(v,f,g[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(g)):i(Object(g)).forEach(function(f){Object.defineProperty(v,f,Object.getOwnPropertyDescriptor(g,f))})}return v}o(e,"_objectSpread2");function t(v,d){if(typeof v!="object"||!v)return v;var g=v[Symbol.toPrimitive];if(g!==void 0){var f=g.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 g=0;g<d.length;g++){var f=d[g];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,g){return d&&a(v.prototype,d),g&&a(v,g),Object.defineProperty(v,"prototype",{writable:!1}),v}o(l,"_createClass");function c(v,d,g){return d=r(d),d in v?Object.defineProperty(v,d,{value:g,enumerable:!0,configurable:!0,writable:!0}):v[d]=g,v}o(c,"_defineProperty");function p(v){return h(v)||m(v)||y(v)||b()}o(p,"_toConsumableArray");function h(v){if(Array.isArray(v))return S(v)}o(h,"_arrayWithoutHoles");function m(v){if(typeof Symbol<"u"&&v[Symbol.iterator]!=null||v["@@iterator"]!=null)return Array.from(v)}o(m,"_iterableToArray");function y(v,d){if(v){if(typeof v=="string")return S(v,d);var g=Object.prototype.toString.call(v).slice(8,-1);if(g==="Object"&&v.constructor&&(g=v.constructor.name),g==="Map"||g==="Set")return Array.from(v);if(g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g))return S(v,d)}}o(y,"_unsupportedIterableToArray");function S(v,d){(d==null||d>v.length)&&(d=v.length);for(var g=0,f=new Array(d);g<d;g++)f[g]=v[g];return f}o(S,"_arrayLikeToArray");function b(){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(b,"_nonIterableSpread");var k=typeof window<"u"&&typeof window.document<"u",A=k?window:{},j=k&&A.document.documentElement?"ontouchstart"in A.document.documentElement:!1,R=k?"PointerEvent"in A:!1,T="cropper",M="all",$="crop",L="move",J="zoom",G="e",Z="w",ie="s",oe="n",Ie="ne",be="nw",me="se",Te="sw",F="".concat(T,"-crop"),x="".concat(T,"-disabled"),E="".concat(T,"-hidden"),z="".concat(T,"-hide"),V="".concat(T,"-invisible"),H="".concat(T,"-modal"),ee="".concat(T,"-move"),N="".concat(T,"Action"),C="".concat(T,"Preview"),O="crop",B="move",Y="none",Q="crop",Se="cropend",pe="cropmove",ne="cropstart",se="dblclick",_e=j?"touchstart":"mousedown",Fe=j?"touchmove":"mousemove",ut=j?"touchend touchcancel":"mouseup",De=R?"pointerdown":_e,te=R?"pointermove":Fe,rt=R?"pointerup pointercancel":ut,je="ready",qt="resize",Yi="wheel",$t="zoom",Zt="image/jpeg",wi=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Si=/^data:/,ei=/^data:image\/jpeg;base64,/,Ge=/^img|canvas$/i,qe=200,Mr=100,Lr={viewMode:0,dragMode:O,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:qe,minContainerHeight:Mr,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},oo='<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>',no=Number.isNaN||A.isNaN;function ae(v){return typeof v=="number"&&!no(v)}o(ae,"isNumber");var Br=o(function(d){return d>0&&d<1/0},"isPositiveNumber");function Ji(v){return typeof v>"u"}o(Ji,"isUndefined");function It(v){return s(v)==="object"&&v!==null}o(It,"isObject");var ao=Object.prototype.hasOwnProperty;function ti(v){if(!It(v))return!1;try{var d=v.constructor,g=d.prototype;return d&&g&&ao.call(g,"isPrototypeOf")}catch{return!1}}o(ti,"isPlainObject");function st(v){return typeof v=="function"}o(st,"isFunction");var Kn=Array.prototype.slice;function lo(v){return Array.from?Array.from(v):Kn.call(v)}o(lo,"toArray");function Ce(v,d){return v&&st(d)&&(Array.isArray(v)||ae(v.length)?lo(v).forEach(function(g,f){d.call(v,g,f,v)}):It(v)&&Object.keys(v).forEach(function(g){d.call(v,v[g],g,v)})),v}o(Ce,"forEach");var Ee=Object.assign||o(function(d){for(var g=arguments.length,f=new Array(g>1?g-1:0),P=1;P<g;P++)f[P-1]=arguments[P];return It(d)&&f.length>0&&f.forEach(function(w){It(w)&&Object.keys(w).forEach(function(_){d[_]=w[_]})}),d},"assign"),uo=/\.\d*(?:0|9){12}\d*$/;function Ot(v){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return uo.test(v)?Math.round(v*d)/d:v}o(Ot,"normalizeDecimalNumber");var jr=/^width|height|left|top|marginLeft|marginTop$/;function Ft(v,d){var g=v.style;Ce(d,function(f,P){jr.test(P)&&ae(f)&&(f="".concat(f,"px")),g[P]=f})}o(Ft,"setStyle");function co(v,d){return v.classList?v.classList.contains(d):v.className.indexOf(d)>-1}o(co,"hasClass");function Le(v,d){if(d){if(ae(v.length)){Ce(v,function(f){Le(f,d)});return}if(v.classList){v.classList.add(d);return}var g=v.className.trim();g?g.indexOf(d)<0&&(v.className="".concat(g," ").concat(d)):v.className=d}}o(Le,"addClass");function yt(v,d){if(d){if(ae(v.length)){Ce(v,function(g){yt(g,d)});return}if(v.classList){v.classList.remove(d);return}v.className.indexOf(d)>=0&&(v.className=v.className.replace(d,""))}}o(yt,"removeClass");function Vt(v,d,g){if(d){if(ae(v.length)){Ce(v,function(f){Vt(f,d,g)});return}g?Le(v,d):yt(v,d)}}o(Vt,"toggleClass");var pc=/([a-z\d])([A-Z])/g;function Wt(v){return v.replace(pc,"$1-$2").toLowerCase()}o(Wt,"toParamCase");function Qi(v,d){return It(v[d])?v[d]:v.dataset?v.dataset[d]:v.getAttribute("data-".concat(Wt(d)))}o(Qi,"getData");function ii(v,d,g){It(g)?v[d]=g:v.dataset?v.dataset[d]=g:v.setAttribute("data-".concat(Wt(d)),g)}o(ii,"setData");function ri(v,d){if(It(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(Wt(d)))}o(ri,"removeData");var Zi=/\s\s*/,si=(function(){var v=!1;if(k){var d=!1,g=o(function(){},"listener"),f=Object.defineProperty({},"once",{get:o(function(){return v=!0,d},"get"),set:o(function(w){d=w},"set")});A.addEventListener("test",g,f),A.removeEventListener("test",g,f)}return v})();function Ct(v,d,g){var f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},P=g;d.trim().split(Zi).forEach(function(w){if(!si){var _=v.listeners;_&&_[w]&&_[w][g]&&(P=_[w][g],delete _[w][g],Object.keys(_[w]).length===0&&delete _[w],Object.keys(_).length===0&&delete v.listeners)}v.removeEventListener(w,P,f)})}o(Ct,"removeListener");function _t(v,d,g){var f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},P=g;d.trim().split(Zi).forEach(function(w){if(f.once&&!si){var _=v.listeners,I=_===void 0?{}:_;P=o(function(){delete I[w][g],v.removeEventListener(w,P,f);for(var q=arguments.length,U=new Array(q),D=0;D<q;D++)U[D]=arguments[D];g.apply(v,U)},"handler"),I[w]||(I[w]={}),I[w][g]&&v.removeEventListener(w,I[w][g],f),I[w][g]=P,v.listeners=I}v.addEventListener(w,P,f)})}o(_t,"addListener");function er(v,d,g){var f;return st(Event)&&st(CustomEvent)?f=new CustomEvent(d,{detail:g,bubbles:!0,cancelable:!0}):(f=document.createEvent("CustomEvent"),f.initCustomEvent(d,!0,!0,g)),v.dispatchEvent(f)}o(er,"dispatchEvent");function dc(v){var d=v.getBoundingClientRect();return{left:d.left+(window.pageXOffset-document.documentElement.clientLeft),top:d.top+(window.pageYOffset-document.documentElement.clientTop)}}o(dc,"getOffset");var Yn=A.location,fy=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function hc(v){var d=v.match(fy);return d!==null&&(d[1]!==Yn.protocol||d[2]!==Yn.hostname||d[3]!==Yn.port)}o(hc,"isCrossOriginURL");function fc(v){var d="timestamp=".concat(new Date().getTime());return v+(v.indexOf("?")===-1?"?":"&")+d}o(fc,"addTimestamp");function zr(v){var d=v.rotate,g=v.scaleX,f=v.scaleY,P=v.translateX,w=v.translateY,_=[];ae(P)&&P!==0&&_.push("translateX(".concat(P,"px)")),ae(w)&&w!==0&&_.push("translateY(".concat(w,"px)")),ae(d)&&d!==0&&_.push("rotate(".concat(d,"deg)")),ae(g)&&g!==1&&_.push("scaleX(".concat(g,")")),ae(f)&&f!==1&&_.push("scaleY(".concat(f,")"));var I=_.length?_.join(" "):"none";return{WebkitTransform:I,msTransform:I,transform:I}}o(zr,"getTransforms");function my(v){var d=e({},v),g=0;return Ce(v,function(f,P){delete d[P],Ce(d,function(w){var _=Math.abs(f.startX-w.startX),I=Math.abs(f.startY-w.startY),X=Math.abs(f.endX-w.endX),q=Math.abs(f.endY-w.endY),U=Math.sqrt(_*_+I*I),D=Math.sqrt(X*X+q*q),W=(D-U)/U;Math.abs(W)>Math.abs(g)&&(g=W)})}),g}o(my,"getMaxZoomRatio");function po(v,d){var g=v.pageX,f=v.pageY,P={endX:g,endY:f};return d?P:e({startX:g,startY:f},P)}o(po,"getPointer");function gy(v){var d=0,g=0,f=0;return Ce(v,function(P){var w=P.startX,_=P.startY;d+=w,g+=_,f+=1}),d/=f,g/=f,{pageX:d,pageY:g}}o(gy,"getPointersCenter");function oi(v){var d=v.aspectRatio,g=v.height,f=v.width,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",w=Br(f),_=Br(g);if(w&&_){var I=g*d;P==="contain"&&I>f||P==="cover"&&I<f?g=f/d:f=g*d}else w?g=f/d:_&&(f=g*d);return{width:f,height:g}}o(oi,"getAdjustedSizes");function yy(v){var d=v.width,g=v.height,f=v.degree;if(f=Math.abs(f)%180,f===90)return{width:g,height:d};var P=f%90*Math.PI/180,w=Math.sin(P),_=Math.cos(P),I=d*_+g*w,X=d*w+g*_;return f>90?{width:X,height:I}:{width:I,height:X}}o(yy,"getRotatedSizes");function vy(v,d,g,f){var P=d.aspectRatio,w=d.naturalWidth,_=d.naturalHeight,I=d.rotate,X=I===void 0?0:I,q=d.scaleX,U=q===void 0?1:q,D=d.scaleY,W=D===void 0?1:D,de=g.aspectRatio,ue=g.naturalWidth,Re=g.naturalHeight,ge=f.fillColor,$e=ge===void 0?"transparent":ge,Xe=f.imageSmoothingEnabled,ze=Xe===void 0?!0:Xe,Gt=f.imageSmoothingQuality,vt=Gt===void 0?"low":Gt,K=f.maxWidth,ye=K===void 0?1/0:K,Ve=f.maxHeight,Et=Ve===void 0?1/0:Ve,Xt=f.minWidth,xi=Xt===void 0?0:Xt,_i=f.minHeight,ni=_i===void 0?0:_i,Ut=document.createElement("canvas"),ht=Ut.getContext("2d"),Ei=oi({aspectRatio:de,width:ye,height:Et}),ho=oi({aspectRatio:de,width:xi,height:ni},"cover"),Jn=Math.min(Ei.width,Math.max(ho.width,ue)),Qn=Math.min(Ei.height,Math.max(ho.height,Re)),yc=oi({aspectRatio:P,width:ye,height:Et}),vc=oi({aspectRatio:P,width:xi,height:ni},"cover"),bc=Math.min(yc.width,Math.max(vc.width,w)),wc=Math.min(yc.height,Math.max(vc.height,_)),Iy=[-bc/2,-wc/2,bc,wc];return Ut.width=Ot(Jn),Ut.height=Ot(Qn),ht.fillStyle=$e,ht.fillRect(0,0,Jn,Qn),ht.save(),ht.translate(Jn/2,Qn/2),ht.rotate(X*Math.PI/180),ht.scale(U,W),ht.imageSmoothingEnabled=ze,ht.imageSmoothingQuality=vt,ht.drawImage.apply(ht,[v].concat(p(Iy.map(function(Oy){return Math.floor(Ot(Oy))})))),ht.restore(),Ut}o(vy,"getSourceCanvas");var mc=String.fromCharCode;function by(v,d,g){var f="";g+=d;for(var P=d;P<g;P+=1)f+=mc(v.getUint8(P));return f}o(by,"getStringFromCharCode");var wy=/^data:.*,/;function Sy(v){var d=v.replace(wy,""),g=atob(d),f=new ArrayBuffer(g.length),P=new Uint8Array(f);return Ce(P,function(w,_){P[_]=g.charCodeAt(_)}),f}o(Sy,"dataURLToArrayBuffer");function xy(v,d){for(var g=[],f=8192,P=new Uint8Array(v);P.length>0;)g.push(mc.apply(null,lo(P.subarray(0,f)))),P=P.subarray(f);return"data:".concat(d,";base64,").concat(btoa(g.join("")))}o(xy,"arrayBufferToDataURL");function _y(v){var d=new DataView(v),g;try{var f,P,w;if(d.getUint8(0)===255&&d.getUint8(1)===216)for(var _=d.byteLength,I=2;I+1<_;){if(d.getUint8(I)===255&&d.getUint8(I+1)===225){P=I;break}I+=1}if(P){var X=P+4,q=P+10;if(by(d,X,4)==="Exif"){var U=d.getUint16(q);if(f=U===18761,(f||U===19789)&&d.getUint16(q+2,f)===42){var D=d.getUint32(q+4,f);D>=8&&(w=q+D)}}}if(w){var W=d.getUint16(w,f),de,ue;for(ue=0;ue<W;ue+=1)if(de=w+ue*12+2,d.getUint16(de,f)===274){de+=8,g=d.getUint16(de,f),d.setUint16(de,1,f);break}}}catch{g=1}return g}o(_y,"resetAndGetOrientation");function Ey(v){var d=0,g=1,f=1;switch(v){case 2:g=-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,g=-1;break;case 8:d=-90;break}return{rotate:d,scaleX:g,scaleY:f}}o(Ey,"parseOrientation");var Py={render:o(function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},"render"),initContainer:o(function(){var d=this.element,g=this.options,f=this.container,P=this.cropper,w=Number(g.minContainerWidth),_=Number(g.minContainerHeight);Le(P,E),yt(d,E);var I={width:Math.max(f.offsetWidth,w>=0?w:qe),height:Math.max(f.offsetHeight,_>=0?_:Mr)};this.containerData=I,Ft(P,{width:I.width,height:I.height}),Le(d,E),yt(P,E)},"initContainer"),initCanvas:o(function(){var d=this.containerData,g=this.imageData,f=this.options.viewMode,P=Math.abs(g.rotate)%180===90,w=P?g.naturalHeight:g.naturalWidth,_=P?g.naturalWidth:g.naturalHeight,I=w/_,X=d.width,q=d.height;d.height*I>d.width?f===3?X=d.height*I:q=d.width/I:f===3?q=d.width/I:X=d.height*I;var U={aspectRatio:I,naturalWidth:w,naturalHeight:_,width:X,height:q};this.canvasData=U,this.limited=f===1||f===2,this.limitCanvas(!0,!0),U.width=Math.min(Math.max(U.width,U.minWidth),U.maxWidth),U.height=Math.min(Math.max(U.height,U.minHeight),U.maxHeight),U.left=(d.width-U.width)/2,U.top=(d.height-U.height)/2,U.oldLeft=U.left,U.oldTop=U.top,this.initialCanvasData=Ee({},U)},"initCanvas"),limitCanvas:o(function(d,g){var f=this.options,P=this.containerData,w=this.canvasData,_=this.cropBoxData,I=f.viewMode,X=w.aspectRatio,q=this.cropped&&_;if(d){var U=Number(f.minCanvasWidth)||0,D=Number(f.minCanvasHeight)||0;I>1?(U=Math.max(U,P.width),D=Math.max(D,P.height),I===3&&(D*X>U?U=D*X:D=U/X)):I>0&&(U?U=Math.max(U,q?_.width:0):D?D=Math.max(D,q?_.height:0):q&&(U=_.width,D=_.height,D*X>U?U=D*X:D=U/X));var W=oi({aspectRatio:X,width:U,height:D});U=W.width,D=W.height,w.minWidth=U,w.minHeight=D,w.maxWidth=1/0,w.maxHeight=1/0}if(g)if(I>(q?0:1)){var de=P.width-w.width,ue=P.height-w.height;w.minLeft=Math.min(0,de),w.minTop=Math.min(0,ue),w.maxLeft=Math.max(0,de),w.maxTop=Math.max(0,ue),q&&this.limited&&(w.minLeft=Math.min(_.left,_.left+(_.width-w.width)),w.minTop=Math.min(_.top,_.top+(_.height-w.height)),w.maxLeft=_.left,w.maxTop=_.top,I===2&&(w.width>=P.width&&(w.minLeft=Math.min(0,de),w.maxLeft=Math.max(0,de)),w.height>=P.height&&(w.minTop=Math.min(0,ue),w.maxTop=Math.max(0,ue))))}else w.minLeft=-w.width,w.minTop=-w.height,w.maxLeft=P.width,w.maxTop=P.height},"limitCanvas"),renderCanvas:o(function(d,g){var f=this.canvasData,P=this.imageData;if(g){var w=yy({width:P.naturalWidth*Math.abs(P.scaleX||1),height:P.naturalHeight*Math.abs(P.scaleY||1),degree:P.rotate||0}),_=w.width,I=w.height,X=f.width*(_/f.naturalWidth),q=f.height*(I/f.naturalHeight);f.left-=(X-f.width)/2,f.top-=(q-f.height)/2,f.width=X,f.height=q,f.aspectRatio=_/I,f.naturalWidth=_,f.naturalHeight=I,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,Ft(this.canvas,Ee({width:f.width,height:f.height},zr({translateX:f.left,translateY:f.top}))),this.renderImage(d),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},"renderCanvas"),renderImage:o(function(d){var g=this.canvasData,f=this.imageData,P=f.naturalWidth*(g.width/g.naturalWidth),w=f.naturalHeight*(g.height/g.naturalHeight);Ee(f,{width:P,height:w,left:(g.width-P)/2,top:(g.height-w)/2}),Ft(this.image,Ee({width:f.width,height:f.height},zr(Ee({translateX:f.left,translateY:f.top},f)))),d&&this.output()},"renderImage"),initCropBox:o(function(){var d=this.options,g=this.canvasData,f=d.aspectRatio||d.initialAspectRatio,P=Number(d.autoCropArea)||.8,w={width:g.width,height:g.height};f&&(g.height*f>g.width?w.height=w.width/f:w.width=w.height*f),this.cropBoxData=w,this.limitCropBox(!0,!0),w.width=Math.min(Math.max(w.width,w.minWidth),w.maxWidth),w.height=Math.min(Math.max(w.height,w.minHeight),w.maxHeight),w.width=Math.max(w.minWidth,w.width*P),w.height=Math.max(w.minHeight,w.height*P),w.left=g.left+(g.width-w.width)/2,w.top=g.top+(g.height-w.height)/2,w.oldLeft=w.left,w.oldTop=w.top,this.initialCropBoxData=Ee({},w)},"initCropBox"),limitCropBox:o(function(d,g){var f=this.options,P=this.containerData,w=this.canvasData,_=this.cropBoxData,I=this.limited,X=f.aspectRatio;if(d){var q=Number(f.minCropBoxWidth)||0,U=Number(f.minCropBoxHeight)||0,D=I?Math.min(P.width,w.width,w.width+w.left,P.width-w.left):P.width,W=I?Math.min(P.height,w.height,w.height+w.top,P.height-w.top):P.height;q=Math.min(q,P.width),U=Math.min(U,P.height),X&&(q&&U?U*X>q?U=q/X:q=U*X:q?U=q/X:U&&(q=U*X),W*X>D?W=D/X:D=W*X),_.minWidth=Math.min(q,D),_.minHeight=Math.min(U,W),_.maxWidth=D,_.maxHeight=W}g&&(I?(_.minLeft=Math.max(0,w.left),_.minTop=Math.max(0,w.top),_.maxLeft=Math.min(P.width,w.left+w.width)-_.width,_.maxTop=Math.min(P.height,w.top+w.height)-_.height):(_.minLeft=0,_.minTop=0,_.maxLeft=P.width-_.width,_.maxTop=P.height-_.height))},"limitCropBox"),renderCropBox:o(function(){var d=this.options,g=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&&ii(this.face,N,f.width>=g.width&&f.height>=g.height?L:M),Ft(this.cropBox,Ee({width:f.width,height:f.height},zr({translateX:f.left,translateY:f.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},"renderCropBox"),output:o(function(){this.preview(),er(this.element,Q,this.getData())},"output")},Ty={initPreview:o(function(){var d=this.element,g=this.crossOrigin,f=this.options.preview,P=g?this.crossOriginUrl:this.url,w=d.alt||"The image to preview",_=document.createElement("img");if(g&&(_.crossOrigin=g),_.src=P,_.alt=w,this.viewBox.appendChild(_),this.viewBoxImage=_,!!f){var I=f;typeof f=="string"?I=d.ownerDocument.querySelectorAll(f):f.querySelector&&(I=[f]),this.previews=I,Ce(I,function(X){var q=document.createElement("img");ii(X,C,{width:X.offsetWidth,height:X.offsetHeight,html:X.innerHTML}),g&&(q.crossOrigin=g),q.src=P,q.alt=w,q.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;"',X.innerHTML="",X.appendChild(q)})}},"initPreview"),resetPreview:o(function(){Ce(this.previews,function(d){var g=Qi(d,C);Ft(d,{width:g.width,height:g.height}),d.innerHTML=g.html,ri(d,C)})},"resetPreview"),preview:o(function(){var d=this.imageData,g=this.canvasData,f=this.cropBoxData,P=f.width,w=f.height,_=d.width,I=d.height,X=f.left-g.left-d.left,q=f.top-g.top-d.top;!this.cropped||this.disabled||(Ft(this.viewBoxImage,Ee({width:_,height:I},zr(Ee({translateX:-X,translateY:-q},d)))),Ce(this.previews,function(U){var D=Qi(U,C),W=D.width,de=D.height,ue=W,Re=de,ge=1;P&&(ge=W/P,Re=w*ge),w&&Re>de&&(ge=de/w,ue=P*ge,Re=de),Ft(U,{width:ue,height:Re}),Ft(U.getElementsByTagName("img")[0],Ee({width:_*ge,height:I*ge},zr(Ee({translateX:-X*ge,translateY:-q*ge},d))))}))},"preview")},ky={bind:o(function(){var d=this.element,g=this.options,f=this.cropper;st(g.cropstart)&&_t(d,ne,g.cropstart),st(g.cropmove)&&_t(d,pe,g.cropmove),st(g.cropend)&&_t(d,Se,g.cropend),st(g.crop)&&_t(d,Q,g.crop),st(g.zoom)&&_t(d,$t,g.zoom),_t(f,De,this.onCropStart=this.cropStart.bind(this)),g.zoomable&&g.zoomOnWheel&&_t(f,Yi,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),g.toggleDragModeOnDblclick&&_t(f,se,this.onDblclick=this.dblclick.bind(this)),_t(d.ownerDocument,te,this.onCropMove=this.cropMove.bind(this)),_t(d.ownerDocument,rt,this.onCropEnd=this.cropEnd.bind(this)),g.responsive&&_t(window,qt,this.onResize=this.resize.bind(this))},"bind"),unbind:o(function(){var d=this.element,g=this.options,f=this.cropper;st(g.cropstart)&&Ct(d,ne,g.cropstart),st(g.cropmove)&&Ct(d,pe,g.cropmove),st(g.cropend)&&Ct(d,Se,g.cropend),st(g.crop)&&Ct(d,Q,g.crop),st(g.zoom)&&Ct(d,$t,g.zoom),Ct(f,De,this.onCropStart),g.zoomable&&g.zoomOnWheel&&Ct(f,Yi,this.onWheel,{passive:!1,capture:!0}),g.toggleDragModeOnDblclick&&Ct(f,se,this.onDblclick),Ct(d.ownerDocument,te,this.onCropMove),Ct(d.ownerDocument,rt,this.onCropEnd),g.responsive&&Ct(window,qt,this.onResize)},"unbind")},Fy={resize:o(function(){if(!this.disabled){var d=this.options,g=this.container,f=this.containerData,P=g.offsetWidth/f.width,w=g.offsetHeight/f.height,_=Math.abs(P-1)>Math.abs(w-1)?P:w;if(_!==1){var I,X;d.restore&&(I=this.getCanvasData(),X=this.getCropBoxData()),this.render(),d.restore&&(this.setCanvasData(Ce(I,function(q,U){I[U]=q*_})),this.setCropBoxData(Ce(X,function(q,U){X[U]=q*_})))}}},"resize"),dblclick:o(function(){this.disabled||this.options.dragMode===Y||this.setDragMode(co(this.dragBox,F)?B:O)},"dblclick"),wheel:o(function(d){var g=this,f=Number(this.options.wheelZoomRatio)||.1,P=1;this.disabled||(d.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){g.wheeling=!1},50),d.deltaY?P=d.deltaY>0?1:-1:d.wheelDelta?P=-d.wheelDelta/120:d.detail&&(P=d.detail>0?1:-1),this.zoom(-P*f,d)))},"wheel"),cropStart:o(function(d){var g=d.buttons,f=d.button;if(!(this.disabled||(d.type==="mousedown"||d.type==="pointerdown"&&d.pointerType==="mouse")&&(ae(g)&&g!==1||ae(f)&&f!==0||d.ctrlKey))){var P=this.options,w=this.pointers,_;d.changedTouches?Ce(d.changedTouches,function(I){w[I.identifier]=po(I)}):w[d.pointerId||0]=po(d),Object.keys(w).length>1&&P.zoomable&&P.zoomOnTouch?_=J:_=Qi(d.target,N),wi.test(_)&&er(this.element,ne,{originalEvent:d,action:_})!==!1&&(d.preventDefault(),this.action=_,this.cropping=!1,_===$&&(this.cropping=!0,Le(this.dragBox,H)))}},"cropStart"),cropMove:o(function(d){var g=this.action;if(!(this.disabled||!g)){var f=this.pointers;d.preventDefault(),er(this.element,pe,{originalEvent:d,action:g})!==!1&&(d.changedTouches?Ce(d.changedTouches,function(P){Ee(f[P.identifier]||{},po(P,!0))}):Ee(f[d.pointerId||0]||{},po(d,!0)),this.change(d))}},"cropMove"),cropEnd:o(function(d){if(!this.disabled){var g=this.action,f=this.pointers;d.changedTouches?Ce(d.changedTouches,function(P){delete f[P.identifier]}):delete f[d.pointerId||0],g&&(d.preventDefault(),Object.keys(f).length||(this.action=""),this.cropping&&(this.cropping=!1,Vt(this.dragBox,H,this.cropped&&this.options.modal)),er(this.element,Se,{originalEvent:d,action:g}))}},"cropEnd")},Cy={change:o(function(d){var g=this.options,f=this.canvasData,P=this.containerData,w=this.cropBoxData,_=this.pointers,I=this.action,X=g.aspectRatio,q=w.left,U=w.top,D=w.width,W=w.height,de=q+D,ue=U+W,Re=0,ge=0,$e=P.width,Xe=P.height,ze=!0,Gt;!X&&d.shiftKey&&(X=D&&W?D/W:1),this.limited&&(Re=w.minLeft,ge=w.minTop,$e=Re+Math.min(P.width,f.width,f.left+f.width),Xe=ge+Math.min(P.height,f.height,f.top+f.height));var vt=_[Object.keys(_)[0]],K={x:vt.endX-vt.startX,y:vt.endY-vt.startY},ye=o(function(Et){switch(Et){case G:de+K.x>$e&&(K.x=$e-de);break;case Z:q+K.x<Re&&(K.x=Re-q);break;case oe:U+K.y<ge&&(K.y=ge-U);break;case ie:ue+K.y>Xe&&(K.y=Xe-ue);break}},"check");switch(I){case M:q+=K.x,U+=K.y;break;case G:if(K.x>=0&&(de>=$e||X&&(U<=ge||ue>=Xe))){ze=!1;break}ye(G),D+=K.x,D<0&&(I=Z,D=-D,q-=D),X&&(W=D/X,U+=(w.height-W)/2);break;case oe:if(K.y<=0&&(U<=ge||X&&(q<=Re||de>=$e))){ze=!1;break}ye(oe),W-=K.y,U+=K.y,W<0&&(I=ie,W=-W,U-=W),X&&(D=W*X,q+=(w.width-D)/2);break;case Z:if(K.x<=0&&(q<=Re||X&&(U<=ge||ue>=Xe))){ze=!1;break}ye(Z),D-=K.x,q+=K.x,D<0&&(I=G,D=-D,q-=D),X&&(W=D/X,U+=(w.height-W)/2);break;case ie:if(K.y>=0&&(ue>=Xe||X&&(q<=Re||de>=$e))){ze=!1;break}ye(ie),W+=K.y,W<0&&(I=oe,W=-W,U-=W),X&&(D=W*X,q+=(w.width-D)/2);break;case Ie:if(X){if(K.y<=0&&(U<=ge||de>=$e)){ze=!1;break}ye(oe),W-=K.y,U+=K.y,D=W*X}else ye(oe),ye(G),K.x>=0?de<$e?D+=K.x:K.y<=0&&U<=ge&&(ze=!1):D+=K.x,K.y<=0?U>ge&&(W-=K.y,U+=K.y):(W-=K.y,U+=K.y);D<0&&W<0?(I=Te,W=-W,D=-D,U-=W,q-=D):D<0?(I=be,D=-D,q-=D):W<0&&(I=me,W=-W,U-=W);break;case be:if(X){if(K.y<=0&&(U<=ge||q<=Re)){ze=!1;break}ye(oe),W-=K.y,U+=K.y,D=W*X,q+=w.width-D}else ye(oe),ye(Z),K.x<=0?q>Re?(D-=K.x,q+=K.x):K.y<=0&&U<=ge&&(ze=!1):(D-=K.x,q+=K.x),K.y<=0?U>ge&&(W-=K.y,U+=K.y):(W-=K.y,U+=K.y);D<0&&W<0?(I=me,W=-W,D=-D,U-=W,q-=D):D<0?(I=Ie,D=-D,q-=D):W<0&&(I=Te,W=-W,U-=W);break;case Te:if(X){if(K.x<=0&&(q<=Re||ue>=Xe)){ze=!1;break}ye(Z),D-=K.x,q+=K.x,W=D/X}else ye(ie),ye(Z),K.x<=0?q>Re?(D-=K.x,q+=K.x):K.y>=0&&ue>=Xe&&(ze=!1):(D-=K.x,q+=K.x),K.y>=0?ue<Xe&&(W+=K.y):W+=K.y;D<0&&W<0?(I=Ie,W=-W,D=-D,U-=W,q-=D):D<0?(I=me,D=-D,q-=D):W<0&&(I=be,W=-W,U-=W);break;case me:if(X){if(K.x>=0&&(de>=$e||ue>=Xe)){ze=!1;break}ye(G),D+=K.x,W=D/X}else ye(ie),ye(G),K.x>=0?de<$e?D+=K.x:K.y>=0&&ue>=Xe&&(ze=!1):D+=K.x,K.y>=0?ue<Xe&&(W+=K.y):W+=K.y;D<0&&W<0?(I=be,W=-W,D=-D,U-=W,q-=D):D<0?(I=Te,D=-D,q-=D):W<0&&(I=Ie,W=-W,U-=W);break;case L:this.move(K.x,K.y),ze=!1;break;case J:this.zoom(my(_),d),ze=!1;break;case $:if(!K.x||!K.y){ze=!1;break}Gt=dc(this.cropper),q=vt.startX-Gt.left,U=vt.startY-Gt.top,D=w.minWidth,W=w.minHeight,K.x>0?I=K.y>0?me:Ie:K.x<0&&(q-=D,I=K.y>0?Te:be),K.y<0&&(U-=W),this.cropped||(yt(this.cropBox,E),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}ze&&(w.width=D,w.height=W,w.left=q,w.top=U,this.action=I,this.renderCropBox()),Ce(_,function(Ve){Ve.startX=Ve.endX,Ve.startY=Ve.endY})},"change")},Ry={crop:o(function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Le(this.dragBox,H),yt(this.cropBox,E),this.setCropBoxData(this.initialCropBoxData)),this},"crop"),reset:o(function(){return this.ready&&!this.disabled&&(this.imageData=Ee({},this.initialImageData),this.canvasData=Ee({},this.initialCanvasData),this.cropBoxData=Ee({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},"reset"),clear:o(function(){return this.cropped&&!this.disabled&&(Ee(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),yt(this.dragBox,H),Le(this.cropBox,E)),this},"clear"),replace:o(function(d){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&d&&(this.isImg&&(this.element.src=d),g?(this.url=d,this.image.src=d,this.ready&&(this.viewBoxImage.src=d,Ce(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,yt(this.cropper,x)),this},"enable"),disable:o(function(){return this.ready&&!this.disabled&&(this.disabled=!0,Le(this.cropper,x)),this},"disable"),destroy:o(function(){var d=this.element;return d[T]?(d[T]=void 0,this.isImg&&this.replaced&&(d.src=this.originalUrl),this.uncreate(),this):this},"destroy"),move:o(function(d){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d,f=this.canvasData,P=f.left,w=f.top;return this.moveTo(Ji(d)?d:P+Number(d),Ji(g)?g:w+Number(g))},"move"),moveTo:o(function(d){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d,f=this.canvasData,P=!1;return d=Number(d),g=Number(g),this.ready&&!this.disabled&&this.options.movable&&(ae(d)&&(f.left=d,P=!0),ae(g)&&(f.top=g,P=!0),P&&this.renderCanvas(!0)),this},"moveTo"),zoom:o(function(d,g){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,g)},"zoom"),zoomTo:o(function(d,g,f){var P=this.options,w=this.canvasData,_=w.width,I=w.height,X=w.naturalWidth,q=w.naturalHeight;if(d=Number(d),d>=0&&this.ready&&!this.disabled&&P.zoomable){var U=X*d,D=q*d;if(er(this.element,$t,{ratio:d,oldRatio:_/X,originalEvent:f})===!1)return this;if(f){var W=this.pointers,de=dc(this.cropper),ue=W&&Object.keys(W).length?gy(W):{pageX:f.pageX,pageY:f.pageY};w.left-=(U-_)*((ue.pageX-de.left-w.left)/_),w.top-=(D-I)*((ue.pageY-de.top-w.top)/I)}else ti(g)&&ae(g.x)&&ae(g.y)?(w.left-=(U-_)*((g.x-w.left)/_),w.top-=(D-I)*((g.y-w.top)/I)):(w.left-=(U-_)/2,w.top-=(D-I)/2);w.width=U,w.height=D,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),ae(d)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=d%360,this.renderCanvas(!0,!0)),this},"rotateTo"),scaleX:o(function(d){var g=this.imageData.scaleY;return this.scale(d,ae(g)?g:1)},"scaleX"),scaleY:o(function(d){var g=this.imageData.scaleX;return this.scale(ae(g)?g:1,d)},"scaleY"),scale:o(function(d){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d,f=this.imageData,P=!1;return d=Number(d),g=Number(g),this.ready&&!this.disabled&&this.options.scalable&&(ae(d)&&(f.scaleX=d,P=!0),ae(g)&&(f.scaleY=g,P=!0),P&&this.renderCanvas(!0,!0)),this},"scale"),getData:o(function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,g=this.options,f=this.imageData,P=this.canvasData,w=this.cropBoxData,_;if(this.ready&&this.cropped){_={x:w.left-P.left,y:w.top-P.top,width:w.width,height:w.height};var I=f.width/f.naturalWidth;if(Ce(_,function(U,D){_[D]=U/I}),d){var X=Math.round(_.y+_.height),q=Math.round(_.x+_.width);_.x=Math.round(_.x),_.y=Math.round(_.y),_.width=q-_.x,_.height=X-_.y}}else _={x:0,y:0,width:0,height:0};return g.rotatable&&(_.rotate=f.rotate||0),g.scalable&&(_.scaleX=f.scaleX||1,_.scaleY=f.scaleY||1),_},"getData"),setData:o(function(d){var g=this.options,f=this.imageData,P=this.canvasData,w={};if(this.ready&&!this.disabled&&ti(d)){var _=!1;g.rotatable&&ae(d.rotate)&&d.rotate!==f.rotate&&(f.rotate=d.rotate,_=!0),g.scalable&&(ae(d.scaleX)&&d.scaleX!==f.scaleX&&(f.scaleX=d.scaleX,_=!0),ae(d.scaleY)&&d.scaleY!==f.scaleY&&(f.scaleY=d.scaleY,_=!0)),_&&this.renderCanvas(!0,!0);var I=f.width/f.naturalWidth;ae(d.x)&&(w.left=d.x*I+P.left),ae(d.y)&&(w.top=d.y*I+P.top),ae(d.width)&&(w.width=d.width*I),ae(d.height)&&(w.height=d.height*I),this.setCropBoxData(w)}return this},"setData"),getContainerData:o(function(){return this.ready?Ee({},this.containerData):{}},"getContainerData"),getImageData:o(function(){return this.sized?Ee({},this.imageData):{}},"getImageData"),getCanvasData:o(function(){var d=this.canvasData,g={};return this.ready&&Ce(["left","top","width","height","naturalWidth","naturalHeight"],function(f){g[f]=d[f]}),g},"getCanvasData"),setCanvasData:o(function(d){var g=this.canvasData,f=g.aspectRatio;return this.ready&&!this.disabled&&ti(d)&&(ae(d.left)&&(g.left=d.left),ae(d.top)&&(g.top=d.top),ae(d.width)?(g.width=d.width,g.height=d.width/f):ae(d.height)&&(g.height=d.height,g.width=d.height*f),this.renderCanvas(!0)),this},"setCanvasData"),getCropBoxData:o(function(){var d=this.cropBoxData,g;return this.ready&&this.cropped&&(g={left:d.left,top:d.top,width:d.width,height:d.height}),g||{}},"getCropBoxData"),setCropBoxData:o(function(d){var g=this.cropBoxData,f=this.options.aspectRatio,P,w;return this.ready&&this.cropped&&!this.disabled&&ti(d)&&(ae(d.left)&&(g.left=d.left),ae(d.top)&&(g.top=d.top),ae(d.width)&&d.width!==g.width&&(P=!0,g.width=d.width),ae(d.height)&&d.height!==g.height&&(w=!0,g.height=d.height),f&&(P?g.height=g.width/f:w&&(g.width=g.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 g=this.canvasData,f=vy(this.image,this.imageData,g,d);if(!this.cropped)return f;var P=this.getData(d.rounded),w=P.x,_=P.y,I=P.width,X=P.height,q=f.width/Math.floor(g.naturalWidth);q!==1&&(w*=q,_*=q,I*=q,X*=q);var U=I/X,D=oi({aspectRatio:U,width:d.maxWidth||1/0,height:d.maxHeight||1/0}),W=oi({aspectRatio:U,width:d.minWidth||0,height:d.minHeight||0},"cover"),de=oi({aspectRatio:U,width:d.width||(q!==1?f.width:I),height:d.height||(q!==1?f.height:X)}),ue=de.width,Re=de.height;ue=Math.min(D.width,Math.max(W.width,ue)),Re=Math.min(D.height,Math.max(W.height,Re));var ge=document.createElement("canvas"),$e=ge.getContext("2d");ge.width=Ot(ue),ge.height=Ot(Re),$e.fillStyle=d.fillColor||"transparent",$e.fillRect(0,0,ue,Re);var Xe=d.imageSmoothingEnabled,ze=Xe===void 0?!0:Xe,Gt=d.imageSmoothingQuality;$e.imageSmoothingEnabled=ze,Gt&&($e.imageSmoothingQuality=Gt);var vt=f.width,K=f.height,ye=w,Ve=_,Et,Xt,xi,_i,ni,Ut;ye<=-I||ye>vt?(ye=0,Et=0,xi=0,ni=0):ye<=0?(xi=-ye,ye=0,Et=Math.min(vt,I+ye),ni=Et):ye<=vt&&(xi=0,Et=Math.min(I,vt-ye),ni=Et),Et<=0||Ve<=-X||Ve>K?(Ve=0,Xt=0,_i=0,Ut=0):Ve<=0?(_i=-Ve,Ve=0,Xt=Math.min(K,X+Ve),Ut=Xt):Ve<=K&&(_i=0,Xt=Math.min(X,K-Ve),Ut=Xt);var ht=[ye,Ve,Et,Xt];if(ni>0&&Ut>0){var Ei=ue/I;ht.push(xi*Ei,_i*Ei,ni*Ei,Ut*Ei)}return $e.drawImage.apply($e,[f].concat(p(ht.map(function(ho){return Math.floor(Ot(ho))})))),ge},"getCroppedCanvas"),setAspectRatio:o(function(d){var g=this.options;return!this.disabled&&!Ji(d)&&(g.aspectRatio=Math.max(0,d)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},"setAspectRatio"),setDragMode:o(function(d){var g=this.options,f=this.dragBox,P=this.face;if(this.ready&&!this.disabled){var w=d===O,_=g.movable&&d===B;d=w||_?d:Y,g.dragMode=d,ii(f,N,d),Vt(f,F,w),Vt(f,ee,_),g.cropBoxMovable||(ii(P,N,d),Vt(P,F,w),Vt(P,ee,_))}return this},"setDragMode")},Ay=A.Cropper,gc=(function(){function v(d){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n(this,v),!d||!Ge.test(d.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=d,this.options=Ee({},Lr,ti(g)&&g),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return o(v,"Cropper"),l(v,[{key:"init",value:o(function(){var g=this.element,f=g.tagName.toLowerCase(),P;if(!g[T]){if(g[T]=this,f==="img"){if(this.isImg=!0,P=g.getAttribute("src")||"",this.originalUrl=P,!P)return;P=g.src}else f==="canvas"&&window.HTMLCanvasElement&&(P=g.toDataURL());this.load(P)}},"init")},{key:"load",value:o(function(g){var f=this;if(g){this.url=g,this.imageData={};var P=this.element,w=this.options;if(!w.rotatable&&!w.scalable&&(w.checkOrientation=!1),!w.checkOrientation||!window.ArrayBuffer){this.clone();return}if(Si.test(g)){ei.test(g)?this.read(Sy(g)):this.clone();return}var _=new XMLHttpRequest,I=this.clone.bind(this);this.reloading=!0,this.xhr=_,_.onabort=I,_.onerror=I,_.ontimeout=I,_.onprogress=function(){_.getResponseHeader("content-type")!==Zt&&_.abort()},_.onload=function(){f.read(_.response)},_.onloadend=function(){f.reloading=!1,f.xhr=null},w.checkCrossOrigin&&hc(g)&&P.crossOrigin&&(g=fc(g)),_.open("GET",g,!0),_.responseType="arraybuffer",_.withCredentials=P.crossOrigin==="use-credentials",_.send()}},"load")},{key:"read",value:o(function(g){var f=this.options,P=this.imageData,w=_y(g),_=0,I=1,X=1;if(w>1){this.url=xy(g,Zt);var q=Ey(w);_=q.rotate,I=q.scaleX,X=q.scaleY}f.rotatable&&(P.rotate=_),f.scalable&&(P.scaleX=I,P.scaleY=X),this.clone()},"read")},{key:"clone",value:o(function(){var g=this.element,f=this.url,P=g.crossOrigin,w=f;this.options.checkCrossOrigin&&hc(f)&&(P||(P="anonymous"),w=fc(f)),this.crossOrigin=P,this.crossOriginUrl=w;var _=document.createElement("img");P&&(_.crossOrigin=P),_.src=w||f,_.alt=g.alt||"The image to crop",this.image=_,_.onload=this.start.bind(this),_.onerror=this.stop.bind(this),Le(_,z),g.parentNode.insertBefore(_,g.nextSibling)},"clone")},{key:"start",value:o(function(){var g=this,f=this.image;f.onload=null,f.onerror=null,this.sizing=!0;var P=A.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(A.navigator.userAgent),w=o(function(q,U){Ee(g.imageData,{naturalWidth:q,naturalHeight:U,aspectRatio:q/U}),g.initialImageData=Ee({},g.imageData),g.sizing=!1,g.sized=!0,g.build()},"done");if(f.naturalWidth&&!P){w(f.naturalWidth,f.naturalHeight);return}var _=document.createElement("img"),I=document.body||document.documentElement;this.sizingImage=_,_.onload=function(){w(_.width,_.height),P||I.removeChild(_)},_.src=f.src,P||(_.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;",I.appendChild(_))},"start")},{key:"stop",value:o(function(){var g=this.image;g.onload=null,g.onerror=null,g.parentNode.removeChild(g),this.image=null},"stop")},{key:"build",value:o(function(){if(!(!this.sized||this.ready)){var g=this.element,f=this.options,P=this.image,w=g.parentNode,_=document.createElement("div");_.innerHTML=oo;var I=_.querySelector(".".concat(T,"-container")),X=I.querySelector(".".concat(T,"-canvas")),q=I.querySelector(".".concat(T,"-drag-box")),U=I.querySelector(".".concat(T,"-crop-box")),D=U.querySelector(".".concat(T,"-face"));this.container=w,this.cropper=I,this.canvas=X,this.dragBox=q,this.cropBox=U,this.viewBox=I.querySelector(".".concat(T,"-view-box")),this.face=D,X.appendChild(P),Le(g,E),w.insertBefore(I,g.nextSibling),yt(P,z),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,Le(U,E),f.guides||Le(U.getElementsByClassName("".concat(T,"-dashed")),E),f.center||Le(U.getElementsByClassName("".concat(T,"-center")),E),f.background&&Le(I,"".concat(T,"-bg")),f.highlight||Le(D,V),f.cropBoxMovable&&(Le(D,ee),ii(D,N,M)),f.cropBoxResizable||(Le(U.getElementsByClassName("".concat(T,"-line")),E),Le(U.getElementsByClassName("".concat(T,"-point")),E)),this.render(),this.ready=!0,this.setDragMode(f.dragMode),f.autoCrop&&this.crop(),this.setData(f.data),st(f.ready)&&_t(g,je,f.ready,{once:!0}),er(g,je)}},"build")},{key:"unbuild",value:o(function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var g=this.cropper.parentNode;g&&g.removeChild(this.cropper),yt(this.element,E)}},"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=Ay,v},"noConflict")},{key:"setDefaults",value:o(function(g){Ee(Lr,ti(g)&&g)},"setDefaults")}])})();return Ee(gc.prototype,Py,Ty,ky,Fy,Cy,Ry),gc}))});var eg=Pe((RN,Zm)=>{"use strict";Zm.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 rg=Pe(Cu=>{"use strict";var PS=Object.prototype.hasOwnProperty,TS;function tg(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return null}}o(tg,"decode");function ig(i){try{return encodeURIComponent(i)}catch{return null}}o(ig,"encode");function kS(i){for(var e=/([^=?#&]+)=?([^&]*)/g,t={},r;r=e.exec(i);){var s=tg(r[1]),n=tg(r[2]);s===null||n===null||s in t||(t[s]=n)}return t}o(kS,"querystring");function FS(i,e){e=e||"";var t=[],r,s;typeof e!="string"&&(e="?");for(s in i)if(PS.call(i,s)){if(r=i[s],!r&&(r===null||r===TS||isNaN(r))&&(r=""),s=ig(s),r=ig(r),s===null||r===null)continue;t.push(s+"="+r)}return t.length?e+t.join("&"):""}o(FS,"querystringify");Cu.stringify=FS;Cu.parse=kS});var pg=Pe((UN,cg)=>{"use strict";var og=eg(),Nn=rg(),CS=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,ng=/[\n\r\t]/g,RS=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,ag=/:\d+$/,AS=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,IS=/^[a-zA-Z]:/;function Au(i){return(i||"").toString().replace(CS,"")}o(Au,"trimLeft");var Ru=[["#","hash"],["?","query"],o(function(e,t){return zt(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]],sg={hash:1,query:1};function lg(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 Ht(unescape(i.pathname),{});else if(s==="string"){r=new Ht(i,{});for(n in sg)delete r[n]}else if(s==="object"){for(n in i)n in sg||(r[n]=i[n]);r.slashes===void 0&&(r.slashes=RS.test(i.href))}return r}o(lg,"lolcation");function zt(i){return i==="file:"||i==="ftp:"||i==="http:"||i==="https:"||i==="ws:"||i==="wss:"}o(zt,"isSpecial");function ug(i,e){i=Au(i),i=i.replace(ng,""),e=e||{};var t=AS.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)):zt(r)?l=t[4]:r?s&&(l=l.slice(2)):a>=2&&zt(e.protocol)&&(l=t[4]),{protocol:r,slashes:s||zt(r),slashesCount:a,rest:l}}o(ug,"extractProtocol");function OS(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(OS,"resolve");function Ht(i,e,t){if(i=Au(i),i=i.replace(ng,""),!(this instanceof Ht))return new Ht(i,e,t);var r,s,n,a,l,c,p=Ru.slice(),h=typeof e,m=this,y=0;for(h!=="object"&&h!=="string"&&(t=e,e=null),t&&typeof t!="function"&&(t=Nn.parse),e=lg(e),s=ug(i||"",e),r=!s.protocol&&!s.slashes,m.slashes=s.slashes||r&&e.slashes,m.protocol=s.protocol||e.protocol||"",i=s.rest,(s.protocol==="file:"&&(s.slashesCount!==2||IS.test(i))||!s.slashes&&(s.protocol||s.slashesCount<2||!zt(m.protocol)))&&(p[3]=[/(.*)/,"pathname"]);y<p.length;y++){if(a=p[y],typeof a=="function"){i=a(i,m);continue}n=a[0],c=a[1],n!==n?m[c]=i:typeof n=="string"?(l=n==="@"?i.lastIndexOf(n):i.indexOf(n),~l&&(typeof a[2]=="number"?(m[c]=i.slice(0,l),i=i.slice(l+a[2])):(m[c]=i.slice(l),i=i.slice(0,l)))):(l=n.exec(i))&&(m[c]=l[1],i=i.slice(0,l.index)),m[c]=m[c]||r&&a[3]&&e[c]||"",a[4]&&(m[c]=m[c].toLowerCase())}t&&(m.query=t(m.query)),r&&e.slashes&&m.pathname.charAt(0)!=="/"&&(m.pathname!==""||e.pathname!=="")&&(m.pathname=OS(m.pathname,e.pathname)),m.pathname.charAt(0)!=="/"&&zt(m.protocol)&&(m.pathname="/"+m.pathname),og(m.port,m.protocol)||(m.host=m.hostname,m.port=""),m.username=m.password="",m.auth&&(l=m.auth.indexOf(":"),~l?(m.username=m.auth.slice(0,l),m.username=encodeURIComponent(decodeURIComponent(m.username)),m.password=m.auth.slice(l+1),m.password=encodeURIComponent(decodeURIComponent(m.password))):m.username=encodeURIComponent(decodeURIComponent(m.auth)),m.auth=m.password?m.username+":"+m.password:m.username),m.origin=m.protocol!=="file:"&&zt(m.protocol)&&m.host?m.protocol+"//"+m.host:"null",m.href=m.toString()}o(Ht,"Url");function US(i,e,t){var r=this;switch(i){case"query":typeof e=="string"&&e.length&&(e=(t||Nn.parse)(e)),r[i]=e;break;case"port":r[i]=e,og(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,ag.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<Ru.length;a++){var l=Ru[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:"&&zt(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r}o(US,"set");function DS(i){(!i||typeof i!="function")&&(i=Nn.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||zt(t.protocol)?"//":"");return t.username?(n+=t.username,t.password&&(n+=":"+t.password),n+="@"):t.password?(n+=":"+t.password,n+="@"):t.protocol!=="file:"&&zt(t.protocol)&&!r&&t.pathname!=="/"&&(n+="@"),(r[r.length-1]===":"||ag.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(DS,"toString");Ht.prototype={set:US,toString:DS};Ht.extractProtocol=ug;Ht.location=lg;Ht.trimLeft=Au;Ht.qs=Nn;cg.exports=Ht});var Gu=Pe((L7,Wu)=>{function it(i){if(i)return Ox(i);this._callbacks=new Map}o(it,"Emitter");function Ox(i){return Object.assign(i,it.prototype),i._callbacks=new Map,i}o(Ox,"mixin");it.prototype.on=function(i,e){let t=this._callbacks.get(i)??[];return t.push(e),this._callbacks.set(i,t),this};it.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};it.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};it.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};it.prototype.listeners=function(i){return this._callbacks.get(i)??[]};it.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};it.prototype.hasListeners=function(i){return this.listenerCount(i)>0};it.prototype.addEventListener=it.prototype.on;it.prototype.removeListener=it.prototype.off;it.prototype.removeEventListener=it.prototype.off;it.prototype.removeAllListeners=it.prototype.off;typeof Wu<"u"&&(Wu.exports=it)});var iy=Pe((aM,Wn)=>{"use strict";Wn.exports=tc;Wn.exports.isMobile=tc;Wn.exports.default=tc;var zx=/(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,Hx=/CrOS/,qx=/android|ipad|playbook|silk/i;function tc(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=zx.test(e)&&!Hx.test(e)||!!i.tablet&&qx.test(e);return!t&&i.tablet&&i.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.indexOf("Macintosh")!==-1&&e.indexOf("Safari")!==-1&&(t=!0),t}o(tc,"isMobile")});function mo(i,e,t){return new Promise(r=>{i.toBlob(r,e,t)})}o(mo,"canvasToBlob");var jy=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function zy(i,e,t){let r=jy.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(zy,"dataURItoBlob");var ea=zy;var ta=class extends Error{static{o(this,"ErrorWithCause")}isNetworkError;constructor(e,t){super(e),this.cause=t?.cause,this.cause&&Object.hasOwn(this.cause,"isNetworkError")?this.isNetworkError=this.cause.isNetworkError:this.isNetworkError=!1}},Kt=ta;function ai(i,e,t,r){return t===0||i===e?i:r===0?e:i+(e-i)*2**(-r/t)}o(ai,"emaFilter");var Hr=['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 ia=class extends Error{static{o(this,"NetworkError")}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}},Pt=ia;var ra=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)}},Sc=ra;function sa(i){return i instanceof Error||typeof i=="object"&&i!=null&&"message"in i&&typeof i.message=="string"}o(sa,"isErrorLike");function Ne(i){return sa(i)?i:new Error(String(i))}o(Ne,"toError");var go=o(()=>{},"noop");function Hy(i){let e=new Map;for(let[t,r]of Object.entries(i))e.set(t.toLowerCase(),[t,r]);return e.values()}o(Hy,"dedupeHeaders");function qr(i,e={}){let{body:t=null,headers:r={},method:s="GET",onBeforeRequest:n=go,onUploadProgress:a=go,shouldRetry:l=o(()=>!0,"shouldRetry"),onAfterResponse:c=go,onTimeout:p=go,responseType:h,retries:m=3,signal:y=null,timeout:S=3e4,withCredentials:b=!1}=e,k=o(R=>.3*2**(R-1)*1e3,"delay"),A=new Sc(S,p);function j(R=0){return new Promise(async(T,M)=>{let $=new XMLHttpRequest,L=o(G=>{l($)&&R<m?setTimeout(()=>{j(R+1).then(T,M)},k(R)):(A.done(),M(G))},"onError");$.open(s,i,!0),$.withCredentials=b,h&&($.responseType=h),$.onload=async()=>{try{await c($,R)}catch(G){L(Object.assign(Ne(G),{request:$}));return}$.status>=200&&$.status<300?(A.done(),T($)):l($)&&R<m?setTimeout(()=>{j(R+1).then(T,M)},k(R)):(A.done(),M(new Pt($.statusText,$)))},$.onerror=()=>L(new Pt($.statusText,$)),$.upload.onprogress=G=>{A.progress(),a(G)};for(let[G,Z]of Hy(r))$.setRequestHeader(G,Z);function J(){$.abort(),M(new DOMException("Aborted","AbortError"))}if(o(J,"abort"),y?.addEventListener("abort",J),y?.aborted){J();return}await n($,R),$.send(t)})}return o(j,"requestWithRetry"),j()}o(qr,"fetcher");function li(...i){return fetch(...i).catch(e=>{throw e.name==="AbortError"?e:new Pt(e)})}o(li,"fetchWithNetworkError");var qy=o(i=>"error"in i&&!!i.error,"hasError"),$y=o(i=>i.progress.uploadComplete,"isCompleted");function Pi(i){return i.filter(e=>!qy(e)&&!$y(e))}o(Pi,"filterFilesToUpload");function Ti(i){return i.filter(e=>!e.progress?.uploadStarted||!e.isRestored)}o(Ti,"filterFilesToEmitUploadStarted");function $r(i){return typeof i!="object"||i===null||!("nodeType"in i)?!1:i.nodeType===Node.ELEMENT_NODE}o($r,"isDOMElement");function Vy(i){if(typeof i=="string"){let e=document.querySelectorAll(i);return e.length===0?null:Array.from(e)}return typeof i=="object"&&$r(i)?[i]:null}o(Vy,"findAllDOMElements");var yo=Vy;function Wy(i,e=document){return typeof i=="string"?e.querySelector(i):$r(i)?i:null}o(Wy,"findDOMElement");var Vr=Wy;function Rt(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(Rt,"getFileNameAndExtension");var tr={__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 ir(i){if(i.type)return i.type;let e=i.name?Rt(i.name).extension?.toLowerCase():null;return e&&e in tr?tr[e]:"application/octet-stream"}o(ir,"getFileType");function Gy(i){return i.charCodeAt(0).toString(32)}o(Gy,"encodeCharacter");function xc(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${Gy(t)}`,"/"))+e}o(xc,"encodeFilename");function oa(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${xc(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${xc(i.meta.relativePath.toLowerCase())}`),i.data?.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}o(oa,"generateFileID");function Xy(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}o(Xy,"hasFileStableId");function Wr(i,e){if(Xy(i))return i.id;let t=ir(i);return oa({...i,type:t},e)}o(Wr,"getSafeFileId");function Yt(i,e){return i===!0?Object.keys(e):Array.isArray(i)?i:[]}o(Yt,"getAllowedMetaFields");var We=Array.from;function na(i){let e=We(i.files);return Promise.resolve(e)}o(na,"fallbackApi");function vo(i,e,t,{onSuccess:r}){i.readEntries(s=>{let n=[...e,...s];s.length?queueMicrotask(()=>{vo(i,n,t,{onSuccess:r})}):r(n)},s=>{t(s),r(e)})}o(vo,"getFilesAndDirectoriesFromDirectory");function _c(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=>{vo(t,[],e,{onSuccess:o(n=>s(n.map(a=>_c(a,e))),"onSuccess")})})},isSameEntry:void 0}}o(_c,"getAsFileSystemHandleFromEntry");async function*Ec(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*Ec(s,e?r():i.name);else t!=null&&(yield t)}o(Ec,"createPromiseToAddFileOrParseDirectory");async function*aa(i,e){let t=await Promise.all(Array.from(i.items,async r=>{let s;return s??=_c(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*Ec(s,"",r)}catch(n){r!=null?yield r:e(n)}else r!=null&&(yield r)}o(aa,"getFilesFromDataTransfer");async function ui(i,e){let t=e?.logDropError??Function.prototype;try{let r=[];for await(let s of aa(i,t))r.push(s);return r}catch{return na(i)}}o(ui,"getDroppedFiles");function ot(i){return sa(i)?i.message:String(i)}o(ot,"getErrorMessage");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 Tt(i){return[i]=i.split(";",1),Ky[i]||null}o(Tt,"getFileTypeExtension");function rr(i){let t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?([^\n]+)/i.exec(i)?.[1];return`${/^http:\/\//i.test(i)?"ws":"wss"}://${t}`}o(rr,"getSocketHost");function Yy(i){for(;i&&!i.dir;)i=i.parentNode;return i?.dir}o(Yy,"getTextDirection");var Gr=Yy;function la(i){return i<10?`0${i}`:i.toString()}o(la,"pad");function ki(){let i=new Date,e=la(i.getHours()),t=la(i.getMinutes()),r=la(i.getSeconds());return`${e}:${t}:${r}`}o(ki,"getTimeStamp");function bt(i){return typeof i=="object"&&i!=null&&"name"in i&&i.name==="AbortError"}o(bt,"isAbortError");function sr(){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(sr,"isDragDropSupported");function Jy(i){return i?i.readyState===4&&i.status===0:!1}o(Jy,"isNetworkError");var Xr=Jy;function Kr(i){return i.startsWith("blob:")}o(Kr,"isObjectURL");function Yr(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}o(Yr,"isPreviewSupported");function nt(i){return i instanceof Error&&"isRestriction"in i&&i.isRestriction===!0}o(nt,"isRestrictionError");function ua(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(ua,"secondsToTime");function or(i){let e=ua(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(or,"prettyETA");function Qy(i){return new Error("Cancelled",{cause:i})}o(Qy,"createCancelError");function Pc(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(Pc,"abortOn");var Jt=class{static{o(this,"RateLimitedQueue")}#e=0;#t=[];#i=!1;#r;#s=1;#o;#a;limit;constructor(e){typeof e!="number"||e===0?this.limit=1/0:this.limit=e}#n(e){this.#e+=1;let t=!1,r;try{r=e()}catch(s){throw this.#e-=1,s}return{abort:o(s=>{t||(t=!0,this.#e-=1,r?.(s),this.#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.#n(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.#n(e):this.#c(e,t)}wrapSyncFunction(e,t){return(...r)=>{let s=this.run(()=>(e(...r),queueMicrotask(()=>s.done()),()=>{}),t);return{abortOn:Pc,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=Qy(h)}},t)});return n.abort=a=>{s.abort(a)},n.abortOn=Pc,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.#a),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(this.#o=this.limit-1,this.limit=this.#s,this.#a=setTimeout(this.#d,e))}#d=o(()=>{if(this.#i){this.#a=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.#a=setTimeout(this.#d,2e3):this.#s=Math.floor(this.#s/2)},"#increaseLimit");get isPaused(){return this.#i}};function nr(i){return{...i,type:i.mimeType,extension:i.name?Rt(i.name).extension:null}}o(nr,"remoteFileObjToLocal");var Fi=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 Zy(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(Zy,"insertReplacement");function Tc(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=Zy(s,new RegExp(`%\\{${n}\\}`,"g"),a)}return s}o(Tc,"interpolate");var ev=o(i=>{throw new Error(`missing string: ${i}`)},"defaultOnMissingKey"),ci=class{static{o(this,"Translator")}locale;constructor(e,{onMissingKey:t=ev}={}){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 Tc(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 Tc(r,t)}};function Jr(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(Jr,"truncateString");var ca=class extends Error{static{o(this,"UserFacingApiError")}name="UserFacingApiError";code;constructor(e,t){super(e),this.code=t}},bo=ca;var es,re,Ac,tv,pi,kc,Ic,Oc,pa,So,Qr,Uc,fa,da,ha,iv,xo={},_o=[],rv=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ts=Array.isArray;function Dt(i,e){for(var t in e)i[t]=e[t];return i}o(Dt,"m");function ma(i){i&&i.parentNode&&i.parentNode.removeChild(i)}o(ma,"b");function Qt(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?es.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 Zr(i,a,r,s,null)}o(Qt,"k");function Zr(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??++Ac,__i:-1,__u:0};return s==null&&re.vnode!=null&&re.vnode(n),n}o(Zr,"x");function Po(){return{current:null}}o(Po,"M");function fe(i){return i.children}o(fe,"S");function he(i,e){this.props=i,this.context=e}o(he,"C");function ar(i,e){if(e==null)return i.__?ar(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"?ar(i):null}o(ar,"$");function sv(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,r=[],s=[],n=Dt({},e);n.__v=e.__v+1,re.vnode&&re.vnode(n),ga(i.__P,n,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,r,t??ar(e),!!(32&e.__u),s),n.__v=e.__v,n.__.__k[n.__i]=n,Bc(r,n,s),e.__e=e.__=null,n.__e!=t&&Dc(n)}}o(sv,"I");function Dc(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}),Dc(i)}o(Dc,"P");function Fc(i){(!i.__d&&(i.__d=!0)&&pi.push(i)&&!Eo.__r++||kc!=re.debounceRendering)&&((kc=re.debounceRendering)||Ic)(Eo)}o(Fc,"A");function Eo(){try{for(var i,e=1;pi.length;)pi.length>e&&pi.sort(Oc),i=pi.shift(),e=pi.length,sv(i)}finally{pi.length=Eo.__r=0}}o(Eo,"H");function Nc(i,e,t,r,s,n,a,l,c,p,h){var m,y,S,b,k,A,j,R=r&&r.__k||_o,T=e.length;for(c=ov(t,e,R,c,T),m=0;m<T;m++)(S=t.__k[m])!=null&&(y=S.__i!=-1&&R[S.__i]||xo,S.__i=m,A=ga(i,S,y,s,n,a,l,c,p,h),b=S.__e,S.ref&&y.ref!=S.ref&&(y.ref&&ya(y.ref,null,S),h.push(S.ref,S.__c||b,S)),k==null&&b!=null&&(k=b),(j=!!(4&S.__u))||y.__k===S.__k?(c=Mc(S,c,i,j),j&&y.__e&&(y.__e=null)):typeof S.type=="function"&&A!==void 0?c=A:b&&(c=b.nextSibling),S.__u&=-7);return t.__e=k,c}o(Nc,"L");function ov(i,e,t,r,s){var n,a,l,c,p,h=t.length,m=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]=Zr(null,a,null,null,null):ts(a)?a=i.__k[n]=Zr(fe,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=i.__k[n]=Zr(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=nv(a,t,c,m))!=-1&&(m--,(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(m)for(n=0;n<h;n++)(l=t[n])!=null&&(2&l.__u)==0&&(l.__e==r&&(r=ar(l)),zc(l,l));return r}o(ov,"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=ar(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 ft(i,e){return e=e||[],i==null||typeof i=="boolean"||(ts(i)?i.some(function(t){ft(t,e)}):e.push(i)),e}o(ft,"F");function nv(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(nv,"O");function Cc(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||rv.test(e)?t:t+"px"}o(Cc,"z");function wo(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||Cc(i.style,e,"");if(t)for(e in t)r&&t[e]==r[e]||Cc(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(Uc,"$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[Qr]=r[Qr]:(t[Qr]=fa,i.addEventListener(e,n?ha:da,n)):i.removeEventListener(e,n?ha:da,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(wo,"N");function Rc(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[So]==null)e[So]=fa++;else if(e[So]<t[Qr])return;return t(re.event?re.event(e):e)}}}o(Rc,"V");function ga(i,e,t,r,s,n,a,l,c,p){var h,m,y,S,b,k,A,j,R,T,M,$,L,J,G,Z,ie=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),n=[l=e.__e=t.__e]),(h=re.__b)&&h(e);e:if(typeof ie=="function"){m=a.length;try{if(R=e.props,T=ie.prototype&&ie.prototype.render,M=(h=ie.contextType)&&r[h.__c],$=h?M?M.props.value:h.__:r,t.__c?j=(y=e.__c=t.__c).__=y.__E:(T?e.__c=y=new ie(R,$):(e.__c=y=new he(R,$),y.constructor=ie,y.render=lv),M&&M.sub(y),y.state||(y.state={}),y.__n=r,S=y.__d=!0,y.__h=[],y._sb=[]),T&&y.__s==null&&(y.__s=y.state),T&&ie.getDerivedStateFromProps!=null&&(y.__s==y.state&&(y.__s=Dt({},y.__s)),Dt(y.__s,ie.getDerivedStateFromProps(R,y.__s))),b=y.props,k=y.state,y.__v=e,S)T&&ie.getDerivedStateFromProps==null&&y.componentWillMount!=null&&y.componentWillMount(),T&&y.componentDidMount!=null&&y.__h.push(y.componentDidMount);else{if(T&&ie.getDerivedStateFromProps==null&&R!==b&&y.componentWillReceiveProps!=null&&y.componentWillReceiveProps(R,$),e.__v==t.__v||!y.__e&&y.shouldComponentUpdate!=null&&y.shouldComponentUpdate(R,y.__s,$)===!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(oe){oe&&(oe.__=e)}),_o.push.apply(y.__h,y._sb),y._sb=[],y.__h.length&&a.push(y);break e}y.componentWillUpdate!=null&&y.componentWillUpdate(R,y.__s,$),T&&y.componentDidUpdate!=null&&y.__h.push(function(){y.componentDidUpdate(b,k,A)})}if(y.context=$,y.props=R,y.__P=i,y.__e=!1,L=re.__r,J=0,T)y.state=y.__s,y.__d=!1,L&&L(e),h=y.render(y.props,y.state,y.context),_o.push.apply(y.__h,y._sb),y._sb=[];else do y.__d=!1,L&&L(e),h=y.render(y.props,y.state,y.context),y.state=y.__s;while(y.__d&&++J<25);y.state=y.__s,y.getChildContext!=null&&(r=Dt(Dt({},r),y.getChildContext())),T&&!S&&y.getSnapshotBeforeUpdate!=null&&(A=y.getSnapshotBeforeUpdate(b,k)),G=h!=null&&h.type===fe&&h.key==null?jc(h.props.children):h,l=Nc(i,ts(G)?G:[G],e,t,r,s,n,a,l,c,p),y.base=e.__e,e.__u&=-161,y.__h.length&&a.push(y),j&&(y.__E=y.__=null)}catch(oe){if(a.length=m,e.__v=null,c||n!=null){if(oe.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(Z=n.length;Z--;)ma(n[Z])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),oe.then||Lc(e),re.__e(oe,e,t)}}else n==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):l=e.__e=av(t.__e,e,t,r,s,n,a,c,p);return(h=re.diffed)&&h(e),128&e.__u?void 0:l}o(ga,"q");function Lc(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(Lc))}o(Lc,"B");function Bc(i,e,t){for(var r=0;r<t.length;r++)ya(t[r],t[++r],t[++r]);re.__c&&re.__c(e,i),i.some(function(s){try{i=s.__h,s.__h=[],i.some(function(n){n.call(s)})}catch(n){re.__e(n,s.__v)}})}o(Bc,"D");function jc(i){return typeof i!="object"||i==null||i.__b>0?i:ts(i)?i.map(jc):i.constructor!==void 0?null:Dt({},i)}o(jc,"E");function av(i,e,t,r,s,n,a,l,c){var p,h,m,y,S,b,k,A=t.props||xo,j=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(j);i=document.createElementNS(s,R,j.is&&j),l&&(re.__m&&re.__m(e,n),l=!1),n=null}if(R==null)A===j||l&&i.data==j||(i.data=j);else{if(n=R=="textarea"&&j.defaultValue!=null?null:n&&es.call(i.childNodes),!l&&n!=null)for(A={},p=0;p<i.attributes.length;p++)A[(S=i.attributes[p]).name]=S.value;for(p in A)S=A[p],p=="dangerouslySetInnerHTML"?m=S:p=="children"||p in j||p=="value"&&"defaultValue"in j||p=="checked"&&"defaultChecked"in j||wo(i,p,null,S,s);for(p in j)S=j[p],p=="children"?y=S:p=="dangerouslySetInnerHTML"?h=S:p=="value"?b=S:p=="checked"?k=S:l&&typeof S!="function"||A[p]===S||wo(i,p,S,A[p],s);if(h)l||m&&(h.__html==m.__html||h.__html==i.innerHTML)||(i.innerHTML=h.__html),e.__k=[];else if(m&&(i.innerHTML=""),Nc(e.type=="template"?i.content:i,ts(y)?y:[y],e,t,r,R=="foreignObject"?"http://www.w3.org/1999/xhtml":s,n,a,n?n[0]:t.__k&&ar(t,0),l,c),n!=null)for(p=n.length;p--;)ma(n[p]);l&&R!="textarea"||(p="value",R=="progress"&&b==null?i.removeAttribute("value"):b!=null&&(b!==i[p]||R=="progress"&&!b||R=="option"&&b!=A[p])&&wo(i,p,b,A[p],s),p="checked",k!=null&&k!=i[p]&&wo(i,p,k,A[p],s))}return i}o(av,"G");function ya(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){re.__e(s,t)}}o(ya,"J");function zc(i,e,t){var r,s;if(re.unmount&&re.unmount(i),(r=i.ref)&&(r.current&&r.current!=i.__e||ya(r,null,e)),(r=i.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(n){re.__e(n,e)}r.base=r.__P=r.__n=null}if(r=i.__k)for(s=0;s<r.length;s++)r[s]&&zc(r[s],e,t||typeof i.type!="function");t||ma(i.__e),i.__c=i.__=i.__e=void 0}o(zc,"K");function lv(i,e,t){return this.constructor(i,t)}o(lv,"Q");function To(i,e,t){var r,s,n,a;e==document&&(e=document.documentElement),re.__&&re.__(i,e),s=(r=typeof t=="function")?null:t&&t.__k||e.__k,n=[],a=[],ga(e,i=(!r&&t||e).__k=Qt(fe,null,[i]),s||xo,xo,e.namespaceURI,!r&&t?[t]:s?null:e.firstChild?es.call(e.childNodes):null,n,!r&&t?t:s?s.__e:e.firstChild,r,a),Bc(n,i,a),i.props.children=null}o(To,"R");function is(i,e,t){var r,s,n,a,l=Dt({},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?es.call(arguments,2):t),Zr(i.type,l,r||i.key,s||i.ref,null)}o(is,"W");es=_o.slice,re={__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")},Ac=0,tv=o(function(i){return i!=null&&i.constructor===void 0},"t"),he.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Dt({},this.state),typeof i=="function"&&(i=i(Dt({},t),this.props)),i&&Dt(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),Fc(this))},he.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),Fc(this))},he.prototype.render=fe,pi=[],Ic=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Oc=o(function(i,e){return i.__v.__b-e.__v.__b},"e"),Eo.__r=0,pa=Math.random().toString(8),So="__d"+pa,Qr="__a"+pa,Uc=/(PointerCapture)$|Capture$/i,fa=0,da=Rc(!1),ha=Rc(!0),iv=0;var uv=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:--uv,__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 re.vnode&&re.vnode(p),p}o(u,"u");var Ci,Oe,va,Hc,rs=0,Yc=[],Be=re,qc=Be.__b,$c=Be.__r,Vc=Be.diffed,Wc=Be.__c,Gc=Be.unmount,Xc=Be.__;function ss(i,e){Be.__h&&Be.__h(Oe,i,rs||e),rs=0;var t=Oe.__H||(Oe.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}o(ss,"s");function Ae(i){return rs=1,Jc(Qc,i)}o(Ae,"d");function Jc(i,e,t){var r=ss(Ci++,2);if(r.t=i,!r.__c&&(r.__=[t?t(e):Qc(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=Oe,!Oe.__f)){var s=o(function(l,c,p){if(!r.__c.__H)return!0;var h=!1,m=r.__c.props!==l;if(r.__c.__H.__.some(function(S){if(S.__N){h=!0;var b=S.__[0];S.__=S.__N,S.__N=void 0,b!==S.__[0]&&(m=!0)}}),n){var y=n.call(this,l,c,p);return h?y||m:y}return!h||m},"f");Oe.__f=!0;var n=Oe.shouldComponentUpdate,a=Oe.componentWillUpdate;Oe.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)},Oe.shouldComponentUpdate=s}return r.__N||r.__}o(Jc,"y");function xe(i,e){var t=ss(Ci++,3);!Be.__s&&wa(t.__H,e)&&(t.__=i,t.u=e,Oe.__H.__h.push(t))}o(xe,"h");function Fo(i,e){var t=ss(Ci++,4);!Be.__s&&wa(t.__H,e)&&(t.__=i,t.u=e,Oe.__h.push(t))}o(Fo,"_");function we(i){return rs=5,At(function(){return{current:i}},[])}o(we,"A");function At(i,e){var t=ss(Ci++,7);return wa(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}o(At,"T");function Qe(i,e){return rs=8,At(function(){return i},e)}o(Qe,"q");function os(){var i=ss(Ci++,11);if(!i.__){for(var e=Oe.__v;e!==null&&!e.__m&&e.__!==null;)e=e.__;var t=e.__m||(e.__m=[0,0]);i.__="P"+t[0]+"-"+t[1]++}return i.__}o(os,"g");function cv(){for(var i;i=Yc.shift();){var e=i.__H;if(i.__P&&e)try{e.__h.some(ko),e.__h.some(ba),e.__h=[]}catch(t){e.__h=[],Be.__e(t,i.__v)}}}o(cv,"j");Be.__b=function(i){Oe=null,qc&&qc(i)},Be.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),Xc&&Xc(i,e)},Be.__r=function(i){$c&&$c(i),Ci=0;var e=(Oe=i.__c).__H;e&&(va===Oe?(e.__h=[],Oe.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.some(ko),e.__h.some(ba),e.__h=[],Ci=0)),va=Oe},Be.diffed=function(i){Vc&&Vc(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(Yc.push(e)!==1&&Hc===Be.requestAnimationFrame||((Hc=Be.requestAnimationFrame)||pv)(cv)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),va=Oe=null},Be.__c=function(i,e){e.some(function(t){try{t.__h.some(ko),t.__h=t.__h.filter(function(r){return!r.__||ba(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],Be.__e(r,t.__v)}}),Wc&&Wc(i,e)},Be.unmount=function(i){Gc&&Gc(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.some(function(r){try{ko(r)}catch(s){e=s}}),t.__H=void 0,e&&Be.__e(e,t.__v))};var Kc=typeof requestAnimationFrame=="function";function pv(i){var e,t=o(function(){clearTimeout(r),Kc&&cancelAnimationFrame(e),setTimeout(i)},"r"),r=setTimeout(t,35);Kc&&(e=requestAnimationFrame(t))}o(pv,"w");function ko(i){var e=Oe,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),Oe=e}o(ko,"z");function ba(i){var e=Oe;i.__c=i.__(),Oe=e}o(ba,"B");function wa(i,e){return!i||i.length!==e.length||e.some(function(t,r){return t!==i[r]})}o(wa,"C");function Qc(i,e){return typeof e=="function"?e(i):e}o(Qc,"D");var dv={position:"relative",width:"100%",minHeight:"100%"},hv={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"};function lr({data:i,rowHeight:e,renderRow:t,overscanCount:r=10,padding:s=4,...n}){let a=we(null),[l,c]=Ae(0),[p,h]=Ae(0);xe(()=>{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 m=Qe(()=>{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 b=y+S+s,k=i.slice(y,b),A={...dv,height:i.length*e},j={...hv,top:y*e};return u("div",{onScroll:m,ref:a,...n,children:u("div",{role:"presentation",style:A,children:u("div",{role:"presentation",style:j,children:k.map(t)})})})}o(lr,"VirtualList");var ke=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 ci([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 Nt=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 Zc={debug:o(()=>{},"debug"),warn:o(()=>{},"warn"),error:o((...i)=>console.error(`[Uppy] [${ki()}]`,...i),"error")},Co={debug:o((...i)=>console.debug(`[Uppy] [${ki()}]`,...i),"debug"),warn:o((...i)=>console.warn(`[Uppy] [${ki()}]`,...i),"warn"),error:o((...i)=>console.error(`[Uppy] [${ki()}]`,...i),"error")};var Sa=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];function Ke(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?Sa.indexOf(e):Math.min(Math.floor(Math.log(r)/Math.log(1024)),Sa.length-1),n=Number(r/1024**s),a=Sa[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(Ke,"prettierBytes");var op=ce(sp(),1);var np={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]},mt=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},Ro=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 mt(`${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 mt(this.getI18n()("aggregateExceedsSize",{sizeAllowed:Ke(r),size:Ke(n)}))}}validateSingleFile(e){let{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(a=>a.includes("/")?e.type?(0,op.default)(e.type.replace(/;.*?$/,""),a):!1:a[0]==="."&&e.extension?e.extension.toLowerCase()===a.slice(1).toLowerCase():!1)){let a=s.join(", ");throw new mt(this.getI18n()("youCanOnlyUploadFileTypes",{types:a}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new mt(this.getI18n()("exceedsSize",{size:Ke(t),file:e.name??this.getI18n()("unnamed")}),{file:e});if(r&&e.size!=null&&e.size<r)throw new mt(this.getI18n()("inferiorSize",{size:Ke(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 mt(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){let t=new mt(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 gv(i){let e=null,t;return(...r)=>(t=r,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e)}o(gv,"debounce");var xa=class i extends ke{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=Vr(e);if(s){this.isTargetDOMEl=!0;let l=document.createElement("div");return l.classList.add("uppy-Root"),this.#e=gv(c=>{this.uppy.getPlugin(this.id)&&(To(this.render(c,l),l),this.afterUpdate())}),this.uppy.log(`Installing ${r} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(s.innerHTML=""),To(this.render(this.uppy.getState(),l),l),this.el=l,s.appendChild(l),l.dir=this.opts.direction||Gr(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(){}},le=xa;var qp=ce(Oo(),1),$p=ce(jp(),1);var zp="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Mt=o((i=21)=>{let e="",t=i|0;for(;t-- >0;)e+=zp[Math.random()*64|0];return e},"nanoid");var Lt={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.2.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && 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:"^6.0.1","p-queue":"^9.3.3","p-retry":"^8.0.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","@uppy-dev/tsconfig":"workspace:^","@vitest/browser-playwright":"^4.1.11",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.11"}};function Ta(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}o(Ta,"getFileName");var Hp={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",actionFailed:"The action 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}",openFileNamed:"Open %{name}",itemActionsNamed:"Actions for %{name}",itemsSelected:{0:"%{smart_count} selected",1:"%{smart_count} selected"},selectMultiple:"Select multiple",cancelSelection:"Cancel selection",close:"Close",detailSize:"Size",detailType:"Type",detailModified:"Modified",cancel:"Cancel",stopOperation:"Stop",dialogConfirm:"OK",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",s3AlreadyExists:"A file or folder with that name already exists",s3Conflict:"The file changed while it was being moved. Refresh the folder and try again",s3DestinationMustBeFile:"The destination of a file must be a file path",s3FileTooLargeToMove:"Files larger than 5 GB cannot be moved or renamed here",s3FolderMoveNotSupported:"Folders have to be moved item by item",s3FolderIntoItself:"A folder cannot be moved into itself",s3FolderNotEmpty:"The folder is not empty",s3InvalidGrant:"Your access to this storage could not be verified",s3InvalidName:"That name is not allowed",s3NotConfigured:"This storage is not available",s3NotFound:"The file or folder no longer exists",s3OutsideAllowedFolder:"That path is outside the folder you have access to",s3ReadOnlySession:"Your session is read-only",s3RequestFailed:"The storage request failed",s3SelectedInOtherSession:"This file was selected in another storage session. Reconnect and select it again",webdavCannotConnect:"Cannot connect to server"}};var ka=class{static{o(this,"DefaultStore")}static VERSION=Lt.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)})}},Fa=ka;function Ca(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(Ca,"supportsUploadProgress");var Uo={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},Ra=class i{static{o(this,"Uppy")}static VERSION=Lt.version;#e=Object.create(null);#t;#i;#r=(0,$p.default)();#s=new Set;#o=new Set;#a=new Set;defaultLocale;locale;opts;store;i18n;i18nArray;scheduledAutoProceed=null;wasOffline=!1;constructor(e){this.defaultLocale=Hp;let t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:np,meta:{},onBeforeFileAdded:o((s,n)=>!Object.hasOwn(n,s.id),"onBeforeFileAdded"),onBeforeUpload:o(s=>s,"onBeforeUpload"),store:new Fa,logger:Zc,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=Co),this.log(`Using Core v${i.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...Uo,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:Ca(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),this.#t=new Ro(()=>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 ci([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,...Uo})}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({...Uo,files:{}})}addPreProcessor(e){this.#s.add(e)}removePreProcessor(e){return this.#s.delete(e)}addPostProcessor(e){this.#a.add(e)}removePostProcessor(e){return this.#a.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=[],m=[],y=[],S=[];for(let b of s){let{progress:k}=b;!k.uploadComplete&&k.uploadStarted&&(n.push(b),b.isPaused||y.push(b)),k.uploadStarted||a.push(b),(k.uploadStarted||k.preprocess||k.postprocess)&&l.push(b),k.uploadStarted&&c.push(b),b.isPaused&&p.push(b),k.uploadComplete&&h.push(b),b.error&&m.push(b),(k.preprocess||k.postprocess)&&S.push(b)}return{newFiles:a,startedFiles:l,uploadStartedFiles:c,pausedFiles:p,completeFiles:h,erroredFiles:m,inProgressFiles:n,inProgressNotPausedFiles:y,processingFiles:S,isUploadStarted:c.length>0,isAllComplete:t===100&&h.length===s.length&&S.length===0,isAllErrored:!!r&&m.length===s.length,isAllPaused:n.length!==0&&p.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:s.some(b=>b.isGhost)}}#n(e){for(let a of e)a.isRestriction?this.emit("restriction-failed",a.file,a):this.emit("error",a,a.file),this.log(a,"warning");let t=e.filter(a=>a.isUserFacing),r=4,s=t.slice(0,r),n=t.slice(r);s.forEach(({message:a,details: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 ot(t)}return null}validateAggregateRestrictions(e){let t=this.getFiles();try{this.#t.validateAggregateRestrictions(t,e)}catch(r){return ot(r)}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 mt(this.i18n("noMoreFilesAllowed"),{file:e});throw this.#n([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=ir(t),s=Ta(r,t),n=Rt(s).extension,a=Wr(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=>{nt(e)||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 mt(this.i18n("noDuplicates",{fileName:l.name??this.i18n("unnamed")}),{file:l});if(h===!1&&!p)throw new mt("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.#n(n),s.length>0)throw s[0];this.setState({files:t});let[a]=r;return this.emit("file-added",a),this.emit("files-added",r),this.log(`Added file: ${a.name}, ${a.id}, mime type: ${a.type}`),this.#h(),a.id}addFiles(e){let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#d(e),n=s.filter(l=>l.isRestriction);this.#n(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 m=r[h].fileIDs.filter(l);if(m.length===0){delete n[h];return}let{capabilities:y}=this.getState();if(m.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:m}});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")}#g(){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.#g(),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(Uo)}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?.()})}#y=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,qp.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.#n([l])}else this.#n([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.#y),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.#a.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=Mt();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}})}#F(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.#a];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.#F(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.#F(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.#g().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 mt(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.#n([Ne(s)]),s}}},Aa=Ra;var Qp={};Zn(Qp,{InvalidTokenError:()=>Ri,Provider:()=>et,RequestClient:()=>ct,SearchProvider:()=>Ai,createGooglePickerController:()=>Mo,createGooglePickerStoreAdapter:()=>No,getAllowedHosts:()=>Ze,isAuthError:()=>kt,tokenStorage:()=>Ue});var Ia=class extends Error{static{o(this,"AuthError")}isAuthError;constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}};function kt(i){return i instanceof Error&&"isAuthError"in i&&i.isAuthError===!0}o(kt,"isAuthError");var Vp=Ia;function cb(i){return i.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}o(cb,"escapeRegex");function pb(i){if(typeof i=="string")return new RegExp(i);if(i instanceof RegExp)return i}o(pb,"wrapInRegex");function Ze(i,e){if(i){let r=o(s=>{if(!(typeof s=="string"&&pb(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=cb(t),t}o(Ze,"getAllowedHosts");var Do=o(i=>({authorization:`Bearer ${i}`}),"getAuthHeader"),Wp=new Set,Gp=!1;async function Xp(i){Wp.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)}),Wp.add(i))}o(Xp,"injectScript");async function db(i){await Promise.all([Xp("https://accounts.google.com/gsi/client"),(async()=>{await Xp("https://apis.google.com/js/api.js"),i==="drive"&&!Gp&&(await new Promise(e=>gapi.load("client:picker",()=>e())),await gapi.client.load("https://www.googleapis.com/discovery/v1/apis/drive/v3/rest"),Gp=!0)})()])}o(db,"ensureScriptsInjected");async function hb(i,e){return!!(await fetch(`https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=${encodeURIComponent(i)}`,{signal:e})).ok}o(hb,"isTokenValid");async function Kp({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(Kp,"authorize");async function fb(i){await new Promise(e=>google.accounts.oauth2.revoke(i,e))}o(fb,"doLogout");var Ri=class extends Error{static{o(this,"InvalidTokenError")}constructor(){super("Invalid or expired token"),this.name="InvalidTokenError"}};async function Yp({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=Do(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 Yp({doc:p,token:e,signal:t}))}while(n);return s}o(Yp,"handleDocObjectRecursively");async function mb({token:i,apiKey:e,appId:t,onFilesPicked:r,signal:s,onLoadingChange:n,onError:a}){if(!await hb(i,s))throw new Ri;let l=o(async p=>{if(p.action===google.picker.Action.PICKED)try{n(!0);let h=[];for(let m of p.docs??[])h.push(...await Yp({doc:m,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(mb,"showDrivePicker");async function gb({token:i,pickingSession:e,onPickingSessionChange:t,signal:r}){let s=Do(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 Ri;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(gb,"showPhotosPicker");async function yb({accessToken:i,pickingSession:e,signal:t}){let r=Do(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:m}}=a;return{platform:"photos",id:l,mimeType:p,url:c==="VIDEO"?`${m}=dv`:`${m}=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(yb,"resolvePickedPhotos");async function vb({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=Do(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 yb({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(vb,"pollPickingSession");var bb=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 No({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(No,"createGooglePickerStoreAdapter");function Mo({uppy:i,store:e,storage:t=Ue,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,m,y,S=o(async(M,$)=>{i.addFiles(M.map(L=>bb({requestClientId:n,accessToken:$,companionUrl:s},L)))},"handleFilesPicked");function b(M){return e.setState($=>({...$,accessToken:M})),M==null?t.removeItem(p):t.setItem(p,M)}o(b,"setAccessToken");function k(M){e.setState($=>({...$,loading:M}))}o(k,"setLoading");async function A(){m==null&&(m=(async()=>{h=new AbortController,b(await t.getItem(p)),h.signal.throwIfAborted(),r==="photos"&&vb({getPickingSession:o(()=>y,"getPickingSession"),getAccessToken:o(()=>e.getSnapshot().accessToken,"getAccessToken"),onPickingSessionClear:o(()=>{y=void 0},"onPickingSessionClear"),signal:h.signal,onFilesPicked:S,onError:o(M=>i.log(M),"onError")})})()),await m}o(A,"init");async function j(){await A();let M=e.getSnapshot().accessToken,$=o(async L=>{if(r==="drive"){if(l==null||c==null)throw new TypeError("apiKey and appId are required for Google Drive picker");await mb({token:L,apiKey:l,appId:c,onFilesPicked:S,signal:h.signal,onLoadingChange:o(J=>k(J),"onLoadingChange"),onError:o(J=>{i.log(J),i.info(i.i18n("failedToAddFiles"),"error")},"onError")})}else await gb({token:L,pickingSession:y,onPickingSessionChange:o(G=>{y=G},"onPickingSessionChange"),signal:h.signal})},"doShowPicker");k(!0);try{try{if(await db(r),M==null&&(M=await Kp({clientId:a,pickerType:r})),M==null)throw new Error;await $(M),b(M)}catch(L){if(L instanceof Ri)i.log("Token is invalid or expired, reauthenticating"),M=await Kp({pickerType:r,accessToken:M,clientId:a}),await $(M),b(M);else throw L}}catch(L){L instanceof Error&&"type"in L&&L.type==="popup_closed"||(b(null),i.log(L))}finally{k(!1)}}o(j,"showPicker");async function R(){let{accessToken:M}=e.getSnapshot();M&&(await fb(M),b(null),y=void 0)}o(R,"logout");function T(){h.abort(),y=void 0,m=void 0,e.setState(M=>({...M,accessToken:void 0,loading:!1}))}return o(T,"reset"),{init:A,show:j,reset:T,logout:R}}o(Mo,"createGooglePickerController");var wb=Object.prototype.toString,Sb=o(i=>wb.call(i)==="[object Error]","isError"),xb=new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function Oa(i){if(!(i&&Sb(i)&&i.name==="TypeError"&&typeof i.message=="string"))return!1;let{message:t,stack:r}=i;return t==="Load failed"||t.startsWith("Load failed (")&&t.endsWith(")")?r===void 0||"__sentry_captured__"in i:t.startsWith("error sending request for url")||t==="Failed to fetch"||t.startsWith("Failed to fetch (")&&t.endsWith(")")?!0:xb.has(t)}o(Oa,"isNetworkError");function _b(i){if(typeof i=="number"){if(i<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(i))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.");if(Number.isFinite(i)&&!Number.isInteger(i))throw new TypeError("Expected `retries` to be a non-negative integer or Infinity.")}else if(i!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}o(_b,"validateRetries");function Lo(i,e,{min:t=0,allowInfinity:r=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${i}\` to be a number${r?" or Infinity":""}.`);if(!r&&!Number.isFinite(e))throw new TypeError(`Expected \`${i}\` to be a finite number.`);if(e<t)throw new TypeError(`Expected \`${i}\` to be \u2265 ${t}.`)}}o(Lo,"validateNumberOption");function Ua(i,e){if(e!==void 0&&typeof e!="function")throw new TypeError(`Expected \`${i}\` to be a function.`)}o(Ua,"validateFunctionOption");var ur=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}};function Eb(i,e){let t=Math.max(1,i+1),r=e.randomize?Math.random()+1:1,s=Math.round(r*e.minTimeout*e.factor**(t-1));return s=Math.min(s,e.maxTimeout),s}o(Eb,"calculateDelay");function Bo(i,e){return Number.isFinite(e)?e-(performance.now()-i):e}o(Bo,"calculateRemainingTime");async function Pb(i,e){i<=0||await new Promise((t,r)=>{let s=o(()=>{clearTimeout(n),e.signal?.removeEventListener("abort",s),r(e.signal.reason)},"onAbort"),n=setTimeout(()=>{e.signal?.removeEventListener("abort",s),t()},i);e.unref&&n.unref?.(),e.signal?.addEventListener("abort",s,{once:!0})})}o(Pb,"delayForRetry");async function Tb({error:i,attemptNumber:e,retriesConsumed:t,startTime:r,options:s}){let n=i instanceof Error?i:new TypeError(`Non-error was thrown: "${i}". You should only throw errors.`);if(n instanceof ur)throw n.originalError;let a=Number.isFinite(s.retries)?Math.max(0,s.retries-t):s.retries,l=s.maxRetryTime??Number.POSITIVE_INFINITY,c=Eb(t,s);if(Bo(r,l)<=0){let j=Object.freeze({error:n,attemptNumber:e,retriesLeft:a,retriesConsumed:t,retryDelay:0});throw await s.onFailedAttempt(j),n}let h=Object.freeze({error:n,attemptNumber:e,retriesLeft:a,retriesConsumed:t,retryDelay:a>0?c:0}),m=await s.shouldConsumeRetry(h),y=m&&a>0?c:0,S=Object.freeze({error:n,attemptNumber:e,retriesLeft:a,retriesConsumed:t,retryDelay:y});if(await s.onFailedAttempt(S),Bo(r,l)<=0||Bo(r,l)<=0||a<=0||n instanceof TypeError&&!Oa(n)||!await s.shouldRetry(S))throw n;let k=Bo(r,l);if(k<=0)throw n;if(!m)return s.signal?.throwIfAborted(),!1;let A=Math.min(y,k);return s.signal?.throwIfAborted(),await Pb(A,s),s.signal?.throwIfAborted(),!0}o(Tb,"onAttemptFailure");async function jo(i,e={}){if(e={...e},_b(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??=10,e.factor??=2,e.minTimeout??=1e3,e.maxTimeout??=Number.POSITIVE_INFINITY,e.maxRetryTime??=Number.POSITIVE_INFINITY,e.randomize??=!1,e.onFailedAttempt??=()=>{},e.shouldRetry??=()=>!0,e.shouldConsumeRetry??=()=>!0,Ua("onFailedAttempt",e.onFailedAttempt),Ua("shouldRetry",e.shouldRetry),Ua("shouldConsumeRetry",e.shouldConsumeRetry),Lo("factor",e.factor,{min:0,allowInfinity:!1}),Lo("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),Lo("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),Lo("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let t=0,r=0,s=performance.now();for(;!Number.isFinite(e.retries)||r<=e.retries;){t++;try{e.signal?.throwIfAborted();let n=await i(t);return e.signal?.throwIfAborted(),n}catch(n){await Tb({error:n,attemptNumber:t,retriesConsumed:r,startTime:s,options:e})&&r++}}throw new Error("Retry attempts exhausted without throwing an error.")}o(jo,"pRetry");function kb(i){return i.replace(/\/$/,"")}o(kb,"stripSlash");var Jp=10,Fb=300*1e3,Da=401,zo=class extends Error{static{o(this,"HttpError")}statusCode;constructor({statusCode:e,message:t}){super(t),this.name="HttpError",this.statusCode=e}};async function Cb(i){if(i.status===Da)throw new Vp;if(i.ok)return i.status===204?void 0:i.json();let e=`Failed request with status: ${i.status}. ${i.statusText}`,t;try{t=await i.json();let r=t.message??t.code;r&&(e=`${e} message: ${r}`),t.requestId&&(e=`${e} request-Id: ${t.requestId}`)}catch(r){throw new Error(e,{cause:r})}if(i.status>=400&&i.status<=499){let{message:r,code:s}=t;if(typeof s=="string")throw new bo(typeof r=="string"?r:s,s);if(typeof r=="string"&&r)throw new bo(r)}throw new zo({statusCode:i.status,message:e})}o(Cb,"handleJSONResponse");function Rb(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(Rb,"emitSocketProgress");var ct=class{static{o(this,"RequestClient")}static VERSION=Lt.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 kb(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 li(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 Cb(l)}catch(a){throw kt(a)||bt(a)||Ne(a).name==="UserFacingApiError"?a:new Kt(`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 jo(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:Jp,signal:s,onFailedAttempt:o(({error:l})=>this.uppy.log(`Retrying upload due to: ${l.message}`,"warning"),"onFailedAttempt")})}catch(s){if(bt(s))return;throw this.uppy.emit("upload-error",e,Ne(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(kt(s))throw new ur(s);if(!(s instanceof Error)||s.cause==null)throw s;let n=s.cause,a=o(({statusCode:l})=>[408,409,429,418,423].includes(l)||l>=500&&l<=599&&![501,505].includes(l),"isRetryableHttpError");throw n instanceof zo&&!a(n)?new ur(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=rr(e.remote.companionUrl),p,h,m,{isPaused:y}=e,S=o((L,J)=>{if(p==null||p.readyState!==p.OPEN){this.uppy.log(`Cannot send "${L}" to socket ${e.id} because the socket state was ${String(p?.readyState)}`,"warning");return}p.send(JSON.stringify({action:L,payload:J??{}}))},"socketSend");function b(){s.resumableUploads&&S(y?"pause":"resume")}o(b,"sendState");let k=o(async()=>{h&&h.abort(),h=new AbortController;let L=o(G=>{this.uppy.setFileState(e.id,{serverToken:null}),h?.abort?.(),a(G)},"onFatalError");function J(){clearTimeout(m),!y&&(m=setTimeout(()=>{L(new Error("Timeout waiting for message from Companion socket"))},Fb))}o(J,"resetActivityTimeout");try{await jo(o(async()=>new Promise((Z,ie)=>{p=new WebSocket(`${c}/api/${l}`),J(),p.addEventListener("close",()=>{p=void 0,ie(new Error("Socket closed unexpectedly"))}),p.addEventListener("error",Ie=>{this.uppy.log(`Companion socket error ${JSON.stringify(Ie)}, closing socket`,"warning"),p?.close()}),p.addEventListener("open",()=>{b()}),p.addEventListener("message",Ie=>{J();try{let{action:be,payload:me}=JSON.parse(Ie.data);switch(be){case"progress":{Rb(this,me,this.uppy.getFile(e.id));break}case"success":{let Te=me.response?.responseText;this.uppy.emit("upload-success",this.uppy.getFile(e.id),{uploadURL:me.url,status:me.response?.status??200,body:Te?JSON.parse(Te):void 0}),h?.abort?.(),n();break}case"error":{let{message:Te}=me.error;throw Object.assign(new Error(Te),{cause:me.error})}default:this.uppy.log(`Companion socket unknown action ${be}`,"warning")}}catch(be){L(Ne(be))}});let oe=o(()=>{this.uppy.log(`Closing socket ${e.id}`),clearTimeout(m),p&&p.close(),p=void 0},"closeSocket");h.signal.addEventListener("abort",()=>{oe()})}),"reconnectWebsocket"),{retries:Jp,signal:h.signal,onFailedAttempt:o(()=>{h.signal.aborted||this.uppy.log(`Retrying websocket ${e.id}`)},"onFailedAttempt")})}catch(G){if(h.signal.aborted)return;L(Ne(G))}},"createWebsocket"),A=o(L=>{s.resumableUploads&&(y=L,p&&b())},"pause"),j=o(L=>{s.individualCancellation&&L.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"),T=o((L,J)=>{L?.id===e.id&&A(J)},"onFilePausedChange"),M=o(()=>A(!0),"onPauseAll"),$=o(()=>A(!1),"onResumeAll");this.uppy.on("file-removed",j),this.uppy.on("cancel-all",R),this.uppy.on("upload-pause",T),this.uppy.on("pause-all",M),this.uppy.on("resume-all",$),r=o(()=>{this.uppy.off("file-removed",j),this.uppy.off("cancel-all",R),this.uppy.off("upload-pause",T),this.uppy.off("pause-all",M),this.uppy.off("resume-all",$)},"removeEventHandlers"),t.addEventListener("abort",()=>{h?.abort()}),k()})}finally{r?.()}}};var Ab=o(i=>i.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),"getName");function Ib(){return location.origin}o(Ib,"getOrigin");var et=class extends ct{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!==Da: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:Ib()})),...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});r.throwIfAborted(),await this.setAuthToken(s.uppyAuthToken),r.throwIfAborted()}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=rr(this.opts.companionUrl),h=await new Promise((m,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:b,error:k}=JSON.parse(S.data);k?y(new Error("Authentication reported error")):b?m(b):y(new Error("Authentication did not return a token"))}catch(b){y(b)}}),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: ${ot(p)}`,"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(!kt(t)||!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 kt(s)&&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}deleteItem(e,t){return this.post(`${this.id}/mutate/delete`,{id:e},t)}moveItem(e,t,r){return this.post(`${this.id}/mutate/move`,{id:e,destination:t},r)}createFolder(e,t,r){return this.post(`${this.id}/mutate/create-folder`,{parentId:e,name:t},r)}};var Ob=o(i=>i.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),"getName"),Ai=class extends ct{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||Ob(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 Ue={};Zn(Ue,{getItem:()=>Db,removeItem:()=>Nb,setItem:()=>Ub});async function Ub(i,e){localStorage.setItem(i,e)}o(Ub,"setItem");async function Db(i){return localStorage.getItem(i)}o(Db,"getItem");async function Nb(i){localStorage.removeItem(i)}o(Nb,"removeItem");var sl={};Zn(sl,{FilterInput:()=>pr,GoogleDriveIcon:()=>hr,GooglePhotosIcon:()=>dr,GooglePickerView:()=>Ii,ProviderViews:()=>Ye,SearchProviderViews:()=>hi,SearchView:()=>en,defaultPickerIcon:()=>mr,useSearchForm:()=>cr});function cr(i){let e=Qe(r=>{r.preventDefault(),i()},[i]),[t]=Ae(()=>{let r=document.createElement("form");return r.setAttribute("tabindex","-1"),r.id=Mt(),r});return xe(()=>(document.body.appendChild(t),t.addEventListener("submit",e),()=>{t.removeEventListener("submit",e),t.remove()}),[t,e]),{formId:t.id}}o(cr,"useSearchForm");function Mb({value:i,onChange:e,onSubmit:t,inputLabel:r,i18n:s,disabled:n=!1}){let{formId:a}=cr(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(l=>e(l.target.value),"onInput"),form:a,disabled: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"),disabled:n,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(Mb,"FilterInput");var pr=Mb;function Bb(i,e){for(var t in e)i[t]=e[t];return i}o(Bb,"g");function Zp(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(Zp,"E");function ld(i,e){var t=e(),r=Ae({t:{__:t,u:e}}),s=r[0].t,n=r[1];return Fo(function(){s.__=t,s.u=e,Na(s)&&n({t:s})},[i,t,e]),xe(function(){return Na(s)&&n({t:s}),i(function(){Na(s)&&n({t:s})})},[i]),t}o(ld,"C");function Na(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(Na,"R");function ed(i,e){this.props=i,this.context=e}o(ed,"M");(ed.prototype=new he).isPureReactComponent=!0,ed.prototype.shouldComponentUpdate=function(i,e){return Zp(this.props,i)||Zp(this.state,e)};var td=re.__b;re.__b=function(i){i.type&&i.type.__f&&i.ref&&(i.props.ref=i.ref,i.ref=null),td&&td(i)};var cT=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var jb=re.__e;re.__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)}jb(i,e,t,r)};var id=re.unmount;function ud(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=Bb({},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 ud(r,e,t)})),i}o(ud,"V");function cd(i,e,t){return i&&t&&(i.__v=null,i.__k=i.__k&&i.__k.map(function(r){return cd(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(cd,"W");function Ma(){this.__u=0,this.o=null,this.__b=null}o(Ma,"P");function pd(i){var e=i.__&&i.__.__c;return e&&e.__a&&e.__a(i)}o(pd,"j");function Ho(){this.i=null,this.l=null}o(Ho,"B");re.unmount=function(i){var e=i.__c;e&&(e.__z=!0),e&&e.__R&&e.__R(),e&&32&i.__u&&(i.type=null),id&&id(i)},(Ma.prototype=new he).__c=function(i,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var s=pd(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]=cd(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)},Ma.prototype.componentWillUnmount=function(){this.o=[]},Ma.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]=ud(this.__b,t,r.__O=r.__P)}this.__b=null}var s=e.__a&&Qt(fe,null,i.fallback);return s&&(s.__u&=-33),[Qt(fe,null,e.__a?null:i.children),s]};var rd=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");(Ho.prototype=new he).__a=function(i){var e=this,t=pd(e.__v),r=e.l.get(i);return r[0]++,function(s){var n=o(function(){e.props.revealOrder?(r.push(s),rd(e,i,r)):s()},"o");t?t(n):n()}},Ho.prototype.render=function(i){this.i=null,this.l=new Map;var e=ft(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},Ho.prototype.componentDidUpdate=Ho.prototype.componentDidMount=function(){var i=this;this.l.forEach(function(e,t){rd(i,t,e)})};var zb=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Hb=/^(?: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]/,qb=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,$b=/[A-Z0-9]/g,Vb=typeof document<"u",Wb=o(function(i){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(i)},"X");he.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(i){Object.defineProperty(he.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 sd=re.event;re.event=function(i){return sd&&(i=sd(i)),i.persist=function(){},i.isPropagationStopped=function(){return this.cancelBubble},i.isDefaultPrevented=function(){return this.defaultPrevented},i.nativeEvent=i};var dd,Gb={configurable:!0,get:o(function(){return this.class},"get")},od=re.vnode;re.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||Vb&&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"||Wb(t.type)?c==="onfocus"?a="onfocusin":c==="onblur"?a="onfocusout":qb.test(a)&&(a=c):c=a="oninput":n&&Hb.test(a)?a=a.replace($b,"-$&").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=ft(t.children).forEach(function(p){p.props.selected=s.value.indexOf(p.props.value)!=-1})),s.defaultValue!=null&&(s.value=ft(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",Gb)):t.className&&(s.class=s.className=t.className),e.props=s})(i),i.$$typeof=zb,od&&od(i)};var nd=re.__r;re.__r=function(i){nd&&nd(i),dd=i.__c};var ad=re.diffed;re.diffed=function(i){ad&&ad(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),dd=null};function Xb(){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(Xb,"GoogleIcon");function Kb({pluginName:i,i18n:e,onAuth:t}){let r=i==="Google Drive",s=Qe(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(Xb,{}),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(Kb,"DefaultForm");var Yb=o(({pluginName:i,i18n:e,onAuth:t})=>u(Kb,{pluginName:i,i18n:e,onAuth:t}),"defaultRenderForm");function as({loading:i,pluginName:e,pluginIcon:t,i18n:r,handleAuth:s,renderForm:n=Yb}){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(as,"AuthView");var dr=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"),hr=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 Jb({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:m,init:y,...S}=At(()=>Mo({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 xe(()=>(y(),()=>{m()}),[m,y]),{...ld(p,h),...S}}o(Jb,"useGooglePicker");function Ii({getPluginState:i,setPluginState:e,uppy:t,i18n:r,clientId:s,pickerType:n,apiKey:a,appId:l,storage:c,requestClientId:p,companionUrl:h}){let m=At(()=>No({uppy:t,getPluginState:i,setPluginState:e}),[t,i,e]),y=Jb({uppy:t,requestClientId:p,companionUrl:h,pickerType:n,clientId:s,apiKey:a,appId:l,storage:c,store:m}),S=we(!1);return xe(()=>{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(as,{pluginName:r(n==="drive"?"pluginNameGoogleDrivePicker":"pluginNameGooglePhotosPicker"),pluginIcon:n==="drive"?hr:dr,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(Ii,"GooglePickerView");var jd=ce(Me(),1),zd=ce(Io(),1);var hd={S3_ALREADY_EXISTS:"s3AlreadyExists",S3_CONFLICT:"s3Conflict",S3_DESTINATION_MUST_BE_FILE:"s3DestinationMustBeFile",S3_FILE_TOO_LARGE_TO_MOVE:"s3FileTooLargeToMove",S3_FOLDER_INTO_ITSELF:"s3FolderIntoItself",S3_FOLDER_MOVE_NOT_SUPPORTED:"s3FolderMoveNotSupported",S3_FOLDER_NOT_EMPTY:"s3FolderNotEmpty",S3_INVALID_GRANT:"s3InvalidGrant",S3_INVALID_NAME:"s3InvalidName",S3_NOT_CONFIGURED:"s3NotConfigured",S3_NOT_FOUND:"s3NotFound",S3_OUTSIDE_ALLOWED_FOLDER:"s3OutsideAllowedFolder",S3_READ_ONLY_SESSION:"s3ReadOnlySession",S3_REQUEST_FAILED:"s3RequestFailed",S3_SELECTED_IN_OTHER_SESSION:"s3SelectedInOtherSession",WEBDAV_CANNOT_CONNECT:"webdavCannotConnect"};function $o(i,e){let{code:t}=e;return t&&Object.hasOwn(hd,t)?i(hd[t]):t&&e.message===t?i("companionError"):e.message}o($o,"describeCompanionError");var fd=o(({appliesTo:i="all"},e)=>i==="all"||i===(e.data.isFolder?"folder":"file"),"appliesToItem");function Vo(i,e){return i.filter(t=>fd(t,e))}o(Vo,"getApplicableActions");function La({file:i,actions:e,open:t,onToggle:r,i18n:s}){return e.some(n=>fd(n,i))?u("div",{className:"uppy-ProviderBrowserItem-actions",children:u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-actionsBtn","aria-label":s("itemActionsNamed",{name:i.data.name??s("unnamed")}),"aria-haspopup":"menu","aria-expanded":t,onClick:o(n=>{n.stopPropagation(),n.preventDefault(),r(n.currentTarget)},"onClick"),children:u("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",focusable:"false",children:[u("circle",{cx:"3",cy:"8",r:"1.5",fill:"currentColor"}),u("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),u("circle",{cx:"13",cy:"8",r:"1.5",fill:"currentColor"})]})})}):null}o(La,"ItemActionsMenu");var yd=ce(Me(),1);function gd(i){i.key==="Escape"&&i.stopPropagation()}o(gd,"stopEscapePropagation");var md=o(i=>{let e=i.currentTarget;if(i.target!==e)return!1;let t=e.getBoundingClientRect();return i.clientX<t.left||i.clientX>t.right||i.clientY<t.top||i.clientY>t.bottom},"isOnBackdrop");function ls({onDismiss:i,restoreFocus:e,children:t,...r}){let s=we(null),n=we(!1),a=we(e);return a.current=e,xe(()=>{let l=s.current;if(!l)return;let c=document.activeElement instanceof HTMLElement?document.activeElement:null;return typeof l.showModal=="function"?l.showModal():(l.setAttribute("open",""),l.querySelector("button")?.focus()),()=>{l.open&&typeof l.close=="function"&&l.close();let{activeElement:p}=document;if(p!==document.body&&!l.contains(p))return;(c?.isConnected?c:a.current?.(l))?.focus()}},[]),u("dialog",{...r,ref:s,onCancel:o(l=>{l.preventDefault(),i()},"onCancel"),onPointerDown:o(l=>{n.current=md(l)},"onPointerDown"),onClick:o(l=>{n.current&&md(l)&&i(),n.current=!1},"onClick"),onKeyDown:o(l=>{l.key!=="Escape"||l.isComposing||(l.preventDefault(),l.stopPropagation(),i())},"onKeyDown"),children:t})}o(ls,"ModalDialog");var Ba=4;function ja({file:i,actions:e,anchor:t,containerRef:r,runAction:s,onClose:n,i18n:a}){let l=we(null),[c,p]=Ae(null),h=Qe(()=>{let S=l.current;if(!S)return;let b=t.getBoundingClientRect(),k=S.offsetHeight,j=b.bottom+Ba+k<=window.innerHeight?b.bottom+Ba:Math.max(0,b.top-Ba-k);p(getComputedStyle(t).direction==="rtl"?{top:j,left:Math.max(0,b.left)}:{top:j,right:Math.max(0,window.innerWidth-b.right)})},[t]);Fo(h,[h]),xe(()=>{let S=l.current,b=r.current;if(!S)return;let k=o(T=>{T.newState==="closed"&&n()},"onToggle"),A=new AbortController,{signal:j}=A;S.addEventListener("toggle",k,{signal:j}),typeof S.showPopover=="function"&&S.showPopover(),h();let R=o(T=>{if(b&&T.target instanceof Node&&b.contains(T.target)){n();return}h()},"onPageScroll");return window.addEventListener("scroll",R,{capture:!0,signal:j}),window.addEventListener("resize",h,{signal:j}),S.querySelector('[role="menuitem"]')?.focus({preventScroll:!0}),()=>A.abort()},[r,n,h]);let m=o(()=>{n(),t.focus({preventScroll:!0})},"closeAndRefocus"),y=o(S=>{let b=Array.from(l.current?.querySelectorAll('[role="menuitem"]')??[]),k=b.indexOf(document.activeElement),A=o(j=>{S.preventDefault(),b[(j+b.length)%b.length]?.focus({preventScroll:!0})},"focusAt");switch(S.key){case"Escape":gd(S),typeof l.current?.hidePopover!="function"&&m();break;case"ArrowDown":A(k+1);break;case"ArrowUp":A(k-1);break;case"Home":A(0);break;case"End":A(b.length-1);break;case"Tab":n();break;default:}},"onKeyDown");return u("div",{ref:l,className:"uppy-ProviderBrowserItem-actionsMenu",popover:"auto",role:"menu","aria-label":a("itemActionsNamed",{name:i.data.name??a("unnamed")}),style:c?{top:`${c.top}px`,..."left"in c?{left:`${c.left}px`}:{right:`${c.right}px`}}:{visibility:"hidden"},onKeyDown:y,children:e.map(S=>u("button",{type:"button",role:"menuitem",className:(0,yd.default)("uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-actionsMenuItem",S.danger&&"uppy-ProviderBrowserItem-actionsMenuItem--danger"),onClick:o(b=>{b.stopPropagation(),b.preventDefault(),m(),s(S,i)},"onClick"),children:S.label},S.id))})}o(ja,"ItemActionsPopover");function za(i){let[e,t]=Ae(null),r=e?i.find(({id:l})=>l===e.id):void 0,s=e&&r?{item:r,anchor:e.anchor}:null,n=Qe(()=>t(null),[]),a=Qe((l,c)=>t(p=>p?.id===l?null:{id:l,anchor:c}),[]);return{open:s,close:n,toggle:a}}o(za,"useItemMenu");var vd=ce(Me(),1);function Qb(){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(Qb,"FileIcon");function Zb(){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(Zb,"FolderIcon");function e0(){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(e0,"VideoIcon");function Bt({itemIconString:i,alt:e=void 0}){if(i===null)return null;switch(i){case"file":return u(Qb,{});case"folder":return u(Zb,{});case"video":return u(e0,{});default:return u("img",{src:i,alt:e,referrerPolicy:"no-referrer",loading:"lazy",width:16,height:16})}}o(Bt,"ItemIcon");function t0({file:i,toggleCheckbox:e,className:t,isDisabled:r,restrictionError:s,showTitles:n,children:a=null,i18n:l,actionsMenu:c=null,selectable:p=!0,onFileClick:h}){let m=i.data.name??l("unnamed"),y=u(fe,{children:[u(Bt,{itemIconString:i.data.thumbnail||i.data.icon}),n&&m,a]});return u("li",{className:t,title:r&&s?s:void 0,children:[p&&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}),!p&&h&&!i.data.isFolder?u("button",{type:"button","aria-label":l("openFileNamed",{name:m}),"data-uppy-item-id":i.id,className:"uppy-u-reset uppy-ProviderBrowserItem-inner",onClick:o(()=>h(i),"onClick"),children:y}):u("label",{htmlFor:p?i.id:void 0,"aria-label":m,className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:y}),c]})}o(t0,"GridItem");var Ha=t0;function qa({file:i,openFolder:e,className:t,isDisabled:r,restrictionError:s,toggleCheckbox:n,showTitles:a,i18n:l,actionsMenu:c=null,selectable:p=!0,onFileClick:h}){let m=u(fe,{children:[u("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:u(Bt,{itemIconString:i.data.icon})}),a&&u("span",{className:"uppy-truncate-text",children:i.data.name??l("unnamed")})]});return u("li",{className:t,title:i.status!=="checked"&&s?s:void 0,children:[p&&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(Bt,{itemIconString:i.data.icon})}),a&&i.data.name?u("span",{className:"uppy-truncate-text",children:i.data.name}):l("unnamed")]}):p?u("label",{htmlFor:i.id,className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:m}):u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",onClick:o(()=>h?.(i),"onClick"),"data-uppy-item-id":i.id,"aria-label":l("openFileNamed",{name:i.data.name??l("unnamed")}),children:m}),c]})}o(qa,"ListItem");function $a(i){let{viewType:e,toggleCheckbox:t,showTitles:r,i18n:s,openFolder:n,file:a,utmSource:l,actions:c=[],menuOpen:p=!1,toggleMenu:h,selectable:m=!0,onFileClick:y}=i,S=c.length>0&&h?u(La,{file:a,actions:c,open:p,onToggle:h,i18n:s}):null,b=a.type==="folder"?null:a.restrictionError,k=!!b&&a.status!=="checked",A={file:a,openFolder:n,toggleCheckbox:t,utmSource:l,i18n:s,viewType:e,showTitles:r,className:(0,vd.default)("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--disabled":k},{"uppy-ProviderBrowserItem--noPreview":a.data.icon==="video"},{"uppy-ProviderBrowserItem--is-checked":a.status==="checked"},{"uppy-ProviderBrowserItem--is-partial":a.status==="partial"}),isDisabled:k,restrictionError:b,actionsMenu:S,selectable:m,onFileClick:y};switch(e){case"grid":return u(Ha,{...A});case"list":return u(qa,{...A});case"unsplash":return u(Ha,{...A,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($a,"Item");function i0(i){let{displayedPartialTree:e,viewType:t,toggleCheckbox:r,handleScroll:s,showTitles:n,i18n:a,isLoading:l,onCancelLoading:c,openFolder:p,noResultsLabel:h,virtualList:m,utmSource:y,actions:S=[],runAction:b,selectable:k=!0,onFileClick:A}=i,[j,R]=Ae(!1),T=za(e),M=we(null);xe(()=>{let Z=o(oe=>{oe.key==="Shift"&&R(!1)},"handleKeyUp"),ie=o(oe=>{oe.key==="Shift"&&R(!0)},"handleKeyDown");return document.addEventListener("keyup",Z),document.addEventListener("keydown",ie),()=>{document.removeEventListener("keyup",Z),document.removeEventListener("keydown",ie)}},[]);let $=we(null),L=!!(l&&c);if(xe(()=>{L&&$.current?.focus()},[L]),l)return u("div",{className:"uppy-Provider-loading",children:[u("span",{role:"status",children:typeof l=="string"?l:a("loading")}),c&&u("button",{ref:$,type:"button",className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Provider-loadingCancel",onClick:c,children:a("stopOperation")})]});if(e.length===0)return u("div",{className:"uppy-Provider-empty",children:h});let J=o(Z=>u($a,{viewType:t,toggleCheckbox:o(ie=>{ie.stopPropagation(),ie.preventDefault(),document.getSelection()?.removeAllRanges(),r(Z,j)},"toggleCheckbox"),showTitles:n,i18n:a,openFolder:p,file:Z,utmSource:y,actions:S,menuOpen:T.open?.item.id===Z.id,toggleMenu:b?ie=>T.toggle(Z.id,ie):void 0,selectable:k,onFileClick:A},Z.id),"renderItem"),G=T.open&&b?u(ja,{file:T.open.item,actions:Vo(S,T.open.item),anchor:T.open.anchor,containerRef:M,runAction:b,onClose:T.close,i18n:a},T.open.item.id):null;return m?u("div",{className:"uppy-ProviderBrowser-body",ref:M,children:[u(lr,{className:"uppy-ProviderBrowser-list",data:e,renderRow:J,rowHeight:35.5}),G]}):u("div",{className:"uppy-ProviderBrowser-body",ref:M,children:[u("ul",{className:"uppy-ProviderBrowser-list",onScroll:s,tabIndex:-1,children:e.map(J)}),G]})}o(i0,"Browser");var Wo=i0;var bd=ce(Me(),1);function Va({selectedCount:i,bulkActions:e,runBulkAction:t,i18n:r}){return i===0||e.length===0?null:u("div",{className:"uppy-ProviderBrowser-footer",children:u("div",{className:"uppy-ProviderBrowser-footer-buttons",children:[u("span",{className:"uppy-ProviderBrowser-footer-count",children:r("itemsSelected",{smart_count:i})}),e.map(s=>u("button",{type:"button",className:(0,bd.default)("uppy-u-reset uppy-c-btn uppy-c-btn-primary",{"uppy-ProviderDialog-confirm--danger":s.danger}),onClick:o(()=>t(s),"onClick"),children:s.label},s.id))]})})}o(Va,"BulkActions");var wd=ce(Me(),1);var r0=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"),Go=r0;function us({cancelSelection:i,donePicking:e,i18n:t,partialTree:r,validateAggregateRestrictions:s}){let n=At(()=>s(r),[r,s]),a=At(()=>Go(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,wd.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(us,"FooterActions");var Sd=ce(Me(),1);function Wa({item:i,actions:e,runAction:t,getPreviewUrl:r,onClose:s,i18n:n}){let[a,l]=Ae(null),c=os(),[p]=Ae(i);xe(()=>{if(!r||p.data.isFolder)return;let A=!1;return Promise.resolve().then(()=>r(p)).then(j=>{A||l(j)}).catch(()=>{}),()=>{A=!0}},[r,p]);let h=i.data.name??n("unnamed"),m=Vo(e,i),y=i.type==="file"?i.data:void 0,S=y?.size,b=y?.mimeType,k=y?.modifiedDate;return u(ls,{className:"uppy-ProviderDialog uppy-ItemDetail","aria-labelledby":c,onDismiss:s,restoreFocus:o(A=>{let j=A.closest(".uppy-ProviderBrowser");return j?.querySelector(`[data-uppy-item-id="${CSS.escape(i.id)}"]`)??j?.querySelector(".uppy-ProviderBrowser-list")},"restoreFocus"),children:[u("header",{className:"uppy-ItemDetail-header",children:[u("h3",{id:c,className:"uppy-ItemDetail-name",children:h}),u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ItemDetail-close","aria-label":n("close"),onClick:s,children:u("svg",{"aria-hidden":"true",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:u("path",{d:"M2 2l10 10M12 2L2 12",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"})})})]}),u("div",{className:"uppy-ItemDetail-body",children:[u("div",{className:"uppy-ItemDetail-preview","data-testid":"file-detail-preview",children:a?u("img",{src:a,alt:"",className:"uppy-ItemDetail-previewImage"}):u("span",{className:"uppy-ItemDetail-previewIcon","aria-hidden":"true",children:u(Bt,{itemIconString:i.data.icon})})}),u("dl",{className:"uppy-ItemDetail-facts",children:[typeof S=="number"?u(fe,{children:[u("dt",{children:n("detailSize")}),u("dd",{children:Ke(S)})]}):null,b?u(fe,{children:[u("dt",{children:n("detailType")}),u("dd",{children:b})]}):null,k?u(fe,{children:[u("dt",{children:n("detailModified")}),u("dd",{children:k})]}):null]})]}),u("footer",{className:"uppy-ItemDetail-actions",children:m.map(A=>u("button",{type:"button",className:(0,Sd.default)("uppy-u-reset uppy-c-btn uppy-ItemDetail-action",A.danger&&"uppy-ItemDetail-action--danger"),onClick:o(()=>{s(),t(A,i)},"onClick"),children:A.label},A.id))})]})}o(Wa,"ItemDetailDialog");var xd=ce(Me(),1);function Ga({dialog:i,i18n:e,onConfirm:t,onCancel:r}){let[s,n]=Ae(i.kind==="prompt"?i.defaultValue??"":""),a=we(null),l=we(null),c=we(null),p=os(),h=i.kind==="prompt",m=i.kind==="confirm"&&i.danger===!0;return xe(()=>{(a.current??(m?c:l).current)?.focus(),a.current?.select()},[m]),u(ls,{className:"uppy-ProviderDialog","aria-labelledby":p,onDismiss:r,children:u("form",{className:"uppy-ProviderDialog-form",onSubmit:o(y=>{y.preventDefault(),t(h?s:void 0)},"onSubmit"),children:[u("h3",{id:p,className:"uppy-ProviderDialog-title",children:i.title}),i.kind==="prompt"?u("label",{className:"uppy-ProviderDialog-label",children:[i.label&&u("span",{className:"uppy-ProviderDialog-labelText",children:i.label}),u("input",{ref:a,type:"text",className:"uppy-u-reset uppy-c-textInput uppy-ProviderDialog-input",value:s,onInput:o(y=>n(y.target.value),"onInput")})]}):i.message&&u("p",{className:"uppy-ProviderDialog-message",children:i.message}),u("div",{className:"uppy-ProviderDialog-actions",children:[u("button",{ref:c,type:"button",className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:r,children:e("cancel")}),u("button",{ref:l,type:"submit",className:(0,xd.default)("uppy-u-reset uppy-c-btn uppy-c-btn-primary",m&&"uppy-ProviderDialog-confirm--danger"),children:i.confirmLabel??e("dialogConfirm")})]})]})})}o(Ga,"ProviderDialog");var cs=class{static{o(this,"ProviderDialogController")}#e;#t=null;#i=0;get revision(){return this.#i}constructor(e){this.#e=e}prompt(e){return new Promise(t=>{this.#r({kind:"prompt",...e},(r,s)=>t(r?s??"":null))})}confirm(e){return new Promise(t=>{this.#r({kind:"confirm",...e},t)})}submit=o(e=>this.#s(!0,e),"submit");cancel=o(()=>this.#s(!1),"cancel");#r(e,t){this.cancel(),this.#i+=1,this.#t=t,this.#e.setPluginState({dialog:e})}#s(e,t){let r=this.#t;r&&(this.#t=null,this.#e.setPluginState({dialog:void 0}),r(e,t))}};var s0=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"),_d=s0;var o0=o((i,e,t)=>{let r=i.map(a=>_d(a,e,t)),s=[],n=[];r.forEach(a=>{e.uppy.checkIfFileAlreadyExists(Wr(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"),Xo=o0;var n0=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"),Ko=n0;var a0=o(i=>e=>{if(kt(e))return;let t=Ne(e);if(bt(t)){i.log("Aborting request","warning");return}i.log(t,"error"),t.name==="UserFacingApiError"&&i.info({message:i.i18n("companionError"),details:$o(i.i18n,t)},"warning",5e3)},"handleError"),jt=a0;var l0=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"),Xa=l0;var Ed=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=[...Ed(i,s.parentId,t),s];return t[r]=n,n},"getPath"),u0=o(i=>{let e=Object.create(null);return i.filter(s=>s.type==="file"&&s.status==="checked").map(s=>{let n=Ed(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"),Yo=u0;var Ya=ce(Td(),1);var Ja=class i extends Error{static{o(this,"TimeoutError")}name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,i)}},kd=o(i=>i.reason??new DOMException("This operation was aborted.","AbortError"),"getAbortedReason");function Qa(i,e){let{milliseconds:t,fallback:r,message:s,customTimers:n={setTimeout,clearTimeout},signal:a}=e,l,c,h=new Promise((m,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(kd(a));return}if(a&&(c=o(()=>{y(kd(a))},"abortHandler"),a.addEventListener("abort",c,{once:!0})),i.then(m,y),t===Number.POSITIVE_INFINITY)return;let S=new Ja;l=n.setTimeout.call(void 0,()=>{if(r){try{m(r())}catch(b){y(b)}return}typeof i.cancel=="function"&&i.cancel(),s===!1?m():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(Qa,"pTimeout");function Za(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(Za,"lowerBound");var d0=100,fr=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=Za(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>d0&&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 ds=class extends Ya.default{static{o(this,"PQueue")}#e;#t;#i=0;#r;#s=!1;#o=!1;#a;#n=0;#u;#l;#c;#p=[];#h=0;#d;#g;#f=0;#y;#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:fr,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.#a=e.interval,this.#c=e.strict,this.#d=new e.queueClass,this.#g=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.#a)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#F(){return this.#t?!0:this.#c?this.#T()<this.#r:this.#i<this.#r}get#E(){return this.#f<this.#y}#M(){this.#f--,this.#f===0&&this.emit("pendingZero"),this.#C(),this.emit("next")}#L(){this.#l=void 0,this.#D(),this.#U()}#B(e){if(this.#c){if(this.#v(e),this.#T()>=this.#r){let r=this.#p[this.#h],s=this.#a-(e-r);return this.#I(s),!0}return!1}if(this.#u===void 0){let t=this.#n-e;if(t<0)this.#i=this.#e?this.#f:0;else return this.#I(t),!0}return!1}#I(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)}#C(){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.#F&&this.#E){let s=this.#d.dequeue();this.#t||(this.#_(t),this.#k()),r&&this.#U(),this.emit("active"),s(),e=!0}}return e}#U(){this.#t||this.#u!==void 0||this.#c||(this.#u=setInterval(()=>{this.#D()},this.#a),this.#n=Date.now()+this.#a)}#D(){this.#c||(this.#u!==void 0&&(this.#i===0&&this.#f===0?this.#R():this.#n=Date.now()+this.#a),this.#i=this.#e?this.#f:0),this.#A(),this.#k()}#A(){for(;this.#C(););}get concurrency(){return this.#y}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.#y=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=Qa(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,b)=>{p=o(()=>{b(y.reason)},"eventListener"),y.addEventListener("abort",p,{once:!0})})])}let m=await h;r(m),this.emit("completed",m)}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 fr){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.#C(),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.#C()})}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.#g,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.#y&&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 h0=o(i=>i.map(e=>({...e})),"shallowClone"),Qo=h0;var Fd=o(async(i,e,t,r,s)=>{let n=[],a=t.cached?t.nextPagePath:t.id;for(;a;){let m=await r(a);n=n.concat(m.items),a=m.nextPagePath}let l=n.filter(m=>m.isFolder===!0),c=n.filter(m=>m.isFolder===!1),p=l.map(m=>({type:"folder",id:m.requestPath,cached:!1,nextPagePath:null,status:"checked",parentId:t.id,data:m})),h=c.map(m=>{let y=s(m);return{type:"file",id:m.requestPath,restrictionError:y,status:y?"unchecked":"checked",parentId:t.id,data:m}});t.cached=!0,t.nextPagePath=null,e.push(...h,...p),p.forEach(async m=>{i.add(()=>Fd(i,e,m,r,s))})},"recursivelyFetch"),f0=o(async(i,e,t,r)=>{let s=new ds({concurrency:6}),n=Qo(i);return n.filter(l=>l.type==="folder"&&l.status==="checked"&&(l.cached===!1||l.nextPagePath)).forEach(l=>{s.add(()=>Fd(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"),Cd=f0;var m0=o((i,e,t,r,s)=>{let n=e.filter(b=>!i.find(k=>k.id===b.requestPath)),a=n.filter(b=>b.isFolder===!0),l=n.filter(b=>b.isFolder===!1),c=t.type==="folder"&&t.status==="checked",p=a.map(b=>({type:"folder",id:b.requestPath,cached:!1,nextPagePath:null,status:c?"checked":"unchecked",parentId:t.id,data:b})),h=l.map(b=>{let k=s(b);return{type:"file",id:b.requestPath,restrictionError:k,status:c&&!k?"checked":"unchecked",parentId:t.id,data:b}}),m={...t,cached:!0,nextPagePath:r};return[...i.map(b=>b.id===m.id?m:b),...p,...h]},"afterOpenFolder"),Rd=m0;var g0=o((i,e,t,r,s)=>{let n=i.find(b=>b.id===e),a=t.filter(b=>b.isFolder===!0),l=t.filter(b=>b.isFolder===!1),c={...n,nextPagePath:r},p=i.map(b=>b.id===c.id?c:b),h=c.type==="folder"&&c.status==="checked",m=a.map(b=>({type:"folder",id:b.requestPath,cached:!1,nextPagePath:null,status:h?"checked":"unchecked",parentId:c.id,data:b})),y=l.map(b=>{let k=s(b);return{type:"file",id:b.requestPath,restrictionError:k,status:h&&!k?"checked":"unchecked",parentId:c.id,data:b}});return[...p,...m,...y]},"afterScrollFolder"),Ad=g0;var Id=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",Id(i,s.id,t)})},"percolateDown"),Od=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",Od(i,t.parentId)},"percolateUp"),y0=o((i,e)=>{let t=Qo(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,Id(t,s.id,s.status==="checked")}),Od(t,r[0].parentId),t},"afterToggleCheckbox"),Ud=y0;var di={afterOpenFolder:Rd,afterScrollFolder:Ad,afterToggleCheckbox:Ud,afterFill:Cd};var v0=o(i=>{let{scrollHeight:e,scrollTop:t,offsetHeight:r}=i.target;return e-(t+r)<50},"shouldHandleScroll"),Zo=v0;var Dd=ce(Me(),1);var b0=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,Dd.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(Bt,{itemIconString:e.data.icon})}),e.data.name??i("unnamed")]})]})},"SearchResultItem"),Nd=b0;var w0=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(Nd,{i18n:r,item:s,toggleCheckbox:e,openFolder:t},s.id))})}),"GlobalSearchView"),Md=w0;var Ld=ce(Me(),1);function el(i){let{openFolder:e,title:t,breadcrumbsIcon:r,breadcrumbs:s,i18n:n,disabled:a=!1}=i;return u("div",{className:"uppy-Provider-breadcrumbs",children:[u("div",{className:"uppy-Provider-breadcrumbsIcon",children:r}),s.map((l,c)=>{let p=l.type==="root"?t:l.data.name??n("unnamed"),h=s.length===c+1;return u(fe,{children:[u("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:h?void 0:()=>e(l.id),"aria-current":h?"page":void 0,disabled:!h&&a,title:p,children:p}),!h&&u("span",{"aria-hidden":"true",className:"uppy-Provider-breadcrumbsSeparator",children:"/"})]},l.id)})]})}o(el,"Breadcrumbs");function tl({i18n:i,logout:e,username:t,disabled:r=!1}){return u(fe,{children:[t&&u("span",{className:"uppy-ProviderBrowser-user",children:t},"username"),u("button",{type:"button",onClick:e,disabled:r,className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-userLogout",children:i("logOut")},"logout")]})}o(tl,"User");function il(i){let e=i.toolbarActions??[],t=i.busy??!1;return u("div",{className:"uppy-ProviderBrowser-header",children:u("div",{className:(0,Ld.default)("uppy-ProviderBrowser-headerBar",!i.showBreadcrumbs&&"uppy-ProviderBrowser-headerBar--simple"),children:[i.showBreadcrumbs&&u(el,{openFolder:i.openFolder,breadcrumbs:i.breadcrumbs,breadcrumbsIcon:i.pluginIcon?.(),title:i.title,i18n:i.i18n,disabled:t}),(e.length>0||i.selectionToggle)&&u("div",{className:"uppy-ProviderBrowser-toolbar",children:[i.selectionToggle&&u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-toolbarBtn",onClick:i.selectionToggle.onToggle,disabled:t,children:i.selectionToggle.active?i.i18n("cancelSelection"):i.i18n("selectMultiple")}),e.map(r=>u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-toolbarBtn",onClick:o(()=>i.runToolbarAction?.(r),"onClick"),disabled:t,children:r.label},r.id))]}),!i.standalone&&u(tl,{logout:i.logout,username:i.username,i18n:i.i18n,disabled:t})]})})}o(il,"Header");function mr(){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(mr,"defaultPickerIcon");var Bd=o(i=>({authenticated:void 0,partialTree:[{type:"root",id:i,cached:!1,nextPagePath:null}],currentFolderId:i,searchString:"",didFirstRender:!1,username:null,loading:!1,selectionActive:!1,detailItemId:void 0}),"getDefaultState");function rl(i,e){let t=[e],r=i.get(e.parentId);for(;r&&r.type!=="root";)t.push(r),r=i.get(r.parentId);return t}o(rl,"lineage");var Ye=class i{static{o(this,"ProviderView")}static VERSION=Lt.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,this.#u=new cs(e);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,zd.default)(this.#h,a,l)}resetPluginState(){this.#n.clear(),this.#u.cancel(),this.plugin.setPluginState(Bd(this.plugin.rootFolderId))}refreshCurrentFolder=o(async(e=!1)=>{let{partialTree:t,currentFolderId:r}=this.plugin.getPluginState();if(t==null||this.#s)return;let s=++this.#a,n=t.flatMap(b=>b.type!=="root"&&b.parentId===r&&b.status==="checked"?[b.id]:[]),a=new Map(t.map(b=>[b.id,b])),l=o(b=>rl(a,b).some(({parentId:k})=>k===r),"isInsideCurrent"),c=new Set(Xa(t,r).map(b=>b.id)),p=t.filter(b=>b.type==="root"||!l(b)).filter(b=>!e||c.has(b.id)).map(b=>(e||b.id===r)&&b.type!=="file"?{...b,status:"unchecked",cached:!1,nextPagePath:null}:b);this.plugin.setPluginState({partialTree:p}),await this.openFolder(r);let{partialTree:h,detailItemId:m}=this.plugin.getPluginState();if(h==null)return;let y=h.some(b=>b.id===r&&b.type!=="file"&&b.cached);s===this.#a&&y&&m&&!h.some(({id:b})=>b===m)&&this.closeItemDetail();let S=n.filter(b=>h.some(k=>k.type!=="root"&&k.id===b&&k.status!=="checked"));S.length>0&&this.plugin.setPluginState({partialTree:di.afterToggleCheckbox(h,S)})},"refreshCurrentFolder");runAction=o((e,t)=>this.#i(e,()=>e.run({item:t,...this.#t()})),"runAction");runToolbarAction=o(e=>this.#i(e,()=>e.run({currentFolderId:this.plugin.getPluginState().currentFolderId,...this.#t()})),"runToolbarAction");#t=o(()=>{let{uppy:e}=this.plugin;return{view:this,uppy:e,i18n:e.i18n}},"#actionContext");async#i({refresh:e},t){try{if(await t()===!1)return}catch(r){this.#r(r)}e!==!1&&await this.refreshCurrentFolder(!0)}#r(e){let{uppy:t}=this.plugin;if(bt(e)){t.log("[ProviderView] action cancelled","warning");return}t.log(`[ProviderView] action failed: ${ot(e)}`,"error");let r=e instanceof Error&&e.name==="UserFacingApiError"?$o(t.i18n,e):e instanceof Kt||kt(e)?t.i18n("companionError"):t.i18n("actionFailed");t.info(r,"error",5e3)}#s;async runWithProgress(e){try{await this.#c(async t=>{let r=this.#l;this.#s=()=>r?.abort(),this.setLoading(!0),await e({signal:t,setProgress:o(s=>this.setLoading(s),"setProgress")})})}finally{this.#s=void 0,this.setLoading(!1)}}toggleSelectionMode=o(()=>{let{selectionActive:e}=this.plugin.getPluginState();e&&this.cancelSelection(),this.plugin.setPluginState({selectionActive:!e})},"toggleSelectionMode");#o;#a=0;openItemDetail=o(e=>{this.#o=e,this.plugin.setPluginState({detailItemId:e.id})},"openItemDetail");closeItemDetail=o(()=>{this.plugin.setPluginState({detailItemId:void 0})},"closeItemDetail");#n=new Set;getBulkActionItems=o(()=>{let{partialTree:e}=this.plugin.getPluginState(),t=new Map(e.map(n=>[n.id,n])),r=e.filter(n=>n.type!=="root"&&n.status==="checked"&&(n.type==="file"||rl(t,n).some(({id:a})=>this.#n.has(a)))),s=new Set(r.map(n=>n.id));return r.filter(n=>!rl(t,n).slice(1).some(({id:a})=>s.has(a)))},"getBulkActionItems");runBulkAction=o(e=>this.#i(e,async()=>{let t=this.getBulkActionItems();if(t.length===0)return!1;let r=await e.run({items:t,...this.#t()});return r!==!1&&this.cancelSelection(),r}),"runBulkAction");#u;prompt(e){return this.#u.prompt(e)}confirm(e){return this.#u.confirm(e)}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}get isLoading(){return this.plugin.getPluginState().loading}cancelSelection(){this.#n.clear();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})}#l;async#c(e){this.#l?.abort();let t=new AbortController;this.#l=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.#l===t&&(this.#l=void 0),this.plugin.uppy.off("dashboard:close-panel",r),this.plugin.uppy.off("cancel-all",r)}}#p(){this.#s===void 0&&this.setLoading(!1)}async#h(){let{partialTree:e,currentFolderId:t,searchString:r}=this.plugin.getPluginState(),s=e.find(n=>n.id===t);if(r.trim()===""){this.#l?.abort(),this.clearSearchState();return}this.setLoading(!0),await this.#c(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(k=>k.length>0),S=this.plugin.rootFolderId,b;y.forEach((k,A,j)=>{let R=y.slice(0,A+1),T=encodeURIComponent(`/${R.join("/")}`),M=p.find(G=>G.id===T&&G.type!=="root");if(M){S=T,b=M.status==="checked";return}let $=A===j.length-1,L,J=b?"checked":"unchecked";if($)if(h.isFolder)L={type:"folder",id:T,cached:!1,nextPagePath:null,status:J,parentId:S,data:h};else{let G=this.validateSingleFile(h);L={type:"file",id:T,restrictionError:G,status:G?"unchecked":J,parentId:S,data:h}}else L={type:"folder",id:T,cached:!1,nextPagePath:null,status:J,parentId:S,data:{name:decodeURIComponent(k),icon:"folder",isFolder:!0}};p.push(L),S=T,b=J==="checked"})}this.plugin.setPluginState({partialTree:p,searchResults:l.map(h=>h.requestPath)})}).catch(jt(this.plugin.uppy)),this.#p()}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.#c(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=di.afterOpenFolder(t,a,r,n,this.validateSingleFile);this.plugin.setPluginState({partialTree:l,currentFolderId:e,searchString:""})}).catch(jt(this.plugin.uppy)),this.#p()}async logout(){this.#n.clear(),await this.#c(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({...Bd(this.plugin.rootFolderId),authenticated:!1})}}).catch(jt(this.plugin.uppy))}async handleAuth(e){await this.#c(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(jt(this.plugin.uppy)),this.#p()}async handleScroll(e){Zo(e)&&await this.loadNextPage()}#d;loadNextPage(){return this.#d||(this.#d=this.#g().finally(()=>{this.#d=void 0})),this.#d}async#g(){let{partialTree:e,currentFolderId:t}=this.plugin.getPluginState(),r=e.find(s=>s.id===t);if(r&&r.type!=="file"&&r.nextPagePath){let s=r.nextPagePath,n=!1;return this.isHandlingScroll=!0,await this.#c(async a=>{let{nextPagePath:l,items:c}=await this.provider.list(s,{signal:a}),p=this.plugin.getPluginState();if(a.aborted||p.currentFolderId!==t)return;let h=di.afterScrollFolder(p.partialTree,t,c,l,this.validateSingleFile);this.plugin.setPluginState({partialTree:h}),n=!0}).catch(jt(this.plugin.uppy)),this.isHandlingScroll=!1,n}return!1}validateSingleFile=o(e=>{let t=nr(e);return this.plugin.uppy.validateSingleFile(t)},"validateSingleFile");async donePicking(){let{partialTree:e}=this.plugin.getPluginState();this.isLoading||(this.setLoading(!0),await this.#c(async t=>{let r=await di.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=Yo(r);Xo(n,this.plugin,this.provider),this.resetPluginState()}).catch(jt(this.plugin.uppy)),this.#p())}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=Ko(e.id,this.getDisplayedPartialTree(),t,this.previousCheckbox),n=di.afterToggleCheckbox(r,s),a=new Map(n.map(l=>[l.id,l.type==="root"?void 0:l.status]));for(let l of s)a.get(l)==="checked"&&this.#n.add(l);for(let l of this.#n){let c=a.get(l);(c===void 0||c==="unchecked")&&this.#n.delete(l)}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 Xa(e,t)},"getBreadcrumbs");getSelectedAmount=o(()=>{let{partialTree:e}=this.plugin.getPluginState();return Go(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");#f(){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||mr;if(a===!1)return u(as,{pluginName:this.plugin.title,pluginIcon:c,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18n,renderForm:n.renderAuthForm,loading:l});let{partialTree:p,currentFolderId:h,username:m,searchString:y,searchResults:S,dialog:b,selectionActive:k=!1,detailItemId:A}=this.plugin.getPluginState(),j=this.getBreadcrumbs(),R=n.mode==="manager",T=!R||k,M=this.#s!==void 0,$=p.find(({id:G})=>G===h),L=$?.type!=="file"&&$?.cached===!0&&!p.some(G=>G.type!=="root"&&G.parentId===h);A&&(this.#o=p.find(G=>G.type!=="root"&&G.id===A)??this.#o);let J=this.#o?.id===A?this.#o:void 0;return u("div",{className:(0,jd.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${n.viewType}`),children:[u(il,{showBreadcrumbs:n.showBreadcrumbs,openFolder:this.openFolder,breadcrumbs:j,pluginIcon:c,title:this.plugin.title,logout:this.logout,username:m,i18n:s,toolbarActions:n.toolbarActions??[],runToolbarAction:this.runToolbarAction,standalone:n.standalone??!1,selectionToggle:R&&(n.bulkActions?.length??0)>0&&(k||!L)?{active:k,onToggle:this.toggleSelectionMode}:void 0,busy:M}),n.showFilter&&u(pr,{value:y,onChange:o(G=>this.onSearchInput(G),"onChange"),onSubmit:o(()=>{},"onSubmit"),inputLabel:s("filter"),i18n:s,disabled:M}),S?this.#f():u(Wo,{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,onCancelLoading:this.#s,utmSource:"Companion",actions:n.actions??[],runAction:this.runAction,selectable:T,onFileClick:R&&!k?this.openItemDetail:void 0}),M?null:R?k&&u(Va,{selectedCount:this.getBulkActionItems().length,bulkActions:n.bulkActions??[],runBulkAction:this.runBulkAction,i18n:s}):u(us,{partialTree:p,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:s,validateAggregateRestrictions:this.validateAggregateRestrictions}),J&&u(Wa,{item:J,actions:n.actions??[],runAction:this.runAction,getPreviewUrl:n.getPreviewUrl,onClose:this.closeItemDetail,i18n:s},J.id),b&&u(Ga,{dialog:b,i18n:s,onConfirm:this.#u.submit,onCancel:this.#u.cancel},this.#u.revision)]})}};var Hd=ce(Me(),1);function S0({value:i,onChange:e,onSubmit:t,inputLabel:r,loading:s=!1,children:n}){let{formId:a}=cr(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(S0,"SearchView");var en=S0;var x0={loading:!1,searchString:"",partialTree:[{type:"root",id:null,cached:!1,nextPagePath:null}],currentFolderId:null,isInputMode:!0},_0={viewType:"grid",showTitles:!0,showFilter:!0,utmSource:"Companion"},hi=class{static{o(this,"SearchProviderView")}static VERSION=Lt.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider,this.opts={..._0,...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(x0)}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){jt(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(Zo(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){jt(this.plugin.uppy)(n)}this.isHandlingScroll=!1}}async donePicking(){let{partialTree:e}=this.plugin.getPluginState(),t=Yo(e);Xo(t,this.plugin,this.provider),this.resetPluginState()}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=Ko(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=di.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}validateSingleFile=o(e=>{let t=nr(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(en,{value:s,onChange:this.setSearchString,onSubmit:this.search,inputLabel:l("enterTextToSearch"),children:l("searchImages")}):u("div",{className:(0,Hd.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${c.viewType}`),children:[c.showFilter&&u(pr,{value:s,onChange:this.setSearchString,onSubmit:this.search,inputLabel:l("search"),i18n:l}),u(Wo,{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(us,{partialTree:a,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:l,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};var qd={name:"@uppy/audio",description:"Uppy plugin that records audio using the device\u2019s microphone.",version:"4.0.1",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:{"@uppy-dev/tsconfig":"workspace:^","@vitest/browser-playwright":"^4.1.11",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.11"},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 $d={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 Vd=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 Wd=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 Gd(i){return typeof i=="function"}o(Gd,"isFunction");function hs(i){return Gd(i)?i():i}o(hs,"result");var fs=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=hs(r.width)||this.canvas.width,this.height=hs(r.height)||this.canvas.height,this.canvas.width=this.width,this.canvas.height=this.height,this.canvasContext=this.canvas.getContext("2d"),this.canvasContext.fillStyle=hs(s.fillStyle)||"rgb(255, 255, 255)",this.canvasContext.strokeStyle=hs(s.strokeStyle)||"rgb(0, 0, 0)",this.canvasContext.lineWidth=hs(s.lineWidth)||1,this.onDrawFrame=Gd(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 m=t[p]/128*(a/2);p===0?s.moveTo(c,m):s.lineTo(c,m),c+=l}s.lineTo(n,a/2),s.stroke(),this.onDrawFrame(this),requestAnimationFrame(this.#e)}#e=o(()=>this.draw(),"#draw")};function P0({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(P0,"DiscardButton");var Xd=P0;function ol({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(ol,"RecordButton");function nl(i){return`${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`}o(nl,"formatSeconds");function al({recordingLengthSeconds:i}){let e=nl(i);return u("span",{children:e})}o(al,"RecordingLength");function T0({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(T0,"SubmitButton");var Kd=T0;function ll(i){let{stream:e,recordedAudio:t,onStop:r,recording:s,supportsRecording:n,audioSources:a,showAudioSourceDropdown:l,onSubmit:c,i18n:p,onStartRecording:h,onStopRecording:m,onDiscardRecordedAudio:y,recordingLengthSeconds:S}=i,b=we(null),k=we();xe(()=>()=>{k.current=null,r()},[r]),xe(()=>{if(!t&&(k.current=new fs(b.current,{canvas:{width:600,height:600},canvasContext:{lineWidth:2,fillStyle:"rgb(0,0,0)",strokeStyle:"green"}}),k.current.draw(),e)){let M=new AudioContext().createMediaStreamSource(e);k.current.addSource(M)}},[t,e]);let A=t!=null,j=!A&&n,R=l&&!A&&a&&a.length>1;return u("div",{className:"uppy-Audio-container",children:[u("div",{className:"uppy-Audio-audioContainer",children:A?u("audio",{className:"uppy-Audio-player",controls:!0,src:t}):u("canvas",{ref:b,className:"uppy-Audio-canvas"})}),u("div",{className:"uppy-Audio-footer",children:[u("div",{className:"uppy-Audio-audioSourceContainer",children:R?Wd(i):null}),u("div",{className:"uppy-Audio-buttonContainer",children:[j&&u(ol,{recording:s,onStartRecording:h,onStopRecording:m,i18n:p}),A&&u(Kd,{onSubmit:c,i18n:p}),A&&u(Xd,{onDiscard:y,i18n:p})]}),u("div",{className:"uppy-Audio-recordingLength",children:!A&&u(al,{recordingLengthSeconds:S})})]})]})}o(ll,"RecordingScreen");function ul(){return typeof MediaRecorder=="function"&&typeof MediaRecorder.prototype?.start=="function"}o(ul,"supportsMediaRecorder");var ms=class extends le{static{o(this,"Audio")}static VERSION=qd.version;#e;icon;#t=null;#i=!1;#r=null;#s=null;#o=null;#a;#n;constructor(e,t){super(e,t),this.#a=navigator.mediaDevices,this.#n=this.#a!=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=$d,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.#a?this.#a.enumerateDevices().then(e=>e.some(t=>t.kind==="audioinput")):Promise.resolve(!1)}#l=o(e=>this.#n?(this.#i=!0,this.#u().then(t=>(this.setPluginState({hasAudio:t}),this.#a.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(ot(r),"error")})))):Promise.reject(new Error("Microphone access not supported")),"#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){nt(r)||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){nt(e)||this.uppy.log(e,"warning")}},"#submit");#g=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=Tt(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)}#y=o(e=>{this.#g(),this.#l({deviceId:e})},"#changeSource");#m=o(()=>{this.#a.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(Vd,{icon:this.icon,i18n:this.i18n,hasAudio:e.hasAudio}):u(ll,{...e,onChangeSource:this.#y,onStartRecording:this.#c,onStopRecording:this.#p,onDiscardRecordedAudio:this.#h,onSubmit:this.#d,onStop:this.#g,i18n:this.i18n,showAudioSourceDropdown:this.opts.showAudioSourceDropdown,supportsRecording:ul(),recording:e.isRecording,stream:this.#t})}install(){this.setPluginState({audioReady:!1,recordingLengthSeconds:0});let{target:e}=this.opts;e&&this.mount(e,this),this.#a&&(this.#m(),this.#a.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.#g(),this.#l())}})}uninstall(){this.#t&&this.#g(),this.unmount()}};var Yd={name:"@uppy/aws-s3",description:"Upload to Amazon S3 with Uppy",version:"6.2.2",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-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^","@vitest/browser-playwright":"^4.1.11",playwright:"1.61.1",typescript:"^6.0.3",vitest:"^4.1.11"},peerDependencies:{"@uppy/core":"workspace:^"}};var F0=1024*1024,C0=5*F0,cl=1e4,gs=class{static{o(this,"S3Uploader")}#e;#t;#i;#r;#s=[];#o=[];#a=!1;#n;#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 Nt(e.uppy);let t=e.file.s3Multipart;t&&(this.#t=t.key,this.#n=t.uploadId,this.#u=!0);let r=e.file.data.size;if(this.#a=!!t||this.#i.shouldUseMultipart===!0&&r>0,this.#a){let n=this.#c(r);n=Math.max(n,C0),Math.ceil(r/n)>cl&&(n=Math.ceil(r/cl));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/cl)}async start(){this.#l?.abort(),this.#l=new AbortController;let e=this.#l.signal;try{let t=this.#n;this.#u&&t?await this.#h(t,e):(this.#u=!0,this.#a?await this.#g(e):await this.#d(e))}catch(t){this.#b(Ne(t))}}#p(){this.#l?.abort()}abort(e){if(this.#l?.abort(),this.#r.remove(),e?.abortInS3!==!1&&this.#n){if(!this.#t)throw new Error("Missing S3 object key for aborting upload");this.#i.s3Client.abortMultipartUpload({key:this.#t,uploadId:this.#n}).catch(t=>{this.#i.log?.(t,"warning")})}this.#t=void 0,this.#n=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.#y(),await this.#f(t)}async#d(e){let{location:t,key:r}=await this.#i.s3Client.putObject({key:this.#i.requestedKey,data:this.#e,fileType:this.#i.file.type||"application/octet-stream",metadata:this.#i.metadata,onProgress:o(s=>{this.#o[0].uploaded=s,this.#y()},"onProgress"),signal:e});this.#m({location:t,key:r})}async#g(e){let{uploadId:t,key:r}=await this.#i.s3Client.createMultipartUpload({key:this.#i.requestedKey,fileType:this.#i.file.type||"application/octet-stream",metadata:this.#i.metadata,signal:e});this.#t=r,this.#n=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.#n,data:c,partNumber:l,onProgress:o(m=>{this.#o[p].uploaded=m,this.#y()},"onProgress"),signal:e});this.#o[n].uploaded=a.size,this.#o[n].etag=h,this.#y(),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.#n,parts:t,signal:e});this.#m({location:r,key:s,uploadId:this.#n})}#y(){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 pl="AWS4-HMAC-SHA256",tn="aws4_request";var dl="UNSIGNED-PAYLOAD",gr="application/octet-stream",Jd="application/xml";var lt="[s3mini] ",Qd=`${lt}endpoint must be a non-empty string`,Zd=`${lt}endpoint must be a valid URL. Expected format: https://<host>[:port][/base-path]`,eh=`${lt}key must be a non-empty string`,yr=`${lt}uploadId must be a non-empty string`;var fl=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,headers:l}){if(n?.aborted)throw new DOMException("Request aborted","AbortError");return qr(e,{method:t,body:["GET","HEAD"].includes(t)?void 0:r,headers:{...a?{"Content-Type":a}:{},...l},signal:n,timeout:this.requestAbortTimeout,retries:3,shouldRetry:o(c=>!(this.isOffline()||c.status>=400&&c.status<500&&c.status!==429),"shouldRetry"),onUploadProgress:o(c=>{c.lengthComputable&&s&&s(c.loaded,c.total)},"onUploadProgress")})}},rn=fl;var gl=o(i=>i.replace(/^(&quot;|&#34;)+|(&quot;|&#34;)+$/g,""),"sanitizeXmlETag"),vr=o(i=>i?.replace(/^"+|"+$/g,""),"sanitizeETag");function rh(i){let e=new URL(i);return e.search="",e.hash="",e.href}o(rh,"removeQueryString");var ml=new TextEncoder,th="0123456789abcdef",yl=o(i=>{let e=new Uint8Array(i),t="";for(let r of e)t+=th[r>>4]+th[r&15];return t},"hexFromBuffer"),sh=o(async i=>{let e=ml.encode(i);return await globalThis.crypto.subtle.digest("SHA-256",e)},"sha256"),br=o(async(i,e)=>{let t=await globalThis.crypto.subtle.importKey("raw",typeof i=="string"?ml.encode(i):i,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),r=ml.encode(e);return await globalThis.crypto.subtle.sign("HMAC",t,r)},"hmac"),R0={"&quot;":'"',"&apos;":"'","&lt;":"<","&gt;":">","&amp;":"&"},ih=o(i=>i.replaceAll(/&(quot|apos|lt|gt|amp);/g,e=>R0[e]??e),"unescapeXml"),Oi=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?Oi(a):ih(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:ih(e.trim())},"parseXml"),A0=o(i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`,"encodeAsHex"),I0=o(i=>encodeURIComponent(i).replace(/[!'()*]/g,A0),"uriEscape"),oh=o(i=>I0(i).replaceAll("%2F","/"),"uriResourceEscape"),sn=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}},on=class extends sn{static{o(this,"S3NetworkError")}},nn=class extends sn{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 bl=class extends rn{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=gr,metadata:s={},onProgress:n,signal:a}){let l=new URLSearchParams({filename:e,type:r,...Object.fromEntries(Object.entries(s).map(([S,b])=>[`metadata[${S}]`,String(b)]))}),c=await this._fetch(`/params?${l}`),{url:p,fields:h}=await c.json(),m=new FormData;Object.entries(h).forEach(([S,b])=>{m.set(S,b)}),m.set("file",t);let y=await this._request({url:p,method:"POST",data:m,onProgress:n,signal:a});return{location:`${p}${h.key}`,etag:vr(y.getResponseHeader("etag")),key:h.key}}async createMultipartUpload({key:e,fileType:t=gr,metadata:r,signal:s}){if(typeof t!="string")throw new TypeError(`${lt}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=vr(p.getResponseHeader("etag"));if(h==null)throw new Error(`${lt}Missing ETag in uploadPart response headers`);return{etag:h}}async listParts({uploadId:e,key:t,signal:r}){if(!e)throw new TypeError(yr);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})}},nh=bl;var U0=3600;function D0(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 m=await br(`AWS4${t}`,h),y=await br(m,s),S=await br(y,a);return br(S,tn)}return o(p,"getSignatureKey"),o(async function(m){let{method:y,key:S,expiresIn:b=U0}=m,k=new URL(n),A=S?S.replace(/^\/+/,""):"",j=A?oh(A):"",R=k.pathname;j&&(R=R.endsWith("/")?`${R}${j}`:`${R}/${j}`);let T=new Date,M=T.toISOString().slice(0,10).replace(/-/g,""),$=`${M}T${T.toISOString().slice(11,19).replace(/:/g,"")}Z`,L=`${e}/${M}/${s}/${a}/${tn}`;k.searchParams.set("X-Amz-Algorithm",pl),k.searchParams.set("X-Amz-Content-Sha256",dl),k.searchParams.set("X-Amz-Credential",L),k.searchParams.set("X-Amz-Date",$),k.searchParams.set("X-Amz-Expires",String(b)),k.searchParams.set("X-Amz-SignedHeaders","host"),r&&k.searchParams.set("X-Amz-Security-Token",r),"uploadId"in m&&k.searchParams.set("uploadId",m.uploadId),"partNumber"in m&&k.searchParams.set("partNumber",String(m.partNumber)),y==="POST"&&!("uploadId"in m)&&k.searchParams.set("uploads",""),k.searchParams.sort();let J=k.searchParams.toString().replace(/\+/g,"%20"),G=`host:${k.host}`,ie=[y,R,J,G,"","host",dl].join(`
`),oe=`${M}/${s}/${a}/${tn}`,Ie=[pl,$,oe,yl(await sh(ie))].join(`
`);(M!==l||!c)&&(l=M,c=await p(M));let be=yl(await br(c,Ie));return{url:`${k.origin}${R}?${J}&X-Amz-Signature=${be}`}},"presign")}o(D0,"createSigV4Presigner");var ah=D0;var wl=class extends rn{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(Qd);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 ah({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=`${Zd} But provided: "${e}"`;throw new TypeError(r)}}_checkKey(e){if(typeof e!="string"||e.trim().length===0)throw new TypeError(eh)}_validateUploadPartParams(e,t,r){if(this._checkKey(e),typeof t!="string"||t.trim().length===0)throw new TypeError(yr);if(!Number.isInteger(r)||r<=0)throw new TypeError(`${lt}partNumber must be a positive integer`)}async putObject({key:e,data:t,fileType:r=gr,onProgress:s,signal:n}){this._checkKey(e);let{xhr:a,url:l,resolvedKey:c}=await this.request({request:{method:"PUT",key:e},data:t,onProgress:s,signal:n,contentType:r});return{location:rh(l),etag:vr(a.getResponseHeader("etag")),key:c}}async createMultipartUpload({key:e,fileType:t=gr,signal:r}){if(this._checkKey(e),typeof t!="string")throw new TypeError(`${lt}fileType must be a string`);let{xhr:s,resolvedKey:n}=await this.request({request:{method:"POST",key:e},contentType:t,signal:r}),a=Oi(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(`${lt}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=vr(l.getResponseHeader("etag"));if(c==null)throw new Error(`${lt}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 l=e.key,{url:c,key:p,headers:h}=await this.signRequest(e),m=await this.xhr({url:c,method:e.method,data:t,onProgress:r,signal:s,contentType:n,headers:h}),y=p?.trim()?p:l;return{xhr:m,url:c,resolvedKey:y}}catch(l){if(l instanceof Error&&"request"in l&&l.request instanceof XMLHttpRequest){let c=l.request;if(c.status===0)throw new on("Network error during S3 request","NETWORK",l);let p=this._parseErrorXml(m=>c.getResponseHeader(m),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 nn(`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(yr);let{xhr:s}=await this.request({request:{method:"GET",key:t,uploadId:e},signal:r}),n=Oi(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:gl(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:Jd,data:n,signal:s}),l=Oi(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,m=p.Bucket||p.bucket,y=p.Key||p.key,S=p.ETag||p.eTag||p.etag;if(!h||!y)throw new Error(`${lt}CompleteMultipartUpload response missing Location or Key: ${JSON.stringify(p)}`);let b=S?gl(S):void 0;return{location:h,bucket:m,key:y,etag:b}}}throw new Error(`${lt}Failed to complete multipart upload: ${JSON.stringify(l)}`)}async abortMultipartUpload({key:e,uploadId:t,signal:r}){if(this._checkKey(e),!t)throw new TypeError(yr);let{xhr:s}=await this.request({request:{method:"DELETE",key:e,uploadId:t},signal:r}),n=Oi(s.responseText);if(n&&"error"in n&&typeof n.error=="object"&&n.error!==null&&"message"in n.error)throw new Error(`${lt}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(`${lt}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=Oi(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 Sl=wl;var lh=1024*1024,M0={shouldUseMultipart:o(i=>(i.size||0)>100*lh,"shouldUseMultipart"),allowedMetaFields:!0,limit:6},an=class extends ke{static{o(this,"AwsS3")}static VERSION=Yd.version;#e;#t;#i={};constructor(e,t){super(e,{...M0,...t}),this.type="uploader",this.id=this.opts.id||"AwsS3"}install(){this.#r(!0),this.#o(),this.#t=new Fi({concurrency:this.opts.limit}),this.uppy.addUploader(this.#a),this.uppy.on("cancel-all",this.#s)}uninstall(){this.#r(!1),this.uppy.removeUploader(this.#a),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 nh({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 Sl({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 Sl({signRequest:this.opts.signRequest})}else throw new TypeError("One of options `companionEndpoint`, `signRequest`, or `getCredentials` is required")}#a=o(async e=>{if(e.length===0)return;let t=this.uppy.getFilesByIds(e),r=Pi(t),s=Ti(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.#n(l)}));await Promise.allSettled(n),this.#r(!0)},"#upload");async#n(e){try{return await new Promise((t,r)=>{let s=new gs({uppy:this.uppy,s3Client:this.#e,file:e,metadata:this.#c(e),requestedKey: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*lh}#l(e){return"companionEndpoint"in this.opts?e.name:this.opts.generateObjectKey?.(e)??`${crypto.randomUUID()}-${e.name}`}#c(e){let t=Yt(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 uh={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-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^",typescript:"^6.0.3"}};var ch={strings:{pluginNameBox:"Box"}};var Ui=class extends le{static{o(this,"Box")}static VERSION=uh.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||Ue,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=Ze(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new et(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=ch,this.i18nInit(),this.title=this.i18n("pluginNameBox"),this.render=this.render.bind(this)}install(){this.view=new Ye(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 hh=ce(ph(),1);var dh={strings:{compressingImages:"Compressing images...",compressedX:"Saved %{size} by compressing images"}};var B0={quality:.6,limit:10},ln=class extends ke{static{o(this,"Compressor")}#e;constructor(e,t){super(e,{...B0,...t}),this.id=this.opts.id||"Compressor",this.type="modifier",this.defaultLocale=dh,this.#e=new Jt(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 hh.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 ${Ke(c)}`),t+=c;let{name:p,type:h,size:m}=l,y=Rt(p),b=`${Rt(a.meta.name).name}.${y.extension}`;this.uppy.setFileState(a.id,{...p&&{name:p},...y.extension&&{extension:y.extension},...h&&{type:h},...m&&{size:m},data:l,meta:{...a.meta,type:h,name:b}}),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:Ke(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 xh=typeof self<"u"?self:global,ws=typeof navigator<"u",j0=ws&&typeof HTMLImageElement>"u",fh=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),_h=xh.Buffer,Eh=!!_h,z0=o(i=>i!==void 0,"h");function Ph(i){return i===void 0||(i instanceof Map?i.size===0:Object.values(i).filter(z0).length===0)}o(Ph,"f");function Je(i){let e=new Error(i);throw delete e.stack,e}o(Je,"l");function mh(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(mh,"o");var El=o(i=>String.fromCharCode.apply(null,i),"u"),gh=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0,Ni=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&&Je("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 Je("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||Je("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),gh?gh.decode(s):Eh?Buffer.from(s).toString("utf8"):decodeURIComponent(escape(El(s)));var s}getLatin1String(e=0,t=this.byteLength){let r=this.getUint8Array(e,t);return El(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 El(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 Tl(i,e){Je(`${i} '${e}' was not loaded, try using full build of exifr.`)}o(Tl,"p");var Ss=class extends Map{static{o(this,"g")}constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||Tl(this.kind,e),t&&(e in t||(function(r,s){Je(`Unknown ${r} '${s}'.`)})(this.kind,e),t[e].enabled||Tl(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}},hn=new Ss("file parser"),wt=new Ss("segment parser"),Es=new Ss("file reader"),H0=xh.fetch;function yh(i,e){return(t=i).startsWith("data:")||t.length>1e4?Fl(i,e,"base64"):fh&&i.includes("://")?kl(i,e,"url",un):fh?Fl(i,e,"fs"):ws?kl(i,e,"url",un):void Je("Invalid input argument");var t}o(yh,"k");async function kl(i,e,t,r){return Es.has(t)?Fl(i,e,t):r?(async function(s,n){let a=await n(s);return new Ni(a)})(i,r):void Je(`Parser ${t} is not loaded`)}o(kl,"O");async function Fl(i,e,t){let r=new(Es.get(t))(i,e);return await r.read(),r}o(Fl,"v");var un=o(i=>H0(i).then((e=>e.arrayBuffer())),"S"),xs=o(i=>new Promise(((e,t)=>{let r=new FileReader;r.onloadend=()=>e(r.result||new ArrayBuffer),r.onerror=t,r.readAsArrayBuffer(i)})),"A"),Cl=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 Th(i,e,t){let r=new Cl;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(Th,"x");function kh(i,e,t){let r,s=i.get(e);for(r of t)s.set(r[0],r[1])}o(kh,"C");var Ps=new Map,Ul=new Map,Dl=new Map,wr=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],fn=["jfif","xmp","icc","iptc","ihdr"],_s=["tiff",...fn],He=["ifd0","ifd1","exif","gps","interop"],Sr=[..._s,...He],xr=["makerNote","userComment"],mn=["translateKeys","translateValues","reviveValues","multiSegment"],_r=[...mn,"sanitize","mergeOutput","silentErrors"],cn=class{static{o(this,"_")}get translate(){return this.translateKeys||this.translateValues||this.reviveValues}},Di=class extends cn{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=He.includes(e),this.canBeFiltered&&(this.dict=Ps.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:Je(`Invalid options argument: ${r}`)}applyInheritables(e){let t,r;for(t of mn)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,pn(this.pick,this.deps)):this.enabled&&this.pick.size>0&&pn(this.pick,this.deps)}},dt={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},vh=new Map,Mi=class extends cn{static{o(this,"R")}static useCached(e){let t=vh.get(e);return t!==void 0||(t=new this(e),vh.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):Je(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=ws?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of wr)this[e]=dt[e];for(e of _r)this[e]=dt[e];for(e of xr)this[e]=dt[e];for(e of Sr)this[e]=new Di(e,dt[e],void 0,this)}setupFromTrue(){let e;for(e of wr)this[e]=dt[e];for(e of _r)this[e]=dt[e];for(e of xr)this[e]=!0;for(e of Sr)this[e]=new Di(e,!0,void 0,this)}setupFromArray(e){let t;for(t of wr)this[t]=dt[t];for(t of _r)this[t]=dt[t];for(t of xr)this[t]=dt[t];for(t of Sr)this[t]=new Di(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,He)}setupFromObject(e){let t;for(t of(He.ifd0=He.ifd0||He.image,He.ifd1=He.ifd1||He.thumbnail,Object.assign(this,e),wr))this[t]=Pl(e[t],dt[t]);for(t of _r)this[t]=Pl(e[t],dt[t]);for(t of xr)this[t]=Pl(e[t],dt[t]);for(t of _s)this[t]=new Di(t,dt[t],e[t],this);for(t of He)this[t]=new Di(t,dt[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,He,Sr),e.tiff===!0?this.batchEnableWithBool(He,!0):e.tiff===!1?this.batchEnableWithUserValue(He,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,He):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,He)}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=bh(e,r);for(let[a,l]of n)pn(this[a].pick,l),this[a].enabled=!0}else if(t&&t.length){let n=bh(t,r);for(let[a,l]of n)pn(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=He.some((n=>this[n].enabled===!0))||this.makerNote||this.userComment;for(let n of He)this[n].finalizeFilters()}get onlyTiff(){return!fn.map((e=>this[e].enabled)).some((e=>e===!0))&&this.tiff.enabled}checkLoadedPlugins(){for(let e of _s)this[e].enabled&&!wt.has(e)&&Tl("segment parser",e)}};function bh(i,e){let t,r,s,n,a=[];for(s of e){for(n of(t=Ps.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(bh,"K");function Pl(i,e){return i!==void 0?i:e!==void 0?e:void 0}o(Pl,"W");function pn(i,e){for(let t of e)i.add(t)}o(pn,"X");ve(Mi,"default",dt);var Er=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=Mi.useCached(e)}async read(e){this.file=await(function(t,r){return typeof t=="string"?yh(t,r):ws&&!j0&&t instanceof HTMLImageElement?yh(t.src,r):t instanceof Uint8Array||t instanceof ArrayBuffer||t instanceof DataView?new Ni(t):ws&&t instanceof Blob?kl(t,r,"blob",xs):void Je("Invalid input argument")})(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[r,s]of hn)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(),Je("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),Ph(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=wt.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 Fh(i,e){let t=new Er(e);return await t.read(i),t.parse()}o(Fh,"Y");var q0=Object.freeze({__proto__:null,parse:Fh,Exifr:Er,fileParsers:hn,segmentParsers:wt,fileReaders:Es,tagKeys:Ps,tagValues:Ul,tagRevivers:Dl,createDictionary:Th,extendDictionary:kh,fetchUrlAsArrayBuffer:un,readBlobAsArrayBuffer:xs,chunkedProps:wr,otherSegments:fn,segments:_s,tiffBlocks:He,segmentsAndBlocks:Sr,tiffExtractables:xr,inheritables:mn,allFormatters:_r,Options:Mi}),fi=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 Mi({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof Ni?e:new Ni(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=Dl.get(t),s=Ul.get(t),n=Ps.get(t),a=this.options[t],l=a.reviveValues&&!!r,c=a.translateValues&&!!s,p=a.translateKeys&&!!n,h={};for(let[m,y]of e)l&&r.has(m)?y=r.get(m)(y):c&&s.has(m)&&(y=this.translateValue(y,s.get(m))),p&&n.has(m)&&(m=n.get(m)||m),h[m]=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(fi,"headerLength",4),ve(fi,"type",void 0),ve(fi,"multiSegment",!1),ve(fi,"canHandle",(()=>!1));function $0(i){return i===192||i===194||i===196||i===219||i===221||i===218||i===254}o($0,"q");function V0(i){return i>=224&&i<=239}o(V0,"Q");function W0(i,e,t){for(let[r,s]of wt)if(s.canHandle(i,e,t))return r}o(W0,"Z");var dn=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){Je(`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):Je("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(wt.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(wt.keyList())):(e=e===void 0?wt.keyList().filter((t=>this.options[t].enabled)):e.filter((t=>this.options[t].enabled&&wt.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=wt.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:m,remaining:y,options:S}=this;for(;e<t;e++)if(p.getUint8(e)===255){if(r=p.getUint8(e+1),V0(r)){if(s=p.getUint16(e+2),n=W0(p,e,s),n&&m.has(n)&&(a=wt.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=fi.findPosition(p,e),l.marker=r,this.unknownSegments.push(l)),e+=s+1}else if($0(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=wt.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(dn,"type","jpeg"),hn.set("jpeg",dn);var G0=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4],Rl=class extends fi{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=G0[n];if(l*a<=4?e+=8:e=s.getUint32(e+8),(n<1||n>13)&&Je(`Invalid TIFF value type. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e}`),e>s.byteLength&&Je(`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(m){switch(m){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 m=0;m<a;m++)p[m]=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:Je(`Invalid tiff type ${e}`)}}},bs=class extends Rl{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&&Je("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&Je(`IFD0 offset points to outside of file.
this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,mh(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,mh(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",wh(...e.get(2),e.get(1))),e.set("longitude",wh(...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 He)if(e=this[t],!Ph(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 wh(i,e,t,r){var s=i+e/60+t/3600;return r!=="S"&&r!=="W"||(s*=-1),s}o(wh,"ne");ve(bs,"type","tiff"),ve(bs,"headerLength",10),wt.set("tiff",bs);var e4=Object.freeze({__proto__:null,default:q0,Exifr:Er,fileParsers:hn,segmentParsers:wt,fileReaders:Es,tagKeys:Ps,tagValues:Ul,tagRevivers:Dl,createDictionary:Th,extendDictionary:kh,fetchUrlAsArrayBuffer:un,readBlobAsArrayBuffer:xs,chunkedProps:wr,otherSegments:fn,segments:_s,tiffBlocks:He,segmentsAndBlocks:Sr,tiffExtractables:xr,inheritables:mn,allFormatters:_r,Options:Mi,parse:Fh}),Nl={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1},t4=Object.assign({},Nl,{firstChunkSize:4e4,gps:[1,2,3,4]});var i4=Object.assign({},Nl,{tiff:!1,ifd1:!0,mergeOutput:!1});var X0=Object.assign({},Nl,{firstChunkSize:4e4,ifd0:[274]});async function K0(i){let e=new Er(X0);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}o(K0,"ce");var Y0=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}}),ys=!0,vs=!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;ys=Number(t)+.1*Number(r)<13.4,vs=!1}}else if(i.includes("OS X 10")){let[,e]=i.match(/OS X 10[_.](\d+)/);ys=vs=Number(e)<15}if(i.includes("Chrome/")){let[,e]=i.match(/Chrome\/(\d+)/);ys=vs=Number(e)<81}else if(i.includes("Firefox/")){let[,e]=i.match(/Firefox\/(\d+)/);ys=vs=Number(e)<77}}async function Ch(i){let e=await K0(i);return Object.assign({canvas:ys,css:vs},Y0[e])}o(Ch,"ye");var Al=class extends Ni{static{o(this,"be")}constructor(...e){super(...e),ve(this,"ranges",new Il),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=Eh?_h.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)}},Il=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=>Sh(e,a.offset,s)||Sh(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 Sh(i,e,t){return i<=e&&e<=t}o(Sh,"ke");var Ol=class extends Al{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(){}};Es.set("blob",class extends Ol{async readWhole(){this.chunked=!1;let i=await xs(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 xs(r);return this.set(s,i,!0)}});var Rh={name:"@uppy/thumbnail-generator",description:"Uppy plugin that generates small previews of images to show on your upload UI.",version:"6.0.1",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:{"@uppy-dev/tsconfig":"workspace:^","@vitest/browser-playwright":"^4.1.11","namespace-emitter":"2.0.1",playwright:"1.61.1",typescript:"^6.0.3",vitest:"^4.1.11"},peerDependencies:{"@uppy/core":"workspace:^"}};var Ah={strings:{generatingThumbnails:"Generating thumbnails..."}};function Q0(i,e,t){try{i.getContext("2d").getImageData(0,0,1,1)}catch(r){if(typeof r=="object"&&r!=null&&"code"in r&&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(()=>ea(i.toDataURL(e,t),{})).then(r=>{if(r===null)throw new Error("could not extract blob, probably an old browser");return r})}o(Q0,"canvasToBlob");function Z0(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(Z0,"rotateImage");function e1(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(e1,"protect");var t1={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1},Pr=class extends le{static{o(this,"ThumbnailGenerator")}static VERSION=Rh.version;queue;queueProcessing;defaultThumbnailDimension;thumbnailType;constructor(e,t){if(super(e,{...t1,...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=Ah,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=Ch(e.data).catch(()=>1);return Promise.all([n,a]).then(([l,c])=>{let p=this.getProportionalDimensions(l,t,r,c.deg),h=Z0(l,c),m=this.resizeImage(h,p.width,p.height);return Q0(m,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=e1(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 Yr(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&&Yr(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&&Kr(e.preview)&&URL.revokeObjectURL(e.preview)},"onFileRemoved");onRestored=o(()=>{this.uppy.getFiles().filter(t=>t.isRestored).forEach(t=>{(!t.preview||Kr(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 Ih={name:"@uppy/dashboard",description:"Universal UI plugin for Uppy.",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 && 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:"^6.0.1",preact:"^10.29.2","shallow-equal":"^3.1.0"},devDependencies:{"@uppy-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^","@uppy/dropbox":"workspace:^","@uppy/google-drive":"workspace:^","@uppy/url":"workspace:^","@uppy/webcam":"workspace:^","@vitest/browser-playwright":"^4.1.11",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.11"},peerDependencies:{"@uppy/core":"workspace:^"}};var df=ce(Me(),1);var Ml=class extends he{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(fe,{children:[this.renderDropPasteBrowseTagline(n.length),u("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist",children:[c.map(({key:h,elements:m})=>u(fe,{children:m},h)),u("span",{role:"presentation",style:{"white-space":"nowrap"},children:p.map(({key:h,elements:m})=>u(fe,{children:m},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()]})]})}},gn=Ml;var Oh=ce(Me(),1);var r1=o(i=>u("div",{className:(0,Oh.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(gn,{...i})]}),"AddFilesPanel"),Uh=r1;var Dh=ce(Me(),1);function s1(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,Dh.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(s1,"EditorPanel");var Nh=s1;var Mh=ce(Me(),1);function o1(){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(o1,"iconImage");function n1(){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(n1,"iconAudio");function a1(){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(a1,"iconVideo");function l1(){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(l1,"iconPDF");function u1(){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(u1,"iconArchive");function c1(){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(c1,"iconFile");function p1(){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(p1,"iconText");function Li(i){let e={color:"#838999",icon:c1()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:p1()}:t==="image"?{color:"#686de0",icon:o1()}:t==="audio"?{color:"#068dbb",icon:n1()}:t==="video"?{color:"#19af67",icon:a1()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:l1()}: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:u1()}:e}o(Li,"getIconByMime");function d1(i){let{tagName:e}=i.target;if(e==="INPUT"||e==="TEXTAREA"){i.stopPropagation();return}i.preventDefault(),i.stopPropagation()}o(d1,"ignoreEvent");var mi=d1;function Ts(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}=Li(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(Ts,"FilePreview");function Ll(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},Qt):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(Ll,"RenderMetaFields");function Bl(i){let{files:e,fileCardFor:t,toggleFileCard:r,saveFileCard:s,metaFields:n,requiredMetaFields:a,openFileEditor:l,i18n:c,i18nArray:p,className:h,canEditFile:m}=i,y=o(()=>typeof n=="function"?n(e[t]):n,"getMetaFields"),S=e[t],b=y()??[],k=m(S),A={};b.forEach(G=>{A[G.id]=S.meta[G.id]??""});let[j,R]=Ae(A),T=Qe(G=>{G.preventDefault(),s(j,t)},[s,j,t]),M=o((G,Z)=>{R({...j,[Z]:G})},"updateMeta"),$=o(()=>{r(!1,t)},"handleCancel"),[L]=Ae(()=>{let G=document.createElement("form");return G.setAttribute("tabindex","-1"),G.id=Mt(),G}),J=we(null);return xe(()=>{let G=J.current?.getRootNode()??document;return G instanceof Document?G.body.appendChild(L):(G instanceof ShadowRoot,G.appendChild(L)),L.addEventListener("submit",T),()=>{L.removeEventListener("submit",T),L.parentNode&&L.parentNode.removeChild(L)}},[L,T]),u("div",{className:(0,Mh.default)("uppy-Dashboard-FileCard",h),"data-uppy-panelType":"FileCard",onDragOver:mi,onDragLeave:mi,onDrop:mi,onPaste:mi,ref:J,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:L.id,title:c("finishEditingFile"),onClick:$,children:c("cancel")})]}),u("div",{className:"uppy-Dashboard-FileCard-inner",children:[u("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:Li(S.type).color},children:[u(Ts,{file:S}),k&&u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:o(G=>{T(G),l(S)},"onClick"),children:c("editImage")})]}),u("div",{className:"uppy-Dashboard-FileCard-info",children:u(Ll,{computedMetaFields:b,requiredMetaFields:a,updateMeta:M,form:L,formState:j})}),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:L.id,children:c("saveChanges")}),u("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:$,form:L.id,children:c("cancel")})]})]})]})}o(Bl,"FileCard");var jh=ce(Me(),1);function Lh(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(Lh,"shallowEqualObjects");function jl(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(jl,"copyToClipboard");function h1({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(h1,"EditButton");function f1({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(f1,"RemoveButton");function m1({file:i,uppy:e,i18n:t}){let r=o(s=>{let{currentTarget:n}=s;jl(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(m1,"CopyLinkButton");function zl(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(h1,{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(m1,{file:t,uppy:e,i18n:c}):null,l?u(f1,{i18n:c,file:t,onClick:o(()=>e.removeFile(t.id),"onClick")}):null]})}o(zl,"Buttons");function g1(i,e,t){return(typeof e=="function"?e(t):e)?.find(n=>n.id===i)?.name??i}o(g1,"metaFieldIdToName");function ks(i){let{file:e,toggleFileCard:t,i18n:r,metaFields:s}=i,{missingRequiredMetaFields:n}=e;if(!n?.length)return null;let a=n.map(l=>g1(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(ks,"MetaErrorMessage");var y1=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:Jr(t,r())})},"renderFileName"),v1=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:Jr(e.name,13)}),t?u(fe,{children:[` ${r} `,t,` ${r} `]}):null]}):null},"renderAuthor"),b1=o(i=>i.file.size&&u("div",{className:"uppy-Dashboard-Item-statusSize",children:Ke(i.file.size)}),"renderFileSize"),w1=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"),S1=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 Hl(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:[y1({file:e,isSingleFile:a,containerHeight:l,containerWidth:c}),u(S1,{file:e,onClick:o(()=>alert(e.error),"onClick")})]}),u("div",{className:"uppy-Dashboard-Item-status",children:[v1({file:e}),b1({file:e}),w1({file:e,toggleAddFilesPanel:n,i18n:t})]}),u(ks,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}o(Hl,"FileInfo");function ql(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,showLinkToFileUploadResult:n}=i,l=e.preview?"rgba(255, 255, 255, 0.5)":Li(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(Ts,{file:e}),u(ks,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}o(ql,"FilePreviewAndLink");function x1(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(x1,"onPauseResumeCancelRetry");function Bh(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(Bh,"progressIndicatorTitle");function $l(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":Bh(i),title:Bh(i),onClick:o(()=>x1(i),"onClick"),children:i.children})})}o($l,"ProgressIndicatorButton");function yn({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(yn,"ProgressCircleContainer");function Vl({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(Vl,"ProgressCircle");function Wl(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(yn,{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($l,{...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($l,{...i,children:u(yn,{children:[u(Vl,{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($l,{...i,children:u(yn,{children:[u(Vl,{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(yn,{children:u(Vl,{progress:i.file.progress.percentage})})})})}o(Wl,"FileProgress");var Fs=class extends he{static{o(this,"FileItem")}componentDidMount(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}shouldComponentUpdate(e){return!Lh(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,jh.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(ql,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),u(Wl,{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(Hl,{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(zl,{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 _1(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(_1,"chunks");function Gl({id:i,i18n:e,uppy:t,files:r,resumableUploads:s,hideRetryButton:n,hidePauseResumeButton:a,hideCancelButton:l,showLinkToFileUploadResult:c,showRemoveButtonAfterComplete:p,metaFields:h,isSingleFile:m,toggleFileCard:y,handleRequestThumbnail:S,handleCancelThumbnail:b,recoveredState:k,individualCancellation:A,itemsPerRow:j,openFileEditor:R,canEditFile:T,toggleAddFilesPanel:M,containerWidth:$,containerHeight:L}){let J=j===1?71:200,G=At(()=>{let ie=o((Ie,be)=>Number(r[be].isGhost)-Number(r[Ie].isGhost),"sortByGhostComesFirst"),oe=Object.keys(r);return k&&oe.sort(ie),_1(oe,j)},[r,j,k]),Z=o(ie=>u("div",{class:"uppy-Dashboard-filesInner",role:"presentation",children:ie.map(oe=>u(Fs,{uppy:t,id:i,i18n:e,resumableUploads:s,individualCancellation:A,hideRetryButton:n,hidePauseResumeButton:a,hideCancelButton:l,showLinkToFileUploadResult:c,showRemoveButtonAfterComplete:p,metaFields:h,recoveredState:k,isSingleFile:m,containerWidth:$,containerHeight:L,toggleFileCard:y,handleRequestThumbnail:S,handleCancelThumbnail:b,role:"listitem",openFileEditor:R,canEditFile:T,toggleAddFilesPanel:M,file:r[oe]},oe))},ie[0]),"renderRow");return m?u("div",{class:"uppy-Dashboard-files",children:Z(G[0])}):u(lr,{class:"uppy-Dashboard-files",role:"list",data:G,renderRow:Z,rowHeight:J})}o(Gl,"FileList");var zh=300,Cs=class extends he{static{o(this,"FadeIn")}ref=Po();componentWillEnter(e){this.ref.current.style.opacity="1",this.ref.current.style.transform="none",setTimeout(e,zh)}componentWillLeave(e){this.ref.current.style.opacity="0",this.ref.current.style.transform="translateY(350%)",setTimeout(e,zh)}render(){let{children:e}=this.props;return u("div",{className:"uppy-Informer-animated",ref:this.ref,children:e})}};function E1(i,e){return Object.assign(i,e)}o(E1,"assign");function P1(i,e){return i?.key??e}o(P1,"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 Rs(i){let e={};for(let t=0;t<i.length;t++)if(i[t]!=null){let r=P1(i[t],t.toString(36));e[r]=i[t]}return e}o(Rs,"getChildMapping");function k1(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(k1,"mergeChildMappings");var F1=o(i=>i,"identity"),vn=class extends he{static{o(this,"TransitionGroup")}constructor(e,t){super(e,t),this.refs={},this.state={children:Rs(ft(ft(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=Rs(ft(e.children)||[]),r=this.state.children;this.setState(n=>({children:k1(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=Rs(ft(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=Rs(ft(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=Rs(ft(this.props.children)||[]);if(s&&Object.hasOwn(s,e))this.performEnter(e);else{let n=E1({},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:m}){let y=Object.entries(m).map(([S,b])=>{if(!b)return;let k=T1(this,S);return is(e(b),{ref:k,key:S})}).filter(Boolean);return Qt(p,h,y)}};vn.defaultProps={component:"span",childFactory:F1};var Hh=vn;var Tr=class extends he{static{o(this,"Informer")}render(){let{info:e}=this.props.uppy.getState();return u("div",{className:"uppy uppy-Informer",children:u(Hh,{children:e.map(t=>u(Cs,{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 qh=ce(Me(),1);function C1({activePickerPanel:i,className:e,hideAllPanels:t,i18n:r,state:s,uppy:n}){let a=we(null),l=n.getPlugin(i.id),c=!!l?.opts.standalone,p=o(m=>{let y=m.target;return!!l?.acceptsFileDrops&&!!m.dataTransfer?.types.includes("Files")&&y.closest("input, textarea, dialog")==null},"leaveToDashboard"),h=o(m=>{p(m)||(mi(m),m.type==="dragover"&&m.defaultPrevented&&m.dataTransfer&&(m.dataTransfer.dropEffect="none"))},"ignoreDrag");return u("div",{className:(0,qh.default)("uppy-DashboardContent-panel",e),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${i.id}`,onDragOver:h,onDragLeave:h,onDrop:h,onPaste:mi,children:[!c&&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:l?.render(s,a.current)})]})}o(C1,"PickerPanelContent");var $h=C1;var gi={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function R1(i,e,t,r={}){if(i)return gi.STATE_ERROR;if(e)return gi.STATE_COMPLETE;if(t)return gi.STATE_PAUSED;let s=gi.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 gi.STATE_UPLOADING;l.preprocess&&(s=gi.STATE_PREPROCESSING),l.postprocess&&s!==gi.STATE_PREPROCESSING&&(s=gi.STATE_POSTPROCESSING)}return s}o(R1,"getUploadingState");function A1({files:i,i18n:e,isAllComplete:t,isAllErrored:r,isAllPaused:s,inProgressNotPausedFiles:n,newFiles:a,processingFiles:l}){switch(R1(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")}}o(A1,"UploadStatus");function I1(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(A1,{...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(I1,"PanelTopBar");var Vh=I1;var Gh=ce(Me(),1);var kr="uppy-transition-slideDownUp",Wh=250;function O1({children:i}){let[e,t]=Ae(null),[r,s]=Ae(""),n=we(),a=we(),l=we(),c=Qe(()=>{s(`${kr}-enter`),cancelAnimationFrame(l.current),clearTimeout(a.current),a.current=void 0,l.current=requestAnimationFrame(()=>{s(`${kr}-enter ${kr}-enter-active`),n.current=setTimeout(()=>{s("")},Wh)})},[]),p=Qe(()=>{s(`${kr}-leave`),cancelAnimationFrame(l.current),clearTimeout(n.current),n.current=void 0,l.current=requestAnimationFrame(()=>{s(`${kr}-leave ${kr}-leave-active`),a.current=setTimeout(()=>{t(null),s("")},Wh)})},[]);return xe(()=>{let h=ft(i)[0];e!==h&&(h&&!e?c():e&&!h&&!a.current&&p(),t(h))},[i,e,c,p]),xe(()=>()=>{clearTimeout(n.current),clearTimeout(a.current),cancelAnimationFrame(l.current)},[]),e?is(e,{className:(0,Gh.default)(r,e.props.className)}):null}o(O1,"Slide");var As=O1;var St={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};var Jl=ce(Me(),1);var Xl=ce(Me(),1);var U1="\xB7",Xh=o(()=>` ${U1} `,"renderDot");function Kh(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:a,startUpload:l}=i,c=(0,Xl.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":n===St.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(Kh,"UploadBtn");function Yh(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(Yh,"RetryBtn");function Jh(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(Jh,"CancelBtn");function Qh(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(Qh,"PauseResumeButton");function Zh(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(Zh,"DoneBtn");function ef(){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(ef,"LoadingSpinner");function tf(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return u("div",{className:"uppy-StatusBar-content",children:[u(ef,{}),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s]})}o(tf,"ProgressBarProcessing");function D1(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:a}=i,l=e>1,c=Ke(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&&Xh(),s!=null?a("dataUploadedOfTotal",{complete:c,total:Ke(s)}):a("dataUploadedOfUnknown",{complete:c}),Xh(),n!=null&&a("xTimeLeft",{time:or(n)})]})]})}o(D1,"ProgressDetails");function rf(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(rf,"FileUploadCount");function N1(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,Xl.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(N1,"UploadNewlyAddedFiles");function sf(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,hideProgressDetails:s,isUploadStarted:n,isAllComplete:a,isAllPaused:l,newFiles:c,numUploads:p,complete:h,totalUploadedSize:m,totalSize:y,totalETA:S,startUpload:b}=i,k=c&&n;if(!n||a)return null;let A=e(l?"paused":"uploading");function j(){return!l&&!k&&!s?t?u(D1,{numUploads:p,complete:h,totalUploadedSize:m,totalSize:y,totalETA:S,i18n:e}):u(rf,{i18n:e,complete:h,numUploads:p}):null}return o(j,"renderProgressDetails"),u("div",{className:"uppy-StatusBar-content",title:A,children:[l?null:u(ef,{}),u("div",{className:"uppy-StatusBar-status",children:[u("div",{className:"uppy-StatusBar-statusPrimary",children:t&&r!==0?`${A}: ${r}%`:A}),j(),k?u(N1,{i18n:e,newFiles:c,startUpload:b}):null]})]})}o(sf,"ProgressBarUploading");function of(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(of,"ProgressBarComplete");function nf(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(rf,{i18n:t,complete:r,numUploads:s})]})]})}o(nf,"ProgressBarError");function Is(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(Is,"calculateProcessingProgress");var{STATE_ERROR:af,STATE_WAITING:M1,STATE_PREPROCESSING:Kl,STATE_UPLOADING:bn,STATE_POSTPROCESSING:Yl,STATE_COMPLETE:wn}=St;function Ql({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:m,totalProgress:y,files:S,supportsUploadProgress:b,hideAfterFinish:k=!1,isSomeGhost:A,doneButtonHandler:j=void 0,isUploadStarted:R,i18n:T,startUpload:M,uppy:$,isAllComplete:L,hideProgressDetails:J=void 0,numUploads:G,complete:Z,totalSize:ie,totalETA:oe,totalUploadedSize:Ie}){function be(){switch(m){case Yl:case Kl:{let Q=Is(S);return Q.mode==="determinate"?Q.value*100:y}case af:return null;case bn:return b?y:null;default:return y}}o(be,"getProgressValue");function me(){switch(m){case Yl:case Kl:{let{mode:Q}=Is(S);return Q==="indeterminate"}case bn:return!b;default:return!1}}o(me,"getIsIndeterminate");let Te=be(),F=Te??100,x=!n&&i&&(!t&&!r||h)&&e&&!a,E=!c&&m!==M1&&m!==wn,z=s&&!l&&m===bn,V=n&&!L&&!p,H=j&&m===wn,ee=(0,Jl.default)("uppy-StatusBar-progress",{"is-indeterminate":me()}),N=(0,Jl.default)("uppy-StatusBar",`is-${m}`,{"has-ghosts":A}),C=(()=>{switch(m){case Kl:case Yl:return u(tf,{progress:Is(S)});case wn:return u(of,{i18n:T});case af:return u(nf,{error:n,i18n:T,numUploads:G,complete:Z});case bn:return u(sf,{i18n:T,supportsUploadProgress:b,totalProgress:y,hideProgressDetails:J,isUploadStarted:R,isAllComplete:L,isAllPaused:r,newFiles:i,numUploads:G,complete:Z,totalUploadedSize:Ie,totalSize:ie,totalETA:oe,startUpload:M});default:return null}})();return!(x||V||z||E||H)&&!C||m===wn&&k?null:u("div",{className:N,children:[u("div",{className:ee,style:{width:`${F}%`},role:"progressbar","aria-label":`${F}%`,"aria-valuetext":`${F}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Te}),C,u("div",{className:"uppy-StatusBar-actions",children:[x?u(Kh,{newFiles:i,isUploadStarted:R,recoveredState:h,i18n:T,isSomeGhost:A,startUpload:M,uploadState:m}):null,V?u(Yh,{i18n:T,uppy:$}):null,z?u(Qh,{isAllPaused:r,i18n:T,isAllComplete:L,resumableUploads:s,uppy:$}):null,E?u(Jh,{i18n:T,uppy:$}):null,H?u(Zh,{i18n:T,doneButtonHandler:j}):null]})]})}o(Ql,"StatusBarUI");var L1=2e3,B1=2e3;function j1(i,e,t,r){if(i)return St.STATE_ERROR;if(e)return St.STATE_COMPLETE;if(t)return St.STATE_WAITING;let s=St.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 St.STATE_UPLOADING;l.preprocess&&(s=St.STATE_PREPROCESSING),l.postprocess&&s!==St.STATE_PREPROCESSING&&(s=St.STATE_POSTPROCESSING)}return s}o(j1,"getUploadingState");var Os=class extends he{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:ai(n,this.#i,L1,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:ai(l,c,B1,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:m,isAllPaused:y,isUploadInProgress:S,isSomeGhost:b}=this.props.uppy.getObjectOfFilesPerState(),k=a?Object.values(t):l,A=!!e.resumableUploads,j=e.uploadProgress!==!1,R=null,T=0;c.every($=>$.progress.bytesTotal!=null&&$.progress.bytesTotal!==0)?(R=0,c.forEach($=>{R+=$.progress.bytesTotal||0,T+=$.progress.bytesUploaded||0})):c.forEach($=>{T+=$.progress.bytesUploaded||0});let M=this.#o({uploaded:T,total:R});return u(Ql,{error:n,uploadState:j1(n,m,a,t||{}),allowNewUpload:r,totalProgress:s,totalSize:R,totalUploadedSize:T,isAllComplete:m,isAllPaused:y,isUploadStarted:h,isUploadInProgress:S,isSomeGhost:b,recoveredState:a,complete:p.length,newFiles:k.length,numUploads:c.length,totalETA:M,files:t,i18n:this.props.i18n,uppy:this.props.uppy,startUpload:this.startUpload,doneButtonHandler:this.props.doneButtonHandler,resumableUploads:A,supportsUploadProgress:j,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 lf=900,uf=700,cf=576,pf=330;function Zl(i){let{activePickerPanel:e,fileCardFor:t}=i,r=i.totalFileCount===0,s=i.totalFileCount===1,n=i.containerHeight>pf,a=(0,df.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>cf,"uppy-size--lg":i.containerWidth>uf,"uppy-size--xl":i.containerWidth>lf,"uppy-size--height-md":i.containerHeight>pf,"uppy-Dashboard--isAddFilesPanelVisible":i.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":i.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":i.singleFileFullScreen&&s&&n}),l=1;i.containerWidth>lf?l=5:i.containerWidth>uf?l=4:i.containerWidth>cf&&(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,m=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&&sr(),"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(Vh,{...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:m()})]}),c?u(Gl,{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(gn,{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(As,{children:i.showAddFilesPanel?u(Uh,{...i},"AddFiles"):null}),u(As,{children:t?u(Bl,{...i,fileCardFor:t},"FileCard"):null}),u(As,{children:e?u($h,{...i,activePickerPanel:e},"Picker"):null}),u(As,{children:i.showFileEditor?u(Nh,{...i},"Editor"):null}),u("div",{className:"uppy-Dashboard-progressindicators",children:[!i.disableInformer&&u(Tr,{uppy:i.uppy}),!i.disableStatusBar&&u(Os,{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(Tr,{uppy:i.uppy}),i.progressindicators.map(S=>i.uppy.getPlugin(S.id).render(i.state))]})]})]})]})}o(Zl,"Dashboard");var hf={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 ff=ce(Io(),1);function Us(i,e){if(e){let t=i.querySelector(`[data-uppy-paneltype="${e}"]`);if(t)return t}return i}o(Us,"getActiveOverlayEl");function eu(){let i=!1;return(0,ff.default)((e,t)=>{let r=Us(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(Hr.join(","))?.focus({preventScroll:!0}),i=!1))},260)}o(eu,"createSuperFocus");function mf(i,e){let t=e[0];t&&(t.focus(),i.preventDefault())}o(mf,"focusOnFirstNode");function z1(i,e){let t=e[e.length-1];t&&(t.focus(),i.preventDefault())}o(z1,"focusOnLastNode");function H1(i){return i.contains(document.activeElement)}o(H1,"isFocusInOverlay");function tu(i,e,t){let r=Us(t,e),s=We(r.querySelectorAll(Hr.join(","))),n=s.indexOf(document.activeElement);H1(r)?i.shiftKey&&n===0?z1(i,s):!i.shiftKey&&n===s.length-1&&mf(i,s):mf(i,s)}o(tu,"trapFocus");function gf(i,e,t){e===null||tu(i,e,t)}o(gf,"forInline");var yf=9,$1=27;function vf(){let i={};return i.promise=new Promise((e,t)=>{i.resolve=e,i.reject=t}),i}o(vf,"createPromise");var V1={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:mr,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},Ds=class extends le{static{o(this,"Dashboard")}static VERSION=Ih.version;#e;modalName=`uppy-Dashboard-${Mt()}`;superFocus=eu();ifFocusedOnUppyRecently=!1;dashboardIsDisabled;savedActiveElement;resizeObserver;darkModeMediaQuery;makeDashboardInsidesVisibleAnywayTimeout;constructor(e,t){let r=t?.autoOpen??null;super(e,{...V1,...t,autoOpen:r}),this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=hf,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.#n(t).some(s=>this.uppy.getPlugin(s.id).canEditFile(e))},"canEditFile");openFileEditor=o(e=>{let{targets:t}=this.getPluginState(),r=this.#n(t);this.setPluginState({showFileEditor:!0,fileCardFor:e.id||null,activeOverlayType:"FileEditor"}),r.forEach(s=>{this.uppy.getPlugin(s.id).selectFile(e)})},"openFileEditor");closeFileEditor=o(()=>{let{metaFields:e}=this.getPluginState();e&&e.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})},"closeFileEditor");saveFileEditor=o(()=>{let{targets:e}=this.getPluginState();this.#n(e).forEach(r=>{this.uppy.getPlugin(r.id).save()}),this.closeFileEditor()},"saveFileEditor");openModal=o(()=>{let{promise:e,resolve:t}=vf();if(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}=vf();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??We(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===$1&&this.requestCloseModal(),e.keyCode===yf&&tu(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=We(e.clipboardData.files);t.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(t))},"handlePaste");handleInputChange=o(e=>{e.preventDefault();let t=We(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 ui(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===yf&&gf(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=yo(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=yo(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");#a=o(e=>e.filter(t=>t.type==="progressindicator").map(this.#r),"#getProgressIndicators");#n=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:m,processingFiles:y,isUploadStarted:S,isAllComplete:b,isAllPaused:k}=this.uppy.getObjectOfFilesPerState(),A=this.#o(t.targets),j=this.#a(t.targets),R=this.#n(t.targets),T;return this.opts.theme==="auto"?T=s.darkMode?"dark":"light":T=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}".`)),Zl({state:e,isHidden:t.isHidden,files:r,newFiles:a,uploadStartedFiles:l,completeFiles:c,erroredFiles:p,inProgressFiles:h,inProgressNotPausedFiles:m,processingFiles:y,isUploadStarted:S,isAllComplete:b,isAllPaused:k,totalFileCount:Object.keys(r).length,totalProgress:e.totalProgress,allowNewUpload:n,acquirers:A,theme:T,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:j,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(Pr,{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 bf={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:{"@uppy-dev/tsconfig":"workspace:^",cssnano:"^8.0.1",postcss:"^8.5.23","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^6.0.3"}};var wf={strings:{dropHereOr:"Drop here or %{browse}",browse:"browse"}};var G1={inputName:"files[]",width:"100%",height:"100%"},Ns=class i extends le{static{o(this,"DragDrop")}static VERSION=bf.version;isDragDropSupported=sr();fileInputRef;constructor(e,t){super(e,{...G1,...t}),this.type="acquirer",this.id=this.opts.id||"DragDrop",this.title="Drag & Drop",this.defaultLocale=wf,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=We(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 ui(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 Sf={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:{"@uppy-dev/tsconfig":"workspace:^",cssnano:"^8.0.1",postcss:"^8.5.23","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^6.0.3"}};var K1={target:null};function iu(i){return i.dataTransfer?.types?.some(e=>e==="Files")??!1}o(iu,"isFileTransfer");var Sn=class extends ke{static{o(this,"DropTarget")}static VERSION=Sf.version;nodes;constructor(e,t){super(e,{...K1,...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(!iu(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 ui(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=>{iu(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=>{iu(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=We(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 xf={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-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^",typescript:"^6.0.3"}};var _f={strings:{pluginNameDropbox:"Dropbox"}};var Bi=class extends le{static{o(this,"Dropbox")}static VERSION=xf.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||Ue,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=Ze(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new et(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=_f,this.i18nInit(),this.title=this.i18n("pluginNameDropbox"),this.render=this.render.bind(this)}install(){this.view=new Ye(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 Ef={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-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^",typescript:"^6.0.3"}};var Pf={strings:{pluginNameFacebook:"Facebook"}};var ji=class extends le{static{o(this,"Facebook")}static VERSION=Ef.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||Ue,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=Ze(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new et(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=Pf,this.i18nInit(),this.title=this.i18n("pluginNameFacebook"),this.render=this.render.bind(this)}install(){this.view=new Ye(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 xn(){return xn=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},xn.apply(this,arguments)}o(xn,"_extends");var Q1={"[object HTMLCollection]":!0,"[object NodeList]":!0,"[object RadioNodeList]":!0},Z1={button:!0,fieldset:!0,reset:!0,submit:!0},ew={checkbox:!0,radio:!0},tw=/^\s+|\s+$/g,iw=Array.prototype.slice,Tf=Object.prototype.toString;function _n(i,e){if(!i)throw new Error("A form is required by getFormData, was given form="+i);e=xn({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];Z1[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 m=Ff(i,r,e);m!=null&&(t[r]=m)}return t}o(_n,"getFormData");function Ff(i,e,t){if(!i)throw new Error("A form is required by getFieldData, was given form="+i);if(!e&&Tf.call(e)!=="[object String]")throw new Error("A field name is required by getFieldData, was given fieldName="+e);t=xn({includeDisabled:!1,trim:!1},t);var r=i.elements[e];if(!r||r.disabled&&!t.includeDisabled)return null;if(!Q1[Tf.call(r)])return kf(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=kf(r[a],t.trim);c!=null&&(s=s.concat(c))}return n&&s.length===1?s[0]:s.length>0?s:null}o(Ff,"getFieldData");function kf(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=iw.call(i.files),t.length===0&&(t=null)):t=i.files[0],t):(ew[r]?i.checked&&(r==="checkbox"&&!i.hasAttribute("value")?t=!0:t=i.value):t=e?i.value.replace(tw,""):i.value,t)}o(kf,"getFormElementValue");_n.getFieldData=Ff;var Cf={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","@uppy-dev/tsconfig":"workspace:^",typescript:"^6.0.3"}};function sw(i){return"default"in i?i.default:i}o(sw,"defaultInterop");var ow=sw(_n),nw={resultName:"uppyResult",getMetaFromForm:!0,addResultToForm:!0,submitOnSuccess:!1,triggerUploadOnSubmit:!1};function aw(i){if(i==null||i.nodeName!=="FORM")throw new Error("ASSERTION FAILED: the target is not a <form> element",{cause:i});return i}o(aw,"assertHTMLFormElement");var En=class extends ke{static{o(this,"Form")}static VERSION=Cf.version;#e;constructor(e,t){super(e,{...nw,...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=We(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=ow(this.#e);delete e[this.opts.resultName],this.uppy.setMeta(e)}install(){this.#e=aw(Vr(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 Rf={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-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^","@uppy/dashboard":"workspace:^","@uppy/xhr-upload":"workspace:^","@vitest/browser-playwright":"^4.1.11",playwright:"1.61.1",typescript:"^6.0.3",vitest:"^4.1.11"}};var Nf=ce(Oo(),1);var Uf=typeof window<"u"&&(window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.OIndexedDB||window.msIndexedDB),uw=!!Uf,Pn="uppy-blobs",gt="files",yi="metadata",Df=1440*60*1e3,cw=4,Af=1048576;function pw(i){let e=i.openCursor();e.onsuccess=t=>{let r=t.target.result;if(!r)return;let s=r.value;s.expires=Date.now()+Df,r.update(s)}}o(pw,"migrateExpiration");function Tn(i){let e=Uf.open(i,cw);return new Promise((t,r)=>{e.onupgradeneeded=s=>{let n=s.target.result;If(n);let a=s.currentTarget.transaction;if(s.oldVersion<2&&n.createObjectStore(gt,{keyPath:"id"}).createIndex("store","store",{unique:!1}),s.oldVersion<3){let l=a.objectStore(gt);l.createIndex("expires","expires",{unique:!1}),pw(l)}s.oldVersion<4&&n.createObjectStore(yi,{keyPath:"id"}).createIndex("expires","expires",{unique:!1}),a.oncomplete=()=>{t(n)}},e.onsuccess=s=>{let n=s.target.result;If(n),t(n)},e.onerror=r})}o(Tn,"connect");function If(i){i.onversionchange=()=>i.close()}o(If,"closeOnVersionChange");function Fr(i){return new Promise((e,t)=>{i.onsuccess=r=>{e(r.target.result)},i.onerror=t})}o(Fr,"waitForRequest");var Of=!1,kn=class i{static{o(this,"IndexedDBStore")}#e;opts;name;static isSupported;constructor(e){this.opts={dbName:Pn,storeName:"default",expires:Df,maxFileSize:10*Af,maxTotalSize:300*Af,...e},this.name=this.opts.storeName;let t=o(async()=>{let r=await Tn(this.opts.dbName);return this.#e=r,r},"createConnection");Of?this.#e=t():(Of=!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([gt],"readonly").objectStore(gt).index("store").getAll(IDBKeyRange.only(this.name)),n=await Fr(s);return Object.fromEntries(n.map(a=>[a.fileID,a.data]))}async get(e){let s=(await this.#e).transaction([gt],"readonly").objectStore(gt).get(this.key(e)),{data:n}=await Fr(s);return{id:n.fileID,data:n.data}}async getSize(){let s=(await this.#e).transaction([gt],"readonly").objectStore(gt).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([gt],"readwrite").objectStore(gt).add({id:this.key(e.id),fileID:e.id,store:this.name,expires:Date.now()+this.opts.expires,data:e.data});return Fr(n)}async delete(e){let s=(await this.#e).transaction([gt],"readwrite").objectStore(gt).delete(this.key(e));return Fr(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 Tn(Pn);try{let t=e.transaction([gt,yi],"readwrite");await Promise.all([i.#t(t.objectStore(gt)),i.#t(t.objectStore(yi))])}finally{e.close()}}};kn.isSupported=uw;var ru=kn;var Ms=class{static{o(this,"IndexedDBMetaDataStore")}#e;#t;#i;#r;#s;constructor(e){this.#e=Tn(Pn),this.#e.catch(()=>{}),this.#i=e.storeName,this.#r=e.expires,this.#s=e.throttleTime===0?this.#o:(0,Nf.default)(this.#o,e.throttleTime??500,{leading:!0,trailing:!0})}async load(){try{let e=await this.#e,t=await Fr(e.transaction([yi]).objectStore(yi).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([yi],"readwrite").objectStore(yi);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 Mf=ce(Oo(),1);function Lf(i){try{return JSON.parse(i)}catch{return null}}o(Lf,"maybeParse");var Bf="uppyState:",dw=o(i=>`${Bf}${i}`,"getItemKey");function hw(){let i=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r?.startsWith(Bf)&&i.push(r)}let e=Date.now();i.forEach(t=>{let r=localStorage.getItem(t);if(!r)return;let s=Lf(r);s?.expires&&s.expires<e&&localStorage.removeItem(t)})}o(hw,"expireOldState");var Ls=class{static{o(this,"MetaDataStore")}opts;name;#e;constructor(e){this.opts={expires:1440*60*1e3,throttleTime:500,...e},this.name=dw(e.storeName),this.#e=this.opts.throttleTime===0?this.save:(0,Mf.default)(this.save,this.opts.throttleTime,{leading:!0,trailing:!0})}#t;load=o(()=>{hw();let e=localStorage.getItem(this.name);if(!e)return;let t=Lf(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 jf=typeof navigator<"u"&&"serviceWorker"in navigator;function fw(){return new Promise((i,e)=>{jf?navigator.serviceWorker.controller?i():navigator.serviceWorker.addEventListener("controllerchange",()=>{i()}):e(new Error("Unsupported"))})}o(fw,"waitForServiceWorker");var Fn=class{static{o(this,"ServiceWorkerStore")}#e;name;static isSupported;constructor(e){this.#e=fw().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})}};Fn.isSupported=jf;var zf=Fn;var mw={expires:1440*60*1e3,serviceWorker:!1},Cn=class i extends ke{static{o(this,"GoldenRetriever")}static VERSION=Rf.version;#e;#t;#i;static[Symbol.for("uppy test: throttleTime")];constructor(e,t){super(e,{...mw,...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=ru.isSupported?new Ms(r):new Ls(r),this.opts.serviceWorker&&(this.#t=new zf({storeName:e.getID()})),this.#i=new ru({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.#a()]),p={...l,...c},h=Object.fromEntries(n.map(([y,S])=>{if(S.isRemote)return[y,{...S,isRestored:!0,data:{size:null}}];let b=p[y];return[y,!S.progress.uploadComplete&&b==null?{...S,isRestored:!0,isGhost:!0,data:void 0}:{...S,isRestored:!0,isGhost:!1,data:b}]}));this.uppy.setState({recoveredState:a?e:null,currentUploads:a?t:{},files:h}),this.uppy.emit("restored",e.pluginData);let m=Object.keys(p).filter(y=>!s[y]);if(m.length)try{this.uppy.log(`[GoldenRetriever] Cleaning up ${m.length} old files`),await this.#n(m)}catch(y){this.uppy.log(`[GoldenRetriever] Could not clean up ${m.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#a(){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#n(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.#n(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)=>{if(t.currentUploads!==e.currentUploads){let{currentUploads:r}=this.uppy.getState();this.#s({currentUploads:r})}if(t.files!==e.files){Object.values(e.files).some(p=>!p.progress.complete)&&(Object.values(t.files).length===0||Object.values(t.files).every(p=>p.progress.complete&&!p.error))&&(this.uppy.log("[GoldenRetriever] All files have been uploaded and processed successfully, clearing recovery state"),this.uppy.setState({recoveredState:null}));let r=Object.fromEntries(Object.entries(t.files).map(([p,{data:h,preview:m,...y}])=>[p,y]));this.#s({files:r});let s=Object.values(t.files).filter(p=>e.files[p.id]==null),n=Object.values(t.files).flatMap(p=>{let h=e.files[p.id];return h!=null&&p.data!==h.data?[p]:[]}),l=[...Object.values(e.files).filter(p=>{let h=t.files[p.id];return h==null||h.progress.uploadComplete&&!p.progress.uploadComplete}),...n],c=[...s,...n];(async()=>{await this.#n(l.map(p=>p.id));for(let p of c)await this.#u(p);c.length>0&&this.uppy.log(`[GoldenRetriever] Added ${c.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 Hf={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-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^",typescript:"^6.0.3"}};var Bs=class extends Ye{static{o(this,"DriveProviderViews")}toggleCheckbox(e,t){e.data.custom?.isSharedDrive||super.toggleCheckbox(e,t)}};var qf={strings:{pluginNameGoogleDrive:"Google Drive"}};var zi=class extends le{static{o(this,"GoogleDrive")}static VERSION=Hf.version;icon;provider;view;storage;files;rootFolderId="root";constructor(e,t){super(e,t),this.type="acquirer",this.storage=this.opts.storage||Ue,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=Ze(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new et(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=qf,this.i18nInit(),this.title=this.i18n("pluginNameGoogleDrive"),this.render=this.render.bind(this)}install(){this.view=new Bs(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-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^",typescript:"^6.0.3"}};var su={strings:{pluginNameGoogleDrivePicker:"Google Drive"}};var js=class i extends le{static{o(this,"GoogleDrivePicker")}static VERSION=$f.version;static requestClientId=i.name;type="acquirer";icon=hr;storage;defaultLocale=su;requestClientId=i.requestClientId;constructor(e,t){super(e,t),this.id=this.opts.id||"GoogleDrivePicker",this.storage=this.opts.storage||Ue,this.defaultLocale=su,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 ct(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(Ii,{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 Vf={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-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^",typescript:"^6.0.3"}};var ou={strings:{pluginNameGooglePhotosPicker:"Google Photos"}};var zs=class i extends le{static{o(this,"GooglePhotosPicker")}static VERSION=Vf.version;static requestClientId=i.name;type="acquirer";icon=dr;storage;defaultLocale=ou;requestClientId=i.requestClientId;constructor(e,t){super(e,t),this.id=this.opts.id||"GooglePhotosPicker",this.storage=this.opts.storage||Ue,this.defaultLocale=ou,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 ct(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(Ii,{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 Zf=ce(Wf(),1);var Gf={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:{"@uppy-dev/tsconfig":"workspace:^",cssnano:"^8.0.1",postcss:"^8.5.23","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^6.0.3"}};var Hs=class extends he{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 Xf={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 ww(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(ww,"getCanvasDataThatFitsPerfectlyIntoContainer");var Kf=ww;function Sw(i){return i*(Math.PI/180)}o(Sw,"toRadians");function xw(i,e,t){let r=Math.abs(Sw(t));return Math.max((Math.sin(r)*i+Math.cos(r)*e)/e,(Math.sin(r)*e+Math.cos(r)*i)/i)}o(xw,"getScaleFactorThatRemovesDarkCorners");var Yf=xw;function _w(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(_w,"limitCropboxMovementOnMove");var Jf=_w;function Ew(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(Ew,"limitCropboxMovementOnResize");var Qf=Ew;var Pw={angle:0,angleGranular:0,isFlippedHorizontally:!1,aspectRatio:"free",cropperReady:!1},em={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},tm={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},Tw={quality:.8,actions:tm,cropperOptions:em},qs=class extends le{static{o(this,"ImageEditor")}static VERSION=Gf.version;cropper=null;objectUrl=null;prevCropboxData=null;imgElement=null;cropstartHandler=null;cropendHandler=null;cropperReadyHandler=null;constructor(e,t){super(e,{...Tw,...t,actions:{...tm,...t?.actions},cropperOptions:{...em,...t?.cropperOptions}}),this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=Xf,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,...Pw,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=Kf(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=Yf(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 Zf.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=Jf(r,s,this.prevCropboxData);n&&this.cropper.setCropBoxData(n)}else{let n=Qf(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(Hs,{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 im={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-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^",typescript:"^6.0.3"}};var rm={strings:{pluginNameOneDrive:"OneDrive"}};var Hi=class extends le{static{o(this,"OneDrive")}static VERSION=im.version;icon;provider;view;storage;files;rootFolderId=null;constructor(e,t){super(e,t),this.type="acquirer",this.files=[],this.storage=this.opts.storage||Ue,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=Ze(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new et(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=rm,this.i18nInit(),this.title=this.i18n("pluginNameOneDrive"),this.render=this.render.bind(this)}install(){this.view=new Ye(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 sm={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-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^",typescript:"^6.0.3"}};var om={strings:{pluginNameUnsplash:"Unsplash"}};var qi=class extends le{static{o(this,"Unsplash")}static VERSION=sm.version;icon;provider;view;storage;files;hostname;constructor(e,t){if(super(e,t),this.type="acquirer",this.files=[],this.storage=this.opts.storage||Ue,this.id=this.opts.id||"Unsplash",this.defaultLocale=om,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=Ze(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new Ai(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule,provider:"unsplash",pluginId:this.id})}install(){this.view=new hi(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 nm={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.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 && 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:"^6.0.1",preact:"^10.29.2"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^","@vitest/browser-playwright":"^4.1.11",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.11"}};var am={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 lu=class extends he{static{o(this,"UrlUI")}form=document.createElement("form");input;constructor(e){super(e),this.form.id=Mt()}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")})]})}},lm=lu;function Rn(i,e,t){let r=We(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(Rn,"forEachDroppedOrPastedUrl");function Rw(){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(Rw,"UrlIcon");function Aw(i){let e=/^[a-z0-9]+:\/\//,t="http://";return e.test(i)?i:t+i}o(Aw,"addProtocolToURL");function Iw(i){return We(i.dataTransfer.items).filter(r=>r.kind==="string"&&r.type==="text/uri-list").length>0}o(Iw,"canHandleRootDrop");function Ow(i){return i?.startsWith("http://")||i?.startsWith("https://")}o(Ow,"checkIfCorrectURL");function Uw(i){let{pathname:e}=new URL(i);return e.substring(e.lastIndexOf("/")+1)}o(Uw,"getFileNameFromUrl");var vi=class i extends le{static{o(this,"Url")}static VERSION=nm.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(Rw,{}),this.defaultLocale=am,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 ct(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=Aw(e);if(!Ow(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){nt(a)||this.uppy.log(a);return}}catch(s){this.uppy.log(s),this.uppy.info({message:this.i18n("failedToFetch"),details:ot(s)},"error",4e3);return}},"addFile");handleRootDrop=o(e=>{Rn(e.dataTransfer,"drop",t=>{this.addFile(t)})},"handleRootDrop");handleRootPaste=o(e=>{Rn(e.clipboardData,"paste",t=>{this.addFile(t)})},"handleRootPaste");render(){return u(lm,{i18n:this.i18n,addFile:this.addFile})}install(){let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount()}};vi.prototype.canHandleRootDrop=Iw;var um={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-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^",typescript:"^6.0.3"}};var cm={strings:{pluginNameZoom:"Zoom"}};var $i=class extends le{static{o(this,"Zoom")}static VERSION=um.version;icon;provider;view;storage;files;rootFolderId=null;constructor(e,t){super(e,t),this.type="acquirer",this.files=[],this.storage=this.opts.storage||Ue,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=Ze(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new et(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=cm,this.i18nInit(),this.title=this.i18n("pluginNameZoom"),this.render=this.render.bind(this)}install(){this.view=new Ye(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 pm={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-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^","@vitest/browser-playwright":"^4.1.11",playwright:"1.61.1",typescript:"^6.0.3",vitest:"^4.1.11"}};var uu={__proto__:null,Box:Ui,Dropbox:Bi,Facebook:ji,GoogleDrive:zi,OneDrive:Hi,Unsplash:qi,Url:vi,Zoom:$i},Mw={sources:Object.keys(uu)},An=class extends ke{static{o(this,"RemoteSources")}static VERSION=pm.version;#e=new Set;constructor(e,t){if(super(e,{...Mw,...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=uu[e];if(n==null){let a=Object.keys(uu),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 dm={name:"@uppy/screen-capture",description:"Uppy plugin that captures video from display or application.",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 && 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:{"@uppy-dev/tsconfig":"workspace:^",cssnano:"^8.0.1",postcss:"^8.5.23","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^6.0.3"}};var hm={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 cu({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(cu,"DiscardButton");function pu({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(pu,"RecordButton");function du({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(du,"ScreenshotButton");function Bw(i){return(i-(i%=60))/60+(i>9?":":":0")+i}o(Bw,"fmtMSS");var hu=class extends he{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=Bw(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}},fm=hu;function fu({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(fu,"StreamStatus");function mu({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(mu,"SubmitButton");var gu=class extends he{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(fu,{...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(fm,{...this.props})})]}),u("div",{className:"uppy-ScreenCapture-buttonContainer",children:r||n?u(fe,{children:[u(mu,{...this.props}),u(cu,{...this.props})]}):u(fe,{children:[s&&!e&&u(du,{...this.props}),u(pu,{...this.props})]})})]})}},mm=gu;function yu(){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(yu,"ScreenRecIcon");function jw(){return window.MediaRecorder&&navigator.mediaDevices?.getDisplayMedia}o(jw,"isScreenRecordingSupported");function zw(){return window.MediaRecorder&&navigator.mediaDevices}o(zw,"getMediaDevices");var Hw=["image/png","image/jpeg","image/webp"],qw={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},$s=class extends le{static{o(this,"ScreenCapture")}static VERSION=dm.version;mediaDevices;protocol;icon;streamInterrupted;captureActive;capturedMediaFile;videoStream=null;audioStream=null;userDenied=!1;recorder=null;outputStream=null;recordingChunks=null;constructor(e,t){super(e,{...qw,...t}),this.mediaDevices=zw(),this.protocol=location.protocol==="https:"?"https":"http",this.id=this.opts.id||"ScreenCapture",this.type="acquirer",this.icon=yu,this.defaultLocale=hm,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(!jw())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)&&Tt(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){nt(e)||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=Tt(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||!Hw.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=Tt(n)||"png",m={source:this.id,name:`Screenshot ${new Date().toISOString()}.${h}`,type:n,data:p};try{this.capturedMediaFile=m;let y=URL.createObjectURL(p);this.setPluginState({capturedScreenshotUrl:y,status:"captured"}),l()}catch(y){this.getPluginState().capturedScreenshotUrl&&this.setPluginState({capturedScreenshotUrl:null}),nt(y)||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(mm,{...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 gm={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:{"@uppy-dev/tsconfig":"workspace:^",cssnano:"^8.0.1",postcss:"^8.5.23","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^6.0.3"}};var ym={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 xt={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};var Su=ce(Me(),1);var vu=ce(Me(),1);var Vw="\xB7",vm=o(()=>` ${Vw} `,"renderDot");function bm(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:a,startUpload:l}=i,c=(0,vu.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":n===xt.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(bm,"UploadBtn");function wm(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(wm,"RetryBtn");function Sm(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(Sm,"CancelBtn");function xm(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(xm,"PauseResumeButton");function _m(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(_m,"DoneBtn");function Em(){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(Em,"LoadingSpinner");function Pm(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return u("div",{className:"uppy-StatusBar-content",children:[u(Em,{}),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s]})}o(Pm,"ProgressBarProcessing");function Ww(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:a}=i,l=e>1,c=Ke(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&&vm(),s!=null?a("dataUploadedOfTotal",{complete:c,total:Ke(s)}):a("dataUploadedOfUnknown",{complete:c}),vm(),n!=null&&a("xTimeLeft",{time:or(n)})]})]})}o(Ww,"ProgressDetails");function Tm(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(Tm,"FileUploadCount");function Gw(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,vu.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(Gw,"UploadNewlyAddedFiles");function km(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,showProgressDetails:s,isUploadStarted:n,isAllComplete:a,isAllPaused:l,newFiles:c,numUploads:p,complete:h,totalUploadedSize:m,totalSize:y,totalETA:S,startUpload:b}=i,k=c&&n;if(!n||a)return null;let A=e(l?"paused":"uploading");function j(){return!l&&!k&&s?t?u(Ww,{numUploads:p,complete:h,totalUploadedSize:m,totalSize:y,totalETA:S,i18n:e}):u(Tm,{i18n:e,complete:h,numUploads:p}):null}return o(j,"renderProgressDetails"),u("div",{className:"uppy-StatusBar-content",title:A,children:[l?null:u(Em,{}),u("div",{className:"uppy-StatusBar-status",children:[u("div",{className:"uppy-StatusBar-statusPrimary",children:t&&r!==0?`${A}: ${r}%`:A}),j(),k?u(Gw,{i18n:e,newFiles:c,startUpload:b}):null]})]})}o(km,"ProgressBarUploading");function Fm(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(Fm,"ProgressBarComplete");function Cm(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(Tm,{i18n:t,complete:r,numUploads:s})]})]})}o(Cm,"ProgressBarError");function Vs(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(Vs,"calculateProcessingProgress");var{STATE_ERROR:Rm,STATE_WAITING:Xw,STATE_PREPROCESSING:bu,STATE_UPLOADING:In,STATE_POSTPROCESSING:wu,STATE_COMPLETE:On}=xt;function xu({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:m,totalProgress:y,files:S,supportsUploadProgress:b,hideAfterFinish:k=!1,isSomeGhost:A,doneButtonHandler:j=void 0,isUploadStarted:R,i18n:T,startUpload:M,uppy:$,isAllComplete:L,showProgressDetails:J=void 0,numUploads:G,complete:Z,totalSize:ie,totalETA:oe,totalUploadedSize:Ie}){function be(){switch(m){case wu:case bu:{let Q=Vs(S);return Q.mode==="determinate"?Q.value*100:y}case Rm:return null;case In:return b?y:null;default:return y}}o(be,"getProgressValue");function me(){switch(m){case wu:case bu:{let{mode:Q}=Vs(S);return Q==="indeterminate"}case In:return!b;default:return!1}}o(me,"getIsIndeterminate");let Te=be(),F=Te??100,x=!n&&i&&(!t&&!r||h)&&e&&!a,E=!c&&m!==Xw&&m!==On,z=s&&!l&&m===In,V=n&&!L&&!p,H=j&&m===On,ee=(0,Su.default)("uppy-StatusBar-progress",{"is-indeterminate":me()}),N=(0,Su.default)("uppy-StatusBar",`is-${m}`,{"has-ghosts":A}),C=(()=>{switch(m){case bu:case wu:return u(Pm,{progress:Vs(S)});case On:return u(Fm,{i18n:T});case Rm:return u(Cm,{error:n,i18n:T,numUploads:G,complete:Z});case In:return u(km,{i18n:T,supportsUploadProgress:b,totalProgress:y,showProgressDetails:J,isUploadStarted:R,isAllComplete:L,isAllPaused:r,newFiles:i,numUploads:G,complete:Z,totalUploadedSize:Ie,totalSize:ie,totalETA:oe,startUpload:M});default:return null}})();return!(x||V||z||E||H)&&!C||m===On&&k?null:u("div",{className:N,children:[u("div",{className:ee,style:{width:`${F}%`},role:"progressbar","aria-label":`${F}%`,"aria-valuetext":`${F}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Te}),C,u("div",{className:"uppy-StatusBar-actions",children:[x?u(bm,{newFiles:i,isUploadStarted:R,recoveredState:h,i18n:T,isSomeGhost:A,startUpload:M,uploadState:m}):null,V?u(wm,{i18n:T,uppy:$}):null,z?u(xm,{isAllPaused:r,i18n:T,isAllComplete:L,resumableUploads:s,uppy:$}):null,E?u(Sm,{i18n:T,uppy:$}):null,H?u(_m,{i18n:T,doneButtonHandler:j}):null]})]})}o(xu,"StatusBarUI");var Kw=2e3,Yw=2e3;function Jw(i,e,t,r){if(i)return xt.STATE_ERROR;if(e)return xt.STATE_COMPLETE;if(t)return xt.STATE_WAITING;let s=xt.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 xt.STATE_UPLOADING;l.preprocess&&(s=xt.STATE_PREPROCESSING),l.postprocess&&s!==xt.STATE_PREPROCESSING&&(s=xt.STATE_POSTPROCESSING)}return s}o(Jw,"getUploadingState");var Qw={hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideCancelButton:!1,showProgressDetails:!1,hideAfterFinish:!0,doneButtonHandler:null},Ws=class extends le{static{o(this,"StatusBar")}static VERSION=gm.version;#e;#t;#i;#r;constructor(e,t){super(e,{...Qw,...t}),this.id=this.opts.id||"StatusBar",this.title="StatusBar",this.type="progressindicator",this.defaultLocale=ym,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:ai(n,this.#i,Kw,r);this.#i=a;let l=t/a,c=Math.max(this.#r-r,0),p=this.#r==null?l:ai(l,c,Yw,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:m,isAllComplete:y,isAllPaused:S,isUploadInProgress:b,isSomeGhost:k}=this.uppy.getObjectOfFilesPerState(),A=l?Object.values(r):c,j=!!t.resumableUploads,R=t.uploadProgress!==!1,T=null,M=0;p.every(L=>L.progress.bytesTotal!=null&&L.progress.bytesTotal!==0)?(T=0,p.forEach(L=>{T+=L.progress.bytesTotal||0,M+=L.progress.bytesUploaded||0})):p.forEach(L=>{M+=L.progress.bytesUploaded||0});let $=this.#s({uploaded:M,total:T});return xu({error:a,uploadState:Jw(a,y,l,e.files||{}),allowNewUpload:s,totalProgress:n,totalSize:T,totalUploadedSize:M,isAllComplete:!1,isAllPaused:S,isUploadStarted:m,isUploadInProgress:b,isSomeGhost:k,recoveredState:l,complete:h.length,newFiles:A.length,numUploads:p.length,totalETA:$,files:r,i18n:this.i18n,uppy:this.uppy,startUpload:this.startUpload,doneButtonHandler:this.opts.doneButtonHandler,resumableUploads:j,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;Gr(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 Cr(i){"@babel/helpers - typeof";return Cr=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},Cr(i)}o(Cr,"_typeof");function Am(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,eS(r.key),r)}}o(Am,"_defineProperties");function Zw(i,e,t){return e&&Am(i.prototype,e),t&&Am(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(Zw,"_createClass");function eS(i){var e=tS(i,"string");return Cr(e)=="symbol"?e:e+""}o(eS,"_toPropertyKey");function tS(i,e){if(Cr(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Cr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(tS,"_toPrimitive");function iS(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(iS,"_classCallCheck");function rS(i,e,t){return e=Xs(e),sS(i,Eu()?Reflect.construct(e,t||[],Xs(i).constructor):e.apply(i,t))}o(rS,"_callSuper");function sS(i,e){if(e&&(Cr(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return oS(i)}o(sS,"_possibleConstructorReturn");function oS(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}o(oS,"_assertThisInitialized");function nS(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&&Gs(i,e)}o(nS,"_inherits");function _u(i){var e=typeof Map=="function"?new Map:void 0;return _u=o(function(r){if(r===null||!lS(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 aS(r,arguments,Xs(this).constructor)}return o(s,"Wrapper"),s.prototype=Object.create(r.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),Gs(s,r)},"_wrapNativeSuper"),_u(i)}o(_u,"_wrapNativeSuper");function aS(i,e,t){if(Eu())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var s=new(i.bind.apply(i,r));return t&&Gs(s,t.prototype),s}o(aS,"_construct");function Eu(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Eu=o(function(){return!!i},"_isNativeReflectConstruct"))()}o(Eu,"_isNativeReflectConstruct");function lS(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}o(lS,"_isNativeFunction");function Gs(i,e){return Gs=Object.setPrototypeOf?Object.setPrototypeOf.bind():o(function(r,s){return r.__proto__=s,r},"_setPrototypeOf"),Gs(i,e)}o(Gs,"_setPrototypeOf");function Xs(i){return Xs=Object.setPrototypeOf?Object.getPrototypeOf.bind():o(function(t){return t.__proto__||Object.getPrototypeOf(t)},"_getPrototypeOf"),Xs(i)}o(Xs,"_getPrototypeOf");var uS=(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(iS(this,e),r=rS(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",m=a?a.getBody()||"":"n/a";t+=", originated from request (method: ".concat(c,", url: ").concat(p,", response code: ").concat(h,", response text: ").concat(m,", request id: ").concat(l,")")}return r.message=t,r}return o(e,"DetailedError"),nS(e,i),Zw(e)})(_u(Error)),Rr=uS;var cS=!1;function bi(i){cS&&console.log(i)}o(bi,"log");function Ks(i){"@babel/helpers - typeof";return Ks=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},Ks(i)}o(Ks,"_typeof");function pS(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(pS,"_classCallCheck");function Im(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,hS(r.key),r)}}o(Im,"_defineProperties");function dS(i,e,t){return e&&Im(i.prototype,e),t&&Im(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(dS,"_createClass");function hS(i){var e=fS(i,"string");return Ks(e)=="symbol"?e:e+""}o(hS,"_toPropertyKey");function fS(i,e){if(Ks(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Ks(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(fS,"_toPrimitive");var Om=(function(){function i(){pS(this,i)}return o(i,"NoopUrlStorage"),dS(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 Bm="3.7.7",mS=Bm,Ir=typeof Buffer=="function",Um=typeof TextDecoder=="function"?new TextDecoder:void 0,Dm=typeof TextEncoder=="function"?new TextEncoder:void 0,gS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Ys=Array.prototype.slice.call(gS),Un=(i=>{let e={};return i.forEach((t,r)=>e[t]=r),e})(Ys),yS=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,tt=String.fromCharCode.bind(String),Nm=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):i=>new Uint8Array(Array.prototype.slice.call(i,0)),jm=o(i=>i.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),"_mkUriSafe"),zm=o(i=>i.replace(/[^A-Za-z0-9\+\/]/g,""),"_tidyB64"),Hm=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+=Ys[e>>18&63]+Ys[e>>12&63]+Ys[e>>6&63]+Ys[e&63]}return a?n.slice(0,a-3)+"===".substring(a):n},"btoaPolyfill"),ku=typeof btoa=="function"?i=>btoa(i):Ir?i=>Buffer.from(i,"binary").toString("base64"):Hm,Pu=Ir?i=>Buffer.from(i).toString("base64"):i=>{let t=[];for(let r=0,s=i.length;r<s;r+=4096)t.push(tt.apply(null,i.subarray(r,r+4096)));return ku(t.join(""))},Dn=o((i,e=!1)=>e?jm(Pu(i)):Pu(i),"fromUint8Array"),vS=o(i=>{if(i.length<2){var e=i.charCodeAt(0);return e<128?i:e<2048?tt(192|e>>>6)+tt(128|e&63):tt(224|e>>>12&15)+tt(128|e>>>6&63)+tt(128|e&63)}else{var e=65536+(i.charCodeAt(0)-55296)*1024+(i.charCodeAt(1)-56320);return tt(240|e>>>18&7)+tt(128|e>>>12&63)+tt(128|e>>>6&63)+tt(128|e&63)}},"cb_utob"),bS=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,qm=o(i=>i.replace(bS,vS),"utob"),Mm=Ir?i=>Buffer.from(i,"utf8").toString("base64"):Dm?i=>Pu(Dm.encode(i)):i=>ku(qm(i)),Ar=o((i,e=!1)=>e?jm(Mm(i)):Mm(i),"encode"),Lm=o(i=>Ar(i,!0),"encodeURI"),wS=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,SS=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 tt((t>>>10)+55296)+tt((t&1023)+56320);case 3:return tt((15&i.charCodeAt(0))<<12|(63&i.charCodeAt(1))<<6|63&i.charCodeAt(2));default:return tt((31&i.charCodeAt(0))<<6|63&i.charCodeAt(1))}},"cb_btou"),$m=o(i=>i.replace(wS,SS),"btou"),Vm=o(i=>{if(i=i.replace(/\s+/g,""),!yS.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=Un[i.charAt(n++)]<<18|Un[i.charAt(n++)]<<12|(r=Un[i.charAt(n++)])<<6|(s=Un[i.charAt(n++)]),t+=r===64?tt(e>>16&255):s===64?tt(e>>16&255,e>>8&255):tt(e>>16&255,e>>8&255,e&255);return t},"atobPolyfill"),Fu=typeof atob=="function"?i=>atob(zm(i)):Ir?i=>Buffer.from(i,"base64").toString("binary"):Vm,Wm=Ir?i=>Nm(Buffer.from(i,"base64")):i=>Nm(Fu(i).split("").map(e=>e.charCodeAt(0))),Gm=o(i=>Wm(Xm(i)),"toUint8Array"),xS=Ir?i=>Buffer.from(i,"base64").toString("utf8"):Um?i=>Um.decode(Wm(i)):i=>$m(Fu(i)),Xm=o(i=>zm(i.replace(/[-_]/g,e=>e=="-"?"+":"/")),"_unURI"),Tu=o(i=>xS(Xm(i)),"decode"),_S=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"),Km=o(i=>({value:i,enumerable:!1,writable:!0,configurable:!0}),"_noEnum"),Ym=o(function(){let i=o((e,t)=>Object.defineProperty(String.prototype,e,Km(t)),"_add");i("fromBase64",function(){return Tu(this)}),i("toBase64",function(e){return Ar(this,e)}),i("toBase64URI",function(){return Ar(this,!0)}),i("toBase64URL",function(){return Ar(this,!0)}),i("toUint8Array",function(){return Gm(this)})},"extendString"),Jm=o(function(){let i=o((e,t)=>Object.defineProperty(Uint8Array.prototype,e,Km(t)),"_add");i("toBase64",function(e){return Dn(this,e)}),i("toBase64URI",function(){return Dn(this,!0)}),i("toBase64URL",function(){return Dn(this,!0)})},"extendUint8Array"),ES=o(()=>{Ym(),Jm()},"extendBuiltins"),Qm={version:Bm,VERSION:mS,atob:Fu,atobPolyfill:Vm,btoa:ku,btoaPolyfill:Hm,fromBase64:Tu,toBase64:Ar,encode:Ar,encodeURI:Lm,encodeURL:Lm,utob:qm,btou:$m,decode:Tu,isValid:_S,fromUint8Array:Dn,toUint8Array:Gm,extendString:Ym,extendUint8Array:Jm,extendBuiltins:ES};var Eg=ce(pg());function Iu(){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(Iu,"uuid");function Ou(){"use strict";Ou=o(function(){return e},"_regeneratorRuntime");var i,e={},t=Object.prototype,r=t.hasOwnProperty,s=Object.defineProperty||function(F,x,E){F[x]=E.value},n=typeof Symbol=="function"?Symbol:{},a=n.iterator||"@@iterator",l=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function p(F,x,E){return Object.defineProperty(F,x,{value:E,enumerable:!0,configurable:!0,writable:!0}),F[x]}o(p,"define");try{p({},"")}catch{p=o(function(E,z,V){return E[z]=V},"define")}function h(F,x,E,z){var V=x&&x.prototype instanceof j?x:j,H=Object.create(V.prototype),ee=new me(z||[]);return s(H,"_invoke",{value:ie(F,E,ee)}),H}o(h,"wrap");function m(F,x,E){try{return{type:"normal",arg:F.call(x,E)}}catch(z){return{type:"throw",arg:z}}}o(m,"tryCatch"),e.wrap=h;var y="suspendedStart",S="suspendedYield",b="executing",k="completed",A={};function j(){}o(j,"Generator");function R(){}o(R,"GeneratorFunction");function T(){}o(T,"GeneratorFunctionPrototype");var M={};p(M,a,function(){return this});var $=Object.getPrototypeOf,L=$&&$($(Te([])));L&&L!==t&&r.call(L,a)&&(M=L);var J=T.prototype=j.prototype=Object.create(M);function G(F){["next","throw","return"].forEach(function(x){p(F,x,function(E){return this._invoke(x,E)})})}o(G,"defineIteratorMethods");function Z(F,x){function E(V,H,ee,N){var C=m(F[V],F,H);if(C.type!=="throw"){var O=C.arg,B=O.value;return B&&Vi(B)=="object"&&r.call(B,"__await")?x.resolve(B.__await).then(function(Y){E("next",Y,ee,N)},function(Y){E("throw",Y,ee,N)}):x.resolve(B).then(function(Y){O.value=Y,ee(O)},function(Y){return E("throw",Y,ee,N)})}N(C.arg)}o(E,"invoke");var z;s(this,"_invoke",{value:o(function(H,ee){function N(){return new x(function(C,O){E(H,ee,C,O)})}return o(N,"callInvokeWithMethodAndArg"),z=z?z.then(N,N):N()},"value")})}o(Z,"AsyncIterator");function ie(F,x,E){var z=y;return function(V,H){if(z===b)throw Error("Generator is already running");if(z===k){if(V==="throw")throw H;return{value:i,done:!0}}for(E.method=V,E.arg=H;;){var ee=E.delegate;if(ee){var N=oe(ee,E);if(N){if(N===A)continue;return N}}if(E.method==="next")E.sent=E._sent=E.arg;else if(E.method==="throw"){if(z===y)throw z=k,E.arg;E.dispatchException(E.arg)}else E.method==="return"&&E.abrupt("return",E.arg);z=b;var C=m(F,x,E);if(C.type==="normal"){if(z=E.done?k:S,C.arg===A)continue;return{value:C.arg,done:E.done}}C.type==="throw"&&(z=k,E.method="throw",E.arg=C.arg)}}}o(ie,"makeInvokeMethod");function oe(F,x){var E=x.method,z=F.iterator[E];if(z===i)return x.delegate=null,E==="throw"&&F.iterator.return&&(x.method="return",x.arg=i,oe(F,x),x.method==="throw")||E!=="return"&&(x.method="throw",x.arg=new TypeError("The iterator does not provide a '"+E+"' method")),A;var V=m(z,F.iterator,x.arg);if(V.type==="throw")return x.method="throw",x.arg=V.arg,x.delegate=null,A;var H=V.arg;return H?H.done?(x[F.resultName]=H.value,x.next=F.nextLoc,x.method!=="return"&&(x.method="next",x.arg=i),x.delegate=null,A):H:(x.method="throw",x.arg=new TypeError("iterator result is not an object"),x.delegate=null,A)}o(oe,"maybeInvokeDelegate");function Ie(F){var x={tryLoc:F[0]};1 in F&&(x.catchLoc=F[1]),2 in F&&(x.finallyLoc=F[2],x.afterLoc=F[3]),this.tryEntries.push(x)}o(Ie,"pushTryEntry");function be(F){var x=F.completion||{};x.type="normal",delete x.arg,F.completion=x}o(be,"resetTryEntry");function me(F){this.tryEntries=[{tryLoc:"root"}],F.forEach(Ie,this),this.reset(!0)}o(me,"Context");function Te(F){if(F||F===""){var x=F[a];if(x)return x.call(F);if(typeof F.next=="function")return F;if(!isNaN(F.length)){var E=-1,z=o(function V(){for(;++E<F.length;)if(r.call(F,E))return V.value=F[E],V.done=!1,V;return V.value=i,V.done=!0,V},"next");return z.next=z}}throw new TypeError(Vi(F)+" is not iterable")}return o(Te,"values"),R.prototype=T,s(J,"constructor",{value:T,configurable:!0}),s(T,"constructor",{value:R,configurable:!0}),R.displayName=p(T,c,"GeneratorFunction"),e.isGeneratorFunction=function(F){var x=typeof F=="function"&&F.constructor;return!!x&&(x===R||(x.displayName||x.name)==="GeneratorFunction")},e.mark=function(F){return Object.setPrototypeOf?Object.setPrototypeOf(F,T):(F.__proto__=T,p(F,c,"GeneratorFunction")),F.prototype=Object.create(J),F},e.awrap=function(F){return{__await:F}},G(Z.prototype),p(Z.prototype,l,function(){return this}),e.AsyncIterator=Z,e.async=function(F,x,E,z,V){V===void 0&&(V=Promise);var H=new Z(h(F,x,E,z),V);return e.isGeneratorFunction(x)?H:H.next().then(function(ee){return ee.done?ee.value:H.next()})},G(J),p(J,c,"Generator"),p(J,a,function(){return this}),p(J,"toString",function(){return"[object Generator]"}),e.keys=function(F){var x=Object(F),E=[];for(var z in x)E.push(z);return E.reverse(),o(function V(){for(;E.length;){var H=E.pop();if(H in x)return V.value=H,V.done=!1,V}return V.done=!0,V},"next")},e.values=Te,me.prototype={constructor:me,reset:o(function(x){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),!x)for(var E in this)E.charAt(0)==="t"&&r.call(this,E)&&!isNaN(+E.slice(1))&&(this[E]=i)},"reset"),stop:o(function(){this.done=!0;var x=this.tryEntries[0].completion;if(x.type==="throw")throw x.arg;return this.rval},"stop"),dispatchException:o(function(x){if(this.done)throw x;var E=this;function z(O,B){return ee.type="throw",ee.arg=x,E.next=O,B&&(E.method="next",E.arg=i),!!B}o(z,"handle");for(var V=this.tryEntries.length-1;V>=0;--V){var H=this.tryEntries[V],ee=H.completion;if(H.tryLoc==="root")return z("end");if(H.tryLoc<=this.prev){var N=r.call(H,"catchLoc"),C=r.call(H,"finallyLoc");if(N&&C){if(this.prev<H.catchLoc)return z(H.catchLoc,!0);if(this.prev<H.finallyLoc)return z(H.finallyLoc)}else if(N){if(this.prev<H.catchLoc)return z(H.catchLoc,!0)}else{if(!C)throw Error("try statement without catch or finally");if(this.prev<H.finallyLoc)return z(H.finallyLoc)}}}},"dispatchException"),abrupt:o(function(x,E){for(var z=this.tryEntries.length-1;z>=0;--z){var V=this.tryEntries[z];if(V.tryLoc<=this.prev&&r.call(V,"finallyLoc")&&this.prev<V.finallyLoc){var H=V;break}}H&&(x==="break"||x==="continue")&&H.tryLoc<=E&&E<=H.finallyLoc&&(H=null);var ee=H?H.completion:{};return ee.type=x,ee.arg=E,H?(this.method="next",this.next=H.finallyLoc,A):this.complete(ee)},"abrupt"),complete:o(function(x,E){if(x.type==="throw")throw x.arg;return x.type==="break"||x.type==="continue"?this.next=x.arg:x.type==="return"?(this.rval=this.arg=x.arg,this.method="return",this.next="end"):x.type==="normal"&&E&&(this.next=E),A},"complete"),finish:o(function(x){for(var E=this.tryEntries.length-1;E>=0;--E){var z=this.tryEntries[E];if(z.finallyLoc===x)return this.complete(z.completion,z.afterLoc),be(z),A}},"finish"),catch:o(function(x){for(var E=this.tryEntries.length-1;E>=0;--E){var z=this.tryEntries[E];if(z.tryLoc===x){var V=z.completion;if(V.type==="throw"){var H=V.arg;be(z)}return H}}throw Error("illegal catch attempt")},"_catch"),delegateYield:o(function(x,E,z){return this.delegate={iterator:Te(x),resultName:E,nextLoc:z},this.method==="next"&&(this.arg=i),A},"delegateYield")},e}o(Ou,"_regeneratorRuntime");function dg(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(dg,"asyncGeneratorStep");function NS(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function a(c){dg(n,r,s,a,l,"next",c)}o(a,"_next");function l(c){dg(n,r,s,a,l,"throw",c)}o(l,"_throw"),a(void 0)})}}o(NS,"_asyncToGenerator");function Sg(i,e){return BS(i)||LS(i,e)||xg(i,e)||MS()}o(Sg,"_slicedToArray");function MS(){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(MS,"_nonIterableRest");function LS(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(LS,"_iterableToArrayLimit");function BS(i){if(Array.isArray(i))return i}o(BS,"_arrayWithHoles");function Vi(i){"@babel/helpers - typeof";return Vi=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},Vi(i)}o(Vi,"_typeof");function jS(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=xg(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(jS,"_createForOfIteratorHelper");function xg(i,e){if(i){if(typeof i=="string")return hg(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 hg(i,e)}}o(xg,"_unsupportedIterableToArray");function hg(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(hg,"_arrayLikeToArray");function fg(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(fg,"ownKeys");function Or(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fg(Object(t),!0).forEach(function(r){zS(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):fg(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}o(Or,"_objectSpread");function zS(i,e,t){return e=_g(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}o(zS,"_defineProperty");function HS(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(HS,"_classCallCheck");function mg(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,_g(r.key),r)}}o(mg,"_defineProperties");function qS(i,e,t){return e&&mg(i.prototype,e),t&&mg(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(qS,"_createClass");function _g(i){var e=$S(i,"string");return Vi(e)=="symbol"?e:e+""}o(_g,"_toPropertyKey");function $S(i,e){if(Vi(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Vi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o($S,"_toPrimitive");var Mn="tus-v1",Ln="ietf-draft-03",Js="ietf-draft-05",VS={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:Tg,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:Mn},Pg=(function(){function i(e,t){HS(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"),qS(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(![Mn,Ln,Js].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?bi("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):bi("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:GS(this._source.size,a);this._parallelUploadUrls&&l.forEach(function(h,m){h.uploadUrl=r._parallelUploadUrls[m]||null}),this._parallelUploadUrls=new Array(l.length);var c=l.map(function(h,m){var y=0;return r._source.slice(h.start,h.end).then(function(S){var b=S.value;return new Promise(function(k,A){var j=Or(Or({},r.options),{},{uploadUrl:h.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:r.options.metadataForPartialUploads,headers:Or(Or({},r.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:k,onError:A,onProgress:o(function(M){n=n-y+M,y=M,r._emitProgress(n,s)},"onProgress"),onUploadUrlAvailable:o(function(){r._parallelUploadUrls[m]=R.url,r._parallelUploadUrls.filter(function(M){return!!M}).length===l.length&&r._saveUploadInUrlStorage()},"onUploadUrlAvailable")}),R=new i(b,j);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=gg(r.options.metadata);return h!==""&&p.setHeader("Upload-Metadata",h),r._sendRequest(p,null)}).then(function(h){if(!Ur(h.getStatus(),200)){r._emitHttpError(p,h,"tus: unexpected response while creating upload");return}var m=h.getHeader("Location");if(m==null){r._emitHttpError(p,h,"tus: invalid or missing Location header");return}r.url=wg(r.options.endpoint,m),bi("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){bi("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){bi("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}bi("Creating a new upload"),this._createUpload()},"_startSingleUpload")},{key:"abort",value:o(function(t){var r=this;if(this._parallelUploads!=null){var s=jS(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 Rr(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),bg(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=gg(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===Ln||this.options.protocol===Js)&&r.setHeader("Upload-Complete","?0"),n=this._sendRequest(r,null)),n.then(function(a){if(!Ur(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=wg(t.options.endpoint,l),bi("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(!Ur(a,200)){if(a===423){t._emitHttpError(r,n,"tus: upload is currently locked; retry later");return}if(Ur(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===Mn){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(!Ur(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===Mn?t.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Js&&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===Ln||r.options.protocol===Js)&&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=yg(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 vg(t,r,this.options)},"_sendRequest")}],[{key:"terminate",value:o(function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=yg("DELETE",t,r);return vg(s,null,r).then(function(n){if(n.getStatus()!==204)throw new Rr("tus: unexpected response while terminating upload",null,s,n)}).catch(function(n){if(n instanceof Rr||(n=new Rr("tus: failed to terminate upload",n,s,null)),!bg(n,0,r))throw n;var a=r.retryDelays[0],l=r.retryDelays.slice(1),c=Or(Or({},r),{},{retryDelays:l});return new Promise(function(p){return setTimeout(p,a)}).then(function(){return i.terminate(t,c)})})},"terminate")}])})();function gg(i){return Object.entries(i).map(function(e){var t=Sg(e,2),r=t[0],s=t[1];return"".concat(r," ").concat(Qm.encode(String(s)))}).join(",")}o(gg,"encodeMetadata");function Ur(i,e){return i>=e&&i<e+100}o(Ur,"inStatusCategory");function yg(i,e,t){var r=t.httpStack.createRequest(i,e);t.protocol===Ln?r.setHeader("Upload-Draft-Interop-Version","5"):t.protocol===Js?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=Sg(a[n],2),c=l[0],p=l[1];r.setHeader(c,p)}if(t.addRequestId){var h=Iu();r.setHeader("X-Request-ID",h)}return r}o(yg,"openRequest");function vg(i,e,t){return Uu.apply(this,arguments)}o(vg,"sendRequest");function Uu(){return Uu=NS(Ou().mark(o(function i(e,t,r){var s;return Ou().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"))),Uu.apply(this,arguments)}o(Uu,"_sendRequest2");function WS(){var i=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(i=!1),i}o(WS,"isOnline");function bg(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):Tg(i)}o(bg,"shouldRetry");function Tg(i){var e=i.originalResponse?i.originalResponse.getStatus():0;return(!Ur(e,400)||e===409||e===423)&&WS()}o(Tg,"defaultOnShouldRetry");function wg(i,e){return new Eg.default(e,i).toString()}o(wg,"resolveUrl");function GS(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(GS,"splitSizeIntoParts");Pg.defaultOptions=VS;var Bn=Pg;var XS=o(function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"},"isReactNative"),jn=XS;function Du(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(Du,"uriToBlob");var KS=o(function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")},"isCordova"),kg=KS;function Nu(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(Nu,"readAsByteArray");function Qs(i){"@babel/helpers - typeof";return Qs=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},Qs(i)}o(Qs,"_typeof");function YS(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(YS,"_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,QS(r.key),r)}}o(Fg,"_defineProperties");function JS(i,e,t){return e&&Fg(i.prototype,e),t&&Fg(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(JS,"_createClass");function QS(i){var e=ZS(i,"string");return Qs(e)=="symbol"?e:e+""}o(QS,"_toPropertyKey");function ZS(i,e){if(Qs(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Qs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(ZS,"_toPrimitive");var Mu=(function(){function i(e){YS(this,i),this._file=e,this.size=e.size}return o(i,"FileSource"),JS(i,[{key:"slice",value:o(function(t,r){if(kg())return Nu(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 Zs(i){"@babel/helpers - typeof";return Zs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zs(i)}o(Zs,"_typeof");function ex(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(ex,"_classCallCheck");function Cg(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,ix(r.key),r)}}o(Cg,"_defineProperties");function tx(i,e,t){return e&&Cg(i.prototype,e),t&&Cg(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(tx,"_createClass");function ix(i){var e=rx(i,"string");return Zs(e)=="symbol"?e:e+""}o(ix,"_toPropertyKey");function rx(i,e){if(Zs(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Zs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(rx,"_toPrimitive");function Rg(i){return i===void 0?0:i.size!==void 0?i.size:i.length}o(Rg,"len");function sx(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(sx,"concat");var Ag=(function(){function i(e){ex(this,i),this._buffer=void 0,this._bufferOffset=0,this._reader=e,this._done=!1}return o(i,"StreamSource"),tx(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+Rg(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=sx(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=Rg(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 Wi(i){"@babel/helpers - typeof";return Wi=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},Wi(i)}o(Wi,"_typeof");function Lu(){"use strict";Lu=o(function(){return e},"_regeneratorRuntime");var i,e={},t=Object.prototype,r=t.hasOwnProperty,s=Object.defineProperty||function(F,x,E){F[x]=E.value},n=typeof Symbol=="function"?Symbol:{},a=n.iterator||"@@iterator",l=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function p(F,x,E){return Object.defineProperty(F,x,{value:E,enumerable:!0,configurable:!0,writable:!0}),F[x]}o(p,"define");try{p({},"")}catch{p=o(function(E,z,V){return E[z]=V},"define")}function h(F,x,E,z){var V=x&&x.prototype instanceof j?x:j,H=Object.create(V.prototype),ee=new me(z||[]);return s(H,"_invoke",{value:ie(F,E,ee)}),H}o(h,"wrap");function m(F,x,E){try{return{type:"normal",arg:F.call(x,E)}}catch(z){return{type:"throw",arg:z}}}o(m,"tryCatch"),e.wrap=h;var y="suspendedStart",S="suspendedYield",b="executing",k="completed",A={};function j(){}o(j,"Generator");function R(){}o(R,"GeneratorFunction");function T(){}o(T,"GeneratorFunctionPrototype");var M={};p(M,a,function(){return this});var $=Object.getPrototypeOf,L=$&&$($(Te([])));L&&L!==t&&r.call(L,a)&&(M=L);var J=T.prototype=j.prototype=Object.create(M);function G(F){["next","throw","return"].forEach(function(x){p(F,x,function(E){return this._invoke(x,E)})})}o(G,"defineIteratorMethods");function Z(F,x){function E(V,H,ee,N){var C=m(F[V],F,H);if(C.type!=="throw"){var O=C.arg,B=O.value;return B&&Wi(B)=="object"&&r.call(B,"__await")?x.resolve(B.__await).then(function(Y){E("next",Y,ee,N)},function(Y){E("throw",Y,ee,N)}):x.resolve(B).then(function(Y){O.value=Y,ee(O)},function(Y){return E("throw",Y,ee,N)})}N(C.arg)}o(E,"invoke");var z;s(this,"_invoke",{value:o(function(H,ee){function N(){return new x(function(C,O){E(H,ee,C,O)})}return o(N,"callInvokeWithMethodAndArg"),z=z?z.then(N,N):N()},"value")})}o(Z,"AsyncIterator");function ie(F,x,E){var z=y;return function(V,H){if(z===b)throw Error("Generator is already running");if(z===k){if(V==="throw")throw H;return{value:i,done:!0}}for(E.method=V,E.arg=H;;){var ee=E.delegate;if(ee){var N=oe(ee,E);if(N){if(N===A)continue;return N}}if(E.method==="next")E.sent=E._sent=E.arg;else if(E.method==="throw"){if(z===y)throw z=k,E.arg;E.dispatchException(E.arg)}else E.method==="return"&&E.abrupt("return",E.arg);z=b;var C=m(F,x,E);if(C.type==="normal"){if(z=E.done?k:S,C.arg===A)continue;return{value:C.arg,done:E.done}}C.type==="throw"&&(z=k,E.method="throw",E.arg=C.arg)}}}o(ie,"makeInvokeMethod");function oe(F,x){var E=x.method,z=F.iterator[E];if(z===i)return x.delegate=null,E==="throw"&&F.iterator.return&&(x.method="return",x.arg=i,oe(F,x),x.method==="throw")||E!=="return"&&(x.method="throw",x.arg=new TypeError("The iterator does not provide a '"+E+"' method")),A;var V=m(z,F.iterator,x.arg);if(V.type==="throw")return x.method="throw",x.arg=V.arg,x.delegate=null,A;var H=V.arg;return H?H.done?(x[F.resultName]=H.value,x.next=F.nextLoc,x.method!=="return"&&(x.method="next",x.arg=i),x.delegate=null,A):H:(x.method="throw",x.arg=new TypeError("iterator result is not an object"),x.delegate=null,A)}o(oe,"maybeInvokeDelegate");function Ie(F){var x={tryLoc:F[0]};1 in F&&(x.catchLoc=F[1]),2 in F&&(x.finallyLoc=F[2],x.afterLoc=F[3]),this.tryEntries.push(x)}o(Ie,"pushTryEntry");function be(F){var x=F.completion||{};x.type="normal",delete x.arg,F.completion=x}o(be,"resetTryEntry");function me(F){this.tryEntries=[{tryLoc:"root"}],F.forEach(Ie,this),this.reset(!0)}o(me,"Context");function Te(F){if(F||F===""){var x=F[a];if(x)return x.call(F);if(typeof F.next=="function")return F;if(!isNaN(F.length)){var E=-1,z=o(function V(){for(;++E<F.length;)if(r.call(F,E))return V.value=F[E],V.done=!1,V;return V.value=i,V.done=!0,V},"next");return z.next=z}}throw new TypeError(Wi(F)+" is not iterable")}return o(Te,"values"),R.prototype=T,s(J,"constructor",{value:T,configurable:!0}),s(T,"constructor",{value:R,configurable:!0}),R.displayName=p(T,c,"GeneratorFunction"),e.isGeneratorFunction=function(F){var x=typeof F=="function"&&F.constructor;return!!x&&(x===R||(x.displayName||x.name)==="GeneratorFunction")},e.mark=function(F){return Object.setPrototypeOf?Object.setPrototypeOf(F,T):(F.__proto__=T,p(F,c,"GeneratorFunction")),F.prototype=Object.create(J),F},e.awrap=function(F){return{__await:F}},G(Z.prototype),p(Z.prototype,l,function(){return this}),e.AsyncIterator=Z,e.async=function(F,x,E,z,V){V===void 0&&(V=Promise);var H=new Z(h(F,x,E,z),V);return e.isGeneratorFunction(x)?H:H.next().then(function(ee){return ee.done?ee.value:H.next()})},G(J),p(J,c,"Generator"),p(J,a,function(){return this}),p(J,"toString",function(){return"[object Generator]"}),e.keys=function(F){var x=Object(F),E=[];for(var z in x)E.push(z);return E.reverse(),o(function V(){for(;E.length;){var H=E.pop();if(H in x)return V.value=H,V.done=!1,V}return V.done=!0,V},"next")},e.values=Te,me.prototype={constructor:me,reset:o(function(x){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),!x)for(var E in this)E.charAt(0)==="t"&&r.call(this,E)&&!isNaN(+E.slice(1))&&(this[E]=i)},"reset"),stop:o(function(){this.done=!0;var x=this.tryEntries[0].completion;if(x.type==="throw")throw x.arg;return this.rval},"stop"),dispatchException:o(function(x){if(this.done)throw x;var E=this;function z(O,B){return ee.type="throw",ee.arg=x,E.next=O,B&&(E.method="next",E.arg=i),!!B}o(z,"handle");for(var V=this.tryEntries.length-1;V>=0;--V){var H=this.tryEntries[V],ee=H.completion;if(H.tryLoc==="root")return z("end");if(H.tryLoc<=this.prev){var N=r.call(H,"catchLoc"),C=r.call(H,"finallyLoc");if(N&&C){if(this.prev<H.catchLoc)return z(H.catchLoc,!0);if(this.prev<H.finallyLoc)return z(H.finallyLoc)}else if(N){if(this.prev<H.catchLoc)return z(H.catchLoc,!0)}else{if(!C)throw Error("try statement without catch or finally");if(this.prev<H.finallyLoc)return z(H.finallyLoc)}}}},"dispatchException"),abrupt:o(function(x,E){for(var z=this.tryEntries.length-1;z>=0;--z){var V=this.tryEntries[z];if(V.tryLoc<=this.prev&&r.call(V,"finallyLoc")&&this.prev<V.finallyLoc){var H=V;break}}H&&(x==="break"||x==="continue")&&H.tryLoc<=E&&E<=H.finallyLoc&&(H=null);var ee=H?H.completion:{};return ee.type=x,ee.arg=E,H?(this.method="next",this.next=H.finallyLoc,A):this.complete(ee)},"abrupt"),complete:o(function(x,E){if(x.type==="throw")throw x.arg;return x.type==="break"||x.type==="continue"?this.next=x.arg:x.type==="return"?(this.rval=this.arg=x.arg,this.method="return",this.next="end"):x.type==="normal"&&E&&(this.next=E),A},"complete"),finish:o(function(x){for(var E=this.tryEntries.length-1;E>=0;--E){var z=this.tryEntries[E];if(z.finallyLoc===x)return this.complete(z.completion,z.afterLoc),be(z),A}},"finish"),catch:o(function(x){for(var E=this.tryEntries.length-1;E>=0;--E){var z=this.tryEntries[E];if(z.tryLoc===x){var V=z.completion;if(V.type==="throw"){var H=V.arg;be(z)}return H}}throw Error("illegal catch attempt")},"_catch"),delegateYield:o(function(x,E,z){return this.delegate={iterator:Te(x),resultName:E,nextLoc:z},this.method==="next"&&(this.arg=i),A},"delegateYield")},e}o(Lu,"_regeneratorRuntime");function Ig(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(Ig,"asyncGeneratorStep");function ox(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function a(c){Ig(n,r,s,a,l,"next",c)}o(a,"_next");function l(c){Ig(n,r,s,a,l,"throw",c)}o(l,"_throw"),a(void 0)})}}o(ox,"_asyncToGenerator");function nx(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(nx,"_classCallCheck");function Og(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,lx(r.key),r)}}o(Og,"_defineProperties");function ax(i,e,t){return e&&Og(i.prototype,e),t&&Og(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(ax,"_createClass");function lx(i){var e=ux(i,"string");return Wi(e)=="symbol"?e:e+""}o(lx,"_toPropertyKey");function ux(i,e){if(Wi(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Wi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(ux,"_toPrimitive");var Ug=(function(){function i(){nx(this,i)}return o(i,"FileReader"),ax(i,[{key:"openFile",value:(function(){var e=ox(Lu().mark(o(function r(s,n){var a;return Lu().wrap(o(function(c){for(;;)switch(c.prev=c.next){case 0:if(!(jn()&&s&&typeof s.uri<"u")){c.next=11;break}return c.prev=1,c.next=4,Du(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 Ag(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 Bu(i,e){return jn()?Promise.resolve(cx(i,e)):Promise.resolve(["tus-br",i.name,i.type,i.size,i.lastModified,e.endpoint].join("-"))}o(Bu,"fingerprint");function cx(i,e){var t=i.exif?px(JSON.stringify(i.exif)):"noexif";return["tus-rn",i.name||"noname",i.size||"nosize",t,e.endpoint].join("/")}o(cx,"reactNativeFingerprint");function px(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(px,"hashCode");function eo(i){"@babel/helpers - typeof";return eo=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},eo(i)}o(eo,"_typeof");function ju(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(ju,"_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,dx(r.key),r)}}o(Dg,"_defineProperties");function zu(i,e,t){return e&&Dg(i.prototype,e),t&&Dg(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(zu,"_createClass");function dx(i){var e=hx(i,"string");return eo(e)=="symbol"?e:e+""}o(dx,"_toPropertyKey");function hx(i,e){if(eo(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(eo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(hx,"_toPrimitive");var Ng=(function(){function i(){ju(this,i)}return o(i,"XHRHttpStack"),zu(i,[{key:"createRequest",value:o(function(t,r){return new fx(t,r)},"createRequest")},{key:"getName",value:o(function(){return"XHRHttpStack"},"getName")}])})();var fx=(function(){function i(e,t){ju(this,i),this._xhr=new XMLHttpRequest,this._xhr.open(e,t,!0),this._method=e,this._url=t,this._headers={}}return o(i,"Request"),zu(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 mx(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")}])})(),mx=(function(){function i(e){ju(this,i),this._xhr=e}return o(i,"Response"),zu(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 to(i){"@babel/helpers - typeof";return to=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},to(i)}o(to,"_typeof");function gx(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(gx,"_classCallCheck");function Mg(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,vx(r.key),r)}}o(Mg,"_defineProperties");function yx(i,e,t){return e&&Mg(i.prototype,e),t&&Mg(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(yx,"_createClass");function vx(i){var e=bx(i,"string");return to(e)=="symbol"?e:e+""}o(vx,"_toPropertyKey");function bx(i,e){if(to(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(to(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(bx,"_toPrimitive");var qu=!1;try{qu="localStorage"in window,zn="tusSupport",Hu=localStorage.getItem(zn),localStorage.setItem(zn,Hu),Hu===null&&localStorage.removeItem(zn)}catch(i){if(i.code===i.SECURITY_ERR||i.code===i.QUOTA_EXCEEDED_ERR)qu=!1;else throw i}var zn,Hu,Lg=qu,Bg=(function(){function i(){gx(this,i)}return o(i,"WebStorageUrlStorage"),yx(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 Nr(i){"@babel/helpers - typeof";return Nr=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},Nr(i)}o(Nr,"_typeof");function wx(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(wx,"_classCallCheck");function jg(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,qg(r.key),r)}}o(jg,"_defineProperties");function Sx(i,e,t){return e&&jg(i.prototype,e),t&&jg(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(Sx,"_createClass");function xx(i,e,t){return e=Hn(e),_x(i,Hg()?Reflect.construct(e,t||[],Hn(i).constructor):e.apply(i,t))}o(xx,"_callSuper");function _x(i,e){if(e&&(Nr(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ex(i)}o(_x,"_possibleConstructorReturn");function Ex(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}o(Ex,"_assertThisInitialized");function Hg(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Hg=o(function(){return!!i},"_isNativeReflectConstruct"))()}o(Hg,"_isNativeReflectConstruct");function Hn(i){return Hn=Object.setPrototypeOf?Object.getPrototypeOf.bind():o(function(t){return t.__proto__||Object.getPrototypeOf(t)},"_getPrototypeOf"),Hn(i)}o(Hn,"_getPrototypeOf");function Px(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&&$u(i,e)}o(Px,"_inherits");function $u(i,e){return $u=Object.setPrototypeOf?Object.setPrototypeOf.bind():o(function(r,s){return r.__proto__=s,r},"_setPrototypeOf"),$u(i,e)}o($u,"_setPrototypeOf");function zg(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(zg,"ownKeys");function Dr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zg(Object(t),!0).forEach(function(r){Tx(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):zg(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}o(Dr,"_objectSpread");function Tx(i,e,t){return e=qg(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}o(Tx,"_defineProperty");function qg(i){var e=kx(i,"string");return Nr(e)=="symbol"?e:e+""}o(qg,"_toPropertyKey");function kx(i,e){if(Nr(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Nr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(kx,"_toPrimitive");var qn=Dr(Dr({},Bn.defaultOptions),{},{httpStack:new Ng,fileReader:new Ug,urlStorage:Lg?new Bg:new Om,fingerprint:Bu}),$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 wx(this,e),r=Dr(Dr({},qn),r),xx(this,e,[t,r])}return o(e,"Upload"),Px(e,i),Sx(e,null,[{key:"terminate",value:o(function(r){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return s=Dr(Dr({},qn),s),Bn.terminate(r,s)},"terminate")}])})(Bn),T7=typeof XMLHttpRequest=="function"&&typeof Blob=="function"&&typeof Blob.prototype.slice=="function";var Wg={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-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^","@vitest/browser-playwright":"^4.1.11",playwright:"1.61.1",typescript:"^6.0.3",vitest:"^4.1.11"},peerDependencies:{"@uppy/core":"workspace:^"}};function Cx(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")}o(Cx,"isCordova");function Rx(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"}o(Rx,"isReactNative");function Vu(i){return(e,t)=>{if(Cx()||Rx())return qn.fingerprint(e,t);let r=["tus",i.id,t.endpoint].join("-");return Promise.resolve(r)}}o(Vu,"getFingerprint");var Gg={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},Ax={limit:20,retryDelays:Gg.retryDelays,withCredentials:!1,allowedMetaFields:!0},Gi=class extends ke{static{o(this,"Tus")}static VERSION=Wg.version;#e;requests;uploaders;uploaderEvents;constructor(e,t){if(super(e,{...Ax,...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 Jt(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);let t=this.uploaderEvents[e];t&&(t.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,...m}=c,y={...Gg,...m};y.fingerprint=Vu(e),y.onBeforeRequest=async R=>{let T=R.getUnderlyingObject();T&&(T.withCredentials=!!c.withCredentials);let M;if(typeof h=="function"&&(M=h(R,e)),Object.hasOwn(n,"shouldBeRequeued")){if(!n.shouldBeRequeued)return Promise.reject();let $,L=new Promise(J=>{$=J});n=this.requests.run(()=>(e.isPaused&&n.abort(),$(),()=>{})),await Promise.all([L,M]);return}return M},y.onError=R=>{this.uppy.log(R);let T=R.originalResponse;T!=null&&(t={status:T.getStatus(),body:{xhr:T.getUnderlyingObject()}});let M=R.originalRequest!=null?R.originalRequest.getUnderlyingObject():null;Xr(M)&&(R=new Pt(R,M)),this.#i(e.id),n?.abort(),typeof c.onError=="function"&&c.onError(R),s(R)},y.onProgress=(R,T)=>{this.onReceiveUploadUrl(e,l.url),typeof c.onProgress=="function"&&c.onProgress(R,T);let M=this.uppy.getFile(e.id);this.uppy.emit("upload-progress",M,{uploadStarted:M.progress.uploadStarted??0,bytesUploaded:R,bytesTotal:T})},y.onSuccess=R=>{let T={uploadURL:l.url??void 0,status:200,body:{xhr:R.lastResponse.getUnderlyingObject()}};this.uppy.emit("upload-success",this.uppy.getFile(e.id),T),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 T=R?.originalResponse?.getStatus();if(T===429){if(!this.requests.isPaused){let M=this.#e?.next();if(M==null||M.done)return!1;this.requests.rateLimit(M.value)}}else{if(T!=null&&T>=400&&T<500&&T!==409&&T!==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,T)=>p(R,T,c,S):y.onShouldRetry=S;let b=o((R,T,M)=>{Object.hasOwn(R,T)&&!Object.hasOwn(R,M)&&(R[M]=R[T])},"copyProp"),k={};if(Yt(c.allowedMetaFields,e.meta).forEach(R=>{k[R]=String(e.meta[R])}),b(k,"type","filetype"),b(k,"name","filename"),y.metadata=k,e.data==null)throw new Error("File data is empty");l=new $g(e.data,y),this.uploaders[e.id]=l;let j=new Nt(this.uppy);this.uploaderEvents[e.id]=j,a=o(()=>(e.isPaused||l.start(),()=>{}),"qRequest"),l.findPreviousUploads().then(R=>{let T=R[0];T&&(this.uppy.log(`[Tus] Resuming upload of ${e.id} started at ${T.creationTime}`),l.resumeFromPreviousUpload(T)),n=this.requests.run(a)}),j.onFileRemove(e.id,R=>{n.abort(),this.#t(e.id,!!l.url),this.#i(e.id),r(`upload ${R} was removed`)}),j.onPause(e.id,R=>{n.abort(),R?l.abort():n=this.requests.run(a)}),j.onPauseAll(e.id,()=>{n.abort(),l.abort()}),j.onCancelAll(e.id,()=>{n.abort(),this.#t(e.id,!!l.url),this.#i(e.id),r(`upload ${e.id} was canceled`)}),j.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=Pi(e),r=Ti(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)}))}#a=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.#a)}uninstall(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!1}}),this.uppy.removeUploader(this.#a)}};var Xg={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.1",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.4.0","@uppy/tus":"workspace:^","component-emitter":"^2.0.0"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^","@vitest/browser-playwright":"^4.1.11",msw:"^2.15.0",playwright:"1.61.1",typescript:"^6.0.3",vitest:"^4.1.11"}};var Yg=ce(Gu(),1);var Ux="ASSEMBLY_UPLOADING",Xu="ASSEMBLY_EXECUTING",Ku="ASSEMBLY_COMPLETED",Kg=[Ux,Xu,Ku];function $n(i,e){return typeof i!="string"?!1:Kg.indexOf(i)>=Kg.indexOf(e)}o($n,"isStatus");var Yu=class extends Yg.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(li)}connect(){this.#a(),this.#u()}#o(){this.emit("finished"),this.close()}get status(){return this.#s}set status(e){this.#s=e,this.emit("status",e)}#a(){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.#n(JSON.parse(e.data))}catch{this.#n(new Error(e.data))}this.#l({diff:!1})})}#n(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=Xi(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.#n(new Pt(r.statusText));return}let s=await r.json();if(this.closed)return;e?this.updateStatus(s):this.status=s}catch(t){this.#n(Ne(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.#n(t);let n=$n(s,Xu)&&!$n(r,Xu);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 m=c[h]??[],y=p[h]??[];m.filter(S=>!y?.some(b=>b.id===S.id)).forEach(S=>{this.emit("result",h,S)})}),$n(s,Ku)&&!$n(r,Ku)&&this.emit("finished")}close(){this.closed=!0,this.#r&&(this.#r.close(),this.#r=null),clearInterval(this.pollInterval),this.pollInterval=null}},Ju=Yu;var Jg=ce(Gu(),1);var Qu=class extends Jg.default{static{o(this,"TransloaditAssemblyWatcher")}#e;#t;promise;#i;#r;constructor(e,t){super(),this.#r=e,this.#e=t,this.#t=t.length,this.promise=new Promise(r=>{this.#i=r}),this.#p()}#s(e){return this.#e.indexOf(e)!==-1}#o=o(e=>{let t=e.assembly_id;t==null||!this.#s(t)||(this.#r.log(`[Transloadit] AssemblyWatcher: Got Assembly finish ${t}`),this.emit("assembly-complete",t),this.#l())},"#onAssemblyComplete");#a=o(e=>{let t=e.assembly_id;t==null||!this.#s(t)||this.#l()},"#onAssemblyCancel");#n=o((e,t)=>{let r=e.assembly_id;r==null||!this.#s(r)||(this.#r.log(`[Transloadit] AssemblyWatcher: Got Assembly error ${r}`),this.#r.log(t),this.emit("assembly-error",r,t),this.#l())},"#onAssemblyError");#u=o((e,t,r)=>{let s=e.assembly_id;s==null||!this.#s(s)||this.#n(e,r)},"#onImportError");#l(){this.#t-=1,this.#t===0&&(this.#c(),this.#i())}#c(){this.#r.off("transloadit:complete",this.#o),this.#r.off("transloadit:assembly-cancel",this.#a),this.#r.off("transloadit:assembly-error",this.#n),this.#r.off("transloadit:import-error",this.#u)}#p(){this.#r.on("transloadit:complete",this.#o),this.#r.on("transloadit:assembly-cancel",this.#a),this.#r.on("transloadit:assembly-error",this.#n),this.#r.on("transloadit:import-error",this.#u)}},Qg=Qu;var Zg="/assemblies",Zu=class extends Error{static{o(this,"AssemblyError")}details;assembly;constructor(e,t,r){super(e),this.details=t,this.assembly=r}},io=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(li)}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(Zg)?t.json().then(s=>{if(!s.error)throw r;let n=new Zu(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(Zg,`${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=`${Xi(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=`${Xi(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=Xi(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 ey={strings:{creatingAssembly:"Preparing upload...",creatingAssemblyFailed:"Transloadit: Could not create Assembly",encoding:"Encoding..."}};var Dx={service:"https://api2.transloadit.com",errorReporting:!0,waitForEncoding:!1,waitForMetadata:!1,alwaysRunAssembly:!1,importFromUploadURLs:!1,limit:20,retryDelays:[7e3,1e4,15e3,2e4],clientName:null},ty=o(i=>e=>{let t=new Kt("Failed to send error to the client",{cause:e});console.error(t,i)},"sendErrorToConsole");function Nx(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 Kt("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(Nx,"validateParams");function Ki(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(Ki,"ensureAssemblyId");function ec(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(ec,"ensureUrl");function Mx(i){return ec("`assembly_url`",i.assembly_url,i.assembly_ssl_url)}o(Mx,"getAssemblyUrl");function Xi(i){return ec("`assembly_ssl_url`",i.assembly_ssl_url,i.assembly_url)}o(Xi,"getAssemblyUrlSsl");var Lx="https://api2.transloadit.com/companion",Bx=/\.transloadit\.com$/,jx=/https?:\/\/api2(?:-\w+)?\.transloadit\.com\/companion/,Vn=class extends ke{static{o(this,"Transloadit")}static VERSION=Xg.version;static COMPANION_URL=Lx;static COMPANION_ALLOWED_HOSTS=Bx;#e;client;#t;#i;completedFiles;restored=null;constructor(e,t){super(e,{...Dx,...t}),this.type="uploader",this.id=this.opts.id||"Transloadit",this.defaultLocale=ey,this.#e=new Jt(this.opts.limit),this.i18nInit(),this.client=new io({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:${Gi.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=Mx(t),s=ec("`tus_url`",t.tus_url),n=Ki(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&&jx.test(e.remote.companionUrl))){let h=t.companion_url.replace(/\/$/,""),m=e.remote.url.replace(e.remote.companionUrl,"").replace(/^\//,"");c={...e.remote,companionUrl:h,url:`${h}/${m}`}}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 Ju(r,this.#e),{status:a}=n,l=Ki(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=Ne(r),n=new Kt(`${this.i18n("creatingAssemblyFailed")}: ${s.message}`,{cause:s});throw"details"in s&&(n.details=s.details),"assembly"in s&&(n.assembly=s.assembly),n}}#a(e){let t=Array.isArray(e)?e:[e],r=new Qg(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}#n(){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())}#g(e){let t=Xi(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}#y=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=Ki(r);r.uploads?.forEach(S=>{let b=this.#p(S);l[S.id]={id:b.id,assembly:p,uploadedFile:S}});let h=this.getPluginState(),m=r.results??{};Object.keys(m).forEach(S=>{let b=m[S]??[];for(let k of b){if(!("id"in k)){console.warn("Result has no id",k);continue}if(typeof k.id!="string"){console.warn("Result has no id of type string",k);continue}if(!("original_id"in k)){console.warn("Result has no original_id",k);continue}if(typeof k.original_id!="string"){console.warn("Result has no original_id of type string",k);continue}let A=h.files[k.original_id];c.push({id:k.id,result:{...k,localId:A?A.id:null},stepName:S,assembly:p})}});let y=new Ju(r,this.#e);return y.status=r,this.assembly=y,this.setPluginState({files:l,results:c}),l},"restoreState"),n=o(l=>{this.#a(Ki(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=Ki(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.#g(e)}):this.opts.waitForMetadata&&e.on("metadata",()=>{this.#g(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??{}},Nx(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.#a(Ki(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,Ne(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?Ki(this.assembly.status):void 0,n=o(()=>{this.assembly?.close()},"closeSocketConnections");if(!this.#n()){n();let c=this.assembly?.status;c!=null&&this.uppy.addResultData(t,{transloadit:[c]});return}if(!s){this.uppy.addResultData(t,{transloadit:[]});return}r.filter(c=>!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(ty(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(ty(t))}},"#onTusError");install(){this.uppy.addPreProcessor(this.#w),this.uppy.addPostProcessor(this.#S),this.uppy.on("error",this.#_),this.uppy.on("cancel-all",this.#y),this.uppy.on("upload-error",this.#x),this.opts.importFromUploadURLs?this.uppy.on("upload-success",this.#c):this.uppy.use(Gi,{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.#y),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 uy=ce(iy(),1);var ry={name:"@uppy/webcam",description:"Uppy plugin that takes photos or records videos using the device's camera.",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 && 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:{"@uppy-dev/tsconfig":"workspace:^","@vitest/browser-playwright":"^4.1.11",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.11"},peerDependencies:{"@uppy/core":"workspace:^"}};function ro(){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(ro,"CameraIcon");function Vx({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(Vx,"DiscardButton");var sy=Vx;function ic({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(ic,"RecordButton");function rc(i){return`${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`}o(rc,"formatSeconds");function sc({recordingLengthSeconds:i}){let e=rc(i);return u("span",{children:e})}o(sc,"RecordingLength");function oc({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:ro()})}o(oc,"SnapshotButton");function Wx({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(Wx,"SubmitButton");var oy=Wx;function nc({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(nc,"VideoSourceSelect");function Gn(i,e){return i.includes(e)}o(Gn,"isModeAvailable");var ac=class extends he{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:m,mirror:y,onSnapshot:S,onStartRecording:b,onStopRecording:k,onDiscardRecordedMedia:A,recordingLengthSeconds:j}=this.props,R=!!t,T=!!r,M=R||T,$=!M&&a&&(Gn(n,"video-only")||Gn(n,"audio-only")||Gn(n,"video-audio")),L=!M&&Gn(n,"picture"),J=a&&p&&!R,G=c&&l&&l.length>1,Z={playsInline:!0};return t?(Z.muted=!1,Z.controls=!0,Z.src=t,this.videoElement&&(this.videoElement.srcObject=null)):(Z.muted=!0,Z.autoPlay=!0,Z.srcObject=e),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(ie=>{this.videoElement=ie},"ref"),className:`uppy-Webcam-video  ${y?"uppy-Webcam-video--mirrored":""}`,...Z})}),u("div",{className:"uppy-Webcam-footer",children:[u("div",{className:"uppy-Webcam-videoSourceContainer",children:G?nc(this.props):null}),u("div",{className:"uppy-Webcam-buttonContainer",children:[L&&u(oc,{onSnapshot:S,i18n:m}),$&&u(ic,{recording:s,onStartRecording:b,onStopRecording:k,i18n:m}),(R||T)&&u(oy,{onSubmit:h,i18n:m}),(R||T)&&u(sy,{onDiscard:A,i18n:m})]}),u("div",{className:"uppy-Webcam-recordingLength",children:J&&u(sc,{recordingLengthSeconds:j})})]})]})}},ny=ac;var ay={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 lc({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(lc,"PermissionsScreen");function uc(){return typeof MediaRecorder=="function"&&!!MediaRecorder.prototype&&typeof MediaRecorder.prototype.start=="function"}o(uc,"supportsMediaRecorder");function ly(i){return i[0]==="."?tr[i.slice(1)]:i}o(ly,"toMimeType");function Gx(i){return/^video\/[^*]+$/.test(i)}o(Gx,"isVideoMimeType");function Xx(i){return/^image\/[^*]+$/.test(i)}o(Xx,"isImageMimeType");function Kx(){return navigator.mediaDevices}o(Kx,"getMediaDevices");function cc(i,e){return i.includes(e)}o(cc,"isModeAvailable");var cy={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,uy.isMobile)({tablet:!0})},so=class extends le{static{o(this,"Webcam")}static VERSION=ry.version;#e;mediaDevices;supportsUserMedia;capturedMediaFile;icon;webcamActive;stream=null;recorder=null;recordingChunks=null;recordingLengthTimer;captureInProgress=!1;constructor(e,t){super(e,{...cy,...t}),this.mediaDevices=Kx(),this.supportsUserMedia=!!this.mediaDevices,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=ay,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);return 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(ot(s),"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(ly).filter(Gx));let s=o(a=>MediaRecorder.isTypeSupported(a)&&Tt(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){nt(r)||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){nt(e)||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=ot(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,nt(e)||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(ly).filter(Xx));let c=l[0]||"image/jpeg",p=Tt(c)||"jpg",h=`cam-${Date.now()}.${p}`;return mo(s,c).then(m=>({source:this.id,name:h,data:new Blob([m],{type:c}),type:c}))}getVideo(){let e=this.recordingChunks.find(a=>a.type?.length>0).type,t=Tt(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(lc,{icon:ro,i18n:this.i18n,hasCamera:e.hasCamera}):u(ny,{...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:uc(),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:cc(t,"video-only")||cc(t,"video-audio"),showNativePhotoCameraButton:cc(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 py={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.1",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-dev/tsconfig":"workspace:^","@uppy/core":"workspace:^","@uppy/dashboard":"workspace:^","@vitest/browser-playwright":"^4.1.11",msw:"^2.15.0",playwright:"1.61.1",typescript:"^6.0.3",vitest:"^4.1.11"},peerDependencies:{"@uppy/core":"workspace:^"}};var dy={strings:{uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it."}};function Jx(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})),Xr(i)?(t=new Pt(t,i),t):(t.request=i,t)}o(Jx,"buildResponseError");function hy(i){return i.data.slice(0,i.data.size,i.meta.type)}o(hy,"setTypeInBlob");var Qx={formData:!0,fieldName:"file",method:"post",allowedMetaFields:!0,bundle:!1,headers:{},timeout:30*1e3,limit:5,withCredentials:!1,responseType:""},Xn=class extends ke{static{o(this,"XHRUpload")}static VERSION=py.version;#e;#t;uploaderEvents;constructor(e,t){if(super(e,{...Qx,fieldName:t.bundle?"files[]":"file",...t}),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.defaultLocale=dy,this.i18nInit(),this.#t=new Fi({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 qr(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),m=new Error(this.i18n("uploadStalled",{seconds:h}));this.uppy.emit("upload-stalled",m,r)},"onTimeout"),onUploadProgress:o(p=>{if(p.lengthComputable)for(let{id:h}of r){let m=this.uppy.getFile(h);m!=null&&this.uppy.emit("upload-progress",m,{uploadStarted:m.progress.uploadStarted??0,bytesUploaded:p.loaded/p.total*m.size,bytesTotal:m.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){let l=Ne(a);if(bt(l))return;let c="request"in l?l.request:void 0;for(let p of r)this.uppy.emit("upload-error",this.uppy.getFile(p.id),Jx(c,l),c);throw l}}}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){Yt(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=hy(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=hy(n);n.name?r.append(a.fieldName,l,n.name):r.append(a.fieldName,l)}),r}async#i(e){let t=new Nt(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(bt(s))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(bt(s))return;throw s}finally{this.uppy.off("cancel-all",r)}}#s(e){let t=this.getOptions(e),r=Yt(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)}))}#a=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=Pi(t),s=Ti(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.#a)}uninstall(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(this.#a)}};function v9(){throw new Error("Core has been renamed to Uppy")}o(v9,"Core");var b9={ProviderView:sl},w9={};export{ms as Audio,an as AwsS3,ke as BasePlugin,Ui as Box,ln as Compressor,v9 as Core,Ds as Dashboard,Fa as DefaultStore,Ns as DragDrop,Sn as DropTarget,Bi as Dropbox,ji as Facebook,En as Form,Cn as GoldenRetriever,zi as GoogleDrive,js as GoogleDrivePicker,zs as GooglePhotosPicker,qs as ImageEditor,Hi as OneDrive,An as RemoteSources,$s as ScreenCapture,Ws as StatusBar,Pr as ThumbnailGenerator,Vn as Transloadit,Gi as Tus,le as UIPlugin,qi as Unsplash,Aa as Uppy,vi as Url,so as Webcam,Xn as XHRUpload,$i as Zoom,Co as debugLogger,w9 as locales,Qp as server,b9 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