Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mux/mux-uploader-react

Package Overview
Dependencies
Maintainers
2
Versions
523
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mux/mux-uploader-react - npm Package Compare versions

Comparing version 0.1.0-canary.10-8374ff1 to 0.1.0-canary.10-8cfa013

6

CHANGELOG.md

@@ -6,2 +6,8 @@ # Change Log

# [0.1.0-beta.4](https://github.com/muxinc/elements/compare/@mux/mux-uploader-react@0.1.0-beta.2...@mux/mux-uploader-react@0.1.0-beta.4) (2022-07-21)
### Bug Fixes
- **mux-uploader, mux-uploader-react:** Add support for endpoint to react version. Clean up type defs, including css vars (drop component only). Remove unnecessary capture for DandD events. ([c12ded5](https://github.com/muxinc/elements/commit/c12ded5188a3d97d48dc335a98d8537b6fa57443))
# 0.1.0-beta.2 (2022-07-11)

@@ -8,0 +14,0 @@

12

dist/index.js

@@ -1,4 +0,4 @@

var et=Object.create;var se=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var rt=Object.getPrototypeOf,ot=Object.prototype.hasOwnProperty;var Le=e=>se(e,"__esModule",{value:!0});var st=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),it=(e,t)=>{Le(e);for(var r in t)se(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"&&se(e,o,{get:()=>t[o],enumerable:!(r=tt(t,o))||r.enumerable});return e},z=e=>at(Le(se(e!=null?et(rt(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var Se=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var _e=(e,t,r)=>(Se(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)},Ue=(e,t,r,o)=>(Se(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Fe=st((ee,he)=>{(function(e,t){typeof ee=="object"&&typeof he=="object"?he.exports=t():typeof define=="function"&&define.amd?define([],t):typeof ee=="object"?ee.UpChunk=t():e.UpChunk=t()})(ee,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(R){return o[R]}.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(f){for(var n,l=1,b=arguments.length;l<b;l++)for(var E in n=arguments[l])Object.prototype.hasOwnProperty.call(n,E)&&(f[E]=n[E]);return f}).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],R=[408,502,503,504],v=function(){function f(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 f.prototype.on=function(n,l){this.eventTarget.addEventListener(n,l)},f.prototype.abort=function(){var n;this.pause(),(n=this.currentXhr)===null||n===void 0||n.abort()},f.prototype.pause=function(){this.paused=!0},f.prototype.resume=function(){this.paused&&(this.paused=!1,this.sendChunks())},f.prototype.dispatch=function(n,l){var b=new CustomEvent(n,{detail:l});this.eventTarget.dispatchEvent(b)},f.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")},f.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})},f.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))})},f.prototype.xhrPromise=function(n){var l=this,b=function(E){E.upload.onprogress=function(x){var w,y=100/l.totalChunks,A=y*l.file.size,d=y*l.chunkCount,j=x.loaded/((w=x.total)!==null&&w!==void 0?w:A)*y;l.dispatch("progress",Math.min(d+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)})})},f.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})},f.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})},f.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(R.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()})},f}();t.UpChunk=v,t.createUpload=function(f){return new v(f)}},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,()=>R(i[u++]))}function R(s){return typeof s!="object"||s===null?String(s):Object.prototype.toString.call(s)}let v;Object.defineProperty(t,"__esModule",{value:!0});let f=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."),A=new l("W06","An event listener wasn't added because it has been added already: %o, %o"),d=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 K}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 K}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 h=g(this);h.dispatchFlag?b.warn():G.set(this,{...h,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,K=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 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 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;f!==void 0&&f.Event!==void 0&&Object.setPrototypeOf(L.prototype,f.Event.prototype);let ge={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 me(s){let i=Object.keys(ge);for(let u=0;u<i.length;++u){let c=i[u],h=ge[c];Object.defineProperty(s,c,{get:()=>h,configurable:!0,enumerable:!0})}}class Z extends L{static wrap(i){return new(function u(c){let h=Object.getPrototypeOf(c);if(h==null)return Z;let m=re.get(h);return m==null&&(m=function(C,M){class O extends C{}let k=Object.keys(M);for(let S=0;S<k.length;++S)Object.defineProperty(O.prototype,k[S],ye(M,k[S]));return O}(u(h),h),re.set(h,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(),be.set(this,{original:i});let u=Object.keys(i);for(let c=0;c<u.length;++c){let h=u[c];h in this||Object.defineProperty(this,h,ye(i,h))}}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 be=new WeakMap;function F(s){let i=be.get(s);return p(i!=null,"'this' is expected an Event object, but got",s),i}let re=new WeakMap;function ye(s,i){let u=Object.getOwnPropertyDescriptor(s,i);return{get(){let c=F(this).original,h=c[i];return typeof h=="function"?h.bind(c):h},set(c){F(this).original[i]=c},configurable:u.configurable,enumerable:u.enumerable}}function ve(s){return(1&s.flags)==1}function Ee(s){return(2&s.flags)==2}function Te(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(h){try{let m=h instanceof Error?h:new Error(R(h));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 we({listeners:s},i,u){for(let c=0;c<s.length;++c)if(s[c].callback===i&&ve(s[c])===u)return c;return-1}function ke(s,i,u,c,h,m){let C;m&&(C=pe.bind(null,s,i,u),m.addEventListener("abort",C));let M=function(O,k,S,U,oe,D){return{callback:O,flags:(k?1:0)|(S?2:0)|(U?4:0),signal:oe,signalListener:D}}(i,u,c,h,m,C);return s.cow?(s.cow=!1,s.listeners=[...s.listeners,M]):s.listeners.push(M),M}function pe(s,i,u){let c=we(s,i,u);return c!==-1&&Re(s,c)}function Re(s,i,u=!1){let c=s.listeners[i];return function(h){h.flags|=8}(c),c.signal&&c.signal.removeEventListener("abort",c.signalListener),s.cow&&!u?(s.cow=!1,s.listeners=s.listeners.filter((h,m)=>m!==i),!1):(s.listeners.splice(i,1),!0)}function xe(s,i){var u;return(u=s[i])!==null&&u!==void 0?u:s[i]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}re.set(Object.prototype,Z),f!==void 0&&f.Event!==void 0&&re.set(f.Event.prototype,Z);class ${constructor(){Pe.set(this,Object.create(null))}addEventListener(i,u,c){let h=Y(this),{callback:m,capture:C,once:M,passive:O,signal:k,type:S}=function(D,H,I){var J;return Ce(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:(J=I.signal)!==null&&J!==void 0?J: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||(k==null?void 0:k.aborted))return;let U=xe(h,S),oe=we(U,m,C);oe===-1?ke(U,m,C,O,M,k):function(D,H,I,J){A.warn(ve(D)?"capture":"bubble",D.callback),Ee(D)!==H&&d.warn("passive"),Te(D)!==I&&d.warn("once"),D.signal!==J&&d.warn("signal")}(U.listeners[oe],O,M,k)}removeEventListener(i,u,c){let h=Y(this),{callback:m,capture:C,type:M}=function(k,S,U){return Ce(S),typeof U=="object"&&U!==null?{type:String(k),callback:S!=null?S:void 0,capture:Boolean(U.capture)}:{type:String(k),callback:S!=null?S:void 0,capture:Boolean(U)}}(i,u,c),O=h[M];m!=null&&O&&pe(O,m,C)}dispatchEvent(i){let u=Y(this)[String(i.type)];if(u==null)return!0;let c=i instanceof L?i:Z.wrap(i),h=g(c,"event");if(h.dispatchFlag)throw m="This event has been in dispatching.",f.DOMException?new f.DOMException(m,"InvalidStateError"):(N==null&&(N=class Ie extends Error{constructor(M){super(M),Error.captureStackTrace&&Error.captureStackTrace(this,Ie)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(N.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),me(N),me(N.prototype)),new N(m));var m;if(h.dispatchFlag=!0,h.target=h.currentTarget=this,!h.stopPropagationFlag){let{cow:C,listeners:M}=u;u.cow=!0;for(let O=0;O<M.length;++O){let k=M[O];if(!Je(k)&&(Te(k)&&Re(u,O,!C)&&(O-=1),h.inPassiveListenerFlag=Ee(k),Qe(k,this,c),h.inPassiveListenerFlag=!1,h.stopImmediatePropagationFlag))break}C||(u.cow=!1)}return h.target=null,h.currentTarget=null,h.stopImmediatePropagationFlag=!1,h.stopPropagationFlag=!1,h.dispatchFlag=!1,!h.canceledFlag}}let Pe=new WeakMap;function Y(s,i="this"){let u=Pe.get(s);return p(u!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",i,s),u}function Ce(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 de=Object.getOwnPropertyNames($.prototype);for(let s=0;s<de.length;++s)de[s]!=="constructor"&&Object.defineProperty($.prototype,de[s],{enumerable:!0});function Ae(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 Me(s,i,u){u!=null&&typeof u!="function"&&V.warn(u),typeof u=="function"||typeof u=="object"&&u!==null?function(c,h,m){let C=xe(Y(c,"target"),String(h));C.attrCallback=m,C.attrListener==null&&(C.attrListener=ke(C,function(M){return function(O){let k=M.attrCallback;typeof k=="function"&&k.call(this,O)}}(C),!1,!1,!1,void 0))}(s,i,u):function(c,h){let m=Y(c,"target")[String(h)];m&&m.attrListener&&(pe(m,m.attrListener.callback,!1),m.attrCallback=m.attrListener=void 0)}(s,i)}function Oe(s,i,u){Object.defineProperty(s,"on"+i,{get(){return Ae(this,i)},set(c){Me(this,i,c)},configurable:!0,enumerable:!0})}f!==void 0&&f.EventTarget!==void 0&&Object.setPrototypeOf($.prototype,f.EventTarget.prototype),t.Event=L,t.EventTarget=$,t.default=$,t.defineCustomEventTarget=function(...s){class i extends ${}for(let u=0;u<s.length;++u)Oe(i.prototype,s[u]);return i},t.defineEventAttribute=Oe,t.getEventAttributeValue=Ae,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=Me,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 R(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,f=[],n=!1,l=-1;function b(){n&&v&&(n=!1,v.length?f=v.concat(f):l=-1,f.length&&E())}function E(){if(!n){var y=R(b);n=!0;for(var A=f.length;A;){for(v=f,f=[];++l<A;)v&&v[l].run();l=-1,A=f.length}v=null,n=!1,function(d){if(o===clearTimeout)return clearTimeout(d);if((o===T||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(d);try{o(d)}catch{try{return o.call(null,d)}catch{return o.call(this,d)}}}(y)}}function x(y,A){this.fun=y,this.array=A}function w(){}a.nextTick=function(y){var A=new Array(arguments.length-1);if(arguments.length>1)for(var d=1;d<arguments.length;d++)A[d-1]=arguments[d];f.push(new x(y,A)),f.length!==1||n||R(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 R(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 f(l=R(n,l,b))}function f(n){if(n.callback===void 0)throw new Error("callback argument missing");var l=!1,b=function(g,P,B){l||(l=!0,n.callback(g,P,B))};function E(){var g=void 0;if(g=d.response?d.response:d.responseText||function(P){try{if(P.responseType==="document")return P.responseXML;var B=P.responseXML&&P.responseXML.documentElement.nodeName==="parsererror";if(P.responseType===""&&!B)return P.responseXML}catch{}return null}(d),K)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,G)}function w(){if(!A){var g;clearTimeout(j),g=n.useXDR&&d.status===void 0?200:d.status===1223?204:d.status;var P=G,B=null;return g!==0?(P={body:E(),statusCode:g,method:L,headers:{},url:V,rawRequest:d},d.getAllResponseHeaders&&(P.headers=p(d.getAllResponseHeaders()))):B=new Error("Internal XMLHttpRequest Error"),b(B,P,P.body)}}var y,A,d=n.xhr||null;d||(d=n.cors||n.useXDR?new v.XDomainRequest:new v.XMLHttpRequest);var j,V=d.url=n.uri||n.url,L=d.method=n.method||"GET",q=n.body||n.data,_=d.headers=n.headers||{},W=!!n.sync,K=!1,G={body:void 0,headers:{},statusCode:0,method:L,url:V,rawRequest:d};if("json"in n&&n.json!==!1&&(K=!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))),d.onreadystatechange=function(){d.readyState===4&&setTimeout(w,0)},d.onload=w,d.onerror=x,d.onprogress=function(){},d.onabort=function(){A=!0},d.ontimeout=x,d.open(L,V,!W,n.username,n.password),W||(d.withCredentials=!!n.withCredentials),!W&&n.timeout>0&&(j=setTimeout(function(){if(!A){A=!0,d.abort("timeout");var g=new Error("XMLHttpRequest timeout");g.code="ETIMEDOUT",x(g)}},n.timeout)),d.setRequestHeader)for(y in _)_.hasOwnProperty(y)&&d.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&&(d.responseType=n.responseType),"beforeSend"in n&&typeof n.beforeSend=="function"&&n.beforeSend(d),d.send(q||null),d}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=R(l,b,E)).method=n.toUpperCase(),f(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(`
`),R=0;R<T.length;R++){var v=T[R],f=v.indexOf(":"),n=r(v.slice(0,f)).toLowerCase(),l=r(v.slice(f+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 Q;if(!globalThis.CustomEvent){class e{constructor(r,o={}){Be(this,Q,void 0);Ue(this,Q,o==null?void 0:o.detail)}get detail(){_e(this,Q)}initCustomEvent(r,o,a,p){}}Q=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 De,je;if(!((De=globalThis.document)==null?void 0:De.createElement)){let e=(je=globalThis.document)!=null?je:{};e.createElement=function(r,o){return new HTMLElement},globalThis.document=e}var ze=z(Fe()),Ne=document.createElement("template");Ne.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 Le=e=>ie(e,"__esModule",{value:!0});var st=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),it=(e,t)=>{Le(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(Le(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 Be=(e,t,r)=>(_e(e,t,"read from private field"),r?r.call(e):t.get(e)),Ue=(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((ee,fe)=>{(function(e,t){typeof ee=="object"&&typeof fe=="object"?fe.exports=t():typeof define=="function"&&define.amd?define([],t):typeof ee=="object"?ee.UpChunk=t():e.UpChunk=t()})(ee,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(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}();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."),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 O{static get NONE(){return q}static get CAPTURING_PHASE(){return _}static get AT_TARGET(){return W}static get BUBBLING_PHASE(){return K}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 K}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,K=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(O,"NONE",{enumerable:!0}),Object.defineProperty(O,"CAPTURING_PHASE",{enumerable:!0}),Object.defineProperty(O,"AT_TARGET",{enumerable:!0}),Object.defineProperty(O,"BUBBLING_PHASE",{enumerable:!0});let B=Object.getOwnPropertyNames(O.prototype);for(let s=0;s<B.length;++s)B[s]!=="constructor"&&Object.defineProperty(O.prototype,B[s],{enumerable:!0});let N;d!==void 0&&d.Event!==void 0&&Object.setPrototypeOf(O.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 Z extends O{static wrap(i){return new(function u(c){let f=Object.getPrototypeOf(c);if(f==null)return Z;let m=oe.get(f);return m==null&&(m=function(C,A){class M extends C{}let R=Object.keys(A);for(let L=0;L<R.length;++L)Object.defineProperty(M.prototype,R[L],ye(A,R[L]));return M}(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 A=function(M,R,L,U,se,D){return{callback:M,flags:(R?1:0)|(L?2:0)|(U?4:0),signal:se,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 de(s,i,u){let c=ke(s,i,u);return c!==-1&&Pe(s,c)}function Pe(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 xe(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,Z),d!==void 0&&d.Event!==void 0&&oe.set(d.Event.prototype,Z);class ${constructor(){Ce.set(this,Object.create(null))}addEventListener(i,u,c){let f=Y(this),{callback:m,capture:C,once:A,passive:M,signal:R,type:L}=function(D,H,I){var J;return Se(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:(J=I.signal)!==null&&J!==void 0?J: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=xe(f,L),se=ke(U,m,C);se===-1?Re(U,m,C,M,A,R):function(D,H,I,J){S.warn(Ee(D)?"capture":"bubble",D.callback),Te(D)!==H&&h.warn("passive"),we(D)!==I&&h.warn("once"),D.signal!==J&&h.warn("signal")}(U.listeners[se],M,A,R)}removeEventListener(i,u,c){let f=Y(this),{callback:m,capture:C,type:A}=function(R,L,U){return Se(L),typeof U=="object"&&U!==null?{type:String(R),callback:L!=null?L:void 0,capture:Boolean(U.capture)}:{type:String(R),callback:L!=null?L:void 0,capture:Boolean(U)}}(i,u,c),M=f[A];m!=null&&M&&de(M,m,C)}dispatchEvent(i){let u=Y(this)[String(i.type)];if(u==null)return!0;let c=i instanceof O?i:Z.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(A){super(A),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:A}=u;u.cow=!0;for(let M=0;M<A.length;++M){let R=A[M];if(!Je(R)&&(we(R)&&Pe(u,M,!C)&&(M-=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 Y(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 Se(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($.prototype);for(let s=0;s<he.length;++s)he[s]!=="constructor"&&Object.defineProperty($.prototype,he[s],{enumerable:!0});function Ae(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 Me(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=xe(Y(c,"target"),String(f));C.attrCallback=m,C.attrListener==null&&(C.attrListener=Re(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&&(de(m,m.attrListener.callback,!1),m.attrCallback=m.attrListener=void 0)}(s,i)}function Oe(s,i,u){Object.defineProperty(s,"on"+i,{get(){return Ae(this,i)},set(c){Me(this,i,c)},configurable:!0,enumerable:!0})}d!==void 0&&d.EventTarget!==void 0&&Object.setPrototypeOf($.prototype,d.EventTarget.prototype),t.Event=O,t.EventTarget=$,t.default=$,t.defineCustomEventTarget=function(...s){class i extends ${}for(let u=0;u<s.length;++u)Oe(i.prototype,s[u]);return i},t.defineEventAttribute=Oe,t.getEventAttributeValue=Ae,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=Me,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 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(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,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),K)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:O,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,O=h.method=n.method||"GET",q=n.body||n.data,_=h.headers=n.headers||{},W=!!n.sync,K=!1,G={body:void 0,headers:{},statusCode:0,method:O,url:V,rawRequest:h};if("json"in n&&n.json!==!1&&(K=!0,_.accept||_.Accept||(_.Accept="application/json"),O!=="GET"&&O!=="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(O,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}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:()=>Ye,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 Q;if(!globalThis.CustomEvent){class e{constructor(r,o={}){Ue(this,Q,void 0);De(this,Q,o==null?void 0:o.detail)}get detail(){Be(this,Q)}initCustomEvent(r,o,a,p){}}Q=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 ie={MUX_UPLOADER:"mux-uploader",OVERLAY_TEXT:"overlay-text"},He=class extends HTMLElement{constructor(){super();let e=this.attachShadow({mode:"open"});e.appendChild(Ne.content.cloneNode(!0)),this.overlayText=e.getElementById("overlay-label")}connectedCallback(){this.setupDragEvents()}attributeChangedCallback(e,t,r){e===ie.OVERLAY_TEXT&&t!==r&&(this.overlayText.innerHTML=r!=null?r:"")}static get observedAttributes(){return[ie.OVERLAY_TEXT,ie.MUX_UPLOADER]}get muxUploader(){let e=this.getAttribute(ie.MUX_UPLOADER);return e?document.getElementById(e):null}setupDragEvents(){this.addEventListener("dragenter",e=>{e.preventDefault(),e.stopPropagation(),this.setAttribute("active","")}),this.addEventListener("dragleave",e=>{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",He),globalThis.MuxUploaderDropElement=He);var ut=`
`;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,3 +197,3 @@ font-family: var(--uploader-font-family, Arial);

}
`,Xe=document.createElement("template");Xe.innerHTML=`
`,Ve=document.createElement("template");Ve.innerHTML=`
<style>

@@ -230,3 +230,3 @@ ${ut}

</div>
`;var ae={BAR:"bar",RADIAL:"radial"},lt=e=>`${Math.floor(e)}%`,ct=e=>{var t;return Number((t=e.svgCircle)==null?void 0:t.getAttribute("r"))},te=e=>ct(e)*2*Math.PI,pt="Media upload progress bar",Ve=["Enter"," "],qe=class extends HTMLElement{constructor(){super();var e,t,r,o,a,p,T,R,v,f,n;this.handleFilePickerButtonClick=this.handleFilePickerButtonClick.bind(this);let l=this.attachShadow({mode:"open"}),b=Xe.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"),(R=this.progressBar)==null||R.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=(f=this.shadowRoot)==null?void 0:f.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 url(){return this.getAttribute("url")}set url(e){this.setAttribute("url",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",ae.BAR),e===ae.RADIAL&&this.svgCircle&&(this.svgCircle.style.strokeDasharray=`${te(this)} ${te(this)}`,this.svgCircle.style.strokeDashoffset=`${te(this)}`)}setupRetry(){var e;(e=this.retryButton)==null||e.addEventListener("click",()=>{this.resetState()});let t=r=>{let{key:o}=r;if(!Ve.includes(o)){this.removeEventListener("keyup",t);return}this.resetState()};this.addEventListener("keydown",r=>{let{metaKey:o,altKey:a,key:p}=r;if(o||a||!Ve.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 ae.BAR:this.progressBar&&(this.progressBar.style.width=`${e}%`);case ae.RADIAL:if(this.svgCircle){let r=te(this)-e/100*te(this);this.svgCircle.style.strokeDashoffset=r.toString()}}}handleUpload(e){var t;let r=this.url;if(r)this.removeAttribute("upload-error"),this.statusMessage&&(this.statusMessage.innerHTML="");else{let a="No url attribute 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,ze.createUpload)({endpoint:r,file:e.detail});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",qe),globalThis.MuxUploaderElement=qe);var ne=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,ue=(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 Ge=z(require("react"));var le=z(require("react")),ce=(...e)=>{let t=(0,le.useRef)(null);return(0,le.useEffect)(()=>{e.forEach(r=>{!r||(typeof r=="function"?r(t.current):r.current=t.current)})},[e]),t};var bt=ne.default.forwardRef(({children:e,...t},r)=>ne.default.createElement("mux-uploader-drop",ue({...t,ref:r}),e)),yt=ne.default.forwardRef((e,t)=>{let r=(0,Ge.useRef)(null),o=ce(r,t);return ne.default.createElement(bt,{ref:o,...e})}),$e=yt;var Ze=z(require("react"));var Ye=z(require("react")),vt=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(!vt.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]),Ke=kt;var Rt=X.default.forwardRef(({children:e,...t},r)=>X.default.createElement("mux-uploader",ue({...t,ref:r}),e)),fe=(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{onError:r,onProgress:o,onSuccess:a,formatProgress:p,...T}=t;return Ke("formatProgress",p,e),fe("error",e,r),fe("progress",e,o),fe("success",e,a),[T]},Pt=X.default.forwardRef((e,t)=>{let r=(0,Ze.useRef)(null),o=ce(r,t),[a]=xt(r,e);return X.default.createElement(Rt,{ref:o,...a})});var Ct=Pt;
`;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"))},te=e=>ct(e)*2*Math.PI,pt="Media upload progress bar",qe=["Enter"," "],We=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 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(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=`${te(this)} ${te(this)}`,this.svgCircle.style.strokeDashoffset=`${te(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=te(this)-e/100*te(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});o.on("attempt",({detail:a})=>{this.dispatchEvent(new CustomEvent("attempt",a))}),o.on("chunkSuccess",({detail: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",We),globalThis.MuxUploaderElement=We);var ne=z(require("react"));var Ge={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,Ge))return Ge[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 $e=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=ne.default.forwardRef(({children:e,...t},r)=>ne.default.createElement("mux-uploader-drop",le({...t,ref:r}),e)),vt=ne.default.forwardRef((e,t)=>{let r=(0,$e.useRef)(null),o=pe(r,t);return ne.default.createElement(bt,{ref:o,...e})}),Ye=vt;var Ze=z(require("react"));var Ke=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,Ke.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)),re=(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]),Pt=(e,t)=>{let{onAttempt:r,onChunkSuccess:o,onError:a,onProgress:p,onSuccess:T,formatProgress:k,endpoint:v,...d}=t;return ge("endpoint",v,e),ge("formatProgress",k,e),re("attempt",e,r),re("chunkSuccess",e,o),re("error",e,a),re("progress",e,p),re("success",e,T),[d]},xt=X.default.forwardRef((e,t)=>{let r=(0,Ze.useRef)(null),o=pe(r,t),[a]=Pt(r,e);return X.default.createElement(Rt,{ref:o,...a})});var Ct=xt;
//# sourceMappingURL=index.js.map

@@ -8,9 +8,23 @@ import React from 'react';

export declare type MuxUploaderProps = {
url: string;
id?: string;
endpoint?: string;
type?: string;
status?: boolean;
style?: CSSProperties;
style?: CSSProperties & {
['--uploader-font-family']?: CSSProperties['fontFamily'];
['--uploader-font-size']?: CSSProperties['fontSize'];
['--uploader-background-color']?: CSSProperties['backgroundColor'];
['--button-background-color']?: CSSProperties['backgroundColor'];
['--button-border-radius']?: CSSProperties['borderRadius'];
['--button-hover-text']?: CSSProperties['color'];
['--button-hover-background']?: CSSProperties['background'];
['--button-active-text']?: CSSProperties['color'];
['--button-active-background']?: CSSProperties['background'];
['--progress-bar-fill-color']?: CSSProperties['background'];
['--progress-radial-fill-color']?: CSSProperties['stroke'];
};
children?: React.ReactNode;
formatProgress?: (percent: number) => string;
onAttempt?: EventListener;
onChunkSuccess?: EventListener;
onError?: EventListener;

@@ -17,0 +31,0 @@ onProgress?: EventListener;

@@ -9,3 +9,5 @@ import React from 'react';

overlayText?: string;
style?: CSSProperties;
style?: CSSProperties & {
['--overlay-background-color']?: CSSProperties['backgroundColor'];
};
children?: React.ReactNode;

@@ -12,0 +14,0 @@ };

@@ -8,9 +8,23 @@ import React from 'react';

export declare type MuxUploaderProps = {
url: string;
id?: string;
endpoint?: string;
type?: string;
status?: boolean;
style?: CSSProperties;
style?: CSSProperties & {
['--uploader-font-family']?: CSSProperties['fontFamily'];
['--uploader-font-size']?: CSSProperties['fontSize'];
['--uploader-background-color']?: CSSProperties['backgroundColor'];
['--button-background-color']?: CSSProperties['backgroundColor'];
['--button-border-radius']?: CSSProperties['borderRadius'];
['--button-hover-text']?: CSSProperties['color'];
['--button-hover-background']?: CSSProperties['background'];
['--button-active-text']?: CSSProperties['color'];
['--button-active-background']?: CSSProperties['background'];
['--progress-bar-fill-color']?: CSSProperties['background'];
['--progress-radial-fill-color']?: CSSProperties['stroke'];
};
children?: React.ReactNode;
formatProgress?: (percent: number) => string;
onAttempt?: EventListener;
onChunkSuccess?: EventListener;
onError?: EventListener;

@@ -17,0 +31,0 @@ onProgress?: EventListener;

@@ -9,3 +9,5 @@ import React from 'react';

overlayText?: string;
style?: CSSProperties;
style?: CSSProperties & {
['--overlay-background-color']?: CSSProperties['backgroundColor'];
};
children?: React.ReactNode;

@@ -12,0 +14,0 @@ };

{
"name": "@mux/mux-uploader-react",
"version": "0.1.0-canary.10-8374ff1",
"version": "0.1.0-canary.10-8cfa013",
"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-beta.3",
"@mux/mux-uploader": "0.1.0-canary.10-8cfa013",
"prop-types": "^15.7.2"

@@ -52,0 +52,0 @@ },

@@ -70,9 +70,9 @@ <p align="center">

| Property | Type | Description | Default |
| ---------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| `url` | `string` | The authenticated URL that your file will be uploaded to. Check out the [direct uploads docs](https://docs.mux.com/guides/video/upload-files-directly#1-create-an-authenticated-mux-url) for how to create one. Required. | `undefined` |
| `id` | `string` | An ID that allows `<MuxUploaderDrop>` to locate `<MuxUploader>`. Required if you use `<MuxUploaderDrop>`. | N/A |
| `type` | `"bar"` | Specifies the visual type of progress bar. A radial type is in-progress. | "bar" |
| `status` | `boolean` | Toggles text status visibility of progress bar. The text that is displayed is a percentage by default. If you prefer just the progress bar with no text upload status, don't include this attribute. | false |
| `formatProgress` | `function` | A function that accepts numeric percent and is expected to return a string. Allows for customizing how the progress should be rendered. | A function the yields a percent progress string |
| Property | Type | Description | Default |
| ---------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| `endpoint` | `string \| Promise` | Either a) the authenticated URL that your file will be uploaded to or b) an async function that yields a promise that resolves to that url. Check out the [direct uploads docs](https://docs.mux.com/guides/video/upload-files-directly#1-create-an-authenticated-mux-url) for how to create one. Required. | `undefined` |
| `id` | `string` | An ID that allows `<MuxUploaderDrop>` to locate `<MuxUploader>`. Required if you use `<MuxUploaderDrop>`. | N/A |
| `type` | `"bar"` | Specifies the visual type of progress bar. A radial type is in-progress. | "bar" |
| `status` | `boolean` | Toggles text status visibility of progress bar. The text that is displayed is a percentage by default. If you prefer just the progress bar with no text upload status, don't include this attribute. | false |
| `formatProgress` | `function` | A function that accepts numeric percent and is expected to return a string. Allows for customizing how the progress should be rendered - whether you want to display only the number, a sentence with the number etc. i.e. `formatProgress={(percent: number) => `${percent} percent uploaded`}` | A function that yields only the percent as a string i.e. `"60%"` |

@@ -84,3 +84,3 @@ #### `<MuxUploaderDrop>`

| `overlay` | `boolean` | Toggles fullscreen overlay on dragover. | false |
| `overlayText` | `boolean` | Optional text to display on dragover when `overlay` is on. | `''` |
| `overlayText` | `string` | Optional text to display on dragover when `overlay` is on. | `''` |
| `muxUploader` | `string ` | Must match the `id` on `<MuxUploader>`. Required. | N/A |

@@ -94,6 +94,8 @@

| Prop | Description |
| ------------ | -------------------------------------------------------------------------- |
| `onError` | Invoked when an error occurs in the chunked upload process. |
| `onProgress` | Invoked whenever a chunk of the file has successfully completed uploading. |
| `onSuccess` | Invoked when the entire file has successfully completed uploading. |
| Prop | Description |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `onAttempt` | Invoked immediately before a chunk upload is attempted. |
| `onChunkSuccess` | Invoked when an indvidual chunk is successfully uploaded. Sample response: `{ detail: { chunk: Integer, attempts: Integer, response: XhrResponse } }` |
| `onError` | Invoked when an error occurs in the chunked upload process. |
| `onProgress` | Invoked continuously with incremental upload progress. This returns the current percentage of the file that's been uploaded. Sample response: `{ detail: [0..100] }` |
| `onSuccess` | Invoked when the entire file has successfully completed uploading. |

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc