@maveio/components 0.0.151 → 0.0.153

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/{chunk-BRZI5I43.cjs → chunk-2P6HF22Q.cjs} +3 -3
  2. package/dist/chunk-36CSGHYJ.js +1807 -0
  3. package/dist/{chunk-S6WN4NLN.js → chunk-6QHPCMNQ.js} +1 -1
  4. package/dist/{chunk-LX6MMRGQ.js → chunk-D3LG3UTO.js} +1 -1
  5. package/dist/{chunk-XSVNMS3S.cjs → chunk-EB4QCWWS.cjs} +1 -1
  6. package/dist/{chunk-ZXCHPIGV.js → chunk-HKHV3KLY.js} +3 -3
  7. package/dist/chunk-MB72HBHH.cjs +1 -0
  8. package/dist/chunk-NV7C4TBM.js +1 -0
  9. package/dist/{chunk-VGWLQHAV.cjs → chunk-SAOOZPZZ.cjs} +2 -2
  10. package/dist/{chunk-SM4RPLYQ.cjs → chunk-WEZKG6QZ.cjs} +2 -2
  11. package/dist/chunk-YAVQQEFQ.cjs +1807 -0
  12. package/dist/{chunk-FDSTNWZP.js → chunk-YVMWE3I7.js} +1 -1
  13. package/dist/components/list.cjs +1 -1
  14. package/dist/components/list.js +1 -1
  15. package/dist/components/player.cjs +1 -1
  16. package/dist/components/player.js +1 -1
  17. package/dist/components/pop.cjs +1 -1
  18. package/dist/components/pop.js +1 -1
  19. package/dist/components/upload.cjs +1 -1
  20. package/dist/components/upload.js +1 -1
  21. package/dist/embed/socket.cjs +1 -1
  22. package/dist/embed/socket.js +1 -1
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.js +1 -1
  25. package/dist/react.cjs +1 -1
  26. package/dist/react.js +1 -1
  27. package/dist/themes/default.cjs +20 -48
  28. package/dist/themes/default.js +20 -48
  29. package/dist/themes/dolphin.cjs +30 -34
  30. package/dist/themes/dolphin.js +30 -34
  31. package/dist/themes/loader.cjs +1 -1
  32. package/dist/themes/loader.d.cts +4 -1
  33. package/dist/themes/loader.d.ts +4 -1
  34. package/dist/themes/loader.js +1 -1
  35. package/dist/themes/synthwave.cjs +23 -41
  36. package/dist/themes/synthwave.js +23 -41
  37. package/package.json +8 -8
  38. package/dist/chunk-AEGY4JNC.js +0 -1209
  39. package/dist/chunk-APKCPW3V.cjs +0 -1209
  40. package/dist/chunk-KTP5LV2E.cjs +0 -1
  41. package/dist/chunk-MAOTHFPC.js +0 -1
@@ -1,6 +1,6 @@
1
- 'use strict';var chunk4GTAVYTC_cjs=require('./chunk-4GTAVYTC.cjs'),chunkBRZI5I43_cjs=require('./chunk-BRZI5I43.cjs'),chunkQ22T22LT_cjs=require('./chunk-Q22T22LT.cjs'),chunkFUBUUA7Y_cjs=require('./chunk-FUBUUA7Y.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs'),chunk5STN56TL_cjs=require('./chunk-5STN56TL.cjs'),chunkIPA5Q26W_cjs=require('./chunk-IPA5Q26W.cjs');var Pt=chunkIPA5Q26W_cjs.a((ro,Et)=>{Et.exports=function(t,r){if(r=r.split(":")[0],t=+t,!t)return false;switch(r){case "http":case "ws":return t!==80;case "https":case "wss":return t!==443;case "ftp":return t!==21;case "gopher":return t!==70;case "file":return false}return t!==0};});var Rt=chunkIPA5Q26W_cjs.a(Te=>{var Wr=Object.prototype.hasOwnProperty,Xr;function Ot(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function kt(e){try{return encodeURIComponent(e)}catch{return null}}function Yr(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var o=Ot(n[1]),s=Ot(n[2]);o===null||s===null||o in r||(r[o]=s);}return r}function Zr(e,t){t=t||"";var r=[],n,o;typeof t!="string"&&(t="?");for(o in e)if(Wr.call(e,o)){if(n=e[o],!n&&(n===null||n===Xr||isNaN(n))&&(n=""),o=kt(o),n=kt(n),o===null||n===null)continue;r.push(o+"="+n);}return r.length?t+r.join("&"):""}Te.stringify=Zr;Te.parse=Yr;});var It=chunkIPA5Q26W_cjs.a((oo,Ft)=>{var Ct=Pt(),ge=Rt(),Vr=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Lt=/[\n\r\t]/g,Jr=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Tt=/:\d+$/,Qr=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,en=/^[a-zA-Z]:/;function De(e){return (e||"").toString().replace(Vr,"")}var Ae=[["#","hash"],["?","query"],function(t,r){return A(r.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],jt={hash:1,query:1};function At(e){var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t={};var r=t.location||{};e=e||r;var n={},o=typeof e,s;if(e.protocol==="blob:")n=new D(unescape(e.pathname),{});else if(o==="string"){n=new D(e,{});for(s in jt)delete n[s];}else if(o==="object"){for(s in e)s in jt||(n[s]=e[s]);n.slashes===void 0&&(n.slashes=Jr.test(e.href));}return n}function A(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function Dt(e,t){e=De(e),e=e.replace(Lt,""),t=t||{};var r=Qr.exec(e),n=r[1]?r[1].toLowerCase():"",o=!!r[2],s=!!r[3],l=0,p;return o?s?(p=r[2]+r[3]+r[4],l=r[2].length+r[3].length):(p=r[2]+r[4],l=r[2].length):s?(p=r[3]+r[4],l=r[3].length):p=r[4],n==="file:"?l>=2&&(p=p.slice(2)):A(n)?p=r[4]:n?o&&(p=p.slice(2)):l>=2&&A(t.protocol)&&(p=r[4]),{protocol:n,slashes:o||A(n),slashesCount:l,rest:p}}function tn(e,t){if(e==="")return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],s=false,l=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),l++):l&&(n===0&&(s=true),r.splice(n,1),l--);return s&&r.unshift(""),(o==="."||o==="..")&&r.push(""),r.join("/")}function D(e,t,r){if(e=De(e),e=e.replace(Lt,""),!(this instanceof D))return new D(e,t,r);var n,o,s,l,p,h,m=Ae.slice(),g=typeof t,y=this,j=0;for(g!=="object"&&g!=="string"&&(r=t,t=null),r&&typeof r!="function"&&(r=ge.parse),t=At(t),o=Dt(e||"",t),n=!o.protocol&&!o.slashes,y.slashes=o.slashes||n&&t.slashes,y.protocol=o.protocol||t.protocol||"",e=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||en.test(e))||!o.slashes&&(o.protocol||o.slashesCount<2||!A(y.protocol)))&&(m[3]=[/(.*)/,"pathname"]);j<m.length;j++){if(l=m[j],typeof l=="function"){e=l(e,y);continue}s=l[0],h=l[1],s!==s?y[h]=e:typeof s=="string"?(p=s==="@"?e.lastIndexOf(s):e.indexOf(s),~p&&(typeof l[2]=="number"?(y[h]=e.slice(0,p),e=e.slice(p+l[2])):(y[h]=e.slice(p),e=e.slice(0,p)))):(p=s.exec(e))&&(y[h]=p[1],e=e.slice(0,p.index)),y[h]=y[h]||n&&l[3]&&t[h]||"",l[4]&&(y[h]=y[h].toLowerCase());}r&&(y.query=r(y.query)),n&&t.slashes&&y.pathname.charAt(0)!=="/"&&(y.pathname!==""||t.pathname!=="")&&(y.pathname=tn(y.pathname,t.pathname)),y.pathname.charAt(0)!=="/"&&A(y.protocol)&&(y.pathname="/"+y.pathname),Ct(y.port,y.protocol)||(y.host=y.hostname,y.port=""),y.username=y.password="",y.auth&&(p=y.auth.indexOf(":"),~p?(y.username=y.auth.slice(0,p),y.username=encodeURIComponent(decodeURIComponent(y.username)),y.password=y.auth.slice(p+1),y.password=encodeURIComponent(decodeURIComponent(y.password))):y.username=encodeURIComponent(decodeURIComponent(y.auth)),y.auth=y.password?y.username+":"+y.password:y.username),y.origin=y.protocol!=="file:"&&A(y.protocol)&&y.host?y.protocol+"//"+y.host:"null",y.href=y.toString();}function rn(e,t,r){var n=this;switch(e){case "query":typeof t=="string"&&t.length&&(t=(r||ge.parse)(t)),n[e]=t;break;case "port":n[e]=t,Ct(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case "hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case "host":n[e]=t,Tt.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case "protocol":n.protocol=t.toLowerCase(),n.slashes=!r;break;case "pathname":case "hash":if(t){var o=e==="pathname"?"/":"#";n[e]=t.charAt(0)!==o?o+t:t;}else n[e]=t;break;case "username":case "password":n[e]=encodeURIComponent(t);break;case "auth":var s=t.indexOf(":");~s?(n.username=t.slice(0,s),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=t.slice(s+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(t));}for(var l=0;l<Ae.length;l++){var p=Ae[l];p[4]&&(n[p[1]]=n[p[1]].toLowerCase());}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&A(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function nn(e){(!e||typeof e!="function")&&(e=ge.stringify);var t,r=this,n=r.host,o=r.protocol;o&&o.charAt(o.length-1)!==":"&&(o+=":");var s=o+(r.protocol&&r.slashes||A(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):r.protocol!=="file:"&&A(r.protocol)&&!n&&r.pathname!=="/"&&(s+="@"),(n[n.length-1]===":"||Tt.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,t=typeof r.query=="object"?e(r.query):r.query,t&&(s+=t.charAt(0)!=="?"?"?"+t:t),r.hash&&(s+=r.hash),s}D.prototype={set:rn,toString:nn};D.extractProtocol=Dt;D.location=At;D.trimLeft=De;D.qs=ge;Ft.exports=D;});function Z(e){"@babel/helpers - typeof";return Z=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Z(e)}function br(e,t,r){return Object.defineProperty(e,"prototype",{writable:false}),e}function xr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sr(e,t,r){return t=ue(t),Ur(e,ke()?Reflect.construct(t,r||[],ue(e).constructor):t.apply(e,r))}function Ur(e,t){if(t&&(Z(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Er(e)}function Er(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}}),Object.defineProperty(e,"prototype",{writable:false}),t&&se(e,t);}function Oe(e){var t=typeof Map=="function"?new Map:void 0;return Oe=function(n){if(n===null||!kr(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(n))return t.get(n);t.set(n,o);}function o(){return Or(n,arguments,ue(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:false,writable:true,configurable:true}}),se(o,n)},Oe(e)}function Or(e,t,r){if(ke())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var o=new(e.bind.apply(e,n));return r&&se(o,r.prototype),o}function ke(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch{}return (ke=function(){return !!e})()}function kr(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function se(e,t){return se=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},se(e,t)}function ue(e){return ue=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ue(e)}var Rr=function(e){function t(r){var n,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(xr(this,t),n=Sr(this,t,[r]),n.originalRequest=s,n.originalResponse=l,n.causingError=o,o!=null&&(r+=", caused by ".concat(o.toString())),s!=null){var p=s.getHeader("X-Request-ID")||"n/a",h=s.getMethod(),m=s.getURL(),g=l?l.getStatus():"n/a",y=l?l.getBody()||"":"n/a";r+=", originated from request (method: ".concat(h,", url: ").concat(m,", response code: ").concat(g,", response text: ").concat(y,", request id: ").concat(p,")");}return n.message=r,n}return Pr(t,e),br(t)}(Oe(Error)),V=Rr;function z(e){}function le(e){"@babel/helpers - typeof";return le=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},le(e)}function Cr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ot(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Tr(n.key),n);}}function Lr(e,t,r){return t&&ot(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Tr(e){var t=Ar(e,"string");return le(t)=="symbol"?t:t+""}function Ar(e,t){if(le(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(le(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var it=function(){function e(){Cr(this,e);}return Lr(e,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(r){return Promise.resolve([])}},{key:"removeUpload",value:function(r){return Promise.resolve()}},{key:"addUpload",value:function(r,n){return Promise.resolve(null)}}])}();var ct="3.7.5",Dr=ct,Fr=typeof atob=="function",Ir=typeof btoa=="function",Q=typeof Buffer=="function",at=typeof TextDecoder=="function"?new TextDecoder:void 0,st=typeof TextEncoder=="function"?new TextEncoder:void 0,Nr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",fe=Array.prototype.slice.call(Nr),me=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(fe),Br=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,U=String.fromCharCode.bind(String),ut=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),pt=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),ht=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),dt=e=>{let t,r,n,o,s="",l=e.length%3;for(let p=0;p<e.length;){if((r=e.charCodeAt(p++))>255||(n=e.charCodeAt(p++))>255||(o=e.charCodeAt(p++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|o,s+=fe[t>>18&63]+fe[t>>12&63]+fe[t>>6&63]+fe[t&63];}return l?s.slice(0,l-3)+"===".substring(l):s},Ce=Ir?e=>btoa(e):Q?e=>Buffer.from(e,"binary").toString("base64"):dt,Re=Q?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,o=e.length;n<o;n+=4096)r.push(U.apply(null,e.subarray(n,n+4096)));return Ce(r.join(""))},ve=(e,t=false)=>t?pt(Re(e)):Re(e),zr=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?U(192|t>>>6)+U(128|t&63):U(224|t>>>12&15)+U(128|t>>>6&63)+U(128|t&63)}else {var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return U(240|t>>>18&7)+U(128|t>>>12&63)+U(128|t>>>6&63)+U(128|t&63)}},Hr=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,yt=e=>e.replace(Hr,zr),lt=Q?e=>Buffer.from(e,"utf8").toString("base64"):st?e=>Re(st.encode(e)):e=>Ce(yt(e)),J=(e,t=false)=>t?pt(lt(e)):lt(e),ft=e=>J(e,true),qr=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Mr=e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return U((r>>>10)+55296)+U((r&1023)+56320);case 3:return U((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return U((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},mt=e=>e.replace(qr,Mr),vt=e=>{if(e=e.replace(/\s+/g,""),!Br.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r="",n,o;for(let s=0;s<e.length;)t=me[e.charAt(s++)]<<18|me[e.charAt(s++)]<<12|(n=me[e.charAt(s++)])<<6|(o=me[e.charAt(s++)]),r+=n===64?U(t>>16&255):o===64?U(t>>16&255,t>>8&255):U(t>>16&255,t>>8&255,t&255);return r},Le=Fr?e=>atob(ht(e)):Q?e=>Buffer.from(e,"base64").toString("binary"):vt,gt=Q?e=>ut(Buffer.from(e,"base64")):e=>ut(Le(e).split("").map(t=>t.charCodeAt(0))),bt=e=>gt(_t(e)),Gr=Q?e=>Buffer.from(e,"base64").toString("utf8"):at?e=>at.decode(gt(e)):e=>mt(Le(e)),_t=e=>ht(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),je=e=>Gr(_t(e)),Kr=e=>{if(typeof e!="string")return false;let t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return !/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},wt=e=>({value:e,enumerable:false,writable:true,configurable:true}),xt=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,wt(r));e("fromBase64",function(){return je(this)}),e("toBase64",function(t){return J(this,t)}),e("toBase64URI",function(){return J(this,true)}),e("toBase64URL",function(){return J(this,true)}),e("toUint8Array",function(){return bt(this)});},St=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,wt(r));e("toBase64",function(t){return ve(this,t)}),e("toBase64URI",function(){return ve(this,true)}),e("toBase64URL",function(){return ve(this,true)});},$r=()=>{xt(),St();},Ut={version:ct,VERSION:Dr,atob:Le,atobPolyfill:vt,btoa:Ce,btoaPolyfill:dt,fromBase64:je,toBase64:J,encode:J,encodeURI:ft,encodeURL:ft,utob:yt,btou:mt,decode:je,isValid:Kr,fromUint8Array:ve,toUint8Array:bt,extendString:xt,extendUint8Array:St,extendBuiltins:$r};var Zt=chunkIPA5Q26W_cjs.b(It());function Fe(){return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=Math.random()*16|0,r=e==="x"?t:t&3|8;return r.toString(16)})}function Ie(){Ie=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(u,i,a){u[i]=a.value;},s=typeof Symbol=="function"?Symbol:{},l=s.iterator||"@@iterator",p=s.asyncIterator||"@@asyncIterator",h=s.toStringTag||"@@toStringTag";function m(u,i,a){return Object.defineProperty(u,i,{value:a,enumerable:true,configurable:true,writable:true}),u[i]}try{m({},"");}catch{m=function(a,f,d){return a[f]=d};}function g(u,i,a,f){var d=i&&i.prototype instanceof F?i:F,c=Object.create(d.prototype),v=new G(f||[]);return o(c,"_invoke",{value:Ue(u,a,v)}),c}function y(u,i,a){try{return {type:"normal",arg:u.call(i,a)}}catch(f){return {type:"throw",arg:f}}}t.wrap=g;var j="suspendedStart",oe="suspendedYield",H="executing",L="completed",w={};function F(){}function k(){}function x(){}var C={};m(C,l,function(){return this});var q=Object.getPrototypeOf,I=q&&q(q(K([])));I&&I!==r&&n.call(I,l)&&(C=I);var R=x.prototype=F.prototype=Object.create(C);function ie(u){["next","throw","return"].forEach(function(i){m(u,i,function(a){return this._invoke(i,a)});});}function N(u,i){function a(d,c,v,b){var _=y(u[d],u,c);if(_.type!=="throw"){var E=_.arg,S=E.value;return S&&X(S)=="object"&&n.call(S,"__await")?i.resolve(S.__await).then(function(P){a("next",P,v,b);},function(P){a("throw",P,v,b);}):i.resolve(S).then(function(P){E.value=P,v(E);},function(P){return a("throw",P,v,b)})}b(_.arg);}var f;o(this,"_invoke",{value:function(c,v){function b(){return new i(function(_,E){a(c,v,_,E);})}return f=f?f.then(b,b):b()}});}function Ue(u,i,a){var f=j;return function(d,c){if(f===H)throw Error("Generator is already running");if(f===L){if(d==="throw")throw c;return {value:e,done:true}}for(a.method=d,a.arg=c;;){var v=a.delegate;if(v){var b=ae(v,a);if(b){if(b===w)continue;return b}}if(a.method==="next")a.sent=a._sent=a.arg;else if(a.method==="throw"){if(f===j)throw f=L,a.arg;a.dispatchException(a.arg);}else a.method==="return"&&a.abrupt("return",a.arg);f=H;var _=y(u,i,a);if(_.type==="normal"){if(f=a.done?L:oe,_.arg===w)continue;return {value:_.arg,done:a.done}}_.type==="throw"&&(f=L,a.method="throw",a.arg=_.arg);}}}function ae(u,i){var a=i.method,f=u.iterator[a];if(f===e)return i.delegate=null,a==="throw"&&u.iterator.return&&(i.method="return",i.arg=e,ae(u,i),i.method==="throw")||a!=="return"&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+a+"' method")),w;var d=y(f,u.iterator,i.arg);if(d.type==="throw")return i.method="throw",i.arg=d.arg,i.delegate=null,w;var c=d.arg;return c?c.done?(i[u.resultName]=c.value,i.next=u.nextLoc,i.method!=="return"&&(i.method="next",i.arg=e),i.delegate=null,w):c:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,w)}function Ee(u){var i={tryLoc:u[0]};1 in u&&(i.catchLoc=u[1]),2 in u&&(i.finallyLoc=u[2],i.afterLoc=u[3]),this.tryEntries.push(i);}function M(u){var i=u.completion||{};i.type="normal",delete i.arg,u.completion=i;}function G(u){this.tryEntries=[{tryLoc:"root"}],u.forEach(Ee,this),this.reset(true);}function K(u){if(u||u===""){var i=u[l];if(i)return i.call(u);if(typeof u.next=="function")return u;if(!isNaN(u.length)){var a=-1,f=function d(){for(;++a<u.length;)if(n.call(u,a))return d.value=u[a],d.done=false,d;return d.value=e,d.done=true,d};return f.next=f}}throw new TypeError(X(u)+" is not iterable")}return k.prototype=x,o(R,"constructor",{value:x,configurable:true}),o(x,"constructor",{value:k,configurable:true}),k.displayName=m(x,h,"GeneratorFunction"),t.isGeneratorFunction=function(u){var i=typeof u=="function"&&u.constructor;return !!i&&(i===k||(i.displayName||i.name)==="GeneratorFunction")},t.mark=function(u){return Object.setPrototypeOf?Object.setPrototypeOf(u,x):(u.__proto__=x,m(u,h,"GeneratorFunction")),u.prototype=Object.create(R),u},t.awrap=function(u){return {__await:u}},ie(N.prototype),m(N.prototype,p,function(){return this}),t.AsyncIterator=N,t.async=function(u,i,a,f,d){d===void 0&&(d=Promise);var c=new N(g(u,i,a,f),d);return t.isGeneratorFunction(i)?c:c.next().then(function(v){return v.done?v.value:c.next()})},ie(R),m(R,h,"Generator"),m(R,l,function(){return this}),m(R,"toString",function(){return "[object Generator]"}),t.keys=function(u){var i=Object(u),a=[];for(var f in i)a.push(f);return a.reverse(),function d(){for(;a.length;){var c=a.pop();if(c in i)return d.value=c,d.done=false,d}return d.done=true,d}},t.values=K,G.prototype={constructor:G,reset:function(i){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=false,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(M),!i)for(var a in this)a.charAt(0)==="t"&&n.call(this,a)&&!isNaN(+a.slice(1))&&(this[a]=e);},stop:function(){this.done=true;var i=this.tryEntries[0].completion;if(i.type==="throw")throw i.arg;return this.rval},dispatchException:function(i){if(this.done)throw i;var a=this;function f(E,S){return v.type="throw",v.arg=i,a.next=E,S&&(a.method="next",a.arg=e),!!S}for(var d=this.tryEntries.length-1;d>=0;--d){var c=this.tryEntries[d],v=c.completion;if(c.tryLoc==="root")return f("end");if(c.tryLoc<=this.prev){var b=n.call(c,"catchLoc"),_=n.call(c,"finallyLoc");if(b&&_){if(this.prev<c.catchLoc)return f(c.catchLoc,true);if(this.prev<c.finallyLoc)return f(c.finallyLoc)}else if(b){if(this.prev<c.catchLoc)return f(c.catchLoc,true)}else {if(!_)throw Error("try statement without catch or finally");if(this.prev<c.finallyLoc)return f(c.finallyLoc)}}}},abrupt:function(i,a){for(var f=this.tryEntries.length-1;f>=0;--f){var d=this.tryEntries[f];if(d.tryLoc<=this.prev&&n.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var c=d;break}}c&&(i==="break"||i==="continue")&&c.tryLoc<=a&&a<=c.finallyLoc&&(c=null);var v=c?c.completion:{};return v.type=i,v.arg=a,c?(this.method="next",this.next=c.finallyLoc,w):this.complete(v)},complete:function(i,a){if(i.type==="throw")throw i.arg;return i.type==="break"||i.type==="continue"?this.next=i.arg:i.type==="return"?(this.rval=this.arg=i.arg,this.method="return",this.next="end"):i.type==="normal"&&a&&(this.next=a),w},finish:function(i){for(var a=this.tryEntries.length-1;a>=0;--a){var f=this.tryEntries[a];if(f.finallyLoc===i)return this.complete(f.completion,f.afterLoc),M(f),w}},catch:function(i){for(var a=this.tryEntries.length-1;a>=0;--a){var f=this.tryEntries[a];if(f.tryLoc===i){var d=f.completion;if(d.type==="throw"){var c=d.arg;M(f);}return c}}throw Error("illegal catch attempt")},delegateYield:function(i,a,f){return this.delegate={iterator:K(i),resultName:a,nextLoc:f},this.method==="next"&&(this.arg=e),w}},t}function Nt(e,t,r,n,o,s,l){try{var p=e[s](l),h=p.value;}catch(m){r(m);return}p.done?t(h):Promise.resolve(h).then(n,o);}function on(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var s=e.apply(t,r);function l(h){Nt(s,n,o,l,p,"next",h);}function p(h){Nt(s,n,o,l,p,"throw",h);}l(void 0);})}}function Wt(e,t){return un(e)||sn(e,t)||Xt(e,t)||an()}function an(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ 'use strict';var chunk4GTAVYTC_cjs=require('./chunk-4GTAVYTC.cjs'),chunk2P6HF22Q_cjs=require('./chunk-2P6HF22Q.cjs'),chunkQ22T22LT_cjs=require('./chunk-Q22T22LT.cjs'),chunkFUBUUA7Y_cjs=require('./chunk-FUBUUA7Y.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs'),chunk5STN56TL_cjs=require('./chunk-5STN56TL.cjs'),chunkIPA5Q26W_cjs=require('./chunk-IPA5Q26W.cjs');var Pt=chunkIPA5Q26W_cjs.a((ro,Et)=>{Et.exports=function(t,r){if(r=r.split(":")[0],t=+t,!t)return false;switch(r){case "http":case "ws":return t!==80;case "https":case "wss":return t!==443;case "ftp":return t!==21;case "gopher":return t!==70;case "file":return false}return t!==0};});var Rt=chunkIPA5Q26W_cjs.a(Te=>{var Wr=Object.prototype.hasOwnProperty,Xr;function Ot(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function kt(e){try{return encodeURIComponent(e)}catch{return null}}function Yr(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var o=Ot(n[1]),s=Ot(n[2]);o===null||s===null||o in r||(r[o]=s);}return r}function Zr(e,t){t=t||"";var r=[],n,o;typeof t!="string"&&(t="?");for(o in e)if(Wr.call(e,o)){if(n=e[o],!n&&(n===null||n===Xr||isNaN(n))&&(n=""),o=kt(o),n=kt(n),o===null||n===null)continue;r.push(o+"="+n);}return r.length?t+r.join("&"):""}Te.stringify=Zr;Te.parse=Yr;});var It=chunkIPA5Q26W_cjs.a((oo,Ft)=>{var Ct=Pt(),ge=Rt(),Vr=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Lt=/[\n\r\t]/g,Jr=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Tt=/:\d+$/,Qr=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,en=/^[a-zA-Z]:/;function De(e){return (e||"").toString().replace(Vr,"")}var Ae=[["#","hash"],["?","query"],function(t,r){return A(r.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],jt={hash:1,query:1};function At(e){var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t={};var r=t.location||{};e=e||r;var n={},o=typeof e,s;if(e.protocol==="blob:")n=new D(unescape(e.pathname),{});else if(o==="string"){n=new D(e,{});for(s in jt)delete n[s];}else if(o==="object"){for(s in e)s in jt||(n[s]=e[s]);n.slashes===void 0&&(n.slashes=Jr.test(e.href));}return n}function A(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function Dt(e,t){e=De(e),e=e.replace(Lt,""),t=t||{};var r=Qr.exec(e),n=r[1]?r[1].toLowerCase():"",o=!!r[2],s=!!r[3],l=0,p;return o?s?(p=r[2]+r[3]+r[4],l=r[2].length+r[3].length):(p=r[2]+r[4],l=r[2].length):s?(p=r[3]+r[4],l=r[3].length):p=r[4],n==="file:"?l>=2&&(p=p.slice(2)):A(n)?p=r[4]:n?o&&(p=p.slice(2)):l>=2&&A(t.protocol)&&(p=r[4]),{protocol:n,slashes:o||A(n),slashesCount:l,rest:p}}function tn(e,t){if(e==="")return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],s=false,l=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),l++):l&&(n===0&&(s=true),r.splice(n,1),l--);return s&&r.unshift(""),(o==="."||o==="..")&&r.push(""),r.join("/")}function D(e,t,r){if(e=De(e),e=e.replace(Lt,""),!(this instanceof D))return new D(e,t,r);var n,o,s,l,p,h,m=Ae.slice(),g=typeof t,y=this,j=0;for(g!=="object"&&g!=="string"&&(r=t,t=null),r&&typeof r!="function"&&(r=ge.parse),t=At(t),o=Dt(e||"",t),n=!o.protocol&&!o.slashes,y.slashes=o.slashes||n&&t.slashes,y.protocol=o.protocol||t.protocol||"",e=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||en.test(e))||!o.slashes&&(o.protocol||o.slashesCount<2||!A(y.protocol)))&&(m[3]=[/(.*)/,"pathname"]);j<m.length;j++){if(l=m[j],typeof l=="function"){e=l(e,y);continue}s=l[0],h=l[1],s!==s?y[h]=e:typeof s=="string"?(p=s==="@"?e.lastIndexOf(s):e.indexOf(s),~p&&(typeof l[2]=="number"?(y[h]=e.slice(0,p),e=e.slice(p+l[2])):(y[h]=e.slice(p),e=e.slice(0,p)))):(p=s.exec(e))&&(y[h]=p[1],e=e.slice(0,p.index)),y[h]=y[h]||n&&l[3]&&t[h]||"",l[4]&&(y[h]=y[h].toLowerCase());}r&&(y.query=r(y.query)),n&&t.slashes&&y.pathname.charAt(0)!=="/"&&(y.pathname!==""||t.pathname!=="")&&(y.pathname=tn(y.pathname,t.pathname)),y.pathname.charAt(0)!=="/"&&A(y.protocol)&&(y.pathname="/"+y.pathname),Ct(y.port,y.protocol)||(y.host=y.hostname,y.port=""),y.username=y.password="",y.auth&&(p=y.auth.indexOf(":"),~p?(y.username=y.auth.slice(0,p),y.username=encodeURIComponent(decodeURIComponent(y.username)),y.password=y.auth.slice(p+1),y.password=encodeURIComponent(decodeURIComponent(y.password))):y.username=encodeURIComponent(decodeURIComponent(y.auth)),y.auth=y.password?y.username+":"+y.password:y.username),y.origin=y.protocol!=="file:"&&A(y.protocol)&&y.host?y.protocol+"//"+y.host:"null",y.href=y.toString();}function rn(e,t,r){var n=this;switch(e){case "query":typeof t=="string"&&t.length&&(t=(r||ge.parse)(t)),n[e]=t;break;case "port":n[e]=t,Ct(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case "hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case "host":n[e]=t,Tt.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case "protocol":n.protocol=t.toLowerCase(),n.slashes=!r;break;case "pathname":case "hash":if(t){var o=e==="pathname"?"/":"#";n[e]=t.charAt(0)!==o?o+t:t;}else n[e]=t;break;case "username":case "password":n[e]=encodeURIComponent(t);break;case "auth":var s=t.indexOf(":");~s?(n.username=t.slice(0,s),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=t.slice(s+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(t));}for(var l=0;l<Ae.length;l++){var p=Ae[l];p[4]&&(n[p[1]]=n[p[1]].toLowerCase());}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&A(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function nn(e){(!e||typeof e!="function")&&(e=ge.stringify);var t,r=this,n=r.host,o=r.protocol;o&&o.charAt(o.length-1)!==":"&&(o+=":");var s=o+(r.protocol&&r.slashes||A(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):r.protocol!=="file:"&&A(r.protocol)&&!n&&r.pathname!=="/"&&(s+="@"),(n[n.length-1]===":"||Tt.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,t=typeof r.query=="object"?e(r.query):r.query,t&&(s+=t.charAt(0)!=="?"?"?"+t:t),r.hash&&(s+=r.hash),s}D.prototype={set:rn,toString:nn};D.extractProtocol=Dt;D.location=At;D.trimLeft=De;D.qs=ge;Ft.exports=D;});function Z(e){"@babel/helpers - typeof";return Z=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Z(e)}function br(e,t,r){return Object.defineProperty(e,"prototype",{writable:false}),e}function xr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sr(e,t,r){return t=ue(t),Ur(e,ke()?Reflect.construct(t,r||[],ue(e).constructor):t.apply(e,r))}function Ur(e,t){if(t&&(Z(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Er(e)}function Er(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}}),Object.defineProperty(e,"prototype",{writable:false}),t&&se(e,t);}function Oe(e){var t=typeof Map=="function"?new Map:void 0;return Oe=function(n){if(n===null||!kr(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(n))return t.get(n);t.set(n,o);}function o(){return Or(n,arguments,ue(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:false,writable:true,configurable:true}}),se(o,n)},Oe(e)}function Or(e,t,r){if(ke())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var o=new(e.bind.apply(e,n));return r&&se(o,r.prototype),o}function ke(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch{}return (ke=function(){return !!e})()}function kr(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function se(e,t){return se=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},se(e,t)}function ue(e){return ue=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ue(e)}var Rr=function(e){function t(r){var n,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(xr(this,t),n=Sr(this,t,[r]),n.originalRequest=s,n.originalResponse=l,n.causingError=o,o!=null&&(r+=", caused by ".concat(o.toString())),s!=null){var p=s.getHeader("X-Request-ID")||"n/a",h=s.getMethod(),m=s.getURL(),g=l?l.getStatus():"n/a",y=l?l.getBody()||"":"n/a";r+=", originated from request (method: ".concat(h,", url: ").concat(m,", response code: ").concat(g,", response text: ").concat(y,", request id: ").concat(p,")");}return n.message=r,n}return Pr(t,e),br(t)}(Oe(Error)),V=Rr;function z(e){}function le(e){"@babel/helpers - typeof";return le=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},le(e)}function Cr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ot(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Tr(n.key),n);}}function Lr(e,t,r){return t&&ot(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Tr(e){var t=Ar(e,"string");return le(t)=="symbol"?t:t+""}function Ar(e,t){if(le(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(le(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var it=function(){function e(){Cr(this,e);}return Lr(e,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(r){return Promise.resolve([])}},{key:"removeUpload",value:function(r){return Promise.resolve()}},{key:"addUpload",value:function(r,n){return Promise.resolve(null)}}])}();var ct="3.7.5",Dr=ct,Fr=typeof atob=="function",Ir=typeof btoa=="function",Q=typeof Buffer=="function",at=typeof TextDecoder=="function"?new TextDecoder:void 0,st=typeof TextEncoder=="function"?new TextEncoder:void 0,Nr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",fe=Array.prototype.slice.call(Nr),me=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(fe),Br=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,U=String.fromCharCode.bind(String),ut=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),pt=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),ht=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),dt=e=>{let t,r,n,o,s="",l=e.length%3;for(let p=0;p<e.length;){if((r=e.charCodeAt(p++))>255||(n=e.charCodeAt(p++))>255||(o=e.charCodeAt(p++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|o,s+=fe[t>>18&63]+fe[t>>12&63]+fe[t>>6&63]+fe[t&63];}return l?s.slice(0,l-3)+"===".substring(l):s},Ce=Ir?e=>btoa(e):Q?e=>Buffer.from(e,"binary").toString("base64"):dt,Re=Q?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,o=e.length;n<o;n+=4096)r.push(U.apply(null,e.subarray(n,n+4096)));return Ce(r.join(""))},ve=(e,t=false)=>t?pt(Re(e)):Re(e),zr=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?U(192|t>>>6)+U(128|t&63):U(224|t>>>12&15)+U(128|t>>>6&63)+U(128|t&63)}else {var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return U(240|t>>>18&7)+U(128|t>>>12&63)+U(128|t>>>6&63)+U(128|t&63)}},Hr=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,yt=e=>e.replace(Hr,zr),lt=Q?e=>Buffer.from(e,"utf8").toString("base64"):st?e=>Re(st.encode(e)):e=>Ce(yt(e)),J=(e,t=false)=>t?pt(lt(e)):lt(e),ft=e=>J(e,true),qr=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Mr=e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return U((r>>>10)+55296)+U((r&1023)+56320);case 3:return U((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return U((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},mt=e=>e.replace(qr,Mr),vt=e=>{if(e=e.replace(/\s+/g,""),!Br.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r="",n,o;for(let s=0;s<e.length;)t=me[e.charAt(s++)]<<18|me[e.charAt(s++)]<<12|(n=me[e.charAt(s++)])<<6|(o=me[e.charAt(s++)]),r+=n===64?U(t>>16&255):o===64?U(t>>16&255,t>>8&255):U(t>>16&255,t>>8&255,t&255);return r},Le=Fr?e=>atob(ht(e)):Q?e=>Buffer.from(e,"base64").toString("binary"):vt,gt=Q?e=>ut(Buffer.from(e,"base64")):e=>ut(Le(e).split("").map(t=>t.charCodeAt(0))),bt=e=>gt(_t(e)),Gr=Q?e=>Buffer.from(e,"base64").toString("utf8"):at?e=>at.decode(gt(e)):e=>mt(Le(e)),_t=e=>ht(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),je=e=>Gr(_t(e)),Kr=e=>{if(typeof e!="string")return false;let t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return !/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},wt=e=>({value:e,enumerable:false,writable:true,configurable:true}),xt=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,wt(r));e("fromBase64",function(){return je(this)}),e("toBase64",function(t){return J(this,t)}),e("toBase64URI",function(){return J(this,true)}),e("toBase64URL",function(){return J(this,true)}),e("toUint8Array",function(){return bt(this)});},St=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,wt(r));e("toBase64",function(t){return ve(this,t)}),e("toBase64URI",function(){return ve(this,true)}),e("toBase64URL",function(){return ve(this,true)});},$r=()=>{xt(),St();},Ut={version:ct,VERSION:Dr,atob:Le,atobPolyfill:vt,btoa:Ce,btoaPolyfill:dt,fromBase64:je,toBase64:J,encode:J,encodeURI:ft,encodeURL:ft,utob:yt,btou:mt,decode:je,isValid:Kr,fromUint8Array:ve,toUint8Array:bt,extendString:xt,extendUint8Array:St,extendBuiltins:$r};var Zt=chunkIPA5Q26W_cjs.b(It());function Fe(){return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=Math.random()*16|0,r=e==="x"?t:t&3|8;return r.toString(16)})}function Ie(){Ie=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(u,i,a){u[i]=a.value;},s=typeof Symbol=="function"?Symbol:{},l=s.iterator||"@@iterator",p=s.asyncIterator||"@@asyncIterator",h=s.toStringTag||"@@toStringTag";function m(u,i,a){return Object.defineProperty(u,i,{value:a,enumerable:true,configurable:true,writable:true}),u[i]}try{m({},"");}catch{m=function(a,f,d){return a[f]=d};}function g(u,i,a,f){var d=i&&i.prototype instanceof F?i:F,c=Object.create(d.prototype),v=new G(f||[]);return o(c,"_invoke",{value:Ue(u,a,v)}),c}function y(u,i,a){try{return {type:"normal",arg:u.call(i,a)}}catch(f){return {type:"throw",arg:f}}}t.wrap=g;var j="suspendedStart",oe="suspendedYield",H="executing",L="completed",w={};function F(){}function k(){}function x(){}var C={};m(C,l,function(){return this});var q=Object.getPrototypeOf,I=q&&q(q(K([])));I&&I!==r&&n.call(I,l)&&(C=I);var R=x.prototype=F.prototype=Object.create(C);function ie(u){["next","throw","return"].forEach(function(i){m(u,i,function(a){return this._invoke(i,a)});});}function N(u,i){function a(d,c,v,b){var _=y(u[d],u,c);if(_.type!=="throw"){var E=_.arg,S=E.value;return S&&X(S)=="object"&&n.call(S,"__await")?i.resolve(S.__await).then(function(P){a("next",P,v,b);},function(P){a("throw",P,v,b);}):i.resolve(S).then(function(P){E.value=P,v(E);},function(P){return a("throw",P,v,b)})}b(_.arg);}var f;o(this,"_invoke",{value:function(c,v){function b(){return new i(function(_,E){a(c,v,_,E);})}return f=f?f.then(b,b):b()}});}function Ue(u,i,a){var f=j;return function(d,c){if(f===H)throw Error("Generator is already running");if(f===L){if(d==="throw")throw c;return {value:e,done:true}}for(a.method=d,a.arg=c;;){var v=a.delegate;if(v){var b=ae(v,a);if(b){if(b===w)continue;return b}}if(a.method==="next")a.sent=a._sent=a.arg;else if(a.method==="throw"){if(f===j)throw f=L,a.arg;a.dispatchException(a.arg);}else a.method==="return"&&a.abrupt("return",a.arg);f=H;var _=y(u,i,a);if(_.type==="normal"){if(f=a.done?L:oe,_.arg===w)continue;return {value:_.arg,done:a.done}}_.type==="throw"&&(f=L,a.method="throw",a.arg=_.arg);}}}function ae(u,i){var a=i.method,f=u.iterator[a];if(f===e)return i.delegate=null,a==="throw"&&u.iterator.return&&(i.method="return",i.arg=e,ae(u,i),i.method==="throw")||a!=="return"&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+a+"' method")),w;var d=y(f,u.iterator,i.arg);if(d.type==="throw")return i.method="throw",i.arg=d.arg,i.delegate=null,w;var c=d.arg;return c?c.done?(i[u.resultName]=c.value,i.next=u.nextLoc,i.method!=="return"&&(i.method="next",i.arg=e),i.delegate=null,w):c:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,w)}function Ee(u){var i={tryLoc:u[0]};1 in u&&(i.catchLoc=u[1]),2 in u&&(i.finallyLoc=u[2],i.afterLoc=u[3]),this.tryEntries.push(i);}function M(u){var i=u.completion||{};i.type="normal",delete i.arg,u.completion=i;}function G(u){this.tryEntries=[{tryLoc:"root"}],u.forEach(Ee,this),this.reset(true);}function K(u){if(u||u===""){var i=u[l];if(i)return i.call(u);if(typeof u.next=="function")return u;if(!isNaN(u.length)){var a=-1,f=function d(){for(;++a<u.length;)if(n.call(u,a))return d.value=u[a],d.done=false,d;return d.value=e,d.done=true,d};return f.next=f}}throw new TypeError(X(u)+" is not iterable")}return k.prototype=x,o(R,"constructor",{value:x,configurable:true}),o(x,"constructor",{value:k,configurable:true}),k.displayName=m(x,h,"GeneratorFunction"),t.isGeneratorFunction=function(u){var i=typeof u=="function"&&u.constructor;return !!i&&(i===k||(i.displayName||i.name)==="GeneratorFunction")},t.mark=function(u){return Object.setPrototypeOf?Object.setPrototypeOf(u,x):(u.__proto__=x,m(u,h,"GeneratorFunction")),u.prototype=Object.create(R),u},t.awrap=function(u){return {__await:u}},ie(N.prototype),m(N.prototype,p,function(){return this}),t.AsyncIterator=N,t.async=function(u,i,a,f,d){d===void 0&&(d=Promise);var c=new N(g(u,i,a,f),d);return t.isGeneratorFunction(i)?c:c.next().then(function(v){return v.done?v.value:c.next()})},ie(R),m(R,h,"Generator"),m(R,l,function(){return this}),m(R,"toString",function(){return "[object Generator]"}),t.keys=function(u){var i=Object(u),a=[];for(var f in i)a.push(f);return a.reverse(),function d(){for(;a.length;){var c=a.pop();if(c in i)return d.value=c,d.done=false,d}return d.done=true,d}},t.values=K,G.prototype={constructor:G,reset:function(i){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=false,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(M),!i)for(var a in this)a.charAt(0)==="t"&&n.call(this,a)&&!isNaN(+a.slice(1))&&(this[a]=e);},stop:function(){this.done=true;var i=this.tryEntries[0].completion;if(i.type==="throw")throw i.arg;return this.rval},dispatchException:function(i){if(this.done)throw i;var a=this;function f(E,S){return v.type="throw",v.arg=i,a.next=E,S&&(a.method="next",a.arg=e),!!S}for(var d=this.tryEntries.length-1;d>=0;--d){var c=this.tryEntries[d],v=c.completion;if(c.tryLoc==="root")return f("end");if(c.tryLoc<=this.prev){var b=n.call(c,"catchLoc"),_=n.call(c,"finallyLoc");if(b&&_){if(this.prev<c.catchLoc)return f(c.catchLoc,true);if(this.prev<c.finallyLoc)return f(c.finallyLoc)}else if(b){if(this.prev<c.catchLoc)return f(c.catchLoc,true)}else {if(!_)throw Error("try statement without catch or finally");if(this.prev<c.finallyLoc)return f(c.finallyLoc)}}}},abrupt:function(i,a){for(var f=this.tryEntries.length-1;f>=0;--f){var d=this.tryEntries[f];if(d.tryLoc<=this.prev&&n.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var c=d;break}}c&&(i==="break"||i==="continue")&&c.tryLoc<=a&&a<=c.finallyLoc&&(c=null);var v=c?c.completion:{};return v.type=i,v.arg=a,c?(this.method="next",this.next=c.finallyLoc,w):this.complete(v)},complete:function(i,a){if(i.type==="throw")throw i.arg;return i.type==="break"||i.type==="continue"?this.next=i.arg:i.type==="return"?(this.rval=this.arg=i.arg,this.method="return",this.next="end"):i.type==="normal"&&a&&(this.next=a),w},finish:function(i){for(var a=this.tryEntries.length-1;a>=0;--a){var f=this.tryEntries[a];if(f.finallyLoc===i)return this.complete(f.completion,f.afterLoc),M(f),w}},catch:function(i){for(var a=this.tryEntries.length-1;a>=0;--a){var f=this.tryEntries[a];if(f.tryLoc===i){var d=f.completion;if(d.type==="throw"){var c=d.arg;M(f);}return c}}throw Error("illegal catch attempt")},delegateYield:function(i,a,f){return this.delegate={iterator:K(i),resultName:a,nextLoc:f},this.method==="next"&&(this.arg=e),w}},t}function Nt(e,t,r,n,o,s,l){try{var p=e[s](l),h=p.value;}catch(m){r(m);return}p.done?t(h):Promise.resolve(h).then(n,o);}function on(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var s=e.apply(t,r);function l(h){Nt(s,n,o,l,p,"next",h);}function p(h){Nt(s,n,o,l,p,"throw",h);}l(void 0);})}}function Wt(e,t){return un(e)||sn(e,t)||Xt(e,t)||an()}function an(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sn(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,s,l,p=[],h=true,m=false;try{if(s=(r=r.call(e)).next,t===0);else for(;!(h=(n=s.call(r)).done)&&(p.push(n.value),p.length!==t);h=!0);}catch(g){m=true,o=g;}finally{try{if(!h&&r.return!=null&&(l=r.return(),Object(l)!==l))return}finally{if(m)throw o}}return p}}function un(e){if(Array.isArray(e))return e}function X(e){"@babel/helpers - typeof";return X=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},X(e)}function ln(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Xt(e))||t){r&&(e=r);var n=0,o=function(){};return {s:o,n:function(){return n>=e.length?{done:true}:{done:false,value:e[n++]}},e:function(m){throw m},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=true,l=false,p;return {s:function(){r=r.call(e);},n:function(){var m=r.next();return s=m.done,m},e:function(m){l=true,p=m;},f:function(){try{!s&&r.return!=null&&r.return();}finally{if(l)throw p}}}}function Xt(e,t){if(e){if(typeof e=="string")return Bt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Bt(e,t)}}function Bt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function zt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n);}return r}function ee(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zt(Object(r),true).forEach(function(n){fn(e,n,r[n]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n));});}return e}function fn(e,t,r){return t=Yt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function cn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ht(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Yt(n.key),n);}}function pn(e,t,r){return t&&Ht(e.prototype,t),r&&Ht(e,r),Object.defineProperty(e,"prototype",{writable:false}),e}function Yt(e){var t=hn(e,"string");return X(t)=="symbol"?t:t+""}function hn(e,t){if(X(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(X(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var Ne="tus-v1",be="ietf-draft-03",dn={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:false,headers:{},addRequestId:false,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:Jt,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:true,removeFingerprintOnSuccess:false,uploadLengthDeferred:false,uploadDataDuringCreation:false,urlStorage:null,fileReader:null,httpStack:null,protocol:Ne},Vt=function(){function e(t,r){cn(this,e),"resume"in r&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=r,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=t,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=false,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null;}return pn(e,[{key:"findPreviousUploads",value:function(){var r=this;return this.options.fingerprint(this.file,this.options).then(function(n){return r._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(r){this.url=r.uploadUrl||null,this._parallelUploadUrls=r.parallelUploadUrls||null,this._urlStorageKey=r.urlStorageKey;}},{key:"start",value:function(){var r=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![Ne,be].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var o=this.options.retryDelays;if(o!=null&&Object.prototype.toString.call(o)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var s=0,l=["uploadUrl","uploadSize","uploadLengthDeferred"];s<l.length;s++){var p=l[s];if(this.options[p]){this._emitError(new Error("tus: cannot use the ".concat(p," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(h){return r._fingerprint=h,r._source?r._source:r.options.fileReader.openFile(n,r.options.chunkSize)}).then(function(h){if(r._source=h,r.options.uploadLengthDeferred)r._size=null;else if(r.options.uploadSize!=null){if(r._size=Number(r.options.uploadSize),Number.isNaN(r._size)){r._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(r._size=r._source.size,r._size==null){r._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}r.options.parallelUploads>1||r._parallelUploadUrls!=null?r._startParallelUpload():r._startSingleUpload();}).catch(function(h){r._emitError(h);});}},{key:"_startParallelUpload",value:function(){var r,n=this,o=this._size,s=0;this._parallelUploads=[];var l=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,p=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:mn(this._source.size,l);this._parallelUploadUrls&&p.forEach(function(g,y){g.uploadUrl=n._parallelUploadUrls[y]||null;}),this._parallelUploadUrls=new Array(p.length);var h=p.map(function(g,y){var j=0;return n._source.slice(g.start,g.end).then(function(oe){var H=oe.value;return new Promise(function(L,w){var F=ee(ee({},n.options),{},{uploadUrl:g.uploadUrl||null,storeFingerprintForResuming:false,removeFingerprintOnSuccess:false,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:ee(ee({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:L,onError:w,onProgress:function(C){s=s-j+C,j=C,n._emitProgress(s,o);},onUploadUrlAvailable:function(){n._parallelUploadUrls[y]=k.url,n._parallelUploadUrls.filter(function(C){return !!C}).length===p.length&&n._saveUploadInUrlStorage();}}),k=new e(H,F);k.start(),n._parallelUploads.push(k);})})}),m;Promise.all(h).then(function(){m=n._openRequest("POST",n.options.endpoint),m.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var g=qt(n.options.metadata);return g!==""&&m.setHeader("Upload-Metadata",g),n._sendRequest(m,null)}).then(function(g){if(!te(g.getStatus(),200)){n._emitHttpError(m,g,"tus: unexpected response while creating upload");return}var y=g.getHeader("Location");if(y==null){n._emitHttpError(m,g,"tus: invalid or missing Location header");return}n.url=$t(n.options.endpoint,y),z("Created upload at ".concat(n.url)),n._emitSuccess(g);}).catch(function(g){n._emitError(g);});}},{key:"_startSingleUpload",value:function(){if(this._aborted=false,this.url!=null){z("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){z("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}this._createUpload();}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=ln(this._parallelUploads),s;try{for(o.s();!(s=o.n()).done;){var l=s.value;l.abort(r);}}catch(p){o.e(p);}finally{o.f();}}return this._req!==null&&this._req.abort(),this._aborted=true,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!r||this.url==null?Promise.resolve():e.terminate(this.url,this.options).then(function(){return n._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(r,n,o,s){this._emitError(new V(o,s,r,n));}},{key:"_emitError",value:function(r){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var o=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(o&&(this._retryAttempt=0),Kt(r,this._retryAttempt,this.options)){var s=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start();},s);return}}if(typeof this.options.onError=="function")this.options.onError(r);else throw r}}},{key:"_emitSuccess",value:function(r){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:r});}},{key:"_emitProgress",value:function(r,n){typeof this.options.onProgress=="function"&&this.options.onProgress(r,n);}},{key:"_emitChunkComplete",value:function(r,n,o){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(r,n,o);}},{key:"_createUpload",value:function(){var r=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var n=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?n.setHeader("Upload-Defer-Length","1"):n.setHeader("Upload-Length","".concat(this._size));var o=qt(this.options.metadata);o!==""&&n.setHeader("Upload-Metadata",o);var s;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,s=this._addChunkToRequest(n)):(this.options.protocol===be&&n.setHeader("Upload-Complete","?0"),s=this._sendRequest(n,null)),s.then(function(l){if(!te(l.getStatus(),200)){r._emitHttpError(n,l,"tus: unexpected response while creating upload");return}var p=l.getHeader("Location");if(p==null){r._emitHttpError(n,l,"tus: invalid or missing Location header");return}if(r.url=$t(r.options.endpoint,p),z("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(l),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,l):(r._offset=0,r._performUpload());});}).catch(function(l){r._emitHttpError(n,null,"tus: failed to create upload",l);});}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),o=this._sendRequest(n,null);o.then(function(s){var l=s.getStatus();if(!te(l,200)){if(l===423){r._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(te(l,400)&&r._removeFromUrlStorage(),!r.options.endpoint){r._emitHttpError(n,s,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}r.url=null,r._createUpload();return}var p=Number.parseInt(s.getHeader("Upload-Offset"),10);if(Number.isNaN(p)){r._emitHttpError(n,s,"tus: invalid or missing offset value");return}var h=Number.parseInt(s.getHeader("Upload-Length"),10);if(Number.isNaN(h)&&!r.options.uploadLengthDeferred&&r.options.protocol===Ne){r._emitHttpError(n,s,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(p===h){r._emitProgress(h,h),r._emitSuccess(s);return}r._offset=p,r._performUpload();});}).catch(function(s){r._emitHttpError(n,null,"tus: failed to resume upload",s);});}},{key:"_performUpload",value:function(){var r=this;if(!this._aborted){var n;this.options.overridePatchMethod?(n=this._openRequest("POST",this.url),n.setHeader("X-HTTP-Method-Override","PATCH")):n=this._openRequest("PATCH",this.url),n.setHeader("Upload-Offset","".concat(this._offset));var o=this._addChunkToRequest(n);o.then(function(s){if(!te(s.getStatus(),200)){r._emitHttpError(n,s,"tus: unexpected response while uploading chunk");return}r._handleUploadResponse(n,s);}).catch(function(s){r._aborted||r._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(r._offset),s);});}}},{key:"_addChunkToRequest",value:function(r){var n=this,o=this._offset,s=this._offset+this.options.chunkSize;return r.setProgressHandler(function(l){n._emitProgress(o+l,n._size);}),r.setHeader("Content-Type","application/offset+octet-stream"),(s===Number.POSITIVE_INFINITY||s>this._size)&&!this.options.uploadLengthDeferred&&(s=this._size),this._source.slice(o,s).then(function(l){var p=l.value,h=l.done,m=p!=null&&p.size?p.size:0;n.options.uploadLengthDeferred&&h&&(n._size=n._offset+m,r.setHeader("Upload-Length","".concat(n._size)));var g=n._offset+m;return !n.options.uploadLengthDeferred&&h&&g!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(g," bytes"))):p===null?n._sendRequest(r):(n.options.protocol===be&&r.setHeader("Upload-Complete",h?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,p))})}},{key:"_handleUploadResponse",value:function(r,n){var o=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(o)){this._emitHttpError(r,n,"tus: invalid or missing offset value");return}if(this._emitProgress(o,this._size),this._emitChunkComplete(o-this._offset,o,this._size),this._offset=o,o===this._size){this._emitSuccess(n),this._source.close();return}this._performUpload();}},{key:"_openRequest",value:function(r,n){var o=Mt(r,n,this.options);return this._req=o,o}},{key:"_removeFromUrlStorage",value:function(){var r=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(n){r._emitError(n);}),this._urlStorageKey=null);}},{key:"_saveUploadInUrlStorage",value:function(){var r=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var n={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?n.parallelUploadUrls=this._parallelUploadUrls:n.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,n).then(function(o){r._urlStorageKey=o;})}},{key:"_sendRequest",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return Gt(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=Mt("DELETE",r,n);return Gt(o,null,n).then(function(s){if(s.getStatus()!==204)throw new V("tus: unexpected response while terminating upload",null,o,s)}).catch(function(s){if(s instanceof V||(s=new V("tus: failed to terminate upload",s,o,null)),!Kt(s,0,n))throw s;var l=n.retryDelays[0],p=n.retryDelays.slice(1),h=ee(ee({},n),{},{retryDelays:p});return new Promise(function(m){return setTimeout(m,l)}).then(function(){return e.terminate(r,h)})})}}])}();function qt(e){return Object.entries(e).map(function(t){var r=Wt(t,2),n=r[0],o=r[1];return "".concat(n," ").concat(Ut.encode(String(o)))}).join(",")}function te(e,t){return e>=t&&e<t+100}function Mt(e,t,r){var n=r.httpStack.createRequest(e,t);r.protocol===be?n.setHeader("Upload-Draft-Interop-Version","5"):n.setHeader("Tus-Resumable","1.0.0");for(var o=r.headers||{},s=0,l=Object.entries(o);s<l.length;s++){var p=Wt(l[s],2),h=p[0],m=p[1];n.setHeader(h,m);}if(r.addRequestId){var g=Fe();n.setHeader("X-Request-ID",g);}return n}function Gt(e,t,r){return Be.apply(this,arguments)}function Be(){return Be=on(Ie().mark(function e(t,r,n){var o;return Ie().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(typeof n.onBeforeRequest!="function"){l.next=3;break}return l.next=3,n.onBeforeRequest(t);case 3:return l.next=5,t.send(r);case 5:if(o=l.sent,typeof n.onAfterResponse!="function"){l.next=9;break}return l.next=9,n.onAfterResponse(t,o);case 9:return l.abrupt("return",o);case 10:case "end":return l.stop()}},e)})),Be.apply(this,arguments)}function yn(){var e=true;return typeof navigator<"u"&&navigator.onLine===false&&(e=false),e}function Kt(e,t,r){return r.retryDelays==null||t>=r.retryDelays.length||e.originalRequest==null?false:r&&typeof r.onShouldRetry=="function"?r.onShouldRetry(e,t,r):Jt(e)}function Jt(e){var t=e.originalResponse?e.originalResponse.getStatus():0;return (!te(t,400)||t===409||t===423)&&yn()}function $t(e,t){return new Zt.default(t,e).toString()}function mn(e,t){for(var r=Math.floor(e/t),n=[],o=0;o<t;o++)n.push({start:r*o,end:r*(o+1)});return n[t-1].end=e,n}Vt.defaultOptions=dn;var _e=Vt;var vn=function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"},we=vn;function ze(e){return new Promise(function(t,r){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var o=n.response;t(o);},n.onerror=function(o){r(o);},n.open("GET",e),n.send();})}var gn=function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")},Qt=gn;function He(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){var o=new Uint8Array(n.result);t({value:o});},n.onerror=function(o){r(o);},n.readAsArrayBuffer(e);})}function ce(e){"@babel/helpers - typeof";return ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ce(e)}function bn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function er(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,wn(n.key),n);}}function _n(e,t,r){return t&&er(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function wn(e){var t=xn(e,"string");return ce(t)=="symbol"?t:t+""}function xn(e,t){if(ce(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ce(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var qe=function(){function e(t){bn(this,e),this._file=t,this.size=t.size;}return _n(e,[{key:"slice",value:function(r,n){if(Qt())return He(this._file.slice(r,n));var o=this._file.slice(r,n),s=n>=this.size;return Promise.resolve({value:o,done:s})}},{key:"close",value:function(){}}])}();function pe(e){"@babel/helpers - typeof";return pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pe(e)}function Sn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,En(n.key),n);}}function Un(e,t,r){return t&&tr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function En(e){var t=Pn(e,"string");return pe(t)=="symbol"?t:t+""}function Pn(e,t){if(pe(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(pe(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}function rr(e){return e===void 0?0:e.size!==void 0?e.size:e.length}function On(e,t){if(e.concat)return e.concat(t);if(e instanceof Blob)return new Blob([e,t],{type:e.type});if(e.set){var r=new e.constructor(e.length+t.length);return r.set(e),r.set(t,e.length),r}throw new Error("Unknown data type")}var nr=function(){function e(t){Sn(this,e),this._buffer=void 0,this._bufferOffset=0,this._reader=t,this._done=false;}return Un(e,[{key:"slice",value:function(r,n){return r<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(r,n)}},{key:"_readUntilEnoughDataOrDone",value:function(r,n){var o=this,s=n<=this._bufferOffset+rr(this._buffer);if(this._done||s){var l=this._getDataFromBuffer(r,n),p=l==null?this._done:false;return Promise.resolve({value:l,done:p})}return this._reader.read().then(function(h){var m=h.value,g=h.done;return g?o._done=true:o._buffer===void 0?o._buffer=m:o._buffer=On(o._buffer,m),o._readUntilEnoughDataOrDone(r,n)})}},{key:"_getDataFromBuffer",value:function(r,n){r>this._bufferOffset&&(this._buffer=this._buffer.slice(r-this._bufferOffset),this._bufferOffset=r);var o=rr(this._buffer)===0;return this._done&&o?null:this._buffer.slice(0,n-r)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel();}}])}();function Y(e){"@babel/helpers - typeof";return Y=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Y(e)}function Me(){Me=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(u,i,a){u[i]=a.value;},s=typeof Symbol=="function"?Symbol:{},l=s.iterator||"@@iterator",p=s.asyncIterator||"@@asyncIterator",h=s.toStringTag||"@@toStringTag";function m(u,i,a){return Object.defineProperty(u,i,{value:a,enumerable:true,configurable:true,writable:true}),u[i]}try{m({},"");}catch{m=function(a,f,d){return a[f]=d};}function g(u,i,a,f){var d=i&&i.prototype instanceof F?i:F,c=Object.create(d.prototype),v=new G(f||[]);return o(c,"_invoke",{value:Ue(u,a,v)}),c}function y(u,i,a){try{return {type:"normal",arg:u.call(i,a)}}catch(f){return {type:"throw",arg:f}}}t.wrap=g;var j="suspendedStart",oe="suspendedYield",H="executing",L="completed",w={};function F(){}function k(){}function x(){}var C={};m(C,l,function(){return this});var q=Object.getPrototypeOf,I=q&&q(q(K([])));I&&I!==r&&n.call(I,l)&&(C=I);var R=x.prototype=F.prototype=Object.create(C);function ie(u){["next","throw","return"].forEach(function(i){m(u,i,function(a){return this._invoke(i,a)});});}function N(u,i){function a(d,c,v,b){var _=y(u[d],u,c);if(_.type!=="throw"){var E=_.arg,S=E.value;return S&&Y(S)=="object"&&n.call(S,"__await")?i.resolve(S.__await).then(function(P){a("next",P,v,b);},function(P){a("throw",P,v,b);}):i.resolve(S).then(function(P){E.value=P,v(E);},function(P){return a("throw",P,v,b)})}b(_.arg);}var f;o(this,"_invoke",{value:function(c,v){function b(){return new i(function(_,E){a(c,v,_,E);})}return f=f?f.then(b,b):b()}});}function Ue(u,i,a){var f=j;return function(d,c){if(f===H)throw Error("Generator is already running");if(f===L){if(d==="throw")throw c;return {value:e,done:true}}for(a.method=d,a.arg=c;;){var v=a.delegate;if(v){var b=ae(v,a);if(b){if(b===w)continue;return b}}if(a.method==="next")a.sent=a._sent=a.arg;else if(a.method==="throw"){if(f===j)throw f=L,a.arg;a.dispatchException(a.arg);}else a.method==="return"&&a.abrupt("return",a.arg);f=H;var _=y(u,i,a);if(_.type==="normal"){if(f=a.done?L:oe,_.arg===w)continue;return {value:_.arg,done:a.done}}_.type==="throw"&&(f=L,a.method="throw",a.arg=_.arg);}}}function ae(u,i){var a=i.method,f=u.iterator[a];if(f===e)return i.delegate=null,a==="throw"&&u.iterator.return&&(i.method="return",i.arg=e,ae(u,i),i.method==="throw")||a!=="return"&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+a+"' method")),w;var d=y(f,u.iterator,i.arg);if(d.type==="throw")return i.method="throw",i.arg=d.arg,i.delegate=null,w;var c=d.arg;return c?c.done?(i[u.resultName]=c.value,i.next=u.nextLoc,i.method!=="return"&&(i.method="next",i.arg=e),i.delegate=null,w):c:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,w)}function Ee(u){var i={tryLoc:u[0]};1 in u&&(i.catchLoc=u[1]),2 in u&&(i.finallyLoc=u[2],i.afterLoc=u[3]),this.tryEntries.push(i);}function M(u){var i=u.completion||{};i.type="normal",delete i.arg,u.completion=i;}function G(u){this.tryEntries=[{tryLoc:"root"}],u.forEach(Ee,this),this.reset(true);}function K(u){if(u||u===""){var i=u[l];if(i)return i.call(u);if(typeof u.next=="function")return u;if(!isNaN(u.length)){var a=-1,f=function d(){for(;++a<u.length;)if(n.call(u,a))return d.value=u[a],d.done=false,d;return d.value=e,d.done=true,d};return f.next=f}}throw new TypeError(Y(u)+" is not iterable")}return k.prototype=x,o(R,"constructor",{value:x,configurable:true}),o(x,"constructor",{value:k,configurable:true}),k.displayName=m(x,h,"GeneratorFunction"),t.isGeneratorFunction=function(u){var i=typeof u=="function"&&u.constructor;return !!i&&(i===k||(i.displayName||i.name)==="GeneratorFunction")},t.mark=function(u){return Object.setPrototypeOf?Object.setPrototypeOf(u,x):(u.__proto__=x,m(u,h,"GeneratorFunction")),u.prototype=Object.create(R),u},t.awrap=function(u){return {__await:u}},ie(N.prototype),m(N.prototype,p,function(){return this}),t.AsyncIterator=N,t.async=function(u,i,a,f,d){d===void 0&&(d=Promise);var c=new N(g(u,i,a,f),d);return t.isGeneratorFunction(i)?c:c.next().then(function(v){return v.done?v.value:c.next()})},ie(R),m(R,h,"Generator"),m(R,l,function(){return this}),m(R,"toString",function(){return "[object Generator]"}),t.keys=function(u){var i=Object(u),a=[];for(var f in i)a.push(f);return a.reverse(),function d(){for(;a.length;){var c=a.pop();if(c in i)return d.value=c,d.done=false,d}return d.done=true,d}},t.values=K,G.prototype={constructor:G,reset:function(i){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=false,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(M),!i)for(var a in this)a.charAt(0)==="t"&&n.call(this,a)&&!isNaN(+a.slice(1))&&(this[a]=e);},stop:function(){this.done=true;var i=this.tryEntries[0].completion;if(i.type==="throw")throw i.arg;return this.rval},dispatchException:function(i){if(this.done)throw i;var a=this;function f(E,S){return v.type="throw",v.arg=i,a.next=E,S&&(a.method="next",a.arg=e),!!S}for(var d=this.tryEntries.length-1;d>=0;--d){var c=this.tryEntries[d],v=c.completion;if(c.tryLoc==="root")return f("end");if(c.tryLoc<=this.prev){var b=n.call(c,"catchLoc"),_=n.call(c,"finallyLoc");if(b&&_){if(this.prev<c.catchLoc)return f(c.catchLoc,true);if(this.prev<c.finallyLoc)return f(c.finallyLoc)}else if(b){if(this.prev<c.catchLoc)return f(c.catchLoc,true)}else {if(!_)throw Error("try statement without catch or finally");if(this.prev<c.finallyLoc)return f(c.finallyLoc)}}}},abrupt:function(i,a){for(var f=this.tryEntries.length-1;f>=0;--f){var d=this.tryEntries[f];if(d.tryLoc<=this.prev&&n.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var c=d;break}}c&&(i==="break"||i==="continue")&&c.tryLoc<=a&&a<=c.finallyLoc&&(c=null);var v=c?c.completion:{};return v.type=i,v.arg=a,c?(this.method="next",this.next=c.finallyLoc,w):this.complete(v)},complete:function(i,a){if(i.type==="throw")throw i.arg;return i.type==="break"||i.type==="continue"?this.next=i.arg:i.type==="return"?(this.rval=this.arg=i.arg,this.method="return",this.next="end"):i.type==="normal"&&a&&(this.next=a),w},finish:function(i){for(var a=this.tryEntries.length-1;a>=0;--a){var f=this.tryEntries[a];if(f.finallyLoc===i)return this.complete(f.completion,f.afterLoc),M(f),w}},catch:function(i){for(var a=this.tryEntries.length-1;a>=0;--a){var f=this.tryEntries[a];if(f.tryLoc===i){var d=f.completion;if(d.type==="throw"){var c=d.arg;M(f);}return c}}throw Error("illegal catch attempt")},delegateYield:function(i,a,f){return this.delegate={iterator:K(i),resultName:a,nextLoc:f},this.method==="next"&&(this.arg=e),w}},t}function or(e,t,r,n,o,s,l){try{var p=e[s](l),h=p.value;}catch(m){r(m);return}p.done?t(h):Promise.resolve(h).then(n,o);}function kn(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var s=e.apply(t,r);function l(h){or(s,n,o,l,p,"next",h);}function p(h){or(s,n,o,l,p,"throw",h);}l(void 0);})}}function Rn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ir(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Cn(n.key),n);}}function jn(e,t,r){return t&&ir(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Cn(e){var t=Ln(e,"string");return Y(t)=="symbol"?t:t+""}function Ln(e,t){if(Y(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Y(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var ar=function(){function e(){Rn(this,e);}return jn(e,[{key:"openFile",value:function(){var t=kn(Me().mark(function n(o,s){var l;return Me().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(!(we()&&o&&typeof o.uri<"u")){h.next=11;break}return h.prev=1,h.next=4,ze(o.uri);case 4:return l=h.sent,h.abrupt("return",new qe(l));case 8:throw h.prev=8,h.t0=h.catch(1),new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(h.t0));case 11:if(!(typeof o.slice=="function"&&typeof o.size<"u")){h.next=13;break}return h.abrupt("return",Promise.resolve(new qe(o)));case 13:if(typeof o.read!="function"){h.next=18;break}if(s=Number(s),Number.isFinite(s)){h.next=17;break}return h.abrupt("return",Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));case 17:return h.abrupt("return",Promise.resolve(new nr(o,s)));case 18:return h.abrupt("return",Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment")));case 19:case "end":return h.stop()}},n,null,[[1,8]])}));function r(n,o){return t.apply(this,arguments)}return r}()}])}();function Ge(e,t){return we()?Promise.resolve(Tn(e,t)):Promise.resolve(["tus-br",e.name,e.type,e.size,e.lastModified,t.endpoint].join("-"))}function Tn(e,t){var r=e.exif?An(JSON.stringify(e.exif)):"noexif";return ["tus-rn",e.name||"noname",e.size||"nosize",r,t.endpoint].join("/")}function An(e){var t=0;if(e.length===0)return t;for(var r=0;r<e.length;r++){var n=e.charCodeAt(r);t=(t<<5)-t+n,t&=t;}return t}function he(e){"@babel/helpers - typeof";return he=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},he(e)}function Ke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Dn(n.key),n);}}function $e(e,t,r){return t&&sr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Dn(e){var t=Fn(e,"string");return he(t)=="symbol"?t:t+""}function Fn(e,t){if(he(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(he(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var ur=function(){function e(){Ke(this,e);}return $e(e,[{key:"createRequest",value:function(r,n){return new In(r,n)}},{key:"getName",value:function(){return "XHRHttpStack"}}])}();var In=function(){function e(t,r){Ke(this,e),this._xhr=new XMLHttpRequest,this._xhr.open(t,r,true),this._method=t,this._url=r,this._headers={};}return $e(e,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(r,n){this._xhr.setRequestHeader(r,n),this._headers[r]=n;}},{key:"getHeader",value:function(r){return this._headers[r]}},{key:"setProgressHandler",value:function(r){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(n){n.lengthComputable&&r(n.loaded);});}},{key:"send",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(o,s){r._xhr.onload=function(){o(new Nn(r._xhr));},r._xhr.onerror=function(l){s(l);},r._xhr.send(n);})}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}(),Nn=function(){function e(t){Ke(this,e),this._xhr=t;}return $e(e,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(r){return this._xhr.getResponseHeader(r)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}();function de(e){"@babel/helpers - typeof";return de=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},de(e)}function Bn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Hn(n.key),n);}}function zn(e,t,r){return t&&lr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Hn(e){var t=qn(e,"string");return de(t)=="symbol"?t:t+""}function qn(e,t){if(de(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(de(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var Xe=false;try{Xe="localStorage"in window,xe="tusSupport",We=localStorage.getItem(xe),localStorage.setItem(xe,We),We===null&&localStorage.removeItem(xe);}catch(e){if(e.code===e.SECURITY_ERR||e.code===e.QUOTA_EXCEEDED_ERR)Xe=false;else throw e}var xe,We,fr=Xe,cr=function(){function e(){Bn(this,e);}return zn(e,[{key:"findAllUploads",value:function(){var r=this._findEntries("tus::");return Promise.resolve(r)}},{key:"findUploadsByFingerprint",value:function(r){var n=this._findEntries("tus::".concat(r,"::"));return Promise.resolve(n)}},{key:"removeUpload",value:function(r){return localStorage.removeItem(r),Promise.resolve()}},{key:"addUpload",value:function(r,n){var o=Math.round(Math.random()*1e12),s="tus::".concat(r,"::").concat(o);return localStorage.setItem(s,JSON.stringify(n)),Promise.resolve(s)}},{key:"_findEntries",value:function(r){for(var n=[],o=0;o<localStorage.length;o++){var s=localStorage.key(o);if(s.indexOf(r)===0)try{var l=JSON.parse(localStorage.getItem(s));l.urlStorageKey=s,n.push(l);}catch{}}return n}}])}();function ne(e){"@babel/helpers - typeof";return ne=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ne(e)}function Mn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,mr(n.key),n);}}function Gn(e,t,r){return r&&pr(e,r),Object.defineProperty(e,"prototype",{writable:false}),e}function Kn(e,t,r){return t=Se(t),$n(e,yr()?Reflect.construct(t,r||[],Se(e).constructor):t.apply(e,r))}function $n(e,t){if(t&&(ne(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wn(e)}function Wn(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch{}return (yr=function(){return !!e})()}function Se(e){return Se=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Se(e)}function Xn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}}),Object.defineProperty(e,"prototype",{writable:false}),t&&Ye(e,t);}function Ye(e,t){return Ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ye(e,t)}function hr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n);}return r}function re(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hr(Object(r),true).forEach(function(n){Yn(e,n,r[n]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n));});}return e}function Yn(e,t,r){return t=mr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function mr(e){var t=Zn(e,"string");return ne(t)=="symbol"?t:t+""}function Zn(e,t){if(ne(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ne(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (t==="string"?String:Number)(e)}var dr=re(re({},_e.defaultOptions),{},{httpStack:new ur,fileReader:new ar,urlStorage:fr?new cr:new it,fingerprint:Ge}),vr=function(e){function t(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Mn(this,t),n=re(re({},dr),n),Kn(this,t,[r,n])}return Xn(t,e),Gn(t,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=re(re({},dr),o),_e.terminate(n,o)}}])}(_e);exports.a=class O extends chunk5NSCV6C2_cjs.i{constructor(){super(...arguments);this.disableCompletion=false;this._completed=false;this.languageController=new chunk4GTAVYTC_cjs.d(this);}connectedCallback(){super.connectedCallback(),window.customElements.get("lottie-player")||import('./lottie-player.esm-OYBEUNQX.cjs'),this.languageController.locale=this.locale||"en",this.embedChannel=chunkBRZI5I43_cjs.a.connect(this.token),this.embedChannel.upload_id&&(this._upload_id=this.embedChannel.upload_id),this.embedChannel.channel.on("initiate",({upload_id:r})=>{this._upload_id=r,this.embedChannel.upload_id=r;}),this.embedChannel.channel.on("completed",this.completed.bind(this)),this.embedChannel.channel.on("rendition",this.rendition.bind(this)),this.embedChannel.channel.on("error",this.error.bind(this));}requestUpdate(r,n){super.requestUpdate(r,n),r==="locale"&&(this.languageController.locale=this.locale);}reset(){this._progress=0,this._completed=false,this.embedChannel.channel.push("reset",{});}disconnectedCallback(){super.disconnectedCallback();}handleDrop(r){if(r.preventDefault(),r.dataTransfer&&r.dataTransfer.items){for(let n of r.dataTransfer.items)if(n.kind==="file"){let o=n.getAsFile();o&&(o.type.startsWith("video/")||o.type.startsWith("audio/"))&&(this._progress=1,this.upload(o));}}else if(r.dataTransfer&&r.dataTransfer.files)for(let n of r.dataTransfer.files)(n.type.startsWith("video/")||n.type.startsWith("audio/"))&&(this._progress=1,this.upload(n));}handleForm(r){this._progress=1;let n=r.target;if(n.files)for(let o of n.files)(o.type.startsWith("video/")||o.type.startsWith("audio/"))&&this.upload(o);}upload(r){this.dispatchEvent(new CustomEvent("upload",{bubbles:true,composed:true,detail:{file:r}}));let n=new vr(r,{endpoint:chunk5STN56TL_cjs.a.upload.endpoint,retryDelays:[0,3e3,5e3,1e4,2e4,6e4,6e4],metadata:{title:r.name,filetype:r.type,token:this.token,upload_id:this._upload_id},onError:o=>{console.log(o),this.dispatchEvent(new CustomEvent("failed",{bubbles:true,composed:true,detail:o}));},onProgress:(o,s)=>{let l=Math.round(o/s*100);l>this._progress&&(this._progress=l),this.dispatchEvent(new CustomEvent("progress",{bubbles:true,composed:true,detail:{progress:l}}));},onSuccess:()=>{this._progress=100,this.dispatchEvent(new CustomEvent("processing",{bubbles:true,composed:true}));},removeFingerprintOnSuccess:true});n.findPreviousUploads().then(o=>{o.length&&n.resumeFromPreviousUpload(o[0]),n.start();});}completed(r){this.disableCompletion||(this._completed=true),this.dispatchEvent(new CustomEvent("completed",{bubbles:true,composed:true,detail:r}));}rendition(r){this.dispatchEvent(new CustomEvent("rendition",{bubbles:true,composed:true,detail:r}));}error(r){console.warn(`[mave-upload] ${r.message}`),this.dispatchEvent(new CustomEvent("error",{bubbles:true,detail:r}));}render(){return chunk5NSCV6C2_cjs.c` ${this._progress?this.renderProgress():this.renderUpload()} `}styleOpacity(){return this.languageController.loaded?this._upload_id?{}:{pointerEvents:"none",opacity:"0.5"}:{pointerEvents:"none",opacity:"0"}}styleFont(){return this.font?{fontFamily:this.font}:{fontFamily:"system-ui"}}renderUpload(){return chunk5NSCV6C2_cjs.c`<form
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=true,l=false,p;return {s:function(){r=r.call(e);},n:function(){var m=r.next();return s=m.done,m},e:function(m){l=true,p=m;},f:function(){try{!s&&r.return!=null&&r.return();}finally{if(l)throw p}}}}function Xt(e,t){if(e){if(typeof e=="string")return Bt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Bt(e,t)}}function Bt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function zt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n);}return r}function ee(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zt(Object(r),true).forEach(function(n){fn(e,n,r[n]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n));});}return e}function fn(e,t,r){return t=Yt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function cn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ht(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Yt(n.key),n);}}function pn(e,t,r){return t&&Ht(e.prototype,t),r&&Ht(e,r),Object.defineProperty(e,"prototype",{writable:false}),e}function Yt(e){var t=hn(e,"string");return X(t)=="symbol"?t:t+""}function hn(e,t){if(X(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(X(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var Ne="tus-v1",be="ietf-draft-03",dn={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:false,headers:{},addRequestId:false,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:Jt,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:true,removeFingerprintOnSuccess:false,uploadLengthDeferred:false,uploadDataDuringCreation:false,urlStorage:null,fileReader:null,httpStack:null,protocol:Ne},Vt=function(){function e(t,r){cn(this,e),"resume"in r&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=r,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=t,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=false,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null;}return pn(e,[{key:"findPreviousUploads",value:function(){var r=this;return this.options.fingerprint(this.file,this.options).then(function(n){return r._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(r){this.url=r.uploadUrl||null,this._parallelUploadUrls=r.parallelUploadUrls||null,this._urlStorageKey=r.urlStorageKey;}},{key:"start",value:function(){var r=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![Ne,be].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var o=this.options.retryDelays;if(o!=null&&Object.prototype.toString.call(o)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var s=0,l=["uploadUrl","uploadSize","uploadLengthDeferred"];s<l.length;s++){var p=l[s];if(this.options[p]){this._emitError(new Error("tus: cannot use the ".concat(p," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(h){return r._fingerprint=h,r._source?r._source:r.options.fileReader.openFile(n,r.options.chunkSize)}).then(function(h){if(r._source=h,r.options.uploadLengthDeferred)r._size=null;else if(r.options.uploadSize!=null){if(r._size=Number(r.options.uploadSize),Number.isNaN(r._size)){r._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(r._size=r._source.size,r._size==null){r._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}r.options.parallelUploads>1||r._parallelUploadUrls!=null?r._startParallelUpload():r._startSingleUpload();}).catch(function(h){r._emitError(h);});}},{key:"_startParallelUpload",value:function(){var r,n=this,o=this._size,s=0;this._parallelUploads=[];var l=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,p=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:mn(this._source.size,l);this._parallelUploadUrls&&p.forEach(function(g,y){g.uploadUrl=n._parallelUploadUrls[y]||null;}),this._parallelUploadUrls=new Array(p.length);var h=p.map(function(g,y){var j=0;return n._source.slice(g.start,g.end).then(function(oe){var H=oe.value;return new Promise(function(L,w){var F=ee(ee({},n.options),{},{uploadUrl:g.uploadUrl||null,storeFingerprintForResuming:false,removeFingerprintOnSuccess:false,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:ee(ee({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:L,onError:w,onProgress:function(C){s=s-j+C,j=C,n._emitProgress(s,o);},onUploadUrlAvailable:function(){n._parallelUploadUrls[y]=k.url,n._parallelUploadUrls.filter(function(C){return !!C}).length===p.length&&n._saveUploadInUrlStorage();}}),k=new e(H,F);k.start(),n._parallelUploads.push(k);})})}),m;Promise.all(h).then(function(){m=n._openRequest("POST",n.options.endpoint),m.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var g=qt(n.options.metadata);return g!==""&&m.setHeader("Upload-Metadata",g),n._sendRequest(m,null)}).then(function(g){if(!te(g.getStatus(),200)){n._emitHttpError(m,g,"tus: unexpected response while creating upload");return}var y=g.getHeader("Location");if(y==null){n._emitHttpError(m,g,"tus: invalid or missing Location header");return}n.url=$t(n.options.endpoint,y),z("Created upload at ".concat(n.url)),n._emitSuccess(g);}).catch(function(g){n._emitError(g);});}},{key:"_startSingleUpload",value:function(){if(this._aborted=false,this.url!=null){z("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){z("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}this._createUpload();}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=ln(this._parallelUploads),s;try{for(o.s();!(s=o.n()).done;){var l=s.value;l.abort(r);}}catch(p){o.e(p);}finally{o.f();}}return this._req!==null&&this._req.abort(),this._aborted=true,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!r||this.url==null?Promise.resolve():e.terminate(this.url,this.options).then(function(){return n._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(r,n,o,s){this._emitError(new V(o,s,r,n));}},{key:"_emitError",value:function(r){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var o=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(o&&(this._retryAttempt=0),Kt(r,this._retryAttempt,this.options)){var s=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start();},s);return}}if(typeof this.options.onError=="function")this.options.onError(r);else throw r}}},{key:"_emitSuccess",value:function(r){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:r});}},{key:"_emitProgress",value:function(r,n){typeof this.options.onProgress=="function"&&this.options.onProgress(r,n);}},{key:"_emitChunkComplete",value:function(r,n,o){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(r,n,o);}},{key:"_createUpload",value:function(){var r=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var n=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?n.setHeader("Upload-Defer-Length","1"):n.setHeader("Upload-Length","".concat(this._size));var o=qt(this.options.metadata);o!==""&&n.setHeader("Upload-Metadata",o);var s;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,s=this._addChunkToRequest(n)):(this.options.protocol===be&&n.setHeader("Upload-Complete","?0"),s=this._sendRequest(n,null)),s.then(function(l){if(!te(l.getStatus(),200)){r._emitHttpError(n,l,"tus: unexpected response while creating upload");return}var p=l.getHeader("Location");if(p==null){r._emitHttpError(n,l,"tus: invalid or missing Location header");return}if(r.url=$t(r.options.endpoint,p),z("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(l),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,l):(r._offset=0,r._performUpload());});}).catch(function(l){r._emitHttpError(n,null,"tus: failed to create upload",l);});}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),o=this._sendRequest(n,null);o.then(function(s){var l=s.getStatus();if(!te(l,200)){if(l===423){r._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(te(l,400)&&r._removeFromUrlStorage(),!r.options.endpoint){r._emitHttpError(n,s,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}r.url=null,r._createUpload();return}var p=Number.parseInt(s.getHeader("Upload-Offset"),10);if(Number.isNaN(p)){r._emitHttpError(n,s,"tus: invalid or missing offset value");return}var h=Number.parseInt(s.getHeader("Upload-Length"),10);if(Number.isNaN(h)&&!r.options.uploadLengthDeferred&&r.options.protocol===Ne){r._emitHttpError(n,s,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(p===h){r._emitProgress(h,h),r._emitSuccess(s);return}r._offset=p,r._performUpload();});}).catch(function(s){r._emitHttpError(n,null,"tus: failed to resume upload",s);});}},{key:"_performUpload",value:function(){var r=this;if(!this._aborted){var n;this.options.overridePatchMethod?(n=this._openRequest("POST",this.url),n.setHeader("X-HTTP-Method-Override","PATCH")):n=this._openRequest("PATCH",this.url),n.setHeader("Upload-Offset","".concat(this._offset));var o=this._addChunkToRequest(n);o.then(function(s){if(!te(s.getStatus(),200)){r._emitHttpError(n,s,"tus: unexpected response while uploading chunk");return}r._handleUploadResponse(n,s);}).catch(function(s){r._aborted||r._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(r._offset),s);});}}},{key:"_addChunkToRequest",value:function(r){var n=this,o=this._offset,s=this._offset+this.options.chunkSize;return r.setProgressHandler(function(l){n._emitProgress(o+l,n._size);}),r.setHeader("Content-Type","application/offset+octet-stream"),(s===Number.POSITIVE_INFINITY||s>this._size)&&!this.options.uploadLengthDeferred&&(s=this._size),this._source.slice(o,s).then(function(l){var p=l.value,h=l.done,m=p!=null&&p.size?p.size:0;n.options.uploadLengthDeferred&&h&&(n._size=n._offset+m,r.setHeader("Upload-Length","".concat(n._size)));var g=n._offset+m;return !n.options.uploadLengthDeferred&&h&&g!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(g," bytes"))):p===null?n._sendRequest(r):(n.options.protocol===be&&r.setHeader("Upload-Complete",h?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,p))})}},{key:"_handleUploadResponse",value:function(r,n){var o=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(o)){this._emitHttpError(r,n,"tus: invalid or missing offset value");return}if(this._emitProgress(o,this._size),this._emitChunkComplete(o-this._offset,o,this._size),this._offset=o,o===this._size){this._emitSuccess(n),this._source.close();return}this._performUpload();}},{key:"_openRequest",value:function(r,n){var o=Mt(r,n,this.options);return this._req=o,o}},{key:"_removeFromUrlStorage",value:function(){var r=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(n){r._emitError(n);}),this._urlStorageKey=null);}},{key:"_saveUploadInUrlStorage",value:function(){var r=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var n={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?n.parallelUploadUrls=this._parallelUploadUrls:n.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,n).then(function(o){r._urlStorageKey=o;})}},{key:"_sendRequest",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return Gt(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=Mt("DELETE",r,n);return Gt(o,null,n).then(function(s){if(s.getStatus()!==204)throw new V("tus: unexpected response while terminating upload",null,o,s)}).catch(function(s){if(s instanceof V||(s=new V("tus: failed to terminate upload",s,o,null)),!Kt(s,0,n))throw s;var l=n.retryDelays[0],p=n.retryDelays.slice(1),h=ee(ee({},n),{},{retryDelays:p});return new Promise(function(m){return setTimeout(m,l)}).then(function(){return e.terminate(r,h)})})}}])}();function qt(e){return Object.entries(e).map(function(t){var r=Wt(t,2),n=r[0],o=r[1];return "".concat(n," ").concat(Ut.encode(String(o)))}).join(",")}function te(e,t){return e>=t&&e<t+100}function Mt(e,t,r){var n=r.httpStack.createRequest(e,t);r.protocol===be?n.setHeader("Upload-Draft-Interop-Version","5"):n.setHeader("Tus-Resumable","1.0.0");for(var o=r.headers||{},s=0,l=Object.entries(o);s<l.length;s++){var p=Wt(l[s],2),h=p[0],m=p[1];n.setHeader(h,m);}if(r.addRequestId){var g=Fe();n.setHeader("X-Request-ID",g);}return n}function Gt(e,t,r){return Be.apply(this,arguments)}function Be(){return Be=on(Ie().mark(function e(t,r,n){var o;return Ie().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(typeof n.onBeforeRequest!="function"){l.next=3;break}return l.next=3,n.onBeforeRequest(t);case 3:return l.next=5,t.send(r);case 5:if(o=l.sent,typeof n.onAfterResponse!="function"){l.next=9;break}return l.next=9,n.onAfterResponse(t,o);case 9:return l.abrupt("return",o);case 10:case "end":return l.stop()}},e)})),Be.apply(this,arguments)}function yn(){var e=true;return typeof navigator<"u"&&navigator.onLine===false&&(e=false),e}function Kt(e,t,r){return r.retryDelays==null||t>=r.retryDelays.length||e.originalRequest==null?false:r&&typeof r.onShouldRetry=="function"?r.onShouldRetry(e,t,r):Jt(e)}function Jt(e){var t=e.originalResponse?e.originalResponse.getStatus():0;return (!te(t,400)||t===409||t===423)&&yn()}function $t(e,t){return new Zt.default(t,e).toString()}function mn(e,t){for(var r=Math.floor(e/t),n=[],o=0;o<t;o++)n.push({start:r*o,end:r*(o+1)});return n[t-1].end=e,n}Vt.defaultOptions=dn;var _e=Vt;var vn=function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"},we=vn;function ze(e){return new Promise(function(t,r){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var o=n.response;t(o);},n.onerror=function(o){r(o);},n.open("GET",e),n.send();})}var gn=function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")},Qt=gn;function He(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){var o=new Uint8Array(n.result);t({value:o});},n.onerror=function(o){r(o);},n.readAsArrayBuffer(e);})}function ce(e){"@babel/helpers - typeof";return ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ce(e)}function bn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function er(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,wn(n.key),n);}}function _n(e,t,r){return t&&er(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function wn(e){var t=xn(e,"string");return ce(t)=="symbol"?t:t+""}function xn(e,t){if(ce(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ce(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var qe=function(){function e(t){bn(this,e),this._file=t,this.size=t.size;}return _n(e,[{key:"slice",value:function(r,n){if(Qt())return He(this._file.slice(r,n));var o=this._file.slice(r,n),s=n>=this.size;return Promise.resolve({value:o,done:s})}},{key:"close",value:function(){}}])}();function pe(e){"@babel/helpers - typeof";return pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pe(e)}function Sn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,En(n.key),n);}}function Un(e,t,r){return t&&tr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function En(e){var t=Pn(e,"string");return pe(t)=="symbol"?t:t+""}function Pn(e,t){if(pe(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(pe(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}function rr(e){return e===void 0?0:e.size!==void 0?e.size:e.length}function On(e,t){if(e.concat)return e.concat(t);if(e instanceof Blob)return new Blob([e,t],{type:e.type});if(e.set){var r=new e.constructor(e.length+t.length);return r.set(e),r.set(t,e.length),r}throw new Error("Unknown data type")}var nr=function(){function e(t){Sn(this,e),this._buffer=void 0,this._bufferOffset=0,this._reader=t,this._done=false;}return Un(e,[{key:"slice",value:function(r,n){return r<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(r,n)}},{key:"_readUntilEnoughDataOrDone",value:function(r,n){var o=this,s=n<=this._bufferOffset+rr(this._buffer);if(this._done||s){var l=this._getDataFromBuffer(r,n),p=l==null?this._done:false;return Promise.resolve({value:l,done:p})}return this._reader.read().then(function(h){var m=h.value,g=h.done;return g?o._done=true:o._buffer===void 0?o._buffer=m:o._buffer=On(o._buffer,m),o._readUntilEnoughDataOrDone(r,n)})}},{key:"_getDataFromBuffer",value:function(r,n){r>this._bufferOffset&&(this._buffer=this._buffer.slice(r-this._bufferOffset),this._bufferOffset=r);var o=rr(this._buffer)===0;return this._done&&o?null:this._buffer.slice(0,n-r)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel();}}])}();function Y(e){"@babel/helpers - typeof";return Y=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Y(e)}function Me(){Me=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(u,i,a){u[i]=a.value;},s=typeof Symbol=="function"?Symbol:{},l=s.iterator||"@@iterator",p=s.asyncIterator||"@@asyncIterator",h=s.toStringTag||"@@toStringTag";function m(u,i,a){return Object.defineProperty(u,i,{value:a,enumerable:true,configurable:true,writable:true}),u[i]}try{m({},"");}catch{m=function(a,f,d){return a[f]=d};}function g(u,i,a,f){var d=i&&i.prototype instanceof F?i:F,c=Object.create(d.prototype),v=new G(f||[]);return o(c,"_invoke",{value:Ue(u,a,v)}),c}function y(u,i,a){try{return {type:"normal",arg:u.call(i,a)}}catch(f){return {type:"throw",arg:f}}}t.wrap=g;var j="suspendedStart",oe="suspendedYield",H="executing",L="completed",w={};function F(){}function k(){}function x(){}var C={};m(C,l,function(){return this});var q=Object.getPrototypeOf,I=q&&q(q(K([])));I&&I!==r&&n.call(I,l)&&(C=I);var R=x.prototype=F.prototype=Object.create(C);function ie(u){["next","throw","return"].forEach(function(i){m(u,i,function(a){return this._invoke(i,a)});});}function N(u,i){function a(d,c,v,b){var _=y(u[d],u,c);if(_.type!=="throw"){var E=_.arg,S=E.value;return S&&Y(S)=="object"&&n.call(S,"__await")?i.resolve(S.__await).then(function(P){a("next",P,v,b);},function(P){a("throw",P,v,b);}):i.resolve(S).then(function(P){E.value=P,v(E);},function(P){return a("throw",P,v,b)})}b(_.arg);}var f;o(this,"_invoke",{value:function(c,v){function b(){return new i(function(_,E){a(c,v,_,E);})}return f=f?f.then(b,b):b()}});}function Ue(u,i,a){var f=j;return function(d,c){if(f===H)throw Error("Generator is already running");if(f===L){if(d==="throw")throw c;return {value:e,done:true}}for(a.method=d,a.arg=c;;){var v=a.delegate;if(v){var b=ae(v,a);if(b){if(b===w)continue;return b}}if(a.method==="next")a.sent=a._sent=a.arg;else if(a.method==="throw"){if(f===j)throw f=L,a.arg;a.dispatchException(a.arg);}else a.method==="return"&&a.abrupt("return",a.arg);f=H;var _=y(u,i,a);if(_.type==="normal"){if(f=a.done?L:oe,_.arg===w)continue;return {value:_.arg,done:a.done}}_.type==="throw"&&(f=L,a.method="throw",a.arg=_.arg);}}}function ae(u,i){var a=i.method,f=u.iterator[a];if(f===e)return i.delegate=null,a==="throw"&&u.iterator.return&&(i.method="return",i.arg=e,ae(u,i),i.method==="throw")||a!=="return"&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+a+"' method")),w;var d=y(f,u.iterator,i.arg);if(d.type==="throw")return i.method="throw",i.arg=d.arg,i.delegate=null,w;var c=d.arg;return c?c.done?(i[u.resultName]=c.value,i.next=u.nextLoc,i.method!=="return"&&(i.method="next",i.arg=e),i.delegate=null,w):c:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,w)}function Ee(u){var i={tryLoc:u[0]};1 in u&&(i.catchLoc=u[1]),2 in u&&(i.finallyLoc=u[2],i.afterLoc=u[3]),this.tryEntries.push(i);}function M(u){var i=u.completion||{};i.type="normal",delete i.arg,u.completion=i;}function G(u){this.tryEntries=[{tryLoc:"root"}],u.forEach(Ee,this),this.reset(true);}function K(u){if(u||u===""){var i=u[l];if(i)return i.call(u);if(typeof u.next=="function")return u;if(!isNaN(u.length)){var a=-1,f=function d(){for(;++a<u.length;)if(n.call(u,a))return d.value=u[a],d.done=false,d;return d.value=e,d.done=true,d};return f.next=f}}throw new TypeError(Y(u)+" is not iterable")}return k.prototype=x,o(R,"constructor",{value:x,configurable:true}),o(x,"constructor",{value:k,configurable:true}),k.displayName=m(x,h,"GeneratorFunction"),t.isGeneratorFunction=function(u){var i=typeof u=="function"&&u.constructor;return !!i&&(i===k||(i.displayName||i.name)==="GeneratorFunction")},t.mark=function(u){return Object.setPrototypeOf?Object.setPrototypeOf(u,x):(u.__proto__=x,m(u,h,"GeneratorFunction")),u.prototype=Object.create(R),u},t.awrap=function(u){return {__await:u}},ie(N.prototype),m(N.prototype,p,function(){return this}),t.AsyncIterator=N,t.async=function(u,i,a,f,d){d===void 0&&(d=Promise);var c=new N(g(u,i,a,f),d);return t.isGeneratorFunction(i)?c:c.next().then(function(v){return v.done?v.value:c.next()})},ie(R),m(R,h,"Generator"),m(R,l,function(){return this}),m(R,"toString",function(){return "[object Generator]"}),t.keys=function(u){var i=Object(u),a=[];for(var f in i)a.push(f);return a.reverse(),function d(){for(;a.length;){var c=a.pop();if(c in i)return d.value=c,d.done=false,d}return d.done=true,d}},t.values=K,G.prototype={constructor:G,reset:function(i){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=false,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(M),!i)for(var a in this)a.charAt(0)==="t"&&n.call(this,a)&&!isNaN(+a.slice(1))&&(this[a]=e);},stop:function(){this.done=true;var i=this.tryEntries[0].completion;if(i.type==="throw")throw i.arg;return this.rval},dispatchException:function(i){if(this.done)throw i;var a=this;function f(E,S){return v.type="throw",v.arg=i,a.next=E,S&&(a.method="next",a.arg=e),!!S}for(var d=this.tryEntries.length-1;d>=0;--d){var c=this.tryEntries[d],v=c.completion;if(c.tryLoc==="root")return f("end");if(c.tryLoc<=this.prev){var b=n.call(c,"catchLoc"),_=n.call(c,"finallyLoc");if(b&&_){if(this.prev<c.catchLoc)return f(c.catchLoc,true);if(this.prev<c.finallyLoc)return f(c.finallyLoc)}else if(b){if(this.prev<c.catchLoc)return f(c.catchLoc,true)}else {if(!_)throw Error("try statement without catch or finally");if(this.prev<c.finallyLoc)return f(c.finallyLoc)}}}},abrupt:function(i,a){for(var f=this.tryEntries.length-1;f>=0;--f){var d=this.tryEntries[f];if(d.tryLoc<=this.prev&&n.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var c=d;break}}c&&(i==="break"||i==="continue")&&c.tryLoc<=a&&a<=c.finallyLoc&&(c=null);var v=c?c.completion:{};return v.type=i,v.arg=a,c?(this.method="next",this.next=c.finallyLoc,w):this.complete(v)},complete:function(i,a){if(i.type==="throw")throw i.arg;return i.type==="break"||i.type==="continue"?this.next=i.arg:i.type==="return"?(this.rval=this.arg=i.arg,this.method="return",this.next="end"):i.type==="normal"&&a&&(this.next=a),w},finish:function(i){for(var a=this.tryEntries.length-1;a>=0;--a){var f=this.tryEntries[a];if(f.finallyLoc===i)return this.complete(f.completion,f.afterLoc),M(f),w}},catch:function(i){for(var a=this.tryEntries.length-1;a>=0;--a){var f=this.tryEntries[a];if(f.tryLoc===i){var d=f.completion;if(d.type==="throw"){var c=d.arg;M(f);}return c}}throw Error("illegal catch attempt")},delegateYield:function(i,a,f){return this.delegate={iterator:K(i),resultName:a,nextLoc:f},this.method==="next"&&(this.arg=e),w}},t}function or(e,t,r,n,o,s,l){try{var p=e[s](l),h=p.value;}catch(m){r(m);return}p.done?t(h):Promise.resolve(h).then(n,o);}function kn(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var s=e.apply(t,r);function l(h){or(s,n,o,l,p,"next",h);}function p(h){or(s,n,o,l,p,"throw",h);}l(void 0);})}}function Rn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ir(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Cn(n.key),n);}}function jn(e,t,r){return t&&ir(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Cn(e){var t=Ln(e,"string");return Y(t)=="symbol"?t:t+""}function Ln(e,t){if(Y(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Y(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var ar=function(){function e(){Rn(this,e);}return jn(e,[{key:"openFile",value:function(){var t=kn(Me().mark(function n(o,s){var l;return Me().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(!(we()&&o&&typeof o.uri<"u")){h.next=11;break}return h.prev=1,h.next=4,ze(o.uri);case 4:return l=h.sent,h.abrupt("return",new qe(l));case 8:throw h.prev=8,h.t0=h.catch(1),new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(h.t0));case 11:if(!(typeof o.slice=="function"&&typeof o.size<"u")){h.next=13;break}return h.abrupt("return",Promise.resolve(new qe(o)));case 13:if(typeof o.read!="function"){h.next=18;break}if(s=Number(s),Number.isFinite(s)){h.next=17;break}return h.abrupt("return",Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));case 17:return h.abrupt("return",Promise.resolve(new nr(o,s)));case 18:return h.abrupt("return",Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment")));case 19:case "end":return h.stop()}},n,null,[[1,8]])}));function r(n,o){return t.apply(this,arguments)}return r}()}])}();function Ge(e,t){return we()?Promise.resolve(Tn(e,t)):Promise.resolve(["tus-br",e.name,e.type,e.size,e.lastModified,t.endpoint].join("-"))}function Tn(e,t){var r=e.exif?An(JSON.stringify(e.exif)):"noexif";return ["tus-rn",e.name||"noname",e.size||"nosize",r,t.endpoint].join("/")}function An(e){var t=0;if(e.length===0)return t;for(var r=0;r<e.length;r++){var n=e.charCodeAt(r);t=(t<<5)-t+n,t&=t;}return t}function he(e){"@babel/helpers - typeof";return he=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},he(e)}function Ke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Dn(n.key),n);}}function $e(e,t,r){return t&&sr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Dn(e){var t=Fn(e,"string");return he(t)=="symbol"?t:t+""}function Fn(e,t){if(he(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(he(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var ur=function(){function e(){Ke(this,e);}return $e(e,[{key:"createRequest",value:function(r,n){return new In(r,n)}},{key:"getName",value:function(){return "XHRHttpStack"}}])}();var In=function(){function e(t,r){Ke(this,e),this._xhr=new XMLHttpRequest,this._xhr.open(t,r,true),this._method=t,this._url=r,this._headers={};}return $e(e,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(r,n){this._xhr.setRequestHeader(r,n),this._headers[r]=n;}},{key:"getHeader",value:function(r){return this._headers[r]}},{key:"setProgressHandler",value:function(r){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(n){n.lengthComputable&&r(n.loaded);});}},{key:"send",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(o,s){r._xhr.onload=function(){o(new Nn(r._xhr));},r._xhr.onerror=function(l){s(l);},r._xhr.send(n);})}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}(),Nn=function(){function e(t){Ke(this,e),this._xhr=t;}return $e(e,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(r){return this._xhr.getResponseHeader(r)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}();function de(e){"@babel/helpers - typeof";return de=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},de(e)}function Bn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Hn(n.key),n);}}function zn(e,t,r){return t&&lr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Hn(e){var t=qn(e,"string");return de(t)=="symbol"?t:t+""}function qn(e,t){if(de(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(de(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var Xe=false;try{Xe="localStorage"in window,xe="tusSupport",We=localStorage.getItem(xe),localStorage.setItem(xe,We),We===null&&localStorage.removeItem(xe);}catch(e){if(e.code===e.SECURITY_ERR||e.code===e.QUOTA_EXCEEDED_ERR)Xe=false;else throw e}var xe,We,fr=Xe,cr=function(){function e(){Bn(this,e);}return zn(e,[{key:"findAllUploads",value:function(){var r=this._findEntries("tus::");return Promise.resolve(r)}},{key:"findUploadsByFingerprint",value:function(r){var n=this._findEntries("tus::".concat(r,"::"));return Promise.resolve(n)}},{key:"removeUpload",value:function(r){return localStorage.removeItem(r),Promise.resolve()}},{key:"addUpload",value:function(r,n){var o=Math.round(Math.random()*1e12),s="tus::".concat(r,"::").concat(o);return localStorage.setItem(s,JSON.stringify(n)),Promise.resolve(s)}},{key:"_findEntries",value:function(r){for(var n=[],o=0;o<localStorage.length;o++){var s=localStorage.key(o);if(s.indexOf(r)===0)try{var l=JSON.parse(localStorage.getItem(s));l.urlStorageKey=s,n.push(l);}catch{}}return n}}])}();function ne(e){"@babel/helpers - typeof";return ne=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ne(e)}function Mn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,mr(n.key),n);}}function Gn(e,t,r){return r&&pr(e,r),Object.defineProperty(e,"prototype",{writable:false}),e}function Kn(e,t,r){return t=Se(t),$n(e,yr()?Reflect.construct(t,r||[],Se(e).constructor):t.apply(e,r))}function $n(e,t){if(t&&(ne(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wn(e)}function Wn(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch{}return (yr=function(){return !!e})()}function Se(e){return Se=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Se(e)}function Xn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}}),Object.defineProperty(e,"prototype",{writable:false}),t&&Ye(e,t);}function Ye(e,t){return Ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ye(e,t)}function hr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n);}return r}function re(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hr(Object(r),true).forEach(function(n){Yn(e,n,r[n]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n));});}return e}function Yn(e,t,r){return t=mr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function mr(e){var t=Zn(e,"string");return ne(t)=="symbol"?t:t+""}function Zn(e,t){if(ne(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ne(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (t==="string"?String:Number)(e)}var dr=re(re({},_e.defaultOptions),{},{httpStack:new ur,fileReader:new ar,urlStorage:fr?new cr:new it,fingerprint:Ge}),vr=function(e){function t(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Mn(this,t),n=re(re({},dr),n),Kn(this,t,[r,n])}return Xn(t,e),Gn(t,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=re(re({},dr),o),_e.terminate(n,o)}}])}(_e);exports.a=class O extends chunk5NSCV6C2_cjs.i{constructor(){super(...arguments);this.disableCompletion=false;this._completed=false;this.languageController=new chunk4GTAVYTC_cjs.d(this);}connectedCallback(){super.connectedCallback(),window.customElements.get("lottie-player")||import('./lottie-player.esm-OYBEUNQX.cjs'),this.languageController.locale=this.locale||"en",this.embedChannel=chunk2P6HF22Q_cjs.a.connect(this.token),this.embedChannel.upload_id&&(this._upload_id=this.embedChannel.upload_id),this.embedChannel.channel.on("initiate",({upload_id:r})=>{this._upload_id=r,this.embedChannel.upload_id=r;}),this.embedChannel.channel.on("completed",this.completed.bind(this)),this.embedChannel.channel.on("rendition",this.rendition.bind(this)),this.embedChannel.channel.on("error",this.error.bind(this));}requestUpdate(r,n){super.requestUpdate(r,n),r==="locale"&&(this.languageController.locale=this.locale);}reset(){this._progress=0,this._completed=false,this.embedChannel.channel.push("reset",{});}disconnectedCallback(){super.disconnectedCallback();}handleDrop(r){if(r.preventDefault(),r.dataTransfer&&r.dataTransfer.items){for(let n of r.dataTransfer.items)if(n.kind==="file"){let o=n.getAsFile();o&&(o.type.startsWith("video/")||o.type.startsWith("audio/"))&&(this._progress=1,this.upload(o));}}else if(r.dataTransfer&&r.dataTransfer.files)for(let n of r.dataTransfer.files)(n.type.startsWith("video/")||n.type.startsWith("audio/"))&&(this._progress=1,this.upload(n));}handleForm(r){this._progress=1;let n=r.target;if(n.files)for(let o of n.files)(o.type.startsWith("video/")||o.type.startsWith("audio/"))&&this.upload(o);}upload(r){this.dispatchEvent(new CustomEvent("upload",{bubbles:true,composed:true,detail:{file:r}}));let n=new vr(r,{endpoint:chunk5STN56TL_cjs.a.upload.endpoint,retryDelays:[0,3e3,5e3,1e4,2e4,6e4,6e4],metadata:{title:r.name,filetype:r.type,token:this.token,upload_id:this._upload_id},onError:o=>{console.log(o),this.dispatchEvent(new CustomEvent("failed",{bubbles:true,composed:true,detail:o}));},onProgress:(o,s)=>{let l=Math.round(o/s*100);l>this._progress&&(this._progress=l),this.dispatchEvent(new CustomEvent("progress",{bubbles:true,composed:true,detail:{progress:l}}));},onSuccess:()=>{this._progress=100,this.dispatchEvent(new CustomEvent("processing",{bubbles:true,composed:true}));},removeFingerprintOnSuccess:true});n.findPreviousUploads().then(o=>{o.length&&n.resumeFromPreviousUpload(o[0]),n.start();});}completed(r){this.disableCompletion||(this._completed=true),this.dispatchEvent(new CustomEvent("completed",{bubbles:true,composed:true,detail:r}));}rendition(r){this.dispatchEvent(new CustomEvent("rendition",{bubbles:true,composed:true,detail:r}));}error(r){console.warn(`[mave-upload] ${r.message}`),this.dispatchEvent(new CustomEvent("error",{bubbles:true,detail:r}));}render(){return chunk5NSCV6C2_cjs.c` ${this._progress?this.renderProgress():this.renderUpload()} `}styleOpacity(){return this.languageController.loaded?this._upload_id?{}:{pointerEvents:"none",opacity:"0.5"}:{pointerEvents:"none",opacity:"0"}}styleFont(){return this.font?{fontFamily:this.font}:{fontFamily:"system-ui"}}renderUpload(){return chunk5NSCV6C2_cjs.c`<form
4
4
  class="state"
5
5
  style=${chunkQ22T22LT_cjs.a({...this.styleOpacity(),...this.styleFont()})}
6
6
  @dragover=${r=>r.preventDefault()}