@mux/mux-uploader-react
Advanced tools
Comparing version 0.1.0-canary.10-485423a to 0.1.0-canary.10-5c601b8
@@ -1,4 +0,4 @@ | ||
var te=Object.create;var it=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty;var Ot=t=>it(t,"__esModule",{value:!0});var se=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ie=(t,e)=>{Ot(t);for(var r in e)it(t,r,{get:e[r],enumerable:!0})},ae=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ne(e))!oe.call(t,o)&&o!=="default"&&it(t,o,{get:()=>e[o],enumerable:!(r=ee(e,o))||r.enumerable});return t},z=t=>ae(Ot(it(t!=null?te(re(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var _t=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var Bt=(t,e,r)=>(_t(t,e,"read from private field"),r?r.call(t):e.get(t)),Ut=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Dt=(t,e,r,o)=>(_t(t,e,"write to private field"),o?o.call(t,r):e.set(t,r),r);var Nt=se((et,ft)=>{(function(t,e){typeof et=="object"&&typeof ft=="object"?ft.exports=e():typeof define=="function"&&define.amd?define([],e):typeof et=="object"?et.UpChunk=e():t.UpChunk=e()})(et,function(){return function(t){var e={};function r(o){if(e[o])return e[o].exports;var a=e[o]={i:o,l:!1,exports:{}};return t[o].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=t,r.c=e,r.d=function(o,a,p){r.o(o,a)||Object.defineProperty(o,a,{enumerable:!0,get:p})},r.r=function(o){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},r.t=function(o,a){if(1&a&&(o=r(o)),8&a||4&a&&typeof o=="object"&&o&&o.__esModule)return o;var p=Object.create(null);if(r.r(p),Object.defineProperty(p,"default",{enumerable:!0,value:o}),2&a&&typeof o!="string")for(var T in o)r.d(p,T,function(k){return o[k]}.bind(null,T));return p},r.n=function(o){var a=o&&o.__esModule?function(){return o.default}:function(){return o};return r.d(a,"a",a),a},r.o=function(o,a){return Object.prototype.hasOwnProperty.call(o,a)},r.p="",r(r.s=1)}([function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch{typeof window=="object"&&(r=window)}t.exports=r},function(t,e,r){"use strict";var o=this&&this.__assign||function(){return(o=Object.assign||function(d){for(var n,l=1,b=arguments.length;l<b;l++)for(var E in n=arguments[l])Object.prototype.hasOwnProperty.call(n,E)&&(d[E]=n[E]);return d}).apply(this,arguments)};e.__esModule=!0,e.createUpload=e.UpChunk=void 0;var a=r(2),p=r(4),T=[200,201,202,204,308],k=[408,502,503,504],v=function(){function d(n){var l=this;this.endpoint=n.endpoint,this.file=n.file,this.headers=n.headers||{},this.method=n.method||"PUT",this.chunkSize=n.chunkSize||30720,this.attempts=n.attempts||5,this.delayBeforeAttempt=n.delayBeforeAttempt||1,this.maxFileBytes=1024*(n.maxFileSize||0),this.chunkCount=0,this.chunkByteSize=1024*this.chunkSize,this.totalChunks=Math.ceil(this.file.size/this.chunkByteSize),this.attemptCount=0,this.offline=!1,this.paused=!1,this.success=!1,this.reader=new FileReader,this.eventTarget=new a.EventTarget,this.validateOptions(),this.getEndpoint().then(function(){return l.sendChunks()}),typeof window!="undefined"&&(window.addEventListener("online",function(){l.offline&&(l.offline=!1,l.dispatch("online"),l.sendChunks())}),window.addEventListener("offline",function(){l.offline=!0,l.dispatch("offline")}))}return d.prototype.on=function(n,l){this.eventTarget.addEventListener(n,l)},d.prototype.abort=function(){var n;this.pause(),(n=this.currentXhr)===null||n===void 0||n.abort()},d.prototype.pause=function(){this.paused=!0},d.prototype.resume=function(){this.paused&&(this.paused=!1,this.sendChunks())},d.prototype.dispatch=function(n,l){var b=new CustomEvent(n,{detail:l});this.eventTarget.dispatchEvent(b)},d.prototype.validateOptions=function(){if(!this.endpoint||typeof this.endpoint!="function"&&typeof this.endpoint!="string")throw new TypeError("endpoint must be defined as a string or a function that returns a promise");if(!(this.file instanceof File))throw new TypeError("file must be a File object");if(this.headers&&typeof this.headers!="object")throw new TypeError("headers must be null or an object");if(this.chunkSize&&(typeof this.chunkSize!="number"||this.chunkSize<=0||this.chunkSize%256!=0))throw new TypeError("chunkSize must be a positive number in multiples of 256");if(this.maxFileBytes>0&&this.maxFileBytes<this.file.size)throw new Error("file size exceeds maximum (".concat(this.file.size," > ").concat(this.maxFileBytes,")"));if(this.attempts&&(typeof this.attempts!="number"||this.attempts<=0))throw new TypeError("retries must be a positive number");if(this.delayBeforeAttempt&&(typeof this.delayBeforeAttempt!="number"||this.delayBeforeAttempt<0))throw new TypeError("delayBeforeAttempt must be a positive number")},d.prototype.getEndpoint=function(){var n=this;return typeof this.endpoint=="string"?(this.endpointValue=this.endpoint,Promise.resolve(this.endpoint)):this.endpoint(this.file).then(function(l){return n.endpointValue=l,n.endpointValue})},d.prototype.getChunk=function(){var n=this;return new Promise(function(l){var b=n.totalChunks===1?n.file.size:n.chunkByteSize,E=b*n.chunkCount;n.reader.onload=function(){n.reader.result!==null&&(n.chunk=new Blob([n.reader.result],{type:"application/octet-stream"})),l()},n.reader.readAsArrayBuffer(n.file.slice(E,E+b))})},d.prototype.xhrPromise=function(n){var l=this,b=function(E){E.upload.onprogress=function(P){var w,y=100/l.totalChunks,S=y*l.file.size,h=y*l.chunkCount,j=P.loaded/((w=P.total)!==null&&w!==void 0?w:S)*y;l.dispatch("progress",Math.min(h+j,100))}};return new Promise(function(E,P){l.currentXhr=(0,p.default)(o(o({},n),{beforeSend:b}),function(w,y){return l.currentXhr=void 0,w?P(w):E(y)})})},d.prototype.sendChunk=function(){var n=this.chunkCount*this.chunkByteSize,l=n+this.chunk.size-1,b=o(o({},this.headers),{"Content-Type":this.file.type,"Content-Range":"bytes ".concat(n,"-").concat(l,"/").concat(this.file.size)});return this.dispatch("attempt",{chunkNumber:this.chunkCount,chunkSize:this.chunk.size}),this.xhrPromise({headers:b,url:this.endpointValue,method:this.method,body:this.chunk})},d.prototype.manageRetries=function(){var n=this;if(this.attemptCount<this.attempts)return setTimeout(function(){return n.sendChunks()},1e3*this.delayBeforeAttempt),void this.dispatch("attemptFailure",{message:"An error occured uploading chunk ".concat(this.chunkCount,". ").concat(this.attempts-this.attemptCount," retries left."),chunkNumber:this.chunkCount,attemptsLeft:this.attempts-this.attemptCount});this.dispatch("error",{message:"An error occured uploading chunk ".concat(this.chunkCount,". No more retries, stopping upload"),chunk:this.chunkCount,attempts:this.attemptCount})},d.prototype.sendChunks=function(){var n=this;this.paused||this.offline||this.success||this.getChunk().then(function(){return n.attemptCount=n.attemptCount+1,n.sendChunk()}).then(function(l){if(T.includes(l.statusCode)){n.dispatch("chunkSuccess",{chunk:n.chunkCount,attempts:n.attemptCount,response:l}),n.attemptCount=0,n.chunkCount=n.chunkCount+1,n.chunkCount<n.totalChunks?n.sendChunks():(n.success=!0,n.dispatch("success"));var b=100*(n.chunkCount/n.totalChunks*n.file.size)/n.file.size;n.dispatch("progress",b)}else if(k.includes(l.statusCode)){if(n.paused||n.offline)return;n.manageRetries()}else{if(n.paused||n.offline)return;n.dispatch("error",{message:"Server responded with ".concat(l.statusCode,". Stopping upload."),chunkNumber:n.chunkCount,attempts:n.attemptCount})}}).catch(function(l){n.paused||n.offline||n.manageRetries()})},d}();e.UpChunk=v,e.createUpload=function(d){return new v(d)}},function(t,e,r){"use strict";(function(o,a){function p(s,i,...u){if(!s)throw new TypeError(T(i,u))}function T(s,i){let u=0;return s.replace(/%[os]/gu,()=>k(i[u++]))}function k(s){return typeof s!="object"||s===null?String(s):Object.prototype.toString.call(s)}let v;Object.defineProperty(e,"__esModule",{value:!0});let d=typeof window!="undefined"?window:typeof self!="undefined"?self:a!==void 0?a:typeof globalThis!="undefined"?globalThis:void 0,n;class l{constructor(i,u){this.code=i,this.message=u}warn(...i){var u;try{if(n)return void n({...this,args:i});let c=((u=new Error().stack)!==null&&u!==void 0?u:"").replace(/^(?:.+?\n){2}/gu,` | ||
`);console.warn(this.message,...i,c)}catch{}}}let b=new l("W01","Unable to initialize event under dispatching."),E=new l("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),P=new l("W03","Assigning any truthy value to 'returnValue' property has no effect."),w=new l("W04","Unable to preventDefault on non-cancelable events."),y=new l("W05","Unable to preventDefault inside passive event listener invocation."),S=new l("W06","An event listener wasn't added because it has been added already: %o, %o"),h=new l("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),j=new l("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o"),V=new l("W09","Event attribute handler must be a function: %o");class L{static get NONE(){return q}static get CAPTURING_PHASE(){return _}static get AT_TARGET(){return W}static get BUBBLING_PHASE(){return Z}constructor(i,u){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let c=u!=null?u:{};G.set(this,{type:String(i),bubbles:Boolean(c.bubbles),cancelable:Boolean(c.cancelable),composed:Boolean(c.composed),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1,inPassiveListenerFlag:!1,dispatchFlag:!1,timeStamp:Date.now()})}get type(){return g(this).type}get target(){return g(this).target}get srcElement(){return g(this).target}get currentTarget(){return g(this).currentTarget}composedPath(){let i=g(this).currentTarget;return i?[i]:[]}get NONE(){return q}get CAPTURING_PHASE(){return _}get AT_TARGET(){return W}get BUBBLING_PHASE(){return Z}get eventPhase(){return g(this).dispatchFlag?2:0}stopPropagation(){g(this).stopPropagationFlag=!0}get cancelBubble(){return g(this).stopPropagationFlag}set cancelBubble(i){i?g(this).stopPropagationFlag=!0:E.warn()}stopImmediatePropagation(){let i=g(this);i.stopPropagationFlag=i.stopImmediatePropagationFlag=!0}get bubbles(){return g(this).bubbles}get cancelable(){return g(this).cancelable}get returnValue(){return!g(this).canceledFlag}set returnValue(i){i?P.warn():x(g(this))}preventDefault(){x(g(this))}get defaultPrevented(){return g(this).canceledFlag}get composed(){return g(this).composed}get isTrusted(){return!1}get timeStamp(){return g(this).timeStamp}initEvent(i,u=!1,c=!1){let f=g(this);f.dispatchFlag?b.warn():G.set(this,{...f,type:String(i),bubbles:Boolean(u),cancelable:Boolean(c),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}}let q=0,_=1,W=2,Z=3,G=new WeakMap;function g(s,i="this"){let u=G.get(s);return p(u!=null,"'%s' must be an object that Event constructor created, but got another one: %o",i,s),u}function x(s){s.inPassiveListenerFlag?y.warn():s.cancelable?s.canceledFlag=!0:w.warn()}Object.defineProperty(L,"NONE",{enumerable:!0}),Object.defineProperty(L,"CAPTURING_PHASE",{enumerable:!0}),Object.defineProperty(L,"AT_TARGET",{enumerable:!0}),Object.defineProperty(L,"BUBBLING_PHASE",{enumerable:!0});let B=Object.getOwnPropertyNames(L.prototype);for(let s=0;s<B.length;++s)B[s]!=="constructor"&&Object.defineProperty(L.prototype,B[s],{enumerable:!0});let N;d!==void 0&&d.Event!==void 0&&Object.setPrototypeOf(L.prototype,d.Event.prototype);let mt={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};function bt(s){let i=Object.keys(mt);for(let u=0;u<i.length;++u){let c=i[u],f=mt[c];Object.defineProperty(s,c,{get:()=>f,configurable:!0,enumerable:!0})}}class J extends L{static wrap(i){return new(function u(c){let f=Object.getPrototypeOf(c);if(f==null)return J;let m=ot.get(f);return m==null&&(m=function(C,A){class M extends C{}let R=Object.keys(A);for(let O=0;O<R.length;++O)Object.defineProperty(M.prototype,R[O],yt(A,R[O]));return M}(u(f),f),ot.set(f,m)),m}(i))(i)}constructor(i){super(i.type,{bubbles:i.bubbles,cancelable:i.cancelable,composed:i.composed}),i.cancelBubble&&super.stopPropagation(),i.defaultPrevented&&super.preventDefault(),vt.set(this,{original:i});let u=Object.keys(i);for(let c=0;c<u.length;++c){let f=u[c];f in this||Object.defineProperty(this,f,yt(i,f))}}stopPropagation(){super.stopPropagation();let{original:i}=F(this);"stopPropagation"in i&&i.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(i){super.cancelBubble=i;let{original:u}=F(this);"cancelBubble"in u&&(u.cancelBubble=i)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:i}=F(this);"stopImmediatePropagation"in i&&i.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(i){super.returnValue=i;let{original:u}=F(this);"returnValue"in u&&(u.returnValue=i)}preventDefault(){super.preventDefault();let{original:i}=F(this);"preventDefault"in i&&i.preventDefault()}get timeStamp(){let{original:i}=F(this);return"timeStamp"in i?i.timeStamp:super.timeStamp}}let vt=new WeakMap;function F(s){let i=vt.get(s);return p(i!=null,"'this' is expected an Event object, but got",s),i}let ot=new WeakMap;function yt(s,i){let u=Object.getOwnPropertyDescriptor(s,i);return{get(){let c=F(this).original,f=c[i];return typeof f=="function"?f.bind(c):f},set(c){F(this).original[i]=c},configurable:u.configurable,enumerable:u.enumerable}}function Et(s){return(1&s.flags)==1}function Tt(s){return(2&s.flags)==2}function wt(s){return(4&s.flags)==4}function Jt(s){return(8&s.flags)==8}function Qt({callback:s},i,u){try{typeof s=="function"?s.call(i,u):typeof s.handleEvent=="function"&&s.handleEvent(u)}catch(c){(function(f){try{let m=f instanceof Error?f:new Error(k(f));if(v)return void v(m);if(typeof dispatchEvent=="function"&&typeof ErrorEvent=="function")dispatchEvent(new ErrorEvent("error",{error:m,message:m.message}));else if(o!==void 0&&typeof o.emit=="function")return void o.emit("uncaughtException",m);console.error(m)}catch{}})(c)}}function kt({listeners:s},i,u){for(let c=0;c<s.length;++c)if(s[c].callback===i&&Et(s[c])===u)return c;return-1}function Rt(s,i,u,c,f,m){let C;m&&(C=dt.bind(null,s,i,u),m.addEventListener("abort",C));let A=function(M,R,O,U,st,D){return{callback:M,flags:(R?1:0)|(O?2:0)|(U?4:0),signal:st,signalListener:D}}(i,u,c,f,m,C);return s.cow?(s.cow=!1,s.listeners=[...s.listeners,A]):s.listeners.push(A),A}function dt(s,i,u){let c=kt(s,i,u);return c!==-1&&Pt(s,c)}function Pt(s,i,u=!1){let c=s.listeners[i];return function(f){f.flags|=8}(c),c.signal&&c.signal.removeEventListener("abort",c.signalListener),s.cow&&!u?(s.cow=!1,s.listeners=s.listeners.filter((f,m)=>m!==i),!1):(s.listeners.splice(i,1),!0)}function xt(s,i){var u;return(u=s[i])!==null&&u!==void 0?u:s[i]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}ot.set(Object.prototype,J),d!==void 0&&d.Event!==void 0&&ot.set(d.Event.prototype,J);class ${constructor(){Ct.set(this,Object.create(null))}addEventListener(i,u,c){let f=Y(this),{callback:m,capture:C,once:A,passive:M,signal:R,type:O}=function(D,H,I){var Q;return St(H),typeof I=="object"&&I!==null?{type:String(D),callback:H!=null?H:void 0,capture:Boolean(I.capture),passive:Boolean(I.passive),once:Boolean(I.once),signal:(Q=I.signal)!==null&&Q!==void 0?Q:void 0}:{type:String(D),callback:H!=null?H:void 0,capture:Boolean(I),passive:!1,once:!1,signal:void 0}}(i,u,c);if(m==null||(R==null?void 0:R.aborted))return;let U=xt(f,O),st=kt(U,m,C);st===-1?Rt(U,m,C,M,A,R):function(D,H,I,Q){S.warn(Et(D)?"capture":"bubble",D.callback),Tt(D)!==H&&h.warn("passive"),wt(D)!==I&&h.warn("once"),D.signal!==Q&&h.warn("signal")}(U.listeners[st],M,A,R)}removeEventListener(i,u,c){let f=Y(this),{callback:m,capture:C,type:A}=function(R,O,U){return St(O),typeof U=="object"&&U!==null?{type:String(R),callback:O!=null?O:void 0,capture:Boolean(U.capture)}:{type:String(R),callback:O!=null?O:void 0,capture:Boolean(U)}}(i,u,c),M=f[A];m!=null&&M&&dt(M,m,C)}dispatchEvent(i){let u=Y(this)[String(i.type)];if(u==null)return!0;let c=i instanceof L?i:J.wrap(i),f=g(c,"event");if(f.dispatchFlag)throw m="This event has been in dispatching.",d.DOMException?new d.DOMException(m,"InvalidStateError"):(N==null&&(N=class Ft extends Error{constructor(A){super(A),Error.captureStackTrace&&Error.captureStackTrace(this,Ft)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(N.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),bt(N),bt(N.prototype)),new N(m));var m;if(f.dispatchFlag=!0,f.target=f.currentTarget=this,!f.stopPropagationFlag){let{cow:C,listeners:A}=u;u.cow=!0;for(let M=0;M<A.length;++M){let R=A[M];if(!Jt(R)&&(wt(R)&&Pt(u,M,!C)&&(M-=1),f.inPassiveListenerFlag=Tt(R),Qt(R,this,c),f.inPassiveListenerFlag=!1,f.stopImmediatePropagationFlag))break}C||(u.cow=!1)}return f.target=null,f.currentTarget=null,f.stopImmediatePropagationFlag=!1,f.stopPropagationFlag=!1,f.dispatchFlag=!1,!f.canceledFlag}}let Ct=new WeakMap;function Y(s,i="this"){let u=Ct.get(s);return p(u!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",i,s),u}function St(s){if(typeof s!="function"&&(typeof s!="object"||s===null||typeof s.handleEvent!="function")){if(s!=null&&typeof s!="object")throw new TypeError(T(j.message,[s]));j.warn(s)}}let ht=Object.getOwnPropertyNames($.prototype);for(let s=0;s<ht.length;++s)ht[s]!=="constructor"&&Object.defineProperty($.prototype,ht[s],{enumerable:!0});function At(s,i){var u,c;return(c=(u=Y(s,"target")[i])===null||u===void 0?void 0:u.attrCallback)!==null&&c!==void 0?c:null}function Mt(s,i,u){u!=null&&typeof u!="function"&&V.warn(u),typeof u=="function"||typeof u=="object"&&u!==null?function(c,f,m){let C=xt(Y(c,"target"),String(f));C.attrCallback=m,C.attrListener==null&&(C.attrListener=Rt(C,function(A){return function(M){let R=A.attrCallback;typeof R=="function"&&R.call(this,M)}}(C),!1,!1,!1,void 0))}(s,i,u):function(c,f){let m=Y(c,"target")[String(f)];m&&m.attrListener&&(dt(m,m.attrListener.callback,!1),m.attrCallback=m.attrListener=void 0)}(s,i)}function Lt(s,i,u){Object.defineProperty(s,"on"+i,{get(){return At(this,i)},set(c){Mt(this,i,c)},configurable:!0,enumerable:!0})}d!==void 0&&d.EventTarget!==void 0&&Object.setPrototypeOf($.prototype,d.EventTarget.prototype),e.Event=L,e.EventTarget=$,e.default=$,e.defineCustomEventTarget=function(...s){class i extends ${}for(let u=0;u<s.length;++u)Lt(i.prototype,s[u]);return i},e.defineEventAttribute=Lt,e.getEventAttributeValue=At,e.setErrorHandler=function(s){p(typeof s=="function"||s===void 0,"The error handler must be a function or undefined, but got %o.",s),v=s},e.setEventAttributeValue=Mt,e.setWarningHandler=function(s){p(typeof s=="function"||s===void 0,"The warning handler must be a function or undefined, but got %o.",s),n=s}}).call(this,r(3),r(0))},function(t,e){var r,o,a=t.exports={};function p(){throw new Error("setTimeout has not been defined")}function T(){throw new Error("clearTimeout has not been defined")}function k(y){if(r===setTimeout)return setTimeout(y,0);if((r===p||!r)&&setTimeout)return r=setTimeout,setTimeout(y,0);try{return r(y,0)}catch{try{return r.call(null,y,0)}catch{return r.call(this,y,0)}}}(function(){try{r=typeof setTimeout=="function"?setTimeout:p}catch{r=p}try{o=typeof clearTimeout=="function"?clearTimeout:T}catch{o=T}})();var v,d=[],n=!1,l=-1;function b(){n&&v&&(n=!1,v.length?d=v.concat(d):l=-1,d.length&&E())}function E(){if(!n){var y=k(b);n=!0;for(var S=d.length;S;){for(v=d,d=[];++l<S;)v&&v[l].run();l=-1,S=d.length}v=null,n=!1,function(h){if(o===clearTimeout)return clearTimeout(h);if((o===T||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(h);try{o(h)}catch{try{return o.call(null,h)}catch{return o.call(this,h)}}}(y)}}function P(y,S){this.fun=y,this.array=S}function w(){}a.nextTick=function(y){var S=new Array(arguments.length-1);if(arguments.length>1)for(var h=1;h<arguments.length;h++)S[h-1]=arguments[h];d.push(new P(y,S)),d.length!==1||n||k(E)},P.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=w,a.addListener=w,a.once=w,a.off=w,a.removeListener=w,a.removeAllListeners=w,a.emit=w,a.prependListener=w,a.prependOnceListener=w,a.listeners=function(y){return[]},a.binding=function(y){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(y){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},function(t,e,r){"use strict";var o=r(5),a=r(6),p=r(7),T=r(8);function k(n,l,b){var E=n;return a(l)?(b=l,typeof n=="string"&&(E={uri:n})):E=T(l,{uri:n}),E.callback=b,E}function v(n,l,b){return d(l=k(n,l,b))}function d(n){if(n.callback===void 0)throw new Error("callback argument missing");var l=!1,b=function(g,x,B){l||(l=!0,n.callback(g,x,B))};function E(){var g=void 0;if(g=h.response?h.response:h.responseText||function(x){try{if(x.responseType==="document")return x.responseXML;var B=x.responseXML&&x.responseXML.documentElement.nodeName==="parsererror";if(x.responseType===""&&!B)return x.responseXML}catch{}return null}(h),Z)try{g=JSON.parse(g)}catch{}return g}function P(g){return clearTimeout(j),g instanceof Error||(g=new Error(""+(g||"Unknown XMLHttpRequest Error"))),g.statusCode=0,b(g,G)}function w(){if(!S){var g;clearTimeout(j),g=n.useXDR&&h.status===void 0?200:h.status===1223?204:h.status;var x=G,B=null;return g!==0?(x={body:E(),statusCode:g,method:L,headers:{},url:V,rawRequest:h},h.getAllResponseHeaders&&(x.headers=p(h.getAllResponseHeaders()))):B=new Error("Internal XMLHttpRequest Error"),b(B,x,x.body)}}var y,S,h=n.xhr||null;h||(h=n.cors||n.useXDR?new v.XDomainRequest:new v.XMLHttpRequest);var j,V=h.url=n.uri||n.url,L=h.method=n.method||"GET",q=n.body||n.data,_=h.headers=n.headers||{},W=!!n.sync,Z=!1,G={body:void 0,headers:{},statusCode:0,method:L,url:V,rawRequest:h};if("json"in n&&n.json!==!1&&(Z=!0,_.accept||_.Accept||(_.Accept="application/json"),L!=="GET"&&L!=="HEAD"&&(_["content-type"]||_["Content-Type"]||(_["Content-Type"]="application/json"),q=JSON.stringify(n.json===!0?q:n.json))),h.onreadystatechange=function(){h.readyState===4&&setTimeout(w,0)},h.onload=w,h.onerror=P,h.onprogress=function(){},h.onabort=function(){S=!0},h.ontimeout=P,h.open(L,V,!W,n.username,n.password),W||(h.withCredentials=!!n.withCredentials),!W&&n.timeout>0&&(j=setTimeout(function(){if(!S){S=!0,h.abort("timeout");var g=new Error("XMLHttpRequest timeout");g.code="ETIMEDOUT",P(g)}},n.timeout)),h.setRequestHeader)for(y in _)_.hasOwnProperty(y)&&h.setRequestHeader(y,_[y]);else if(n.headers&&!function(g){for(var x in g)if(g.hasOwnProperty(x))return!1;return!0}(n.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in n&&(h.responseType=n.responseType),"beforeSend"in n&&typeof n.beforeSend=="function"&&n.beforeSend(h),h.send(q||null),h}t.exports=v,t.exports.default=v,v.XMLHttpRequest=o.XMLHttpRequest||function(){},v.XDomainRequest="withCredentials"in new v.XMLHttpRequest?v.XMLHttpRequest:o.XDomainRequest,function(n,l){for(var b=0;b<n.length;b++)l(n[b])}(["get","put","post","patch","head","delete"],function(n){v[n==="delete"?"del":n]=function(l,b,E){return(b=k(l,b,E)).method=n.toUpperCase(),d(b)}})},function(t,e,r){(function(o){var a;a=typeof window!="undefined"?window:o!==void 0?o:typeof self!="undefined"?self:{},t.exports=a}).call(this,r(0))},function(t,e){t.exports=function(o){if(!o)return!1;var a=r.call(o);return a==="[object Function]"||typeof o=="function"&&a!=="[object RegExp]"||typeof window!="undefined"&&(o===window.setTimeout||o===window.alert||o===window.confirm||o===window.prompt)};var r=Object.prototype.toString},function(t,e){var r=function(o){return o.replace(/^\s+|\s+$/g,"")};t.exports=function(o){if(!o)return{};for(var a,p={},T=r(o).split(` | ||
`),k=0;k<T.length;k++){var v=T[k],d=v.indexOf(":"),n=r(v.slice(0,d)).toLowerCase(),l=r(v.slice(d+1));p[n]===void 0?p[n]=l:(a=p[n],Object.prototype.toString.call(a)==="[object Array]"?p[n].push(l):p[n]=[p[n],l])}return p}},function(t,e){t.exports=function(){for(var o={},a=0;a<arguments.length;a++){var p=arguments[a];for(var T in p)r.call(p,T)&&(o[T]=p[T])}return o};var r=Object.prototype.hasOwnProperty}])})});ie(exports,{MuxUploaderDrop:()=>Yt,default:()=>Ce});var X=z(require("react"));if(typeof DocumentFragment=="undefined"){class t{}globalThis.DocumentFragment=t}globalThis.customElements||(globalThis.customElements={get(t){},define(t,e,r){},upgrade(t){},whenDefined(t){return Promise.resolve(globalThis.HTMLElement)}});var tt;if(!globalThis.CustomEvent){class t{constructor(r,o={}){Ut(this,tt,void 0);Dt(this,tt,o==null?void 0:o.detail)}get detail(){Bt(this,tt)}initCustomEvent(r,o,a,p){}}tt=new WeakMap,globalThis.CustomEvent=t}if(!globalThis.EventTarget){class t{addEventListener(){}removeEventListener(){}dispatchEvent(r){return!0}}globalThis.EventTarget=t}if(!globalThis.HTMLElement){class t extends EventTarget{}globalThis.HTMLElement=t}if(!globalThis.HTMLVideoElement){class t extends EventTarget{}globalThis.HTMLVideoElement=t}var jt,It;if(!((jt=globalThis.document)==null?void 0:jt.createElement)){let t=(It=globalThis.document)!=null?It:{};t.createElement=function(r,o){return new HTMLElement},globalThis.document=t}var Xt=z(Nt()),Ht=document.createElement("template");Ht.innerHTML=` | ||
var et=Object.create;var ie=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var rt=Object.getPrototypeOf,ot=Object.prototype.hasOwnProperty;var Oe=e=>ie(e,"__esModule",{value:!0});var st=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),it=(e,t)=>{Oe(e);for(var r in t)ie(e,r,{get:t[r],enumerable:!0})},at=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of nt(t))!ot.call(e,o)&&o!=="default"&&ie(e,o,{get:()=>t[o],enumerable:!(r=tt(t,o))||r.enumerable});return e},z=e=>at(Oe(ie(e!=null?et(rt(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var _e=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Ue=(e,t,r)=>(_e(e,t,"read from private field"),r?r.call(e):t.get(e)),Be=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},De=(e,t,r,o)=>(_e(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Ne=st((te,fe)=>{(function(e,t){typeof te=="object"&&typeof fe=="object"?fe.exports=t():typeof define=="function"&&define.amd?define([],t):typeof te=="object"?te.UpChunk=t():e.UpChunk=t()})(te,function(){return function(e){var t={};function r(o){if(t[o])return t[o].exports;var a=t[o]={i:o,l:!1,exports:{}};return e[o].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(o,a,p){r.o(o,a)||Object.defineProperty(o,a,{enumerable:!0,get:p})},r.r=function(o){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},r.t=function(o,a){if(1&a&&(o=r(o)),8&a||4&a&&typeof o=="object"&&o&&o.__esModule)return o;var p=Object.create(null);if(r.r(p),Object.defineProperty(p,"default",{enumerable:!0,value:o}),2&a&&typeof o!="string")for(var T in o)r.d(p,T,function(k){return o[k]}.bind(null,T));return p},r.n=function(o){var a=o&&o.__esModule?function(){return o.default}:function(){return o};return r.d(a,"a",a),a},r.o=function(o,a){return Object.prototype.hasOwnProperty.call(o,a)},r.p="",r(r.s=1)}([function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch{typeof window=="object"&&(r=window)}e.exports=r},function(e,t,r){"use strict";var o=this&&this.__assign||function(){return(o=Object.assign||function(d){for(var n,l=1,b=arguments.length;l<b;l++)for(var E in n=arguments[l])Object.prototype.hasOwnProperty.call(n,E)&&(d[E]=n[E]);return d}).apply(this,arguments)};t.__esModule=!0,t.createUpload=t.UpChunk=void 0;var a=r(2),p=r(4),T=[200,201,202,204,308],k=[408,502,503,504],v=function(){function d(n){var l=this;this.endpoint=n.endpoint,this.file=n.file,this.headers=n.headers||{},this.method=n.method||"PUT",this.chunkSize=n.chunkSize||30720,this.attempts=n.attempts||5,this.delayBeforeAttempt=n.delayBeforeAttempt||1,this.maxFileBytes=1024*(n.maxFileSize||0),this.chunkCount=0,this.chunkByteSize=1024*this.chunkSize,this.totalChunks=Math.ceil(this.file.size/this.chunkByteSize),this.attemptCount=0,this.offline=!1,this.paused=!1,this.success=!1,this.reader=new FileReader,this.eventTarget=new a.EventTarget,this.validateOptions(),this.getEndpoint().then(function(){return l.sendChunks()}),typeof window!="undefined"&&(window.addEventListener("online",function(){l.offline&&(l.offline=!1,l.dispatch("online"),l.sendChunks())}),window.addEventListener("offline",function(){l.offline=!0,l.dispatch("offline")}))}return d.prototype.on=function(n,l){this.eventTarget.addEventListener(n,l)},d.prototype.abort=function(){var n;this.pause(),(n=this.currentXhr)===null||n===void 0||n.abort()},d.prototype.pause=function(){this.paused=!0},d.prototype.resume=function(){this.paused&&(this.paused=!1,this.sendChunks())},d.prototype.dispatch=function(n,l){var b=new CustomEvent(n,{detail:l});this.eventTarget.dispatchEvent(b)},d.prototype.validateOptions=function(){if(!this.endpoint||typeof this.endpoint!="function"&&typeof this.endpoint!="string")throw new TypeError("endpoint must be defined as a string or a function that returns a promise");if(!(this.file instanceof File))throw new TypeError("file must be a File object");if(this.headers&&typeof this.headers!="object")throw new TypeError("headers must be null or an object");if(this.chunkSize&&(typeof this.chunkSize!="number"||this.chunkSize<=0||this.chunkSize%256!=0))throw new TypeError("chunkSize must be a positive number in multiples of 256");if(this.maxFileBytes>0&&this.maxFileBytes<this.file.size)throw new Error("file size exceeds maximum (".concat(this.file.size," > ").concat(this.maxFileBytes,")"));if(this.attempts&&(typeof this.attempts!="number"||this.attempts<=0))throw new TypeError("retries must be a positive number");if(this.delayBeforeAttempt&&(typeof this.delayBeforeAttempt!="number"||this.delayBeforeAttempt<0))throw new TypeError("delayBeforeAttempt must be a positive number")},d.prototype.getEndpoint=function(){var n=this;return typeof this.endpoint=="string"?(this.endpointValue=this.endpoint,Promise.resolve(this.endpoint)):this.endpoint(this.file).then(function(l){return n.endpointValue=l,n.endpointValue})},d.prototype.getChunk=function(){var n=this;return new Promise(function(l){var b=n.totalChunks===1?n.file.size:n.chunkByteSize,E=b*n.chunkCount;n.reader.onload=function(){n.reader.result!==null&&(n.chunk=new Blob([n.reader.result],{type:"application/octet-stream"})),l()},n.reader.readAsArrayBuffer(n.file.slice(E,E+b))})},d.prototype.xhrPromise=function(n){var l=this,b=function(E){E.upload.onprogress=function(x){var w,y=100/l.totalChunks,M=y*l.file.size,h=y*l.chunkCount,j=x.loaded/((w=x.total)!==null&&w!==void 0?w:M)*y;l.dispatch("progress",Math.min(h+j,100))}};return new Promise(function(E,x){l.currentXhr=(0,p.default)(o(o({},n),{beforeSend:b}),function(w,y){return l.currentXhr=void 0,w?x(w):E(y)})})},d.prototype.sendChunk=function(){var n=this.chunkCount*this.chunkByteSize,l=n+this.chunk.size-1,b=o(o({},this.headers),{"Content-Type":this.file.type,"Content-Range":"bytes ".concat(n,"-").concat(l,"/").concat(this.file.size)});return this.dispatch("attempt",{chunkNumber:this.chunkCount,chunkSize:this.chunk.size}),this.xhrPromise({headers:b,url:this.endpointValue,method:this.method,body:this.chunk})},d.prototype.manageRetries=function(){var n=this;if(this.attemptCount<this.attempts)return setTimeout(function(){return n.sendChunks()},1e3*this.delayBeforeAttempt),void this.dispatch("attemptFailure",{message:"An error occured uploading chunk ".concat(this.chunkCount,". ").concat(this.attempts-this.attemptCount," retries left."),chunkNumber:this.chunkCount,attemptsLeft:this.attempts-this.attemptCount});this.dispatch("error",{message:"An error occured uploading chunk ".concat(this.chunkCount,". No more retries, stopping upload"),chunk:this.chunkCount,attempts:this.attemptCount})},d.prototype.sendChunks=function(){var n=this;this.paused||this.offline||this.success||this.getChunk().then(function(){return n.attemptCount=n.attemptCount+1,n.sendChunk()}).then(function(l){if(T.includes(l.statusCode)){n.dispatch("chunkSuccess",{chunk:n.chunkCount,attempts:n.attemptCount,response:l}),n.attemptCount=0,n.chunkCount=n.chunkCount+1,n.chunkCount<n.totalChunks?n.sendChunks():(n.success=!0,n.dispatch("success"));var b=100*(n.chunkCount/n.totalChunks*n.file.size)/n.file.size;n.dispatch("progress",b)}else if(k.includes(l.statusCode)){if(n.paused||n.offline)return;n.manageRetries()}else{if(n.paused||n.offline)return;n.dispatch("error",{message:"Server responded with ".concat(l.statusCode,". Stopping upload."),chunkNumber:n.chunkCount,attempts:n.attemptCount})}}).catch(function(l){n.paused||n.offline||n.manageRetries()})},d}();t.UpChunk=v,t.createUpload=function(d){return new v(d)}},function(e,t,r){"use strict";(function(o,a){function p(s,i,...u){if(!s)throw new TypeError(T(i,u))}function T(s,i){let u=0;return s.replace(/%[os]/gu,()=>k(i[u++]))}function k(s){return typeof s!="object"||s===null?String(s):Object.prototype.toString.call(s)}let v;Object.defineProperty(t,"__esModule",{value:!0});let d=typeof window!="undefined"?window:typeof self!="undefined"?self:a!==void 0?a:typeof globalThis!="undefined"?globalThis:void 0,n;class l{constructor(i,u){this.code=i,this.message=u}warn(...i){var u;try{if(n)return void n({...this,args:i});let c=((u=new Error().stack)!==null&&u!==void 0?u:"").replace(/^(?:.+?\n){2}/gu,` | ||
`);console.warn(this.message,...i,c)}catch{}}}let b=new l("W01","Unable to initialize event under dispatching."),E=new l("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),x=new l("W03","Assigning any truthy value to 'returnValue' property has no effect."),w=new l("W04","Unable to preventDefault on non-cancelable events."),y=new l("W05","Unable to preventDefault inside passive event listener invocation."),M=new l("W06","An event listener wasn't added because it has been added already: %o, %o"),h=new l("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),j=new l("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o"),V=new l("W09","Event attribute handler must be a function: %o");class L{static get NONE(){return q}static get CAPTURING_PHASE(){return _}static get AT_TARGET(){return G}static get BUBBLING_PHASE(){return Z}constructor(i,u){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let c=u!=null?u:{};W.set(this,{type:String(i),bubbles:Boolean(c.bubbles),cancelable:Boolean(c.cancelable),composed:Boolean(c.composed),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1,inPassiveListenerFlag:!1,dispatchFlag:!1,timeStamp:Date.now()})}get type(){return g(this).type}get target(){return g(this).target}get srcElement(){return g(this).target}get currentTarget(){return g(this).currentTarget}composedPath(){let i=g(this).currentTarget;return i?[i]:[]}get NONE(){return q}get CAPTURING_PHASE(){return _}get AT_TARGET(){return G}get BUBBLING_PHASE(){return Z}get eventPhase(){return g(this).dispatchFlag?2:0}stopPropagation(){g(this).stopPropagationFlag=!0}get cancelBubble(){return g(this).stopPropagationFlag}set cancelBubble(i){i?g(this).stopPropagationFlag=!0:E.warn()}stopImmediatePropagation(){let i=g(this);i.stopPropagationFlag=i.stopImmediatePropagationFlag=!0}get bubbles(){return g(this).bubbles}get cancelable(){return g(this).cancelable}get returnValue(){return!g(this).canceledFlag}set returnValue(i){i?x.warn():P(g(this))}preventDefault(){P(g(this))}get defaultPrevented(){return g(this).canceledFlag}get composed(){return g(this).composed}get isTrusted(){return!1}get timeStamp(){return g(this).timeStamp}initEvent(i,u=!1,c=!1){let f=g(this);f.dispatchFlag?b.warn():W.set(this,{...f,type:String(i),bubbles:Boolean(u),cancelable:Boolean(c),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}}let q=0,_=1,G=2,Z=3,W=new WeakMap;function g(s,i="this"){let u=W.get(s);return p(u!=null,"'%s' must be an object that Event constructor created, but got another one: %o",i,s),u}function P(s){s.inPassiveListenerFlag?y.warn():s.cancelable?s.canceledFlag=!0:w.warn()}Object.defineProperty(L,"NONE",{enumerable:!0}),Object.defineProperty(L,"CAPTURING_PHASE",{enumerable:!0}),Object.defineProperty(L,"AT_TARGET",{enumerable:!0}),Object.defineProperty(L,"BUBBLING_PHASE",{enumerable:!0});let U=Object.getOwnPropertyNames(L.prototype);for(let s=0;s<U.length;++s)U[s]!=="constructor"&&Object.defineProperty(L.prototype,U[s],{enumerable:!0});let N;d!==void 0&&d.Event!==void 0&&Object.setPrototypeOf(L.prototype,d.Event.prototype);let me={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};function be(s){let i=Object.keys(me);for(let u=0;u<i.length;++u){let c=i[u],f=me[c];Object.defineProperty(s,c,{get:()=>f,configurable:!0,enumerable:!0})}}class J extends L{static wrap(i){return new(function u(c){let f=Object.getPrototypeOf(c);if(f==null)return J;let m=oe.get(f);return m==null&&(m=function(C,S){class A extends C{}let R=Object.keys(S);for(let O=0;O<R.length;++O)Object.defineProperty(A.prototype,R[O],ye(S,R[O]));return A}(u(f),f),oe.set(f,m)),m}(i))(i)}constructor(i){super(i.type,{bubbles:i.bubbles,cancelable:i.cancelable,composed:i.composed}),i.cancelBubble&&super.stopPropagation(),i.defaultPrevented&&super.preventDefault(),ve.set(this,{original:i});let u=Object.keys(i);for(let c=0;c<u.length;++c){let f=u[c];f in this||Object.defineProperty(this,f,ye(i,f))}}stopPropagation(){super.stopPropagation();let{original:i}=F(this);"stopPropagation"in i&&i.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(i){super.cancelBubble=i;let{original:u}=F(this);"cancelBubble"in u&&(u.cancelBubble=i)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:i}=F(this);"stopImmediatePropagation"in i&&i.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(i){super.returnValue=i;let{original:u}=F(this);"returnValue"in u&&(u.returnValue=i)}preventDefault(){super.preventDefault();let{original:i}=F(this);"preventDefault"in i&&i.preventDefault()}get timeStamp(){let{original:i}=F(this);return"timeStamp"in i?i.timeStamp:super.timeStamp}}let ve=new WeakMap;function F(s){let i=ve.get(s);return p(i!=null,"'this' is expected an Event object, but got",s),i}let oe=new WeakMap;function ye(s,i){let u=Object.getOwnPropertyDescriptor(s,i);return{get(){let c=F(this).original,f=c[i];return typeof f=="function"?f.bind(c):f},set(c){F(this).original[i]=c},configurable:u.configurable,enumerable:u.enumerable}}function Ee(s){return(1&s.flags)==1}function Te(s){return(2&s.flags)==2}function we(s){return(4&s.flags)==4}function Je(s){return(8&s.flags)==8}function Qe({callback:s},i,u){try{typeof s=="function"?s.call(i,u):typeof s.handleEvent=="function"&&s.handleEvent(u)}catch(c){(function(f){try{let m=f instanceof Error?f:new Error(k(f));if(v)return void v(m);if(typeof dispatchEvent=="function"&&typeof ErrorEvent=="function")dispatchEvent(new ErrorEvent("error",{error:m,message:m.message}));else if(o!==void 0&&typeof o.emit=="function")return void o.emit("uncaughtException",m);console.error(m)}catch{}})(c)}}function ke({listeners:s},i,u){for(let c=0;c<s.length;++c)if(s[c].callback===i&&Ee(s[c])===u)return c;return-1}function Re(s,i,u,c,f,m){let C;m&&(C=de.bind(null,s,i,u),m.addEventListener("abort",C));let S=function(A,R,O,B,se,D){return{callback:A,flags:(R?1:0)|(O?2:0)|(B?4:0),signal:se,signalListener:D}}(i,u,c,f,m,C);return s.cow?(s.cow=!1,s.listeners=[...s.listeners,S]):s.listeners.push(S),S}function de(s,i,u){let c=ke(s,i,u);return c!==-1&&xe(s,c)}function xe(s,i,u=!1){let c=s.listeners[i];return function(f){f.flags|=8}(c),c.signal&&c.signal.removeEventListener("abort",c.signalListener),s.cow&&!u?(s.cow=!1,s.listeners=s.listeners.filter((f,m)=>m!==i),!1):(s.listeners.splice(i,1),!0)}function Pe(s,i){var u;return(u=s[i])!==null&&u!==void 0?u:s[i]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}oe.set(Object.prototype,J),d!==void 0&&d.Event!==void 0&&oe.set(d.Event.prototype,J);class K{constructor(){Ce.set(this,Object.create(null))}addEventListener(i,u,c){let f=$(this),{callback:m,capture:C,once:S,passive:A,signal:R,type:O}=function(D,H,I){var Q;return Me(H),typeof I=="object"&&I!==null?{type:String(D),callback:H!=null?H:void 0,capture:Boolean(I.capture),passive:Boolean(I.passive),once:Boolean(I.once),signal:(Q=I.signal)!==null&&Q!==void 0?Q:void 0}:{type:String(D),callback:H!=null?H:void 0,capture:Boolean(I),passive:!1,once:!1,signal:void 0}}(i,u,c);if(m==null||(R==null?void 0:R.aborted))return;let B=Pe(f,O),se=ke(B,m,C);se===-1?Re(B,m,C,A,S,R):function(D,H,I,Q){M.warn(Ee(D)?"capture":"bubble",D.callback),Te(D)!==H&&h.warn("passive"),we(D)!==I&&h.warn("once"),D.signal!==Q&&h.warn("signal")}(B.listeners[se],A,S,R)}removeEventListener(i,u,c){let f=$(this),{callback:m,capture:C,type:S}=function(R,O,B){return Me(O),typeof B=="object"&&B!==null?{type:String(R),callback:O!=null?O:void 0,capture:Boolean(B.capture)}:{type:String(R),callback:O!=null?O:void 0,capture:Boolean(B)}}(i,u,c),A=f[S];m!=null&&A&&de(A,m,C)}dispatchEvent(i){let u=$(this)[String(i.type)];if(u==null)return!0;let c=i instanceof L?i:J.wrap(i),f=g(c,"event");if(f.dispatchFlag)throw m="This event has been in dispatching.",d.DOMException?new d.DOMException(m,"InvalidStateError"):(N==null&&(N=class Fe extends Error{constructor(S){super(S),Error.captureStackTrace&&Error.captureStackTrace(this,Fe)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(N.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),be(N),be(N.prototype)),new N(m));var m;if(f.dispatchFlag=!0,f.target=f.currentTarget=this,!f.stopPropagationFlag){let{cow:C,listeners:S}=u;u.cow=!0;for(let A=0;A<S.length;++A){let R=S[A];if(!Je(R)&&(we(R)&&xe(u,A,!C)&&(A-=1),f.inPassiveListenerFlag=Te(R),Qe(R,this,c),f.inPassiveListenerFlag=!1,f.stopImmediatePropagationFlag))break}C||(u.cow=!1)}return f.target=null,f.currentTarget=null,f.stopImmediatePropagationFlag=!1,f.stopPropagationFlag=!1,f.dispatchFlag=!1,!f.canceledFlag}}let Ce=new WeakMap;function $(s,i="this"){let u=Ce.get(s);return p(u!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",i,s),u}function Me(s){if(typeof s!="function"&&(typeof s!="object"||s===null||typeof s.handleEvent!="function")){if(s!=null&&typeof s!="object")throw new TypeError(T(j.message,[s]));j.warn(s)}}let he=Object.getOwnPropertyNames(K.prototype);for(let s=0;s<he.length;++s)he[s]!=="constructor"&&Object.defineProperty(K.prototype,he[s],{enumerable:!0});function Se(s,i){var u,c;return(c=(u=$(s,"target")[i])===null||u===void 0?void 0:u.attrCallback)!==null&&c!==void 0?c:null}function Ae(s,i,u){u!=null&&typeof u!="function"&&V.warn(u),typeof u=="function"||typeof u=="object"&&u!==null?function(c,f,m){let C=Pe($(c,"target"),String(f));C.attrCallback=m,C.attrListener==null&&(C.attrListener=Re(C,function(S){return function(A){let R=S.attrCallback;typeof R=="function"&&R.call(this,A)}}(C),!1,!1,!1,void 0))}(s,i,u):function(c,f){let m=$(c,"target")[String(f)];m&&m.attrListener&&(de(m,m.attrListener.callback,!1),m.attrCallback=m.attrListener=void 0)}(s,i)}function Le(s,i,u){Object.defineProperty(s,"on"+i,{get(){return Se(this,i)},set(c){Ae(this,i,c)},configurable:!0,enumerable:!0})}d!==void 0&&d.EventTarget!==void 0&&Object.setPrototypeOf(K.prototype,d.EventTarget.prototype),t.Event=L,t.EventTarget=K,t.default=K,t.defineCustomEventTarget=function(...s){class i extends K{}for(let u=0;u<s.length;++u)Le(i.prototype,s[u]);return i},t.defineEventAttribute=Le,t.getEventAttributeValue=Se,t.setErrorHandler=function(s){p(typeof s=="function"||s===void 0,"The error handler must be a function or undefined, but got %o.",s),v=s},t.setEventAttributeValue=Ae,t.setWarningHandler=function(s){p(typeof s=="function"||s===void 0,"The warning handler must be a function or undefined, but got %o.",s),n=s}}).call(this,r(3),r(0))},function(e,t){var r,o,a=e.exports={};function p(){throw new Error("setTimeout has not been defined")}function T(){throw new Error("clearTimeout has not been defined")}function k(y){if(r===setTimeout)return setTimeout(y,0);if((r===p||!r)&&setTimeout)return r=setTimeout,setTimeout(y,0);try{return r(y,0)}catch{try{return r.call(null,y,0)}catch{return r.call(this,y,0)}}}(function(){try{r=typeof setTimeout=="function"?setTimeout:p}catch{r=p}try{o=typeof clearTimeout=="function"?clearTimeout:T}catch{o=T}})();var v,d=[],n=!1,l=-1;function b(){n&&v&&(n=!1,v.length?d=v.concat(d):l=-1,d.length&&E())}function E(){if(!n){var y=k(b);n=!0;for(var M=d.length;M;){for(v=d,d=[];++l<M;)v&&v[l].run();l=-1,M=d.length}v=null,n=!1,function(h){if(o===clearTimeout)return clearTimeout(h);if((o===T||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(h);try{o(h)}catch{try{return o.call(null,h)}catch{return o.call(this,h)}}}(y)}}function x(y,M){this.fun=y,this.array=M}function w(){}a.nextTick=function(y){var M=new Array(arguments.length-1);if(arguments.length>1)for(var h=1;h<arguments.length;h++)M[h-1]=arguments[h];d.push(new x(y,M)),d.length!==1||n||k(E)},x.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=w,a.addListener=w,a.once=w,a.off=w,a.removeListener=w,a.removeAllListeners=w,a.emit=w,a.prependListener=w,a.prependOnceListener=w,a.listeners=function(y){return[]},a.binding=function(y){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(y){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},function(e,t,r){"use strict";var o=r(5),a=r(6),p=r(7),T=r(8);function k(n,l,b){var E=n;return a(l)?(b=l,typeof n=="string"&&(E={uri:n})):E=T(l,{uri:n}),E.callback=b,E}function v(n,l,b){return d(l=k(n,l,b))}function d(n){if(n.callback===void 0)throw new Error("callback argument missing");var l=!1,b=function(g,P,U){l||(l=!0,n.callback(g,P,U))};function E(){var g=void 0;if(g=h.response?h.response:h.responseText||function(P){try{if(P.responseType==="document")return P.responseXML;var U=P.responseXML&&P.responseXML.documentElement.nodeName==="parsererror";if(P.responseType===""&&!U)return P.responseXML}catch{}return null}(h),Z)try{g=JSON.parse(g)}catch{}return g}function x(g){return clearTimeout(j),g instanceof Error||(g=new Error(""+(g||"Unknown XMLHttpRequest Error"))),g.statusCode=0,b(g,W)}function w(){if(!M){var g;clearTimeout(j),g=n.useXDR&&h.status===void 0?200:h.status===1223?204:h.status;var P=W,U=null;return g!==0?(P={body:E(),statusCode:g,method:L,headers:{},url:V,rawRequest:h},h.getAllResponseHeaders&&(P.headers=p(h.getAllResponseHeaders()))):U=new Error("Internal XMLHttpRequest Error"),b(U,P,P.body)}}var y,M,h=n.xhr||null;h||(h=n.cors||n.useXDR?new v.XDomainRequest:new v.XMLHttpRequest);var j,V=h.url=n.uri||n.url,L=h.method=n.method||"GET",q=n.body||n.data,_=h.headers=n.headers||{},G=!!n.sync,Z=!1,W={body:void 0,headers:{},statusCode:0,method:L,url:V,rawRequest:h};if("json"in n&&n.json!==!1&&(Z=!0,_.accept||_.Accept||(_.Accept="application/json"),L!=="GET"&&L!=="HEAD"&&(_["content-type"]||_["Content-Type"]||(_["Content-Type"]="application/json"),q=JSON.stringify(n.json===!0?q:n.json))),h.onreadystatechange=function(){h.readyState===4&&setTimeout(w,0)},h.onload=w,h.onerror=x,h.onprogress=function(){},h.onabort=function(){M=!0},h.ontimeout=x,h.open(L,V,!G,n.username,n.password),G||(h.withCredentials=!!n.withCredentials),!G&&n.timeout>0&&(j=setTimeout(function(){if(!M){M=!0,h.abort("timeout");var g=new Error("XMLHttpRequest timeout");g.code="ETIMEDOUT",x(g)}},n.timeout)),h.setRequestHeader)for(y in _)_.hasOwnProperty(y)&&h.setRequestHeader(y,_[y]);else if(n.headers&&!function(g){for(var P in g)if(g.hasOwnProperty(P))return!1;return!0}(n.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in n&&(h.responseType=n.responseType),"beforeSend"in n&&typeof n.beforeSend=="function"&&n.beforeSend(h),h.send(q||null),h}e.exports=v,e.exports.default=v,v.XMLHttpRequest=o.XMLHttpRequest||function(){},v.XDomainRequest="withCredentials"in new v.XMLHttpRequest?v.XMLHttpRequest:o.XDomainRequest,function(n,l){for(var b=0;b<n.length;b++)l(n[b])}(["get","put","post","patch","head","delete"],function(n){v[n==="delete"?"del":n]=function(l,b,E){return(b=k(l,b,E)).method=n.toUpperCase(),d(b)}})},function(e,t,r){(function(o){var a;a=typeof window!="undefined"?window:o!==void 0?o:typeof self!="undefined"?self:{},e.exports=a}).call(this,r(0))},function(e,t){e.exports=function(o){if(!o)return!1;var a=r.call(o);return a==="[object Function]"||typeof o=="function"&&a!=="[object RegExp]"||typeof window!="undefined"&&(o===window.setTimeout||o===window.alert||o===window.confirm||o===window.prompt)};var r=Object.prototype.toString},function(e,t){var r=function(o){return o.replace(/^\s+|\s+$/g,"")};e.exports=function(o){if(!o)return{};for(var a,p={},T=r(o).split(` | ||
`),k=0;k<T.length;k++){var v=T[k],d=v.indexOf(":"),n=r(v.slice(0,d)).toLowerCase(),l=r(v.slice(d+1));p[n]===void 0?p[n]=l:(a=p[n],Object.prototype.toString.call(a)==="[object Array]"?p[n].push(l):p[n]=[p[n],l])}return p}},function(e,t){e.exports=function(){for(var o={},a=0;a<arguments.length;a++){var p=arguments[a];for(var T in p)r.call(p,T)&&(o[T]=p[T])}return o};var r=Object.prototype.hasOwnProperty}])})});it(exports,{MuxUploaderDrop:()=>$e,default:()=>Ct});var X=z(require("react"));if(typeof DocumentFragment=="undefined"){class e{}globalThis.DocumentFragment=e}globalThis.customElements||(globalThis.customElements={get(e){},define(e,t,r){},upgrade(e){},whenDefined(e){return Promise.resolve(globalThis.HTMLElement)}});var ee;if(!globalThis.CustomEvent){class e{constructor(r,o={}){Be(this,ee,void 0);De(this,ee,o==null?void 0:o.detail)}get detail(){Ue(this,ee)}initCustomEvent(r,o,a,p){}}ee=new WeakMap,globalThis.CustomEvent=e}if(!globalThis.EventTarget){class e{addEventListener(){}removeEventListener(){}dispatchEvent(r){return!0}}globalThis.EventTarget=e}if(!globalThis.HTMLElement){class e extends EventTarget{}globalThis.HTMLElement=e}if(!globalThis.HTMLVideoElement){class e extends EventTarget{}globalThis.HTMLVideoElement=e}var je,Ie;if(!((je=globalThis.document)==null?void 0:je.createElement)){let e=(Ie=globalThis.document)!=null?Ie:{};e.createElement=function(r,o){return new HTMLElement},globalThis.document=e}var Xe=z(Ne()),He=document.createElement("template");He.innerHTML=` | ||
<style> | ||
@@ -33,3 +33,3 @@ :host { | ||
</div> | ||
`;var at={MUX_UPLOADER:"mux-uploader",OVERLAY_TEXT:"overlay-text"},zt=class extends HTMLElement{constructor(){super();let t=this.attachShadow({mode:"open"});t.appendChild(Ht.content.cloneNode(!0)),this.overlayText=t.getElementById("overlay-label")}connectedCallback(){this.setupDragEvents()}attributeChangedCallback(t,e,r){t===at.OVERLAY_TEXT&&e!==r?this.overlayText.innerHTML=r!=null?r:"":t==="active"&&this.getAttribute("overlay")&&r!=null&&(this._currentDragTarget=this)}static get observedAttributes(){return[at.OVERLAY_TEXT,at.MUX_UPLOADER,"active"]}get muxUploader(){let t=this.getAttribute(at.MUX_UPLOADER);return t?document.getElementById(t):null}setupDragEvents(){this.addEventListener("dragenter",t=>{this._currentDragTarget=t.target,t.preventDefault(),t.stopPropagation(),this.setAttribute("active","")}),this.addEventListener("dragleave",t=>{this._currentDragTarget===t.target&&(this._currentDragTarget=void 0,this.removeAttribute("active"))}),this.addEventListener("dragover",t=>{t.preventDefault(),t.stopPropagation()}),this.addEventListener("drop",t=>{var e;t.preventDefault(),t.stopPropagation();let{dataTransfer:r}=t,{files:o}=r,a=o[0];((e=this.muxUploader)!=null?e:this).dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:a})),this.removeAttribute("active")})}};globalThis.customElements.get("mux-uploader-drop")||(globalThis.customElements.define("mux-uploader-drop",zt),globalThis.MuxUploaderDropElement=zt);var ue=` | ||
`;var ae={MUX_UPLOADER:"mux-uploader",OVERLAY_TEXT:"overlay-text"},ze=class extends HTMLElement{constructor(){super();let e=this.attachShadow({mode:"open"});e.appendChild(He.content.cloneNode(!0)),this.overlayText=e.getElementById("overlay-label")}connectedCallback(){this.setupDragEvents()}attributeChangedCallback(e,t,r){e===ae.OVERLAY_TEXT&&t!==r?this.overlayText.innerHTML=r!=null?r:"":e==="active"&&this.getAttribute("overlay")&&r!=null&&(this._currentDragTarget=this)}static get observedAttributes(){return[ae.OVERLAY_TEXT,ae.MUX_UPLOADER,"active"]}get muxUploader(){let e=this.getAttribute(ae.MUX_UPLOADER);return e?document.getElementById(e):null}setupDragEvents(){this.addEventListener("dragenter",e=>{this._currentDragTarget=e.target,e.preventDefault(),e.stopPropagation(),this.setAttribute("active","")}),this.addEventListener("dragleave",e=>{this._currentDragTarget===e.target&&(this._currentDragTarget=void 0,this.removeAttribute("active"))}),this.addEventListener("dragover",e=>{e.preventDefault(),e.stopPropagation()}),this.addEventListener("drop",e=>{var t;e.preventDefault(),e.stopPropagation();let{dataTransfer:r}=e,{files:o}=r,a=o[0];((t=this.muxUploader)!=null?t:this).dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:a})),this.removeAttribute("active")})}};globalThis.customElements.get("mux-uploader-drop")||(globalThis.customElements.define("mux-uploader-drop",ze),globalThis.MuxUploaderDropElement=ze);var ut=` | ||
:host { | ||
@@ -197,5 +197,5 @@ font-family: var(--uploader-font-family, Arial); | ||
} | ||
`,Vt=document.createElement("template");Vt.innerHTML=` | ||
`,Ve=document.createElement("template");Ve.innerHTML=` | ||
<style> | ||
${ue} | ||
${ut} | ||
</style> | ||
@@ -230,3 +230,3 @@ | ||
</div> | ||
`;var ut={BAR:"bar",RADIAL:"radial"},le=t=>`${Math.floor(t)}%`,ce=t=>{var e;return Number((e=t.svgCircle)==null?void 0:e.getAttribute("r"))},nt=t=>ce(t)*2*Math.PI,pe="Media upload progress bar",qt=["Enter"," "],Wt=class extends HTMLElement{constructor(){super();var t,e,r,o,a,p,T,k,v,d,n;this.handleFilePickerButtonClick=this.handleFilePickerButtonClick.bind(this);let l=this.attachShadow({mode:"open"}),b=Vt.content.cloneNode(!0);l.appendChild(b),this.filePickerButton=(t=this.shadowRoot)==null?void 0:t.querySelector("slot[name=upload-button] > *"),this.svgCircle=(e=this.shadowRoot)==null?void 0:e.querySelector("circle"),this.progressBar=(r=this.shadowRoot)==null?void 0:r.getElementById("progress-bar"),this.uploadPercentage=(o=this.shadowRoot)==null?void 0:o.getElementById("upload-status"),this.statusMessage=(a=this.shadowRoot)==null?void 0:a.getElementById("status-message"),this.retryButton=(p=this.shadowRoot)==null?void 0:p.getElementById("retry-button"),this.srOnlyText=(T=this.shadowRoot)==null?void 0:T.getElementById("sr-only"),(k=this.progressBar)==null||k.setAttribute("aria-description",pe),(v=this.hiddenFileInput)==null||v.addEventListener("change",E=>{var P,w;let y=(w=(P=this.hiddenFileInput)==null?void 0:P.files)==null?void 0:w[0];y&&this.dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:y}))}),(n=(d=this.shadowRoot)==null?void 0:d.querySelector("slot[name=upload-button]"))==null||n.addEventListener("slotchange",()=>{var E,P;this.filePickerButton=(P=(E=this.shadowRoot)==null?void 0:E.querySelector("slot[name=upload-button]"))==null?void 0:P.assignedNodes()[0]})}connectedCallback(){this.setDefaultType(),this.setupRetry(),this.addEventListener("file-ready",this.handleUpload)}disconnectedCallback(){this.removeEventListener("file-ready",this.handleUpload,!1)}get filePickerButton(){return this._filePickerButton}set filePickerButton(t){t!==this._filePickerButton&&(this._filePickerButton&&this._filePickerButton.removeEventListener("click",this.handleFilePickerButtonClick),this._filePickerButton=t,this._filePickerButton&&this._filePickerButton.addEventListener("click",this.handleFilePickerButtonClick))}get hiddenFileInput(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("#hidden-file-input")}handleFilePickerButtonClick(t){this.hiddenFileInput.click()}get endpoint(){var t;return(t=this.getAttribute("endpoint"))!=null?t:this._endpoint}set endpoint(t){t!==this.endpoint&&(typeof t=="string"?this.setAttribute("endpoint",t):t==null&&this.removeAttribute("endpoint"),this._endpoint=t)}get formatProgress(){var t;return(t=this._formatProgress)!=null?t:le}set formatProgress(t){this._formatProgress=t}setDefaultType(){let t=this.getAttribute("type");t||this.setAttribute("type",ut.BAR),t===ut.RADIAL&&this.svgCircle&&(this.svgCircle.style.strokeDasharray=`${nt(this)} ${nt(this)}`,this.svgCircle.style.strokeDashoffset=`${nt(this)}`)}setupRetry(){var t;(t=this.retryButton)==null||t.addEventListener("click",()=>{this.resetState()});let e=r=>{let{key:o}=r;if(!qt.includes(o)){this.removeEventListener("keyup",e);return}this.resetState()};this.addEventListener("keydown",r=>{let{metaKey:o,altKey:a,key:p}=r;if(o||a||!qt.includes(p)){this.removeEventListener("keyup",e);return}this.addEventListener("keyup",e)})}resetState(){this.removeAttribute("upload-error"),this.removeAttribute("upload-in-progress"),this.hiddenFileInput.value="",this.statusMessage&&(this.statusMessage.innerHTML=""),this.uploadPercentage&&(this.uploadPercentage.innerHTML="")}setProgress(t){var e;switch(this.uploadPercentage&&(this.uploadPercentage.innerHTML=this.formatProgress(t)),(e=this.progressBar)==null||e.setAttribute("aria-valuenow",`${Math.floor(t)}`),this.getAttribute("type")){case ut.BAR:this.progressBar&&(this.progressBar.style.width=`${t}%`);case ut.RADIAL:if(this.svgCircle){let r=nt(this)-t/100*nt(this);this.svgCircle.style.strokeDashoffset=r.toString()}}}handleUpload(t){var e;let r=this.endpoint;if(r)this.removeAttribute("upload-error"),this.statusMessage&&(this.statusMessage.innerHTML="");else{let a="No url or endpoint specified -- cannot handleUpload";this.statusMessage&&(this.statusMessage.innerHTML=a),this.setAttribute("upload-error",""),console.error(a);return}this.setAttribute("upload-in-progress",""),(e=this.progressBar)==null||e.focus();let o=(0,Xt.createUpload)({endpoint:r,file:t.detail});this.dispatchEvent(new CustomEvent("uploadstart",{detail:o})),o.on("attempt",a=>{this.dispatchEvent(new CustomEvent("chunkattempt",a))}),o.on("chunkSuccess",a=>{this.dispatchEvent(new CustomEvent("chunksuccess",a))}),o.on("error",a=>{let p="An error has occurred";this.setAttribute("upload-error",""),this.statusMessage&&(this.statusMessage.innerHTML=p),console.error(a.detail.message),this.dispatchEvent(new CustomEvent("error",a))}),o.on("progress",a=>{this.setProgress(a.detail),this.dispatchEvent(new CustomEvent("progress",a))}),o.on("success",a=>{let p="Upload complete!";this.statusMessage&&(this.statusMessage.innerHTML=p),this.srOnlyText&&(this.srOnlyText.innerHTML=p),console.info(p),this.dispatchEvent(new CustomEvent("success",a))})}};globalThis.customElements.get("mux-uploader")||(globalThis.customElements.define("mux-uploader",Wt),globalThis.MuxUploaderElement=Wt);var rt=z(require("react"));var Gt={className:"class",classname:"class",htmlFor:"for",crossOrigin:"crossorigin",viewBox:"viewBox",playsInline:"playsinline",autoPlay:"autoplay"},de=t=>t==null,he=(t,e)=>de(e)?!1:t in e,fe=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),ge=(t,e)=>{if(!(typeof e=="boolean"&&!e)){if(he(t,Gt))return Gt[t];if(typeof e!=null)return/[A-Z]/.test(t)?fe(t):t}};var me=(t,e)=>typeof t=="boolean"?"":t,lt=(t={})=>Object.entries(t).reduce((e,[r,o])=>{let a=ge(r,o);if(!a)return e;let p=me(o,r);return e[a]=p,e},{});var $t=z(require("react"));var ct=z(require("react")),pt=(...t)=>{let e=(0,ct.useRef)(null);return(0,ct.useEffect)(()=>{t.forEach(r=>{!r||(typeof r=="function"?r(e.current):r.current=e.current)})},[t]),e};var be=rt.default.forwardRef(({children:t,...e},r)=>rt.default.createElement("mux-uploader-drop",lt({...e,ref:r}),t)),ve=rt.default.forwardRef((t,e)=>{let r=(0,$t.useRef)(null),o=pt(r,e);return rt.default.createElement(be,{ref:o,...t})}),Yt=ve;var Zt=z(require("react"));var Kt=z(require("react")),ye=Object.prototype.hasOwnProperty,Ee=(t,e)=>{if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(Array.isArray(t))return!Array.isArray(e)||t.length!==e.length?!1:t.some((a,p)=>e[p]===a);let r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return!1;for(let a=0;a<r.length;a++)if(!ye.call(e,r[a])||!Object.is(t[r[a]],e[r[a]]))return!1;return!0},Te=(t,e,r)=>!Ee(e,t[r]),we=(t,e,r)=>{t[r]=e},ke=(t,e,r,o=we,a=Te)=>(0,Kt.useEffect)(()=>{let p=r==null?void 0:r.current;!p||!a(p,e,t)||o(p,e,t)},[r==null?void 0:r.current,e]),gt=ke;var Re=X.default.forwardRef(({children:t,...e},r)=>X.default.createElement("mux-uploader",lt({...e,ref:r}),t)),K=(t,e,r)=>(0,X.useEffect)(()=>{let o=e==null?void 0:e.current;if(!(!o||!r))return o.addEventListener(t,r),()=>{o.removeEventListener(t,r)}},[e==null?void 0:e.current,r]),Pe=(t,e)=>{let{onUploadStart:r,onChunkAttempt:o,onChunkSuccess:a,onError:p,onProgress:T,onSuccess:k,formatProgress:v,endpoint:d,...n}=e;return gt("endpoint",d,t),gt("formatProgress",v,t),K("uploadstart",t,r),K("chunkattempt",t,o),K("chunksuccess",t,a),K("error",t,p),K("progress",t,T),K("success",t,k),[n]},xe=X.default.forwardRef((t,e)=>{let r=(0,Zt.useRef)(null),o=pt(r,e),[a]=Pe(r,t);return X.default.createElement(Re,{ref:o,...a})});var Ce=xe; | ||
`;var ue={BAR:"bar",RADIAL:"radial"},lt=e=>`${Math.floor(e)}%`,ct=e=>{var t;return Number((t=e.svgCircle)==null?void 0:t.getAttribute("r"))},ne=e=>ct(e)*2*Math.PI,pt="Media upload progress bar",qe=["Enter"," "],Ge=class extends HTMLElement{constructor(){super();var e,t,r,o,a,p,T,k,v,d,n;this.handleFilePickerButtonClick=this.handleFilePickerButtonClick.bind(this);let l=this.attachShadow({mode:"open"}),b=Ve.content.cloneNode(!0);l.appendChild(b),this.filePickerButton=(e=this.shadowRoot)==null?void 0:e.querySelector("slot[name=upload-button] > *"),this.svgCircle=(t=this.shadowRoot)==null?void 0:t.querySelector("circle"),this.progressBar=(r=this.shadowRoot)==null?void 0:r.getElementById("progress-bar"),this.uploadPercentage=(o=this.shadowRoot)==null?void 0:o.getElementById("upload-status"),this.statusMessage=(a=this.shadowRoot)==null?void 0:a.getElementById("status-message"),this.retryButton=(p=this.shadowRoot)==null?void 0:p.getElementById("retry-button"),this.srOnlyText=(T=this.shadowRoot)==null?void 0:T.getElementById("sr-only"),(k=this.progressBar)==null||k.setAttribute("aria-description",pt),(v=this.hiddenFileInput)==null||v.addEventListener("change",E=>{var x,w;let y=(w=(x=this.hiddenFileInput)==null?void 0:x.files)==null?void 0:w[0];y&&this.dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:y}))}),(n=(d=this.shadowRoot)==null?void 0:d.querySelector("slot[name=upload-button]"))==null||n.addEventListener("slotchange",()=>{var E,x;this.filePickerButton=(x=(E=this.shadowRoot)==null?void 0:E.querySelector("slot[name=upload-button]"))==null?void 0:x.assignedNodes()[0]})}connectedCallback(){this.setDefaultType(),this.setupRetry(),this.addEventListener("file-ready",this.handleUpload)}disconnectedCallback(){this.removeEventListener("file-ready",this.handleUpload,!1)}get filePickerButton(){return this._filePickerButton}set filePickerButton(e){e!==this._filePickerButton&&(this._filePickerButton&&this._filePickerButton.removeEventListener("click",this.handleFilePickerButtonClick),this._filePickerButton=e,this._filePickerButton&&this._filePickerButton.addEventListener("click",this.handleFilePickerButtonClick))}get hiddenFileInput(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("#hidden-file-input")}handleFilePickerButtonClick(e){this.hiddenFileInput.click()}get endpoint(){var e;return(e=this.getAttribute("endpoint"))!=null?e:this._endpoint}set endpoint(e){e!==this.endpoint&&(typeof e=="string"?this.setAttribute("endpoint",e):e==null&&this.removeAttribute("endpoint"),this._endpoint=e)}get formatProgress(){var e;return(e=this._formatProgress)!=null?e:lt}set formatProgress(e){this._formatProgress=e}setDefaultType(){let e=this.getAttribute("type");e||this.setAttribute("type",ue.BAR),e===ue.RADIAL&&this.svgCircle&&(this.svgCircle.style.strokeDasharray=`${ne(this)} ${ne(this)}`,this.svgCircle.style.strokeDashoffset=`${ne(this)}`)}setupRetry(){var e;(e=this.retryButton)==null||e.addEventListener("click",()=>{this.resetState()});let t=r=>{let{key:o}=r;if(!qe.includes(o)){this.removeEventListener("keyup",t);return}this.resetState()};this.addEventListener("keydown",r=>{let{metaKey:o,altKey:a,key:p}=r;if(o||a||!qe.includes(p)){this.removeEventListener("keyup",t);return}this.addEventListener("keyup",t)})}resetState(){this.removeAttribute("upload-error"),this.removeAttribute("upload-in-progress"),this.hiddenFileInput.value="",this.statusMessage&&(this.statusMessage.innerHTML=""),this.uploadPercentage&&(this.uploadPercentage.innerHTML="")}setProgress(e){var t;switch(this.uploadPercentage&&(this.uploadPercentage.innerHTML=this.formatProgress(e)),(t=this.progressBar)==null||t.setAttribute("aria-valuenow",`${Math.floor(e)}`),this.getAttribute("type")){case ue.BAR:this.progressBar&&(this.progressBar.style.width=`${e}%`);case ue.RADIAL:if(this.svgCircle){let r=ne(this)-e/100*ne(this);this.svgCircle.style.strokeDashoffset=r.toString()}}}handleUpload(e){var t;let r=this.endpoint;if(r)this.removeAttribute("upload-error"),this.statusMessage&&(this.statusMessage.innerHTML="");else{let a="No url or endpoint specified -- cannot handleUpload";this.statusMessage&&(this.statusMessage.innerHTML=a),this.setAttribute("upload-error",""),console.error(a);return}this.setAttribute("upload-in-progress",""),(t=this.progressBar)==null||t.focus();let o=(0,Xe.createUpload)({endpoint:r,file:e.detail});this.dispatchEvent(new CustomEvent("uploadstart",{detail:o})),o.on("attempt",a=>{this.dispatchEvent(new CustomEvent("chunkattempt",a))}),o.on("chunkSuccess",a=>{this.dispatchEvent(new CustomEvent("chunksuccess",a))}),o.on("error",a=>{let p="An error has occurred";this.setAttribute("upload-error",""),this.statusMessage&&(this.statusMessage.innerHTML=p),console.error(a.detail.message),this.dispatchEvent(new CustomEvent("error",a))}),o.on("progress",a=>{this.setProgress(a.detail),this.dispatchEvent(new CustomEvent("progress",a))}),o.on("success",a=>{let p="Upload complete!";this.statusMessage&&(this.statusMessage.innerHTML=p),this.srOnlyText&&(this.srOnlyText.innerHTML=p),console.info(p),this.dispatchEvent(new CustomEvent("success",a))})}};globalThis.customElements.get("mux-uploader")||(globalThis.customElements.define("mux-uploader",Ge),globalThis.MuxUploaderElement=Ge);var re=z(require("react"));var We={className:"class",classname:"class",htmlFor:"for",crossOrigin:"crossorigin",viewBox:"viewBox",playsInline:"playsinline",autoPlay:"autoplay"},dt=e=>e==null,ht=(e,t)=>dt(t)?!1:e in t,ft=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),gt=(e,t)=>{if(!(typeof t=="boolean"&&!t)){if(ht(e,We))return We[e];if(typeof t!=null)return/[A-Z]/.test(e)?ft(e):e}};var mt=(e,t)=>typeof e=="boolean"?"":e,le=(e={})=>Object.entries(e).reduce((t,[r,o])=>{let a=gt(r,o);if(!a)return t;let p=mt(o,r);return t[a]=p,t},{});var Ke=z(require("react"));var ce=z(require("react")),pe=(...e)=>{let t=(0,ce.useRef)(null);return(0,ce.useEffect)(()=>{e.forEach(r=>{!r||(typeof r=="function"?r(t.current):r.current=t.current)})},[e]),t};var bt=re.default.forwardRef(({children:e,...t},r)=>re.default.createElement("mux-uploader-drop",le({...t,ref:r}),e)),vt=re.default.forwardRef((e,t)=>{let r=(0,Ke.useRef)(null),o=pe(r,t);return re.default.createElement(bt,{ref:o,...e})}),$e=vt;var Ze=z(require("react"));var Ye=z(require("react")),yt=Object.prototype.hasOwnProperty,Et=(e,t)=>{if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.some((a,p)=>t[p]===a);let r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let a=0;a<r.length;a++)if(!yt.call(t,r[a])||!Object.is(e[r[a]],t[r[a]]))return!1;return!0},Tt=(e,t,r)=>!Et(t,e[r]),wt=(e,t,r)=>{e[r]=t},kt=(e,t,r,o=wt,a=Tt)=>(0,Ye.useEffect)(()=>{let p=r==null?void 0:r.current;!p||!a(p,t,e)||o(p,t,e)},[r==null?void 0:r.current,t]),ge=kt;var Rt=X.default.forwardRef(({children:e,...t},r)=>X.default.createElement("mux-uploader",le({...t,ref:r}),e)),Y=(e,t,r)=>(0,X.useEffect)(()=>{let o=t==null?void 0:t.current;if(!(!o||!r))return o.addEventListener(e,r),()=>{o.removeEventListener(e,r)}},[t==null?void 0:t.current,r]),xt=(e,t)=>{let{onUploadStart:r,onChunkAttempt:o,onChunkSuccess:a,onError:p,onProgress:T,onSuccess:k,formatProgress:v,endpoint:d,...n}=t;return ge("endpoint",d,e),ge("formatProgress",v,e),Y("uploadstart",e,r),Y("chunkattempt",e,o),Y("chunksuccess",e,a),Y("error",e,p),Y("progress",e,T),Y("success",e,k),[n]},Pt=X.default.forwardRef((e,t)=>{let r=(0,Ze.useRef)(null),o=pe(r,t),[a]=xt(r,e);return X.default.createElement(Rt,{ref:o,...a})});var Ct=Pt; | ||
//# sourceMappingURL=index.js.map |
@@ -6,3 +6,7 @@ import React from 'react'; | ||
import MuxUploaderElement from '@mux/mux-uploader'; | ||
import { MuxUploaderElementEventMap } from '@mux/mux-uploader'; | ||
export declare type MuxUploaderRefAttributes = MuxUploaderElement; | ||
interface GenericEventListener<T extends Event = CustomEvent> { | ||
(evt: T): void; | ||
} | ||
export declare type MuxUploaderProps = { | ||
@@ -30,8 +34,8 @@ id?: string; | ||
formatProgress?: (percent: number) => string; | ||
onUploadStart?: EventListener; | ||
onChunkAttempt?: EventListener; | ||
onChunkSuccess?: EventListener; | ||
onError?: EventListener; | ||
onProgress?: EventListener; | ||
onSuccess?: EventListener; | ||
onUploadStart?: GenericEventListener<MuxUploaderElementEventMap['uploadstart']>; | ||
onChunkAttempt?: GenericEventListener<MuxUploaderElementEventMap['chunkattempt']>; | ||
onChunkSuccess?: GenericEventListener<MuxUploaderElementEventMap['chunksuccess']>; | ||
onError?: GenericEventListener<MuxUploaderElementEventMap['error']>; | ||
onProgress?: GenericEventListener<MuxUploaderElementEventMap['progress']>; | ||
onSuccess?: GenericEventListener<MuxUploaderElementEventMap['success']>; | ||
}; | ||
@@ -38,0 +42,0 @@ declare const MuxUploader: React.ForwardRefExoticComponent<MuxUploaderProps & React.RefAttributes<MuxUploaderElement>>; |
@@ -6,3 +6,7 @@ import React from 'react'; | ||
import type MuxUploaderElement from '@mux/mux-uploader'; | ||
import type { MuxUploaderElementEventMap } from '@mux/mux-uploader'; | ||
export declare type MuxUploaderRefAttributes = MuxUploaderElement; | ||
interface GenericEventListener<T extends Event = CustomEvent> { | ||
(evt: T): void; | ||
} | ||
export declare type MuxUploaderProps = { | ||
@@ -30,8 +34,8 @@ id?: string; | ||
formatProgress?: (percent: number) => string; | ||
onUploadStart?: EventListener; | ||
onChunkAttempt?: EventListener; | ||
onChunkSuccess?: EventListener; | ||
onError?: EventListener; | ||
onProgress?: EventListener; | ||
onSuccess?: EventListener; | ||
onUploadStart?: GenericEventListener<MuxUploaderElementEventMap['uploadstart']>; | ||
onChunkAttempt?: GenericEventListener<MuxUploaderElementEventMap['chunkattempt']>; | ||
onChunkSuccess?: GenericEventListener<MuxUploaderElementEventMap['chunksuccess']>; | ||
onError?: GenericEventListener<MuxUploaderElementEventMap['error']>; | ||
onProgress?: GenericEventListener<MuxUploaderElementEventMap['progress']>; | ||
onSuccess?: GenericEventListener<MuxUploaderElementEventMap['success']>; | ||
}; | ||
@@ -38,0 +42,0 @@ declare const MuxUploader: React.ForwardRefExoticComponent<MuxUploaderProps & React.RefAttributes<MuxUploaderElement>>; |
{ | ||
"name": "@mux/mux-uploader-react", | ||
"version": "0.1.0-canary.10-485423a", | ||
"version": "0.1.0-canary.10-5c601b8", | ||
"type": "commonjs", | ||
@@ -49,3 +49,3 @@ "description": "An uploader element for React that handles Mux Direct Uploads and a visual progress bar for you", | ||
"dependencies": { | ||
"@mux/mux-uploader": "0.1.0-canary.10-485423a", | ||
"@mux/mux-uploader": "0.1.0-canary.10-5c601b8", | ||
"prop-types": "^15.7.2" | ||
@@ -52,0 +52,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
755
204817
22
+ Added@mux/mux-uploader@0.1.0-canary.10-5c601b8(transitive)
- Removed@mux/mux-uploader@0.1.0-canary.10-485423a(transitive)