@fsdk/upchunk
Version:
Dead simple chunked file uploads using Fetch
5 lines (4 loc) • 20 kB
JavaScript
var UpChunk=(()=>{var ke=Object.create;var k=Object.defineProperty;var Ae=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var Le=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty;var P=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Fe=(t,e)=>{for(var n in e)k(t,n,{get:e[n],enumerable:!0})},x=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of _e(e))!Be.call(t,s)&&s!==n&&k(t,s,{get:()=>e[s],enumerable:!(r=Ae(e,s))||r.enumerable});return t};var Ie=(t,e,n)=>(n=t!=null?ke(Le(t)):{},x(e||!t||!t.__esModule?k(n,"default",{value:t,enumerable:!0}):n,t)),Ne=t=>x(k({},"__esModule",{value:!0}),t);var ge=P((vt,de)=>{var O;typeof window!="undefined"?O=window:typeof global!="undefined"?O=global:typeof self!="undefined"?O=self:O={};de.exports=O});var be=P((wt,me)=>{me.exports=nt;var tt=Object.prototype.toString;function nt(t){if(!t)return!1;var e=tt.call(t);return e==="[object Function]"||typeof t=="function"&&e!=="[object RegExp]"||typeof window!="undefined"&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}});var Ee=P((Rt,ye)=>{var H=function(t){return t.replace(/^\s+|\s+$/g,"")},rt=function(t){return Object.prototype.toString.call(t)==="[object Array]"};ye.exports=function(t){if(!t)return{};for(var e={},n=H(t).split(`
`),r=0;r<n.length;r++){var s=n[r],o=s.indexOf(":"),a=H(s.slice(0,o)).toLowerCase(),i=H(s.slice(o+1));typeof e[a]=="undefined"?e[a]=i:rt(e[a])?e[a].push(i):e[a]=[e[a],i]}return e}});var we=P((Ct,ve)=>{ve.exports=it;var st=Object.prototype.hasOwnProperty;function it(){for(var t={},e=0;e<arguments.length;e++){var n=arguments[e];for(var r in n)st.call(n,r)&&(t[r]=n[r])}return t}});var Pe=P((Tt,U)=>{"use strict";var Re=ge(),ot=be(),at=Ee(),ut=we();U.exports=b;U.exports.default=b;b.XMLHttpRequest=Re.XMLHttpRequest||pt;b.XDomainRequest="withCredentials"in new b.XMLHttpRequest?b.XMLHttpRequest:Re.XDomainRequest;lt(["get","put","post","patch","head","delete"],function(t){b[t==="delete"?"del":t]=function(e,n,r){return n=Ce(e,n,r),n.method=t.toUpperCase(),Te(n)}});function lt(t,e){for(var n=0;n<t.length;n++)e(t[n])}function ct(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}function Ce(t,e,n){var r=t;return ot(e)?(n=e,typeof t=="string"&&(r={uri:t})):r=ut(e,{uri:t}),r.callback=n,r}function b(t,e,n){return e=Ce(t,e,n),Te(e)}function Te(t){if(typeof t.callback=="undefined")throw new Error("callback argument missing");var e=!1,n=function(v,S,Se){e||(e=!0,t.callback(v,S,Se))};function r(){i.readyState===4&&setTimeout(a,0)}function s(){var u=void 0;if(i.response?u=i.response:u=i.responseText||ft(i),X)try{u=JSON.parse(u)}catch{}return u}function o(u){return clearTimeout(B),u instanceof Error||(u=new Error(""+(u||"Unknown XMLHttpRequest Error"))),u.statusCode=0,n(u,z)}function a(){if(!f){var u;clearTimeout(B),t.useXDR&&i.status===void 0?u=200:u=i.status===1223?204:i.status;var v=z,S=null;return u!==0?(v={body:s(),statusCode:u,method:g,headers:{},url:y,rawRequest:i},i.getAllResponseHeaders&&(v.headers=at(i.getAllResponseHeaders()))):S=new Error("Internal XMLHttpRequest Error"),n(S,v,v.body)}}var i=t.xhr||null;i||(t.cors||t.useXDR?i=new b.XDomainRequest:i=new b.XMLHttpRequest);var c,f,y=i.url=t.uri||t.url,g=i.method=t.method||"GET",R=t.body||t.data,m=i.headers=t.headers||{},L=!!t.sync,X=!1,B,z={body:void 0,headers:{},statusCode:0,method:g,url:y,rawRequest:i};if("json"in t&&t.json!==!1&&(X=!0,m.accept||m.Accept||(m.Accept="application/json"),g!=="GET"&&g!=="HEAD"&&(m["content-type"]||m["Content-Type"]||(m["Content-Type"]="application/json"),R=JSON.stringify(t.json===!0?R:t.json))),i.onreadystatechange=r,i.onload=a,i.onerror=o,i.onprogress=function(){},i.onabort=function(){f=!0},i.ontimeout=o,i.open(g,y,!L,t.username,t.password),L||(i.withCredentials=!!t.withCredentials),!L&&t.timeout>0&&(B=setTimeout(function(){if(!f){f=!0,i.abort("timeout");var u=new Error("XMLHttpRequest timeout");u.code="ETIMEDOUT",o(u)}},t.timeout)),i.setRequestHeader)for(c in m)m.hasOwnProperty(c)&&i.setRequestHeader(c,m[c]);else if(t.headers&&!ct(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(i.responseType=t.responseType),"beforeSend"in t&&typeof t.beforeSend=="function"&&t.beforeSend(i),i.send(R||null),i}function ft(t){try{if(t.responseType==="document")return t.responseXML;var e=t.responseXML&&t.responseXML.documentElement.nodeName==="parsererror";if(t.responseType===""&&!e)return t.responseXML}catch{}return null}function pt(){}});var mt={};Fe(mt,{UpChunk:()=>_,createUpload:()=>gt});function M(t,e,...n){if(!t)throw new TypeError(ee(e,n))}function ee(t,e){let n=0;return t.replace(/%[os]/gu,()=>te(e[n++]))}function te(t){return typeof t!="object"||t===null?String(t):Object.prototype.toString.call(t)}var W;function De(t){try{let e=t instanceof Error?t:new Error(te(t));if(W){W(e);return}if(typeof dispatchEvent=="function"&&typeof ErrorEvent=="function")dispatchEvent(new ErrorEvent("error",{error:e,message:e.message}));else if(typeof process!="undefined"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)}catch{}}var p=typeof window!="undefined"?window:typeof self!="undefined"?self:typeof global!="undefined"?global:typeof globalThis!="undefined"?globalThis:void 0,V;var h=class{constructor(e,n){this.code=e,this.message=n}warn(...e){var n;try{if(V){V({...this,args:e});return}let r=((n=new Error().stack)!==null&&n!==void 0?n:"").replace(/^(?:.+?\n){2}/gu,`
`);console.warn(this.message,...e,r)}catch{}}},je=new h("W01","Unable to initialize event under dispatching."),Me=new h("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),He=new h("W03","Assigning any truthy value to 'returnValue' property has no effect."),Ue=new h("W04","Unable to preventDefault on non-cancelable events."),Xe=new h("W05","Unable to preventDefault inside passive event listener invocation."),ze=new h("W06","An event listener wasn't added because it has been added already: %o, %o"),F=new h("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),q=new h("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o"),yt=new h("W09","Event attribute handler must be a function: %o"),d=class{static get NONE(){return $}static get CAPTURING_PHASE(){return G}static get AT_TARGET(){return Y}static get BUBBLING_PHASE(){return J}constructor(e,n){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let r=n!=null?n:{};j.set(this,{type:String(e),bubbles:Boolean(r.bubbles),cancelable:Boolean(r.cancelable),composed:Boolean(r.composed),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1,inPassiveListenerFlag:!1,dispatchFlag:!1,timeStamp:Date.now()})}get type(){return l(this).type}get target(){return l(this).target}get srcElement(){return l(this).target}get currentTarget(){return l(this).currentTarget}composedPath(){let e=l(this).currentTarget;return e?[e]:[]}get NONE(){return $}get CAPTURING_PHASE(){return G}get AT_TARGET(){return Y}get BUBBLING_PHASE(){return J}get eventPhase(){return l(this).dispatchFlag?2:0}stopPropagation(){l(this).stopPropagationFlag=!0}get cancelBubble(){return l(this).stopPropagationFlag}set cancelBubble(e){e?l(this).stopPropagationFlag=!0:Me.warn()}stopImmediatePropagation(){let e=l(this);e.stopPropagationFlag=e.stopImmediatePropagationFlag=!0}get bubbles(){return l(this).bubbles}get cancelable(){return l(this).cancelable}get returnValue(){return!l(this).canceledFlag}set returnValue(e){e?He.warn():K(l(this))}preventDefault(){K(l(this))}get defaultPrevented(){return l(this).canceledFlag}get composed(){return l(this).composed}get isTrusted(){return!1}get timeStamp(){return l(this).timeStamp}initEvent(e,n=!1,r=!1){let s=l(this);if(s.dispatchFlag){je.warn();return}j.set(this,{...s,type:String(e),bubbles:Boolean(n),cancelable:Boolean(r),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}},$=0,G=1,Y=2,J=3,j=new WeakMap;function l(t,e="this"){let n=j.get(t);return M(n!=null,"'%s' must be an object that Event constructor created, but got another one: %o",e,t),n}function K(t){if(t.inPassiveListenerFlag){Xe.warn();return}if(!t.cancelable){Ue.warn();return}t.canceledFlag=!0}Object.defineProperty(d,"NONE",{enumerable:!0});Object.defineProperty(d,"CAPTURING_PHASE",{enumerable:!0});Object.defineProperty(d,"AT_TARGET",{enumerable:!0});Object.defineProperty(d,"BUBBLING_PHASE",{enumerable:!0});var I=Object.getOwnPropertyNames(d.prototype);for(let t=0;t<I.length;++t)I[t]!=="constructor"&&Object.defineProperty(d.prototype,I[t],{enumerable:!0});typeof p!="undefined"&&typeof p.Event!="undefined"&&Object.setPrototypeOf(d.prototype,p.Event.prototype);function xe(t){return p.DOMException?new p.DOMException(t,"InvalidStateError"):(C==null&&(C=class ne extends Error{constructor(n){super(n),Error.captureStackTrace&&Error.captureStackTrace(this,ne)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(C.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),Z(C),Z(C.prototype)),new C(t))}var C,Q={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 Z(t){let e=Object.keys(Q);for(let n=0;n<e.length;++n){let r=e[n],s=Q[r];Object.defineProperty(t,r,{get(){return s},configurable:!0,enumerable:!0})}}var T=class extends d{static wrap(e){return new(se(e))(e)}constructor(e){super(e.type,{bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed}),e.cancelBubble&&super.stopPropagation(),e.defaultPrevented&&super.preventDefault(),re.set(this,{original:e});let n=Object.keys(e);for(let r=0;r<n.length;++r){let s=n[r];s in this||Object.defineProperty(this,s,ie(e,s))}}stopPropagation(){super.stopPropagation();let{original:e}=E(this);"stopPropagation"in e&&e.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(e){super.cancelBubble=e;let{original:n}=E(this);"cancelBubble"in n&&(n.cancelBubble=e)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:e}=E(this);"stopImmediatePropagation"in e&&e.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(e){super.returnValue=e;let{original:n}=E(this);"returnValue"in n&&(n.returnValue=e)}preventDefault(){super.preventDefault();let{original:e}=E(this);"preventDefault"in e&&e.preventDefault()}get timeStamp(){let{original:e}=E(this);return"timeStamp"in e?e.timeStamp:super.timeStamp}},re=new WeakMap;function E(t){let e=re.get(t);return M(e!=null,"'this' is expected an Event object, but got",t),e}var A=new WeakMap;A.set(Object.prototype,T);typeof p!="undefined"&&typeof p.Event!="undefined"&&A.set(p.Event.prototype,T);function se(t){let e=Object.getPrototypeOf(t);if(e==null)return T;let n=A.get(e);return n==null&&(n=We(se(e),e),A.set(e,n)),n}function We(t,e){class n extends t{}let r=Object.keys(e);for(let s=0;s<r.length;++s)Object.defineProperty(n.prototype,r[s],ie(e,r[s]));return n}function ie(t,e){let n=Object.getOwnPropertyDescriptor(t,e);return{get(){let r=E(this).original,s=r[e];return typeof s=="function"?s.bind(r):s},set(r){let s=E(this).original;s[e]=r},configurable:n.configurable,enumerable:n.enumerable}}function Ve(t,e,n,r,s,o){return{callback:t,flags:(e?1:0)|(n?2:0)|(r?4:0),signal:s,signalListener:o}}function qe(t){t.flags|=8}function oe(t){return(t.flags&1)===1}function ae(t){return(t.flags&2)===2}function ue(t){return(t.flags&4)===4}function $e(t){return(t.flags&8)===8}function Ge({callback:t},e,n){try{typeof t=="function"?t.call(e,n):typeof t.handleEvent=="function"&&t.handleEvent(n)}catch(r){De(r)}}function le({listeners:t},e,n){for(let r=0;r<t.length;++r)if(t[r].callback===e&&oe(t[r])===n)return r;return-1}function Ye(t,e,n,r,s,o){let a;o&&(a=ce.bind(null,t,e,n),o.addEventListener("abort",a));let i=Ve(e,n,r,s,o,a);return t.cow?(t.cow=!1,t.listeners=[...t.listeners,i]):t.listeners.push(i),i}function ce(t,e,n){let r=le(t,e,n);return r!==-1?fe(t,r):!1}function fe(t,e,n=!1){let r=t.listeners[e];return qe(r),r.signal&&r.signal.removeEventListener("abort",r.signalListener),t.cow&&!n?(t.cow=!1,t.listeners=t.listeners.filter((s,o)=>o!==e),!1):(t.listeners.splice(e,1),!0)}function Je(){return Object.create(null)}function Ke(t,e){var n;return(n=t[e])!==null&&n!==void 0?n:t[e]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}var w=class{constructor(){pe.set(this,Je())}addEventListener(e,n,r){let s=N(this),{callback:o,capture:a,once:i,passive:c,signal:f,type:y}=Qe(e,n,r);if(o==null||(f==null?void 0:f.aborted))return;let g=Ke(s,y),R=le(g,o,a);if(R!==-1){et(g.listeners[R],c,i,f);return}Ye(g,o,a,c,i,f)}removeEventListener(e,n,r){let s=N(this),{callback:o,capture:a,type:i}=Ze(e,n,r),c=s[i];o!=null&&c&&ce(c,o,a)}dispatchEvent(e){let n=N(this)[String(e.type)];if(n==null)return!0;let r=e instanceof d?e:T.wrap(e),s=l(r,"event");if(s.dispatchFlag)throw xe("This event has been in dispatching.");if(s.dispatchFlag=!0,s.target=s.currentTarget=this,!s.stopPropagationFlag){let{cow:o,listeners:a}=n;n.cow=!0;for(let i=0;i<a.length;++i){let c=a[i];if(!$e(c)&&(ue(c)&&fe(n,i,!o)&&(i-=1),s.inPassiveListenerFlag=ae(c),Ge(c,this,r),s.inPassiveListenerFlag=!1,s.stopImmediatePropagationFlag))break}o||(n.cow=!1)}return s.target=null,s.currentTarget=null,s.stopImmediatePropagationFlag=!1,s.stopPropagationFlag=!1,s.dispatchFlag=!1,!s.canceledFlag}},pe=new WeakMap;function N(t,e="this"){let n=pe.get(t);return M(n!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",e,t),n}function Qe(t,e,n){var r;return he(e),typeof n=="object"&&n!==null?{type:String(t),callback:e!=null?e:void 0,capture:Boolean(n.capture),passive:Boolean(n.passive),once:Boolean(n.once),signal:(r=n.signal)!==null&&r!==void 0?r:void 0}:{type:String(t),callback:e!=null?e:void 0,capture:Boolean(n),passive:!1,once:!1,signal:void 0}}function Ze(t,e,n){return he(e),typeof n=="object"&&n!==null?{type:String(t),callback:e!=null?e:void 0,capture:Boolean(n.capture)}:{type:String(t),callback:e!=null?e:void 0,capture:Boolean(n)}}function he(t){if(!(typeof t=="function"||typeof t=="object"&&t!==null&&typeof t.handleEvent=="function")){if(t==null||typeof t=="object"){q.warn(t);return}throw new TypeError(ee(q.message,[t]))}}function et(t,e,n,r){ze.warn(oe(t)?"capture":"bubble",t.callback),ae(t)!==e&&F.warn("passive"),ue(t)!==n&&F.warn("once"),t.signal!==r&&F.warn("signal")}var D=Object.getOwnPropertyNames(w.prototype);for(let t=0;t<D.length;++t)D[t]!=="constructor"&&Object.defineProperty(w.prototype,D[t],{enumerable:!0});typeof p!="undefined"&&typeof p.EventTarget!="undefined"&&Object.setPrototypeOf(w.prototype,p.EventTarget.prototype);var Oe=Ie(Pe()),ht=[200,201,202,204,308],dt=[408,502,503,504],_=class{constructor(e){this.endpoint=e.endpoint,this.file=e.file,this.headers=e.headers||{},this.method=e.method||"PUT",this.chunkSize=e.chunkSize||30720,this.retries=e.retries||5,this.delayBeforeRetry=e.delayBeforeRetry||1,this.retryCodes=e.retryCodes||dt,this.maxFileBytes=(e.maxFileSize||0)*1024,this.chunkCount=0,this.chunkByteSize=this.chunkSize*1024,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 w,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=!0,this.dispatch("offline")}))}on(e,n){this.eventTarget.addEventListener(e,n)}abort(){var e;this.pause(),(e=this.currentXhr)==null||e.abort()}pause(){this.paused=!0}resume(){this.paused&&(this.paused=!1,this.sendChunks())}dispatch(e,n){let r=new CustomEvent(e,{detail:n});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!="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 (${this.file.size} > ${this.maxFileBytes})`);if(this.retries&&(typeof this.retries!="number"||this.retries<=0))throw new TypeError("retries must be a positive number");if(this.delayBeforeRetry&&(typeof this.delayBeforeRetry!="number"||this.delayBeforeRetry<0))throw new TypeError("delayBeforeRetry 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))}getChunk(){return new Promise(e=>{let n=this.totalChunks===1?this.file.size:this.chunkByteSize,r=n*this.chunkCount;this.reader.onload=()=>{this.reader.result!==null&&(this.chunk=new Blob([this.reader.result],{type:"application/octet-stream"})),e()},this.reader.readAsArrayBuffer(this.file.slice(r,r+n))})}xhrPromise(e){let n=r=>{r.upload.onprogress=s=>{var y;let o=100/this.totalChunks,a=o*this.file.size,i=o*this.chunkCount,f=s.loaded/((y=s.total)!=null?y:a)*o;this.dispatch("progress",Math.min(i+f,100))}};return new Promise((r,s)=>{this.currentXhr=(0,Oe.default)({...e,beforeSend:n},(o,a)=>(this.currentXhr=void 0,o?s(o):r(a)))})}async sendChunk(){let e=this.chunkCount*this.chunkByteSize,n=e+this.chunk.size-1,r={...this.headers,"Content-Type":this.file.type,"Content-Range":`bytes ${e}-${n}/${this.file.size}`};return this.dispatch("attempt",{chunkNumber:this.chunkCount,chunkSize:this.chunk.size}),this.xhrPromise({headers:r,url:this.endpointValue,method:this.method,body:this.chunk})}manageRetries(){if(this.attemptCount<this.retries){setTimeout(()=>this.sendChunks(),this.delayBeforeRetry*1e3),this.dispatch("attemptFailure",{message:`An error occured uploading chunk ${this.chunkCount}. ${this.retries-this.attemptCount} retries left.`,chunkNumber:this.chunkCount,attemptsLeft:this.retries-this.attemptCount});return}this.dispatch("error",{message:`An error occured uploading chunk ${this.chunkCount}. No more retries, stopping upload`,chunk:this.chunkCount,attempts:this.attemptCount})}sendChunks(){this.paused||this.offline||this.success||this.getChunk().then(()=>(this.attemptCount=this.attemptCount+1,this.sendChunk())).then(e=>{if(ht.includes(e.statusCode)){this.dispatch("chunkSuccess",{chunk:this.chunkCount,attempts:this.attemptCount,response:e}),this.attemptCount=0,this.chunkCount=this.chunkCount+1,this.chunkCount<this.totalChunks?this.sendChunks():(this.success=!0,this.dispatch("success"));let r=this.chunkCount/this.totalChunks*this.file.size,s=100*r/this.file.size;this.dispatch("progress",s)}else if(this.retryCodes.includes(e.statusCode)){if(this.paused||this.offline)return;this.manageRetries()}else{if(this.paused||this.offline)return;this.dispatch("error",{message:`Server responded with ${e.statusCode}. Stopping upload.`,chunkNumber:this.chunkCount,attempts:this.attemptCount})}}).catch(e=>{this.paused||this.offline||this.manageRetries()})}},gt=t=>new _(t);return Ne(mt);})();
//# sourceMappingURL=upchunk.js.map