2 lines
84 KiB
JavaScript
2 lines
84 KiB
JavaScript
!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).tus=t()}(function(){return function n(o,i,u){function a(e,t){if(!i[e]){if(!o[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(s)return s(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}r=i[e]={exports:{}},o[e][0].call(r.exports,function(t){return a(o[e][1][t]||t)},r,r.exports,n,o,i,u)}return i[e].exports}for(var s="function"==typeof require&&require,t=0;t<u.length;t++)a(u[t]);return a}({1:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=n(t("./isReactNative.js")),u=n(t("./uriToBlob.js")),s=n(t("./sources/FileSource.js")),l=n(t("./sources/StreamSource.js"));function n(t){return t&&t.__esModule?t:{default:t}}function U(t){return(U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function j(){j=function(){return u};var u={},t=Object.prototype,s=t.hasOwnProperty,l=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(t){i=function(t,e,r){return t[e]=r}}function a(t,e,r,n){var o,i,u,a,e=e&&e.prototype instanceof p?e:p,e=Object.create(e.prototype),n=new _(n||[]);return l(e,"_invoke",{value:(o=t,i=r,u=n,a="suspendedStart",function(t,e){if("executing"===a)throw new Error("Generator is already running");if("completed"===a){if("throw"===t)throw e;return E()}for(u.method=t,u.arg=e;;){var r=u.delegate;if(r){r=function t(e,r){var n=r.method,o=e.iterator[n];if(void 0===o)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=void 0,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),c;n=f(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,c;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,c):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}(r,u);if(r){if(r===c)continue;return r}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===a)throw a="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);a="executing";r=f(o,i,u);if("normal"===r.type){if(a=u.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:u.done}}"throw"===r.type&&(a="completed",u.method="throw",u.arg=r.arg)}})}),e}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}u.wrap=a;var c={};function p(){}function h(){}function d(){}var e={},y=(i(e,n,function(){return this}),Object.getPrototypeOf),y=y&&y(y(S([]))),g=(y&&y!==t&&s.call(y,n)&&(e=y),d.prototype=p.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function m(u,a){var e;l(this,"_invoke",{value:function(r,n){function t(){return new a(function(t,e){!function e(t,r,n,o){var i,t=f(u[t],u,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==U(r)&&s.call(r,"__await")?a.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):a.resolve(r).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}})}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function w(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function S(e){if(e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(s.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:E}}function E(){return{value:void 0,done:!0}}return l(g,"constructor",{value:h.prototype=d,configurable:!0}),l(d,"constructor",{value:h,configurable:!0}),h.displayName=i(d,o,"GeneratorFunction"),u.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},u.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,i(t,o,"GeneratorFunction")),t.prototype=Object.create(g),t},u.awrap=function(t){return{__await:t}},v(m.prototype),i(m.prototype,r,function(){return this}),u.AsyncIterator=m,u.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new m(a(t,e,r,n),o);return u.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},v(g),i(g,o,"Generator"),i(g,n,function(){return this}),i(g,"toString",function(){return"[object Generator]"}),u.keys=function(t){var e,r=Object(t),n=[];for(e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},u.values=S,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var u=s.call(o,"catchLoc"),a=s.call(o,"finallyLoc");if(u&&a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,c):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),c},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),w(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,w(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},u}function f(t,e,r,n,o,i,u){try{var a=t[i](u),s=a.value}catch(t){return void r(t)}a.done?e(s):Promise.resolve(s).then(n,o)}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==U(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==U(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===U(t)?t:String(t)}(n.key),n)}}t=function(){function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function")}var e,r,n,a,o;return e=t,(r=[{key:"openFile",value:(a=j().mark(function t(e,r){var n;return j().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if((0,i.default)()&&e&&void 0!==e.uri)return t.prev=1,t.next=4,(0,u.default)(e.uri);t.next=11;break;case 4:return n=t.sent,t.abrupt("return",new s.default(n));case 8:throw t.prev=8,t.t0=t.catch(1),new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(t.t0));case 11:if("function"==typeof e.slice&&void 0!==e.size)return t.abrupt("return",Promise.resolve(new s.default(e)));t.next=13;break;case 13:if("function"!=typeof e.read){t.next=18;break}if(r=Number(r),Number.isFinite(r)){t.next=17;break}return t.abrupt("return",Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));case 17:return t.abrupt("return",Promise.resolve(new l.default(e,r)));case 18:return t.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 t.stop()}},t,null,[[1,8]])}),o=function(){var t=this,u=arguments;return new Promise(function(e,r){var n=a.apply(t,u);function o(t){f(n,e,r,o,i,"next",t)}function i(t){f(n,e,r,o,i,"throw",t)}o(void 0)})},function(t,e){return o.apply(this,arguments)})}])&&c(e.prototype,r),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();r.default=t},{"./isReactNative.js":5,"./sources/FileSource.js":6,"./sources/StreamSource.js":7,"./uriToBlob.js":10}],2:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e){if((0,n.default)())return Promise.resolve(function(t,e){var r=t.exif?function(t){var e=0;if(0!==t.length)for(var r=0;r<t.length;r++){var n=t.charCodeAt(r);e=(e<<5)-e+n,e&=e}return e}(JSON.stringify(t.exif)):"noexif";return["tus-rn",t.name||"noname",t.size||"nosize",r,e.endpoint].join("/")}(t,e));return Promise.resolve(["tus-br",t.name,t.type,t.size,t.lastModified,e.endpoint].join("-"))};var n=(r=t("./isReactNative.js"))&&r.__esModule?r:{default:r}},{"./isReactNative.js":5}],3:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function u(t,e,r){e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1})}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function t(){n(this,t)}return u(t,[{key:"createRequest",value:function(t,e){return new a(t,e)}},{key:"getName",value:function(){return"XHRHttpStack"}}]),t}();var a=function(){function r(t,e){n(this,r),this._xhr=new XMLHttpRequest,this._xhr.open(t,e,!0),this._method=t,this._url=e,this._headers={}}return u(r,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(t,e){this._xhr.setRequestHeader(t,e),this._headers[t]=e}},{key:"getHeader",value:function(t){return this._headers[t]}},{key:"setProgressHandler",value:function(e){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(t){t.lengthComputable&&e(t.loaded)})}},{key:"send",value:function(){var r=this,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;return new Promise(function(t,e){r._xhr.onload=function(){t(new s(r._xhr))},r._xhr.onerror=function(t){e(t)},r._xhr.send(n)})}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),r}(),s=function(){function e(t){n(this,e),this._xhr=t}return u(e,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(t){return this._xhr.getResponseHeader(t)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),e}()},{}],4:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"DefaultHttpStack",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(r,"DetailedError",{enumerable:!0,get:function(){return u.default}}),r.Upload=void 0,Object.defineProperty(r,"canStoreURLs",{enumerable:!0,get:function(){return a.canStoreURLs}}),r.defaultOptions=void 0,Object.defineProperty(r,"enableDebugLog",{enumerable:!0,get:function(){return i.enableDebugLog}}),r.isSupported=void 0;var n=f(t("../upload.js")),o=f(t("../noopUrlStorage.js")),i=t("../logger.js"),u=f(t("../error.js")),a=t("./urlStorage.js"),s=f(t("./httpStack.js")),l=f(t("./fileReader.js")),t=f(t("./fileSignature.js"));function f(t){return t&&t.__esModule?t:{default:t}}function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,m(n.key),n)}}function h(t,e){return(h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function d(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=y(r),e=(t=n?(t=y(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===c(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function y(t){return(y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function g(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function v(n){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?g(Object(o),!0).forEach(function(t){var e,r;e=n,r=o[t=t],(t=m(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):g(Object(o)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(o,t))})}return n}function m(t){t=function(t,e){if("object"!==c(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===c(t)?t:String(t)}var b=v(v({},n.default.defaultOptions),{},{httpStack:new s.default,fileReader:new l.default,urlStorage:new(a.canStoreURLs?a.WebStorageUrlStorage:o.default),fingerprint:t.default}),l=(r.defaultOptions=b,function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t);var r,o=d(i);function i(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=this,n=i;if(r instanceof n)return e=v(v({},b),e),o.call(this,t,e);throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"terminate",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=v(v({},b),e);return n.default.terminate(t,e)}}],(r=null)&&p(e.prototype,r),t&&p(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}(n.default)),o=(r.Upload=l,window),t=o.XMLHttpRequest,l=o.Blob,o=t&&l&&"function"==typeof l.prototype.slice;r.isSupported=o},{"../error.js":12,"../logger.js":13,"../noopUrlStorage.js":14,"../upload.js":15,"./fileReader.js":1,"./fileSignature.js":2,"./httpStack.js":3,"./urlStorage.js":11}],5:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){return"undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase()}},{}],6:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=n(t("./isCordova.js")),i=n(t("./readAsByteArray.js"));function n(t){return t&&t.__esModule?t:{default:t}}function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==u(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===u(t)?t:String(t)}(n.key),n)}}t=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this._file=t,this.size=t.size}var t,r,n;return t=e,(r=[{key:"slice",value:function(t,e){return(0,o.default)()?(0,i.default)(this._file.slice(t,e)):(t=this._file.slice(t,e),e=e>=this.size,Promise.resolve({value:t,done:e}))}},{key:"close",value:function(){}}])&&a(t.prototype,r),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();r.default=t},{"./isCordova.js":8,"./readAsByteArray.js":9}],7:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function u(t){return void 0===t?0:void 0!==t.size?t.size:t.length}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this._buffer=void 0,this._bufferOffset=0,this._reader=t,this._done=!1}var t,r,n;return t=e,(r=[{key:"slice",value:function(t,e){return t<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(t,e)}},{key:"_readUntilEnoughDataOrDone",value:function(r,n){var t,o=this,e=n<=this._bufferOffset+u(this._buffer);return this._done||e?(t=null==(e=this._getDataFromBuffer(r,n))&&this._done,Promise.resolve({value:e,done:t})):this._reader.read().then(function(t){var e=t.value;return t.done?o._done=!0:void 0===o._buffer?o._buffer=e:o._buffer=function(t,e){if(t.concat)return t.concat(e);if(t instanceof Blob)return new Blob([t,e],{type:t.type});var r;if(t.set)return(r=new t.constructor(t.length+e.length)).set(t),r.set(e,t.length),r;throw new Error("Unknown data type")}(o._buffer,e),o._readUntilEnoughDataOrDone(r,n)})}},{key:"_getDataFromBuffer",value:function(t,e){t>this._bufferOffset&&(this._buffer=this._buffer.slice(t-this._bufferOffset),this._bufferOffset=t);var r=0===u(this._buffer);return this._done&&r?null:this._buffer.slice(0,e-t)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}])&&i(t.prototype,r),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();r.default=n},{}],8:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){return"undefined"!=typeof window&&(void 0!==window.PhoneGap||void 0!==window.Cordova||void 0!==window.cordova)}},{}],9:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return new Promise(function(e,r){var n=new FileReader;n.onload=function(){var t=new Uint8Array(n.result);e({value:t})},n.onerror=function(t){r(t)},n.readAsArrayBuffer(t)})}},{}],10:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return new Promise(function(e,r){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var t=n.response;e(t)},n.onerror=function(t){r(t)},n.open("GET",t),n.send()})}},{}],11:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}Object.defineProperty(r,"__esModule",{value:!0}),r.canStoreURLs=r.WebStorageUrlStorage=void 0;var n=!1;try{var n="localStorage"in window,u="tusSupport",a=localStorage.getItem(u);localStorage.setItem(u,a),null===a&&localStorage.removeItem(u)}catch(t){if(t.code!==t.SECURITY_ERR&&t.code!==t.QUOTA_EXCEEDED_ERR)throw t;n=!1}a=n,r.canStoreURLs=a,u=function(){function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function")}var e,r,n;return e=t,(r=[{key:"findAllUploads",value:function(){var t=this._findEntries("tus::");return Promise.resolve(t)}},{key:"findUploadsByFingerprint",value:function(t){t=this._findEntries("tus::".concat(t,"::"));return Promise.resolve(t)}},{key:"removeUpload",value:function(t){return localStorage.removeItem(t),Promise.resolve()}},{key:"addUpload",value:function(t,e){var r=Math.round(1e12*Math.random()),t="tus::".concat(t,"::").concat(r);return localStorage.setItem(t,JSON.stringify(e)),Promise.resolve(t)}},{key:"_findEntries",value:function(t){for(var e=[],r=0;r<localStorage.length;r++){var n=localStorage.key(r);if(0===n.indexOf(t))try{var o=JSON.parse(localStorage.getItem(n));o.urlStorageKey=n,e.push(o)}catch(t){}}return e}}])&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();r.WebStorageUrlStorage=u},{}],12:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function u(r){var n=s();return function(){var t,e=f(r),e=(t=n?(t=f(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function n(t){var r="function"==typeof Map?new Map:void 0;return function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return a(t,arguments,f(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),l(e,t)}(t)}function a(t,e,r){return(a=s()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);e=new(Function.bind.apply(t,n));return r&&l(e,r.prototype),e}).apply(null,arguments)}function s(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var c=function(t){var e=s;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t);var r,n,a=u(s);function s(t){var e,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,i=this,u=s;if(i instanceof u)return(i=a.call(this,t)).originalRequest=n,i.originalResponse=o,null!=(i.causingError=r)&&(t+=", caused by ".concat(r.toString())),null!=n&&(u=n.getHeader("X-Request-ID")||"n/a",r=n.getMethod(),n=n.getURL(),e=o?o.getStatus():"n/a",o=o?o.getBody()||"":"n/a",t+=", originated from request (method: ".concat(r,", url: ").concat(n,", response code: ").concat(e,", response text: ").concat(o,", request id: ").concat(u,")")),i.message=t,i;throw new TypeError("Cannot call a class as a function")}return e=s,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(n(Error));r.default=c},{}],13:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.enableDebugLog=function(){n=!0};var n=!(r.log=function(t){n&&console.log(t)})},{}],14:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=function(){function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function")}var e,r,n;return e=t,(r=[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(t){return Promise.resolve([])}},{key:"removeUpload",value:function(t){return Promise.resolve()}},{key:"addUpload",value:function(t,e){return Promise.resolve(null)}}])&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();r.default=n},{}],15:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=t("js-base64"),o=s(t("url-parse")),a=s(t("./error.js")),u=t("./logger.js"),i=s(t("./uuid.js"));function s(t){return t&&t.__esModule?t:{default:t}}function U(){U=function(){return u};var u={},t=Object.prototype,s=t.hasOwnProperty,l=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(t){i=function(t,e,r){return t[e]=r}}function a(t,e,r,n){var o,i,u,a,e=e&&e.prototype instanceof p?e:p,e=Object.create(e.prototype),n=new _(n||[]);return l(e,"_invoke",{value:(o=t,i=r,u=n,a="suspendedStart",function(t,e){if("executing"===a)throw new Error("Generator is already running");if("completed"===a){if("throw"===t)throw e;return E()}for(u.method=t,u.arg=e;;){var r=u.delegate;if(r){r=function t(e,r){var n=r.method,o=e.iterator[n];if(void 0===o)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=void 0,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),c;n=f(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,c;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,c):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}(r,u);if(r){if(r===c)continue;return r}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===a)throw a="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);a="executing";r=f(o,i,u);if("normal"===r.type){if(a=u.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:u.done}}"throw"===r.type&&(a="completed",u.method="throw",u.arg=r.arg)}})}),e}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}u.wrap=a;var c={};function p(){}function h(){}function d(){}var e={},y=(i(e,n,function(){return this}),Object.getPrototypeOf),y=y&&y(y(S([]))),g=(y&&y!==t&&s.call(y,n)&&(e=y),d.prototype=p.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function m(u,a){var e;l(this,"_invoke",{value:function(r,n){function t(){return new a(function(t,e){!function e(t,r,n,o){var i,t=f(u[t],u,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==j(r)&&s.call(r,"__await")?a.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):a.resolve(r).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}})}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function w(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function S(e){if(e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(s.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:E}}function E(){return{value:void 0,done:!0}}return l(g,"constructor",{value:h.prototype=d,configurable:!0}),l(d,"constructor",{value:h,configurable:!0}),h.displayName=i(d,o,"GeneratorFunction"),u.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},u.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,i(t,o,"GeneratorFunction")),t.prototype=Object.create(g),t},u.awrap=function(t){return{__await:t}},v(m.prototype),i(m.prototype,r,function(){return this}),u.AsyncIterator=m,u.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new m(a(t,e,r,n),o);return u.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},v(g),i(g,o,"Generator"),i(g,n,function(){return this}),i(g,"toString",function(){return"[object Generator]"}),u.keys=function(t){var e,r=Object(t),n=[];for(e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},u.values=S,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var u=s.call(o,"catchLoc"),a=s.call(o,"finallyLoc");if(u&&a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,c):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),c},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),w(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,w(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},u}function l(t,e,r,n,o,i,u){try{var a=t[i](u),s=a.value}catch(t){return void r(t)}a.done?e(s):Promise.resolve(s).then(n,o)}function f(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],s=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);s=!0);}catch(t){l=!0,o=t}finally{try{if(!s&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(l)throw o}}return a}}(t,e)||function(t,e){var r;if(t)return"string"==typeof t?c(t,e):"Map"===(r="Object"===(r=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(t,e):void 0}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function j(t){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function h(n){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?p(Object(o),!0).forEach(function(t){var e,r;e=n,r=o[t=t],(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):p(Object(o)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(o,t))})}return n}function d(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,y(n.key),n)}}function y(t){t=function(t,e){if("object"!==j(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==j(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===j(t)?t:String(t)}var t={endpoint:null,uploadUrl:null,metadata:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:null,chunkSize:1/0,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null},g=function(){function c(t,e){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");"resume"in e&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=e,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=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}var t,e,r;return t=c,r=[{key:"terminate",value:function(o){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},u=b("DELETE",o,i);return w(u,null,i).then(function(t){if(204!==t.getStatus())throw new a.default("tus: unexpected response while terminating upload",null,u,t)}).catch(function(t){var e,r,n;if(S(t=t instanceof a.default?t:new a.default("tus: failed to terminate upload",t,u,null),0,i))return e=i.retryDelays[0],r=i.retryDelays.slice(1),n=h(h({},i),{},{retryDelays:r}),new Promise(function(t){return setTimeout(t,e)}).then(function(){return c.terminate(o,n)});throw t})}}],(e=[{key:"findPreviousUploads",value:function(){var e=this;return this.options.fingerprint(this.file,this.options).then(function(t){return e._urlStorage.findUploadsByFingerprint(t)})}},{key:"resumeFromPreviousUpload",value:function(t){this.url=t.uploadUrl||null,this._parallelUploadUrls=t.parallelUploadUrls||null,this._urlStorageKey=t.urlStorageKey}},{key:"start",value:function(){var e=this,r=this.file;if(r)if(this.options.endpoint||this.options.uploadUrl||this.url){var t=this.options.retryDelays;if(null!=t&&"[object Array]"!==Object.prototype.toString.call(t))this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));else{if(1<this.options.parallelUploads)for(var n=0,o=["uploadUrl","uploadSize","uploadLengthDeferred"];n<o.length;n++){var i=o[n];if(this.options[i])return void this._emitError(new Error("tus: cannot use the ".concat(i," option when parallelUploads is enabled")))}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1)return void this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length)return void this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"))}this.options.fingerprint(r,this.options).then(function(t){return null==t?(0,u.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,u.log)("Calculated fingerprint: ".concat(t)),e._fingerprint=t,e._source||e.options.fileReader.openFile(r,e.options.chunkSize)}).then(function(t){if(e._source=t,e.options.uploadLengthDeferred)e._size=null;else if(null!=e.options.uploadSize){if(e._size=Number(e.options.uploadSize),Number.isNaN(e._size))return void e._emitError(new Error("tus: cannot convert `uploadSize` option into a number"))}else if(e._size=e._source.size,null==e._size)return void e._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));1<e.options.parallelUploads||null!=e._parallelUploadUrls?e._startParallelUpload():e._startSingleUpload()}).catch(function(t){e._emitError(t)})}}else this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));else this._emitError(new Error("tus: no file or stream to upload provided"))}},{key:"_startParallelUpload",value:function(){var r,a=this,s=this._size,l=0,t=(this._parallelUploads=[],null!=this._parallelUploadUrls?this._parallelUploadUrls.length:this.options.parallelUploads),f=null!=(e=this.options.parallelUploadBoundaries)?e:function(t,e){for(var r=Math.floor(t/e),n=[],o=0;o<e;o++)n.push({start:r*o,end:r*(o+1)});return n[e-1].end=t,n}(this._source.size,t),e=(this._parallelUploadUrls&&f.forEach(function(t,e){t.uploadUrl=a._parallelUploadUrls[e]||null}),this._parallelUploadUrls=new Array(f.length),f.map(function(o,i){var u=0;return a._source.slice(o.start,o.end).then(function(t){var n=t.value;return new Promise(function(t,e){var t=h(h({},a.options),{},{uploadUrl:o.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:{},headers:h(h({},a.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:t,onError:e,onProgress:function(t){l=l-u+t,u=t,a._emitProgress(l,s)},onUploadUrlAvailable:function(){a._parallelUploadUrls[i]=r.url,a._parallelUploadUrls.filter(function(t){return Boolean(t)}).length===f.length&&a._saveUploadInUrlStorage()}}),r=new c(n,t);r.start(),a._parallelUploads.push(r)})})}));Promise.all(e).then(function(){(r=a._openRequest("POST",a.options.endpoint)).setHeader("Upload-Concat","final;".concat(a._parallelUploadUrls.join(" ")));var t=v(a.options.metadata);return""!==t&&r.setHeader("Upload-Metadata",t),a._sendRequest(r,null)}).then(function(t){var e;m(t.getStatus(),200)?null==(e=t.getHeader("Location"))?a._emitHttpError(r,t,"tus: invalid or missing Location header"):(a.url=E(a.options.endpoint,e),(0,u.log)("Created upload at ".concat(a.url)),a._emitSuccess()):a._emitHttpError(r,t,"tus: unexpected response while creating upload")}).catch(function(t){a._emitError(t)})}},{key:"_startSingleUpload",value:function(){this._aborted=!1,null!=this.url?((0,u.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload()):null!=this.options.uploadUrl?((0,u.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload()):((0,u.log)("Creating a new upload"),this._createUpload())}},{key:"abort",value:function(e){var t=this;return null!=this._parallelUploads&&this._parallelUploads.forEach(function(t){t.abort(e)}),null!==this._req&&this._req.abort(),this._aborted=!0,null!=this._retryTimeout&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),e&&null!=this.url?c.terminate(this.url,this.options).then(function(){return t._removeFromUrlStorage()}):Promise.resolve()}},{key:"_emitHttpError",value:function(t,e,r,n){this._emitError(new a.default(r,n,t,e))}},{key:"_emitError",value:function(t){var e,r=this;if(!this._aborted){if(null!=this.options.retryDelays)if(null!=this._offset&&this._offset>this._offsetBeforeRetry&&(this._retryAttempt=0),S(t,this._retryAttempt,this.options))return e=this.options.retryDelays[this._retryAttempt++],this._offsetBeforeRetry=this._offset,void(this._retryTimeout=setTimeout(function(){r.start()},e));if("function"!=typeof this.options.onError)throw t;this.options.onError(t)}}},{key:"_emitSuccess",value:function(){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),"function"==typeof this.options.onSuccess&&this.options.onSuccess()}},{key:"_emitProgress",value:function(t,e){"function"==typeof this.options.onProgress&&this.options.onProgress(t,e)}},{key:"_emitChunkComplete",value:function(t,e,r){"function"==typeof this.options.onChunkComplete&&this.options.onChunkComplete(t,e,r)}},{key:"_createUpload",value:function(){var r,t,n=this;this.options.endpoint?(r=this._openRequest("POST",this.options.endpoint),this.options.uploadLengthDeferred?r.setHeader("Upload-Defer-Length",1):r.setHeader("Upload-Length",this._size),""!==(t=v(this.options.metadata))&&r.setHeader("Upload-Metadata",t),(this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,this._addChunkToRequest(r)):this._sendRequest(r,null)).then(function(t){var e;m(t.getStatus(),200)?null==(e=t.getHeader("Location"))?n._emitHttpError(r,t,"tus: invalid or missing Location header"):(n.url=E(n.options.endpoint,e),(0,u.log)("Created upload at ".concat(n.url)),"function"==typeof n.options.onUploadUrlAvailable&&n.options.onUploadUrlAvailable(),0===n._size?(n._emitSuccess(),n._source.close()):n._saveUploadInUrlStorage().then(function(){n.options.uploadDataDuringCreation?n._handleUploadResponse(r,t):(n._offset=0,n._performUpload())})):n._emitHttpError(r,t,"tus: unexpected response while creating upload")}).catch(function(t){n._emitHttpError(r,null,"tus: failed to create upload",t)})):this._emitError(new Error("tus: unable to create upload because no endpoint is provided"))}},{key:"_resumeUpload",value:function(){var o=this,i=this._openRequest("HEAD",this.url);this._sendRequest(i,null).then(function(t){var e=t.getStatus();if(!m(e,200))return 423===e?void o._emitHttpError(i,t,"tus: upload is currently locked; retry later"):(m(e,400)&&o._removeFromUrlStorage(),o.options.endpoint?(o.url=null,void o._createUpload()):void o._emitHttpError(i,t,"tus: unable to resume upload (new upload cannot be created without an endpoint)"));var r,n=parseInt(t.getHeader("Upload-Offset"),10);Number.isNaN(n)?o._emitHttpError(i,t,"tus: invalid or missing offset value"):(r=parseInt(t.getHeader("Upload-Length"),10),Number.isNaN(r)&&!o.options.uploadLengthDeferred?o._emitHttpError(i,t,"tus: invalid or missing length value"):("function"==typeof o.options.onUploadUrlAvailable&&o.options.onUploadUrlAvailable(),o._saveUploadInUrlStorage().then(function(){n===r?(o._emitProgress(r,r),o._emitSuccess()):(o._offset=n,o._performUpload())})))}).catch(function(t){o._emitHttpError(i,null,"tus: failed to resume upload",t)})}},{key:"_performUpload",value:function(){var e,r=this;this._aborted||(this.options.overridePatchMethod?(e=this._openRequest("POST",this.url)).setHeader("X-HTTP-Method-Override","PATCH"):e=this._openRequest("PATCH",this.url),e.setHeader("Upload-Offset",this._offset),this._addChunkToRequest(e).then(function(t){m(t.getStatus(),200)?r._handleUploadResponse(e,t):r._emitHttpError(e,t,"tus: unexpected response while uploading chunk")}).catch(function(t){r._aborted||r._emitHttpError(e,null,"tus: failed to upload chunk at offset ".concat(r._offset),t)}))}},{key:"_addChunkToRequest",value:function(n){var o=this,e=this._offset,t=this._offset+this.options.chunkSize;return n.setProgressHandler(function(t){o._emitProgress(e+t,o._size)}),n.setHeader("Content-Type","application/offset+octet-stream"),(t===1/0||t>this._size)&&!this.options.uploadLengthDeferred&&(t=this._size),this._source.slice(e,t).then(function(t){var e=t.value,t=t.done,r=e&&e.size?e.size:0,r=(o.options.uploadLengthDeferred&&t&&(o._size=o._offset+r,n.setHeader("Upload-Length",o._size)),o._offset+r);return!o.options.uploadLengthDeferred&&t&&r!==o._size?Promise.reject(new Error("upload was configured with a size of ".concat(o._size," bytes, but the source is done after ").concat(r," bytes"))):null===e?o._sendRequest(n):(o._emitProgress(o._offset,o._size),o._sendRequest(n,e))})}},{key:"_handleUploadResponse",value:function(t,e){var r=parseInt(e.getHeader("Upload-Offset"),10);Number.isNaN(r)?this._emitHttpError(t,e,"tus: invalid or missing offset value"):(this._emitProgress(r,this._size),this._emitChunkComplete(r-this._offset,r,this._size),(this._offset=r)===this._size?(this._emitSuccess(),this._source.close()):this._performUpload())}},{key:"_openRequest",value:function(t,e){t=b(t,e,this.options);return this._req=t}},{key:"_removeFromUrlStorage",value:function(){var e=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(t){e._emitError(t)}),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var t,e=this;return this.options.storeFingerprintForResuming&&this._fingerprint&&null===this._urlStorageKey?(t={size:this._size,metadata:this.options.metadata,creationTime:(new Date).toString()},this._parallelUploads?t.parallelUploadUrls=this._parallelUploadUrls:t.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,t).then(function(t){e._urlStorageKey=t})):Promise.resolve()}},{key:"_sendRequest",value:function(t){return w(t,1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,this.options)}}])&&d(t.prototype,e),r&&d(t,r),Object.defineProperty(t,"prototype",{writable:!1}),c}();function v(t){return Object.entries(t).map(function(t){var t=f(t,2),e=t[0],t=t[1];return"".concat(e," ").concat(n.Base64.encode(String(t)))}).join(",")}function m(t,e){return e<=t&&t<e+100}function b(t,e,r){var n=r.httpStack.createRequest(t,e),t=(n.setHeader("Tus-Resumable","1.0.0"),r.headers||{});return Object.entries(t).forEach(function(t){var t=f(t,2),e=t[0],t=t[1];n.setHeader(e,t)}),r.addRequestId&&(e=(0,i.default)(),n.setHeader("X-Request-ID",e)),n}function w(){return _.apply(this,arguments)}function _(){var a;return a=U().mark(function t(e,r,n){var o;return U().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("function"==typeof n.onBeforeRequest)return t.next=3,n.onBeforeRequest(e);t.next=3;break;case 3:return t.next=5,e.send(r);case 5:if(o=t.sent,"function"==typeof n.onAfterResponse)return t.next=9,n.onAfterResponse(e,o);t.next=9;break;case 9:return t.abrupt("return",o);case 10:case"end":return t.stop()}},t)}),(_=function(){var t=this,u=arguments;return new Promise(function(e,r){var n=a.apply(t,u);function o(t){l(n,e,r,o,i,"next",t)}function i(t){l(n,e,r,o,i,"throw",t)}o(void 0)})}).apply(this,arguments)}function S(t,e,r){return!(null==r.retryDelays||e>=r.retryDelays.length||null==t.originalRequest)&&(r&&"function"==typeof r.onShouldRetry?r.onShouldRetry(t,e,r):(!m(e=t.originalResponse?t.originalResponse.getStatus():0,400)||409===e||423===e)&&(r=!0,r=!("undefined"!=typeof window&&"navigator"in window&&!1===window.navigator.onLine)&&r))}function E(t,e){return new o.default(e,t).toString()}g.defaultOptions=t,r.default=g},{"./error.js":12,"./logger.js":13,"./uuid.js":16,"js-base64":20,"url-parse":23}],16:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}},{}],17:[function(t,e,r){"use strict";r.byteLength=function(t){var t=f(t),e=t[0],t=t[1];return 3*(e+t)/4-t},r.toByteArray=function(t){var e,r,n=f(t),o=n[0],n=n[1],i=new l(function(t,e){return 3*(t+e)/4-e}(o,n)),u=0,a=0<n?o-4:o;for(r=0;r<a;r+=4)e=s[t.charCodeAt(r)]<<18|s[t.charCodeAt(r+1)]<<12|s[t.charCodeAt(r+2)]<<6|s[t.charCodeAt(r+3)],i[u++]=e>>16&255,i[u++]=e>>8&255,i[u++]=255&e;2===n&&(e=s[t.charCodeAt(r)]<<2|s[t.charCodeAt(r+1)]>>4,i[u++]=255&e);1===n&&(e=s[t.charCodeAt(r)]<<10|s[t.charCodeAt(r+1)]<<4|s[t.charCodeAt(r+2)]>>2,i[u++]=e>>8&255,i[u++]=255&e);return i},r.fromByteArray=function(t){for(var e,r=t.length,n=r%3,o=[],i=0,u=r-n;i<u;i+=16383)o.push(function(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(255&t[i+2]),o.push(function(t){return a[t>>18&63]+a[t>>12&63]+a[t>>6&63]+a[63&t]}(n));return o.join("")}(t,i,u<i+16383?u:i+16383));1==n?(e=t[r-1],o.push(a[e>>2]+a[e<<4&63]+"==")):2==n&&(e=(t[r-2]<<8)+t[r-1],o.push(a[e>>10]+a[e>>4&63]+a[e<<2&63]+"="));return o.join("")};for(var a=[],s=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,i=n.length;o<i;++o)a[o]=n[o],s[n.charCodeAt(o)]=o;function f(t){var e=t.length;if(0<e%4)throw new Error("Invalid string. Length must be a multiple of 4");t=t.indexOf("="),e=(t=-1===t?e:t)===e?0:4-t%4;return[t,e]}s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},{}],18:[function(k,t,L){!function(t){!function(){"use strict";var U=k("base64-js"),i=k("ieee754"),e=(L.Buffer=c,L.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},L.INSPECT_MAX_BYTES=50,2147483647);function s(t){if(e<t)throw new RangeError('The value "'+t+'" is invalid for option "size"');t=new Uint8Array(t);return t.__proto__=c.prototype,t}function c(t,e,r){if("number"!=typeof t)return n(t,e,r);if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}function n(t,e,r){if("string"==typeof t){var n=t,o=e;if(c.isEncoding(o="string"==typeof o&&""!==o?o:"utf8"))return i=0|p(n,o),u=s(i),u=(n=u.write(n,o))!==i?u.slice(0,n):u;throw new TypeError("Unknown encoding: "+o)}if(ArrayBuffer.isView(t))return l(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(A(t,ArrayBuffer)||t&&A(t.buffer,ArrayBuffer)){var i=t,n=e,u=r;if(n<0||i.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(i.byteLength<n+(u||0))throw new RangeError('"length" is outside of buffer bounds');return(i=void 0===n&&void 0===u?new Uint8Array(i):void 0===u?new Uint8Array(i,n):new Uint8Array(i,n,u)).__proto__=c.prototype,i}if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');o=t.valueOf&&t.valueOf();if(null!=o&&o!==t)return c.from(o,e,r);var a=function(t){{var e,r;if(c.isBuffer(t))return e=0|f(t.length),0!==(r=s(e)).length&&t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||R(t.length)?s(0):l(t);if("Buffer"===t.type&&Array.isArray(t.data))return l(t.data)}(t);if(a)return a;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return c.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function o(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return o(t),s(t<0?0:0|f(t))}function l(t){for(var e=t.length<0?0:0|f(t.length),r=s(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function f(t){if(e<=t)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+e.toString(16)+" bytes");return 0|t}function p(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||A(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=2<arguments.length&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return O(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return x(t).length;default:if(o)return n?-1:O(t).length;e=(""+e).toLowerCase(),o=!0}}function r(t,e,r){var n,o=!1;if((e=void 0===e||e<0?0:e)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t=t||"utf8";;)switch(t){case"hex":var i=this,u=e,a=r,s=i.length;(!a||a<0||s<a)&&(a=s);for(var l="",f=u=!u||u<0?0:u;f<a;++f)l+=function(t){return t<16?"0"+t.toString(16):t.toString(16)}(i[f]);return l;case"utf8":case"utf-8":return j(this,e,r);case"ascii":var c=this,s=e,p=r,h="";p=Math.min(c.length,p);for(var d=s;d<p;++d)h+=String.fromCharCode(127&c[d]);return h;case"latin1":case"binary":var y=this,u=e,g=r,v="";g=Math.min(y.length,g);for(var m=u;m<g;++m)v+=String.fromCharCode(y[m]);return v;case"base64":return b=this,n=r,0===(w=e)&&n===b.length?U.fromByteArray(b):U.fromByteArray(b.slice(w,n));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":for(var b=e,w=r,_=this.slice(b,w),S="",E=0;E<_.length;E+=2)S+=String.fromCharCode(_[E]+256*_[E+1]);return S;default:if(o)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),o=!0}}function a(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function h(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647<r?r=2147483647:r<-2147483648&&(r=-2147483648),(r=(r=R(r=+r)?o?0:t.length-1:r)<0?t.length+r:r)>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=c.from(e,n)),c.isBuffer(e))return 0===e.length?-1:d(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?(o?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(t,e,r):d(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function d(t,e,r,n,o){var i=1,u=t.length,a=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;u/=i=2,a/=2,r/=2}function s(t,e){return 1===i?t[e]:t.readUInt16BE(e*i)}if(o)for(var l=-1,f=r;f<u;f++)if(s(t,f)===s(e,-1===l?0:f-l)){if(f-(l=-1===l?f:l)+1===a)return l*i}else-1!==l&&(f-=f-l),l=-1;else for(f=r=u<r+a?u-a:r;0<=f;f--){for(var c=!0,p=0;p<a;p++)if(s(t,f+p)!==s(e,p)){c=!1;break}if(c)return f}return-1}function g(t,e,r,n){return P(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function v(t,e,r,n){return P(function(t,e){for(var r,n,o=[],i=0;i<t.length&&!((e-=2)<0);++i)r=t.charCodeAt(i),n=r>>8,o.push(r%256),o.push(n);return o}(e,t.length-r),t,r,n)}function j(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,u,a,s,l=t[o],f=null,c=239<l?4:223<l?3:191<l?2:1;if(o+c<=r)switch(c){case 1:l<128&&(f=l);break;case 2:128==(192&(i=t[o+1]))&&127<(s=(31&l)<<6|63&i)&&(f=s);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&2047<(s=(15&l)<<12|(63&i)<<6|63&u)&&(s<55296||57343<s)&&(f=s);break;case 4:i=t[o+1],u=t[o+2],a=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&a)&&65535<(s=(15&l)<<18|(63&i)<<12|(63&u)<<6|63&a)&&s<1114112&&(f=s)}null===f?(f=65533,c=1):65535<f&&(n.push((f-=65536)>>>10&1023|55296),f=56320|1023&f),n.push(f),o+=c}var p=n,h=p.length;if(h<=m)return String.fromCharCode.apply(String,p);for(var d="",y=0;y<h;)d+=String.fromCharCode.apply(String,p.slice(y,y+=m));return d}L.kMaxLength=e,(c.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),c.poolSize=8192,c.from=n,c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,c.alloc=function(t,e,r){return e=e,r=r,o(t=t),!(t<=0)&&void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)},c.allocUnsafe=u,c.allocUnsafeSlow=u,c.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==c.prototype},c.compare=function(t,e){if(A(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),A(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);if(void 0===e)for(o=e=0;o<t.length;++o)e+=t[o].length;for(var r=c.allocUnsafe(e),n=0,o=0;o<t.length;++o){var i=t[o];if(A(i,Uint8Array)&&(i=c.from(i)),!c.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,n),n+=i.length}return r},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)a(this,e,e+1);return this},c.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)a(this,e,e+3),a(this,e+1,e+2);return this},c.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)a(this,e,e+7),a(this,e+1,e+6),a(this,e+2,e+5),a(this,e+3,e+4);return this},c.prototype.toLocaleString=c.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?j(this,0,t):r.apply(this,arguments)},c.prototype.equals=function(t){if(c.isBuffer(t))return this===t||0===c.compare(this,t);throw new TypeError("Argument must be a Buffer")},c.prototype.inspect=function(){var t="",e=L.INSPECT_MAX_BYTES,t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim();return this.length>e&&(t+=" ... "),"<Buffer "+t+">"},c.prototype.compare=function(t,e,r,n,o){if(A(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),(e=void 0===e?0:e)<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(o<=n&&r<=e)return 0;if(o<=n)return-1;if(r<=e)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),u=(r>>>=0)-(e>>>=0),a=Math.min(i,u),s=this.slice(n,o),l=t.slice(e,r),f=0;f<a;++f)if(s[f]!==l[f]){i=s[f],u=l[f];break}return i<u?-1:u<i?1:0},c.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},c.prototype.indexOf=function(t,e,r){return h(this,t,e,r,!0)},c.prototype.lastIndexOf=function(t,e,r){return h(this,t,e,r,!1)},c.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||o<r)&&(r=o),0<t.length&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var i,u,a,s=!1;;)switch(n){case"hex":var l=this,f=t,c=e,p=r,h=(c=Number(c)||0,l.length-c);(!p||h<(p=Number(p)))&&(p=h),(h=f.length)/2<p&&(p=h/2);for(var d=0;d<p;++d){var y=parseInt(f.substr(2*d,2),16);if(R(y))return d;l[c+d]=y}return d;case"utf8":case"utf-8":return h=e,a=r,P(O(t,(u=this).length-h),u,h,a);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return g(this,t,e,r);case"base64":return u=this,a=e,i=r,P(x(t),u,a,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var m=4096;function y(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(r<t+e)throw new RangeError("Trying to access beyond buffer length")}function b(t,e,r,n,o,i){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(o<e||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function w(t,e,r,n){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function _(t,e,r,n,o){return e=+e,r>>>=0,o||w(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function S(t,e,r,n,o){return e=+e,r>>>=0,o||w(t,0,r,8),i.write(t,e,r,n,52,8),r+8}c.prototype.slice=function(t,e){var r=this.length,r=((t=~~t)<0?(t+=r)<0&&(t=0):r<t&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):r<e&&(e=r),e<t&&(e=t),this.subarray(t,e));return r.__proto__=c.prototype,r},c.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||y(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},c.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||y(t,e,this.length);for(var n=this[t+--e],o=1;0<e&&(o*=256);)n+=this[t+--e]*o;return n},c.prototype.readUInt8=function(t,e){return t>>>=0,e||y(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||y(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||y(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,e){return t>>>=0,e||y(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,e){return t>>>=0,e||y(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||y(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return(o*=128)<=n&&(n-=Math.pow(2,8*e)),n},c.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||y(t,e,this.length);for(var n=e,o=1,i=this[t+--n];0<n&&(o*=256);)i+=this[t+--n]*o;return(o*=128)<=i&&(i-=Math.pow(2,8*e)),i},c.prototype.readInt8=function(t,e){return t>>>=0,e||y(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||y(t,2,this.length);e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},c.prototype.readInt16BE=function(t,e){t>>>=0,e||y(t,2,this.length);e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},c.prototype.readInt32LE=function(t,e){return t>>>=0,e||y(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return t>>>=0,e||y(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,e){return t>>>=0,e||y(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||y(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||y(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||y(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||b(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},c.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||b(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;0<=--o&&(i*=256);)this[e+o]=t/i&255;return e+r},c.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||b(this,t,e,1,255,0),this[e]=255&t,e+1},c.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||b(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||b(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||b(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},c.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||b(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeIntLE=function(t,e,r,n){t=+t,e>>>=0,n||b(this,t,e,r,(n=Math.pow(2,8*r-1))-1,-n);var o=0,i=1,u=0;for(this[e]=255&t;++o<r&&(i*=256);)t<0&&0===u&&0!==this[e+o-1]&&(u=1),this[e+o]=(t/i>>0)-u&255;return e+r},c.prototype.writeIntBE=function(t,e,r,n){t=+t,e>>>=0,n||b(this,t,e,r,(n=Math.pow(2,8*r-1))-1,-n);var o=r-1,i=1,u=0;for(this[e+o]=255&t;0<=--o&&(i*=256);)t<0&&0===u&&0!==this[e+o+1]&&(u=1),this[e+o]=(t/i>>0)-u&255;return e+r},c.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||b(this,t,e,1,127,-128),this[e]=255&(t=t<0?255+t+1:t),e+1},c.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||b(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||b(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||b(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},c.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||b(this,t,e,4,2147483647,-2147483648),this[e]=(t=t<0?4294967295+t+1:t)>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeFloatLE=function(t,e,r){return _(this,t,e,!0,r)},c.prototype.writeFloatBE=function(t,e,r){return _(this,t,e,!1,r)},c.prototype.writeDoubleLE=function(t,e,r){return S(this,t,e,!0,r)},c.prototype.writeDoubleBE=function(t,e,r){return S(this,t,e,!1,r)},c.prototype.copy=function(t,e,r,n){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),e>=t.length&&(e=t.length),(n=0<n&&n<r?r:n)===r)return 0;if(0===t.length||0===this.length)return 0;if((e=e||0)<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var o=(n=t.length-e<n-r?t.length-e+r:n)-r;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,r,n);else if(this===t&&r<e&&e<n)for(var i=o-1;0<=i;--i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},c.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!c.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var o;1===t.length&&(o=t.charCodeAt(0),"utf8"===n&&o<128||"latin1"===n)&&(t=o)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");var i;if(!(r<=e))if(e>>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(t=t||0))for(i=e;i<r;++i)this[i]=t;else{var u=c.isBuffer(t)?t:c.from(t,n),a=u.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=u[i%a]}return this};var E=/[^+/0-9A-Za-z-_]/g;function O(t,e){e=e||1/0;for(var r,n=t.length,o=null,i=[],u=0;u<n;++u){if(55295<(r=t.charCodeAt(u))&&r<57344){if(!o){if(56319<r){-1<(e-=3)&&i.push(239,191,189);continue}if(u+1===n){-1<(e-=3)&&i.push(239,191,189);continue}o=r;continue}if(r<56320){-1<(e-=3)&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&-1<(e-=3)&&i.push(239,191,189);if(o=null,r<128){if(--e<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function x(t){return U.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(E,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function P(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function A(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function R(t){return t!=t}}.call(this)}.call(this,k("buffer").Buffer)},{"base64-js":17,buffer:18,ieee754:19}],19:[function(t,e,r){r.read=function(t,e,r,n,o){var i,u,a=8*o-n-1,s=(1<<a)-1,l=s>>1,f=-7,c=r?o-1:0,p=r?-1:1,o=t[e+c];for(c+=p,i=o&(1<<-f)-1,o>>=-f,f+=a;0<f;i=256*i+t[e+c],c+=p,f-=8);for(u=i&(1<<-f)-1,i>>=-f,f+=n;0<f;u=256*u+t[e+c],c+=p,f-=8);if(0===i)i=1-l;else{if(i===s)return u?NaN:1/0*(o?-1:1);u+=Math.pow(2,n),i-=l}return(o?-1:1)*u*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var u,a,s=8*i-o-1,l=(1<<s)-1,f=l>>1,c=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,h=n?1:-1,i=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,u=l):(u=Math.floor(Math.log(e)/Math.LN2),e*(n=Math.pow(2,-u))<1&&(u--,n*=2),2<=(e+=1<=u+f?c/n:c*Math.pow(2,1-f))*n&&(u++,n/=2),l<=u+f?(a=0,u=l):1<=u+f?(a=(e*n-1)*Math.pow(2,o),u+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,o),u=0));8<=o;t[r+p]=255&a,p+=h,a/=256,o-=8);for(u=u<<o|a,s+=o;0<s;t[r+p]=255&u,p+=h,u/=256,s-=8);t[r+p-h]|=128*i}},{}],20:[function(t,i,u){!function(o,D){!function(){var t,e,r,n;t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==o?o:this,e=function(){"use strict";function r(t){return t.replace(/=/g,"").replace(/[+\/]/g,function(t){return"+"==t?"-":"_"})}function t(t){for(var e,r,n,o="",i=t.length%3,u=0;u<t.length;){if(255<(e=t.charCodeAt(u++))||255<(r=t.charCodeAt(u++))||255<(n=t.charCodeAt(u++)))throw new TypeError("invalid character found");o+=S[(e=e<<16|r<<8|n)>>18&63]+S[e>>12&63]+S[e>>6&63]+S[63&e]}return i?o.slice(0,i-3)+"===".substring(i):o}function e(t,e){return(e=void 0===e?!1:e)?r(A(t)):A(t)}function n(t){var e;return t.length<2?(e=t.charCodeAt(0))<128?t:e<2048?j(192|e>>>6)+j(128|63&e):j(224|e>>>12&15)+j(128|e>>>6&63)+j(128|63&e):(e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320),j(240|e>>>18&7)+j(128|e>>>12&63)+j(128|e>>>6&63)+j(128|63&e))}function o(t){return t.replace(R,n)}function i(t,e){return(e=void 0===e?!1:e)?r(k(t)):k(t)}function u(t){return i(t,!0)}function a(t){switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return j(55296+(e>>>10))+j(56320+(1023&e));case 3:return j((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return j((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}}function s(t){return t.replace(L,a)}function l(t){if(t=t.replace(/\s+/g,""),!U.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));for(var e,r,n,o="",i=0;i<t.length;)e=E[t.charAt(i++)]<<18|E[t.charAt(i++)]<<12|(r=E[t.charAt(i++)])<<6|(n=E[t.charAt(i++)]),o+=64===r?j(e>>16&255):64===n?j(e>>16&255,e>>8&255):j(e>>16&255,e>>8&255,255&e);return o}function f(t){return C(c(t))}function c(t){return x(t.replace(/[-_]/g,function(t){return"-"==t?"+":"/"}))}function p(t){return I(c(t))}function h(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}}function d(){function t(t,e){Object.defineProperty(String.prototype,t,h(e))}t("fromBase64",function(){return p(this)}),t("toBase64",function(t){return i(this,t)}),t("toBase64URI",function(){return i(this,!0)}),t("toBase64URL",function(){return i(this,!0)}),t("toUint8Array",function(){return f(this)})}function y(){function t(t,e){Object.defineProperty(Uint8Array.prototype,t,h(e))}t("toBase64",function(t){return e(this,t)}),t("toBase64URI",function(){return e(this,!0)}),t("toBase64URL",function(){return e(this,!0)})}var g,v="function"==typeof atob,m="function"==typeof btoa,b="function"==typeof D,w="function"==typeof TextDecoder?new TextDecoder:void 0,_="function"==typeof TextEncoder?new TextEncoder:void 0,S=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),E=(g={},S.forEach(function(t,e){return g[t]=e}),g),U=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,j=String.fromCharCode.bind(String),O="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t){return new Uint8Array(Array.prototype.slice.call(t,0))},x=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},P=m?function(t){return btoa(t)}:b?function(t){return D.from(t,"binary").toString("base64")}:t,A=b?function(t){return D.from(t).toString("base64")}:function(t){for(var e=[],r=0,n=t.length;r<n;r+=4096)e.push(j.apply(null,t.subarray(r,r+4096)));return P(e.join(""))},R=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,k=b?function(t){return D.from(t,"utf8").toString("base64")}:_?function(t){return A(_.encode(t))}:function(t){return P(o(t))},L=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=v?function(t){return atob(x(t))}:b?function(t){return D.from(t,"base64").toString("binary")}:l,C=b?function(t){return O(D.from(t,"base64"))}:function(t){return O(B(t).split("").map(function(t){return t.charCodeAt(0)}))},I=b?function(t){return D.from(t,"base64").toString("utf8")}:w?function(t){return w.decode(C(t))}:function(t){return s(B(t))},T={version:"3.7.5",VERSION:"3.7.5",atob:B,atobPolyfill:l,btoa:P,btoaPolyfill:t,fromBase64:p,toBase64:i,encode:i,encodeURI:u,encodeURL:u,utob:o,btou:s,decode:p,isValid:function(t){return"string"==typeof t&&(t=t.replace(/\s+/g,"").replace(/={0,2}$/,""),!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t))},fromUint8Array:e,toUint8Array:f,extendString:d,extendUint8Array:y,extendBuiltins:function(){d(),y()},Base64:{}};return Object.keys(T).forEach(function(t){return T.Base64[t]=T[t]}),T},"object"==typeof u&&void 0!==i?i.exports=e():(r=t.Base64,(n=e()).noConflict=function(){return t.Base64=r,n},t.Meteor&&(Base64=n),t.Base64=n)}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{buffer:18}],21:[function(t,e,r){"use strict";var i=Object.prototype.hasOwnProperty;function u(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(t){return null}}function a(t){try{return encodeURIComponent(t)}catch(t){return null}}r.stringify=function(t,e){var r,n,o=[];for(n in"string"!=typeof(e=e||"")&&(e="?"),t)i.call(t,n)&&((r=t[n])||null!=r&&!isNaN(r)||(r=""),n=a(n),r=a(r),null!==n)&&null!==r&&o.push(n+"="+r);return o.length?e+o.join("&"):""},r.parse=function(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={};o=e.exec(t);){var n=u(o[1]),o=u(o[2]);null===n||null===o||n in r||(r[n]=o)}return r}},{}],22:[function(t,e,r){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],!(t=+t))return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}],23:[function(t,r,e){!function(u){!function(){"use strict";var p=t("requires-port"),h=t("querystringify"),e=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,d=/[\n\r\t]/g,o=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,a=/:\d+$/,s=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,y=/^[a-zA-Z]:/;function g(t){return(t||"").toString().replace(e,"")}var v=[["#","hash"],["?","query"],function(t,e){return b(e.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]],i={hash:1,query:1};function m(t){var e,r="undefined"!=typeof window?window:void 0!==u?u:"undefined"!=typeof self?self:{},r=r.location||{},n={},r=typeof(t=t||r);if("blob:"===t.protocol)n=new _(unescape(t.pathname),{});else if("string"==r)for(e in n=new _(t,{}),i)delete n[e];else if("object"==r){for(e in t)e in i||(n[e]=t[e]);void 0===n.slashes&&(n.slashes=o.test(t.href))}return n}function b(t){return"file:"===t||"ftp:"===t||"http:"===t||"https:"===t||"ws:"===t||"wss:"===t}function w(t,e){t=(t=g(t)).replace(d,""),e=e||{};var r,t=s.exec(t),n=t[1]?t[1].toLowerCase():"",o=!!t[2],i=!!t[3],u=0;return o?u=i?(r=t[2]+t[3]+t[4],t[2].length+t[3].length):(r=t[2]+t[4],t[2].length):i?(r=t[3]+t[4],u=t[3].length):r=t[4],"file:"===n?2<=u&&(r=r.slice(2)):b(n)?r=t[4]:n?o&&(r=r.slice(2)):2<=u&&b(e.protocol)&&(r=t[4]),{protocol:n,slashes:o||b(n),slashesCount:u,rest:r}}function _(t,e,r){if(t=(t=g(t)).replace(d,""),!(this instanceof _))return new _(t,e,r);var n,o,i,u,a,s=v.slice(),l=typeof e,f=this,c=0;for("object"!=l&&"string"!=l&&(r=e,e=null),r&&"function"!=typeof r&&(r=h.parse),n=!(l=w(t||"",e=m(e))).protocol&&!l.slashes,f.slashes=l.slashes||n&&e.slashes,f.protocol=l.protocol||e.protocol||"",t=l.rest,("file:"===l.protocol&&(2!==l.slashesCount||y.test(t))||!l.slashes&&(l.protocol||l.slashesCount<2||!b(f.protocol)))&&(s[3]=[/(.*)/,"pathname"]);c<s.length;c++)"function"==typeof(i=s[c])?t=i(t,f):(o=i[0],a=i[1],o!=o?f[a]=t:"string"==typeof o?~(u="@"===o?t.lastIndexOf(o):t.indexOf(o))&&(t="number"==typeof i[2]?(f[a]=t.slice(0,u),t.slice(u+i[2])):(f[a]=t.slice(u),t.slice(0,u))):(u=o.exec(t))&&(f[a]=u[1],t=t.slice(0,u.index)),f[a]=f[a]||n&&i[3]&&e[a]||"",i[4]&&(f[a]=f[a].toLowerCase()));r&&(f.query=r(f.query)),n&&e.slashes&&"/"!==f.pathname.charAt(0)&&(""!==f.pathname||""!==e.pathname)&&(f.pathname=function(t,e){if(""===t)return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,e=r[n-1],o=!1,i=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),i++):i&&(0===n&&(o=!0),r.splice(n,1),i--);return o&&r.unshift(""),"."!==e&&".."!==e||r.push(""),r.join("/")}(f.pathname,e.pathname)),"/"!==f.pathname.charAt(0)&&b(f.protocol)&&(f.pathname="/"+f.pathname),p(f.port,f.protocol)||(f.host=f.hostname,f.port=""),f.username=f.password="",f.auth&&(~(u=f.auth.indexOf(":"))?(f.username=f.auth.slice(0,u),f.username=encodeURIComponent(decodeURIComponent(f.username)),f.password=f.auth.slice(u+1),f.password=encodeURIComponent(decodeURIComponent(f.password))):f.username=encodeURIComponent(decodeURIComponent(f.auth)),f.auth=f.password?f.username+":"+f.password:f.username),f.origin="file:"!==f.protocol&&b(f.protocol)&&f.host?f.protocol+"//"+f.host:"null",f.href=f.toString()}_.prototype={set:function(t,e,r){var n=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(r||h.parse)(e)),n[t]=e;break;case"port":n[t]=e,p(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[t]="");break;case"hostname":n[t]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[t]=e,a.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":e?(o="pathname"===t?"/":"#",n[t]=e.charAt(0)!==o?o+e:e):n[t]=e;break;case"username":case"password":n[t]=encodeURIComponent(e);break;case"auth":var o=e.indexOf(":");~o?(n.username=e.slice(0,o),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(o+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var i=0;i<v.length;i++){var u=v[i];u[4]&&(n[u[1]]=n[u[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin="file:"!==n.protocol&&b(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},toString:function(t){t&&"function"==typeof t||(t=h.stringify);var e=this,r=e.host,n=((n=e.protocol)&&":"!==n.charAt(n.length-1)&&(n+=":"),n+(e.protocol&&e.slashes||b(e.protocol)?"//":""));return e.username?(n+=e.username,e.password&&(n+=":"+e.password),n+="@"):e.password?n=n+(":"+e.password)+"@":"file:"!==e.protocol&&b(e.protocol)&&!r&&"/"!==e.pathname&&(n+="@"),(":"===r[r.length-1]||a.test(e.hostname)&&!e.port)&&(r+=":"),n+=r+e.pathname,(r="object"==typeof e.query?t(e.query):e.query)&&(n+="?"!==r.charAt(0)?"?"+r:r),e.hash&&(n+=e.hash),n}},_.extractProtocol=w,_.location=m,_.trimLeft=g,_.qs=h,r.exports=_}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{querystringify:21,"requires-port":22}]},{},[4])(4)});
|
|
//# sourceMappingURL=tus.min.js.map
|