@mux/mux-uploader-react
Advanced tools
Comparing version 1.0.1 to 1.0.2-canary.0-1088443
"use strict";"use client";var Yt=Object.create;var ce=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var Jt=Object.getOwnPropertyNames;var Qt=Object.getPrototypeOf,er=Object.prototype.hasOwnProperty;var tr=(e,t)=>{for(var r in t)ce(e,r,{get:t[r],enumerable:!0})},je=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Jt(t))!er.call(e,s)&&s!==r&&ce(e,s,{get:()=>t[s],enumerable:!(n=Zt(t,s))||n.enumerable});return e};var B=(e,t,r)=>(r=e!=null?Yt(Qt(e)):{},je(t||!e||!e.__esModule?ce(r,"default",{value:e,enumerable:!0}):r,e)),rr=e=>je(ce({},"__esModule",{value:!0}),e);var Un={};tr(Un,{MuxUploaderDrop:()=>zt,MuxUploaderFileSelect:()=>It,MuxUploaderPause:()=>jt,MuxUploaderProgress:()=>Ft,MuxUploaderRetry:()=>Ht,MuxUploaderStatus:()=>$t,ProgressTypes:()=>wn,default:()=>Pn});module.exports=rr(Un);var j=B(require("react"));var nr=Object.create,Qe=Object.defineProperty,sr=Object.getOwnPropertyDescriptor,et=Object.getOwnPropertyNames,ir=Object.getPrototypeOf,ar=Object.prototype.hasOwnProperty,K=(e,t)=>function(){return t||(0,e[et(e)[0]])((t={exports:{}}).exports,t),t.exports},or=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of et(t))!ar.call(e,s)&&s!==r&&Qe(e,s,{get:()=>t[s],enumerable:!(n=sr(t,s))||n.enumerable});return e},lr=(e,t,r)=>(r=e!=null?nr(ir(e)):{},or(t||!e||!e.__esModule?Qe(r,"default",{value:e,enumerable:!0}):r,e)),ur=K({"node_modules/global/window.js"(e,t){var r;typeof window!="undefined"?r=window:typeof global!="undefined"?r=global:typeof self!="undefined"?r=self:r={},t.exports=r}}),dr=K({"node_modules/is-function/index.js"(e,t){t.exports=n;var r=Object.prototype.toString;function n(s){if(!s)return!1;var a=r.call(s);return a==="[object Function]"||typeof s=="function"&&a!=="[object RegExp]"||typeof window!="undefined"&&(s===window.setTimeout||s===window.alert||s===window.confirm||s===window.prompt)}}}),pr=K({"node_modules/parse-headers/parse-headers.js"(e,t){var r=function(s){return s.replace(/^\s+|\s+$/g,"")},n=function(s){return Object.prototype.toString.call(s)==="[object Array]"};t.exports=function(s){if(!s)return{};for(var a={},l=r(s).split(` | ||
`),u=0;u<l.length;u++){var h=l[u],c=h.indexOf(":"),m=r(h.slice(0,c)).toLowerCase(),k=r(h.slice(c+1));typeof a[m]=="undefined"?a[m]=k:n(a[m])?a[m].push(k):a[m]=[a[m],k]}return a}}}),hr=K({"node_modules/xtend/immutable.js"(e,t){t.exports=n;var r=Object.prototype.hasOwnProperty;function n(){for(var s={},a=0;a<arguments.length;a++){var l=arguments[a];for(var u in l)r.call(l,u)&&(s[u]=l[u])}return s}}}),cr=K({"node_modules/xhr/index.js"(e,t){"use strict";var r=ur(),n=dr(),s=pr(),a=hr();t.exports=c,t.exports.default=c,c.XMLHttpRequest=r.XMLHttpRequest||ke,c.XDomainRequest="withCredentials"in new c.XMLHttpRequest?c.XMLHttpRequest:r.XDomainRequest,l(["get","put","post","patch","head","delete"],function(o){c[o==="delete"?"del":o]=function(v,y,O){return y=h(v,y,O),y.method=o.toUpperCase(),m(y)}});function l(o,v){for(var y=0;y<o.length;y++)v(o[y])}function u(o){for(var v in o)if(o.hasOwnProperty(v))return!1;return!0}function h(o,v,y){var O=o;return n(v)?(y=v,typeof o=="string"&&(O={uri:o})):O=a(v,{uri:o}),O.callback=y,O}function c(o,v,y){return v=h(o,v,y),m(v)}function m(o){if(typeof o.callback=="undefined")throw new Error("callback argument missing");var v=!1,y=function(F,he,Kt){v||(v=!0,o.callback(F,he,Kt))};function O(){d.readyState===4&&setTimeout(Be,0)}function Vt(){var f=void 0;if(d.response?f=d.response:f=d.responseText||k(d),He)try{f=JSON.parse(f)}catch{}return f}function Ce(f){return clearTimeout(Me),f instanceof Error||(f=new Error(""+(f||"Unknown XMLHttpRequest Error"))),f.statusCode=0,y(f,Ne)}function Be(){if(!pe){var f;clearTimeout(Me),o.useXDR&&d.status===void 0?f=200:f=d.status===1223?204:d.status;var F=Ne,he=null;return f!==0?(F={body:Vt(),statusCode:f,method:q,headers:{},url:Se,rawRequest:d},d.getAllResponseHeaders&&(F.headers=s(d.getAllResponseHeaders()))):he=new Error("Internal XMLHttpRequest Error"),y(he,F,F.body)}}var d=o.xhr||null;d||(o.cors||o.useXDR?d=new c.XDomainRequest:d=new c.XMLHttpRequest);var de,pe,Se=d.url=o.uri||o.url,q=d.method=o.method||"GET",Re=o.body||o.data,U=d.headers=o.headers||{},we=!!o.sync,He=!1,Me,Ne={body:void 0,headers:{},statusCode:0,method:q,url:Se,rawRequest:d};if("json"in o&&o.json!==!1&&(He=!0,U.accept||U.Accept||(U.Accept="application/json"),q!=="GET"&&q!=="HEAD"&&(U["content-type"]||U["Content-Type"]||(U["Content-Type"]="application/json"),Re=JSON.stringify(o.json===!0?Re:o.json))),d.onreadystatechange=O,d.onload=Be,d.onerror=Ce,d.onprogress=function(){},d.onabort=function(){pe=!0},d.ontimeout=Ce,d.open(q,Se,!we,o.username,o.password),we||(d.withCredentials=!!o.withCredentials),!we&&o.timeout>0&&(Me=setTimeout(function(){if(!pe){pe=!0,d.abort("timeout");var f=new Error("XMLHttpRequest timeout");f.code="ETIMEDOUT",Ce(f)}},o.timeout)),d.setRequestHeader)for(de in U)U.hasOwnProperty(de)&&d.setRequestHeader(de,U[de]);else if(o.headers&&!u(o.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in o&&(d.responseType=o.responseType),"beforeSend"in o&&typeof o.beforeSend=="function"&&o.beforeSend(d),d.send(Re||null),d}function k(o){try{if(o.responseType==="document")return o.responseXML;var v=o.responseXML&&o.responseXML.documentElement.nodeName==="parsererror";if(o.responseType===""&&!v)return o.responseXML}catch{}return null}function ke(){}}});function _e(e,t,...r){if(!e)throw new TypeError(tt(t,r))}function tt(e,t){let r=0;return e.replace(/%[os]/gu,()=>rt(t[r++]))}function rt(e){return typeof e!="object"||e===null?String(e):Object.prototype.toString.call(e)}var We;function fr(e){try{let t=e instanceof Error?e:new Error(rt(e));if(We){We(t);return}if(typeof dispatchEvent=="function"&&typeof ErrorEvent=="function")dispatchEvent(new ErrorEvent("error",{error:t,message:t.message}));else if(typeof process!="undefined"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)}catch{}}var M=typeof window!="undefined"?window:typeof self!="undefined"?self:typeof global!="undefined"?global:typeof globalThis!="undefined"?globalThis:void 0,$e,L=class{constructor(e,t){this.code=e,this.message=t}warn(...e){var t;try{if($e){$e({...this,args:e});return}let r=((t=new Error().stack)!==null&&t!==void 0?t:"").replace(/^(?:.+?\n){2}/gu,` | ||
`);console.warn(this.message,...e,r)}catch{}}},gr=new L("W01","Unable to initialize event under dispatching."),mr=new L("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),br=new L("W03","Assigning any truthy value to 'returnValue' property has no effect."),vr=new L("W04","Unable to preventDefault on non-cancelable events."),yr=new L("W05","Unable to preventDefault inside passive event listener invocation."),Er=new L("W06","An event listener wasn't added because it has been added already: %o, %o"),Ae=new L("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),Xe=new L("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o"),_n=new L("W09","Event attribute handler must be a function: %o"),_=class{static get NONE(){return qe}static get CAPTURING_PHASE(){return Ge}static get AT_TARGET(){return Ve}static get BUBBLING_PHASE(){return Ke}constructor(e,t){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let r=t!=null?t:{};Le.set(this,{type:String(e),bubbles:!!r.bubbles,cancelable:!!r.cancelable,composed:!!r.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 e=g(this).currentTarget;return e?[e]:[]}get NONE(){return qe}get CAPTURING_PHASE(){return Ge}get AT_TARGET(){return Ve}get BUBBLING_PHASE(){return Ke}get eventPhase(){return g(this).dispatchFlag?2:0}stopPropagation(){g(this).stopPropagationFlag=!0}get cancelBubble(){return g(this).stopPropagationFlag}set cancelBubble(e){e?g(this).stopPropagationFlag=!0:mr.warn()}stopImmediatePropagation(){let e=g(this);e.stopPropagationFlag=e.stopImmediatePropagationFlag=!0}get bubbles(){return g(this).bubbles}get cancelable(){return g(this).cancelable}get returnValue(){return!g(this).canceledFlag}set returnValue(e){e?br.warn():Ye(g(this))}preventDefault(){Ye(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(e,t=!1,r=!1){let n=g(this);if(n.dispatchFlag){gr.warn();return}Le.set(this,{...n,type:String(e),bubbles:!!t,cancelable:!!r,target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}},qe=0,Ge=1,Ve=2,Ke=3,Le=new WeakMap;function g(e,t="this"){let r=Le.get(e);return _e(r!=null,"'%s' must be an object that Event constructor created, but got another one: %o",t,e),r}function Ye(e){if(e.inPassiveListenerFlag){yr.warn();return}if(!e.cancelable){vr.warn();return}e.canceledFlag=!0}Object.defineProperty(_,"NONE",{enumerable:!0});Object.defineProperty(_,"CAPTURING_PHASE",{enumerable:!0});Object.defineProperty(_,"AT_TARGET",{enumerable:!0});Object.defineProperty(_,"BUBBLING_PHASE",{enumerable:!0});var Te=Object.getOwnPropertyNames(_.prototype);for(let e=0;e<Te.length;++e)Te[e]!=="constructor"&&Object.defineProperty(_.prototype,Te[e],{enumerable:!0});typeof M!="undefined"&&typeof M.Event!="undefined"&&Object.setPrototypeOf(_.prototype,M.Event.prototype);function xr(e){return M.DOMException?new M.DOMException(e,"InvalidStateError"):(W==null&&(W=class nt extends Error{constructor(r){super(r),Error.captureStackTrace&&Error.captureStackTrace(this,nt)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(W.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),Je(W),Je(W.prototype)),new W(e))}var W,Ze={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 Je(e){let t=Object.keys(Ze);for(let r=0;r<t.length;++r){let n=t[r],s=Ze[n];Object.defineProperty(e,n,{get(){return s},configurable:!0,enumerable:!0})}}var ge=class extends _{static wrap(e){return new(it(e))(e)}constructor(e){super(e.type,{bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed}),e.cancelBubble&&super.stopPropagation(),e.defaultPrevented&&super.preventDefault(),st.set(this,{original:e});let t=Object.keys(e);for(let r=0;r<t.length;++r){let n=t[r];n in this||Object.defineProperty(this,n,at(e,n))}}stopPropagation(){super.stopPropagation();let{original:e}=I(this);"stopPropagation"in e&&e.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(e){super.cancelBubble=e;let{original:t}=I(this);"cancelBubble"in t&&(t.cancelBubble=e)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:e}=I(this);"stopImmediatePropagation"in e&&e.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(e){super.returnValue=e;let{original:t}=I(this);"returnValue"in t&&(t.returnValue=e)}preventDefault(){super.preventDefault();let{original:e}=I(this);"preventDefault"in e&&e.preventDefault()}get timeStamp(){let{original:e}=I(this);return"timeStamp"in e?e.timeStamp:super.timeStamp}},st=new WeakMap;function I(e){let t=st.get(e);return _e(t!=null,"'this' is expected an Event object, but got",e),t}var fe=new WeakMap;fe.set(Object.prototype,ge);typeof M!="undefined"&&typeof M.Event!="undefined"&&fe.set(M.Event.prototype,ge);function it(e){let t=Object.getPrototypeOf(e);if(t==null)return ge;let r=fe.get(t);return r==null&&(r=kr(it(t),t),fe.set(t,r)),r}function kr(e,t){class r extends e{}let n=Object.keys(t);for(let s=0;s<n.length;++s)Object.defineProperty(r.prototype,n[s],at(t,n[s]));return r}function at(e,t){let r=Object.getOwnPropertyDescriptor(e,t);return{get(){let n=I(this).original,s=n[t];return typeof s=="function"?s.bind(n):s},set(n){let s=I(this).original;s[t]=n},configurable:r.configurable,enumerable:r.enumerable}}function Cr(e,t,r,n,s,a){return{callback:e,flags:(t?1:0)|(r?2:0)|(n?4:0),signal:s,signalListener:a}}function Sr(e){e.flags|=8}function ot(e){return(e.flags&1)===1}function lt(e){return(e.flags&2)===2}function ut(e){return(e.flags&4)===4}function Rr(e){return(e.flags&8)===8}function wr({callback:e},t,r){try{typeof e=="function"?e.call(t,r):typeof e.handleEvent=="function"&&e.handleEvent(r)}catch(n){fr(n)}}function dt({listeners:e},t,r){for(let n=0;n<e.length;++n)if(e[n].callback===t&&ot(e[n])===r)return n;return-1}function Mr(e,t,r,n,s,a){let l;a&&(l=pt.bind(null,e,t,r),a.addEventListener("abort",l));let u=Cr(t,r,n,s,a,l);return e.cow?(e.cow=!1,e.listeners=[...e.listeners,u]):e.listeners.push(u),u}function pt(e,t,r){let n=dt(e,t,r);return n!==-1?ht(e,n):!1}function ht(e,t,r=!1){let n=e.listeners[t];return Sr(n),n.signal&&n.signal.removeEventListener("abort",n.signalListener),e.cow&&!r?(e.cow=!1,e.listeners=e.listeners.filter((s,a)=>a!==t),!1):(e.listeners.splice(t,1),!0)}function Ar(){return Object.create(null)}function Tr(e,t){var r;return(r=e[t])!==null&&r!==void 0?r:e[t]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}var me=class{constructor(){ct.set(this,Ar())}addEventListener(e,t,r){let n=Pe(this),{callback:s,capture:a,once:l,passive:u,signal:h,type:c}=Pr(e,t,r);if(s==null||h!=null&&h.aborted)return;let m=Tr(n,c),k=dt(m,s,a);if(k!==-1){Lr(m.listeners[k],u,l,h);return}Mr(m,s,a,u,l,h)}removeEventListener(e,t,r){let n=Pe(this),{callback:s,capture:a,type:l}=Ur(e,t,r),u=n[l];s!=null&&u&&pt(u,s,a)}dispatchEvent(e){let t=Pe(this)[String(e.type)];if(t==null)return!0;let r=e instanceof _?e:ge.wrap(e),n=g(r,"event");if(n.dispatchFlag)throw xr("This event has been in dispatching.");if(n.dispatchFlag=!0,n.target=n.currentTarget=this,!n.stopPropagationFlag){let{cow:s,listeners:a}=t;t.cow=!0;for(let l=0;l<a.length;++l){let u=a[l];if(!Rr(u)&&(ut(u)&&ht(t,l,!s)&&(l-=1),n.inPassiveListenerFlag=lt(u),wr(u,this,r),n.inPassiveListenerFlag=!1,n.stopImmediatePropagationFlag))break}s||(t.cow=!1)}return n.target=null,n.currentTarget=null,n.stopImmediatePropagationFlag=!1,n.stopPropagationFlag=!1,n.dispatchFlag=!1,!n.canceledFlag}},ct=new WeakMap;function Pe(e,t="this"){let r=ct.get(e);return _e(r!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",t,e),r}function Pr(e,t,r){var n;return ft(t),typeof r=="object"&&r!==null?{type:String(e),callback:t!=null?t:void 0,capture:!!r.capture,passive:!!r.passive,once:!!r.once,signal:(n=r.signal)!==null&&n!==void 0?n:void 0}:{type:String(e),callback:t!=null?t:void 0,capture:!!r,passive:!1,once:!1,signal:void 0}}function Ur(e,t,r){return ft(t),typeof r=="object"&&r!==null?{type:String(e),callback:t!=null?t:void 0,capture:!!r.capture}:{type:String(e),callback:t!=null?t:void 0,capture:!!r}}function ft(e){if(!(typeof e=="function"||typeof e=="object"&&e!==null&&typeof e.handleEvent=="function")){if(e==null||typeof e=="object"){Xe.warn(e);return}throw new TypeError(tt(Xe.message,[e]))}}function Lr(e,t,r,n){Er.warn(ot(e)?"capture":"bubble",e.callback),lt(e)!==t&&Ae.warn("passive"),ut(e)!==r&&Ae.warn("once"),e.signal!==n&&Ae.warn("signal")}var Ue=Object.getOwnPropertyNames(me.prototype);for(let e=0;e<Ue.length;++e)Ue[e]!=="constructor"&&Object.defineProperty(me.prototype,Ue[e],{enumerable:!0});typeof M!="undefined"&&typeof M.EventTarget!="undefined"&&Object.setPrototypeOf(me.prototype,M.EventTarget.prototype);var _r=lr(cr()),ze=30720,Y=512e3,Z=256,G=(e,{minChunkSize:t=Z,maxChunkSize:r=Y}={})=>e==null||typeof e=="number"&&e>=256&&e%256===0&&e>=t&&e<=r,V=(e,{minChunkSize:t=Z,maxChunkSize:r=Y}={})=>new TypeError(`chunkSize ${e} must be a positive number in multiples of 256, between ${t} and ${r}`),zr=class{constructor(e,t={}){this.readableStream=e;var r,n,s;if(!G(t.defaultChunkSize,t))throw V(t.defaultChunkSize,t);this.defaultChunkSize=(r=t.defaultChunkSize)!=null?r:ze,this.minChunkSize=(n=t.minChunkSize)!=null?n:Z,this.maxChunkSize=(s=t.maxChunkSize)!=null?s:Y}get chunkSize(){var e;return(e=this._chunkSize)!=null?e:this.defaultChunkSize}set chunkSize(e){if(!G(e,this))throw V(e,this);this._chunkSize=e}get chunkByteSize(){return this.chunkSize*1024}get error(){return this._error}async*[Symbol.asyncIterator](){let e,t=this.readableStream.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r){if(e){let a=e;e=void 0,yield a}break}let s=n instanceof Uint8Array?new Blob([n],{type:"application/octet-stream"}):n;for(e=e?new Blob([e,s]):s;e;)if(e.size===this.chunkByteSize){let a=e;e=void 0,yield a;break}else{if(e.size<this.chunkByteSize)break;{let a=e.slice(0,this.chunkByteSize);e=e.slice(this.chunkByteSize),yield a}}}}catch(r){this._error=r}finally{if(e){let r=e;e=void 0,yield r}t.releaseLock();return}}},Or=class{constructor(e,t={}){this.file=e;var r,n,s;if(!G(t.defaultChunkSize,t))throw V(t.defaultChunkSize,t);this.defaultChunkSize=(r=t.defaultChunkSize)!=null?r:ze,this.minChunkSize=(n=t.minChunkSize)!=null?n:Z,this.maxChunkSize=(s=t.maxChunkSize)!=null?s:Y}get chunkSize(){var e;return(e=this._chunkSize)!=null?e:this.defaultChunkSize}set chunkSize(e){if(!G(e,this))throw V(e,this);this._chunkSize=e}get chunkByteSize(){return this.chunkSize*1024}get error(){return this._error}async*[Symbol.asyncIterator](){let e=new FileReader,t=0,r=()=>new Promise(n=>{if(t>=this.file.size){n(void 0);return}let s=Math.min(this.chunkByteSize,this.file.size-t);e.onload=()=>{e.result!==null?n(new Blob([e.result],{type:"application/octet-stream"})):n(void 0)},e.readAsArrayBuffer(this.file.slice(t,t+s))});try{for(;;){let n=await r();if(n)t+=n.size,yield n;else break}}catch(n){this._error=n}}},Ir=[200,201,202,204,308],gt=[408,502,503,504],Dr=[308],mt=(e,t)=>!!e&&Ir.includes(e.statusCode),Fr=(e,{retryCodes:t=gt})=>!e||t.includes(e.statusCode),Br=(e,t)=>t.attemptCount>=t.attempts||!(mt(e)||Fr(e,t)),Hr=(e,t)=>{var r;if(!e||!Dr.includes(e.statusCode)||!((r=e.headers)!=null&&r.range))return!1;let n=e.headers.range.match(/bytes=(\d+)-(\d+)/);return n?parseInt(n[2],10)!==t.currentChunkEndByte:!1},Oe=class{static createUpload(e){return new Oe(e)}constructor(e){if(this.eventTarget=new me,this.endpoint=e.endpoint,this.file=e.file,this.headers=e.headers||{},this.method=e.method||"PUT",this.attempts=e.attempts||5,this.delayBeforeAttempt=e.delayBeforeAttempt||1,this.retryCodes=e.retryCodes||gt,this.dynamicChunkSize=e.dynamicChunkSize||!1,this.maxFileBytes=(e.maxFileSize||0)*1024,this.chunkCount=0,this.attemptCount=0,this._offline=typeof window!="undefined"&&!window.navigator.onLine,this._paused=!1,this.success=!1,this.nextChunkRangeStart=0,e.useLargeFileWorkaround){let t=r=>{this.chunkedIterable.error&&(console.warn(`Unable to read file of size ${this.file.size} bytes via a ReadableStream. Falling back to in-memory FileReader!`),r.stopImmediatePropagation(),this.chunkedIterable=new Or(this.file,{...e,defaultChunkSize:e.chunkSize}),this.chunkedIterator=this.chunkedIterable[Symbol.asyncIterator](),this.getEndpoint().then(()=>{this.sendChunks()}),this.off("error",t))};this.on("error",t)}this.chunkedIterable=new zr(this.file.stream(),{...e,defaultChunkSize:e.chunkSize}),this.chunkedIterator=this.chunkedIterable[Symbol.asyncIterator](),this.totalChunks=Math.ceil(this.file.size/this.chunkByteSize),this.validateOptions(),this.getEndpoint().then(()=>this.sendChunks()),typeof window!="undefined"&&(window.addEventListener("online",()=>{this.offline&&(this._offline=!1,this.dispatch("online"),this.sendChunks())}),window.addEventListener("offline",()=>{this.offline||(this._offline=!0,this.dispatch("offline"))}))}get maxChunkSize(){var e,t;return(t=(e=this.chunkedIterable)==null?void 0:e.maxChunkSize)!=null?t:Y}get minChunkSize(){var e,t;return(t=(e=this.chunkedIterable)==null?void 0:e.minChunkSize)!=null?t:Z}get chunkSize(){var e,t;return(t=(e=this.chunkedIterable)==null?void 0:e.chunkSize)!=null?t:ze}set chunkSize(e){this.chunkedIterable.chunkSize=e}get chunkByteSize(){return this.chunkedIterable.chunkByteSize}get totalChunkSize(){return Math.ceil(this.file.size/this.chunkByteSize)}on(e,t){this.eventTarget.addEventListener(e,t)}once(e,t){this.eventTarget.addEventListener(e,t,{once:!0})}off(e,t){this.eventTarget.removeEventListener(e,t)}get offline(){return this._offline}get paused(){return this._paused}abort(){var e;this.pause(),(e=this.currentXhr)==null||e.abort()}pause(){this._paused=!0}resume(){this._paused&&(this._paused=!1,this.sendChunks())}get successfulPercentage(){return this.nextChunkRangeStart/this.file.size}dispatch(e,t){let r=new CustomEvent(e,{detail:t});this.eventTarget.dispatchEvent(r)}validateOptions(){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!="function"&&typeof this.headers!="object")throw new TypeError("headers must be null, an object, or a function that returns an object or a promise");if(!G(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize}))throw V(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize});if(this.maxChunkSize&&(typeof this.maxChunkSize!="number"||this.maxChunkSize<256||this.maxChunkSize%256!==0||this.maxChunkSize<this.chunkSize||this.maxChunkSize<this.minChunkSize))throw new TypeError(`maxChunkSize must be a positive number in multiples of 256, and larger than or equal to both ${this.minChunkSize} and ${this.chunkSize}`);if(this.minChunkSize&&(typeof this.minChunkSize!="number"||this.minChunkSize<256||this.minChunkSize%256!==0||this.minChunkSize>this.chunkSize||this.minChunkSize>this.maxChunkSize))throw new TypeError(`minChunkSize must be a positive number in multiples of 256, and smaller than ${this.chunkSize} and ${this.maxChunkSize}`);if(this.maxFileBytes>0&&this.maxFileBytes<this.file.size)throw new Error(`file size exceeds maximum (${this.file.size} > ${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")}getEndpoint(){return typeof this.endpoint=="string"?(this.endpointValue=this.endpoint,Promise.resolve(this.endpoint)):this.endpoint(this.file).then(e=>(this.endpointValue=e,this.endpointValue))}xhrPromise(e){let t=r=>{r.upload.onprogress=n=>{var s;let a=this.totalChunks-this.chunkCount,l=(this.file.size-this.nextChunkRangeStart)/this.file.size/a,h=n.loaded/((s=n.total)!=null?s:this.chunkByteSize)*l;this.dispatch("progress",Math.min((this.successfulPercentage+h)*100,100))}};return new Promise((r,n)=>{this.currentXhr=(0,_r.default)({...e,beforeSend:t},(s,a)=>(this.currentXhr=void 0,s?n(s):r(a)))})}async sendChunk(e){let t=this.nextChunkRangeStart,r=t+e.size-1,s={...await(typeof this.headers=="function"?this.headers():this.headers),"Content-Type":this.file.type,"Content-Range":`bytes ${t}-${r}/${this.file.size}`};return this.dispatch("attempt",{chunkNumber:this.chunkCount,totalChunks:this.totalChunks,chunkSize:this.chunkSize}),this.xhrPromise({headers:s,url:this.endpointValue,method:this.method,body:e})}async sendChunkWithRetries(e){let t=async(l,u)=>{var h;let m=(new Date().getTime()-this.lastChunkStart.getTime())/1e3;if(this.dispatch("chunkSuccess",{chunk:this.chunkCount,chunkSize:this.chunkSize,attempts:this.attemptCount,timeInterval:m,response:l}),this.attemptCount=0,this.chunkCount=((h=this.chunkCount)!=null?h:0)+1,this.nextChunkRangeStart=this.nextChunkRangeStart+this.chunkByteSize,this.dynamicChunkSize){let k=this.chunkSize;m<10?k=Math.min(this.chunkSize*2,this.maxChunkSize):m>30&&(k=Math.max(this.chunkSize/2,this.minChunkSize)),this.chunkSize=Math.ceil(k/256)*256;let ke=(this.file.size-this.nextChunkRangeStart)/this.chunkByteSize;this.totalChunks=Math.ceil(this.chunkCount+ke)}return!0},r=async(l,u)=>(this.dispatch("progress",Math.min(this.successfulPercentage*100,100)),this.dispatch("error",{message:`Server responded with ${l.statusCode}. Stopping upload.`,chunk:this.chunkCount,attempts:this.attemptCount,response:l}),!1),n=async(l,u)=>(this.dispatch("attemptFailure",{message:`An error occured uploading chunk ${this.chunkCount}. ${this.attempts-this.attemptCount} retries left.`,chunkNumber:this.chunkCount,attemptsLeft:this.attempts-this.attemptCount,response:l}),new Promise(h=>{setTimeout(async()=>{if(this._paused||this.offline){this.pendingChunk=e,h(!1);return}let c=await this.sendChunkWithRetries(e);h(c)},this.delayBeforeAttempt*1e3)})),s;try{this.attemptCount=this.attemptCount+1,this.lastChunkStart=new Date,s=await this.sendChunk(e)}catch(l){typeof(l==null?void 0:l.statusCode)=="number"&&(s=l)}let a={retryCodes:this.retryCodes,attemptCount:this.attemptCount,attempts:this.attempts,currentChunkEndByte:this.nextChunkRangeStart+e.size-1};return Hr(s,a)?n(s,e):mt(s,a)?t(s,e):Br(s,a)?r(s,e):n(s,e)}async sendChunks(){if(this.pendingChunk&&!(this._paused||this.offline)){let e=this.pendingChunk;this.pendingChunk=void 0;let t=await this.sendChunkWithRetries(e);this.success&&t&&this.dispatch("success")}for(;!(this.success||this._paused||this.offline);){let{value:e,done:t}=await this.chunkedIterator.next(),r=!e&&t;if(e&&(r=await this.sendChunkWithRetries(e)),this.chunkedIterable.error){r=!1,this.dispatch("error",{message:`Unable to read file of size ${this.file.size} bytes. Try loading from another browser.`});return}if(this.success=!!t,this.success&&r&&this.dispatch("success"),!r)return}}};var Nr=Object.defineProperty,jr=(e,t)=>{for(var r in t)Nr(e,r,{get:t[r],enumerable:!0})},yt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},i=(e,t,r)=>(yt(e,t,"read from private field"),r?r.call(e):t.get(e)),E=(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)},x=(e,t,r,n)=>(yt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),De={};jr(De,{ProgressTypes:()=>$});var $={BAR:"bar",RADIAL:"radial",PERCENTAGE:"percentage"},Ee=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment=="undefined"){class e extends Ee{}globalThis.DocumentFragment=e}var Fe=class extends Ee{},Wr=class extends Ee{},$r={get(e){},define(e,t,r){},upgrade(e){},whenDefined(e){return Promise.resolve(Fe)}},ve,Xr=class{constructor(e,t={}){E(this,ve,void 0),x(this,ve,t==null?void 0:t.detail)}get detail(){return i(this,ve)}initCustomEvent(){}};ve=new WeakMap;function qr(e,t){return new Fe}var Et={document:{createElement:qr},DocumentFragment,customElements:$r,CustomEvent:Xr,EventTarget:Ee,HTMLElement:Fe,HTMLVideoElement:Wr},xt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",p=xt?Et:globalThis,P=xt?Et.document:globalThis.document,kt=(e,t)=>e?e.closest(t)||kt(e.getRootNode().host,t):null,N=e=>{let t=e.getAttribute("mux-uploader");return t?document.getElementById(t):kt(e,"mux-uploader")},Ct=P.createElement("template");Ct.innerHTML=` | ||
`);console.warn(this.message,...e,r)}catch{}}},gr=new L("W01","Unable to initialize event under dispatching."),mr=new L("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),br=new L("W03","Assigning any truthy value to 'returnValue' property has no effect."),vr=new L("W04","Unable to preventDefault on non-cancelable events."),yr=new L("W05","Unable to preventDefault inside passive event listener invocation."),Er=new L("W06","An event listener wasn't added because it has been added already: %o, %o"),Ae=new L("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),Xe=new L("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o"),_n=new L("W09","Event attribute handler must be a function: %o"),_=class{static get NONE(){return qe}static get CAPTURING_PHASE(){return Ge}static get AT_TARGET(){return Ve}static get BUBBLING_PHASE(){return Ke}constructor(e,t){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let r=t!=null?t:{};Le.set(this,{type:String(e),bubbles:!!r.bubbles,cancelable:!!r.cancelable,composed:!!r.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 e=g(this).currentTarget;return e?[e]:[]}get NONE(){return qe}get CAPTURING_PHASE(){return Ge}get AT_TARGET(){return Ve}get BUBBLING_PHASE(){return Ke}get eventPhase(){return g(this).dispatchFlag?2:0}stopPropagation(){g(this).stopPropagationFlag=!0}get cancelBubble(){return g(this).stopPropagationFlag}set cancelBubble(e){e?g(this).stopPropagationFlag=!0:mr.warn()}stopImmediatePropagation(){let e=g(this);e.stopPropagationFlag=e.stopImmediatePropagationFlag=!0}get bubbles(){return g(this).bubbles}get cancelable(){return g(this).cancelable}get returnValue(){return!g(this).canceledFlag}set returnValue(e){e?br.warn():Ye(g(this))}preventDefault(){Ye(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(e,t=!1,r=!1){let n=g(this);if(n.dispatchFlag){gr.warn();return}Le.set(this,{...n,type:String(e),bubbles:!!t,cancelable:!!r,target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}},qe=0,Ge=1,Ve=2,Ke=3,Le=new WeakMap;function g(e,t="this"){let r=Le.get(e);return _e(r!=null,"'%s' must be an object that Event constructor created, but got another one: %o",t,e),r}function Ye(e){if(e.inPassiveListenerFlag){yr.warn();return}if(!e.cancelable){vr.warn();return}e.canceledFlag=!0}Object.defineProperty(_,"NONE",{enumerable:!0});Object.defineProperty(_,"CAPTURING_PHASE",{enumerable:!0});Object.defineProperty(_,"AT_TARGET",{enumerable:!0});Object.defineProperty(_,"BUBBLING_PHASE",{enumerable:!0});var Te=Object.getOwnPropertyNames(_.prototype);for(let e=0;e<Te.length;++e)Te[e]!=="constructor"&&Object.defineProperty(_.prototype,Te[e],{enumerable:!0});typeof M!="undefined"&&typeof M.Event!="undefined"&&Object.setPrototypeOf(_.prototype,M.Event.prototype);function xr(e){return M.DOMException?new M.DOMException(e,"InvalidStateError"):(W==null&&(W=class nt extends Error{constructor(r){super(r),Error.captureStackTrace&&Error.captureStackTrace(this,nt)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(W.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),Je(W),Je(W.prototype)),new W(e))}var W,Ze={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 Je(e){let t=Object.keys(Ze);for(let r=0;r<t.length;++r){let n=t[r],s=Ze[n];Object.defineProperty(e,n,{get(){return s},configurable:!0,enumerable:!0})}}var ge=class extends _{static wrap(e){return new(it(e))(e)}constructor(e){super(e.type,{bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed}),e.cancelBubble&&super.stopPropagation(),e.defaultPrevented&&super.preventDefault(),st.set(this,{original:e});let t=Object.keys(e);for(let r=0;r<t.length;++r){let n=t[r];n in this||Object.defineProperty(this,n,at(e,n))}}stopPropagation(){super.stopPropagation();let{original:e}=I(this);"stopPropagation"in e&&e.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(e){super.cancelBubble=e;let{original:t}=I(this);"cancelBubble"in t&&(t.cancelBubble=e)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:e}=I(this);"stopImmediatePropagation"in e&&e.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(e){super.returnValue=e;let{original:t}=I(this);"returnValue"in t&&(t.returnValue=e)}preventDefault(){super.preventDefault();let{original:e}=I(this);"preventDefault"in e&&e.preventDefault()}get timeStamp(){let{original:e}=I(this);return"timeStamp"in e?e.timeStamp:super.timeStamp}},st=new WeakMap;function I(e){let t=st.get(e);return _e(t!=null,"'this' is expected an Event object, but got",e),t}var fe=new WeakMap;fe.set(Object.prototype,ge);typeof M!="undefined"&&typeof M.Event!="undefined"&&fe.set(M.Event.prototype,ge);function it(e){let t=Object.getPrototypeOf(e);if(t==null)return ge;let r=fe.get(t);return r==null&&(r=kr(it(t),t),fe.set(t,r)),r}function kr(e,t){class r extends e{}let n=Object.keys(t);for(let s=0;s<n.length;++s)Object.defineProperty(r.prototype,n[s],at(t,n[s]));return r}function at(e,t){let r=Object.getOwnPropertyDescriptor(e,t);return{get(){let n=I(this).original,s=n[t];return typeof s=="function"?s.bind(n):s},set(n){let s=I(this).original;s[t]=n},configurable:r.configurable,enumerable:r.enumerable}}function Cr(e,t,r,n,s,a){return{callback:e,flags:(t?1:0)|(r?2:0)|(n?4:0),signal:s,signalListener:a}}function Sr(e){e.flags|=8}function ot(e){return(e.flags&1)===1}function lt(e){return(e.flags&2)===2}function ut(e){return(e.flags&4)===4}function Rr(e){return(e.flags&8)===8}function wr({callback:e},t,r){try{typeof e=="function"?e.call(t,r):typeof e.handleEvent=="function"&&e.handleEvent(r)}catch(n){fr(n)}}function dt({listeners:e},t,r){for(let n=0;n<e.length;++n)if(e[n].callback===t&&ot(e[n])===r)return n;return-1}function Mr(e,t,r,n,s,a){let l;a&&(l=pt.bind(null,e,t,r),a.addEventListener("abort",l));let u=Cr(t,r,n,s,a,l);return e.cow?(e.cow=!1,e.listeners=[...e.listeners,u]):e.listeners.push(u),u}function pt(e,t,r){let n=dt(e,t,r);return n!==-1?ht(e,n):!1}function ht(e,t,r=!1){let n=e.listeners[t];return Sr(n),n.signal&&n.signal.removeEventListener("abort",n.signalListener),e.cow&&!r?(e.cow=!1,e.listeners=e.listeners.filter((s,a)=>a!==t),!1):(e.listeners.splice(t,1),!0)}function Ar(){return Object.create(null)}function Tr(e,t){var r;return(r=e[t])!==null&&r!==void 0?r:e[t]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}var me=class{constructor(){ct.set(this,Ar())}addEventListener(e,t,r){let n=Pe(this),{callback:s,capture:a,once:l,passive:u,signal:h,type:c}=Pr(e,t,r);if(s==null||h!=null&&h.aborted)return;let m=Tr(n,c),k=dt(m,s,a);if(k!==-1){Lr(m.listeners[k],u,l,h);return}Mr(m,s,a,u,l,h)}removeEventListener(e,t,r){let n=Pe(this),{callback:s,capture:a,type:l}=Ur(e,t,r),u=n[l];s!=null&&u&&pt(u,s,a)}dispatchEvent(e){let t=Pe(this)[String(e.type)];if(t==null)return!0;let r=e instanceof _?e:ge.wrap(e),n=g(r,"event");if(n.dispatchFlag)throw xr("This event has been in dispatching.");if(n.dispatchFlag=!0,n.target=n.currentTarget=this,!n.stopPropagationFlag){let{cow:s,listeners:a}=t;t.cow=!0;for(let l=0;l<a.length;++l){let u=a[l];if(!Rr(u)&&(ut(u)&&ht(t,l,!s)&&(l-=1),n.inPassiveListenerFlag=lt(u),wr(u,this,r),n.inPassiveListenerFlag=!1,n.stopImmediatePropagationFlag))break}s||(t.cow=!1)}return n.target=null,n.currentTarget=null,n.stopImmediatePropagationFlag=!1,n.stopPropagationFlag=!1,n.dispatchFlag=!1,!n.canceledFlag}},ct=new WeakMap;function Pe(e,t="this"){let r=ct.get(e);return _e(r!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",t,e),r}function Pr(e,t,r){var n;return ft(t),typeof r=="object"&&r!==null?{type:String(e),callback:t!=null?t:void 0,capture:!!r.capture,passive:!!r.passive,once:!!r.once,signal:(n=r.signal)!==null&&n!==void 0?n:void 0}:{type:String(e),callback:t!=null?t:void 0,capture:!!r,passive:!1,once:!1,signal:void 0}}function Ur(e,t,r){return ft(t),typeof r=="object"&&r!==null?{type:String(e),callback:t!=null?t:void 0,capture:!!r.capture}:{type:String(e),callback:t!=null?t:void 0,capture:!!r}}function ft(e){if(!(typeof e=="function"||typeof e=="object"&&e!==null&&typeof e.handleEvent=="function")){if(e==null||typeof e=="object"){Xe.warn(e);return}throw new TypeError(tt(Xe.message,[e]))}}function Lr(e,t,r,n){Er.warn(ot(e)?"capture":"bubble",e.callback),lt(e)!==t&&Ae.warn("passive"),ut(e)!==r&&Ae.warn("once"),e.signal!==n&&Ae.warn("signal")}var Ue=Object.getOwnPropertyNames(me.prototype);for(let e=0;e<Ue.length;++e)Ue[e]!=="constructor"&&Object.defineProperty(me.prototype,Ue[e],{enumerable:!0});typeof M!="undefined"&&typeof M.EventTarget!="undefined"&&Object.setPrototypeOf(me.prototype,M.EventTarget.prototype);var _r=lr(cr()),ze=30720,Y=512e3,Z=256,G=(e,{minChunkSize:t=Z,maxChunkSize:r=Y}={})=>e==null||typeof e=="number"&&e>=256&&e%256===0&&e>=t&&e<=r,V=(e,{minChunkSize:t=Z,maxChunkSize:r=Y}={})=>new TypeError(`chunkSize ${e} must be a positive number in multiples of 256, between ${t} and ${r}`),zr=class{constructor(e,t={}){this.readableStream=e;var r,n,s;if(!G(t.defaultChunkSize,t))throw V(t.defaultChunkSize,t);this.defaultChunkSize=(r=t.defaultChunkSize)!=null?r:ze,this.minChunkSize=(n=t.minChunkSize)!=null?n:Z,this.maxChunkSize=(s=t.maxChunkSize)!=null?s:Y}get chunkSize(){var e;return(e=this._chunkSize)!=null?e:this.defaultChunkSize}set chunkSize(e){if(!G(e,this))throw V(e,this);this._chunkSize=e}get chunkByteSize(){return this.chunkSize*1024}get error(){return this._error}async*[Symbol.asyncIterator](){let e,t=this.readableStream.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r){if(e){let a=e;e=void 0,yield a}break}let s=n instanceof Uint8Array?new Blob([n],{type:"application/octet-stream"}):n;for(e=e?new Blob([e,s]):s;e;)if(e.size===this.chunkByteSize){let a=e;e=void 0,yield a;break}else{if(e.size<this.chunkByteSize)break;{let a=e.slice(0,this.chunkByteSize);e=e.slice(this.chunkByteSize),yield a}}}}catch(r){this._error=r}finally{if(e){let r=e;e=void 0,yield r}t.releaseLock();return}}},Or=class{constructor(e,t={}){this.file=e;var r,n,s;if(!G(t.defaultChunkSize,t))throw V(t.defaultChunkSize,t);this.defaultChunkSize=(r=t.defaultChunkSize)!=null?r:ze,this.minChunkSize=(n=t.minChunkSize)!=null?n:Z,this.maxChunkSize=(s=t.maxChunkSize)!=null?s:Y}get chunkSize(){var e;return(e=this._chunkSize)!=null?e:this.defaultChunkSize}set chunkSize(e){if(!G(e,this))throw V(e,this);this._chunkSize=e}get chunkByteSize(){return this.chunkSize*1024}get error(){return this._error}async*[Symbol.asyncIterator](){let e=new FileReader,t=0,r=()=>new Promise(n=>{if(t>=this.file.size){n(void 0);return}let s=Math.min(this.chunkByteSize,this.file.size-t);e.onload=()=>{e.result!==null?n(new Blob([e.result],{type:"application/octet-stream"})):n(void 0)},e.readAsArrayBuffer(this.file.slice(t,t+s))});try{for(;;){let n=await r();if(n)t+=n.size,yield n;else break}}catch(n){this._error=n}}},Ir=[200,201,202,204,308],gt=[408,502,503,504],Dr=[308],mt=(e,t)=>!!e&&Ir.includes(e.statusCode),Fr=(e,{retryCodes:t=gt})=>!e||t.includes(e.statusCode),Br=(e,t)=>t.attemptCount>=t.attempts||!(mt(e)||Fr(e,t)),Hr=(e,t)=>{var r;if(!e||!Dr.includes(e.statusCode)||!((r=e.headers)!=null&&r.range))return!1;let n=e.headers.range.match(/bytes=(\d+)-(\d+)/);return n?parseInt(n[2],10)!==t.currentChunkEndByte:!1},Oe=class{static createUpload(e){return new Oe(e)}constructor(e){if(this.eventTarget=new me,this.endpoint=e.endpoint,this.file=e.file,this.headers=e.headers||{},this.method=e.method||"PUT",this.attempts=e.attempts||5,this.delayBeforeAttempt=e.delayBeforeAttempt||1,this.retryCodes=e.retryCodes||gt,this.dynamicChunkSize=e.dynamicChunkSize||!1,this.maxFileBytes=(e.maxFileSize||0)*1024,this.chunkCount=0,this.attemptCount=0,this._offline=typeof window!="undefined"&&!window.navigator.onLine,this._paused=!1,this.success=!1,this.nextChunkRangeStart=0,e.useLargeFileWorkaround){let t=r=>{this.chunkedIterable.error&&(console.warn(`Unable to read file of size ${this.file.size} bytes via a ReadableStream. Falling back to in-memory FileReader!`),r.stopImmediatePropagation(),this.chunkedIterable=new Or(this.file,{...e,defaultChunkSize:e.chunkSize}),this.chunkedIterator=this.chunkedIterable[Symbol.asyncIterator](),this.getEndpoint().then(()=>{this.sendChunks()}),this.off("error",t))};this.on("error",t)}this.chunkedIterable=new zr(this.file.stream(),{...e,defaultChunkSize:e.chunkSize}),this.chunkedIterator=this.chunkedIterable[Symbol.asyncIterator](),this.totalChunks=Math.ceil(this.file.size/this.chunkByteSize),this.validateOptions(),this.getEndpoint().then(()=>this.sendChunks()),typeof window!="undefined"&&(window.addEventListener("online",()=>{this.offline&&(this._offline=!1,this.dispatch("online"),this.sendChunks())}),window.addEventListener("offline",()=>{this.offline||(this._offline=!0,this.dispatch("offline"))}))}get maxChunkSize(){var e,t;return(t=(e=this.chunkedIterable)==null?void 0:e.maxChunkSize)!=null?t:Y}get minChunkSize(){var e,t;return(t=(e=this.chunkedIterable)==null?void 0:e.minChunkSize)!=null?t:Z}get chunkSize(){var e,t;return(t=(e=this.chunkedIterable)==null?void 0:e.chunkSize)!=null?t:ze}set chunkSize(e){this.chunkedIterable.chunkSize=e}get chunkByteSize(){return this.chunkedIterable.chunkByteSize}get totalChunkSize(){return Math.ceil(this.file.size/this.chunkByteSize)}on(e,t){this.eventTarget.addEventListener(e,t)}once(e,t){this.eventTarget.addEventListener(e,t,{once:!0})}off(e,t){this.eventTarget.removeEventListener(e,t)}get offline(){return this._offline}get paused(){return this._paused}abort(){var e;this.pause(),(e=this.currentXhr)==null||e.abort()}pause(){this._paused=!0}resume(){this._paused&&(this._paused=!1,this.sendChunks())}get successfulPercentage(){return this.nextChunkRangeStart/this.file.size}dispatch(e,t){let r=new CustomEvent(e,{detail:t});this.eventTarget.dispatchEvent(r)}validateOptions(){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!="function"&&typeof this.headers!="object")throw new TypeError("headers must be null, an object, or a function that returns an object or a promise");if(!G(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize}))throw V(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize});if(this.maxChunkSize&&(typeof this.maxChunkSize!="number"||this.maxChunkSize<256||this.maxChunkSize%256!==0||this.maxChunkSize<this.chunkSize||this.maxChunkSize<this.minChunkSize))throw new TypeError(`maxChunkSize must be a positive number in multiples of 256, and larger than or equal to both ${this.minChunkSize} and ${this.chunkSize}`);if(this.minChunkSize&&(typeof this.minChunkSize!="number"||this.minChunkSize<256||this.minChunkSize%256!==0||this.minChunkSize>this.chunkSize||this.minChunkSize>this.maxChunkSize))throw new TypeError(`minChunkSize must be a positive number in multiples of 256, and smaller than ${this.chunkSize} and ${this.maxChunkSize}`);if(this.maxFileBytes>0&&this.maxFileBytes<this.file.size)throw new Error(`file size exceeds maximum (${this.file.size} > ${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")}getEndpoint(){return typeof this.endpoint=="string"?(this.endpointValue=this.endpoint,Promise.resolve(this.endpoint)):this.endpoint(this.file).then(e=>(this.endpointValue=e,this.endpointValue))}xhrPromise(e){let t=r=>{r.upload.onprogress=n=>{var s;let a=this.totalChunks-this.chunkCount,l=(this.file.size-this.nextChunkRangeStart)/this.file.size/a,h=n.loaded/((s=n.total)!=null?s:this.chunkByteSize)*l;this.dispatch("progress",Math.min((this.successfulPercentage+h)*100,100))}};return new Promise((r,n)=>{this.currentXhr=(0,_r.default)({...e,beforeSend:t},(s,a)=>(this.currentXhr=void 0,s?n(s):r(a)))})}async sendChunk(e){let t=this.nextChunkRangeStart,r=t+e.size-1,s={...await(typeof this.headers=="function"?this.headers():this.headers),"Content-Type":this.file.type,"Content-Range":`bytes ${t}-${r}/${this.file.size}`};return this.dispatch("attempt",{chunkNumber:this.chunkCount,totalChunks:this.totalChunks,chunkSize:this.chunkSize}),this.xhrPromise({headers:s,url:this.endpointValue,method:this.method,body:e})}async sendChunkWithRetries(e){let t=async(l,u)=>{var h;let m=(new Date().getTime()-this.lastChunkStart.getTime())/1e3;if(this.dispatch("chunkSuccess",{chunk:this.chunkCount,chunkSize:this.chunkSize,attempts:this.attemptCount,timeInterval:m,response:l}),this.attemptCount=0,this.chunkCount=((h=this.chunkCount)!=null?h:0)+1,this.nextChunkRangeStart=this.nextChunkRangeStart+this.chunkByteSize,this.dynamicChunkSize){let k=this.chunkSize;m<10?k=Math.min(this.chunkSize*2,this.maxChunkSize):m>30&&(k=Math.max(this.chunkSize/2,this.minChunkSize)),this.chunkSize=Math.ceil(k/256)*256;let ke=(this.file.size-this.nextChunkRangeStart)/this.chunkByteSize;this.totalChunks=Math.ceil(this.chunkCount+ke)}return!0},r=async(l,u)=>(this.dispatch("progress",Math.min(this.successfulPercentage*100,100)),this.dispatch("error",{message:`Server responded with ${l.statusCode}. Stopping upload.`,chunk:this.chunkCount,attempts:this.attemptCount,response:l}),!1),n=async(l,u)=>(this.dispatch("attemptFailure",{message:`An error occured uploading chunk ${this.chunkCount}. ${this.attempts-this.attemptCount} retries left.`,chunkNumber:this.chunkCount,attemptsLeft:this.attempts-this.attemptCount,response:l}),new Promise(h=>{setTimeout(async()=>{if(this._paused||this.offline){this.pendingChunk=e,h(!1);return}let c=await this.sendChunkWithRetries(e);h(c)},this.delayBeforeAttempt*1e3)})),s;try{this.attemptCount=this.attemptCount+1,this.lastChunkStart=new Date,s=await this.sendChunk(e)}catch(l){typeof(l==null?void 0:l.statusCode)=="number"&&(s=l)}let a={retryCodes:this.retryCodes,attemptCount:this.attemptCount,attempts:this.attempts,currentChunkEndByte:this.nextChunkRangeStart+e.size-1};return Hr(s,a)?n(s,e):mt(s,a)?t(s,e):Br(s,a)?r(s,e):n(s,e)}async sendChunks(){if(this.pendingChunk&&!(this._paused||this.offline)){let e=this.pendingChunk;this.pendingChunk=void 0;let t=await this.sendChunkWithRetries(e);this.success&&t&&this.dispatch("success")}for(;!(this.success||this._paused||this.offline);){let{value:e,done:t}=await this.chunkedIterator.next(),r=!e&&t;if(e&&(r=await this.sendChunkWithRetries(e)),this.chunkedIterable.error){r=!1,this.dispatch("error",{message:`Unable to read file of size ${this.file.size} bytes. Try loading from another browser.`});return}if(this.success=!!t,this.success&&r&&this.dispatch("success"),!r)return}}};var Nr=Object.defineProperty,jr=(e,t)=>{for(var r in t)Nr(e,r,{get:t[r],enumerable:!0})},yt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},i=(e,t,r)=>(yt(e,t,"read from private field"),r?r.call(e):t.get(e)),E=(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)},x=(e,t,r,n)=>(yt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),De={};jr(De,{ProgressTypes:()=>$});var $={BAR:"bar",RADIAL:"radial",PERCENTAGE:"percentage"},Ee=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment=="undefined"){class e extends Ee{}globalThis.DocumentFragment=e}var Fe=class extends Ee{},Wr=class extends Ee{},$r={get(e){},define(e,t,r){},getName(e){return null},upgrade(e){},whenDefined(e){return Promise.resolve(Fe)}},ve,Xr=class{constructor(e,t={}){E(this,ve,void 0),x(this,ve,t==null?void 0:t.detail)}get detail(){return i(this,ve)}initCustomEvent(){}};ve=new WeakMap;function qr(e,t){return new Fe}var Et={document:{createElement:qr},DocumentFragment,customElements:$r,CustomEvent:Xr,EventTarget:Ee,HTMLElement:Fe,HTMLVideoElement:Wr},xt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",p=xt?Et:globalThis,P=xt?Et.document:globalThis.document,kt=(e,t)=>e?e.closest(t)||kt(e.getRootNode().host,t):null,N=e=>{let t=e.getAttribute("mux-uploader");return t?document.getElementById(t):kt(e,"mux-uploader")},Ct=P.createElement("template");Ct.innerHTML=` | ||
<style> | ||
@@ -5,0 +5,0 @@ :host { |
@@ -45,43 +45,27 @@ import React from 'react'; | ||
declare const MuxUploader: React.ForwardRefExoticComponent<{ | ||
id?: string | undefined; | ||
endpoint?: MuxUploaderElement['endpoint']; | ||
type?: "bar" | "radial" | "percentage" | undefined; | ||
noDrop?: boolean | undefined; | ||
noProgress?: boolean | undefined; | ||
noStatus?: boolean | undefined; | ||
noRetry?: boolean | undefined; | ||
pausable?: boolean | undefined; | ||
style?: (React.CSSProperties & { | ||
"--progress-bar-fill-color"?: CSSProperties['background']; | ||
"--progress-radial-fill-color"?: CSSProperties['stroke']; | ||
}) | undefined; | ||
id?: string; | ||
endpoint?: MuxUploaderElement["endpoint"]; | ||
type?: ProgressTypes[keyof ProgressTypes]; | ||
noDrop?: boolean; | ||
noProgress?: boolean; | ||
noStatus?: boolean; | ||
noRetry?: boolean; | ||
pausable?: boolean; | ||
style?: CSSProperties & { | ||
["--progress-bar-fill-color"]?: CSSProperties["background"]; | ||
["--progress-radial-fill-color"]?: CSSProperties["stroke"]; | ||
}; | ||
children?: React.ReactNode; | ||
dynamicChunkSize?: boolean | undefined; | ||
useLargeFileWorkaround?: boolean | undefined; | ||
maxFileSize?: number | undefined; | ||
chunkSize?: number | undefined; | ||
onUploadStart?: GenericEventListener<CustomEvent<{ | ||
file: File; | ||
chunkSize: number; | ||
}>> | undefined; | ||
onChunkAttempt?: GenericEventListener<CustomEvent<{ | ||
chunkNumber: number; | ||
chunkSize: number; | ||
}>> | undefined; | ||
onChunkSuccess?: GenericEventListener<CustomEvent<{ | ||
chunk: number; | ||
chunkSize: number; | ||
attempts: number; | ||
timeInterval: number; | ||
response: any; | ||
}>> | undefined; | ||
onUploadError?: GenericEventListener<CustomEvent<{ | ||
message: string; | ||
chunkNumber?: number | undefined; | ||
attempts?: number | undefined; | ||
}>> | undefined; | ||
onProgress?: GenericEventListener<CustomEvent<number>> | undefined; | ||
onSuccess?: GenericEventListener<CustomEvent<null | undefined>> | undefined; | ||
dynamicChunkSize?: boolean; | ||
useLargeFileWorkaround?: boolean; | ||
maxFileSize?: number; | ||
chunkSize?: number; | ||
onUploadStart?: GenericEventListener<MuxUploaderElementEventMap["uploadstart"]>; | ||
onChunkAttempt?: GenericEventListener<MuxUploaderElementEventMap["chunkattempt"]>; | ||
onChunkSuccess?: GenericEventListener<MuxUploaderElementEventMap["chunksuccess"]>; | ||
onUploadError?: GenericEventListener<MuxUploaderElementEventMap["uploaderror"]>; | ||
onProgress?: GenericEventListener<MuxUploaderElementEventMap["progress"]>; | ||
onSuccess?: GenericEventListener<MuxUploaderElementEventMap["success"]>; | ||
} & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, Exclude<keyof React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">> & React.RefAttributes<MuxUploaderElement>>; | ||
export { MuxUploaderDrop, MuxUploaderFileSelect, MuxUploaderProgress, MuxUploaderRetry, MuxUploaderPause, MuxUploaderStatus, }; | ||
export default MuxUploader; |
@@ -16,10 +16,10 @@ import React from 'react'; | ||
declare const MuxUploaderDrop: React.ForwardRefExoticComponent<{ | ||
overlay?: boolean | undefined; | ||
overlayText?: string | undefined; | ||
muxUploader?: string | undefined; | ||
style?: (React.CSSProperties & { | ||
"--overlay-background-color"?: CSSProperties['backgroundColor']; | ||
}) | undefined; | ||
overlay?: boolean; | ||
overlayText?: string; | ||
muxUploader?: string; | ||
style?: CSSProperties & { | ||
["--overlay-background-color"]?: CSSProperties["backgroundColor"]; | ||
}; | ||
children?: React.ReactNode; | ||
} & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, Exclude<keyof React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">> & React.RefAttributes<MuxUploaderDropElement>>; | ||
export default MuxUploaderDrop; |
@@ -10,5 +10,5 @@ import React from 'react'; | ||
declare const MuxUploaderFileSelect: React.ForwardRefExoticComponent<{ | ||
muxUploader?: string | undefined; | ||
muxUploader?: string; | ||
children?: React.ReactNode; | ||
} & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, Exclude<keyof React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">> & React.RefAttributes<MuxUploaderFileSelectElement>>; | ||
export default MuxUploaderFileSelect; |
@@ -10,5 +10,5 @@ import React from 'react'; | ||
declare const MuxUploaderPause: React.ForwardRefExoticComponent<{ | ||
muxUploader?: string | undefined; | ||
muxUploader?: string; | ||
children?: React.ReactNode; | ||
} & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, Exclude<keyof React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">> & React.RefAttributes<MuxUploaderPauseElement>>; | ||
export default MuxUploaderPause; |
@@ -17,11 +17,11 @@ import React from 'react'; | ||
declare const MuxUploaderProgress: React.ForwardRefExoticComponent<{ | ||
muxUploader?: string | undefined; | ||
type?: "bar" | "radial" | "percentage" | undefined; | ||
muxUploader?: string; | ||
type?: "bar" | "radial" | "percentage"; | ||
children?: React.ReactNode; | ||
style?: (React.CSSProperties & { | ||
"--progress-bar-height"?: CSSProperties['height']; | ||
"--progress-bar-fill-color"?: CSSProperties['fill']; | ||
"--progress-percentage-display"?: CSSProperties['display']; | ||
}) | undefined; | ||
style?: CSSProperties & { | ||
["--progress-bar-height"]?: CSSProperties["height"]; | ||
["--progress-bar-fill-color"]?: CSSProperties["fill"]; | ||
["--progress-percentage-display"]?: CSSProperties["display"]; | ||
}; | ||
} & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, Exclude<keyof React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">> & React.RefAttributes<MuxUploaderProgressElement>>; | ||
export default MuxUploaderProgress; |
@@ -10,5 +10,5 @@ import React from 'react'; | ||
declare const MuxUploaderRetry: React.ForwardRefExoticComponent<{ | ||
muxUploader?: string | undefined; | ||
muxUploader?: string; | ||
children?: React.ReactNode; | ||
} & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, Exclude<keyof React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">> & React.RefAttributes<MuxUploaderRetryElement>>; | ||
export default MuxUploaderRetry; |
@@ -10,5 +10,5 @@ import React from 'react'; | ||
declare const MuxUploaderStatus: React.ForwardRefExoticComponent<{ | ||
muxUploader?: string | undefined; | ||
muxUploader?: string; | ||
children?: React.ReactNode; | ||
} & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, Exclude<keyof React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">> & React.RefAttributes<MuxUploaderStatusElement>>; | ||
export default MuxUploaderStatus; |
export declare const defaultHasChanged: (obj: any, v: any, k: string) => boolean; | ||
export declare const useObjectPropEffect: <T extends { | ||
[k: string]: any; | ||
}, V>(propName: string, propValue: V | null | undefined, ref: import("react").MutableRefObject<T | null> | null | undefined, updateValue?: (obj: any, v: any, k: string) => void, hasChanged?: (obj: any, v: any, k: string) => boolean) => void; | ||
}, V>(propName: string, propValue: V | null | undefined, ref: React.MutableRefObject<T | null> | null | undefined, updateValue?: (obj: any, v: any, k: string) => void, hasChanged?: (obj: any, v: any, k: string) => boolean) => void; | ||
export default useObjectPropEffect; |
@@ -45,43 +45,27 @@ import React from 'react'; | ||
declare const MuxUploader: React.ForwardRefExoticComponent<{ | ||
id?: string | undefined; | ||
endpoint?: MuxUploaderElement['endpoint']; | ||
type?: "bar" | "radial" | "percentage" | undefined; | ||
noDrop?: boolean | undefined; | ||
noProgress?: boolean | undefined; | ||
noStatus?: boolean | undefined; | ||
noRetry?: boolean | undefined; | ||
pausable?: boolean | undefined; | ||
style?: (React.CSSProperties & { | ||
"--progress-bar-fill-color"?: CSSProperties['background']; | ||
"--progress-radial-fill-color"?: CSSProperties['stroke']; | ||
}) | undefined; | ||
id?: string; | ||
endpoint?: MuxUploaderElement["endpoint"]; | ||
type?: ProgressTypes[keyof ProgressTypes]; | ||
noDrop?: boolean; | ||
noProgress?: boolean; | ||
noStatus?: boolean; | ||
noRetry?: boolean; | ||
pausable?: boolean; | ||
style?: CSSProperties & { | ||
["--progress-bar-fill-color"]?: CSSProperties["background"]; | ||
["--progress-radial-fill-color"]?: CSSProperties["stroke"]; | ||
}; | ||
children?: React.ReactNode; | ||
dynamicChunkSize?: boolean | undefined; | ||
useLargeFileWorkaround?: boolean | undefined; | ||
maxFileSize?: number | undefined; | ||
chunkSize?: number | undefined; | ||
onUploadStart?: GenericEventListener<CustomEvent<{ | ||
file: File; | ||
chunkSize: number; | ||
}>> | undefined; | ||
onChunkAttempt?: GenericEventListener<CustomEvent<{ | ||
chunkNumber: number; | ||
chunkSize: number; | ||
}>> | undefined; | ||
onChunkSuccess?: GenericEventListener<CustomEvent<{ | ||
chunk: number; | ||
chunkSize: number; | ||
attempts: number; | ||
timeInterval: number; | ||
response: any; | ||
}>> | undefined; | ||
onUploadError?: GenericEventListener<CustomEvent<{ | ||
message: string; | ||
chunkNumber?: number | undefined; | ||
attempts?: number | undefined; | ||
}>> | undefined; | ||
onProgress?: GenericEventListener<CustomEvent<number>> | undefined; | ||
onSuccess?: GenericEventListener<CustomEvent<null | undefined>> | undefined; | ||
dynamicChunkSize?: boolean; | ||
useLargeFileWorkaround?: boolean; | ||
maxFileSize?: number; | ||
chunkSize?: number; | ||
onUploadStart?: GenericEventListener<MuxUploaderElementEventMap["uploadstart"]>; | ||
onChunkAttempt?: GenericEventListener<MuxUploaderElementEventMap["chunkattempt"]>; | ||
onChunkSuccess?: GenericEventListener<MuxUploaderElementEventMap["chunksuccess"]>; | ||
onUploadError?: GenericEventListener<MuxUploaderElementEventMap["uploaderror"]>; | ||
onProgress?: GenericEventListener<MuxUploaderElementEventMap["progress"]>; | ||
onSuccess?: GenericEventListener<MuxUploaderElementEventMap["success"]>; | ||
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<MuxUploaderElement>>; | ||
export { MuxUploaderDrop, MuxUploaderFileSelect, MuxUploaderProgress, MuxUploaderRetry, MuxUploaderPause, MuxUploaderStatus, }; | ||
export default MuxUploader; |
@@ -16,10 +16,10 @@ import React from 'react'; | ||
declare const MuxUploaderDrop: React.ForwardRefExoticComponent<{ | ||
overlay?: boolean | undefined; | ||
overlayText?: string | undefined; | ||
muxUploader?: string | undefined; | ||
style?: (React.CSSProperties & { | ||
"--overlay-background-color"?: CSSProperties['backgroundColor']; | ||
}) | undefined; | ||
overlay?: boolean; | ||
overlayText?: string; | ||
muxUploader?: string; | ||
style?: CSSProperties & { | ||
["--overlay-background-color"]?: CSSProperties["backgroundColor"]; | ||
}; | ||
children?: React.ReactNode; | ||
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<MuxUploaderDropElement>>; | ||
export default MuxUploaderDrop; |
@@ -10,5 +10,5 @@ import React from 'react'; | ||
declare const MuxUploaderFileSelect: React.ForwardRefExoticComponent<{ | ||
muxUploader?: string | undefined; | ||
muxUploader?: string; | ||
children?: React.ReactNode; | ||
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<MuxUploaderFileSelectElement>>; | ||
export default MuxUploaderFileSelect; |
@@ -10,5 +10,5 @@ import React from 'react'; | ||
declare const MuxUploaderPause: React.ForwardRefExoticComponent<{ | ||
muxUploader?: string | undefined; | ||
muxUploader?: string; | ||
children?: React.ReactNode; | ||
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<MuxUploaderPauseElement>>; | ||
export default MuxUploaderPause; |
@@ -17,11 +17,11 @@ import React from 'react'; | ||
declare const MuxUploaderProgress: React.ForwardRefExoticComponent<{ | ||
muxUploader?: string | undefined; | ||
type?: "bar" | "radial" | "percentage" | undefined; | ||
muxUploader?: string; | ||
type?: "bar" | "radial" | "percentage"; | ||
children?: React.ReactNode; | ||
style?: (React.CSSProperties & { | ||
"--progress-bar-height"?: CSSProperties['height']; | ||
"--progress-bar-fill-color"?: CSSProperties['fill']; | ||
"--progress-percentage-display"?: CSSProperties['display']; | ||
}) | undefined; | ||
style?: CSSProperties & { | ||
["--progress-bar-height"]?: CSSProperties["height"]; | ||
["--progress-bar-fill-color"]?: CSSProperties["fill"]; | ||
["--progress-percentage-display"]?: CSSProperties["display"]; | ||
}; | ||
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<MuxUploaderProgressElement>>; | ||
export default MuxUploaderProgress; |
@@ -10,5 +10,5 @@ import React from 'react'; | ||
declare const MuxUploaderRetry: React.ForwardRefExoticComponent<{ | ||
muxUploader?: string | undefined; | ||
muxUploader?: string; | ||
children?: React.ReactNode; | ||
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<MuxUploaderRetryElement>>; | ||
export default MuxUploaderRetry; |
@@ -10,5 +10,5 @@ import React from 'react'; | ||
declare const MuxUploaderStatus: React.ForwardRefExoticComponent<{ | ||
muxUploader?: string | undefined; | ||
muxUploader?: string; | ||
children?: React.ReactNode; | ||
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<MuxUploaderStatusElement>>; | ||
export default MuxUploaderStatus; |
export declare const defaultHasChanged: (obj: any, v: any, k: string) => boolean; | ||
export declare const useObjectPropEffect: <T extends { | ||
[k: string]: any; | ||
}, V>(propName: string, propValue: V | null | undefined, ref: import("react").MutableRefObject<T | null> | null | undefined, updateValue?: (obj: any, v: any, k: string) => void, hasChanged?: (obj: any, v: any, k: string) => boolean) => void; | ||
}, V>(propName: string, propValue: V | null | undefined, ref: React.MutableRefObject<T | null> | null | undefined, updateValue?: (obj: any, v: any, k: string) => void, hasChanged?: (obj: any, v: any, k: string) => boolean) => void; | ||
export default useObjectPropEffect; |
{ | ||
"name": "@mux/mux-uploader-react", | ||
"version": "1.0.1", | ||
"version": "1.0.2-canary.0-1088443", | ||
"description": "An uploader element for React that handles Mux Direct Uploads and a visual progress bar for you", | ||
@@ -73,3 +73,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@mux/mux-uploader": "1.0.1", | ||
"@mux/mux-uploader": "1.0.2-canary.0-1088443", | ||
"prop-types": "^15.7.2" | ||
@@ -87,5 +87,4 @@ }, | ||
"shx": "^0.3.4", | ||
"typescript": "^4.9.4" | ||
}, | ||
"gitHead": "31bf5057d37d4e57b630012fc09d52daedb2973a" | ||
"typescript": "^5.5.4" | ||
} | ||
} |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
631784
30
2169
3
+ Added@mux/mux-uploader@1.0.2-canary.0-1088443(transitive)
- Removed@mux/mux-uploader@1.0.1(transitive)