tt-uploader 1.0.27 → 1.1.0
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.
- package/dist/index.js +1 -1
- package/dist/plugins/imagexEncrypt.js +24 -0
- package/package.json +8 -7
- package/types/index.d.ts +9 -2
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TTUploader=t():e.TTUploader=t()}("undefined"!=typeof self?self:this,function(){return function(r){var o={};function __webpack_require__(e){var t;return(o[e]||(t=o[e]={i:e,l:!1,exports:{}},r[e].call(t.exports,t,t.exports,__webpack_require__),t.l=!0,t)).exports}return __webpack_require__.m=r,__webpack_require__.c=o,__webpack_require__.d=function(e,t,r){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.t=function(t,e){if(1&e&&(t=__webpack_require__(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(__webpack_require__.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)__webpack_require__.d(r,o,function(e){return t[e]}.bind(null,o));return r},__webpack_require__.n=function(e){var t=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=9)}([function(e,t,r){"use strict";var o="object"==typeof Reflect?Reflect:null,c=o&&"function"==typeof o.apply?o.apply:function ReflectApply(e,t,r){return Function.prototype.apply.call(e,t,r)};var n=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function ReflectOwnKeys(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function ReflectOwnKeys(e){return Object.getOwnPropertyNames(e)},i=Number.isNaN||function NumberIsNaN(e){return e!=e};function EventEmitter(){EventEmitter.init.call(this)}e.exports=EventEmitter,e.exports.once=function once(r,o){return new Promise(function(e,t){function errorListener(e){r.removeListener(o,resolver),t(e)}function resolver(){"function"==typeof r.removeListener&&r.removeListener("error",errorListener),e([].slice.call(arguments))}eventTargetAgnosticAddListener(r,o,resolver,{once:!0}),"error"!==o&&function addErrorHandlerIfEventEmitter(e,t,r){"function"==typeof e.on&&eventTargetAgnosticAddListener(e,"error",t,r)}(r,errorListener,{once:!0})})},(EventEmitter.EventEmitter=EventEmitter).prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var s=10;function checkListener(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function _getMaxListeners(e){return void 0===e._maxListeners?EventEmitter.defaultMaxListeners:e._maxListeners}function _addListener(e,t,r,o){var n,i;return checkListener(r),void 0===(n=e._events)?(n=e._events=Object.create(null),e._eventsCount=0):(void 0!==n.newListener&&(e.emit("newListener",t,r.listener||r),n=e._events),i=n[t]),void 0===i?(i=n[t]=r,++e._eventsCount):("function"==typeof i?i=n[t]=o?[r,i]:[i,r]:o?i.unshift(r):i.push(r),0<(n=_getMaxListeners(e))&&i.length>n&&!i.warned&&(i.warned=!0,(o=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",o.emitter=e,o.type=t,o.count=i.length,function ProcessEmitWarning(e){console&&console.warn&&console.warn(e)}(o))),e}function _onceWrap(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function _listeners(e,t,r){var e=e._events;return void 0===e||void 0===(e=e[t])?[]:"function"==typeof e?r?[e.listener||e]:[e]:r?function unwrapListeners(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(e):arrayClone(e,e.length)}function listenerCount(e){var t=this._events;if(void 0!==t){t=t[e];if("function"==typeof t)return 1;if(void 0!==t)return t.length}return 0}function arrayClone(e,t){for(var r=new Array(t),o=0;o<t;++o)r[o]=e[o];return r}function eventTargetAgnosticAddListener(t,r,o,n){if("function"==typeof t.on)n.once?t.once(r,o):t.on(r,o);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(r,function wrapListener(e){n.once&&t.removeEventListener(r,wrapListener),o(e)})}}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),EventEmitter.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function setMaxListeners(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},EventEmitter.prototype.getMaxListeners=function getMaxListeners(){return _getMaxListeners(this)},EventEmitter.prototype.emit=function emit(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,n=this._events;if(void 0!==n)o=o&&void 0===n.error;else if(!o)return!1;if(o){if((i=0<t.length?t[0]:i)instanceof Error)throw i;o=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw o.context=i,o}var i=n[e];if(void 0===i)return!1;if("function"==typeof i)c(i,this,t);else for(var s=i.length,a=arrayClone(i,s),r=0;r<s;++r)c(a[r],this,t);return!0},EventEmitter.prototype.on=EventEmitter.prototype.addListener=function addListener(e,t){return _addListener(this,e,t,!1)},EventEmitter.prototype.prependListener=function prependListener(e,t){return _addListener(this,e,t,!0)},EventEmitter.prototype.once=function once(e,t){return checkListener(t),this.on(e,_onceWrap(this,e,t)),this},EventEmitter.prototype.prependOnceListener=function prependOnceListener(e,t){return checkListener(t),this.prependListener(e,_onceWrap(this,e,t)),this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener=function removeListener(e,t){var r,o,n,i,s;if(checkListener(t),void 0!==(o=this._events)&&void 0!==(r=o[e]))if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,i=r.length-1;0<=i;i--)if(r[i]===t||r[i].listener===t){s=r[i].listener,n=i;break}if(n<0)return this;0===n?r.shift():function spliceOne(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(o[e]=r[0]),void 0!==o.removeListener&&this.emit("removeListener",e,s||t)}return this},EventEmitter.prototype.removeAllListeners=function removeAllListeners(e){var t,r=this._events;if(void 0!==r)if(void 0===r.removeListener)0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]);else if(0===arguments.length){for(var o,n=Object.keys(r),i=0;i<n.length;++i)"removeListener"!==(o=n[i])&&this.removeAllListeners(o);this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0}else if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;0<=i;i--)this.removeListener(e,t[i]);return this},EventEmitter.prototype.listeners=function listeners(e){return _listeners(this,e,!0)},EventEmitter.prototype.rawListeners=function rawListeners(e){return _listeners(this,e,!1)},EventEmitter.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):listenerCount.call(e,t)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function eventNames(){return 0<this._eventsCount?n(this._events):[]}},function(n,i,s){!function(r){var o;function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e){"object"==_typeof(i)&&void 0!==n?n.exports=e():void 0!==(o="function"==typeof(o=e)?o.call(i,s,i,n):o)&&(n.exports=o)}(function(){"use strict";function e(e,t){for(var r,o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,"symbol"==_typeof(r=function(e){if("object"!=_typeof(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);t=t.call(e,"string");if("object"!=_typeof(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(n.key))?r:String(r),n)}}function t(e,t,r){return e(r={path:t,exports:{},require:function require(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var r=t(function(e,t){e.exports=function(u){var r=Object.create||function(){function e(){}return function(t){return e.prototype=t,t=new e,e.prototype=null,t}}(),e={},t=e.lib={},o=t.Base={extend:function extend(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),(t.init.prototype=t).$super=this,t},create:function create(){var e=this.extend();return e.init.apply(e,arguments),e},init:function init(){},mixIn:function mixIn(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function clone(){return this.init.prototype.extend(this)}},l=t.WordArray=o.extend({init:function init(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function toString(e){return(e||s).stringify(this)},concat:function concat(e){var t=this.words,r=e.words,o=this.sigBytes,n=e.sigBytes;if(this.clamp(),o%4)for(var i=0;i<n;i++){var s=r[i>>>2]>>>24-i%4*8&255;t[o+i>>>2]|=s<<24-(o+i)%4*8}else for(i=0;i<n;i+=4)t[o+i>>>2]=r[i>>>2];return this.sigBytes+=n,this},clamp:function clamp(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=u.ceil(t/4)},clone:function clone(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function random(e){for(var t=[],r=function i(e){var t=987654321,r=4294967295;return function(){return((((t=36969*(65535&t)+(t>>16)&r)<<16)+(e=18e3*(65535&e)+(e>>16)&r)&r)/4294967296+.5)*(.5<u.random()?1:-1)}},o=0;o<e;o+=4){var n=r(4294967296*(i||u.random())),i=987654071*n();t.push(4294967296*n()|0)}return new l.init(t,e)}}),n=e.enc={},s=n.Hex={stringify:function stringify(e){for(var t=e.words,r=e.sigBytes,o=[],n=0;n<r;n++){var i=t[n>>>2]>>>24-n%4*8&255;o.push((i>>>4).toString(16)),o.push((15&i).toString(16))}return o.join("")},parse:function parse(e){for(var t=e.length,r=[],o=0;o<t;o+=2)r[o>>>3]|=parseInt(e.substr(o,2),16)<<24-o%8*4;return new l.init(r,t/2)}},a=n.Latin1={stringify:function stringify(e){for(var t=e.words,r=e.sigBytes,o=[],n=0;n<r;n++){var i=t[n>>>2]>>>24-n%4*8&255;o.push(String.fromCharCode(i))}return o.join("")},parse:function parse(e){for(var t=e.length,r=[],o=0;o<t;o++)r[o>>>2]|=(255&e.charCodeAt(o))<<24-o%4*8;return new l.init(r,t)}},c=n.Utf8={stringify:function stringify(e){try{return decodeURIComponent(escape(a.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function parse(e){return a.parse(unescape(encodeURIComponent(e)))}},p=t.BufferedBlockAlgorithm=o.extend({reset:function reset(){this._data=new l.init,this._nDataBytes=0},_append:function _append(e){"string"==typeof e&&(e=c.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function _process(e){var t=this._data,r=t.words,o=t.sigBytes,n=this.blockSize,i=o/(4*n),s=(e?u.ceil(i):u.max((0|i)-this._minBufferSize,0))*n,e=u.min(4*s,o);if(s){for(var a=0;a<s;a+=n)this._doProcessBlock(r,a);var c=r.splice(0,s);t.sigBytes-=e}return new l.init(c,e)},clone:function clone(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(t.Hasher=p.extend({cfg:o.extend(),init:function init(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function reset(){p.reset.call(this),this._doReset()},update:function update(e){return this._append(e),this._process(),this},finalize:function finalize(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function _createHelper(r){return function(e,t){return new r.init(t).finalize(e)}},_createHmacHelper:function _createHmacHelper(r){return function(e,t){return new f.HMAC.init(r,t).finalize(e)}}}),e.algo={});return e}(Math)}),o=t(function(e,t){var c;e.exports=(c=r,function(i){var e=c,r=e.lib,o=r.WordArray,s=r.Hasher,r=e.algo,a=[],h=[],y=(!function(){function n(e){return 4294967296*(e-(0|e))|0}for(var e=2,t=0;t<64;)!function t(e){for(var r=i.sqrt(e),o=2;o<=r;o++)if(!(e%o))return;return 1}(e)||(t<8&&(a[t]=n(i.pow(e,.5))),h[t]=n(i.pow(e,1/3)),t++),e++}(),[]),r=r.SHA256=s.extend({_doReset:function _doReset(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function _doProcessBlock(e,t){for(var r=this._hash.words,o=r[0],n=r[1],i=r[2],s=r[3],a=r[4],c=r[5],u=r[6],l=r[7],p=0;p<64;p++){y[p]=p<16?0|e[t+p]:(((f=y[p-15])<<25|f>>>7)^(f<<14|f>>>18)^f>>>3)+y[p-7]+(((f=y[p-2])<<15|f>>>17)^(f<<13|f>>>19)^f>>>10)+y[p-16];var f=o&n^o&i^n&i,d=l+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&c^~a&u)+h[p]+y[p],l=u,u=c,c=a,a=s+d|0,s=i,i=n,n=o,o=d+(((o<<30|o>>>2)^(o<<19|o>>>13)^(o<<10|o>>>22))+f)|0}r[0]=r[0]+o|0,r[1]=r[1]+n|0,r[2]=r[2]+i|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+l|0},_doFinalize:function _doFinalize(){var e=this._data,t=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;return t[o>>>5]|=128<<24-o%32,t[14+(64+o>>>9<<4)]=i.floor(r/4294967296),t[15+(64+o>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function clone(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA256=s._createHelper(r),e.HmacSHA256=s._createHmacHelper(r)}(Math),c.SHA256)}),n=(t(function(e,t){var a;e.exports=(e=r.lib.Base,a=r.enc.Utf8,void(r.algo.HMAC=e.extend({init:function init(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=a.parse(t));var r=e.blockSize,o=4*r;(t=t.sigBytes>o?e.finalize(t):t).clamp();for(var e=this._oKey=t.clone(),t=this._iKey=t.clone(),n=e.words,i=t.words,s=0;s<r;s++)n[s]^=1549556828,i[s]^=909522486;e.sigBytes=t.sigBytes=o,this.reset()},reset:function reset(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function update(e){return this._hasher.update(e),this},finalize:function finalize(e){var t=this._hasher,e=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(e))}})))}),t(function(e,t){e.exports=r.HmacSHA256})),i=function hmac(e,t){return n(t,e)},s=function sha256(e){return o(e)},a=["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id"],u=function a(e){try{return encodeURIComponent(e).replace(/[^A-Za-z0-9_.~\-%]+/g,escape).replace(/[*]/g,function(e){return"%".concat(e.charCodeAt(0).toString(16).toUpperCase())})}catch(e){return""}},l=function c(r){return Object.keys(r).sort().map(function(e){var t=r[e];if(null!=t){e=u(e);if(e)return Array.isArray(t)?"".concat(e,"=").concat(t.map(u).sort().join("&".concat(e,"="))):"".concat(e,"=").concat(u(t))}}).filter(function(e){return e}).join("&")};return function(){function t(e,r,o){!function(e){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.request=e,this.request.headers=e.headers||{},this.serviceName=r,this.signatureCache="boolean"!=typeof(o=o||{}).signatureCache||o.signatureCache,this.operation=o.operation,this.signatureVersion=o.signatureVersion,this.constant=o.isVolcengine?{algorithm:"HMAC-SHA256",v4Identifier:"request",dateHeader:"X-Date",tokenHeader:"x-security-token",contentSha256Header:"X-Content-Sha256",kDatePrefix:""}:{algorithm:"AWS4-HMAC-SHA256",v4Identifier:"aws4_request",dateHeader:"X-Amz-Date",tokenHeader:"x-amz-security-token",contentSha256Header:"X-Amz-Content-Sha256",kDatePrefix:"AWS4"},this.bodySha256=o.bodySha256,this.shouldSerializeBody="boolean"!=typeof o.shouldSerializeBody||o.shouldSerializeBody}var r=t;return e(r.prototype,[{key:"addAuthorization",value:function value(e,t){t=this.iso8601(t).replace(/[:\-]|\.\d{3}/g,"");this.addHeaders(e,t),this.request.headers.Authorization=this.authorization(e,t)}},{key:"addHeaders",value:function value(e,t){this.request.headers[this.constant.dateHeader]=t,e.sessionToken&&(this.request.headers[this.constant.tokenHeader]=e.sessionToken),this.request.body&&("string"!=typeof(t=this.request.body)&&this.shouldSerializeBody&&(t=t instanceof URLSearchParams?t.toString():JSON.stringify(t)),this.request.headers[this.constant.contentSha256Header]=this.bodySha256||s(t).toString())}},{key:"authorization",value:function value(e,t){var r=[],o=this.credentialString(t);return r.push("".concat(this.constant.algorithm," Credential=").concat(e.accessKeyId,"/").concat(o)),r.push("SignedHeaders=".concat(this.signedHeaders())),r.push("Signature=".concat(this.signature(e,t))),r.join(", ")}},{key:"signature",value:function value(e,t){e=this.getSigningKey(e,t.substr(0,8),this.request.region,this.serviceName,this.signatureCache);return i(e,this.stringToSign(t),"hex")}},{key:"stringToSign",value:function value(e){var t=[];return t.push(this.constant.algorithm),t.push(e),t.push(this.credentialString(e)),t.push(this.hexEncodedHash(this.canonicalString())),t.join("\n")}},{key:"canonicalString",value:function value(){var e=[],t=this.request.pathname||"/";return e.push(this.request.method.toUpperCase()),e.push(t),e.push(l(this.request.params)||""),e.push("".concat(this.canonicalHeaders(),"\n")),e.push(this.signedHeaders()),e.push(this.hexEncodedBodyHash()),e.join("\n")}},{key:"canonicalHeaders",value:function value(){var r=this,t=[],o=(Object.keys(this.request.headers).forEach(function(e){t.push([e,r.request.headers[e]])}),t.sort(function(e,t){return e[0].toLowerCase()<t[0].toLowerCase()?-1:1}),[]);return t.forEach(function(e){var t=e[0].toLowerCase();if(r.isSignableHeader(t)){e=e[1];if(null==e||"function"!=typeof e.toString)throw new Error("Header ".concat(t," contains invalid value"));o.push("".concat(t,":").concat(r.canonicalHeaderValues(e.toString())))}}),o.join("\n")}},{key:"canonicalHeaderValues",value:function value(e){return e.replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")}},{key:"signedHeaders",value:function value(){var t=this,r=[];return Object.keys(this.request.headers).forEach(function(e){e=e.toLowerCase(),t.isSignableHeader(e)&&r.push(e)}),r.sort().join(";")}},{key:"credentialString",value:function value(e){return this.createScope(e.substr(0,8),this.request.region,this.serviceName)}},{key:"hexEncodedHash",value:function value(e){return s(e)}},{key:"hexEncodedBodyHash",value:function value(){return this.request.headers[this.constant.contentSha256Header]||(this.request.body?this.hexEncodedHash(l(this.request.body)):this.hexEncodedHash(""))}},{key:"isSignableHeader",value:function value(e){return 0===e.toLowerCase().indexOf("x-amz-")||a.indexOf(e)<0}},{key:"iso8601",value:function value(e){return(e=void 0===e?new Date:e).toISOString().replace(/\.\d{3}Z$/,"Z")}},{key:"getSigningKey",value:function value(e,t,r,o){e=i("".concat(this.constant.kDatePrefix).concat(e.secretAccessKey),t),t=i(e,r),e=i(t,o);return i(e,this.constant.v4Identifier)}},{key:"createScope",value:function value(e,t,r){return[e.substr(0,8),t,r,this.constant.v4Identifier].join("/")}}]),Object.defineProperty(r,"prototype",{writable:!1}),t}()})}.call(this,s(7))},function(e,t,r){e.exports=function(){var e=e||function(p,r){var o=Object.create||function(){function F(){}return function(e){var t;F.prototype=e;t=new F;F.prototype=null;return t}}();var e={};var t=e.lib={};var n=t.Base=function(){return{extend:function(e){var t=o(this);if(e)t.mixIn(e);if(!t.hasOwnProperty("init")||this.init===t.init)t.init=function(){t.$super.init.apply(this,arguments)};t.init.prototype=t;t.$super=this;return t},create:function(){var e=this.extend();e.init.apply(e,arguments);return e},init:function(){},mixIn:function(e){for(var t in e)if(e.hasOwnProperty(t))this[t]=e[t];if(e.hasOwnProperty("toString"))this.toString=e.toString},clone:function(){return this.init.prototype.extend(this)}}}();var f=t.WordArray=n.extend({init:function(e,t){e=this.words=e||[];if(t!=r)this.sigBytes=t;else this.sigBytes=e.length*4},toString:function(e){return(e||s).stringify(this)},concat:function(e){var t=this.words;var r=e.words;var o=this.sigBytes;var n=e.sigBytes;this.clamp();if(o%4)for(var i=0;i<n;i++){var s=r[i>>>2]>>>24-i%4*8&255;t[o+i>>>2]|=s<<24-(o+i)%4*8}else for(var i=0;i<n;i+=4)t[o+i>>>2]=r[i>>>2];this.sigBytes+=n;return this},clamp:function(){var e=this.words;var t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8;e.length=p.ceil(t/4)},clone:function(){var e=n.clone.call(this);e.words=this.words.slice(0);return e},random:function(e){var t=[];var r=function(t){var t=t;var r=987654321;var o=4294967295;return function(){r=36969*(r&65535)+(r>>16)&o;t=18e3*(t&65535)+(t>>16)&o;var e=(r<<16)+t&o;e/=4294967296;e+=.5;return e*(p.random()>.5?1:-1)}};for(var o=0,n;o<e;o+=4){var i=r((n||p.random())*4294967296);n=i()*987654071;t.push(i()*4294967296|0)}return new f.init(t,e)}});var i=e.enc={};var s=i.Hex={stringify:function(e){var t=e.words;var r=e.sigBytes;var o=[];for(var n=0;n<r;n++){var i=t[n>>>2]>>>24-n%4*8&255;o.push((i>>>4).toString(16));o.push((i&15).toString(16))}return o.join("")},parse:function(e){var t=e.length;var r=[];for(var o=0;o<t;o+=2)r[o>>>3]|=parseInt(e.substr(o,2),16)<<24-o%8*4;return new f.init(r,t/2)}};var a=i.Latin1={stringify:function(e){var t=e.words;var r=e.sigBytes;var o=[];for(var n=0;n<r;n++){var i=t[n>>>2]>>>24-n%4*8&255;o.push(String.fromCharCode(i))}return o.join("")},parse:function(e){var t=e.length;var r=[];for(var o=0;o<t;o++)r[o>>>2]|=(e.charCodeAt(o)&255)<<24-o%4*8;return new f.init(r,t)}};var c=i.Utf8={stringify:function(e){try{return decodeURIComponent(escape(a.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return a.parse(unescape(encodeURIComponent(e)))}};var u=t.BufferedBlockAlgorithm=n.extend({reset:function(){this._data=new f.init;this._nDataBytes=0},_append:function(e){if(typeof e=="string")e=c.parse(e);this._data.concat(e);this._nDataBytes+=e.sigBytes},_process:function(e){var t=this._data;var r=t.words;var o=t.sigBytes;var n=this.blockSize;var i=n*4;var s=o/i;if(e)s=p.ceil(s);else s=p.max((s|0)-this._minBufferSize,0);var a=s*n;var c=p.min(a*4,o);if(a){for(var u=0;u<a;u+=n)this._doProcessBlock(r,u);var l=r.splice(0,a);t.sigBytes-=c}return new f.init(l,c)},clone:function(){var e=n.clone.call(this);e._data=this._data.clone();return e},_minBufferSize:0});var l=t.Hasher=u.extend({cfg:n.extend(),init:function(e){this.cfg=this.cfg.extend(e);this.reset()},reset:function(){u.reset.call(this);this._doReset()},update:function(e){this._append(e);this._process();return this},finalize:function(e){if(e)this._append(e);var t=this._doFinalize();return t},blockSize:512/32,_createHelper:function(r){return function(e,t){return new r.init(t).finalize(e)}},_createHmacHelper:function(r){return function(e,t){return new d.HMAC.init(r,t).finalize(e)}}});var d=e.algo={};return e}(Math);return e}()},function(e,t,r){e.exports=function(c){return function(n){var e=c;var t=e.lib;var r=t.WordArray;var o=t.Hasher;var i=e.algo;var s=[];var x=[];(function(){function isPrime(e){var t=n.sqrt(e);for(var r=2;r<=t;r++)if(!(e%r))return false;return true}function getFractionalBits(e){return(e-(e|0))*4294967296|0}var e=2;var t=0;while(t<64){if(isPrime(e)){if(t<8)s[t]=getFractionalBits(n.pow(e,1/2));x[t]=getFractionalBits(n.pow(e,1/3));t++}e++}})();var k=[];var a=i.SHA256=o.extend({_doReset:function(){this._hash=new r.init(s.slice(0))},_doProcessBlock:function(e,t){var r=this._hash.words;var o=r[0];var n=r[1];var i=r[2];var s=r[3];var a=r[4];var c=r[5];var u=r[6];var l=r[7];for(var p=0;p<64;p++){if(p<16)k[p]=e[t+p]|0;else{var f=k[p-15];var d=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3;var h=k[p-2];var y=(h<<15|h>>>17)^(h<<13|h>>>19)^h>>>10;k[p]=d+k[p-7]+y+k[p-16]}var _=a&c^~a&u;var g=o&n^o&i^n&i;var m=(o<<30|o>>>2)^(o<<19|o>>>13)^(o<<10|o>>>22);var v=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25);var b=l+v+_+x[p]+k[p];var w=m+g;l=u;u=c;c=a;a=s+b|0;s=i;i=n;n=o;o=b+w|0}r[0]=r[0]+o|0;r[1]=r[1]+n|0;r[2]=r[2]+i|0;r[3]=r[3]+s|0;r[4]=r[4]+a|0;r[5]=r[5]+c|0;r[6]=r[6]+u|0;r[7]=r[7]+l|0},_doFinalize:function(){var e=this._data;var t=e.words;var r=this._nDataBytes*8;var o=e.sigBytes*8;t[o>>>5]|=128<<24-o%32;t[(o+64>>>9<<4)+14]=n.floor(r/4294967296);t[(o+64>>>9<<4)+15]=r;e.sigBytes=t.length*4;this._process();return this._hash},clone:function(){var e=o.clone.call(this);e._hash=this._hash.clone();return e}});e.SHA256=o._createHelper(a);e.HmacSHA256=o._createHmacHelper(a)}(Math),c.SHA256}(r(2))},function(e,t,r){e.exports=function(e){return e.HmacSHA256}(r(2),(r(3),r(6)))},function(e,t,r){e.exports=function(){return r(8)('!function(_){var t={};function __webpack_require__(e){var r;return(t[e]||(r=t[e]={i:e,l:!1,exports:{}},_[e].call(r.exports,r,r.exports,__webpack_require__),r.l=!0,r)).exports}__webpack_require__.m=_,__webpack_require__.c=t,__webpack_require__.d=function(e,r,_){__webpack_require__.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:_})},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.t=function(r,e){if(1&e&&(r=__webpack_require__(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var _=Object.create(null);if(__webpack_require__.r(_),Object.defineProperty(_,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var t in r)__webpack_require__.d(_,t,function(e){return r[e]}.bind(null,t));return _},__webpack_require__.n=function(e){var r=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(r,"a",r),r},__webpack_require__.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=0)}([function(e,r){function dec2hex(e){if(void 0!==e)return function toEight(e){return e.length<8?toEight(e="0".concat(e)):e}(Number(e).toString(16))}self.onmessage=function(e){var e=e.data,r=e[0],e=e[1],_=function crc32(e,r){for(var _=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],t=("undefined"!=typeof Int32Array&&(_=new Int32Array(_)),-1^~~r),n=(e=new Uint8Array(e)).length,u=0;u<n;u++)t=_[255&(t^e[u])]^t>>>8;return(-1^t)>>>0}(r,0);postMessage([r,dec2hex(_),e],[r])}}]);',null)}},function(e,t,r){e.exports=function(s){(function(){var e=s;var t=e.lib;var r=t.Base;var o=e.enc;var u=o.Utf8;var n=e.algo;var i=n.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init;if(typeof t=="string")t=u.parse(t);var r=e.blockSize;var o=r*4;if(t.sigBytes>o)t=e.finalize(t);t.clamp();var n=this._oKey=t.clone();var i=this._iKey=t.clone();var s=n.words;var a=i.words;for(var c=0;c<r;c++){s[c]^=1549556828;a[c]^=909522486}n.sigBytes=i.sigBytes=o;this.reset()},reset:function(){var e=this._hasher;e.reset();e.update(this._iKey)},update:function(e){this._hasher.update(e);return this},finalize:function(e){var t=this._hasher;var r=t.finalize(e);t.reset();var o=t.finalize(this._oKey.clone().concat(r));return o}})})()}(r(2))},function(e,t){var r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n=window.URL||window.webkitURL;e.exports=function(t,r){try{try{var o;try{(o=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)).append(t),o=o.getBlob()}catch(e){o=new Blob([t])}return new Worker(n.createObjectURL(o))}catch(e){return new Worker("data:application/javascript,"+encodeURIComponent(t))}}catch(e){if(r)return new Worker(r);throw Error("Inline worker is not supported")}}},function(O,r,o){"use strict";o.r(r),o.d(r,"default",function(){return Ne});var r=o(0),n=o.n(r),S={debug:!1,region:"cn-north-1",initUploadFileUrl:"{tosDomain}/{oid}?uploads",uploadChunkedUrl:"{tosDomain}/{oid}?partNumber={number}&uploadID={uploadId}",uploadMergeUrl:"{tosDomain}/{oid}?uploadID={uploadId}",getUploadListUrl:"{tosDomain}/{oid}?uploadID={uploadId}",directUploadFileUrl:"{tosDomain}/{oid}",external:{},getSliceFunc:null,uploadSliceCount:5,retryUploadTime:3,retryProcess:!0,retryProcessTime:3,retryTaskTime:3,maxProcessPause:20,schema:"https",useLocalStorage:!0,log:{external:{},appId:"",userId:"",video_id:"",upload_video_url:"",upload_id:"",type:"",stage:"",video_size:0,part_count:0,slice_index:0,extra:{},msg:""},replace:{}};function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var s=function e(){return(s=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function t(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,i=r.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(o=i.next()).done;)s.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return s}function index_base_min_i(){for(var e=[],r=0;r<arguments.length;r++)e=e.concat(t(arguments[r]));return e}function Z4(e,a){var t,r=function r(e){var t=document.createElement("a");return t.href=e,t},o=window.screen.width,n=window.screen.height,i=window.navigator.appVersion,s=window.navigator.userAgent,c=window.navigator.language,u=document.referrer,l=u?r(u).hostname:"",p=function(e){var e=(e=r(e).search).slice(1),o={};return e.split("&").forEach(function(e){var t,r,e=e.split("=");e.length&&(t=e[0],r=e[1]),r=r&&r.replace(/\%/g,"%25"),o[t]=decodeURIComponent(void 0===r?"":r)}),o}(window.location.href),f="",d="",h="",y=""+parseFloat(i);-1!==(g=s.indexOf("Opera"))&&(h="Opera",y=s.substring(g+6),-1!==(g=s.indexOf("Version")))&&(y=s.substring(g+8)),-1!==(g=s.indexOf("Edge"))?(h="Microsoft Edge",y=s.substring(g+5)):-1!==(g=s.indexOf("MSIE"))?(h="Microsoft Internet Explorer",y=s.substring(g+5)):-1!==s.indexOf("Chrome")?-1!==(g=s.indexOf("MicroMessenger"))?(h="weixin",y=s.substring(g+15,g+20)):-1!==(g=s.indexOf("MQQBrowser"))?(h="qqbrowser",y=s.substring(g+11,g+15)):-1!==(g=s.indexOf("Chrome"))&&(h="Chrome",y=s.substring(g+7)):-1!==s.indexOf("Safari")?-1!==(g=s.indexOf("QQ"))?(h="qqbrowser",y=s.substring(g+10,g+16)):-1!==(g=s.indexOf("Safari"))&&(h="Safari",y=s.substring(g+7),-1!==(g=s.indexOf("Version")))&&(y=s.substring(g+8)):-1!==(g=s.indexOf("Firefox"))?(h="Firefox",y=s.substring(g+8)):-1!==(g=s.indexOf("MicroMessenger"))?(h="weixin",y=s.substring(g+15,g+20)):-1!==(g=s.indexOf("QQ"))&&(h="qqbrowser",y=s.substring(g+3,g+8)),-1!==(t=(y=-1!==(t=(y=-1!==(t=y.indexOf(";"))?y.substring(0,t):y).indexOf(" "))?y.substring(0,t):y).indexOf(")"))&&(y=y.substring(0,t));for(var _,g=/Mobile|htc|mini|Android|iP(ad|od|hone)/.test(i)?"wap":"web",m=[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Android",r:/Android/},{s:"Sun OS",r:/SunOS/},{s:"Linux",r:/(Linux|X11)/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/}],v=0;v<m.length;v++){var b=m[v];if(b.r.test(s)){f=b.s;break}}function I(e,t){e=e.exec(t);return e&&e[1]?e[1]:""}switch(/Windows/.test(f)&&(d=I(/Windows (.*)/,f),f="windows"),f){case"Mac OS X":d=I(/Mac OS X (10[\.\_\d]+)/,s),f="mac";break;case"Android":d=I(/Android ([\.\_\d]+)/,_=s)||I(/Android\/([\.\_\d]+)/,_),f="android";break;case"iOS":d=(d=/OS (\d+)_(\d+)_?(\d+)?/.exec(i))?d[1]+"."+d[2]+"."+(0|d[3]):"",f="ios"}return e=e?function(){var e=a?"_tea_utm_cache_"+a:"_tea_utm_cache",t={},r={utm_source:p.utm_source,utm_medium:p.utm_medium,utm_campaign:p.utm_campaign,utm_term:p.utm_term,utm_content:p.utm_content};try{var o,n,i=window.sessionStorage,s=!1;for(o in r)r[o]&&(t[o]=r[o],s=!0);s?i.setItem(e,JSON.stringify(t)):(n=i.getItem(e))&&(t=JSON.parse(n))}catch(e){return r}return t}():{},{browser:h,browser_version:y,platform:g,os_name:f,os_version:d,userAgent:s,screen_width:o,screen_height:n,device_model:function(e){var t,r,o="";try{"android"===e?navigator.userAgent.split(";").forEach(function(e){-1<e.indexOf("Build/")&&(o=e.slice(0,e.indexOf("Build/")))}):"ios"!==e&&"mac"!==e||(r=(t=navigator.userAgent.replace("Mozilla/5.0 (","")).indexOf(";"),o=t.slice(0,r))}catch(e){}return o.trim()}(f),language:c,referrer:u,referrer_host:l,utm_source:e.utm_source,utm_medium:e.utm_medium,utm_campaign:e.utm_campaign,utm_term:e.utm_term,utm_content:e.utm_content,isSupportBeacon:("ios"!==f||"safari"!==h)&&(!(!window.navigator||!window.navigator.sendBeacon)||void 0)}}(function(e){e.exports=function i(){function e(){for(var e=0,t={};e<arguments.length;e++){var r,o=arguments[e];for(r in o)t[r]=o[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function i(u){function r(){}function o(t,o,n){if("undefined"!=typeof document){"number"==typeof(n=e({path:"/"},r.defaults,n)).expires&&(n.expires=new Date(+new Date+864e5*n.expires)),n.expires=n.expires?n.expires.toUTCString():"";try{var i=JSON.stringify(o);/^[\{\[]/.test(i)&&(o=i)}catch(e){}o=u.write?u.write(o,t):encodeURIComponent(String(o)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s,a="";for(s in n)n[s]&&(a+="; "+s,!0!==n[s])&&(a+="="+n[s].split(";")[0]);return document.cookie=t+"="+o+a}}function s(e,r){if("undefined"!=typeof document){for(var o={},n=document.cookie?document.cookie.split("; "):[],i=0;i<n.length;i++){var s=n[i].split("="),a=s.slice(1).join("=");r||'"'!==a.charAt(0)||(a=a.slice(1,-1));try{var c=t(s[0]),a=(u.read||u)(a,c)||t(a);if(r)try{a=JSON.parse(a)}catch(e){}if(o[c]=a,e===c)break}catch(e){}}return e?o[e]:o}}return r.set=o,r.get=function(e){return s(e,!1)},r.getJSON=function(e){return s(e,!0)},r.remove=function(t,r){o(t,"",e(r,{expires:-1}))},r.defaults={},r.withConverter=i,r}(function(){})}()})(r={exports:{}});var C=r.exports,U=function(){function e(){this.cache={}}return e.prototype.setItem=function(e,t){this.cache[e]=t},e.prototype.getItem=function(e){return this.cache[e]},e.prototype.removeItem=function(e){this.cache[e]=void 0},e}(),I={getItem:function getItem(e){try{var t=localStorage.getItem(e),r=t;try{t&&"string"==typeof t&&(r=JSON.parse(t))}catch(e){}return r||void 0}catch(e){}},setItem:function setItem(e,t){try{var r="string"==typeof t?t:JSON.stringify(t);localStorage.setItem(e,r)}catch(e){}},removeItem:function removeItem(e){try{localStorage.removeItem(e)}catch(e){}},getCookie:function getCookie(e){try{var t=document.cookie.match(new RegExp("(?:^|;)\\s*"+e+"=([^;]+)")),r=t?t[1]:"";return decodeURIComponent(r)}catch(e){return""}},setCookie:function setCookie(e,t,r){try{var o=+new Date+r;C.set(e,t,{expires:new Date(o),path:"/",domain:document.domain.split(".").slice(-2).join(".")})}catch(e){}},isSupportLS:function(){try{return localStorage.setItem("_ranger-test-key","hi"),localStorage.getItem("_ranger-test-key"),localStorage.removeItem("_ranger-test-key"),!0}catch(e){return!1}}()},j=function(){function e(e){this._storage=!e&&I.isSupportLS?I:new U}return e.prototype.getItem=function(e){return this._storage.getItem(e)},e.prototype.setItem=function(e,t){this._storage.setItem(e,t)},e.prototype.getCookie=function(e){return this._storage.getCookie(e)},e.prototype.setCookie=function(e,t,r){this._storage.setCookie(e,t,r)},e.prototype.removeItem=function(e){this._storage.removeItem(e)},e}(),T={cn:"https://mcs.snssdk.com",sg:"https://sgali-mcs.byteoversea.com",va:"https://maliva-mcs.byteoversea.com"},E="/v1/user/webid",f={NO_URL:4001,IMG_ON:4e3,IMG_CATCH:4002,BEACON_FALSE:4003,XHR_ON:500,RESPONSE:5001},F=function _(e,t){return t?"__tea_cache_tokens_"+e:"__tea_cache_events_"+e},N=function p(r,o,n,i){try{var e=r.match(/\/v\d\//),t=e?e[0]:-1!==r.indexOf("/v1/")?"/v1/":"/v2/",s=r.split(t)[0];s?o.forEach(function(e){var e=function(e){var t,r="";for(t in e)e.hasOwnProperty(t)&&void 0!==e[t]&&(r+="&"+t+"="+encodeURIComponent(JSON.stringify(e[t])));return"&"===r[0]?r.slice(1):r}(e),t=new Image(1,1);t.onload=function(){t=null,n&&n()},t.onerror=function(){t=null,i&&i(r,o,f.IMG_ON)},t.src=s+"/v1/gif?"+e}):i(r,o,f.NO_URL)}catch(n){i&&i(r,o,f.IMG_CATCH,n.message)}},L=function l(e,t,r,o,n,i,s,a){var c=window.navigator.userAgent,c=-1!==window.navigator.appName.indexOf("Microsoft Internet Explorer")&&(-1!==c.indexOf("MSIE 8.0")||-1!==c.indexOf("MSIE 9.0")),u=!!r;if(!u&&c)N(e,t,o,n);else if(!u&&s)return Z4(!1).isSupportBeacon?(a&&a(),void(window.navigator.sendBeacon(e,JSON.stringify(t))?o():n(e,t,f.BEACON_FALSE))):void N(e,t,o,n);i&&delete t.app_key,function(e,t,r,o,n){var i=new XMLHttpRequest;i.open("POST",""+e,!0),i.setRequestHeader("Content-Type","application/json; charset=utf-8"),n&&i.setRequestHeader("X-MCS-AppKey",""+n),i.onload=function(){if(r){var t=null;if(i.responseText){try{t=JSON.parse(i.responseText)}catch(e){t={}}r(t)}}},i.onerror=function(){i.abort(),o&&o(t,f.XHR_ON)},i.send(JSON.stringify(t))}(e,t,o,n,r)};function g(e){return e?(e^16*Math.random()>>e/4).toString(10):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,g)}var B,z=function v(){return g().replace(/-/g,"").slice(0,19)},q=function(){function e(e,t){this.browser=Z4(!0,e.app_id),this.config=e,this.cfg=t,this.storage=new j(!1),this.appInfo=e.app_key||e.app_id,this.isNoWebid=e.disable_webid,this.isNoSsid=e.disable_webid||e.disable_ssid,this.domain=e.channel_domain||T[e.channel],this.tokenReady=!1,this.checkExp=e.checkExp||!1,this.enableCookie=e.cross_subdomain||!1,this.expiresTime=this.enableCookie?94608e6:0,this.fetchUrl=this.domain+E}return e.prototype._getToken=function(){this.tokensKey=F(this.appInfo,!0),this.cookieKey="__tea_cookie_tokens_"+this.appInfo;var e,t,r,o,n=this.storage.getItem(this.tokensKey);this.enableCookie?(o=this.storage.getCookie(this.cookieKey))?(o=decodeURIComponent(o),e=(o=JSON.parse(o)).user_unique_id,t=o.web_id,r=o.timestamp,o=o.ssid,this._setToken(t,e,o,r)):n?(this.storage.setCookie(this.cookieKey,encodeURIComponent(JSON.stringify(n)),this.expiresTime),this._checkLocal(n)):this._requestWebId():n?this._checkLocal(n):this._requestWebId()},e.prototype._checkLocal=function(e){e.web_id||(t=this.storage.getCookie("tt_webid"),n=this.storage.getCookie("__tea_sdk__ssid"),r=this.storage.getCookie("__tea_sdk__user_unique_id"),t&&n&&r&&(e={web_id:t,ssid:n,user_unique_id:r,timestamp:Date.now()},this.storage.setItem(this.tokensKey,e)));var t,r,e=this.storage.getItem(this.tokensKey),o=(r=e.user_unique_id,t=e.web_id,e.timestamp),n=e.ssid;t&&r?this._setToken(t,r,n,o):this._requestWebId()},e.prototype._setToken=function(e,t,r,o){if(this.uuid=t,this.web_id=e,this.ssid=r,this.checkExp){o=Date.now()-parseFloat(o);if(7344e6<o)return void this._requestWebId();if(432e7<o)return void this._updateWebId(e)}this._complete(e,t,r)},e.prototype._complete=function(e,t,r){this.cfg.envInfo.user.ssid=r,this.cfg.envInfo.user.web_id=e,this.cfg.envInfo.user.user_unique_id=t,this.tokenReady=!0},e.prototype._requestWebId=function(){this.isNoWebid?this._setwebId({web_id:z(),ssid:""}):this._fetchWebId(this.fetchUrl,!1)},e.prototype._updateWebId=function(e){e=this.domain+E+"/"+e+"/update";this._fetchWebId(e,!0)},e.prototype._fetchWebId=function(e,r){var o=this;this.isGetWebId=!0,L(e,{app_key:this.config.app_key,app_id:this.config.app_id,url:location.href,user_agent:this.browser.userAgent,referer:this.browser.referrer,user_unique_id:""},this.config.app_key,function(e){var t;e&&0===e.e?(r?(t={web_id:o.web_id,ssid:o.ssid,user_unique_id:o.uuid,timestamp:Date.now()},o.enableCookie&&o.storage.setCookie(o.cookieKey,encodeURIComponent(JSON.stringify(t)),o.expiresTime),o.storage.setItem(o.tokensKey,t),o._complete(o.web_id,o.uuid,o.ssid)):(o.isGetWebId=!1,o._setwebId(e)),o.isGetSsid?o._requestSsId():o.callback&&o.callback()):r?o._fetchWebId(o.fetchUrl,!1):o.isGetWebId=!1},function(){o.isGetWebId=!1},!0)},e.prototype._setwebId=function(e){var t=this.cfg.envInfo.user.web_id||e.web_id,r={web_id:t,ssid:e.ssid,user_unique_id:this._uuid||t,timestamp:Date.now()};this.enableCookie&&this.storage.setCookie(this.cookieKey,encodeURIComponent(JSON.stringify(r)),this.expiresTime),this.storage.setItem(this.tokensKey,r),this.cfg.envInfo.user.ssid=e.ssid,this.cfg.envInfo.user.web_id=t,this.cfg.envInfo.user.user_unique_id=this._uuid||t,this.uuid=this._uuid||t,this.web_id=t,this.ssid=e.ssid,this.tokenReady=!0},e.prototype._getSsid=function(e){e&&-1===["0","Null","None","","undefined"].indexOf(e)&&(this.uuid===e&&this.web_id&&this.ssid?this.tokenReady=!0:(this._uuid=e,this.uuid=e,this.cfg.envInfo.user.user_unique_id=e,this.isGetSsid=!0,this.isNoSsid||this.isGetWebId?this.callback&&this.callback():(this.tokenReady=!1,this.isGetSsid=!1,this._requestSsId())))},e.prototype._requestSsId=function(){var t=this,e=this.domain+"/v1/user/ssid";L(e,{app_key:this.config.app_key,app_id:this.config.app_id,web_id:this.web_id,user_unique_id:this.uuid},this.config.app_key,function(e){e&&0===e.e&&(t.cfg.envInfo.user.ssid=e.ssid,e={web_id:t.web_id,ssid:e.ssid,user_unique_id:t.uuid,timestamp:Date.now()},t.enableCookie&&t.storage.setCookie(t.cookieKey,encodeURIComponent(JSON.stringify(e)),t.expiresTime),t.storage.setItem(t.tokensKey,e)),t.tokenReady=!0,t.callback&&t.callback()},function(){t.tokenReady=!0,t.callback&&t.callback()},!0)},e.prototype.isTokenReady=function(){return this.tokenReady},e}(),H=function(){function t(e,t,r,o){this.cfg=t,this.config=e,this._token=r,this.appInfo=e.app_key||e.app_id,this.debugMode=!!e.log,this.evtDataKey=F(this.appInfo,!1);t=e.channel_domain||T[e.channel];this.reportUrl=e.report_url||t+"/v1/list",this.maxReport=e.max_report||20,this.storage=new j(!0),this.plugin=o,this.addListener()}return t.prototype.addListener=function(){var e=this;window.addEventListener("unload",function(){e.report(!0)},!1),window.addEventListener("beforeunload",function(){e.report(!0)},!1),document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&e.report(!0)},!1)},t.prototype.setReady=function(){this.isReady=!0,this.report()},t.prototype.event=function(e,t){var r=this,o=(void 0===e&&(e=[]),void 0===t&&(t=!1),this.storage.getItem(this.evtDataKey)||[]),t=t?index_base_min_i(e,o):index_base_min_i(o,e);this.storage.setItem(this.evtDataKey,t),this.reportTimer&&clearTimeout(this.reportTimer),t.length>=this.maxReport?this.report():this.reportTimer=setTimeout(function(){r.report(),r.reportTimer=null},30)},t.prototype.report=function(e){var t;void 0===e&&(e=!1),this._token.isTokenReady()&&this.isReady&&(t=this.storage.getItem(this.evtDataKey)||[],t=this._mergeEvents(t),this.storage.removeItem(this.evtDataKey),this._dealData(t,e))},t.prototype._mergeEvents=function(e){var t,r,o=this;return e.length?((t=this.cfg.get()).header.custom=JSON.stringify(t.header.custom),(r=[]).push(e),r.map(function(e){return{events:e.map(function(e){var t=s({},o.cfg.get("evtParams"),e.params);return delete t.__disable_storage__,s({},e,{params:JSON.stringify(t)})}),user:t.user,header:t.header,verbose:o.debugMode?1:void 0}})):e},t.prototype._dealData=function(e,r){var o=this;if(!e.length)return e;e.map(function(e){var t=[];return t.push(e),t}).forEach(function(e){var t=z();o._send(t,e,r)})},t.prototype._send=function(e,t,o){var n=this,i=(this.isSending=!0,function r(){n.isSending=!1});L(this.reportUrl,t,this.config.app_key,function(){i()},function(e,t){i(),n.cfg.get("reportErrorCallback")(e,t)},!1,o,i)},t}(),a=void 0,r=(new Date).getTimezoneOffset(),K=parseInt(""+-r/60,10),W=60*r,Q=function(){function t(e){e=Z4(!0,e);this.envInfo={user:{user_unique_id:a,user_type:a,user_id:a,user_is_auth:a,user_is_login:a,device_id:a,web_id:a,ip_addr_id:a,ssid:a},header:{app_id:a,app_name:a,app_install_id:a,install_id:a,app_package:a,app_channel:a,app_version:a,os_name:e.os_name,os_version:e.os_version,device_model:e.device_model,ab_client:a,ab_version:a,ab_sdk_version:a,traffic_type:a,client_ip:a,device_brand:a,os_api:a,access:a,language:e.language,region:a,app_language:a,app_region:a,creative_id:a,ad_id:a,campaign_id:a,log_type:a,rnd:a,platform:e.platform,sdk_version:"4.1.15",province:a,city:a,timezone:K,tz_offset:W,tz_name:a,sim_region:a,carrier:a,resolution:e.screen_width+"x"+e.screen_height,browser:e.browser,browser_version:e.browser_version,referrer:e.referrer,referrer_host:e.referrer_host,width:e.screen_width,height:e.screen_height,screen_width:e.screen_width,screen_height:e.screen_height,utm_term:e.utm_term,utm_content:e.utm_content,utm_source:e.utm_source,utm_medium:e.utm_medium,utm_campaign:e.utm_campaign,custom:{}}},this.evtParams={},this.reportErrorCallback=function(){}}return t.prototype.set=function(e,t){var r=this;if("disable_auto_pv"!==e)if("evtParams"===e||"_staging_flag"===e){var o="evtParams"===e?t:{_staging_flag:Number(t)},n=s({},o);Object.keys(n).forEach(function(e){r.evtParams[e]=n[e]})}else if("reportErrorCallback"===e&&"function"==typeof t)this.reportErrorCallback=t;else{var i,o="";if(-1<e.indexOf(".")&&(o=(i=e.split("."))[0],e=i[1]),"user_unique_id"===e){if(!t)return;if(-1!==["0","Null","None","","undefined"].indexOf(t))return}if("web_id"===(e="os_version"===e?""+t:e)){if(!t)return;(!this.envInfo.user.user_unique_id||this.envInfo.user.user_unique_id&&this.envInfo.user.user_unique_id===this.envInfo.user.web_id)&&(this.envInfo.user.user_unique_id=t)}o?"user"===o||"header"===o?this.envInfo[o][e]=t:this.envInfo.header.custom[e]=t:this.envInfo.user.hasOwnProperty(e)?-1<["user_type","device_id","ip_addr_id"].indexOf(e)?this.envInfo.user[e]=Number(t):-1<["user_id","web_id","user_unique_id","ssid"].indexOf(e)?this.envInfo.user[e]=String(t):-1<["user_is_auth","user_is_login"].indexOf(e)&&(this.envInfo.user[e]=Boolean(t)):this.envInfo.header.hasOwnProperty(e)?this.envInfo.header[e]=t:this.envInfo.header.custom[e]=t}},t.prototype.get=function(e){return e?"evtParams"===e?this.evtParams:"reportErrorCallback"===e?this.reportErrorCallback:JSON.parse(JSON.stringify(this.envInfo[e])):JSON.parse(JSON.stringify(this.envInfo))},t}(),J=function(){function e(e,t){this.isLog=t,this.name=e||""}var t=e.prototype;return t.info=function(e){this.isLog&&console.log(this.name+" "+e)},t.warn=function(e){this.isLog&&console.warn(this.name+" "+e)},t.error=function(e){this.isLog&&console.error(this.name+" "+e)},t.throw=function(e){throw this.error(this.name),new Error(e)},e}(),V=index_base_min_i(["init","config","send","start"],[]),X=(B=+Date.now()+Number((""+Math.random()).slice(2,8)),function(){function i(e){var r=this;this.predefinePageView=function(e){void 0===e&&(e={});var t=s({title:document.title||location.pathname,url:location.href,url_path:location.pathname,time:Date.now(),referrer:window.document.referrer},r._event.closeStorage?{}:{__disable_storage__:1}),t=s({},t,e);r.event("predefine_pageview",t,!0)},this.name=e,this._isSend=!1,this.autoPV=!0}return i.prototype.init=function(e){var t=this;if(!this._inited){if(this._inited=!0,!e||"object"!=_typeof(e))throw new Error("init参数有误,请检查");var r=e.app_id,o=e.app_key,n=e.log;this._config=new Q(r),this.logger=new J(this.name,n),o||r||this.logger.throw("没有传入 app_key 或 app_id "),r&&"number"!=typeof r&&this.logger.throw("app_id参数有误,请检查 "),o&&"string"!=typeof o&&this.logger.warn("app_key为空,如果有请传入"),e.channel_domain||-1!==["cn","sg","va"].indexOf(e.channel)||this.logger.throw("channel 变量只能是 `cn`, `sg`,`va`"),this._config.set("app_id",r),e.channel=e.channel||"cn",this._initConfig=e,this._token=new q(e,this._config),this._token.callback=function(){t.callbackSend&&t.start()},this._event=new H(e,this._config,this._token,this.plugin),this._token._getToken()}},i.prototype.config=function(e){if(this._inited)if(e&&"object"==_typeof(e)){if(e.user_unique_id){if("string"!=typeof e.user_unique_id)throw new Error("user_unique_id 只能是string");this._token._getSsid(e.user_unique_id)}for(var t in e.disable_auto_pv&&(this.autoPV=!1),e)this._config.set(t,e[t])}else this.logger.warn("config参数有误,请检查");else this.logger.warn("config应在init之后调用")},i.prototype.send=function(){this.start()},i.prototype.start=function(){this._token.isTokenReady()?this._isSend||(this._isSend=!0,this.logger.info("用户信息:"+JSON.stringify(this._config.get("user"))),this.autoPV&&this.predefinePageView(),this._event.setReady()):this.callbackSend=!0},i.prototype.event=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var o="boolean"==typeof e[e.length-1]&&e[e.length-1],n="boolean"==typeof e[e.length-1]?e.slice(0,e.length-1):e,i=t(n,1)[0],s=[];"Array"!==Object.prototype.toString.call(i).slice(8,-1)?s[0]=n:s=n,s=s.map(function(e){return function(e,t){var r=e,e=(/^event\./.test(e)&&(r=e.slice(6)),t);return(e="object"!=_typeof(e)?{}:e).event_index=B+=1,{event:r,params:e,local_time_ms:+new Date,is_bav:0}}(e[0],e[1])}),this._event.event(s,o)},i}());function R(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}var G=function M(e){var i=this;return R(this,"_exportCollect",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i._isProcess?i._executeCmd.apply(i,t):(i.cmdQueue.push(t),i._processCmd())}),R(this,"_processCmd",function(){var e,r,o;0!==i.cmdQueue.length&&(e=i.cmdQueue,r=-1,e.forEach(function(e,t){"init"===e[0]&&(r=t)}),-1!==(o=r))&&(i._isProcess=!0,i._executeCmd.apply(i,i.cmdQueue[o]),i.cmdQueue.forEach(function(e,t){t!==o&&i._executeCmd.apply(i,e)}),i.cmdQueue=[])}),R(this,"_executeCmd",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var o,n=t[0];-1<V.indexOf(n)?(o=i.colloctor)[n].apply(o,t.slice(1)):(n=i.colloctor).event.apply(n,t)}),this.cmdQueue=[],this.name=e,this.colloctor=new X(e),this._isProcess=!1,this._alias={},this._processCmd(),V.forEach(function(e){i._exportCollect[e]=i._exportCollect.bind(i,e)}),this._exportCollect},c={},u={},d=function P(e){return u[e]||(u[e]=[]),u[e]},Z=function A(e){var e=t(e),r=e[0],e=e.slice(1),o=r.split(".");1===o.length?d("default").push(index_base_min_i([r],e)):2===o.length?"event"===o[0]?d("default").push(index_base_min_i([r],e)):d(o[0]).push(index_base_min_i([o[1]],e)):(r=o[0],o=[o[1],o[2]].join("."),d(r).push(index_base_min_i([o],e)))},$=function D(){h.q.forEach(function(e){e=[].slice.call(e);"Array"===Object.prototype.toString.call(e[0]).slice(8,-1)?e.forEach(function(e){Z(e)}):Z(e)}),Object.keys(u).forEach(function(t){u[t].forEach(function(e){!function(e){return c[e]||(c[e]=new G(e)),c[e]}(t).apply(void 0,index_base_min_i(e))}),u[t]=[]}),h.q=[]},h=function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];e.q.push(t),$()},Y=(h.q=[],h.l=Date.now(),h._instanceMap=c,h._instanceCmdMap=u,V.forEach(function(e){h[e]=h.bind(null,e)}),function(e){var t,r;"undefined"!=typeof window&&(t=function(){if("undefined"!=typeof window)return window.TeaAnalyticsObject}())&&window[t]&&((r=window[t]).init||(e.q=r.q||[],e.l=r.l||Date.now(),window[t]=e))}(h),$(),h),ee={browserError:1e3,crc32:1e3,preUpload:1001,initUploadID:1002,process:1003,fileMerge:1004,complete:1005},te="video",y="image",_="object",re={video:"video_upload",image:"image_upload",object:"object_upload"},m=1,oe=2,ne=3,ie="vod",b="imagex",se=2562,ae=2643,ce={"cn-north-1":"cn-north-1","us-east-1":"us-east-1","ap-singapore-1":"ap-singapore-1",boe:"boe"},ue={"cn-north-1":"https://vod.volcengineapi.com","ap-singapore-1":"https://vod.byteplusapi.com"},le={"cn-north-1":"https://imagex.volcengineapi.com","us-east-1":"https://imagex-us-east-1.volcengineapi.com","ap-singapore-1":"https://imagex-ap-singapore-1.volcengineapi.com"};function LoggerV5_typeof(e){return(LoggerV5_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _extends(){return(_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function _toPropertyKey(e){e=function _toPrimitive(e,t){if("object"!==LoggerV5_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==LoggerV5_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===LoggerV5_typeof(e)?e:String(e)}(o.key),o)}}var pe=function(){function Logger(e,t){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Logger),this.options=e,this.context=t,this.teaLog=Y,this.tea_app_id=se,this.tea_channel="cn","ap-singapore-1"===this.options.region?(this.tea_app_id=ae,this.tea_channel="sg"):(this.tea_app_id=se,this.tea_channel="cn"),this.teaLog.init({app_id:this.tea_app_id,channel:this.tea_channel,log:!1,disable_sdk_monitor:!0}),this.teaLog.config({evtParams:{sdk_version:"1.0.27",line_app_id:this.options.appId,toB:!0},user_unique_id:this.options.userId,disable_auto_pv:!0}),this.teaLog.start()}return function _createClass(e,t,r){t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Logger,[{key:"send",value:function send(e){var t=this.context,r=e.key,t=t.tasks[r],o=ee[e.stage]||999,t=e.fileType||t.fileType,n=e.fileSize||0,i={toB:!0,log_type:re[t],stage:o,fk:r,fs:n,req:e.req,res:e.res,ts:Math.round(Date.now()/1e3),sst:e.stageStartTime,set:e.stageEndTime,dur:e.duration,tdur:e.totalDuration},s="".concat("image"===t?"image":"video","_")+("error"===e.type?"error":o);switch(o){case 1e3:this.teaLog(s,_extends({},i,{type:e.type,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message,crc32Array:e.crc32Array,isDirect:e.isDirect})}));break;case 1001:this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,err:e.extra&&e.extra.error,msg:e.extra&&e.extra.message,sig:e.signature})}));break;case 1002:this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message,upid:e.uploadID})}));break;case 1003:e.isAllFinish||e.isDirect||(delete i.sst,delete i.set,delete i.dur),this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message,si:e.slice_index,af:e.isAllFinish})}));break;case 1004:this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message})}));break;case 1005:this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,err:e.extra&&e.extra.error,msg:e.extra&&e.extra.message,vid:e.uploadResult&&e.uploadResult.Vid})}));break;default:this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message})}))}}},{key:"console",value:function(t){function console(e){return t.apply(this,arguments)}return console.toString=function(){return t.toString()},console}(function(e){this.options.debug&&console.log(e)})}]),Logger}(),r=o(4),fe=o.n(r),r=o(3),de=o.n(r),w={resolveUri:function resolveUri(t){if(!t)return"";if(Array.isArray(t))return t.map(function(t){try{return t.split("/")[0]+"/"+encodeURIComponent(t.split("/").slice(1).join("/"))}catch(e){return t}});try{return t.split("/")[0]+"/"+encodeURIComponent(t.split("/").slice(1).join("/"))}catch(e){return t}},urlTemplate:function urlTemplate(t,r){var o;return r=r||{},Object.keys(r).forEach(function(e){o=new RegExp("{".concat(e,"}"),"g"),t=t.replace(o,r[e])}),t},toQueryString:function toQueryString(){var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=[];return Object.keys(r).map(function(t){var e=r[t];"[object Array]"===Object.prototype.toString.call(e)?e.sort().forEach(function(e){o.push("".concat(t,"=").concat(encodeURIComponent(e)))}):o.push("".concat(t,"=").concat(encodeURIComponent(r[t])))}),o.join("&")},arrayToObject:function arrayToObject(e){var t={};return e&&e.forEach(function(e){t[e.Key.toLowerCase()]=e.Value}),t},supportChunked:function supportChunked(){var e=window.Blob||window.WebKitBlob;try{var t=e.prototype;return!(!FormData||!(t.slice||t.webkitSlice||t.mozSlice))}catch(e){return!1}},supportXhr:function supportXhr(){return!!window.FormData||window.ProgressEvent&&window.FileReader},supportCrc32:function supportCrc32(){var e=window.FileReader&&window.FileReader.prototype.readAsBinaryString;return"undefined"!=typeof Int32Array&&e&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice)},storage:function storage(e){var r=e,e={removeItem:function removeItem(e){delete r.cache[e]},setItem:function setItem(e,t){r.cache[e]=t},getItem:function getItem(e){return r.cache[e]},clear:function clear(){delete r.cache,r.cache={}}};if(!(1<arguments.length&&void 0!==arguments[1])||arguments[1])try{if(window.localStorage)return window.localStorage.setItem("",""),window.localStorage}catch(e){}return e},noop:function noop(){},getUnique:function getUnique(e){return"".concat(e,"_").concat((new Date).getTime(),"_").concat(parseInt(1e6*Math.random()))},getFileSliceLength:function getFileSliceLength(e,t){var r=e.size,o=1048576;return t&&"function"==typeof t?t(r)<5242880?5242880:t(r)||r:200*o<r?10*o:r<=200*o&&2*o<=r?5*o:e.size},getFileSuffix:function getFileSuffix(e){var t;return e&&"[object String]"===Object.prototype.toString.call(e)&&0<(t=e.lastIndexOf("."))?"."+e.substring(t+1):void 0},crypto:{hmac:function hmac(e,t){return fe()(t,e)},sha256:function sha256(e){return de()(e)}},date:{iso8601:function iso8601(e){return(e=void 0===e?w.date.getDate():e).toISOString().replace(/\.\d{3}Z$/,"Z")}},Buffer:Uint8Array,buffer:{toBuffer:function toBuffer(e,t){return"function"==typeof w.Buffer.from&&w.Buffer.from!==Uint8Array.from?w.Buffer.from(e,t):new w.Buffer(e,t)},alloc:function alloc(e,t,r){if("number"!=typeof e)throw new Error("size passed to alloc must be a number.");return"function"==typeof w.Buffer.alloc?w.Buffer.alloc(e,t,r):(e=new w.Buffer(e),void 0!==t&&"function"==typeof e.fill&&e.fill(t,void 0,void 0,r),e)},toStream:function toStream(t){w.Buffer.isBuffer(t)||(t=w.buffer.toBuffer(t));var r=new w.stream.Readable,o=0;return r._read=function(e){if(o>=t.length)return r.push(null);e=o+e;e>t.length&&(e=t.length),r.push(t.slice(o,e)),o=e},r},concat:function concat(e){for(var t,r=0,o=0,n=0;n<e.length;n++)r+=e[n].length;for(t=w.buffer.alloc(r),n=0;n<e.length;n++)e[n].copy(t,o),o+=e[n].length;return t}}},x=w;var he={crc32:function encrypt_crc32(e,t){for(var r=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],o=("undefined"!=typeof Int32Array&&(r=new Int32Array(r)),-1^~~t),n=(e=new Uint8Array(e)).length,i=0;i<n;i++)o=r[255&(o^e[i])]^o>>>8;return(-1^o)>>>0},dec2hex:function dec2hex(e){if(void 0!==e)return function toEight(e){return e.length<8?toEight(e="0".concat(e)):e}(Number(e).toString(16))}};function Crc32_typeof(e){return(Crc32_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Crc32_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function Crc32_toPropertyKey(e){e=function Crc32_toPrimitive(e,t){if("object"!==Crc32_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Crc32_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Crc32_typeof(e)?e:String(e)}(o.key),o)}}var ye=function(){function Crc32(e,t,r,o){!function Crc32_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Crc32),this.file=e,this.successProcess=r,this.failProcess=o,this.sliceLength=t,this.retryTime=0,this.fileSize=e.size,this.crc32Array=[]}return function Crc32_createClass(e,t,r){t&&Crc32_defineProperties(e.prototype,t),r&&Crc32_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Crc32,[{key:"start",value:function start(){this.readFileCrc32(this.file)}},{key:"readFileCrc32",value:function readFileCrc32(t){var r=this,e=this.sliceLength,o=t.slice||t.webkitSlice||t.mozSlice,n=new FileReader,i=0,s=0,a=0;(function read(){s<t.size&&(s=Math.min(i+e,t.size),104857600<t.size)&&t.size-s<=5242880&&(s=t.size),n.readAsArrayBuffer(o.call(t,i,s)),n.onload=function(e){e=e.target.result;a=he.crc32(e,0),r.crc32Array.push({start:i,end:s,crc32:he.dec2hex(a),buffer:e}),(i=s)<t.size?read():r.success(r.crc32Array)}})()}},{key:"success",value:function success(e){this.successProcess(e)}},{key:"fail",value:function fail(e,t,r,o){3<=this.retryTime?this.failProcess():(this.readFileCrc32(e,t,r,o),this.retryTime++)}}]),Crc32}();function FileCrc32_typeof(e){return(FileCrc32_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function FileCrc32_extends(){return(FileCrc32_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function FileCrc32_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function FileCrc32_toPropertyKey(e){e=function FileCrc32_toPrimitive(e,t){if("object"!==FileCrc32_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==FileCrc32_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===FileCrc32_typeof(e)?e:String(e)}(o.key),o)}}var _e=function(){function FileCrc32(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};!function FileCrc32_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FileCrc32),this.context=e.context,this.key=e.key,this.isDirect=e.isDirect,this.isImageBatchUpload=e.isImageBatchUpload,this.file=e.file,this.type=(this.isImageBatchUpload?this.file[0]:this.file).type||"",this.sliceLength=x.getFileSliceLength(this.file,t.getSliceFunc),this.config=t}return function FileCrc32_createClass(e,t,r){t&&FileCrc32_defineProperties(e.prototype,t),r&&FileCrc32_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(FileCrc32,[{key:"start",value:function start(e,t,r){this.successProcess=t,this.failProcess=r,this._st=Date.now(),this.crc32(this.file,this.sliceLength)}},{key:"crc32",value:function crc32(e,t){var r=this;if(this.isImageBatchUpload)for(var o=e.length,n=[],i=0;i<o;i++)new ye(e[i],e[i].size,function(e){n.push(e[0]),n.length===o&&r.success(n)},function(e){r.fail(e)}).start();else!e||!e.size||e.size<=0?this.fail({message:"There is a problem with the input file or fileSize."}):this.isDirect?new ye(e,e.size,function(e){r.success(e)},function(e){r.fail(e)}).start():this.sliceFile(e,t,function(e){r.success(e)},function(e){r.fail(e)})}},{key:"sliceFile",value:function sliceFile(e,t,r,o){for(var n=[],i=t,s=e.size,a=new FileReader,c=e.slice||e.webkitSlice||e.mozSlice,u=0,l=0,p=0;l<s;)l=Math.min(u+i,s),s-l<=5242880&&(l=s),n.push({start:u,end:l,crc32:0}),u=l;try{!function read(t){u=n[t].start,l=n[t].end,a.readAsArrayBuffer(c.call(e,u,l)),a.onload=function(e){e=e.target.result,p=he.dec2hex(he.crc32(e,0)),n[t].crc32=p,l===s?r(n):read(n.length-1)},a.onerror=function(e){o(e)}}(0)}catch(e){o(e)}}},{key:"getCrc32Key",value:function getCrc32Key(e,t){t="[object Array]"===Object.prototype.toString.call(t)?_toConsumableArray(t):[t];return t.push(e[0].crc32,e[e.length-1].crc32),t.join("_")}},{key:"success",value:function success(e){var t=this.context,r=this.key,o=[],n=[];if(this.isImageBatchUpload)for(var i=0;i<this.file.length;i++)o.push(this.file[i].size),n.push(this.file[i].name);else o=this.file.size,n=this.file.name;var s=this.getCrc32Key(e,o),t=t.tasks[r];t&&this.successProcess(FileCrc32_extends(t,{key:r,crc32Array:e,crc32Key:s,sdkVersion:"1.0.27",sliceLength:this.sliceLength,extra:{message:"get crc32 success"},stage:"crc32",type:"success",fileSize:o,fileName:n,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st,isDirect:this.isDirect,isImageBatchUpload:this.isImageBatchUpload}))}},{key:"fail",value:function fail(e){var t=this.context,r=this.key,e=e&&e.message?e.message:"get crc32 error",t=FileCrc32_extends(t.tasks[r],{extra:{message:e},type:"error",stage:"crc32",stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st});this.failProcess(t)}}]),FileCrc32}();function Transport_typeof(e){return(Transport_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Transport_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function Transport_toPropertyKey(e){e=function Transport_toPrimitive(e,t){if("object"!==Transport_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Transport_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Transport_typeof(e)?e:String(e)}(o.key),o)}}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(r){var o=function _isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=_getPrototypeOf(r);return function _possibleConstructorReturn(e,t){{if(t&&("object"===Transport_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function _assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var k=function(){!function _inherits(e,t){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&&_setPrototypeOf(e,t)}(Transport,n.a);var t=_createSuper(Transport);function Transport(){var e;return function Transport_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Transport),(e=t.call(this)).xhr=new XMLHttpRequest,e._data=null,e}return function Transport_createClass(e,t,r){t&&Transport_defineProperties(e.prototype,t),r&&Transport_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Transport,[{key:"_ajax",value:function _ajax(e){var t=this,r=this.xhr;r.upload.onprogress=function(e){t.emit("progress",e)},r.onreadystatechange=function(){4===r.readyState&&(r.upload.onprogress=x.noop,r.onreadystatechange=x.noop,r.params=e,t._data&&t._data.url&&(r.currentUrl=t._data.url),200<=r.status&&r.status<300?t.emit("complete",r):400<=r.status&&t.emit("error",r))},r.onerror=function(){r.errText="unknow net error",t.emit("error",r)},r.ontimeout=function(){r.errText="timeout",t.emit("error",r)},r.onabort=function(){r.errText="abort",t.emit("error",r)},r.send(e)}},{key:"send",value:function send(t){var r=this;return this._data=t,this.xhr.open(t.method||"POST",t.url||"",!0),t.headers&&Object.keys(t.headers).forEach(function(e){r.xhr.setRequestHeader(e,t.headers[e])}),this.xhr.timeout=t.timeout||0,t.ontimeout&&(this.xhr.ontimeout=t.ontimeout),t.binary?this.sendAsBinary(t):t.custom?"object"===Transport_typeof(t.custom)?this.sendAsCustom(JSON.stringify(t.custom)):"none"===t.custom?(delete t.custom,this.sendAsCustom()):this.sendAsCustom(t.custom):this.sendAsFormData(t)}},{key:"sendAsBinary",value:function sendAsBinary(e){return this.xhr.setRequestHeader("Content-Type","application/octet-stream"),this.xhr.setRequestHeader("Content-Disposition",'attachment; filename="'.concat(encodeURI(e.filename),'"')),this._ajax(e.file)}},{key:"sendAsFormData",value:function sendAsFormData(e){t=(t=e.formData?"function"==typeof e.formData?e.formData():e.formData:t)||[];for(var t,r=new FormData,o=0,n=t.length;o<n;o++){var i=t[o];r.append(i.name,i.value)}return e.file&&r.append(e.field,e.file,e.name),this._ajax(r)}},{key:"sendAsCustom",value:function sendAsCustom(e){return this._ajax(e)}},{key:"abort",value:function abort(){this.xhr.onreadystatechange=x.noop,this.xhr.abort()}},{key:"getResponse",value:function getResponse(){return this.xhr.response}},{key:"getText",value:function getText(){return this.xhr.responseText}},{key:"getJson",value:function getJson(){return JSON.parse(this.xhr.responseText)}}]),Transport}(),r=o(1),ge=o.n(r),me=1000002,ve=1001e3,be=1002e3,we=1003e3,xe=1003003,ke=1004e3,Oe=1005e3,Se="The format of stsToken is incorrect.",Ce="An error occurred reading the file";function ApplyUpload_typeof(e){return(ApplyUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){!function _defineProperty(e,t,r){(t=ApplyUpload_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function ApplyUpload_extends(){return(ApplyUpload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function ApplyUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,ApplyUpload_toPropertyKey(o.key),o)}}function ApplyUpload_toPropertyKey(e){e=function ApplyUpload_toPrimitive(e,t){if("object"!==ApplyUpload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==ApplyUpload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===ApplyUpload_typeof(e)?e:String(e)}function ApplyUpload_setPrototypeOf(e,t){return(ApplyUpload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function ApplyUpload_createSuper(r){var o=function ApplyUpload_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=ApplyUpload_getPrototypeOf(r);return function ApplyUpload_possibleConstructorReturn(e,t){{if(t&&("object"===ApplyUpload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function ApplyUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=ApplyUpload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function ApplyUpload_getPrototypeOf(e){return(ApplyUpload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Pe=function(){!function ApplyUpload_inherits(e,t){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&&ApplyUpload_setPrototypeOf(e,t)}(ApplyUpload,n.a);var o=ApplyUpload_createSuper(ApplyUpload);function ApplyUpload(e,t){var r;return function ApplyUpload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ApplyUpload),(r=o.call(this)).options=e,r.config=t,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r.isImageBatchUpload=!!r.options.isImageBatchUpload,r.serviceName=e.serviceName||ie,r}return function ApplyUpload_createClass(e,t,r){t&&ApplyUpload_defineProperties(e.prototype,t),r&&ApplyUpload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(ApplyUpload,[{key:"start",value:function start(e,t,r){this.failProcess=r,this.successProcess=t,this._st=Date.now();r=this.uploaderCtx._getCache(this.currFileCtx.crc32Key),t=r?JSON.parse(r):{};t.oid&&t.uploadID&&t.tosDomain?this.resumeFromCache(t):this.startPreUpload()}},{key:"startPreUpload",value:function startPreUpload(){var f=this,e=ce[this.config.region],t=new k,r=(t.on("complete",function(t){if(t.response)try{var e,r,o,n,i,s,a,c,u,l,p=JSON.parse(t.response);p.ResponseMetadata.Error?f.fail({xhr:t,errorCode:p.ResponseMetadata.Error.CodeN,error:p.ResponseMetadata.Error.Code,message:p.ResponseMetadata.Error.Message}):(e=p.Result,o=(r=(f.options.type===y&&f.config.imageConfig&&f.config.imageConfig.serviceId?e:e.Data).UploadAddress).StoreInfos,n=r.UploadHosts,i=r.SessionKey,a=void 0===(s=r.UploadHeader)?[]:s,c=[],u=[],f.isImageBatchUpload&&1<o.length?o.forEach(function(e){c.push(e.Auth),u.push(e.StoreUri)}):(c=o[0].Auth,u=o[0].StoreUri),l=ApplyUpload_extends(f.currFileCtx,{signature:c,type:"success",extra:{message:"prepare upload success"},stage:"preUpload",oid:x.resolveUri(u),tosDomain:"".concat(f.config.schema,"://").concat(n[0]),xhr:t,UploadHeader:a,SessionKey:i,stageStartTime:f._st,stageEndTime:Date.now(),duration:Date.now()-f._st,totalDuration:Date.now()-f._st+f.currFileCtx.totalDuration}),f.successProcess&&f.successProcess(l))}catch(e){f.fail({error:"catch error: ".concat(e.toString()),xhr:t})}else f.fail({error:"request fail: ".concat(t.statusText||t.errText||"UNKNOWN"),xhr:t})}),t.on("error",function(e){var t={error:"request fail: ".concat(e.statusText||e.errText||"UNKNOWN"),xhr:e};e.response&&(e=JSON.parse(e.response)).ResponseMetadata&&e.ResponseMetadata.Error&&(t.errorCode=e.ResponseMetadata.Error.CodeN,t.error=e.ResponseMetadata.Error.Code,t.message=e.ResponseMetadata.Error.Message),f.fail(t)}),this.serviceName),o="",n={},i=(r===b?(o=this.config.imageHost||le[e],n={Action:"ApplyImageUpload",Version:"2018-08-01",ServiceId:this.options.serviceId||this.config.imageConfig.serviceId},this.currFileCtx.fileSize&&1<this.currFileCtx.fileSize.length&&(n.UploadNum=this.currFileCtx.fileSize.length),this.options.storeKey&&(i=this.options.storeKey,"[object Array]"===Object.prototype.toString.call(i)?n.StoreKeys=i:"[object String]"===Object.prototype.toString.call(i)&&(n.StoreKeys=[i])),this.options.prefix&&(n.Prefix=this.options.prefix)):(i=this.config.videoConfig&&this.config.videoConfig.spaceName,this.options.type===_&&this.config.objectConfig&&this.config.objectConfig.spaceName&&(i=this.config.objectConfig.spaceName),o=this.config.videoHost||ue[e],n={Action:"ApplyUploadInfo",Version:"2022-01-01",SpaceName:i,FileSize:this.currFileCtx.fileSize,FileType:this.options.type},this.options.fileName&&(n.FileName=this.options.fileName),this.options.fileExtension&&(n.FileExtension=this.options.fileExtension),this.options.storageClass&&(n.StorageClass=this.options.storageClass),this.config.enOID&&(n.EnOID=1)),this.config.useFileExtension&&this.currFileCtx.fileName&&(this.options.type===_||this.options.type===y)&&(i=this.currFileCtx.fileName,i=x.getFileSuffix(i))&&(n.FileExtension=i),this.options.fileExtension&&(n.FileExtension=this.options.fileExtension),this.config.accountId&&(n["X-Account-Id"]=this.config.accountId),n.s=Math.random().toString(36).substr(2),this.currFileCtx.proxyStsToken||this.config.stsToken),s=x.toQueryString(n),a=i.AccessKeyID,c=i.AccessKeyId,u=i.SecretAccessKey,i=i.SessionToken,o={method:"GET",url:"".concat(o,"?").concat(s),timeout:3e4,region:e,params:n};new ge.a(o,r,{isVolcengine:!0}).addAuthorization({accessKeyId:c||a,secretAccessKey:u,sessionToken:i},new Date),t.send(o)}},{key:"resumeFromCache",value:function resumeFromCache(i){var s=this,a=this.options.key,e=new k,t=(e.on("complete",function(e){try{var t,r,o,n=JSON.parse(e.response);0===n.success&&0<n.payload.partList.length?(t=s.confirmCache(n.payload.partList),r=!!i.hasMerge?5:t.isAllFinished?4:3,o=ApplyUpload_extends(s.currFileCtx,i,{key:a,xhr:e,extra:{message:"prepare upload from cache success"},stage:"preUpload",type:"success",percent:0,cacheTask:r,proxyStsToken:s.options.stsToken,currentTask:1,status:1,isBreak:1,crc32Array:t.crc32Array,stageStartTime:s._st,stageEndTime:Date.now(),duration:Date.now()-s._st,totalDuration:Date.now()-s._st+s.currFileCtx.totalDuration}),s.successProcess&&s.successProcess(o)):s.startPreUpload()}catch(e){s.startPreUpload()}}),e.on("error",function(e){400<=e.status?s.startPreUpload():s.fail({error:"request error",xhr:e})}),this.config.userId),r=ApplyUpload_extends(x.arrayToObject(i.UploadHeader),{"x-storage-mode":"gateway"});e.send({method:"get",url:x.urlTemplate(this.config.getUploadListUrl,{tosDomain:i.tosDomain,oid:i.oid,uploadId:i.uploadID}),headers:_objectSpread({authorization:i.signature,"x-storage-u":t},r),timeout:3e4})}},{key:"confirmCache",value:function confirmCache(e){var t=this.currFileCtx.crc32Array,r={},o=(e.forEach(function(e){var t=parseInt(e.partNumber)-1;isNaN(t)||void 0!==r[t]||(r[t]={tag:!0,crc32:e.crc32})}),!0),e=t.map(function(e,t){return r[t]&&r[t].tag&&r[t].crc32?(e.crc32=r[t].crc32,e.finished=!0,e.loaded=e.end-e.start):o=!1,e});return{isAllFinished:o,crc32Array:e}}},{key:"fail",value:function fail(e){var t=e.xhr,r=e.errorCode||ve,o="prepare upload error: UNKNOWN",o=(t&&(o=0===t.status?"prepare upload error: NETERROR":e.message||"prepare upload error: ".concat(t.status)),ApplyUpload_extends(this.currFileCtx,{extra:{message:o,error:e.error,errorCode:r},type:"error",stage:"preUpload",xhr:t,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration}));this.uploaderCtx._removeTaskCache(this.options.key),this.failProcess(o)}}]),ApplyUpload}();function InitUploadID_typeof(e){return(InitUploadID_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function InitUploadID_ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function InitUploadID_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?InitUploadID_ownKeys(Object(r),!0).forEach(function(e){!function InitUploadID_defineProperty(e,t,r){(t=InitUploadID_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):InitUploadID_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function InitUploadID_extends(){return(InitUploadID_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function InitUploadID_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,InitUploadID_toPropertyKey(o.key),o)}}function InitUploadID_toPropertyKey(e){e=function InitUploadID_toPrimitive(e,t){if("object"!==InitUploadID_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==InitUploadID_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===InitUploadID_typeof(e)?e:String(e)}function InitUploadID_setPrototypeOf(e,t){return(InitUploadID_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function InitUploadID_createSuper(r){var o=function InitUploadID_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=InitUploadID_getPrototypeOf(r);return function InitUploadID_possibleConstructorReturn(e,t){{if(t&&("object"===InitUploadID_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function InitUploadID_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=InitUploadID_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function InitUploadID_getPrototypeOf(e){return(InitUploadID_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ue=function(){!function InitUploadID_inherits(e,t){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&&InitUploadID_setPrototypeOf(e,t)}(InitUploadID,n.a);var o=InitUploadID_createSuper(InitUploadID);function InitUploadID(e,t){var r;return function InitUploadID_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,InitUploadID),(r=o.call(this)).options=e,r.config=t,r.transport=new k,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r.eventInit(),r}return function InitUploadID_createClass(e,t,r){t&&InitUploadID_defineProperties(e.prototype,t),r&&InitUploadID_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(InitUploadID,[{key:"initUpload",value:function initUpload(){var e=this.options.context,t=this.options.key,r={oid:e.tasks[t].oid,tosDomain:e.tasks[t].tosDomain},r=x.urlTemplate(this.config.initUploadFileUrl,r),o=this.config.userId,n=InitUploadID_extends(x.arrayToObject(this.currFileCtx.UploadHeader),{"x-storage-mode":"gateway"});this.transport.send({method:"post",url:r,headers:InitUploadID_objectSpread({authorization:e.tasks[t].signature,"x-storage-u":o},n),timeout:3e4})}},{key:"start",value:function start(e,t,r){this.successProcess=t,this.failProcess=r,this._st=Date.now(),this.initUpload()}},{key:"eventInit",value:function eventInit(){var n=this,i=this.options.context,s=this.options.key;this.transport.on("complete",function(t){try{var e,r=JSON.parse(t.response),o=r.payload.uploadID;0===r.success&&o?(e=InitUploadID_extends(i.tasks[s],{uploadID:o,percent:0,type:"success",extra:{message:"init upload id success"},stage:"initUploadID",xhr:t,stageStartTime:n._st,stageEndTime:Date.now(),duration:Date.now()-n._st,totalDuration:Date.now()-n._st+n.currFileCtx.totalDuration}),n.successProcess(e)):n.fail({error:"fail! res.success: ".concat(r.success,", uploadId:").concat(o),xhr:t})}catch(e){n.fail({error:"catch error: ".concat(JSON.stringify(e)),xhr:t})}}),this.transport.on("error",function(e){n.fail({error:"request fail: ".concat(e.statusText||e.errText||"UNKNOWN"),xhr:e})})}},{key:"fail",value:function fail(e){var t=this.options.context,r=this.options.key,t=InitUploadID_extends(t.tasks[r],{extra:{message:"init upload id error, ".concat(e.error),errorCode:be},type:"error",stage:"initUploadID",xhr:e.xhr,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration});this.uploaderCtx._removeTaskCache(this.options.key),this.failProcess(t)}}]),InitUploadID}();function Uploader_typeof(e){return(Uploader_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Uploader_ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function Uploader_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Uploader_ownKeys(Object(r),!0).forEach(function(e){!function Uploader_defineProperty(e,t,r){(t=Uploader_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Uploader_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Uploader_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,Uploader_toPropertyKey(o.key),o)}}function Uploader_toPropertyKey(e){e=function Uploader_toPrimitive(e,t){if("object"!==Uploader_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Uploader_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Uploader_typeof(e)?e:String(e)}function Uploader_setPrototypeOf(e,t){return(Uploader_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Uploader_createSuper(r){var o=function Uploader_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=Uploader_getPrototypeOf(r);return function Uploader_possibleConstructorReturn(e,t){{if(t&&("object"===Uploader_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function Uploader_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=Uploader_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function Uploader_getPrototypeOf(e){return(Uploader_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ie=function(){!function Uploader_inherits(e,t){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&&Uploader_setPrototypeOf(e,t)}(Uploader,n.a);var u=Uploader_createSuper(Uploader);function Uploader(e){var t,r=e.sliceItem,o=e.crc32,n=e.url,i=e.signature,s=e.uploadHeader,a=e.userId,c=e.retryTime,c=void 0===c?0:c,e=e.method,e=void 0===e?"put":e;return function Uploader_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Uploader),(t=u.call(this)).fileSlice=r,t.crc32=o,t.uploadUrl=n,t.uploadHeader=s,t.signature=i,t.userId=a,t.retryTime=c,t.method=e,t.retryCount=0,t.ready=!1,t.cancel=!1,t.transport=new k,t.eventInit(),t}return function Uploader_createClass(e,t,r){t&&Uploader_defineProperties(e.prototype,t),r&&Uploader_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Uploader,[{key:"upload",value:function upload(){this.isParamsValid()&&(this._st=Date.now(),this.transport.send({method:this.method,url:this.uploadUrl,headers:Uploader_objectSpread({authorization:this.signature,"content-crc32":this.crc32,"x-storage-u":this.userId},this.uploadHeader),file:this.fileSlice,binary:1,timeout:18e5}))}},{key:"isParamsValid",value:function isParamsValid(){return this.fileSlice&&(this.fileSlice.size||this.fileSlice.byteLength)?this.crc32?!!this.uploadUrl||(this.emit("error",{message:"slice upload failed: NOURL",crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength}),!1):(this.emit("error",{message:"slice upload failed: NOCRC32",crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength}),!1):(this.emit("error",{message:"slice upload failed: NOCONTENT",crc32:this.crc32}),!1)}},{key:"eventInit",value:function eventInit(){var t=this;this.transport.on("complete",function(e){t.success(e)}),this.transport.on("error",function(e){t.fail(e)}),this.transport.on("progress",function(e){t.process(e)})}},{key:"success",value:function success(e){this.ready=!0;var t=Date.now()-this._st,r=this.fileSlice.size||this.fileSlice.byteLength;this.emit("complete",{crc32:this.crc32,size:r,speed:r/t,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st})}},{key:"fail",value:function fail(e){var t,r=this;this.cancel||(e&&401===e.status?this.emit("error",{message:"slice upload failed: UNAUTHORIZED",crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st}):this.retryCount<this.retryTime?(setTimeout(function(){r.upload()},1e3),this.retryCount++):(t="slice upload failed: UNKNOWN",e&&(t=e.status?"slice upload failed: ".concat(e.status):"slice upload failed: NETERROR"),this.emit("error",{message:t,crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st})))}},{key:"process",value:function process(e){this.cancel||this.emit("progress",{crc32:this.crc32,loaded:e.loaded||0,total:e.total||0})}},{key:"abort",value:function abort(){this.transport&&(this.cancel=!0,this.transport.abort())}},{key:"destroy",value:function destroy(){this.transport=null}}]),Uploader}(),r=o(5),je=o.n(r);function Upload_typeof(e){return(Upload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Upload_extends(){return(Upload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function Upload_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function Upload_toPropertyKey(e){e=function Upload_toPrimitive(e,t){if("object"!==Upload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Upload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Upload_typeof(e)?e:String(e)}(o.key),o)}}function Upload_setPrototypeOf(e,t){return(Upload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Upload_createSuper(r){var o=function Upload_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=Upload_getPrototypeOf(r);return function Upload_possibleConstructorReturn(e,t){{if(t&&("object"===Upload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function Upload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=Upload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function Upload_getPrototypeOf(e){return(Upload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Te=function(){!function Upload_inherits(e,t){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&&Upload_setPrototypeOf(e,t)}(Upload,n.a);var o=Upload_createSuper(Upload);function Upload(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return function Upload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Upload),(t=o.call(this)).file=e.file,t.context=e.context,t.key=e.key,t.config=r,t.finishArr=[],t.errorLength=0,t.finishSize=0,t.retryUploadTime=Number(r.retryUploadTime)||5,t.retryProcess=r.retryProcess,t.retryProcessTime=Number(r.retryProcessTime)||5,t.maxProcessPause=Number(r.maxProcessPause)||20,t.uploadSliceCount=Number(r.uploadSliceCount)||5,t.realtimeSpeedInterval=Number(r.realtimeSpeedInterval)||5,t.processRetry=0,t.lastFinishSize=-1,t.lastProcessPercent=-1,t.lastIntervalSize=-1,t.lastCalculateSpeedTime=-1,t.lastCalculateSpeedSize=0,t.uploadHandlers={},t}return function Upload_createClass(e,t,r){t&&Upload_defineProperties(e.prototype,t),r&&Upload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Upload,[{key:"start",value:function start(e,t,r){this.failProcess=r,this.successProcess=t,this.errorLength=0,this.currentCtx=this.context.tasks[this.key],this.crc32Array=this.context.tasks[this.key].crc32Array,this.uploadSliceCount=this.uploadSliceCount>this.crc32Array.length?this.crc32Array.length:this.uploadSliceCount,this.lastIndex=0,this.uploading=[],this._uploadSize=this.crc32Array.reduce(function(e,t){return e+(t.finished?0:t.end-t.start)},0),this._st=Date.now(),this._lastSaveTime=Date.now(),this.lastCalculateSpeedTime=this._st,this.initWorker(),this.threadUpload()}},{key:"initWorker",value:function initWorker(){var n,i=this;this.worker||(n=this.crc32Array,this.worker=new je.a,this.worker.onmessage=function(e){var t=e.data[0],r=e.data[2],o=n[r];o.crc32=e.data[1],i.upload(o,t,r)})}},{key:"read",value:function read(e,t){var r=this,o=this.file,n=o.slice||o.webkitSlice||o.mozSlice,i=new FileReader;i.onload=function(e){r.worker.postMessage([e.target.result,t],[e.target.result])},i.onerror=function(){r.stop(),r.fail({extra:{message:Ce,errorCode:xe}})},i.readAsArrayBuffer(n.call(o,e.start,e.end))}},{key:"threadUpload",value:function threadUpload(){if(this.uploading.length<this.uploadSliceCount){var e=this.lastIndex,t=this.crc32Array[e];if(t){if(t.finished){if(-1===this.finishArr.indexOf(t.start)&&(this.finishArr.push(t.start),this.finishArr.length>=this.crc32Array.length))return this.stop(),void this.success()}else t.loaded=0,this.uploading.push(e),this.read(t,e);this.lastIndex++,this.threadUpload()}}}},{key:"stop",value:function stop(){var t=this;Object.keys(this.uploadHandlers).forEach(function(e){t.uploadHandlers[e].abort()}),this.worker&&this.worker.terminate(),this.worker=null,this.clearMonitor()}},{key:"clearMonitor",value:function clearMonitor(){this.progressMonitorInterval&&clearInterval(this.progressMonitorInterval)}},{key:"upload",value:function upload(t,e,r){var o=this,n=t.crc32,i={number:r+1,uploadId:this.currentCtx.uploadID,oid:this.currentCtx.oid,tosDomain:this.currentCtx.tosDomain},i=x.urlTemplate(this.config.uploadChunkedUrl,i),s=this.config.userId,a=Upload_extends(x.arrayToObject(this.currentCtx.UploadHeader),{"x-storage-mode":"gateway"}),e=new Ie({sliceItem:e,crc32:n,url:i,signature:this.currentCtx.signature,uploadHeader:a,userId:s,retryTime:this.retryUploadTime});e.on("complete",function(e){o.currentCtx.status===m&&(e.start=t.start,e.index=r,o.fileSliceSuccess(e))}),e.on("error",function(e){1===o.currentCtx.status&&(e.start=t.start,e.index=r,o.fail(e))}),e.on("progress",function(e){1===o.currentCtx.status&&(e.start=t.start,e.index=r,o.process(e))}),e.upload(),this.uploadHandlers[r]=e}},{key:"success",value:function success(e){this.finishArr=[];var t=Date.now()-this._st,t=this._uploadSize/t,t=Upload_extends(this.currentCtx,{type:"success",stage:"process",percent:100,extra:{message:"upload all success"},speed:t,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._lastSaveTime+this.currentCtx.totalDuration,isAllFinish:!0});this.worker&&this.worker.terminate(),this.successProcess(t)}},{key:"fail",value:function fail(e){var t=this.currentCtx.totalDuration,r=Date.now()-this._st,o=e.crc32?{message:e.message,data:e.crc32,size:e.size}:e.extra,o=(o.errorCode=o.errorCode||we,Upload_extends(this.currentCtx,{extra:o,type:"error",stage:"process",req:{},res:{},totalDuration:r+t}));e.xhr&&(r=e.xhr,o.req={url:e.xhr.currentUrl},o.res={status:r.status,body:r.responseText,header:r.getAllResponseHeaders()},delete e.xhr),void 0!==e.statusCode&&Upload_extends(this.currentCtx,{statusCode:e.statusCode}),this.errorLength||(t=e.index,this.context.logger.send(Upload_extends({},o,{slice_index:t})),this.stop(),this.context._broadcast("error",o),this.currentCtx.isBreak?this.context._cancel(this.key):this.context._pause(this.key),this.errorLength++)}},{key:"fileSliceSuccess",value:function fileSliceSuccess(e){var t,r=e.index,o=Date.now(),n=(-1===this.finishArr.indexOf(e.start)&&this.finishArr.push(e.start),this.crc32Array[r].finished=!0,this.crc32Array[r].speed=e.speed,{message:"slice upload success"});e.xhr&&(t=e.xhr,n.currentUrl=t.currentUrl||"",Upload_extends(this.currentCtx,{req:{url:t.currentUrl,param:t.params},res:{status:t.status,body:t.responseText,header:t.getAllResponseHeaders()}}),delete e.xhr),this.context.logger.send(Upload_extends(this.currentCtx,{stage:"process",type:"success",slice_index:r,extra:n,totalDuration:o-this._lastSaveTime+this.currentCtx.totalDuration})),this._lastSaveTime=o,this.finishArr.length>=this.crc32Array.length?(this.stop(),this.success(e.xhr)):(this.uploading.splice(this.uploading.indexOf(r),1),this.uploadHandlers[r]&&delete this.uploadHandlers[r],this.threadUpload())}},{key:"getFinishSize",value:function getFinishSize(e,t){var r=t.crc32,o=0;return e.forEach(function(e){e.crc32===r?(e.loaded=t.loaded,o+=t.loaded):(e.loaded||(e.loaded=0),o+=e.loaded)}),o}},{key:"process",value:function process(e){var t=this.currentCtx.realtimeSpeed||0,r=this.currentCtx.fileSize,o=(this.finishSize=this.getFinishSize(this.crc32Array,e),this.finishSize>this.lastFinishSize&&((e=new Date).getTime()-this.lastCalculateSpeedTime>1e3*this.realtimeSpeedInterval&&(n=e.getTime()-this.lastCalculateSpeedTime,o=this.finishSize-this.lastCalculateSpeedSize,t=Math.floor(o/n),this.lastCalculateSpeedTime=e.getTime(),this.lastCalculateSpeedSize=this.finishSize),this.lastFinishSize=this.finishSize),Math.floor(this.finishSize/r*100*100)/100||0),n=Upload_extends(this.currentCtx,{stage:"process",percent:o,realtimeSpeed:t});o>this.lastProcessPercent&&100!==o&&(this.lastProcessPercent=o,this.context._broadcast("progress",n))}}]),Upload}();function FileMerge_typeof(e){return(FileMerge_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function FileMerge_ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function FileMerge_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?FileMerge_ownKeys(Object(r),!0).forEach(function(e){!function FileMerge_defineProperty(e,t,r){(t=FileMerge_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):FileMerge_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function FileMerge_extends(){return(FileMerge_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function FileMerge_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,FileMerge_toPropertyKey(o.key),o)}}function FileMerge_toPropertyKey(e){e=function FileMerge_toPrimitive(e,t){if("object"!==FileMerge_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==FileMerge_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===FileMerge_typeof(e)?e:String(e)}function FileMerge_setPrototypeOf(e,t){return(FileMerge_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function FileMerge_createSuper(r){var o=function FileMerge_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=FileMerge_getPrototypeOf(r);return function FileMerge_possibleConstructorReturn(e,t){{if(t&&("object"===FileMerge_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function FileMerge_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=FileMerge_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function FileMerge_getPrototypeOf(e){return(FileMerge_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var De=function(){!function FileMerge_inherits(e,t){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&&FileMerge_setPrototypeOf(e,t)}(FileMerge,n.a);var o=FileMerge_createSuper(FileMerge);function FileMerge(e,t){var r;return function FileMerge_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FileMerge),(r=o.call(this)).options=e,r.config=t,r.transport=new k,r.eventInit(),r.errorCount=0,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r}return function FileMerge_createClass(e,t,r){t&&FileMerge_defineProperties(e.prototype,t),r&&FileMerge_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(FileMerge,[{key:"mergeFile",value:function mergeFile(){for(var e={oid:this.currFileCtx.oid,uploadId:this.currFileCtx.uploadID,tosDomain:this.currFileCtx.tosDomain},t=this.currFileCtx.crc32Array,r="",o=0;o<t.length;o++)r=(r?"".concat(r,","):"").concat(o+1,":").concat(t[o].crc32);var e=x.urlTemplate(this.config.uploadMergeUrl,e),n=this.config.userId,i=FileMerge_extends(x.arrayToObject(this.currFileCtx.UploadHeader),{"x-storage-mode":"gateway"});this.transport.send({method:"post",url:e,headers:FileMerge_objectSpread({authorization:this.currFileCtx.signature,"x-storage-u":n},i),custom:r})}},{key:"start",value:function start(e,t,r){this.successProcess=t,this.failProcess=r,this._st=Date.now(),this.mergeFile()}},{key:"eventInit",value:function eventInit(){var r=this,o=this.options.stage;this.transport.on("complete",function(t){try{var e=JSON.parse(t.response);0===e.success&&e.payload.key?(FileMerge_extends(r.currFileCtx,{stage:o,type:"success",hasMerge:!0,extra:{message:"merge file success"},xhr:t,stageStartTime:r._st,stageEndTime:Date.now(),duration:Date.now()-r._st,totalDuration:Date.now()-r._st+r.currFileCtx.totalDuration}),r.successProcess(r.currFileCtx)):r.fail({error:"fail! result.success:".concat(e.success),xhr:t})}catch(e){r.fail({error:"response parse error: ".concat(JSON.stringify(e)),xhr:t})}}),this.transport.on("error",function(e){r.fail({error:"request fail: ".concat(e.statusText||e.errText),xhr:e})})}},{key:"getProcessIndex",value:function getProcessIndex(e){var r=0;return e.forEach(function(e,t){"process"===e.stage&&(r=t)}),r}},{key:"fail",value:function fail(e){e=FileMerge_extends(this.currFileCtx,{extra:{message:"merge file error, ".concat(e.error),errorCode:ke},type:"error",stage:this.options.stage,xhr:e.xhr,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration});this.failProcess(e)}}]),FileMerge}();function DirectUpload_typeof(e){return(DirectUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function DirectUpload_extends(){return(DirectUpload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function DirectUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function DirectUpload_toPropertyKey(e){e=function DirectUpload_toPrimitive(e,t){if("object"!==DirectUpload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==DirectUpload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===DirectUpload_typeof(e)?e:String(e)}(o.key),o)}}function DirectUpload_setPrototypeOf(e,t){return(DirectUpload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function DirectUpload_createSuper(r){var o=function DirectUpload_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=DirectUpload_getPrototypeOf(r);return function DirectUpload_possibleConstructorReturn(e,t){{if(t&&("object"===DirectUpload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function DirectUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=DirectUpload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function DirectUpload_getPrototypeOf(e){return(DirectUpload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ee=function(){!function DirectUpload_inherits(e,t){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&&DirectUpload_setPrototypeOf(e,t)}(DirectUpload,n.a);var o=DirectUpload_createSuper(DirectUpload);function DirectUpload(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return function DirectUpload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,DirectUpload),(t=o.call(this)).options=e,t.file=e.file,t.context=e.context,t.key=e.key,t.config=r,t.finishArr=[],t.errorLength=0,t.finishSize=0,t.retryUploadTime=Number(r.retryUploadTime)||5,t.processRetry=0,t.lastFinishSize=-1,t.lastProcessPercent=-1,t.lastIntervalSize=-1,t}return function DirectUpload_createClass(e,t,r){t&&DirectUpload_defineProperties(e.prototype,t),r&&DirectUpload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(DirectUpload,[{key:"start",value:function start(e,t,r){this.failProcess=r,this.successProcess=t,this.currentCtx=this.context.tasks[this.key],this.crc32Array=this.context.tasks[this.key].crc32Array,this._uploadSize=this.file.size,this.uploadHandlers={},this._st=Date.now(),this.upload()}},{key:"upload",value:function upload(){for(var t=this,r=this.crc32Array.length,o=0,n=0,e=0;e<r;e++){var i=this.crc32Array[e],s=i.buffer,i=i.crc32,a=this.currentCtx.oid,c=this.currentCtx.signature,a={oid:"[object Array]"===Object.prototype.toString.call(a)?a[e]:a,tosDomain:this.currentCtx.tosDomain},a=x.urlTemplate(this.config.directUploadFileUrl,a),u=this.config.userId,l=x.arrayToObject(this.currentCtx.UploadHeader),s=new Ie({sliceItem:s,crc32:i,url:a,signature:"[object Array]"===Object.prototype.toString.call(c)?c[e]:c,uploadHeader:l,userId:u,retryTime:this.retryUploadTime,method:"put"});s.on("complete",function(e){n+ ++o===r&&t.success(e.xhr)}),s.on("error",function(e){++n===r&&t.fail(e.xhr)}),s.on("progress",function(e){t.process(e)}),(this.uploadHandlers["".concat(i,"_").concat(Math.round(1e3*Math.random()))]=s).upload()}}},{key:"success",value:function success(e){this.finishArr=[];var t=Date.now()-this._st,t=this._uploadSize/t,t=DirectUpload_extends(this.currentCtx,{type:"success",stage:"process",percent:100,extra:{message:"direct upload success"},speed:t,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currentCtx.totalDuration});this.successProcess(t)}},{key:"fail",value:function fail(e){e=DirectUpload_extends(this.currentCtx,{extra:{message:"direct upload error",errorCode:we},type:"error",stage:"process",xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currentCtx.totalDuration});this.failProcess(e)}},{key:"process",value:function process(e){var t=this.currentCtx.fileSize,e=(this.finishSize=e.loaded,this.finishSize>this.lastFinishSize&&(this.lastFinishSize=this.finishSize),Math.floor(this.finishSize/t*100*100)/100||0),t=DirectUpload_extends(this.currentCtx,{stage:"process",percent:e});e>this.lastProcessPercent&&100!==e&&(this.lastProcessPercent=e,this.context._broadcast("progress",t))}},{key:"stop",value:function stop(){Object.values(this.uploadHandlers).forEach(function(e){e.abort()})}}]),DirectUpload}();function CommitUpload_typeof(e){return(CommitUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function CommitUpload_ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function CommitUpload_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?CommitUpload_ownKeys(Object(r),!0).forEach(function(e){!function CommitUpload_defineProperty(e,t,r){(t=CommitUpload_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):CommitUpload_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function CommitUpload_extends(){return(CommitUpload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function CommitUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,CommitUpload_toPropertyKey(o.key),o)}}function CommitUpload_toPropertyKey(e){e=function CommitUpload_toPrimitive(e,t){if("object"!==CommitUpload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==CommitUpload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===CommitUpload_typeof(e)?e:String(e)}function CommitUpload_setPrototypeOf(e,t){return(CommitUpload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function CommitUpload_createSuper(r){var o=function CommitUpload_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=CommitUpload_getPrototypeOf(r);return function CommitUpload_possibleConstructorReturn(e,t){{if(t&&("object"===CommitUpload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function CommitUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=CommitUpload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function CommitUpload_getPrototypeOf(e){return(CommitUpload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ae=function(){!function CommitUpload_inherits(e,t){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&&CommitUpload_setPrototypeOf(e,t)}(CommitUpload,n.a);var o=CommitUpload_createSuper(CommitUpload);function CommitUpload(e,t){var r;return function CommitUpload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,CommitUpload),(r=o.call(this)).options=e,r.config=t,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r.isImageBatchUpload=!!r.options.isImageBatchUpload,r.processAction=e.processAction,r.skipCommit=e.skipCommit,r.serviceName=e.serviceName||ie,r.transport=new k,r.eventInit(),r}return function CommitUpload_createClass(e,t,r){t&&CommitUpload_defineProperties(e.prototype,t),r&&CommitUpload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(CommitUpload,[{key:"commitUpload",value:function commitUpload(){var t,e=this.options.key,e=this.options.context.tasks[e],r=ce[this.config.region],o="",n={},i=this.serviceName,e=(i===b?(o=this.config.imageHost||le[r],n={Action:"CommitImageUpload",Version:"2018-08-01",SessionKey:e.SessionKey},this.options.skipMeta&&(n.SkipMeta=this.options.skipMeta),this.options.serviceId||this.config.imageConfig&&this.config.imageConfig.serviceId?n.ServiceId=this.options.serviceId||this.config.imageConfig.serviceId:n.SpaceName=this.config.videoConfig&&this.config.videoConfig.spaceName):(s=this.config.videoConfig&&this.config.videoConfig.spaceName,this.options.type===_&&this.config.objectConfig&&this.config.objectConfig.spaceName&&(s=this.config.objectConfig.spaceName),o=this.config.videoHost||ue[r],n={Action:"CommitUploadInfo",Version:"2022-01-01"},t={SpaceName:s,SessionKey:e.SessionKey,Functions:[]},s=this.config.videoConfig&&this.config.videoConfig.processAction,this.options.type===_&&this.config.objectConfig&&this.config.objectConfig.processAction&&(s=this.config.objectConfig.processAction),this.processAction&&(s=this.processAction),Array.isArray(s)&&0<s.length&&(t.Functions=s),(this.config.videoConfig&&this.config.videoConfig.callbackArgs||this.options.callbackArgs)&&(t.CallbackArgs=this.options.callbackArgs||this.config.videoConfig.callbackArgs)),this.config.accountId&&(n["X-Account-Id"]=this.config.accountId),x.toQueryString(n)),s=this.currFileCtx.proxyStsToken||this.config.stsToken,a=s.AccessKeyID,c=s.AccessKeyId,u=s.SecretAccessKey,s=s.SessionToken,o={method:"POST",url:"".concat(o,"?").concat(e),timeout:3e4,region:r,params:n,headers:{}};this.options.type===y&&this.config.imageConfig&&this.config.imageConfig.serviceId?(o.custom="none",o.headers["Content-Type"]="application/json"):(e=Object.keys(t).map(function(e){return"[object Array]"===Object.prototype.toString.call(t[e])||"[object Object]"===Object.prototype.toString.call(t[e])?"".concat(e,"=").concat(encodeURIComponent(JSON.stringify(t[e]))):"SessionKey"===e?"".concat(e,"=").concat(encodeURIComponent(t[e])):"".concat(e,"=").concat(t[e])}).join("&"),o.headers["Content-Type"]="application/x-www-form-urlencoded",o.body=e,o.custom=o.body),new ge.a(o,i,{isVolcengine:!0}).addAuthorization({accessKeyId:c||a,secretAccessKey:u,sessionToken:s},new Date),this.transport.send(o)}},{key:"start",value:function start(e,t,r){if(this.successProcess=t,this.failProcess=r,this._st=Date.now(),this.skipCommit)return this.successProcess(CommitUpload_extends(this.currFileCtx,{stage:"complete",type:"success",percent:100,extra:{message:"upload successful, skip commit"},stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration,skipCommit:this.skipCommit}));try{this.commitUpload()}catch(e){this.fail({error:"catch error: ".concat(e.toString())})}}},{key:"eventInit",value:function eventInit(){var a=this;this.transport.on("complete",function(t){try{var e,r,o,n,i,s=JSON.parse(t.response);if(!s.ResponseMetadata.Error)return e=s.Result,r={},a.options.type===y&&a.config.imageConfig&&a.config.imageConfig.serviceId?a.isImageBatchUpload?(o=e.Results,n=e.PluginResult||[],o.forEach(function(e,t){o[t]=CommitUpload_objectSpread(CommitUpload_objectSpread({},o[t]),n[t])}),r=o):CommitUpload_extends(r=e.Results[0],e.PluginResult&&e.PluginResult[0]):r=e.Data,i=CommitUpload_extends(a.currFileCtx,{stage:"complete",type:"success",percent:100,extra:{message:"upload successful"},uploadResult:r,xhr:t,stageStartTime:a._st,stageEndTime:Date.now(),duration:Date.now()-a._st,totalDuration:Date.now()-a._st+a.currFileCtx.totalDuration}),a.successProcess(i);a.fail({xhr:t,errorCode:s.ResponseMetadata.Error.CodeN,error:s.ResponseMetadata.Error.Code,message:s.ResponseMetadata.Error.Message})}catch(e){a.fail({error:"catch error: ".concat(e.toString()),xhr:t})}}),this.transport.on("error",function(e){var t={error:"request fail: ".concat(e.statusText||e.errText||"UNKNOWN"),xhr:e};if(e.response)try{var r=JSON.parse(e.response);r.ResponseMetadata&&r.ResponseMetadata.Error&&(t.errorCode=r.ResponseMetadata.Error.CodeN,t.error=r.ResponseMetadata.Error.Code,t.message=r.ResponseMetadata.Error.Message)}catch(e){}a.fail(t)})}},{key:"fail",value:function fail(e){var t=this.options.context,r=this.options.key,o=e.xhr,n=e.errorCode||Oe,i="commit upload error: UNKNOWN",t=(o&&(i=0===o.status?"commit upload error: NETERROR":e.message||"commit upload error: ".concat(o.status)),CommitUpload_extends(t.tasks[r],{extra:{message:i,error:e.error,errorCode:n},type:"error",stage:"complete",xhr:o,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration}));this.failProcess(t)}}]),CommitUpload}();function Queue_typeof(e){return(Queue_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Queue_extends(){return(Queue_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function Queue_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function Queue_toPropertyKey(e){e=function Queue_toPrimitive(e,t){if("object"!==Queue_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Queue_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Queue_typeof(e)?e:String(e)}(o.key),o)}}function Queue_setPrototypeOf(e,t){return(Queue_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Queue_createSuper(r){var o=function Queue_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=Queue_getPrototypeOf(r);return function Queue_possibleConstructorReturn(e,t){{if(t&&("object"===Queue_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function Queue_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=Queue_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function Queue_getPrototypeOf(e){return(Queue_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Me=function(){!function Queue_inherits(e,t){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&&Queue_setPrototypeOf(e,t)}(Queue,n.a);var i=Queue_createSuper(Queue);function Queue(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=2<arguments.length?arguments[2]:void 0,n=3<arguments.length?arguments[3]:void 0;return function Queue_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Queue),(t=i.call(this,e)).tasks=e,t.config=r,t.key=n,t.uploaderCtx=o,t.current=0,t.length=t.tasks.length,t.taskError={},t.uploadList=[],t.retryTaskTime=r.retryTaskTime||3,t}return function Queue_createClass(e,t,r){t&&Queue_defineProperties(e.prototype,t),r&&Queue_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Queue,[{key:"start",value:function start(){var e=this.tasks.shift();e&&(this.current=e.index,this.execTask(e))}},{key:"execTask",value:function execTask(r){var o=this,n=r.key,i=this.uploaderCtx,e=i.tasks[n].cacheTask,s=i.taskList[n].length;e&&0<r.index&&r.index<e?this.start():(i.tasks[n].currentTask=r.index,1===i.tasks[n].status&&r&&r.func.call(r.context,r.arg,function(e){var t=i.taskList[n][r.index+1];t&&0!==r.index?i._saveTask(n,{currentTask:t.index,stage:t.stage}):r.index===s-1&&i._removeTaskCache(n),o.success(e),0<o.tasks.length?o.start():i._queueSuccess(n)},function(e){e.xhr&&400<=e.xhr.status?o.fail(e):o.taskError[n]?o.taskError[n]<o.retryTaskTime?(o.taskError[n]++,o.execTask(r)):(e.key=n,o.fail(e)):(o.taskError[n]=1,o.execTask(r))}))}},{key:"addTask",value:function addTask(e){this.tasks.push(e)}},{key:"success",value:function success(e){var t;e.xhr&&(t=e.xhr,e.req={url:t.currentUrl,param:t.params},e.res={status:t.status,header:t.getAllResponseHeaders(),body:t.responseText},delete e.xhr),Queue_extends(e,{type:"success"});try{this.uploaderCtx._broadcast(e.stage,e)}catch(e){}this.uploaderCtx.logger.send(e)}},{key:"fail",value:function fail(e){var t,r=this.uploaderCtx;e.xhr&&(t=e.xhr,e.req={url:t.currentUrl,param:t.params},e.res={status:t.status,header:t.getAllResponseHeaders(),body:t.responseText},e.extra&&(e.extra.req=e.req,e.extra.res=e.res),delete e.xhr),Queue_extends(e,{type:"error"});try{r._broadcast("error",e)}catch(e){}r.logger.send(e),1!==e.currentTask&&(r.tasks[e.key].isBreak?r._cancel(e.key):r._pause(e.key))}},{key:"cancel",value:function cancel(e){var t=this.key,r=this.uploaderCtx.tasks[t].currentTask,r=this.uploaderCtx.tasks[t].isDirect?this.uploaderCtx.taskList[t][r-1]:this.uploaderCtx.taskList[t][r];e?r&&3===r.index&&(e=r.context,Object.values(e.uploadHandlers).forEach(function(e){e.abort()})):(this.tasks=[],r&&3===r.index&&r.context.stop(),this.uploaderCtx._removeTaskCache(t))}},{key:"restart",value:function restart(){this.uploadList.forEach(function(e){e.cancel=!1}),this.start()}}]),Queue}();function MainClass_typeof(e){return(MainClass_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function MainClass_extends(){return(MainClass_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function MainClass_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function MainClass_toPropertyKey(e){e=function MainClass_toPrimitive(e,t){if("object"!==MainClass_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==MainClass_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===MainClass_typeof(e)?e:String(e)}(o.key),o)}}function MainClass_setPrototypeOf(e,t){return(MainClass_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function MainClass_createSuper(r){var o=function MainClass_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=MainClass_getPrototypeOf(r);return function MainClass_possibleConstructorReturn(e,t){{if(t&&("object"===MainClass_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return MainClass_assertThisInitialized(e)}(this,o?(e=MainClass_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function MainClass_assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function MainClass_getPrototypeOf(e){return(MainClass_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Re=function(){!function MainClass_inherits(e,t){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&&MainClass_setPrototypeOf(e,t)}(MainClass,n.a);var r=MainClass_createSuper(MainClass);function MainClass(e){var t;return function MainClass_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,MainClass),(t=r.call(this,e)).config=MainClass_extends({},S),t._mergeOptions(t.config,e),t.tasks={},t.taskList={},t.cache={},t.storage=x.storage(MainClass_assertThisInitialized(t),t.config.useLocalStorage),t.logger=t.config.noLog?{send:function send(){}}:new pe(t.config,MainClass_assertThisInitialized(t)),t}return function MainClass_createClass(e,t,r){t&&MainClass_defineProperties(e.prototype,t),r&&MainClass_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(MainClass,[{key:"_mergeOptions",value:function _mergeOptions(t,r){r&&"object"===MainClass_typeof(r)&&(MainClass_extends(t,r),t.log.userId=r.userId||t.userId,t.log.appId=r.appId||t.appId,Object.keys(r).forEach(function(e){"vodDomain"===e&&(t.replace[e]=r[e])}))}},{key:"_setCache",value:function _setCache(e,t){this.storage.setItem(e,t)}},{key:"_getCache",value:function _getCache(e){return this.storage.getItem(e)}},{key:"_removeCache",value:function _removeCache(e){e?this.storage.removeItem(e):this.storage.clear()}},{key:"_addTask",value:function _addTask(e,t){var r=this.tasks,o=this.taskList;r[e]&&r[e].task?o[e].push(t):(o[e]=[],o[e].push(t),r[e]=r[e]||{},r[e].task=new Me([],this.config,this,e)),r[e].task.addTask(t)}},{key:"_broadcast",value:function _broadcast(e,t){var r=this.tasks[t.key].status;if(r===m||0===r)try{this.emit(e,t)}catch(e){r=!("[object Error]"!==Object.prototype.toString.call(e));if(!r||"Error"===e.name)throw e}}},{key:"_addCrc32ProcessTask",value:function _addCrc32ProcessTask(e,t,r){var o=r.isDirect,r=r.isImageBatchUpload,e=new _e({file:e.file,context:this,key:t,isDirect:o,isImageBatchUpload:r},this.config),o={context:e,func:e.start,arg:{},key:t,index:0,stage:"crc32"};this._addTask(t,o)}},{key:"_addPreUploadTask",value:function _addPreUploadTask(e,t,r){var o=r.isImageBatchUpload,n=r.serviceId,r=r.serviceName,o={file:e.file,stsToken:e.stsToken,context:this,type:e.type||te,preUploadUriParams:e.preUploadUriParams||{},key:t,isImageBatchUpload:o,fileName:e.fileName||null,fileExtension:e.fileExtension||null,storageClass:e.storageClass||null,serviceId:n,prefix:e.prefix,storeKey:e.storeKey,serviceName:r},n=new Pe(o,this.config),e={context:n,func:n.start,arg:{},key:t,index:1,stage:"preUpload"};this._addTask(t,e)}},{key:"_addDirectUploadTask",value:function _addDirectUploadTask(e,t,r){r=r.isImageBatchUpload,e=new Ee({file:e.file,context:this,key:t,isImageBatchUpload:r},this.config),r={context:e,func:e.start,arg:{},key:t,index:3,stage:"process"};this._addTask(t,r)}},{key:"_addInitUploadIDTask",value:function _addInitUploadIDTask(e,t){e=new Ue({file:e.file,context:this,key:t},this.config),e={context:e,func:e.start,arg:{},key:t,index:2,stage:"initUploadID"};this._addTask(t,e)}},{key:"_addUploadProcessTask",value:function _addUploadProcessTask(e,t){e=new Te({file:e.file,context:this,key:t},this.config),e={context:e,func:e.start,arg:{},key:t,index:3,stage:"process"};this._addTask(t,e)}},{key:"_mergeFileTask",value:function _mergeFileTask(e,t){e=new De({file:e.file,context:this,stage:"fileMerge",key:t},this.config),e={context:e,func:e.start,arg:{},key:t,index:4,stage:"fileMerge"};this._addTask(t,e)}},{key:"_getMetaInfoTask",value:function _getMetaInfoTask(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},o=r.isImageBatchUpload,n=r.serviceId,i=r.skipCommit,r=r.serviceName,o={file:e.file,context:this,data:e.data,type:e.type||te,callbackArgs:e.callbackArgs,key:t,isImageBatchUpload:void 0!==o&&o,serviceId:n,processAction:e.processAction,skipCommit:i,skipMeta:e.skipMeta,serviceName:r},n=new Ae(o,this.config),i={context:n,func:n.start,arg:{},key:t,index:5,stage:"complete"};this._addTask(t,i)}},{key:"_addAllUploadProcess",value:function _addAllUploadProcess(e,t,r){var o=e.type===y&&"[object Array]"===Object.prototype.toString.call(e.file),n=(this.tasks[t]=this.tasks[t]||{},this.tasks[t].fileType=e.type||te,this.tasks[t].fileSize=e.file&&e.file.size,this.tasks[t].proxyStsToken=e.stsToken,e.file.size<10485760||o),n=(this._addCrc32ProcessTask(e,t,{isDirect:n,isImageBatchUpload:o}),this._addPreUploadTask(e,t,{isImageBatchUpload:o,serviceId:r===b?e.serviceId:null,serviceName:r}),n?this._addDirectUploadTask(e,t,{isImageBatchUpload:o}):(this._addInitUploadIDTask(e,t),this._addUploadProcessTask(e,t),this._mergeFileTask(e,t)),r===b&&e.skipCommit);this._getMetaInfoTask(e,t,{isImageBatchUpload:o,serviceId:r===b?e.serviceId:null,skipCommit:n,serviceName:r})}},{key:"_run",value:function _run(e){var t=this.tasks,r=navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/);r&&r[1]&&Number(r[1])<=9?(this._broadcast("error",MainClass_extends(t[e],{key:e,status:0,stage:"browserError",extra:{message:"cannot support the browser below ie10"},type:"error"})),this.logger.send(t[e]),this._cancel(e)):t[e]?t[e].status===ne?this._restart(e):(r=new Date,t[e].startTime=r.getTime(),t[e].task&&t[e].status!==m&&t[e].task.tasks.length&&(t[e].status=m,this.logger.send(MainClass_extends({},t[e],{extra:{message:"start upload"},type:"start",key:e})),t[e].task.start())):console.warn("".concat(e," is not exit in object tasks, stop running..."))}},{key:"_restart",value:function _restart(r){var o,n,i=this,e=this.tasks;e[r]?(o=e[r].task,n=e[r].currentTask||0,this.taskList[r].forEach(function(e,t){e.index===n&&(o.tasks=i.taskList[r].slice(t))}),o&&e[r].status!==m&&o.tasks.length&&(e[r].status=m,o.restart())):console.warn("".concat(r," is not exit in object tasks"))}},{key:"_cancel",value:function _cancel(e){var t=this.tasks;t[e]?(t[e].status=oe,t[e].task.cancel(!1),this.taskList[e]=[]):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_pause",value:function _pause(e){var t=this.tasks;t[e]?(t[e].status=ne,t[e].task.cancel(!0),this._saveTask(e)):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_removeTaskCache",value:function _removeTaskCache(e){var t=this.tasks;t[e]?(t=t[e].crc32Key)&&this._removeCache(t):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_saveTask",value:function _saveTask(e,t){e=MainClass_extends({},this.tasks[e],t||{}),t=e.crc32Key;if(t){var r={SessionKey:e.SessionKey,UploadHeader:e.UploadHeader,fileName:e.fileName,oid:e.oid,uploadID:e.uploadID,signature:e.signature,tosDomain:e.tosDomain,hasMerge:e.hasMerge};Object.keys(r).forEach(function(e){r[e]||delete r[e]});try{this._setCache(t,JSON.stringify(r))}catch(e){return[!1,e.message]}return[!0,""]}}},{key:"_queueSuccess",value:function _queueSuccess(e){var t,r=this.tasks;r[e]?(t=new Date,r[e].endTime=t.getTime(),r[e].time=r[e].endTime-r[e].startTime,r[e].status=0,this.taskList[e]=[]):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_removeFile",value:function _removeFile(e){delete this.tasks[e]}},{key:"_batchAction",value:function _batchAction(t){var e=this.tasks;Object.keys(e).forEach(function(e){t&&t(e)})}},{key:"_refreshStsToken",value:function _refreshStsToken(o){var n=this,i=this.tasks;Object.keys(i).forEach(function(e){var e=i[e],t=MainClass_extends({},e,{proxyStsToken:o}),r=(e.proxyStsToken=o,t.crc32Key);r&&(delete t.task,delete t.xhr,delete t.crc32Array,e.proxyStsToken=o,n._setCache(r,JSON.stringify(t)))})}},{key:"_setOption",value:function _setOption(e){this._mergeOptions(this.config,e)}},{key:"_setServiceId",value:function _setServiceId(e){!this.config.imageConfig&&e?this.config.imageConfig={serviceId:e}:this.config.imageConfig.serviceId=e}},{key:"_getServiceId",value:function _getServiceId(){var e;return null==(e=this.config.imageConfig)?void 0:e.serviceId}},{key:"_getOption",value:function _getOption(e){var t=MainClass_extends({},this.config);return Object.keys(t).forEach(function(e){(-1<e.indexOf("Url")||"replace"===e||"log"===e)&&delete t[e]}),e?t[e]:t}},{key:"_userCancel",value:function _userCancel(e){var t=this,r=this.tasks;e?(this._cancel(e),this.logger.send(MainClass_extends({},r[e],{type:"cancel"}))):Object.keys(r).forEach(function(e){t._cancel(e),t.logger.send(MainClass_extends({},r[e],{type:"cancel"}))})}},{key:"_userPause",value:function _userPause(e){var t=this,r=this.tasks;e?(this._pause(e),this.logger.send(MainClass_extends({},r[e],{type:"pause"}))):Object.keys(r).forEach(function(e){t._pause(e),t.logger.send(MainClass_extends({},r[e],{type:"pause"}))})}}]),MainClass}(),Fe={checkFile:function checkFile(){},checkStsToken:function checkStsToken(e){return!e||e.SessionToken&&e.SecretAccessKey&&(e.AccessKeyId||e.AccessKeyID)}};function entry_typeof(e){return(entry_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function entry_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function entry_toPropertyKey(e){e=function entry_toPrimitive(e,t){if("object"!==entry_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==entry_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===entry_typeof(e)?e:String(e)}(o.key),o)}}function entry_setPrototypeOf(e,t){return(entry_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function entry_createSuper(r){var o=function entry_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=entry_getPrototypeOf(r);return function entry_possibleConstructorReturn(e,t){{if(t&&("object"===entry_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function entry_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=entry_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function entry_getPrototypeOf(e){return(entry_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ne=function(){!function entry_inherits(e,t){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&&entry_setPrototypeOf(e,t)}(TTUploader,Re);var e=entry_createSuper(TTUploader);function TTUploader(){return function entry_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,TTUploader),e.apply(this,arguments)}return function entry_createClass(e,t,r){t&&entry_defineProperties(e.prototype,t),r&&entry_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(TTUploader,[{key:"start",value:function start(e){this.abort=!1,e?this._run(e):this._batchAction(this._run.bind(this))}},{key:"addFile",value:function addFile(e){var t;return e&&Fe.checkStsToken(e.stsToken)?e.file?(t=x.getUnique("file"),this._addAllUploadProcess(e,t,ie),t):null:(this.emit("error",{extra:{message:Se,errorCode:me}}),null)}},{key:"addImageFile",value:function addImageFile(e){var t;return e&&Fe.checkStsToken(e.stsToken)?e.file?(e.type=y,t=x.getUnique("file"),this._addAllUploadProcess(e,t,b),t):null:(this.emit("error",{extra:{message:Se,errorCode:me}}),null)}},{key:"setServiceId",value:function setServiceId(e){this._setServiceId(e)}},{key:"getServiceId",value:function getServiceId(){return this._getServiceId()}},{key:"removeFile",value:function removeFile(e){e&&this._removeFile(e)}},{key:"cancel",value:function cancel(e){e?this._userCancel(e):this._batchAction(this._userCancel.bind(this))}},{key:"pause",value:function pause(e){this._userPause(e)}},{key:"restart",value:function restart(e){e?this._restart(e):this._batchAction(this._restart.bind(this))}},{key:"refreshAuth",value:function refreshAuth(e){this._refreshAuth(e)}},{key:"setOption",value:function setOption(e){this._setOption(e)}},{key:"getOption",value:function getOption(e){return this._getOption(e)}}]),TTUploader}()}]).default});
|
|
1
|
+
!function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.BytedUploader=t():e.BytedUploader=t()}("undefined"!=typeof self?self:this,()=>(()=>{var r={149:function(r,n,i){var o;function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e){"object"==_typeof(n)?r.exports=e():void 0!==(o="function"==typeof(o=e)?o.call(n,i,n,r):o)&&(r.exports=o)}(function(){"use strict";function e(e,t){for(var r,n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,"symbol"==_typeof(r=function(e,t){if("object"!=_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return String(e);r=r.call(e,t);if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(i.key,"string"))?r:String(r),i)}}function t(e,t,r){return e(r={path:t,exports:{},require:function require(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var r=t(function(e,t){e.exports=function(u){var r=Object.create||function(){function e(){}return function(t){return e.prototype=t,t=new e,e.prototype=null,t}}(),e={},t=e.lib={},n=t.Base={extend:function extend(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),(t.init.prototype=t).$super=this,t},create:function create(){var e=this.extend();return e.init.apply(e,arguments),e},init:function init(){},mixIn:function mixIn(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function clone(){return this.init.prototype.extend(this)}},l=t.WordArray=n.extend({init:function init(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function toString(e){return(e||s).stringify(this)},concat:function concat(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var s=r[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(o=0;o<i;o+=4)t[n+o>>>2]=r[o>>>2];return this.sigBytes+=i,this},clamp:function clamp(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=u.ceil(t/4)},clone:function clone(){var e=n.clone.call(this);return e.words=this.words.slice(0),e},random:function random(e){for(var t=[],r=function i(e){var t=987654321,r=4294967295;return function(){return((((t=36969*(65535&t)+(t>>16)&r)<<16)+(e=18e3*(65535&e)+(e>>16)&r)&r)/4294967296+.5)*(.5<u.random()?1:-1)}},n=0;n<e;n+=4){var i=r(4294967296*(o||u.random())),o=987654071*i();t.push(4294967296*i()|0)}return new l.init(t,e)}}),o=e.enc={},s=o.Hex={stringify:function stringify(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function parse(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new l.init(r,t/2)}},a=o.Latin1={stringify:function stringify(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function parse(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new l.init(r,t)}},c=o.Utf8={stringify:function stringify(e){try{return decodeURIComponent(escape(a.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function parse(e){return a.parse(unescape(encodeURIComponent(e)))}},f=t.BufferedBlockAlgorithm=n.extend({reset:function reset(){this._data=new l.init,this._nDataBytes=0},_append:function _append(e){"string"==typeof e&&(e=c.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function _process(e){var t=this._data,r=t.words,n=t.sigBytes,i=this.blockSize,o=n/(4*i),s=(e?u.ceil(o):u.max((0|o)-this._minBufferSize,0))*i,e=u.min(4*s,n);if(s){for(var a=0;a<s;a+=i)this._doProcessBlock(r,a);var c=r.splice(0,s);t.sigBytes-=e}return new l.init(c,e)},clone:function clone(){var e=n.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),p=(t.Hasher=f.extend({cfg:n.extend(),init:function init(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function reset(){f.reset.call(this),this._doReset()},update:function update(e){return this._append(e),this._process(),this},finalize:function finalize(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function _createHelper(r){return function(e,t){return new r.init(t).finalize(e)}},_createHmacHelper:function _createHmacHelper(r){return function(e,t){return new p.HMAC.init(r,t).finalize(e)}}}),e.algo={});return e}(Math)}),n=t(function(e,t){var c;e.exports=(c=r,function(i){var e=c,r=e.lib,o=r.WordArray,s=r.Hasher,r=e.algo,a=[],h=[],y=(!function(){function n(e){return 4294967296*(e-(0|e))|0}for(var e=2,t=0;t<64;)!function t(e){for(var r=i.sqrt(e),n=2;n<=r;n++)if(!(e%n))return;return 1}(e)||(t<8&&(a[t]=n(i.pow(e,.5))),h[t]=n(i.pow(e,1/3)),t++),e++}(),[]),r=r.SHA256=s.extend({_doReset:function _doReset(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function _doProcessBlock(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],c=r[5],u=r[6],l=r[7],f=0;f<64;f++){y[f]=f<16?0|e[t+f]:(((p=y[f-15])<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+y[f-7]+(((p=y[f-2])<<15|p>>>17)^(p<<13|p>>>19)^p>>>10)+y[f-16];var p=n&i^n&o^i&o,d=l+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&c^~a&u)+h[f]+y[f],l=u,u=c,c=a,a=s+d|0,s=o,o=i,i=n,n=d+(((n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22))+p)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+l|0},_doFinalize:function _doFinalize(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(64+n>>>9<<4)]=i.floor(r/4294967296),t[15+(64+n>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function clone(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA256=s._createHelper(r),e.HmacSHA256=s._createHmacHelper(r)}(Math),c.SHA256)}),i=(t(function(e,t){var a;e.exports=(e=r.lib.Base,a=r.enc.Utf8,void(r.algo.HMAC=e.extend({init:function init(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=a.parse(t));var r=e.blockSize,n=4*r;(t=t.sigBytes>n?e.finalize(t):t).clamp();for(var e=this._oKey=t.clone(),t=this._iKey=t.clone(),i=e.words,o=t.words,s=0;s<r;s++)i[s]^=1549556828,o[s]^=909522486;e.sigBytes=t.sigBytes=n,this.reset()},reset:function reset(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function update(e){return this._hasher.update(e),this},finalize:function finalize(e){var t=this._hasher,e=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(e))}})))}),t(function(e,t){e.exports=r.HmacSHA256})),o=function hmac(e,t){return i(t,e)},s=function sha256(e){return n(e)},a=["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id"],u=function a(e){try{return encodeURIComponent(e).replace(/[^A-Za-z0-9_.~\-%]+/g,escape).replace(/[*]/g,function(e){return"%".concat(e.charCodeAt(0).toString(16).toUpperCase())})}catch(e){return""}},l=function c(r){return Object.keys(r).sort().map(function(e){var t=r[e];if(null!=t){e=u(e);if(e)return Array.isArray(t)?"".concat(e,"=").concat(t.map(u).sort().join("&".concat(e,"="))):"".concat(e,"=").concat(u(t))}}).filter(function(e){return e}).join("&")};return function(){function t(e,r,n){!function(e){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.request=e,this.request.headers=e.headers||{},this.serviceName=r,this.signatureCache="boolean"!=typeof(n=n||{}).signatureCache||n.signatureCache,this.operation=n.operation,this.signatureVersion=n.signatureVersion,this.constant=n.isVolcengine?{algorithm:"HMAC-SHA256",v4Identifier:"request",dateHeader:"X-Date",tokenHeader:"x-security-token",contentSha256Header:"X-Content-Sha256",kDatePrefix:""}:{algorithm:"AWS4-HMAC-SHA256",v4Identifier:"aws4_request",dateHeader:"X-Amz-Date",tokenHeader:"x-amz-security-token",contentSha256Header:"X-Amz-Content-Sha256",kDatePrefix:"AWS4"},this.bodySha256=n.bodySha256,this.shouldSerializeBody="boolean"!=typeof n.shouldSerializeBody||n.shouldSerializeBody}var r=t;return e(r.prototype,[{key:"addAuthorization",value:function value(e,t){t=this.iso8601(t).replace(/[:\-]|\.\d{3}/g,"");this.addHeaders(e,t),this.request.headers.Authorization=this.authorization(e,t)}},{key:"addHeaders",value:function value(e,t){this.request.headers[this.constant.dateHeader]=t,e.sessionToken&&(this.request.headers[this.constant.tokenHeader]=e.sessionToken),this.request.body&&("string"!=typeof(t=this.request.body)&&this.shouldSerializeBody&&(t=t instanceof URLSearchParams?t.toString():JSON.stringify(t)),this.request.headers[this.constant.contentSha256Header]=this.bodySha256||s(t).toString())}},{key:"authorization",value:function value(e,t){var r=[],n=this.credentialString(t);return r.push("".concat(this.constant.algorithm," Credential=").concat(e.accessKeyId,"/").concat(n)),r.push("SignedHeaders=".concat(this.signedHeaders())),r.push("Signature=".concat(this.signature(e,t))),r.join(", ")}},{key:"signature",value:function value(e,t){e=this.getSigningKey(e,t.substr(0,8),this.request.region,this.serviceName,this.signatureCache);return o(e,this.stringToSign(t),"hex")}},{key:"stringToSign",value:function value(e){var t=[];return t.push(this.constant.algorithm),t.push(e),t.push(this.credentialString(e)),t.push(this.hexEncodedHash(this.canonicalString())),t.join("\n")}},{key:"canonicalString",value:function value(){var e=[],t=this.request.pathname||"/";return e.push(this.request.method.toUpperCase()),e.push(t),e.push(l(this.request.params)||""),e.push("".concat(this.canonicalHeaders(),"\n")),e.push(this.signedHeaders()),e.push(this.hexEncodedBodyHash()),e.join("\n")}},{key:"canonicalHeaders",value:function value(){var r=this,t=[],n=(Object.keys(this.request.headers).forEach(function(e){t.push([e,r.request.headers[e]])}),t.sort(function(e,t){return e[0].toLowerCase()<t[0].toLowerCase()?-1:1}),[]);return t.forEach(function(e){var t=e[0].toLowerCase();if(r.isSignableHeader(t)){e=e[1];if(null==e||"function"!=typeof e.toString)throw new Error("Header ".concat(t," contains invalid value"));n.push("".concat(t,":").concat(r.canonicalHeaderValues(e.toString())))}}),n.join("\n")}},{key:"canonicalHeaderValues",value:function value(e){return e.replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")}},{key:"signedHeaders",value:function value(){var t=this,r=[];return Object.keys(this.request.headers).forEach(function(e){e=e.toLowerCase(),t.isSignableHeader(e)&&r.push(e)}),r.sort().join(";")}},{key:"credentialString",value:function value(e){return this.createScope(e.substr(0,8),this.request.region,this.serviceName)}},{key:"hexEncodedHash",value:function value(e){return s(e)}},{key:"hexEncodedBodyHash",value:function value(){return this.request.headers[this.constant.contentSha256Header]||(this.request.body?this.hexEncodedHash(l(this.request.body)):this.hexEncodedHash(""))}},{key:"isSignableHeader",value:function value(e){return 0===e.toLowerCase().indexOf("x-amz-")||a.indexOf(e)<0}},{key:"iso8601",value:function value(e){return(e=void 0===e?new Date:e).toISOString().replace(/\.\d{3}Z$/,"Z")}},{key:"getSigningKey",value:function value(e,t,r,n){e=o("".concat(this.constant.kDatePrefix).concat(e.secretAccessKey),t),t=o(e,r),e=o(t,n);return o(e,this.constant.v4Identifier)}},{key:"createScope",value:function value(e,t,r){return[e.substr(0,8),t,r,this.constant.v4Identifier].join("/")}}]),Object.defineProperty(r,"prototype",{writable:!1}),t}()})},452:function(e,t,r){e.exports=function(o){return function(){var e=o;var t=e.lib;var r=t.BlockCipher;var n=e.algo;var l=[];var u=[];var f=[];var p=[];var d=[];var h=[];var y=[];var _=[];var g=[];var v=[];(function(){var e=[];for(var t=0;t<256;t++)if(t<128)e[t]=t<<1;else e[t]=t<<1^283;var r=0;var n=0;for(var t=0;t<256;t++){var i=n^n<<1^n<<2^n<<3^n<<4;i=i>>>8^i&255^99;l[r]=i;u[i]=r;var o=e[r];var s=e[o];var a=e[s];var c=e[i]*257^i*16843008;f[r]=c<<24|c>>>8;p[r]=c<<16|c>>>16;d[r]=c<<8|c>>>24;h[r]=c;var c=a*16843009^s*65537^o*257^r*16843008;y[i]=c<<24|c>>>8;_[i]=c<<16|c>>>16;g[i]=c<<8|c>>>24;v[i]=c;if(!r)r=n=1;else{r=o^e[e[e[a^o]]];n^=e[e[n]]}}})();var m=[0,1,2,4,8,16,32,64,128,27,54];var i=n.AES=r.extend({_doReset:function(){var e;if(this._nRounds&&this._keyPriorReset===this._key)return;var t=this._keyPriorReset=this._key;var r=t.words;var n=t.sigBytes/4;var i=this._nRounds=n+6;var o=(i+1)*4;var s=this._keySchedule=[];for(var a=0;a<o;a++)if(a<n)s[a]=r[a];else{e=s[a-1];if(!(a%n)){e=e<<8|e>>>24;e=l[e>>>24]<<24|l[e>>>16&255]<<16|l[e>>>8&255]<<8|l[e&255];e^=m[a/n|0]<<24}else if(n>6&&a%n==4)e=l[e>>>24]<<24|l[e>>>16&255]<<16|l[e>>>8&255]<<8|l[e&255];s[a]=s[a-n]^e}var c=this._invKeySchedule=[];for(var u=0;u<o;u++){var a=o-u;if(u%4)var e=s[a];else var e=s[a-4];if(u<4||a<=4)c[u]=e;else c[u]=y[l[e>>>24]]^_[l[e>>>16&255]]^g[l[e>>>8&255]]^v[l[e&255]]}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,f,p,d,h,l)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3];e[t+3]=r;this._doCryptBlock(e,t,this._invKeySchedule,y,_,g,v,u);var r=e[t+1];e[t+1]=e[t+3];e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,o,s,a){var c=this._nRounds;var u=e[t]^r[0];var l=e[t+1]^r[1];var f=e[t+2]^r[2];var p=e[t+3]^r[3];var d=4;for(var h=1;h<c;h++){var y=n[u>>>24]^i[l>>>16&255]^o[f>>>8&255]^s[p&255]^r[d++];var _=n[l>>>24]^i[f>>>16&255]^o[p>>>8&255]^s[u&255]^r[d++];var g=n[f>>>24]^i[p>>>16&255]^o[u>>>8&255]^s[l&255]^r[d++];var v=n[p>>>24]^i[u>>>16&255]^o[l>>>8&255]^s[f&255]^r[d++];u=y;l=_;f=g;p=v}var y=(a[u>>>24]<<24|a[l>>>16&255]<<16|a[f>>>8&255]<<8|a[p&255])^r[d++];var _=(a[l>>>24]<<24|a[f>>>16&255]<<16|a[p>>>8&255]<<8|a[u&255])^r[d++];var g=(a[f>>>24]<<24|a[p>>>16&255]<<16|a[u>>>8&255]<<8|a[l&255])^r[d++];var v=(a[p>>>24]<<24|a[u>>>16&255]<<16|a[l>>>8&255]<<8|a[f&255])^r[d++];e[t]=y;e[t+1]=_;e[t+2]=g;e[t+3]=v},keySize:256/32});e.AES=r._createHelper(i)}(),o.AES}(r(249),(r(269),r(214),r(888),r(109)))},109:function(e,t,r){e.exports=function(C){C.lib.Cipher||function(s){var e=C;var t=e.lib;var r=t.Base;var c=t.WordArray;var n=t.BufferedBlockAlgorithm;var i=e.enc;var o=i.Utf8;var a=i.Base64;var u=e.algo;var l=u.EvpKDF;var f=t.Cipher=n.extend({cfg:r.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r);this._xformMode=e;this._key=t;this.reset()},reset:function(){n.reset.call(this);this._doReset()},process:function(e){this._append(e);return this._process()},finalize:function(e){if(e)this._append(e);var t=this._doFinalize();return t},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function selectCipherStrategy(e){if(typeof e=="string")return O;else return x}return function(n){return{encrypt:function(e,t,r){return selectCipherStrategy(t).encrypt(n,e,t,r)},decrypt:function(e,t,r){return selectCipherStrategy(t).decrypt(n,e,t,r)}}}}()});var p=t.StreamCipher=f.extend({_doFinalize:function(){var e=this._process(!!"flush");return e},blockSize:1});var d=e.mode={};var h=t.BlockCipherMode=r.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e;this._iv=t}});var y=d.CBC=function(){var e=h.extend();e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher;var n=r.blockSize;xorBlock.call(this,e,t,n);r.encryptBlock(e,t);this._prevBlock=e.slice(t,t+n)}});e.Decryptor=e.extend({processBlock:function(e,t){var r=this._cipher;var n=r.blockSize;var i=e.slice(t,t+n);r.decryptBlock(e,t);xorBlock.call(this,e,t,n);this._prevBlock=i}});function xorBlock(e,t,r){var n;var i=this._iv;if(i){n=i;this._iv=s}else n=this._prevBlock;for(var o=0;o<r;o++)e[t+o]^=n[o]}return e}();var _=e.pad={};var g=_.Pkcs7={pad:function(e,t){var r=t*4;var n=r-e.sigBytes%r;var i=n<<24|n<<16|n<<8|n;var o=[];for(var s=0;s<n;s+=4)o.push(i);var a=c.create(o,n);e.concat(a)},unpad:function(e){var t=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=t}};var v=t.BlockCipher=f.extend({cfg:f.cfg.extend({mode:y,padding:g}),reset:function(){var e;f.reset.call(this);var t=this.cfg;var r=t.iv;var n=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)e=n.createEncryptor;else{e=n.createDecryptor;this._minBufferSize=1}if(this._mode&&this._mode.__creator==e)this._mode.init(this,r&&r.words);else{this._mode=e.call(n,this,r&&r.words);this._mode.__creator=e}},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e;var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);e=this._process(!!"flush")}else{e=this._process(!!"flush");t.unpad(e)}return e},blockSize:128/32});var m=t.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}});var b=e.format={};var w=b.OpenSSL={stringify:function(e){var t;var r=e.ciphertext;var n=e.salt;if(n)t=c.create([1398893684,1701076831]).concat(n).concat(r);else t=r;return t.toString(a)},parse:function(e){var t;var r=a.parse(e);var n=r.words;if(n[0]==1398893684&&n[1]==1701076831){t=c.create(n.slice(2,4));n.splice(0,4);r.sigBytes-=16}return m.create({ciphertext:r,salt:t})}};var x=t.SerializableCipher=r.extend({cfg:r.extend({format:w}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n);var o=i.finalize(t);var s=i.cfg;return m.create({ciphertext:o,key:r,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){n=this.cfg.extend(n);t=this._parse(t,n.format);var i=e.createDecryptor(r,n).finalize(t.ciphertext);return i},_parse:function(e,t){if(typeof e=="string")return t.parse(e,this);else return e}});var k=e.kdf={};var S=k.OpenSSL={execute:function(e,t,r,n){if(!n)n=c.random(64/8);var i=l.create({keySize:t+r}).compute(e,n);var o=c.create(i.words.slice(t),r*4);i.sigBytes=t*4;return m.create({key:i,iv:o,salt:n})}};var O=t.PasswordBasedCipher=x.extend({cfg:x.cfg.extend({kdf:S}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=n.kdf.execute(r,e.keySize,e.ivSize);n.iv=i.iv;var o=x.encrypt.call(this,e,t,i.key,n);o.mixIn(i);return o},decrypt:function(e,t,r,n){n=this.cfg.extend(n);t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt);n.iv=i.iv;var o=x.decrypt.call(this,e,t,i.key,n);return o}})}()}(r(249),r(888))},249:function(e,t,_){e.exports=function(){var e=e||function(f,r){var e;if(typeof window!=="undefined"&&window.crypto)e=window.crypto;if(typeof self!=="undefined"&&self.crypto)e=self.crypto;if(typeof globalThis!=="undefined"&&globalThis.crypto)e=globalThis.crypto;if(!e&&typeof window!=="undefined"&&window.msCrypto)e=window.msCrypto;if(!e&&typeof global!=="undefined"&&global.crypto)e=global.crypto;if(!e&&"function"==="function")try{e=_(480)}catch(e){}var n=function(){if(e){if(typeof e.getRandomValues==="function")try{return e.getRandomValues(new Uint32Array(1))[0]}catch(e){}if(typeof e.randomBytes==="function")try{return e.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")};var i=Object.create||function(){function F(){}return function(e){var t;F.prototype=e;t=new F;F.prototype=null;return t}}();var t={};var o=t.lib={};var s=o.Base=function(){return{extend:function(e){var t=i(this);if(e)t.mixIn(e);if(!t.hasOwnProperty("init")||this.init===t.init)t.init=function(){t.$super.init.apply(this,arguments)};t.init.prototype=t;t.$super=this;return t},create:function(){var e=this.extend();e.init.apply(e,arguments);return e},init:function(){},mixIn:function(e){for(var t in e)if(e.hasOwnProperty(t))this[t]=e[t];if(e.hasOwnProperty("toString"))this.toString=e.toString},clone:function(){return this.init.prototype.extend(this)}}}();var p=o.WordArray=s.extend({init:function(e,t){e=this.words=e||[];if(t!=r)this.sigBytes=t;else this.sigBytes=e.length*4},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words;var r=e.words;var n=this.sigBytes;var i=e.sigBytes;this.clamp();if(n%4)for(var o=0;o<i;o++){var s=r[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(var a=0;a<i;a+=4)t[n+a>>>2]=r[a>>>2];this.sigBytes+=i;return this},clamp:function(){var e=this.words;var t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8;e.length=f.ceil(t/4)},clone:function(){var e=s.clone.call(this);e.words=this.words.slice(0);return e},random:function(e){var t=[];for(var r=0;r<e;r+=4)t.push(n());return new p.init(t,e)}});var a=t.enc={};var c=a.Hex={stringify:function(e){var t=e.words;var r=e.sigBytes;var n=[];for(var i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16));n.push((o&15).toString(16))}return n.join("")},parse:function(e){var t=e.length;var r=[];for(var n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new p.init(r,t/2)}};var u=a.Latin1={stringify:function(e){var t=e.words;var r=e.sigBytes;var n=[];for(var i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){var t=e.length;var r=[];for(var n=0;n<t;n++)r[n>>>2]|=(e.charCodeAt(n)&255)<<24-n%4*8;return new p.init(r,t)}};var l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}};var d=o.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new p.init;this._nDataBytes=0},_append:function(e){if(typeof e=="string")e=l.parse(e);this._data.concat(e);this._nDataBytes+=e.sigBytes},_process:function(e){var t;var r=this._data;var n=r.words;var i=r.sigBytes;var o=this.blockSize;var s=o*4;var a=i/s;if(e)a=f.ceil(a);else a=f.max((a|0)-this._minBufferSize,0);var c=a*o;var u=f.min(c*4,i);if(c){for(var l=0;l<c;l+=o)this._doProcessBlock(n,l);t=n.splice(0,c);r.sigBytes-=u}return new p.init(t,u)},clone:function(){var e=s.clone.call(this);e._data=this._data.clone();return e},_minBufferSize:0});var h=o.Hasher=d.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e);this.reset()},reset:function(){d.reset.call(this);this._doReset()},update:function(e){this._append(e);this._process();return this},finalize:function(e){if(e)this._append(e);var t=this._doFinalize();return t},blockSize:512/32,_createHelper:function(r){return function(e,t){return new r.init(t).finalize(e)}},_createHmacHelper:function(r){return function(e,t){return new y.HMAC.init(r,t).finalize(e)}}});var y=t.algo={};return t}(Math);return e}()},269:function(e,t,r){e.exports=function(i){return function(){var e=i;var t=e.lib;var u=t.WordArray;var r=e.enc;var n=r.Base64={stringify:function(e){var t=e.words;var r=e.sigBytes;var n=this._map;e.clamp();var i=[];for(var o=0;o<r;o+=3){var s=t[o>>>2]>>>24-o%4*8&255;var a=t[o+1>>>2]>>>24-(o+1)%4*8&255;var c=t[o+2>>>2]>>>24-(o+2)%4*8&255;var u=s<<16|a<<8|c;for(var l=0;l<4&&o+l*.75<r;l++)i.push(n.charAt(u>>>6*(3-l)&63))}var f=n.charAt(64);if(f)while(i.length%4)i.push(f);return i.join("")},parse:function(e){var t=e.length;var r=this._map;var n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var i=0;i<r.length;i++)n[r.charCodeAt(i)]=i}var o=r.charAt(64);if(o){var s=e.indexOf(o);if(s!==-1)t=s}return parseLoop(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function parseLoop(e,t,r){var n=[];var i=0;for(var o=0;o<t;o++)if(o%4){var s=r[e.charCodeAt(o-1)]<<o%4*2;var a=r[e.charCodeAt(o)]>>>6-o%4*2;var c=s|a;n[i>>>2]|=c<<24-i%4*8;i++}return u.create(n,i)}}(),i.enc.Base64}(r(249))},743:function(e,t,r){e.exports=function(e){return e.enc.Utf8}(r(249))},888:function(e,t,r){e.exports=function(s){return function(){var e=s;var t=e.lib;var r=t.Base;var l=t.WordArray;var n=e.algo;var i=n.MD5;var o=n.EvpKDF=r.extend({cfg:r.extend({keySize:128/32,hasher:i,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){var r;var n=this.cfg;var i=n.hasher.create();var o=l.create();var s=o.words;var a=n.keySize;var c=n.iterations;while(s.length<a){if(r)i.update(r);r=i.update(e).finalize(t);i.reset();for(var u=1;u<c;u++){r=i.finalize(r);i.reset()}o.concat(r)}o.sigBytes=a*4;return o}});e.EvpKDF=function(e,t,r){return o.create(r).compute(e,t)}}(),s.EvpKDF}(r(249),(r(783),r(824)))},10:function(e,t,r){e.exports=function(e){return e.HmacSHA256}(r(249),(r(153),r(824)))},824:function(e,t,r){e.exports=function(s){(function(){var e=s;var t=e.lib;var r=t.Base;var n=e.enc;var u=n.Utf8;var i=e.algo;var o=i.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init;if(typeof t=="string")t=u.parse(t);var r=e.blockSize;var n=r*4;if(t.sigBytes>n)t=e.finalize(t);t.clamp();var i=this._oKey=t.clone();var o=this._iKey=t.clone();var s=i.words;var a=o.words;for(var c=0;c<r;c++){s[c]^=1549556828;a[c]^=909522486}i.sigBytes=o.sigBytes=n;this.reset()},reset:function(){var e=this._hasher;e.reset();e.update(this._iKey)},update:function(e){this._hasher.update(e);return this},finalize:function(e){var t=this._hasher;var r=t.finalize(e);t.reset();var n=t.finalize(this._oKey.clone().concat(r));return n}})})()}(r(249))},433:function(e,t,r){e.exports=function(o){return function(){if(typeof ArrayBuffer!="function")return;var e=o;var t=e.lib;var r=t.WordArray;var i=r.init;var n=r.init=function(e){if(e instanceof ArrayBuffer)e=new Uint8Array(e);if(e instanceof Int8Array||typeof Uint8ClampedArray!=="undefined"&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(e instanceof Uint8Array){var t=e.byteLength;var r=[];for(var n=0;n<t;n++)r[n>>>2]|=e[n]<<24-n%4*8;i.call(this,r,t)}else i.apply(this,arguments)};n.prototype=r}(),o.lib.WordArray}(r(249))},214:function(e,t,r){e.exports=function(s){return function(l){var e=s;var t=e.lib;var r=t.WordArray;var n=t.Hasher;var i=e.algo;var C=[];(function(){for(var e=0;e<64;e++)C[e]=l.abs(l.sin(e+1))*4294967296|0})();var o=i.MD5=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r;var i=e[n];e[n]=(i<<8|i>>>24)&16711935|(i<<24|i>>>8)&4278255360}var o=this._hash.words;var s=e[t+0];var a=e[t+1];var c=e[t+2];var u=e[t+3];var l=e[t+4];var f=e[t+5];var p=e[t+6];var d=e[t+7];var h=e[t+8];var y=e[t+9];var _=e[t+10];var g=e[t+11];var v=e[t+12];var m=e[t+13];var b=e[t+14];var w=e[t+15];var x=o[0];var k=o[1];var S=o[2];var O=o[3];x=FF(x,k,S,O,s,7,C[0]);O=FF(O,x,k,S,a,12,C[1]);S=FF(S,O,x,k,c,17,C[2]);k=FF(k,S,O,x,u,22,C[3]);x=FF(x,k,S,O,l,7,C[4]);O=FF(O,x,k,S,f,12,C[5]);S=FF(S,O,x,k,p,17,C[6]);k=FF(k,S,O,x,d,22,C[7]);x=FF(x,k,S,O,h,7,C[8]);O=FF(O,x,k,S,y,12,C[9]);S=FF(S,O,x,k,_,17,C[10]);k=FF(k,S,O,x,g,22,C[11]);x=FF(x,k,S,O,v,7,C[12]);O=FF(O,x,k,S,m,12,C[13]);S=FF(S,O,x,k,b,17,C[14]);k=FF(k,S,O,x,w,22,C[15]);x=GG(x,k,S,O,a,5,C[16]);O=GG(O,x,k,S,p,9,C[17]);S=GG(S,O,x,k,g,14,C[18]);k=GG(k,S,O,x,s,20,C[19]);x=GG(x,k,S,O,f,5,C[20]);O=GG(O,x,k,S,_,9,C[21]);S=GG(S,O,x,k,w,14,C[22]);k=GG(k,S,O,x,l,20,C[23]);x=GG(x,k,S,O,y,5,C[24]);O=GG(O,x,k,S,b,9,C[25]);S=GG(S,O,x,k,u,14,C[26]);k=GG(k,S,O,x,h,20,C[27]);x=GG(x,k,S,O,m,5,C[28]);O=GG(O,x,k,S,c,9,C[29]);S=GG(S,O,x,k,d,14,C[30]);k=GG(k,S,O,x,v,20,C[31]);x=HH(x,k,S,O,f,4,C[32]);O=HH(O,x,k,S,h,11,C[33]);S=HH(S,O,x,k,g,16,C[34]);k=HH(k,S,O,x,b,23,C[35]);x=HH(x,k,S,O,a,4,C[36]);O=HH(O,x,k,S,l,11,C[37]);S=HH(S,O,x,k,d,16,C[38]);k=HH(k,S,O,x,_,23,C[39]);x=HH(x,k,S,O,m,4,C[40]);O=HH(O,x,k,S,s,11,C[41]);S=HH(S,O,x,k,u,16,C[42]);k=HH(k,S,O,x,p,23,C[43]);x=HH(x,k,S,O,y,4,C[44]);O=HH(O,x,k,S,v,11,C[45]);S=HH(S,O,x,k,w,16,C[46]);k=HH(k,S,O,x,c,23,C[47]);x=II(x,k,S,O,s,6,C[48]);O=II(O,x,k,S,d,10,C[49]);S=II(S,O,x,k,b,15,C[50]);k=II(k,S,O,x,f,21,C[51]);x=II(x,k,S,O,v,6,C[52]);O=II(O,x,k,S,u,10,C[53]);S=II(S,O,x,k,_,15,C[54]);k=II(k,S,O,x,a,21,C[55]);x=II(x,k,S,O,h,6,C[56]);O=II(O,x,k,S,w,10,C[57]);S=II(S,O,x,k,p,15,C[58]);k=II(k,S,O,x,m,21,C[59]);x=II(x,k,S,O,l,6,C[60]);O=II(O,x,k,S,g,10,C[61]);S=II(S,O,x,k,c,15,C[62]);k=II(k,S,O,x,y,21,C[63]);o[0]=o[0]+x|0;o[1]=o[1]+k|0;o[2]=o[2]+S|0;o[3]=o[3]+O|0},_doFinalize:function(){var e=this._data;var t=e.words;var r=this._nDataBytes*8;var n=e.sigBytes*8;t[n>>>5]|=128<<24-n%32;var i=l.floor(r/4294967296);var o=r;t[(n+64>>>9<<4)+15]=(i<<8|i>>>24)&16711935|(i<<24|i>>>8)&4278255360;t[(n+64>>>9<<4)+14]=(o<<8|o>>>24)&16711935|(o<<24|o>>>8)&4278255360;e.sigBytes=(t.length+1)*4;this._process();var s=this._hash;var a=s.words;for(var c=0;c<4;c++){var u=a[c];a[c]=(u<<8|u>>>24)&16711935|(u<<24|u>>>8)&4278255360}return s},clone:function(){var e=n.clone.call(this);e._hash=this._hash.clone();return e}});function FF(e,t,r,n,i,o,s){var a=e+(t&r|~t&n)+i+s;return(a<<o|a>>>32-o)+t}function GG(e,t,r,n,i,o,s){var a=e+(t&n|r&~n)+i+s;return(a<<o|a>>>32-o)+t}function HH(e,t,r,n,i,o,s){var a=e+(t^r^n)+i+s;return(a<<o|a>>>32-o)+t}function II(e,t,r,n,i,o,s){var a=e+(r^(t|~n))+i+s;return(a<<o|a>>>32-o)+t}e.MD5=n._createHelper(o);e.HmacMD5=n._createHmacHelper(o)}(Math),s.MD5}(r(249))},568:function(e,t,r){e.exports=function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher;var n=r.blockSize;generateKeystreamAndEncrypt.call(this,e,t,n,r);this._prevBlock=e.slice(t,t+n)}});e.Decryptor=e.extend({processBlock:function(e,t){var r=this._cipher;var n=r.blockSize;var i=e.slice(t,t+n);generateKeystreamAndEncrypt.call(this,e,t,n,r);this._prevBlock=i}});function generateKeystreamAndEncrypt(e,t,r,n){var i;var o=this._iv;if(o){i=o.slice(0);this._iv=undefined}else i=this._prevBlock;n.encryptBlock(i,0);for(var s=0;s<r;s++)e[t+s]^=i[s]}return e}(),t.mode.CFB}(r(249),r(109))},991:function(e,t,r){e.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(r(249),r(109))},783:function(e,t,r){e.exports=function(s){return function(){var e=s;var t=e.lib;var r=t.WordArray;var n=t.Hasher;var i=e.algo;var f=[];var o=i.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){var r=this._hash.words;var n=r[0];var i=r[1];var o=r[2];var s=r[3];var a=r[4];for(var c=0;c<80;c++){if(c<16)f[c]=e[t+c]|0;else{var u=f[c-3]^f[c-8]^f[c-14]^f[c-16];f[c]=u<<1|u>>>31}var l=(n<<5|n>>>27)+a+f[c];if(c<20)l+=(i&o|~i&s)+1518500249;else if(c<40)l+=(i^o^s)+1859775393;else if(c<60)l+=(i&o|i&s|o&s)-1894007588;else l+=(i^o^s)-899497514;a=s;s=o;o=i<<30|i>>>2;i=n;n=l}r[0]=r[0]+n|0;r[1]=r[1]+i|0;r[2]=r[2]+o|0;r[3]=r[3]+s|0;r[4]=r[4]+a|0},_doFinalize:function(){var e=this._data;var t=e.words;var r=this._nDataBytes*8;var n=e.sigBytes*8;t[n>>>5]|=128<<24-n%32;t[(n+64>>>9<<4)+14]=Math.floor(r/4294967296);t[(n+64>>>9<<4)+15]=r;e.sigBytes=t.length*4;this._process();return this._hash},clone:function(){var e=n.clone.call(this);e._hash=this._hash.clone();return e}});e.SHA1=n._createHelper(o);e.HmacSHA1=n._createHmacHelper(o)}(),s.SHA1}(r(249))},153:function(e,t,r){e.exports=function(c){return function(i){var e=c;var t=e.lib;var r=t.WordArray;var n=t.Hasher;var o=e.algo;var s=[];var x=[];(function(){function isPrime(e){var t=i.sqrt(e);for(var r=2;r<=t;r++)if(!(e%r))return false;return true}function getFractionalBits(e){return(e-(e|0))*4294967296|0}var e=2;var t=0;while(t<64){if(isPrime(e)){if(t<8)s[t]=getFractionalBits(i.pow(e,1/2));x[t]=getFractionalBits(i.pow(e,1/3));t++}e++}})();var k=[];var a=o.SHA256=n.extend({_doReset:function(){this._hash=new r.init(s.slice(0))},_doProcessBlock:function(e,t){var r=this._hash.words;var n=r[0];var i=r[1];var o=r[2];var s=r[3];var a=r[4];var c=r[5];var u=r[6];var l=r[7];for(var f=0;f<64;f++){if(f<16)k[f]=e[t+f]|0;else{var p=k[f-15];var d=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3;var h=k[f-2];var y=(h<<15|h>>>17)^(h<<13|h>>>19)^h>>>10;k[f]=d+k[f-7]+y+k[f-16]}var _=a&c^~a&u;var g=n&i^n&o^i&o;var v=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22);var m=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25);var b=l+m+_+x[f]+k[f];var w=v+g;l=u;u=c;c=a;a=s+b|0;s=o;o=i;i=n;n=b+w|0}r[0]=r[0]+n|0;r[1]=r[1]+i|0;r[2]=r[2]+o|0;r[3]=r[3]+s|0;r[4]=r[4]+a|0;r[5]=r[5]+c|0;r[6]=r[6]+u|0;r[7]=r[7]+l|0},_doFinalize:function(){var e=this._data;var t=e.words;var r=this._nDataBytes*8;var n=e.sigBytes*8;t[n>>>5]|=128<<24-n%32;t[(n+64>>>9<<4)+14]=i.floor(r/4294967296);t[(n+64>>>9<<4)+15]=r;e.sigBytes=t.length*4;this._process();return this._hash},clone:function(){var e=n.clone.call(this);e._hash=this._hash.clone();return e}});e.SHA256=n._createHelper(a);e.HmacSHA256=n._createHmacHelper(a)}(Math),c.SHA256}(r(249))},187:e=>{function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(e){return"function"==typeof e}function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}((e.exports=EventEmitter).EventEmitter=EventEmitter).prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(e){if(!function isNumber(e){return"number"==typeof e}(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},EventEmitter.prototype.emit=function(e){var t,r,n,i,o,s,a;if((this._events||(this._events={}),"error"===e)&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length))throw(a=arguments[1])instanceof Error?a:((s=new Error('Uncaught, unspecified "error" event. ('+a+")")).context=a,s);if(isUndefined(t=this._events[e]))return!1;if(isFunction(t))switch(arguments.length){case 1:t.call(this);break;case 2:t.call(this,arguments[1]);break;case 3:t.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),t.apply(this,n)}else if(isObject(t))for(n=Array.prototype.slice.call(arguments,1),r=(o=t.slice()).length,i=0;i<r;i++)o[i].apply(this,n);return!0},EventEmitter.prototype.on=EventEmitter.prototype.addListener=function(e,t){if(isFunction(t))return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,isFunction(t.listener)?t.listener:t),this._events[e]?isObject(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,isObject(this._events[e])&&!this._events[e].warned&&(t=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners)&&0<t&&this._events[e].length>t&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace)&&console.trace(),this;throw TypeError("listener must be a function")},EventEmitter.prototype.once=function(e,t){var r;if(isFunction(t))return r=!1,g.listener=t,this.on(e,g),this;throw TypeError("listener must be a function");function g(){this.removeListener(e,g),r||(r=!0,t.apply(this,arguments))}},EventEmitter.prototype.removeListener=function(e,t){var r,n,i,o;if(!isFunction(t))throw TypeError("listener must be a function");if(this._events&&this._events[e])if(i=(r=this._events[e]).length,n=-1,r===t||isFunction(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(isObject(r)){for(o=i;0<o--;)if(r[o]===t||r[o].listener&&r[o].listener===t){n=o;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},EventEmitter.prototype.removeAllListeners=function(e){var t,r;if(this._events)if(this._events.removeListener)if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);this.removeAllListeners("removeListener"),this._events={}}else{if(isFunction(r=this._events[e]))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);delete this._events[e]}else 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e];return this},EventEmitter.prototype.listeners=function(e){e=this._events&&this._events[e]?isFunction(this._events[e])?[this._events[e]]:this._events[e].slice():[];return e},EventEmitter.prototype.listenerCount=function(e){if(this._events){e=this._events[e];if(isFunction(e))return 1;if(e)return e.length}return 0},EventEmitter.listenerCount=function(e,t){return e.listenerCount(t)}},391:(e,t,r)=>{e.exports=function(){return r(855)('(()=>{function dec2hex(n){if(void 0!==n)return function toEight(n){return n.length<8?toEight(n="0".concat(n)):n}(Number(n).toString(16))}self.onmessage=function(n){var n=n.data,t=n[0],n=n[1],e=function crc32(n,t){for(var e=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],r=("undefined"!=typeof Int32Array&&(e=new Int32Array(e)),-1^~~t),o=(n=new Uint8Array(n)).length,i=0;i<o;i++)r=e[255&(r^n[i])]^r>>>8;return(-1^r)>>>0}(t,0);postMessage([t,dec2hex(e),n],[t])}})();',null)}},855:e=>{"use strict";var i=window.URL||window.webkitURL;e.exports=function(t,r){try{try{var n;try{(n=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)).append(t),n=n.getBlob()}catch(e){n=new Blob([t])}return new Worker(i.createObjectURL(n))}catch(e){return new Worker("data:application/javascript,"+encodeURIComponent(t))}}catch(e){if(r)return new Worker(r);throw Error("Inline worker is not supported")}}},480:()=>{}},n={};function __webpack_require__(e){var t=n[e];return void 0!==t||(t=n[e]={exports:{}},r[e].call(t.exports,t,t.exports,__webpack_require__)),t.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Le={};return(()=>{"use strict";__webpack_require__.d(Le,{default:()=>He});var r=__webpack_require__(187),s=__webpack_require__.n(r);const S={debug:!1,region:"cn-north-1",initUploadFileUrl:"{tosDomain}/{oid}?uploads",uploadChunkedUrl:"{tosDomain}/{oid}?partNumber={number}&uploadID={uploadId}",uploadMergeUrl:"{tosDomain}/{oid}?uploadID={uploadId}",getUploadListUrl:"{tosDomain}/{oid}?uploadID={uploadId}",directUploadFileUrl:"{tosDomain}/{oid}",external:{},getSliceFunc:null,uploadSliceCount:5,retryUploadTime:3,retryProcess:!0,retryProcessTime:3,retryTaskTime:3,maxProcessPause:20,schema:"https",useLocalStorage:!0,log:{external:{},appId:"",userId:"",video_id:"",upload_video_url:"",upload_id:"",type:"",stage:"",video_size:0,part_count:0,slice_index:0,extra:{},msg:""},replace:{}};function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=function e(){return(a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function t(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function i(){for(var e=[],r=0;r<arguments.length;r++)e=e.concat(t(arguments[r]));return e}function Ei(e,a){var t,r=function r(e){var t=document.createElement("a");return t.href=e,t},n=window.screen.width,i=window.screen.height,o=window.navigator.appVersion,s=window.navigator.userAgent,c=window.navigator.language,u=document.referrer,l=u?r(u).hostname:"",f=function(e){var e=(e=r(e).search).slice(1),n={};return e.split("&").forEach(function(e){var t,r,e=e.split("=");e.length&&(t=e[0],r=e[1]),r=r&&r.replace(/\%/g,"%25"),n[t]=decodeURIComponent(void 0===r?"":r)}),n}(window.location.href),p="",d="",h="",y=""+parseFloat(o);-1!==(g=s.indexOf("Opera"))&&(h="Opera",y=s.substring(g+6),-1!==(g=s.indexOf("Version")))&&(y=s.substring(g+8)),-1!==(g=s.indexOf("Edge"))?(h="Microsoft Edge",y=s.substring(g+5)):-1!==(g=s.indexOf("MSIE"))?(h="Microsoft Internet Explorer",y=s.substring(g+5)):-1!==s.indexOf("Chrome")?-1!==(g=s.indexOf("MicroMessenger"))?(h="weixin",y=s.substring(g+15,g+20)):-1!==(g=s.indexOf("MQQBrowser"))?(h="qqbrowser",y=s.substring(g+11,g+15)):-1!==(g=s.indexOf("Chrome"))&&(h="Chrome",y=s.substring(g+7)):-1!==s.indexOf("Safari")?-1!==(g=s.indexOf("QQ"))?(h="qqbrowser",y=s.substring(g+10,g+16)):-1!==(g=s.indexOf("Safari"))&&(h="Safari",y=s.substring(g+7),-1!==(g=s.indexOf("Version")))&&(y=s.substring(g+8)):-1!==(g=s.indexOf("Firefox"))?(h="Firefox",y=s.substring(g+8)):-1!==(g=s.indexOf("MicroMessenger"))?(h="weixin",y=s.substring(g+15,g+20)):-1!==(g=s.indexOf("QQ"))&&(h="qqbrowser",y=s.substring(g+3,g+8)),-1!==(t=(y=-1!==(t=(y=-1!==(t=y.indexOf(";"))?y.substring(0,t):y).indexOf(" "))?y.substring(0,t):y).indexOf(")"))&&(y=y.substring(0,t));for(var _,g=/Mobile|htc|mini|Android|iP(ad|od|hone)/.test(o)?"wap":"web",v=[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Android",r:/Android/},{s:"Sun OS",r:/SunOS/},{s:"Linux",r:/(Linux|X11)/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/}],m=0;m<v.length;m++){var b=v[m];if(b.r.test(s)){p=b.s;break}}function I(e,t){e=e.exec(t);return e&&e[1]?e[1]:""}switch(/Windows/.test(p)&&(d=I(/Windows (.*)/,p),p="windows"),p){case"Mac OS X":d=I(/Mac OS X (10[\.\_\d]+)/,s),p="mac";break;case"Android":d=I(/Android ([\.\_\d]+)/,_=s)||I(/Android\/([\.\_\d]+)/,_),p="android";break;case"iOS":d=(d=/OS (\d+)_(\d+)_?(\d+)?/.exec(o))?d[1]+"."+d[2]+"."+(0|d[3]):"",p="ios"}return e=e?function(){var e=a?"_tea_utm_cache_"+a:"_tea_utm_cache",t={},r={utm_source:f.utm_source,utm_medium:f.utm_medium,utm_campaign:f.utm_campaign,utm_term:f.utm_term,utm_content:f.utm_content};try{var n,i,o=window.sessionStorage,s=!1;for(n in r)r[n]&&(t[n]=r[n],s=!0);s?o.setItem(e,JSON.stringify(t)):(i=o.getItem(e))&&(t=JSON.parse(i))}catch(e){return r}return t}():{},{browser:h,browser_version:y,platform:g,os_name:p,os_version:d,userAgent:s,screen_width:n,screen_height:i,device_model:function(e){var t,r,n="";try{"android"===e?navigator.userAgent.split(";").forEach(function(e){-1<e.indexOf("Build/")&&(n=e.slice(0,e.indexOf("Build/")))}):"ios"!==e&&"mac"!==e||(r=(t=navigator.userAgent.replace("Mozilla/5.0 (","")).indexOf(";"),n=t.slice(0,r))}catch(e){}return n.trim()}(p),language:c,referrer:u,referrer_host:l,utm_source:e.utm_source,utm_medium:e.utm_medium,utm_campaign:e.utm_campaign,utm_term:e.utm_term,utm_content:e.utm_content,isSupportBeacon:("ios"!==p||"safari"!==h)&&(!(!window.navigator||!window.navigator.sendBeacon)||void 0)}}(function(e){e.exports=function i(){function e(){for(var e=0,t={};e<arguments.length;e++){var r,n=arguments[e];for(r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function i(u){function r(){}function o(t,n,i){if("undefined"!=typeof document){"number"==typeof(i=e({path:"/"},r.defaults,i)).expires&&(i.expires=new Date(+new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var o=JSON.stringify(n);/^[\{\[]/.test(o)&&(n=o)}catch(e){}n=u.write?u.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s,a="";for(s in i)i[s]&&(a+="; "+s,!0!==i[s])&&(a+="="+i[s].split(";")[0]);return document.cookie=t+"="+n+a}}function s(e,r){if("undefined"!=typeof document){for(var n={},i=document.cookie?document.cookie.split("; "):[],o=0;o<i.length;o++){var s=i[o].split("="),a=s.slice(1).join("=");r||'"'!==a.charAt(0)||(a=a.slice(1,-1));try{var c=t(s[0]),a=(u.read||u)(a,c)||t(a);if(r)try{a=JSON.parse(a)}catch(e){}if(n[c]=a,e===c)break}catch(e){}}return e?n[e]:n}}return r.set=o,r.get=function(e){return s(e,!1)},r.getJSON=function(e){return s(e,!0)},r.remove=function(t,r){o(t,"",e(r,{expires:-1}))},r.defaults={},r.withConverter=i,r}(function(){})}()})(r={exports:{}});var O=r.exports,C=function(){function e(){this.cache={}}return e.prototype.setItem=function(e,t){this.cache[e]=t},e.prototype.getItem=function(e){return this.cache[e]},e.prototype.removeItem=function(e){this.cache[e]=void 0},e}(),I={getItem:function getItem(e){try{var t=localStorage.getItem(e),r=t;try{t&&"string"==typeof t&&(r=JSON.parse(t))}catch(e){}return r||void 0}catch(e){}},setItem:function setItem(e,t){try{var r="string"==typeof t?t:JSON.stringify(t);localStorage.setItem(e,r)}catch(e){}},removeItem:function removeItem(e){try{localStorage.removeItem(e)}catch(e){}},getCookie:function getCookie(e){try{var t=document.cookie.match(new RegExp("(?:^|;)\\s*"+e+"=([^;]+)")),r=t?t[1]:"";return decodeURIComponent(r)}catch(e){return""}},setCookie:function setCookie(e,t,r){try{var n=+new Date+r;O.set(e,t,{expires:new Date(n),path:"/",domain:document.domain.split(".").slice(-2).join(".")})}catch(e){}},isSupportLS:function(){try{return localStorage.setItem("_ranger-test-key","hi"),localStorage.getItem("_ranger-test-key"),localStorage.removeItem("_ranger-test-key"),!0}catch(e){return!1}}()},U=function(){function e(e){this._storage=!e&&I.isSupportLS?I:new C}return e.prototype.getItem=function(e){return this._storage.getItem(e)},e.prototype.setItem=function(e,t){this._storage.setItem(e,t)},e.prototype.getCookie=function(e){return this._storage.getCookie(e)},e.prototype.setCookie=function(e,t,r){this._storage.setCookie(e,t,r)},e.prototype.removeItem=function(e){this._storage.removeItem(e)},e}(),j={cn:"https://mcs.snssdk.com",sg:"https://sgali-mcs.byteoversea.com",va:"https://maliva-mcs.byteoversea.com"},T="/v1/user/webid",f={NO_URL:4001,IMG_ON:4e3,IMG_CATCH:4002,BEACON_FALSE:4003,XHR_ON:500,RESPONSE:5001},E=function _(e,t){return t?"__tea_cache_tokens_"+e:"__tea_cache_events_"+e},F=function p(r,n,i,o){try{var e=r.match(/\/v\d\//),t=e?e[0]:-1!==r.indexOf("/v1/")?"/v1/":"/v2/",s=r.split(t)[0];s?n.forEach(function(e){var e=function(e){var t,r="";for(t in e)e.hasOwnProperty(t)&&void 0!==e[t]&&(r+="&"+t+"="+encodeURIComponent(JSON.stringify(e[t])));return"&"===r[0]?r.slice(1):r}(e),t=new Image(1,1);t.onload=function(){t=null,i&&i()},t.onerror=function(){t=null,o&&o(r,n,f.IMG_ON)},t.src=s+"/v1/gif?"+e}):o(r,n,f.NO_URL)}catch(i){o&&o(r,n,f.IMG_CATCH,i.message)}},B=function l(e,t,r,n,i,o,s,a){var c=window.navigator.userAgent,c=-1!==window.navigator.appName.indexOf("Microsoft Internet Explorer")&&(-1!==c.indexOf("MSIE 8.0")||-1!==c.indexOf("MSIE 9.0")),u=!!r;if(!u&&c)F(e,t,n,i);else if(!u&&s)return Ei(!1).isSupportBeacon?(a&&a(),void(window.navigator.sendBeacon(e,JSON.stringify(t))?n():i(e,t,f.BEACON_FALSE))):void F(e,t,n,i);o&&delete t.app_key,function(e,t,r,n,i){var o=new XMLHttpRequest;o.open("POST",""+e,!0),o.setRequestHeader("Content-Type","application/json; charset=utf-8"),i&&o.setRequestHeader("X-MCS-AppKey",""+i),o.onload=function(){if(r){var t=null;if(o.responseText){try{t=JSON.parse(o.responseText)}catch(e){t={}}r(t)}}},o.onerror=function(){o.abort(),n&&n(t,f.XHR_ON)},o.send(JSON.stringify(t))}(e,t,n,i,r)};function g(e){return e?(e^16*Math.random()>>e/4).toString(10):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,g)}var N,z=function v(){return g().replace(/-/g,"").slice(0,19)},H=function(){function e(e,t){this.browser=Ei(!0,e.app_id),this.config=e,this.cfg=t,this.storage=new U(!1),this.appInfo=e.app_key||e.app_id,this.isNoWebid=e.disable_webid,this.isNoSsid=e.disable_webid||e.disable_ssid,this.domain=e.channel_domain||j[e.channel],this.tokenReady=!1,this.checkExp=e.checkExp||!1,this.enableCookie=e.cross_subdomain||!1,this.expiresTime=this.enableCookie?94608e6:0,this.fetchUrl=this.domain+T}return e.prototype._getToken=function(){this.tokensKey=E(this.appInfo,!0),this.cookieKey="__tea_cookie_tokens_"+this.appInfo;var e,t,r,n,i=this.storage.getItem(this.tokensKey);this.enableCookie?(n=this.storage.getCookie(this.cookieKey))?(n=decodeURIComponent(n),e=(n=JSON.parse(n)).user_unique_id,t=n.web_id,r=n.timestamp,n=n.ssid,this._setToken(t,e,n,r)):i?(this.storage.setCookie(this.cookieKey,encodeURIComponent(JSON.stringify(i)),this.expiresTime),this._checkLocal(i)):this._requestWebId():i?this._checkLocal(i):this._requestWebId()},e.prototype._checkLocal=function(e){e.web_id||(t=this.storage.getCookie("tt_webid"),i=this.storage.getCookie("__tea_sdk__ssid"),r=this.storage.getCookie("__tea_sdk__user_unique_id"),t&&i&&r&&(e={web_id:t,ssid:i,user_unique_id:r,timestamp:Date.now()},this.storage.setItem(this.tokensKey,e)));var t,r,e=this.storage.getItem(this.tokensKey),n=(r=e.user_unique_id,t=e.web_id,e.timestamp),i=e.ssid;t&&r?this._setToken(t,r,i,n):this._requestWebId()},e.prototype._setToken=function(e,t,r,n){if(this.uuid=t,this.web_id=e,this.ssid=r,this.checkExp){n=Date.now()-parseFloat(n);if(7344e6<n)return void this._requestWebId();if(432e7<n)return void this._updateWebId(e)}this._complete(e,t,r)},e.prototype._complete=function(e,t,r){this.cfg.envInfo.user.ssid=r,this.cfg.envInfo.user.web_id=e,this.cfg.envInfo.user.user_unique_id=t,this.tokenReady=!0},e.prototype._requestWebId=function(){this.isNoWebid?this._setwebId({web_id:z(),ssid:""}):this._fetchWebId(this.fetchUrl,!1)},e.prototype._updateWebId=function(e){e=this.domain+T+"/"+e+"/update";this._fetchWebId(e,!0)},e.prototype._fetchWebId=function(e,r){var n=this;this.isGetWebId=!0,B(e,{app_key:this.config.app_key,app_id:this.config.app_id,url:location.href,user_agent:this.browser.userAgent,referer:this.browser.referrer,user_unique_id:""},this.config.app_key,function(e){var t;e&&0===e.e?(r?(t={web_id:n.web_id,ssid:n.ssid,user_unique_id:n.uuid,timestamp:Date.now()},n.enableCookie&&n.storage.setCookie(n.cookieKey,encodeURIComponent(JSON.stringify(t)),n.expiresTime),n.storage.setItem(n.tokensKey,t),n._complete(n.web_id,n.uuid,n.ssid)):(n.isGetWebId=!1,n._setwebId(e)),n.isGetSsid?n._requestSsId():n.callback&&n.callback()):r?n._fetchWebId(n.fetchUrl,!1):n.isGetWebId=!1},function(){n.isGetWebId=!1},!0)},e.prototype._setwebId=function(e){var t=this.cfg.envInfo.user.web_id||e.web_id,r={web_id:t,ssid:e.ssid,user_unique_id:this._uuid||t,timestamp:Date.now()};this.enableCookie&&this.storage.setCookie(this.cookieKey,encodeURIComponent(JSON.stringify(r)),this.expiresTime),this.storage.setItem(this.tokensKey,r),this.cfg.envInfo.user.ssid=e.ssid,this.cfg.envInfo.user.web_id=t,this.cfg.envInfo.user.user_unique_id=this._uuid||t,this.uuid=this._uuid||t,this.web_id=t,this.ssid=e.ssid,this.tokenReady=!0},e.prototype._getSsid=function(e){e&&-1===["0","Null","None","","undefined"].indexOf(e)&&(this.uuid===e&&this.web_id&&this.ssid?this.tokenReady=!0:(this._uuid=e,this.uuid=e,this.cfg.envInfo.user.user_unique_id=e,this.isGetSsid=!0,this.isNoSsid||this.isGetWebId?this.callback&&this.callback():(this.tokenReady=!1,this.isGetSsid=!1,this._requestSsId())))},e.prototype._requestSsId=function(){var t=this,e=this.domain+"/v1/user/ssid";B(e,{app_key:this.config.app_key,app_id:this.config.app_id,web_id:this.web_id,user_unique_id:this.uuid},this.config.app_key,function(e){e&&0===e.e&&(t.cfg.envInfo.user.ssid=e.ssid,e={web_id:t.web_id,ssid:e.ssid,user_unique_id:t.uuid,timestamp:Date.now()},t.enableCookie&&t.storage.setCookie(t.cookieKey,encodeURIComponent(JSON.stringify(e)),t.expiresTime),t.storage.setItem(t.tokensKey,e)),t.tokenReady=!0,t.callback&&t.callback()},function(){t.tokenReady=!0,t.callback&&t.callback()},!0)},e.prototype.isTokenReady=function(){return this.tokenReady},e}(),L=function(){function t(e,t,r,n){this.cfg=t,this.config=e,this._token=r,this.appInfo=e.app_key||e.app_id,this.debugMode=!!e.log,this.evtDataKey=E(this.appInfo,!1);t=e.channel_domain||j[e.channel];this.reportUrl=e.report_url||t+"/v1/list",this.maxReport=e.max_report||20,this.storage=new U(!0),this.plugin=n,this.addListener()}return t.prototype.addListener=function(){var e=this;window.addEventListener("unload",function(){e.report(!0)},!1),window.addEventListener("beforeunload",function(){e.report(!0)},!1),document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&e.report(!0)},!1)},t.prototype.setReady=function(){this.isReady=!0,this.report()},t.prototype.event=function(e,t){var r=this,n=(void 0===e&&(e=[]),void 0===t&&(t=!1),this.storage.getItem(this.evtDataKey)||[]),t=t?i(e,n):i(n,e);this.storage.setItem(this.evtDataKey,t),this.reportTimer&&clearTimeout(this.reportTimer),t.length>=this.maxReport?this.report():this.reportTimer=setTimeout(function(){r.report(),r.reportTimer=null},30)},t.prototype.report=function(e){var t;void 0===e&&(e=!1),this._token.isTokenReady()&&this.isReady&&(t=this.storage.getItem(this.evtDataKey)||[],t=this._mergeEvents(t),this.storage.removeItem(this.evtDataKey),this._dealData(t,e))},t.prototype._mergeEvents=function(e){var t,r,n=this;return e.length?((t=this.cfg.get()).header.custom=JSON.stringify(t.header.custom),(r=[]).push(e),r.map(function(e){return{events:e.map(function(e){var t=a({},n.cfg.get("evtParams"),e.params);return delete t.__disable_storage__,a({},e,{params:JSON.stringify(t)})}),user:t.user,header:t.header,verbose:n.debugMode?1:void 0}})):e},t.prototype._dealData=function(e,r){var n=this;if(!e.length)return e;e.map(function(e){var t=[];return t.push(e),t}).forEach(function(e){var t=z();n._send(t,e,r)})},t.prototype._send=function(e,t,n){var i=this,o=(this.isSending=!0,function r(){i.isSending=!1});B(this.reportUrl,t,this.config.app_key,function(){o()},function(e,t){o(),i.cfg.get("reportErrorCallback")(e,t)},!1,n,o)},t}(),n=void 0,r=(new Date).getTimezoneOffset(),K=parseInt(""+-r/60,10),q=60*r,W=function(){function t(e){e=Ei(!0,e);this.envInfo={user:{user_unique_id:n,user_type:n,user_id:n,user_is_auth:n,user_is_login:n,device_id:n,web_id:n,ip_addr_id:n,ssid:n},header:{app_id:n,app_name:n,app_install_id:n,install_id:n,app_package:n,app_channel:n,app_version:n,os_name:e.os_name,os_version:e.os_version,device_model:e.device_model,ab_client:n,ab_version:n,ab_sdk_version:n,traffic_type:n,client_ip:n,device_brand:n,os_api:n,access:n,language:e.language,region:n,app_language:n,app_region:n,creative_id:n,ad_id:n,campaign_id:n,log_type:n,rnd:n,platform:e.platform,sdk_version:"4.1.15",province:n,city:n,timezone:K,tz_offset:q,tz_name:n,sim_region:n,carrier:n,resolution:e.screen_width+"x"+e.screen_height,browser:e.browser,browser_version:e.browser_version,referrer:e.referrer,referrer_host:e.referrer_host,width:e.screen_width,height:e.screen_height,screen_width:e.screen_width,screen_height:e.screen_height,utm_term:e.utm_term,utm_content:e.utm_content,utm_source:e.utm_source,utm_medium:e.utm_medium,utm_campaign:e.utm_campaign,custom:{}}},this.evtParams={},this.reportErrorCallback=function(){}}return t.prototype.set=function(e,t){var r=this;if("disable_auto_pv"!==e)if("evtParams"===e||"_staging_flag"===e){var n="evtParams"===e?t:{_staging_flag:Number(t)},i=a({},n);Object.keys(i).forEach(function(e){r.evtParams[e]=i[e]})}else if("reportErrorCallback"===e&&"function"==typeof t)this.reportErrorCallback=t;else{var o,n="";if(-1<e.indexOf(".")&&(n=(o=e.split("."))[0],e=o[1]),"user_unique_id"===e){if(!t)return;if(-1!==["0","Null","None","","undefined"].indexOf(t))return}if("web_id"===(e="os_version"===e?""+t:e)){if(!t)return;(!this.envInfo.user.user_unique_id||this.envInfo.user.user_unique_id&&this.envInfo.user.user_unique_id===this.envInfo.user.web_id)&&(this.envInfo.user.user_unique_id=t)}n?"user"===n||"header"===n?this.envInfo[n][e]=t:this.envInfo.header.custom[e]=t:this.envInfo.user.hasOwnProperty(e)?-1<["user_type","device_id","ip_addr_id"].indexOf(e)?this.envInfo.user[e]=Number(t):-1<["user_id","web_id","user_unique_id","ssid"].indexOf(e)?this.envInfo.user[e]=String(t):-1<["user_is_auth","user_is_login"].indexOf(e)&&(this.envInfo.user[e]=Boolean(t)):this.envInfo.header.hasOwnProperty(e)?this.envInfo.header[e]=t:this.envInfo.header.custom[e]=t}},t.prototype.get=function(e){return e?"evtParams"===e?this.evtParams:"reportErrorCallback"===e?this.reportErrorCallback:JSON.parse(JSON.stringify(this.envInfo[e])):JSON.parse(JSON.stringify(this.envInfo))},t}(),Q=function(){function e(e,t){this.isLog=t,this.name=e||""}var t=e.prototype;return t.info=function(e){this.isLog&&console.log(this.name+" "+e)},t.warn=function(e){this.isLog&&console.warn(this.name+" "+e)},t.error=function(e){this.isLog&&console.error(this.name+" "+e)},t.throw=function(e){throw this.error(this.name),new Error(e)},e}(),J=i(["init","config","send","start"],[]),G=(N=+Date.now()+Number((""+Math.random()).slice(2,8)),function(){function i(e){var r=this;this.predefinePageView=function(e){void 0===e&&(e={});var t=a({title:document.title||location.pathname,url:location.href,url_path:location.pathname,time:Date.now(),referrer:window.document.referrer},r._event.closeStorage?{}:{__disable_storage__:1}),t=a({},t,e);r.event("predefine_pageview",t,!0)},this.name=e,this._isSend=!1,this.autoPV=!0}return i.prototype.init=function(e){var t=this;if(!this._inited){if(this._inited=!0,!e||"object"!=_typeof(e))throw new Error("init参数有误,请检查");var r=e.app_id,n=e.app_key,i=e.log;this._config=new W(r),this.logger=new Q(this.name,i),n||r||this.logger.throw("没有传入 app_key 或 app_id "),r&&"number"!=typeof r&&this.logger.throw("app_id参数有误,请检查 "),n&&"string"!=typeof n&&this.logger.warn("app_key为空,如果有请传入"),e.channel_domain||-1!==["cn","sg","va"].indexOf(e.channel)||this.logger.throw("channel 变量只能是 `cn`, `sg`,`va`"),this._config.set("app_id",r),e.channel=e.channel||"cn",this._initConfig=e,this._token=new H(e,this._config),this._token.callback=function(){t.callbackSend&&t.start()},this._event=new L(e,this._config,this._token,this.plugin),this._token._getToken()}},i.prototype.config=function(e){if(this._inited)if(e&&"object"==_typeof(e)){if(e.user_unique_id){if("string"!=typeof e.user_unique_id)throw new Error("user_unique_id 只能是string");this._token._getSsid(e.user_unique_id)}for(var t in e.disable_auto_pv&&(this.autoPV=!1),e)this._config.set(t,e[t])}else this.logger.warn("config参数有误,请检查");else this.logger.warn("config应在init之后调用")},i.prototype.send=function(){this.start()},i.prototype.start=function(){this._token.isTokenReady()?this._isSend||(this._isSend=!0,this.logger.info("用户信息:"+JSON.stringify(this._config.get("user"))),this.autoPV&&this.predefinePageView(),this._event.setReady()):this.callbackSend=!0},i.prototype.event=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n="boolean"==typeof e[e.length-1]&&e[e.length-1],i="boolean"==typeof e[e.length-1]?e.slice(0,e.length-1):e,o=t(i,1)[0],s=[];"Array"!==Object.prototype.toString.call(o).slice(8,-1)?s[0]=i:s=i,s=s.map(function(e){return function(e,t){var r=e,e=(/^event\./.test(e)&&(r=e.slice(6)),t);return(e="object"!=_typeof(e)?{}:e).event_index=N+=1,{event:r,params:e,local_time_ms:+new Date,is_bav:0}}(e[0],e[1])}),this._event.event(s,n)},i}());function R(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}var V=function M(e){var o=this;return R(this,"_exportCollect",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];o._isProcess?o._executeCmd.apply(o,t):(o.cmdQueue.push(t),o._processCmd())}),R(this,"_processCmd",function(){var e,r,n;0!==o.cmdQueue.length&&(e=o.cmdQueue,r=-1,e.forEach(function(e,t){"init"===e[0]&&(r=t)}),-1!==(n=r))&&(o._isProcess=!0,o._executeCmd.apply(o,o.cmdQueue[n]),o.cmdQueue.forEach(function(e,t){t!==n&&o._executeCmd.apply(o,e)}),o.cmdQueue=[])}),R(this,"_executeCmd",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n,i=t[0];-1<J.indexOf(i)?(n=o.colloctor)[i].apply(n,t.slice(1)):(i=o.colloctor).event.apply(i,t)}),this.cmdQueue=[],this.name=e,this.colloctor=new G(e),this._isProcess=!1,this._alias={},this._processCmd(),J.forEach(function(e){o._exportCollect[e]=o._exportCollect.bind(o,e)}),this._exportCollect},o={},c={},u=function P(e){return c[e]||(c[e]=[]),c[e]},X=function A(e){var e=t(e),r=e[0],e=e.slice(1),n=r.split(".");1===n.length?u("default").push(i([r],e)):2===n.length?"event"===n[0]?u("default").push(i([r],e)):u(n[0]).push(i([n[1]],e)):(r=n[0],n=[n[1],n[2]].join("."),u(r).push(i([n],e)))},Z=function D(){d.q.forEach(function(e){e=[].slice.call(e);"Array"===Object.prototype.toString.call(e[0]).slice(8,-1)?e.forEach(function(e){X(e)}):X(e)}),Object.keys(c).forEach(function(t){c[t].forEach(function(e){!function(e){return o[e]||(o[e]=new V(e)),o[e]}(t).apply(void 0,i(e))}),c[t]=[]}),d.q=[]},d=function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];e.q.push(t),Z()};d.q=[],d.l=Date.now(),d._instanceMap=o,d._instanceCmdMap=c,J.forEach(function(e){d[e]=d.bind(null,e)}),function(e){var t,r;"undefined"!=typeof window&&(t=function(){if("undefined"!=typeof window)return window.TeaAnalyticsObject}())&&window[t]&&((r=window[t]).init||(e.q=r.q||[],e.l=r.l||Date.now(),window[t]=e))}(d),Z();const $=d;var Y={browserError:1e3,crc32:1e3,preUpload:1001,initUploadID:1002,process:1003,fileMerge:1004,complete:1005},ee="video",h="image",y="object",te={video:"video_upload",image:"image_upload",object:"object_upload"},_=1,re=2,ne=3,m="vod",b="imagex",ie=2562,oe=2643,se={"cn-north-1":"cn-north-1","us-east-1":"us-east-1","ap-singapore-1":"ap-singapore-1",boe:"boe"},ae={"cn-north-1":"https://vod.volcengineapi.com","ap-singapore-1":"https://vod.byteplusapi.com"},ce={"cn-north-1":"https://imagex.volcengineapi.com","us-east-1":"https://imagex-us-east-1.volcengineapi.com","ap-singapore-1":"https://imagex-ap-singapore-1.volcengineapi.com"};function LoggerV5_typeof(e){return(LoggerV5_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _extends(){return(_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,function _toPropertyKey(e){e=function _toPrimitive(e,t){if("object"!==LoggerV5_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==LoggerV5_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===LoggerV5_typeof(e)?e:String(e)}(n.key),n)}}var ue=function(){function Logger(e,t){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Logger),this.options=e,this.context=t,this.teaLog=$,this.tea_app_id=ie,this.tea_channel="cn","ap-singapore-1"===this.options.region?(this.tea_app_id=oe,this.tea_channel="sg"):(this.tea_app_id=ie,this.tea_channel="cn"),this.teaLog.init({app_id:this.tea_app_id,channel:this.tea_channel,log:!1,disable_sdk_monitor:!0}),this.teaLog.config({evtParams:{sdk_version:"1.1.0",line_app_id:this.options.appId,toB:!0},user_unique_id:this.options.userId,disable_auto_pv:!0}),this.teaLog.start()}return function _createClass(e,t,r){t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Logger,[{key:"send",value:function send(e){var t=this.context,r=e.key,t=t.tasks[r],n=Y[e.stage]||999,t=e.fileType||t.fileType,i=e.fileSize||0,o={toB:!0,log_type:te[t],stage:n,fk:r,fs:i,req:e.req,res:e.res,ts:Math.round(Date.now()/1e3),sst:e.stageStartTime,set:e.stageEndTime,dur:e.duration,tdur:e.totalDuration},s="".concat("image"===t?"image":"video","_")+("error"===e.type?"error":n);switch(n){case 1e3:this.teaLog(s,_extends({},o,{type:e.type,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message,crc32Array:e.crc32Array,isDirect:e.isDirect})}));break;case 1001:this.teaLog(s,_extends({},o,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,err:e.extra&&e.extra.error,msg:e.extra&&e.extra.message,sig:e.signature})}));break;case 1002:this.teaLog(s,_extends({},o,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message,upid:e.uploadID})}));break;case 1003:e.isAllFinish||e.isDirect||(delete o.sst,delete o.set,delete o.dur),this.teaLog(s,_extends({},o,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message,si:e.slice_index,af:e.isAllFinish})}));break;case 1004:this.teaLog(s,_extends({},o,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message})}));break;case 1005:this.teaLog(s,_extends({},o,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,err:e.extra&&e.extra.error,msg:e.extra&&e.extra.message,vid:e.uploadResult&&e.uploadResult.Vid})}));break;default:this.teaLog(s,_extends({},o,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message})}))}}},{key:"console",value:function(t){function console(e){return t.apply(this,arguments)}return console.toString=function(){return t.toString()},console}(function(e){this.options.debug&&console.log(e)})}]),Logger}(),r=__webpack_require__(10),le=__webpack_require__.n(r),r=__webpack_require__(153),fe=__webpack_require__.n(r),w={concatAb:function concatAb(){for(var e=0,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];for(var i=0,o=r;i<o.length;i++)e+=o[i].byteLength;for(var s=new ArrayBuffer(e),a=new Uint8Array(s),c=0,u=0,l=r;u<l.length;u++){var f=l[u];a.set(new Uint8Array(f),c),c+=f.byteLength}return s},str2ab:function str2ab(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),i=0;i<t;i++)n[i]=e.charCodeAt(i);return r},generateKey:function generateKey(e){for(var t="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=r.length,i=0;i<e;i++)t+=r.charAt(Math.floor(Math.random()*n));return t},resolveUri:function resolveUri(t){if(!t)return"";if(Array.isArray(t))return t.map(function(t){try{return t.split("/")[0]+"/"+encodeURIComponent(t.split("/").slice(1).join("/"))}catch(e){return t}});try{return t.split("/")[0]+"/"+encodeURIComponent(t.split("/").slice(1).join("/"))}catch(e){return t}},urlTemplate:function urlTemplate(t,r){var n;return r=r||{},Object.keys(r).forEach(function(e){n=new RegExp("{".concat(e,"}"),"g"),t=t.replace(n,r[e])}),t},toQueryString:function toQueryString(){var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=[];return Object.keys(r).map(function(t){var e=r[t];"[object Array]"===Object.prototype.toString.call(e)?e.sort().forEach(function(e){n.push("".concat(t,"=").concat(encodeURIComponent(e)))}):n.push("".concat(t,"=").concat(encodeURIComponent(r[t])))}),n.join("&")},arrayToObject:function arrayToObject(e){var t={};return e&&e.forEach(function(e){t[e.Key.toLowerCase()]=e.Value}),t},supportChunked:function supportChunked(){var e=window.Blob||window.WebKitBlob;try{var t=e.prototype;return!(!FormData||!(t.slice||t.webkitSlice||t.mozSlice))}catch(e){return!1}},supportXhr:function supportXhr(){return!!window.FormData||window.ProgressEvent&&window.FileReader},supportCrc32:function supportCrc32(){var e=window.FileReader&&window.FileReader.prototype.readAsBinaryString;return"undefined"!=typeof Int32Array&&e&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice)},storage:function storage(e){var r=e,e={removeItem:function removeItem(e){delete r.cache[e]},setItem:function setItem(e,t){r.cache[e]=t},getItem:function getItem(e){return r.cache[e]},clear:function clear(){delete r.cache,r.cache={}}};if(!(1<arguments.length&&void 0!==arguments[1])||arguments[1])try{if(window.localStorage)return window.localStorage.setItem("",""),window.localStorage}catch(e){}return e},noop:function noop(){},getUnique:function getUnique(e){return"".concat(e,"_").concat((new Date).getTime(),"_").concat(parseInt(1e6*Math.random()))},getFileSliceLength:function getFileSliceLength(e,t){var r=e.size,n=1048576;return t&&"function"==typeof t?t(r)<5242880?5242880:t(r)||r:200*n<r?10*n:r<=200*n&&2*n<=r?5*n:e.size},getFileSuffix:function getFileSuffix(e){var t;return e&&"[object String]"===Object.prototype.toString.call(e)&&0<(t=e.lastIndexOf("."))?"."+e.substring(t+1):void 0},crypto:{hmac:function hmac(e,t){return le()(t,e)},sha256:function sha256(e){return fe()(e)}},date:{iso8601:function iso8601(e){return(e=void 0===e?w.date.getDate():e).toISOString().replace(/\.\d{3}Z$/,"Z")}},Buffer:Uint8Array,buffer:{toBuffer:function toBuffer(e,t){return"function"==typeof w.Buffer.from&&w.Buffer.from!==Uint8Array.from?w.Buffer.from(e,t):new w.Buffer(e,t)},alloc:function alloc(e,t,r){if("number"!=typeof e)throw new Error("size passed to alloc must be a number.");return"function"==typeof w.Buffer.alloc?w.Buffer.alloc(e,t,r):(e=new w.Buffer(e),void 0!==t&&"function"==typeof e.fill&&e.fill(t,void 0,void 0,r),e)},toStream:function toStream(t){w.Buffer.isBuffer(t)||(t=w.buffer.toBuffer(t));var r=new w.stream.Readable,n=0;return r._read=function(e){if(n>=t.length)return r.push(null);e=n+e;e>t.length&&(e=t.length),r.push(t.slice(n,e)),n=e},r},concat:function concat(e){for(var t,r=0,n=0,i=0;i<e.length;i++)r+=e[i].length;for(t=w.buffer.alloc(r),i=0;i<e.length;i++)e[i].copy(t,n),n+=e[i].length;return t}}};const x=w;const pe={crc32:function crc32(e,t){for(var r=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],n=("undefined"!=typeof Int32Array&&(r=new Int32Array(r)),-1^~~t),i=(e=new Uint8Array(e)).length,o=0;o<i;o++)n=r[255&(n^e[o])]^n>>>8;return(-1^n)>>>0},dec2hex:function dec2hex(e){if(void 0!==e)return function toEight(e){return e.length<8?toEight(e="0".concat(e)):e}(Number(e).toString(16))}};function Crc32_typeof(e){return(Crc32_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Crc32_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,function Crc32_toPropertyKey(e){e=function Crc32_toPrimitive(e,t){if("object"!==Crc32_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Crc32_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Crc32_typeof(e)?e:String(e)}(n.key),n)}}var de=function(){function Crc32(e,t,r,n){!function Crc32_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Crc32),this.file=e,this.successProcess=r,this.failProcess=n,this.sliceLength=t,this.retryTime=0,this.fileSize=e.size,this.crc32Array=[]}return function Crc32_createClass(e,t,r){t&&Crc32_defineProperties(e.prototype,t),r&&Crc32_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Crc32,[{key:"start",value:function start(){this.readFileCrc32(this.file)}},{key:"readFileCrc32",value:function readFileCrc32(t){var r=this,e=this.sliceLength,n=t.slice||t.webkitSlice||t.mozSlice,i=new FileReader,o=0,s=0,a=0;(function read(){s<t.size&&(s=Math.min(o+e,t.size),104857600<t.size)&&t.size-s<=5242880&&(s=t.size),i.readAsArrayBuffer(n.call(t,o,s)),i.onload=function(e){e=e.target.result;a=pe.crc32(e,0),r.crc32Array.push({start:o,end:s,crc32:pe.dec2hex(a),buffer:e}),(o=s)<t.size?read():r.success(r.crc32Array)}})()}},{key:"success",value:function success(e){this.successProcess(e)}},{key:"fail",value:function fail(e,t,r,n){3<=this.retryTime?this.failProcess():(this.readFileCrc32(e,t,r,n),this.retryTime++)}}]),Crc32}();function crc32_dec2hex(e){if(void 0!==e)return function crc32_toEight(e){return e.length<8?crc32_toEight(e="0".concat(e)):e}(Number(e).toString(16))}function lib_crc32(e,t){for(var r=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],n=("undefined"!=typeof Int32Array&&(r=new Int32Array(r)),-1^~~t),i=(e=new Uint8Array(e)).length,o=0;o<i;o++)n=r[255&(n^e[o])]^n>>>8;return crc32_dec2hex((-1^n)>>>0)}var r=__webpack_require__(433),he=__webpack_require__.n(r),r=__webpack_require__(452),ye=__webpack_require__.n(r),r=__webpack_require__(743),_e=__webpack_require__.n(r),r=__webpack_require__(568),ge=__webpack_require__.n(r),r=__webpack_require__(991),ve=__webpack_require__.n(r);function cipher_imagex_encrypt(e){var t=e.key,r=e.iv,e=e.data;return function wordArray2ArrayBuffer(e){for(var t=e.words,r=e.sigBytes,n=new Uint8Array(r),i=0;i<r;i+=1)n[i]=t[i>>>2]>>>24-i%4*8&255;return n}(ye().encrypt(he().create(e),_e().parse(t),{mode:ge(),padding:ve(),iv:_e().parse(r)}).ciphertext).buffer}function FileCrc32_typeof(e){return(FileCrc32_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function FileCrc32_extends(){return(FileCrc32_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function FileCrc32_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,function FileCrc32_toPropertyKey(e){e=function FileCrc32_toPrimitive(e,t){if("object"!==FileCrc32_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==FileCrc32_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===FileCrc32_typeof(e)?e:String(e)}(n.key),n)}}var me=function(){function FileCrc32(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};!function FileCrc32_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FileCrc32),this.context=e.context,this.key=e.key,this.currFileCtx=this.context.tasks[this.key],this.isDirect=e.isDirect,this.isImageBatchUpload=e.isImageBatchUpload,this.serviceName=e.serviceName||m,this.file=e.file,this.sliceLength=x.getFileSliceLength(this.file,t.getSliceFunc),this.config=t}return function FileCrc32_createClass(e,t,r){t&&FileCrc32_defineProperties(e.prototype,t),r&&FileCrc32_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(FileCrc32,[{key:"start",value:function start(e,t,r){this.successProcess=t,this.failProcess=r,this._st=Date.now(),this.currFileCtx.imagexEnableEncrypt?this.imagex_encrypt(this.file):this.crc32(this.file,this.sliceLength)}},{key:"imagex_encrypt",value:function imagex_encrypt(e){var n=this,i=this.currFileCtx.imagexEncryptKey;if(this.isDirect){var o=this.isImageBatchUpload?e:[e],s=[];o.forEach(function(e,r){var t=new FileReader;t.readAsArrayBuffer(e),t.onload=function(e){var e=e.target.result,t=x.generateKey(16),e=cipher_imagex_encrypt({key:i,iv:t,data:e}),e=x.concatAb(x.str2ab("aes256cfb-direct"),x.str2ab(t),e);s[r]={data:e,iv:t},s.filter(function(e){return!!e}).length===o.length&&(e=s.map(function(e){return{start:0,end:e.data.byteLength,crc32:lib_crc32(e.data),buffer:e.data}}),n.success(e))},t.onerror=function(){n.fail({message:"Read file error."})}})}else{for(var t=new ArrayBuffer(36),r=new DataView(t),a=x.str2ab("aes-256-cfb-part"),c=new Uint8Array(a),u=0;u<16;u++)r.setUint8(u,c[u]);r.setUint16(16,0,!0),r.setUint16(18,0,!0),r.setUint32(20,this.sliceLength,!0),r.setUint32(24,0,!0),r.setUint32(28,0,!0),r.setUint32(32,0,!0);for(var a=x.generateKey(16),t=x.concatAb(t,x.str2ab(a)),l=[{crc32:lib_crc32(t,0),buffer:t,encryptMeta:!0,start:-52,end:0,iv:a}],f=this.sliceLength,p=e.size,d=0,h=0;h<p;)h=Math.min(d+f,p),l.push({start:d,end:h,crc32:0}),d=h;this.success(l)}}},{key:"crc32",value:function crc32(e,t){var r=this;if(this.isImageBatchUpload)for(var n=e.length,i=[],o=0;o<n;o++)new de(e[o],e[o].size,function(e){i.push(e[0]),i.length===n&&r.success(i)},function(e){r.fail(e)}).start();else!e||!e.size||e.size<=0?this.fail({message:"There is a problem with the input file or fileSize."}):this.isDirect?new de(e,e.size,function(e){r.success(e)},function(e){r.fail(e)}).start():this.sliceFile(e,t,function(e){r.success(e)},function(e){r.fail(e)})}},{key:"sliceFile",value:function sliceFile(e,t,r,n){for(var i=[],o=t,s=e.size,a=new FileReader,c=e.slice||e.webkitSlice||e.mozSlice,u=0,l=0,f=0;l<s;)l=Math.min(u+o,s),s-l<=5242880&&(l=s),i.push({start:u,end:l,crc32:0}),u=l;try{!function read(t){u=i[t].start,l=i[t].end,a.readAsArrayBuffer(c.call(e,u,l)),a.onload=function(e){e=e.target.result,f=pe.dec2hex(pe.crc32(e,0)),i[t].crc32=f,l===s?r(i):read(i.length-1)},a.onerror=function(e){n(e)}}(0)}catch(e){n(e)}}},{key:"getCrc32Key",value:function getCrc32Key(e,t){t="[object Array]"===Object.prototype.toString.call(t)?_toConsumableArray(t):[t];return t.push(e[0].crc32,e[e.length-1].crc32),t.join("_")}},{key:"success",value:function success(e){var t=this.context,r=this.key,n=[],i=[];if(this.isImageBatchUpload)for(var o=0;o<this.file.length;o++)n.push(this.file[o].size),i.push(this.file[o].name);else n=this.file.size,i=this.file.name;var s=this.getCrc32Key(e,n),t=FileCrc32_extends(t.tasks[r],{key:r,crc32Array:e,crc32Key:s,sdkVersion:"1.1.0",sliceLength:this.sliceLength,extra:{message:"get crc32 success"},stage:"crc32",type:"success",fileSize:n,fileName:i,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st,isDirect:this.isDirect,isImageBatchUpload:this.isImageBatchUpload});this.successProcess(t)}},{key:"fail",value:function fail(e){var t=this.context,r=this.key,e=e&&e.message?e.message:"get crc32 error",t=FileCrc32_extends(t.tasks[r],{extra:{message:e},type:"error",stage:"crc32",stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st});this.failProcess(t)}}]),FileCrc32}();function Transport_typeof(e){return(Transport_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Transport_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,function Transport_toPropertyKey(e){e=function Transport_toPrimitive(e,t){if("object"!==Transport_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Transport_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Transport_typeof(e)?e:String(e)}(n.key),n)}}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(r){var n=function _isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=_getPrototypeOf(r);return function _possibleConstructorReturn(e,t){{if(t&&("object"===Transport_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function _assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,n?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var k=function(){!function _inherits(e,t){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&&_setPrototypeOf(e,t)}(Transport,s());var t=_createSuper(Transport);function Transport(){var e;return function Transport_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Transport),(e=t.call(this)).xhr=new XMLHttpRequest,e._data=null,e}return function Transport_createClass(e,t,r){t&&Transport_defineProperties(e.prototype,t),r&&Transport_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Transport,[{key:"_ajax",value:function _ajax(e){var t=this,r=this.xhr;r.upload.onprogress=function(e){t.emit("progress",e)},r.onreadystatechange=function(){4===r.readyState&&(r.upload.onprogress=x.noop,r.onreadystatechange=x.noop,r.params=e,t._data&&t._data.url&&(r.currentUrl=t._data.url),200<=r.status&&r.status<300?t.emit("complete",r):400<=r.status&&t.emit("error",r))},r.onerror=function(){r.errText="unknow net error",t.emit("error",r)},r.ontimeout=function(){r.errText="timeout",t.emit("error",r)},r.onabort=function(){r.errText="abort",t.emit("error",r)},r.send(e)}},{key:"send",value:function send(t){var r=this;return this._data=t,this.xhr.open(t.method||"POST",t.url||"",!0),t.headers&&Object.keys(t.headers).forEach(function(e){r.xhr.setRequestHeader(e,t.headers[e])}),this.xhr.timeout=t.timeout||0,t.ontimeout&&(this.xhr.ontimeout=t.ontimeout),t.binary?this.sendAsBinary(t):t.custom?"object"===Transport_typeof(t.custom)?this.sendAsCustom(JSON.stringify(t.custom)):"none"===t.custom?(delete t.custom,this.sendAsCustom()):this.sendAsCustom(t.custom):this.sendAsFormData(t)}},{key:"sendAsBinary",value:function sendAsBinary(e){return this.xhr.setRequestHeader("Content-Type","application/octet-stream"),this.xhr.setRequestHeader("Content-Disposition",'attachment; filename="'.concat(encodeURI(e.filename),'"')),this._ajax(e.file)}},{key:"sendAsFormData",value:function sendAsFormData(e){t=(t=e.formData?"function"==typeof e.formData?e.formData():e.formData:t)||[];for(var t,r=new FormData,n=0,i=t.length;n<i;n++){var o=t[n];r.append(o.name,o.value)}return e.file&&r.append(e.field,e.file,e.name),this._ajax(r)}},{key:"sendAsCustom",value:function sendAsCustom(e){return this._ajax(e)}},{key:"abort",value:function abort(){this.xhr.onreadystatechange=x.noop,this.xhr.abort()}},{key:"getResponse",value:function getResponse(){return this.xhr.response}},{key:"getText",value:function getText(){return this.xhr.responseText}},{key:"getJson",value:function getJson(){return JSON.parse(this.xhr.responseText)}}]),Transport}(),r=__webpack_require__(149),be=__webpack_require__.n(r),we=1000002,xe=1001e3,ke=1002e3,Se=1003e3,Oe=1003003,Ce=1004e3,Pe=1005e3,Ie="The format of stsToken is incorrect.",Ue="An error occurred reading the file";function ApplyUpload_typeof(e){return(ApplyUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){!function _defineProperty(e,t,r){(t=ApplyUpload_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function ApplyUpload_extends(){return(ApplyUpload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function ApplyUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ApplyUpload_toPropertyKey(n.key),n)}}function ApplyUpload_toPropertyKey(e){e=function ApplyUpload_toPrimitive(e,t){if("object"!==ApplyUpload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==ApplyUpload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===ApplyUpload_typeof(e)?e:String(e)}function ApplyUpload_setPrototypeOf(e,t){return(ApplyUpload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function ApplyUpload_createSuper(r){var n=function ApplyUpload_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=ApplyUpload_getPrototypeOf(r);return function ApplyUpload_possibleConstructorReturn(e,t){{if(t&&("object"===ApplyUpload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function ApplyUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,n?(e=ApplyUpload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function ApplyUpload_getPrototypeOf(e){return(ApplyUpload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var je=function(){!function ApplyUpload_inherits(e,t){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&&ApplyUpload_setPrototypeOf(e,t)}(ApplyUpload,s());var n=ApplyUpload_createSuper(ApplyUpload);function ApplyUpload(e,t){var r;return function ApplyUpload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ApplyUpload),(r=n.call(this)).options=e,r.config=t,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r.isImageBatchUpload=!!r.options.isImageBatchUpload,r.serviceName=e.serviceName||m,r}return function ApplyUpload_createClass(e,t,r){t&&ApplyUpload_defineProperties(e.prototype,t),r&&ApplyUpload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(ApplyUpload,[{key:"start",value:function start(e,t,r){this.failProcess=r,this.successProcess=t,this._st=Date.now();r=this.uploaderCtx._getCache(this.currFileCtx.crc32Key),t=r?JSON.parse(r):{};t.oid&&t.uploadID&&t.tosDomain?this.resumeFromCache(t):this.startPreUpload()}},{key:"startPreUpload",value:function startPreUpload(){var p=this,e=se[this.config.region],t=new k,r=(t.on("complete",function(t){if(t.response)try{var e,r,n,i,o,s,a,c,u,l,f=JSON.parse(t.response);f.ResponseMetadata.Error?p.fail({xhr:t,errorCode:f.ResponseMetadata.Error.CodeN,error:f.ResponseMetadata.Error.Code,message:f.ResponseMetadata.Error.Message}):(e=f.Result,n=(r=(p.serviceName===b?e:e.Data).UploadAddress).StoreInfos,i=r.UploadHosts,o=r.SessionKey,a=void 0===(s=r.UploadHeader)?[]:s,c=[],u=[],p.isImageBatchUpload&&1<n.length?n.forEach(function(e){c.push(e.Auth),u.push(e.StoreUri)}):(c=n[0].Auth,u=n[0].StoreUri),l=ApplyUpload_extends(p.currFileCtx,{signature:c,type:"success",extra:{message:"prepare upload success"},stage:"preUpload",oid:x.resolveUri(u),tosDomain:"".concat(p.config.schema,"://").concat(i[0]),xhr:t,UploadHeader:a,SessionKey:o,stageStartTime:p._st,stageEndTime:Date.now(),duration:Date.now()-p._st,totalDuration:Date.now()-p._st+p.currFileCtx.totalDuration}),p.successProcess&&p.successProcess(l))}catch(e){p.fail({error:"catch error: ".concat(e.toString()),xhr:t})}else p.fail({error:"request fail: ".concat(t.statusText||t.errText||"UNKNOWN"),xhr:t})}),t.on("error",function(e){var t={error:"request fail: ".concat(e.statusText||e.errText||"UNKNOWN"),xhr:e};e.response&&(e=JSON.parse(e.response)).ResponseMetadata&&e.ResponseMetadata.Error&&(t.errorCode=e.ResponseMetadata.Error.CodeN,t.error=e.ResponseMetadata.Error.Code,t.message=e.ResponseMetadata.Error.Message),p.fail(t)}),this.serviceName),n="",i={},o=(r===b?(n=this.config.imageHost||ce[e],i={Action:"ApplyImageUpload",Version:"2018-08-01",ServiceId:this.options.serviceId||this.config.imageConfig.serviceId},this.currFileCtx.fileSize&&1<this.currFileCtx.fileSize.length&&(i.UploadNum=this.currFileCtx.fileSize.length),this.options.storeKey&&(o=this.options.storeKey,"[object Array]"===Object.prototype.toString.call(o)?i.StoreKeys=o:"[object String]"===Object.prototype.toString.call(o)&&(i.StoreKeys=[o])),this.options.prefix&&(i.Prefix=this.options.prefix),this.options.overwrite&&(i.Overwrite=!0)):(o=this.config.videoConfig&&this.config.videoConfig.spaceName,this.options.type===y&&this.config.objectConfig&&this.config.objectConfig.spaceName&&(o=this.config.objectConfig.spaceName),n=this.config.videoHost||ae[e],i={Action:"ApplyUploadInfo",Version:"2022-01-01",SpaceName:o,FileSize:this.currFileCtx.fileSize,FileType:this.options.type},this.options.fileName&&(i.FileName=this.options.fileName),this.options.fileExtension&&(i.FileExtension=this.options.fileExtension),this.options.storageClass&&(i.StorageClass=this.options.storageClass),this.config.enOID&&(i.EnOID=1)),this.config.useFileExtension&&this.currFileCtx.fileName&&(this.options.type===y||this.options.type===h)&&(o=this.currFileCtx.fileName,o=x.getFileSuffix(o))&&(i.FileExtension=o),this.options.fileExtension&&(i.FileExtension=this.options.fileExtension),this.config.accountId&&(i["X-Account-Id"]=this.config.accountId),i.s=Math.random().toString(36).substr(2),this.currFileCtx.proxyStsToken||this.config.stsToken),s=x.toQueryString(i),a=o.AccessKeyID,c=o.AccessKeyId,u=o.SecretAccessKey,o=o.SessionToken,n={method:"GET",url:"".concat(n,"?").concat(s),timeout:3e4,region:e,params:i};new(be())(n,r,{isVolcengine:!0}).addAuthorization({accessKeyId:c||a,secretAccessKey:u,sessionToken:o},new Date),t.send(n)}},{key:"resumeFromCache",value:function resumeFromCache(o){var s=this,a=this.options.key,e=new k,t=(e.on("complete",function(e){try{var t,r,n,i=JSON.parse(e.response);0===i.success&&0<i.payload.partList.length?(t=s.confirmCache(i.payload.partList),r=!!o.hasMerge?5:t.isAllFinished?4:3,n=ApplyUpload_extends(s.currFileCtx,o,{key:a,xhr:e,extra:{message:"prepare upload from cache success"},stage:"preUpload",type:"success",percent:0,cacheTask:r,proxyStsToken:s.options.stsToken,currentTask:1,status:1,isBreak:1,crc32Array:t.crc32Array,stageStartTime:s._st,stageEndTime:Date.now(),duration:Date.now()-s._st,totalDuration:Date.now()-s._st+s.currFileCtx.totalDuration}),s.successProcess&&s.successProcess(n)):s.startPreUpload()}catch(e){s.startPreUpload()}}),e.on("error",function(e){400<=e.status?s.startPreUpload():s.fail({error:"request error",xhr:e})}),this.config.userId),r=ApplyUpload_extends(x.arrayToObject(o.UploadHeader),{"x-storage-mode":"gateway"});e.send({method:"get",url:x.urlTemplate(this.config.getUploadListUrl,{tosDomain:o.tosDomain,oid:o.oid,uploadId:o.uploadID}),headers:_objectSpread({authorization:o.signature,"x-storage-u":t},r),timeout:3e4})}},{key:"confirmCache",value:function confirmCache(e){var t=this.currFileCtx.crc32Array,r={},n=(e.forEach(function(e){var t=parseInt(e.partNumber)-1;isNaN(t)||void 0!==r[t]||(r[t]={tag:!0,crc32:e.crc32})}),!0),e=t.map(function(e,t){return r[t]&&r[t].tag&&r[t].crc32?(e.crc32=r[t].crc32,e.finished=!0,e.loaded=e.end-e.start):n=!1,e});return{isAllFinished:n,crc32Array:e}}},{key:"fail",value:function fail(e){var t=e.xhr,r=e.errorCode||xe,n="prepare upload error: UNKNOWN",n=(t&&(n=0===t.status?"prepare upload error: NETERROR":e.message||"prepare upload error: ".concat(t.status)),ApplyUpload_extends(this.currFileCtx,{extra:{message:n,error:e.error,errorCode:r},type:"error",stage:"preUpload",xhr:t,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration}));this.uploaderCtx._removeTaskCache(this.options.key),this.failProcess(n)}}]),ApplyUpload}();function InitUploadID_typeof(e){return(InitUploadID_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function InitUploadID_ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function InitUploadID_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?InitUploadID_ownKeys(Object(r),!0).forEach(function(e){!function InitUploadID_defineProperty(e,t,r){(t=InitUploadID_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):InitUploadID_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function InitUploadID_extends(){return(InitUploadID_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function InitUploadID_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,InitUploadID_toPropertyKey(n.key),n)}}function InitUploadID_toPropertyKey(e){e=function InitUploadID_toPrimitive(e,t){if("object"!==InitUploadID_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==InitUploadID_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===InitUploadID_typeof(e)?e:String(e)}function InitUploadID_setPrototypeOf(e,t){return(InitUploadID_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function InitUploadID_createSuper(r){var n=function InitUploadID_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=InitUploadID_getPrototypeOf(r);return function InitUploadID_possibleConstructorReturn(e,t){{if(t&&("object"===InitUploadID_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function InitUploadID_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,n?(e=InitUploadID_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function InitUploadID_getPrototypeOf(e){return(InitUploadID_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Te=function(){!function InitUploadID_inherits(e,t){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&&InitUploadID_setPrototypeOf(e,t)}(InitUploadID,s());var n=InitUploadID_createSuper(InitUploadID);function InitUploadID(e,t){var r;return function InitUploadID_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,InitUploadID),(r=n.call(this)).options=e,r.config=t,r.transport=new k,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r.eventInit(),r}return function InitUploadID_createClass(e,t,r){t&&InitUploadID_defineProperties(e.prototype,t),r&&InitUploadID_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(InitUploadID,[{key:"initUpload",value:function initUpload(){var e=this.options.context,t=this.options.key,r={oid:e.tasks[t].oid,tosDomain:e.tasks[t].tosDomain},r=x.urlTemplate(this.config.initUploadFileUrl,r),n=this.config.userId,i=InitUploadID_extends(x.arrayToObject(this.currFileCtx.UploadHeader),{"x-storage-mode":"gateway"});this.transport.send({method:"post",url:r,headers:InitUploadID_objectSpread({authorization:e.tasks[t].signature,"x-storage-u":n},i),timeout:3e4})}},{key:"start",value:function start(e,t,r){this.successProcess=t,this.failProcess=r,this._st=Date.now(),this.initUpload()}},{key:"eventInit",value:function eventInit(){var i=this,o=this.options.context,s=this.options.key;this.transport.on("complete",function(t){try{var e,r=JSON.parse(t.response),n=r.payload.uploadID;0===r.success&&n?(e=InitUploadID_extends(o.tasks[s],{uploadID:n,percent:0,type:"success",extra:{message:"init upload id success"},stage:"initUploadID",xhr:t,stageStartTime:i._st,stageEndTime:Date.now(),duration:Date.now()-i._st,totalDuration:Date.now()-i._st+i.currFileCtx.totalDuration}),i.successProcess(e)):i.fail({error:"fail! res.success: ".concat(r.success,", uploadId:").concat(n),xhr:t})}catch(e){i.fail({error:"catch error: ".concat(JSON.stringify(e)),xhr:t})}}),this.transport.on("error",function(e){i.fail({error:"request fail: ".concat(e.statusText||e.errText||"UNKNOWN"),xhr:e})})}},{key:"fail",value:function fail(e){var t=this.options.context,r=this.options.key,t=InitUploadID_extends(t.tasks[r],{extra:{message:"init upload id error, ".concat(e.error),errorCode:ke},type:"error",stage:"initUploadID",xhr:e.xhr,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration});this.uploaderCtx._removeTaskCache(this.options.key),this.failProcess(t)}}]),InitUploadID}();function Uploader_typeof(e){return(Uploader_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Uploader_ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function Uploader_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Uploader_ownKeys(Object(r),!0).forEach(function(e){!function Uploader_defineProperty(e,t,r){(t=Uploader_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Uploader_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Uploader_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Uploader_toPropertyKey(n.key),n)}}function Uploader_toPropertyKey(e){e=function Uploader_toPrimitive(e,t){if("object"!==Uploader_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Uploader_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Uploader_typeof(e)?e:String(e)}function Uploader_setPrototypeOf(e,t){return(Uploader_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Uploader_createSuper(r){var n=function Uploader_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=Uploader_getPrototypeOf(r);return function Uploader_possibleConstructorReturn(e,t){{if(t&&("object"===Uploader_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function Uploader_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,n?(e=Uploader_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function Uploader_getPrototypeOf(e){return(Uploader_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var De=function(){!function Uploader_inherits(e,t){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&&Uploader_setPrototypeOf(e,t)}(Uploader,s());var u=Uploader_createSuper(Uploader);function Uploader(e){var t,r=e.sliceItem,n=e.crc32,i=e.url,o=e.signature,s=e.uploadHeader,a=e.userId,c=e.retryTime,c=void 0===c?0:c,e=e.method,e=void 0===e?"put":e;return function Uploader_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Uploader),(t=u.call(this)).fileSlice=r,t.crc32=n,t.uploadUrl=i,t.uploadHeader=s,t.signature=o,t.userId=a,t.retryTime=c,t.method=e,t.retryCount=0,t.ready=!1,t.cancel=!1,t.transport=new k,t.eventInit(),t}return function Uploader_createClass(e,t,r){t&&Uploader_defineProperties(e.prototype,t),r&&Uploader_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Uploader,[{key:"upload",value:function upload(){this.isParamsValid()&&(this._st=Date.now(),this.transport.send({method:this.method,url:this.uploadUrl,headers:Uploader_objectSpread({authorization:this.signature,"content-crc32":this.crc32,"x-storage-u":this.userId},this.uploadHeader),file:this.fileSlice,binary:1,timeout:18e5}))}},{key:"isParamsValid",value:function isParamsValid(){return this.fileSlice&&(this.fileSlice.size||this.fileSlice.byteLength)?this.crc32?!!this.uploadUrl||(this.emit("error",{message:"slice upload failed: NOURL",crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength}),!1):(this.emit("error",{message:"slice upload failed: NOCRC32",crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength}),!1):(this.emit("error",{message:"slice upload failed: NOCONTENT",crc32:this.crc32}),!1)}},{key:"eventInit",value:function eventInit(){var t=this;this.transport.on("complete",function(e){t.success(e)}),this.transport.on("error",function(e){t.fail(e)}),this.transport.on("progress",function(e){t.process(e)})}},{key:"success",value:function success(e){this.ready=!0;var t=Date.now()-this._st,r=this.fileSlice.size||this.fileSlice.byteLength;this.emit("complete",{crc32:this.crc32,size:r,speed:r/t,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st})}},{key:"fail",value:function fail(e){var t,r=this;this.cancel||(e&&401===e.status?this.emit("error",{message:"slice upload failed: UNAUTHORIZED",crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st}):this.retryCount<this.retryTime?(setTimeout(function(){r.upload()},1e3),this.retryCount++):(t="slice upload failed: UNKNOWN",e&&(t=e.status?"slice upload failed: ".concat(e.status):"slice upload failed: NETERROR"),this.emit("error",{message:t,crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st})))}},{key:"process",value:function process(e){this.cancel||this.emit("progress",{crc32:this.crc32,loaded:e.loaded||0,total:e.total||0})}},{key:"abort",value:function abort(){this.transport&&(this.cancel=!0,this.transport.abort())}},{key:"destroy",value:function destroy(){this.transport=null}}]),Uploader}(),r=__webpack_require__(391),Ae=__webpack_require__.n(r);function Upload_typeof(e){return(Upload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Upload_extends(){return(Upload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Upload_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,function Upload_toPropertyKey(e){e=function Upload_toPrimitive(e,t){if("object"!==Upload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Upload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Upload_typeof(e)?e:String(e)}(n.key),n)}}function Upload_setPrototypeOf(e,t){return(Upload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Upload_createSuper(r){var n=function Upload_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=Upload_getPrototypeOf(r);return function Upload_possibleConstructorReturn(e,t){{if(t&&("object"===Upload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function Upload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,n?(e=Upload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function Upload_getPrototypeOf(e){return(Upload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ee=function(){!function Upload_inherits(e,t){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&&Upload_setPrototypeOf(e,t)}(Upload,s());var n=Upload_createSuper(Upload);function Upload(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return function Upload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Upload),(t=n.call(this)).file=e.file,t.context=e.context,t.key=e.key,t.config=r,t.finishArr=[],t.errorLength=0,t.finishSize=0,t.retryUploadTime=Number(r.retryUploadTime)||5,t.retryProcess=r.retryProcess,t.retryProcessTime=Number(r.retryProcessTime)||5,t.maxProcessPause=Number(r.maxProcessPause)||20,t.uploadSliceCount=Number(r.uploadSliceCount)||5,t.realtimeSpeedInterval=Number(r.realtimeSpeedInterval)||5,t.processRetry=0,t.lastFinishSize=-1,t.lastProcessPercent=-1,t.lastIntervalSize=-1,t.lastCalculateSpeedTime=-1,t.lastCalculateSpeedSize=0,t.uploadHandlers={},t}return function Upload_createClass(e,t,r){t&&Upload_defineProperties(e.prototype,t),r&&Upload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Upload,[{key:"start",value:function start(e,t,r){this.failProcess=r,this.successProcess=t,this.errorLength=0,this.currentCtx=this.context.tasks[this.key],this.crc32Array=this.context.tasks[this.key].crc32Array,this.uploadSliceCount=this.uploadSliceCount>this.crc32Array.length?this.crc32Array.length:this.uploadSliceCount,this.lastIndex=0,this.uploading=[],this._uploadSize=this.crc32Array.reduce(function(e,t){return e+(t.finished?0:t.end-t.start)},0),this._st=Date.now(),this._lastSaveTime=Date.now(),this.lastCalculateSpeedTime=this._st,this.imagexEncrypt=this.currentCtx.imagexEnableEncrypt,this.initWorker(),this.threadUpload()}},{key:"initWorker",value:function initWorker(){var i,o=this;this.worker||(i=this.crc32Array,this.worker=new(Ae()),this.worker.onmessage=function(e){var t=e.data[0],r=e.data[2],n=i[r];n.crc32=e.data[1],o.upload(n,t,r)})}},{key:"read",value:function read(e,r){var t,n,i,o=this;e.encryptMeta?this.upload(e,e.buffer,r):(n=(t=this.file).slice||t.webkitSlice||t.mozSlice,(i=new FileReader).onload=function(e){var t;o.imagexEncrypt?(t=cipher_imagex_encrypt({iv:o.crc32Array[0].iv,key:o.currentCtx.imagexEncryptKey,data:e.target.result}),o.worker.postMessage([t,r],[t])):o.worker.postMessage([e.target.result,r],[e.target.result])},i.onerror=function(){o.stop(),o.fail({extra:{message:Ue,errorCode:Oe}})},i.readAsArrayBuffer(n.call(t,e.start,e.end)))}},{key:"threadUpload",value:function threadUpload(){if(this.uploading.length<this.uploadSliceCount){var e=this.lastIndex,t=this.crc32Array[e];if(t){if(t.finished){if(-1===this.finishArr.indexOf(t.start)&&(this.finishArr.push(t.start),this.finishArr.length>=this.crc32Array.length))return this.stop(),void this.success()}else t.loaded=0,this.uploading.push(e),this.read(t,e);this.lastIndex++,this.threadUpload()}}}},{key:"stop",value:function stop(){var t=this;Object.keys(this.uploadHandlers).forEach(function(e){t.uploadHandlers[e].abort()}),this.worker&&this.worker.terminate(),this.worker=null,this.clearMonitor()}},{key:"clearMonitor",value:function clearMonitor(){this.progressMonitorInterval&&clearInterval(this.progressMonitorInterval)}},{key:"upload",value:function upload(t,e,r){var n=this,i=t.crc32,o={number:r+1,uploadId:this.currentCtx.uploadID,oid:this.currentCtx.oid,tosDomain:this.currentCtx.tosDomain},o=x.urlTemplate(this.config.uploadChunkedUrl,o),s=this.config.userId,a=Upload_extends(x.arrayToObject(this.currentCtx.UploadHeader)),e=(this.imagexEncrypt||(a["x-storage-mode"]="gateway"),new De({sliceItem:e,crc32:i,url:o,signature:this.currentCtx.signature,uploadHeader:a,userId:s,retryTime:this.retryUploadTime}));e.on("complete",function(e){n.currentCtx.status===_&&(e.start=t.start,e.index=r,n.fileSliceSuccess(e))}),e.on("error",function(e){1===n.currentCtx.status&&(e.start=t.start,e.index=r,n.fail(e))}),e.on("progress",function(e){1===n.currentCtx.status&&(e.start=t.start,e.index=r,n.process(e))}),e.upload(),this.uploadHandlers[r]=e}},{key:"success",value:function success(e){this.finishArr=[];var t=Date.now()-this._st,t=this._uploadSize/t,t=Upload_extends(this.currentCtx,{type:"success",stage:"process",percent:99,extra:{message:"upload all success"},speed:t,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._lastSaveTime+this.currentCtx.totalDuration,isAllFinish:!0});this.worker&&this.worker.terminate(),this.successProcess(t)}},{key:"fail",value:function fail(e){var t=this.currentCtx.totalDuration,r=Date.now()-this._st,n=e.crc32?{message:e.message,data:e.crc32,size:e.size}:e.extra,n=(n.errorCode=n.errorCode||Se,Upload_extends(this.currentCtx,{extra:n,type:"error",stage:"process",req:{},res:{},totalDuration:r+t}));e.xhr&&(r=e.xhr,n.req={url:e.xhr.currentUrl},n.res={status:r.status,body:r.responseText,header:r.getAllResponseHeaders()},delete e.xhr),void 0!==e.statusCode&&Upload_extends(this.currentCtx,{statusCode:e.statusCode}),this.errorLength||(t=e.index,this.context.logger.send(Upload_extends({},n,{slice_index:t})),this.stop(),this.context._broadcast("error",n),this.currentCtx.isBreak?this.context._cancel(this.key):this.context._pause(this.key),this.errorLength++)}},{key:"fileSliceSuccess",value:function fileSliceSuccess(e){var t,r=e.index,n=Date.now(),i=(-1===this.finishArr.indexOf(e.start)&&this.finishArr.push(e.start),this.crc32Array[r].finished=!0,this.crc32Array[r].speed=e.speed,{message:"slice upload success"});e.xhr&&(t=e.xhr,i.currentUrl=t.currentUrl||"",Upload_extends(this.currentCtx,{req:{url:t.currentUrl,param:t.params},res:{status:t.status,body:t.responseText,header:t.getAllResponseHeaders()}}),delete e.xhr),this.context.logger.send(Upload_extends(this.currentCtx,{stage:"process",type:"success",slice_index:r,extra:i,totalDuration:n-this._lastSaveTime+this.currentCtx.totalDuration})),this._lastSaveTime=n,this.finishArr.length>=this.crc32Array.length?(this.stop(),this.success(e.xhr)):(this.uploading.splice(this.uploading.indexOf(r),1),this.uploadHandlers[r]&&delete this.uploadHandlers[r],this.threadUpload())}},{key:"getFinishSize",value:function getFinishSize(e,t){var r=t.crc32,n=0;return e.forEach(function(e){e.crc32===r?(e.loaded=t.loaded,n+=t.loaded):(e.loaded||(e.loaded=0),n+=e.loaded)}),n}},{key:"process",value:function process(e){var t=this.currentCtx.realtimeSpeed||0,r=this.currentCtx.fileSize,n=(this.finishSize=this.getFinishSize(this.crc32Array,e),this.finishSize>this.lastFinishSize&&((e=new Date).getTime()-this.lastCalculateSpeedTime>1e3*this.realtimeSpeedInterval&&(i=e.getTime()-this.lastCalculateSpeedTime,n=this.finishSize-this.lastCalculateSpeedSize,t=Math.floor(n/i),this.lastCalculateSpeedTime=e.getTime(),this.lastCalculateSpeedSize=this.finishSize),this.lastFinishSize=this.finishSize),Math.floor(this.finishSize/r*100*100)/100||0),n=Math.min(99,n),i=Upload_extends(this.currentCtx,{stage:"process",percent:n,realtimeSpeed:t});n>this.lastProcessPercent&&100!==n&&(this.lastProcessPercent=n,this.context._broadcast("progress",i))}}]),Upload}();function FileMerge_typeof(e){return(FileMerge_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function FileMerge_ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function FileMerge_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?FileMerge_ownKeys(Object(r),!0).forEach(function(e){!function FileMerge_defineProperty(e,t,r){(t=FileMerge_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):FileMerge_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function FileMerge_extends(){return(FileMerge_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function FileMerge_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,FileMerge_toPropertyKey(n.key),n)}}function FileMerge_toPropertyKey(e){e=function FileMerge_toPrimitive(e,t){if("object"!==FileMerge_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==FileMerge_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===FileMerge_typeof(e)?e:String(e)}function FileMerge_setPrototypeOf(e,t){return(FileMerge_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function FileMerge_createSuper(r){var n=function FileMerge_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=FileMerge_getPrototypeOf(r);return function FileMerge_possibleConstructorReturn(e,t){{if(t&&("object"===FileMerge_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function FileMerge_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,n?(e=FileMerge_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function FileMerge_getPrototypeOf(e){return(FileMerge_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Fe=function(){!function FileMerge_inherits(e,t){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&&FileMerge_setPrototypeOf(e,t)}(FileMerge,s());var n=FileMerge_createSuper(FileMerge);function FileMerge(e,t){var r;return function FileMerge_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FileMerge),(r=n.call(this)).options=e,r.config=t,r.transport=new k,r.eventInit(),r.errorCount=0,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r}return function FileMerge_createClass(e,t,r){t&&FileMerge_defineProperties(e.prototype,t),r&&FileMerge_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(FileMerge,[{key:"mergeFile",value:function mergeFile(){for(var e={oid:this.currFileCtx.oid,uploadId:this.currFileCtx.uploadID,tosDomain:this.currFileCtx.tosDomain},t=this.currFileCtx.crc32Array,r="",n=0;n<t.length;n++)r=(r?"".concat(r,","):"").concat(n+1,":").concat(t[n].crc32);var e=x.urlTemplate(this.config.uploadMergeUrl,e),i=this.config.userId,o=FileMerge_extends(x.arrayToObject(this.currFileCtx.UploadHeader));this.currFileCtx.imagexEnableEncrypt||(o["x-storage-mode"]="gateway"),this.transport.send({method:"post",url:e,headers:FileMerge_objectSpread({authorization:this.currFileCtx.signature,"x-storage-u":i},o),custom:r})}},{key:"start",value:function start(e,t,r){this.successProcess=t,this.failProcess=r,this._st=Date.now(),this.mergeFile()}},{key:"eventInit",value:function eventInit(){var r=this,n=this.options.stage;this.transport.on("complete",function(t){try{var e=JSON.parse(t.response);0===e.success&&e.payload.key?(FileMerge_extends(r.currFileCtx,{stage:n,type:"success",hasMerge:!0,extra:{message:"merge file success"},xhr:t,stageStartTime:r._st,stageEndTime:Date.now(),duration:Date.now()-r._st,totalDuration:Date.now()-r._st+r.currFileCtx.totalDuration}),r.successProcess(r.currFileCtx)):r.fail({error:"fail! result.success:".concat(e.success),xhr:t})}catch(e){r.fail({error:"response parse error: ".concat(JSON.stringify(e)),xhr:t})}}),this.transport.on("error",function(e){r.fail({error:"request fail: ".concat(e.statusText||e.errText),xhr:e})})}},{key:"getProcessIndex",value:function getProcessIndex(e){var r=0;return e.forEach(function(e,t){"process"===e.stage&&(r=t)}),r}},{key:"fail",value:function fail(e){e=FileMerge_extends(this.currFileCtx,{extra:{message:"merge file error, ".concat(e.error),errorCode:Ce},type:"error",stage:this.options.stage,xhr:e.xhr,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration});this.failProcess(e)}}]),FileMerge}();function DirectUpload_typeof(e){return(DirectUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function DirectUpload_extends(){return(DirectUpload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function DirectUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,function DirectUpload_toPropertyKey(e){e=function DirectUpload_toPrimitive(e,t){if("object"!==DirectUpload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==DirectUpload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===DirectUpload_typeof(e)?e:String(e)}(n.key),n)}}function DirectUpload_setPrototypeOf(e,t){return(DirectUpload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function DirectUpload_createSuper(r){var n=function DirectUpload_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=DirectUpload_getPrototypeOf(r);return function DirectUpload_possibleConstructorReturn(e,t){{if(t&&("object"===DirectUpload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function DirectUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,n?(e=DirectUpload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function DirectUpload_getPrototypeOf(e){return(DirectUpload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Me=function(){!function DirectUpload_inherits(e,t){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&&DirectUpload_setPrototypeOf(e,t)}(DirectUpload,s());var n=DirectUpload_createSuper(DirectUpload);function DirectUpload(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return function DirectUpload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,DirectUpload),(t=n.call(this)).options=e,t.file=e.file,t.context=e.context,t.key=e.key,t.config=r,t.finishArr=[],t.errorLength=0,t.finishSize=0,t.retryUploadTime=Number(r.retryUploadTime)||5,t.processRetry=0,t.lastFinishSize=-1,t.lastProcessPercent=-1,t.lastIntervalSize=-1,t}return function DirectUpload_createClass(e,t,r){t&&DirectUpload_defineProperties(e.prototype,t),r&&DirectUpload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(DirectUpload,[{key:"start",value:function start(e,t,r){this.failProcess=r,this.successProcess=t,this.currentCtx=this.context.tasks[this.key],this.crc32Array=this.context.tasks[this.key].crc32Array,this._uploadSize=this.file.size,this.uploadHandlers={},this._st=Date.now(),this.upload()}},{key:"upload",value:function upload(){for(var t=this,r=this.crc32Array.length,n=0,i=0,e=0;e<r;e++){var o=this.crc32Array[e],s=o.buffer,o=o.crc32,a=this.currentCtx.oid,c=this.currentCtx.signature,a={oid:"[object Array]"===Object.prototype.toString.call(a)?a[e]:a,tosDomain:this.currentCtx.tosDomain},a=x.urlTemplate(this.config.directUploadFileUrl,a),u=this.config.userId,l=x.arrayToObject(this.currentCtx.UploadHeader),s=new De({sliceItem:s,crc32:o,url:a,signature:"[object Array]"===Object.prototype.toString.call(c)?c[e]:c,uploadHeader:l,userId:u,retryTime:this.retryUploadTime,method:"put"});s.on("complete",function(e){i+ ++n===r&&t.success(e.xhr)}),s.on("error",function(e){++i===r&&t.fail(e.xhr)}),s.on("progress",function(e){t.process(e)}),(this.uploadHandlers["".concat(o,"_").concat(Math.round(1e3*Math.random()))]=s).upload()}}},{key:"success",value:function success(e){this.finishArr=[];var t=Date.now()-this._st,t=this._uploadSize/t,t=DirectUpload_extends(this.currentCtx,{type:"success",stage:"process",percent:99,extra:{message:"direct upload success"},speed:t,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currentCtx.totalDuration});this.successProcess(t)}},{key:"fail",value:function fail(e){e=DirectUpload_extends(this.currentCtx,{extra:{message:"direct upload error",errorCode:Se},type:"error",stage:"process",xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currentCtx.totalDuration});this.failProcess(e)}},{key:"process",value:function process(e){var t=this.currentCtx.fileSize,e=(this.finishSize=e.loaded,this.finishSize>this.lastFinishSize&&(this.lastFinishSize=this.finishSize),Math.floor(this.finishSize/t*100*100)/100||0),e=Math.min(99,e),t=DirectUpload_extends(this.currentCtx,{stage:"process",percent:e});e>this.lastProcessPercent&&100!==e&&(this.lastProcessPercent=e,this.context._broadcast("progress",t))}},{key:"stop",value:function stop(){Object.values(this.uploadHandlers).forEach(function(e){e.abort()})}}]),DirectUpload}();function CommitUpload_typeof(e){return(CommitUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function CommitUpload_ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function CommitUpload_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?CommitUpload_ownKeys(Object(r),!0).forEach(function(e){!function CommitUpload_defineProperty(e,t,r){(t=CommitUpload_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):CommitUpload_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function CommitUpload_extends(){return(CommitUpload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function CommitUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,CommitUpload_toPropertyKey(n.key),n)}}function CommitUpload_toPropertyKey(e){e=function CommitUpload_toPrimitive(e,t){if("object"!==CommitUpload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==CommitUpload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===CommitUpload_typeof(e)?e:String(e)}function CommitUpload_setPrototypeOf(e,t){return(CommitUpload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function CommitUpload_createSuper(r){var n=function CommitUpload_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=CommitUpload_getPrototypeOf(r);return function CommitUpload_possibleConstructorReturn(e,t){{if(t&&("object"===CommitUpload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function CommitUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,n?(e=CommitUpload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function CommitUpload_getPrototypeOf(e){return(CommitUpload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Be=function(){!function CommitUpload_inherits(e,t){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&&CommitUpload_setPrototypeOf(e,t)}(CommitUpload,s());var n=CommitUpload_createSuper(CommitUpload);function CommitUpload(e,t){var r;return function CommitUpload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,CommitUpload),(r=n.call(this)).options=e,r.config=t,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r.isImageBatchUpload=!!r.options.isImageBatchUpload,r.processAction=e.processAction,r.skipCommit=e.skipCommit,r.serviceName=e.serviceName||m,r.transport=new k,r.eventInit(),r}return function CommitUpload_createClass(e,t,r){t&&CommitUpload_defineProperties(e.prototype,t),r&&CommitUpload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(CommitUpload,[{key:"commitUpload",value:function commitUpload(){var t,r=this,e=this.options.key,e=this.options.context.tasks[e],n=se[this.config.region],i="",o={},s=this.serviceName,a=(s===b?(i=this.config.imageHost||ce[n],o={Action:"CommitImageUpload",Version:"2018-08-01",ServiceId:this.options.serviceId||(null==(c=this.config.imageConfig)?void 0:c.serviceId)},this.options.skipMeta&&(o.SkipMeta=this.options.skipMeta),t={SessionKey:e.SessionKey},this.processAction&&Array.isArray(this.processAction)&&0<this.processAction.length&&(t.Functions=this.processAction),a=(c=this.currFileCtx).imagexEnableEncrypt,c=c.imagexPublicKey,a&&c&&!this.options.skipMeta&&this.uploaderCtx.plugins.forEach(function(e){"imagex-encrypt-plugin"===(null==e?void 0:e._identifier)&&(t.DecryptKeys=e.apply(r.currFileCtx))})):(a=this.config.videoConfig&&this.config.videoConfig.spaceName,this.options.type===y&&this.config.objectConfig&&this.config.objectConfig.spaceName&&(a=this.config.objectConfig.spaceName),i=this.config.videoHost||ae[n],o={Action:"CommitUploadInfo",Version:"2022-01-01"},t={SpaceName:a,SessionKey:e.SessionKey,Functions:[]},c=this.config.videoConfig&&this.config.videoConfig.processAction,this.options.type===y&&this.config.objectConfig&&this.config.objectConfig.processAction&&(c=this.config.objectConfig.processAction),this.processAction&&(c=this.processAction),Array.isArray(c)&&0<c.length&&(t.Functions=c),(this.config.videoConfig&&this.config.videoConfig.callbackArgs||this.options.callbackArgs)&&(t.CallbackArgs=this.options.callbackArgs||this.config.videoConfig.callbackArgs)),this.config.accountId&&(o["X-Account-Id"]=this.config.accountId),x.toQueryString(o)),e=this.currFileCtx.proxyStsToken||this.config.stsToken,c=e.AccessKeyID,u=e.AccessKeyId,l=e.SecretAccessKey,e=e.SessionToken,i={method:"POST",url:"".concat(i,"?").concat(a),timeout:3e4,region:n,params:o,headers:{}};s===m?(a=Object.keys(t).map(function(e){return"[object Array]"===Object.prototype.toString.call(t[e])||"[object Object]"===Object.prototype.toString.call(t[e])?"".concat(e,"=").concat(encodeURIComponent(JSON.stringify(t[e]))):"SessionKey"===e?"".concat(e,"=").concat(encodeURIComponent(t[e])):"".concat(e,"=").concat(t[e])}).join("&"),i.headers["Content-Type"]="application/x-www-form-urlencoded",i.body=a,i.custom=i.body):(i.custom=t,i.headers["Content-Type"]="application/json",i.body=t),new(be())(i,s,{isVolcengine:!0}).addAuthorization({accessKeyId:u||c,secretAccessKey:l,sessionToken:e},new Date),this.transport.send(i)}},{key:"start",value:function start(e,t,r){if(this.successProcess=t,this.failProcess=r,this._st=Date.now(),this.skipCommit)return this.successProcess(CommitUpload_extends(this.currFileCtx,{stage:"complete",type:"success",percent:100,extra:{message:"upload successful, skip commit"},stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration,skipCommit:this.skipCommit}));try{this.commitUpload()}catch(e){this.fail({error:"catch error: ".concat(e.toString())})}}},{key:"eventInit",value:function eventInit(){var a=this;this.transport.on("complete",function(t){try{var e,r,n,i,o,s=JSON.parse(t.response);if(!s.ResponseMetadata.Error)return e=s.Result,r={},a.options.type===h&&a.config.imageConfig&&a.config.imageConfig.serviceId?a.isImageBatchUpload?(n=e.Results,i=e.PluginResult||[],n.forEach(function(e,t){n[t]=CommitUpload_objectSpread(CommitUpload_objectSpread({},n[t]),i[t])}),r=n):CommitUpload_extends(r=e.Results[0],e.PluginResult&&e.PluginResult[0]):r=e.Data,o=CommitUpload_extends(a.currFileCtx,{stage:"complete",type:"success",percent:100,extra:{message:"upload successful"},uploadResult:r,xhr:t,stageStartTime:a._st,stageEndTime:Date.now(),duration:Date.now()-a._st,totalDuration:Date.now()-a._st+a.currFileCtx.totalDuration}),a.successProcess(o);a.fail({xhr:t,errorCode:s.ResponseMetadata.Error.CodeN,error:s.ResponseMetadata.Error.Code,message:s.ResponseMetadata.Error.Message})}catch(e){a.fail({error:"catch error: ".concat(e.toString()),xhr:t})}}),this.transport.on("error",function(e){var t={error:"request fail: ".concat(e.statusText||e.errText||"UNKNOWN"),xhr:e};if(e.response)try{var r=JSON.parse(e.response);r.ResponseMetadata&&r.ResponseMetadata.Error&&(t.errorCode=r.ResponseMetadata.Error.CodeN,t.error=r.ResponseMetadata.Error.Code,t.message=r.ResponseMetadata.Error.Message)}catch(e){}a.fail(t)})}},{key:"fail",value:function fail(e){var t=this.options.context,r=this.options.key,n=e.xhr,i=e.errorCode||Pe,o="commit upload error: UNKNOWN",t=(n&&(o=0===n.status?"commit upload error: NETERROR":e.message||"commit upload error: ".concat(n.status)),CommitUpload_extends(t.tasks[r],{extra:{message:o,error:e.error,errorCode:i},type:"error",stage:"complete",xhr:n,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration}));this.failProcess(t)}}]),CommitUpload}();function Queue_typeof(e){return(Queue_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Queue_extends(){return(Queue_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Queue_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,function Queue_toPropertyKey(e){e=function Queue_toPrimitive(e,t){if("object"!==Queue_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Queue_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Queue_typeof(e)?e:String(e)}(n.key),n)}}function Queue_setPrototypeOf(e,t){return(Queue_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Queue_createSuper(r){var n=function Queue_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=Queue_getPrototypeOf(r);return function Queue_possibleConstructorReturn(e,t){{if(t&&("object"===Queue_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function Queue_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,n?(e=Queue_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function Queue_getPrototypeOf(e){return(Queue_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Re=function(){!function Queue_inherits(e,t){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&&Queue_setPrototypeOf(e,t)}(Queue,s());var o=Queue_createSuper(Queue);function Queue(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length?arguments[2]:void 0,i=3<arguments.length?arguments[3]:void 0;return function Queue_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Queue),(t=o.call(this,e)).tasks=e,t.config=r,t.key=i,t.uploaderCtx=n,t.current=0,t.length=t.tasks.length,t.taskError={},t.uploadList=[],t.retryTaskTime=r.retryTaskTime||3,t}return function Queue_createClass(e,t,r){t&&Queue_defineProperties(e.prototype,t),r&&Queue_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Queue,[{key:"start",value:function start(){var e=this.tasks.shift();e&&(this.current=e.index,this.execTask(e))}},{key:"execTask",value:function execTask(n){var i=this,o=n.key,s=this.uploaderCtx,e=s.tasks[o].cacheTask,a=s.taskList[o].length;e&&0<n.index&&n.index<e?this.start():(s.tasks[o].currentTask=n.index,1===s.tasks[o].status&&n&&n.func.call(n.context,n.arg,function(e){var t=s.taskList[o][n.index+1],r=i.uploaderCtx.tasks[i.key];r.isDirect||r.imagexEnableEncrypt||(t&&0!==n.index?s._saveTask(o,{currentTask:t.index,stage:t.stage}):n.index===a-1&&s._removeTaskCache(o)),i.success(e),0<i.tasks.length?i.start():s._queueSuccess(o)},function(e){e.xhr&&400<=e.xhr.status?i.fail(e):i.taskError[o]?i.taskError[o]<i.retryTaskTime?(i.taskError[o]++,i.execTask(n)):(e.key=o,i.fail(e)):(i.taskError[o]=1,i.execTask(n))}))}},{key:"addTask",value:function addTask(e){this.tasks.push(e)}},{key:"success",value:function success(e){var t;e.xhr&&(t=e.xhr,e.req={url:t.currentUrl,param:t.params},e.res={status:t.status,header:t.getAllResponseHeaders(),body:t.responseText},delete e.xhr),Queue_extends(e,{type:"success"});try{this.uploaderCtx._broadcast(e.stage,e)}catch(e){throw Error(e)}this.uploaderCtx.logger.send(e)}},{key:"fail",value:function fail(e){var t,r=this.uploaderCtx;e.xhr&&(t=e.xhr,e.req={url:t.currentUrl,param:t.params},e.res={status:t.status,header:t.getAllResponseHeaders(),body:t.responseText},e.extra&&(e.extra.req=e.req,e.extra.res=e.res),delete e.xhr),Queue_extends(e,{type:"error"});try{r._broadcast("error",e)}catch(e){}r.logger.send(e),1!==e.currentTask&&(r.tasks[e.key].isBreak?r._cancel(e.key):r._pause(e.key))}},{key:"cancel",value:function cancel(e){var t=this.key,r=this.uploaderCtx.tasks[t].currentTask,r=this.uploaderCtx.tasks[t].isDirect?this.uploaderCtx.taskList[t][r-1]:this.uploaderCtx.taskList[t][r];e?r&&3===r.index&&(e=r.context,Object.values(e.uploadHandlers).forEach(function(e){e.abort()})):(this.tasks=[],r&&3===r.index&&r.context.stop(),this.uploaderCtx._removeTaskCache(t))}},{key:"restart",value:function restart(){this.uploadList.forEach(function(e){e.cancel=!1}),this.start()}}]),Queue}();function MainClass_typeof(e){return(MainClass_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _createForOfIteratorHelper(t,r){var i,o,a,c,u="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(u)return o=!(i=!0),{s:function s(){u=u.call(t)},n:function n(){var e=u.next();return i=e.done,e},e:function e(t){o=!0,a=t},f:function f(){try{i||null==u.return||u.return()}finally{if(o)throw a}}};if(Array.isArray(t)||(u=function MainClass_unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?MainClass_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?MainClass_arrayLikeToArray(e,t):void 0}(t))||r&&t&&"number"==typeof t.length)return u&&(t=u),c=0,{s:r=function F(){},n:function n(){return c>=t.length?{done:!0}:{done:!1,value:t[c++]}},e:function e(t){throw t},f:r};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function MainClass_arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function MainClass_extends(){return(MainClass_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function MainClass_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,function MainClass_toPropertyKey(e){e=function MainClass_toPrimitive(e,t){if("object"!==MainClass_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==MainClass_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===MainClass_typeof(e)?e:String(e)}(n.key),n)}}function MainClass_setPrototypeOf(e,t){return(MainClass_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function MainClass_createSuper(r){var n=function MainClass_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=MainClass_getPrototypeOf(r);return function MainClass_possibleConstructorReturn(e,t){{if(t&&("object"===MainClass_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return MainClass_assertThisInitialized(e)}(this,n?(e=MainClass_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function MainClass_assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function MainClass_getPrototypeOf(e){return(MainClass_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ne=function(){!function MainClass_inherits(e,t){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&&MainClass_setPrototypeOf(e,t)}(MainClass,s());var r=MainClass_createSuper(MainClass);function MainClass(e){var t;return function MainClass_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,MainClass),(t=r.call(this,e)).config=MainClass_extends({},S),t._mergeOptions(t.config,e),t.tasks={},t.taskList={},t.cache={},t.storage=x.storage(MainClass_assertThisInitialized(t),t.config.useLocalStorage),t.logger=t.config.noLog?{send:function send(){}}:new ue(t.config,MainClass_assertThisInitialized(t)),t.plugins=[],t}return function MainClass_createClass(e,t,r){t&&MainClass_defineProperties(e.prototype,t),r&&MainClass_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(MainClass,[{key:"_use",value:function _use(e){var t,r=!1,n=_createForOfIteratorHelper(this.plugins);try{for(n.s();!(t=n.n()).done;){var i=t.value;if((null==i?void 0:i.stage)===(null==e?void 0:e.stage)&&(null==i?void 0:i._identifier)===e._identifier){r=!0;break}}}catch(e){n.e(e)}finally{n.f()}r||this.plugins.push(e)}},{key:"_mergeOptions",value:function _mergeOptions(t,r){r&&"object"===MainClass_typeof(r)&&(MainClass_extends(t,r),t.log.userId=r.userId||t.userId,t.log.appId=r.appId||t.appId,Object.keys(r).forEach(function(e){"vodDomain"===e&&(t.replace[e]=r[e])}))}},{key:"_addAllUploadProcess",value:function _addAllUploadProcess(e,t,r){var n,i=e.type===h&&"[object Array]"===Object.prototype.toString.call(e.file),o=(this.tasks[t]=this.tasks[t]||{},this.tasks[t]),s=(o.fileType=e.type||ee,o.fileSize=e.file&&e.file.size,o.proxyStsToken=e.stsToken,o.serviceType=r,e.file.size<5242880||i),o=(r===b&&(n=!(null==(n=this.config)||null==(n=n.imageConfig)||!n.imagexEnableEncrypt),o.imagexEnableEncrypt=n)&&(o.imagexEncryptKey=(null==(n=this.config)||null==(n=n.imageConfig)?void 0:n.imagexEncryptKey)||x.generateKey(32),o.imagexPublicKey=null==(n=this.config)||null==(n=n.imageConfig)?void 0:n.imagexPublicKey),this._addCrc32ProcessTask(e,t,{isDirect:s,isImageBatchUpload:i,serviceName:r}),this._addPreUploadTask(e,t,{isImageBatchUpload:i,serviceId:r===b?e.serviceId:null,serviceName:r}),s?this._addDirectUploadTask(e,t,{isImageBatchUpload:i}):(this._addInitUploadIDTask(e,t),this._addUploadProcessTask(e,t),this._mergeFileTask(e,t)),r===b&&e.skipCommit);this._getMetaInfoTask(e,t,{isImageBatchUpload:i,serviceId:r===b?e.serviceId:null,skipCommit:o,serviceName:r})}},{key:"_run",value:function _run(e){var t=this.tasks,r=navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/);r&&r[1]&&Number(r[1])<=9?(this._broadcast("error",MainClass_extends(t[e],{key:e,status:0,stage:"browserError",extra:{message:"cannot support the browser below ie10"},type:"error"})),this.logger.send(t[e]),this._cancel(e)):t[e]?t[e].status===ne?this._restart(e):(r=new Date,t[e].startTime=r.getTime(),t[e].task&&t[e].status!==_&&t[e].task.tasks.length&&(t[e].status=_,this.logger.send(MainClass_extends({},t[e],{extra:{message:"start upload"},type:"start",key:e})),t[e].task.start())):console.warn("".concat(e," is not exit in object tasks, stop running..."))}},{key:"_setCache",value:function _setCache(e,t){this.storage.setItem(e,t)}},{key:"_getCache",value:function _getCache(e){return this.storage.getItem(e)}},{key:"_removeCache",value:function _removeCache(e){e?this.storage.removeItem(e):this.storage.clear()}},{key:"_addTask",value:function _addTask(e,t){var r=this.tasks,n=this.taskList;r[e]&&r[e].task?n[e].push(t):(n[e]=[],n[e].push(t),r[e]=r[e]||{},r[e].task=new Re([],this.config,this,e)),r[e].task.addTask(t)}},{key:"_broadcast",value:function _broadcast(e,t){var r=this.tasks[t.key].status;if(r===_||0===r)try{this.emit(e,t)}catch(e){r=!("[object Error]"!==Object.prototype.toString.call(e));if(!r||"Error"===e.name)throw e}}},{key:"_addCrc32ProcessTask",value:function _addCrc32ProcessTask(e,t,r){var n=r.isDirect,i=r.isImageBatchUpload,r=r.serviceName,e=new me({file:e.file,context:this,key:t,isDirect:n,isImageBatchUpload:i,serviceName:r},this.config),n={context:e,func:e.start,arg:{},key:t,index:0,stage:"crc32"};this._addTask(t,n)}},{key:"_addPreUploadTask",value:function _addPreUploadTask(e,t,r){var n=r.isImageBatchUpload,i=r.serviceId,r=r.serviceName,n={file:e.file,stsToken:e.stsToken,context:this,type:e.type||ee,preUploadUriParams:e.preUploadUriParams||{},key:t,isImageBatchUpload:n,fileName:e.fileName||null,fileExtension:e.fileExtension||null,storageClass:e.storageClass||null,serviceId:i,prefix:e.prefix,storeKey:e.storeKey,serviceName:r,overwrite:e.overwrite},i=new je(n,this.config),r={context:i,func:i.start,arg:{},key:t,index:1,stage:"preUpload"};this._addTask(t,r)}},{key:"_addDirectUploadTask",value:function _addDirectUploadTask(e,t,r){r=r.isImageBatchUpload,e=new Me({file:e.file,context:this,key:t,isImageBatchUpload:r},this.config),r={context:e,func:e.start,arg:{},key:t,index:3,stage:"process"};this._addTask(t,r)}},{key:"_addInitUploadIDTask",value:function _addInitUploadIDTask(e,t){e=new Te({file:e.file,context:this,key:t},this.config),e={context:e,func:e.start,arg:{},key:t,index:2,stage:"initUploadID"};this._addTask(t,e)}},{key:"_addUploadProcessTask",value:function _addUploadProcessTask(e,t){e=new Ee({file:e.file,context:this,key:t},this.config),e={context:e,func:e.start,arg:{},key:t,index:3,stage:"process"};this._addTask(t,e)}},{key:"_mergeFileTask",value:function _mergeFileTask(e,t){e=new Fe({file:e.file,context:this,stage:"fileMerge",key:t},this.config),e={context:e,func:e.start,arg:{},key:t,index:4,stage:"fileMerge"};this._addTask(t,e)}},{key:"_getMetaInfoTask",value:function _getMetaInfoTask(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},n=r.isImageBatchUpload,i=r.serviceId,o=r.skipCommit,r=r.serviceName,n={file:e.file,context:this,data:e.data,type:e.type||ee,callbackArgs:e.callbackArgs,key:t,isImageBatchUpload:void 0!==n&&n,serviceId:i,processAction:e.processAction,skipCommit:o,skipMeta:e.skipMeta,serviceName:r},i=new Be(n,this.config),o={context:i,func:i.start,arg:{},key:t,index:5,stage:"complete"};this._addTask(t,o)}},{key:"_restart",value:function _restart(r){var n,i,o=this,e=this.tasks;e[r]?(n=e[r].task,i=e[r].currentTask||0,this.taskList[r].forEach(function(e,t){e.index===i&&(n.tasks=o.taskList[r].slice(t))}),n&&e[r].status!==_&&n.tasks.length&&(e[r].status=_,n.restart())):console.warn("".concat(r," is not exit in object tasks"))}},{key:"_cancel",value:function _cancel(e){var t=this.tasks;t[e]?(t[e].status=re,t[e].task.cancel(!1),this.taskList[e]=[]):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_pause",value:function _pause(e){var t=this.tasks;t[e]?(t[e].status=ne,t[e].task.cancel(!0),t[e].isDirect||t[e].imagexEnableEncrypt||this._saveTask(e)):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_removeTaskCache",value:function _removeTaskCache(e){var t=this.tasks;t[e]?(t=t[e].crc32Key)&&this._removeCache(t):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_saveTask",value:function _saveTask(e,t){e=MainClass_extends({},this.tasks[e],t||{}),t=e.crc32Key;if(t){var r={SessionKey:e.SessionKey,UploadHeader:e.UploadHeader,fileName:e.fileName,oid:e.oid,uploadID:e.uploadID,signature:e.signature,tosDomain:e.tosDomain,hasMerge:e.hasMerge};Object.keys(r).forEach(function(e){r[e]||delete r[e]});try{this._setCache(t,JSON.stringify(r))}catch(e){return[!1,e.message]}return[!0,""]}}},{key:"_queueSuccess",value:function _queueSuccess(e){var t,r=this.tasks;r[e]?(t=new Date,r[e].endTime=t.getTime(),r[e].time=r[e].endTime-r[e].startTime,r[e].status=0,this.taskList[e]=[]):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_removeFile",value:function _removeFile(e){delete this.tasks[e]}},{key:"_batchAction",value:function _batchAction(t){var e=this.tasks;Object.keys(e).forEach(function(e){t&&t(e)})}},{key:"_refreshStsToken",value:function _refreshStsToken(n){var i=this,o=this.tasks;Object.keys(o).forEach(function(e){var e=o[e],t=MainClass_extends({},e,{proxyStsToken:n}),r=(e.proxyStsToken=n,t.crc32Key);r&&(delete t.task,delete t.xhr,delete t.crc32Array,e.proxyStsToken=n,i._setCache(r,JSON.stringify(t)))})}},{key:"_setOption",value:function _setOption(e){this._mergeOptions(this.config,e)}},{key:"_setServiceId",value:function _setServiceId(e){!this.config.imageConfig&&e?this.config.imageConfig={serviceId:e}:this.config.imageConfig.serviceId=e}},{key:"_getServiceId",value:function _getServiceId(){var e;return null==(e=this.config.imageConfig)?void 0:e.serviceId}},{key:"_getOption",value:function _getOption(e){var t=MainClass_extends({},this.config);return Object.keys(t).forEach(function(e){(-1<e.indexOf("Url")||"replace"===e||"log"===e)&&delete t[e]}),e?t[e]:t}},{key:"_userCancel",value:function _userCancel(e){var t=this,r=this.tasks;e?(this._cancel(e),this.logger.send(MainClass_extends({},r[e],{type:"cancel"}))):Object.keys(r).forEach(function(e){t._cancel(e),t.logger.send(MainClass_extends({},r[e],{type:"cancel"}))})}},{key:"_userPause",value:function _userPause(e){var t=this,r=this.tasks;e?(this._pause(e),this.logger.send(MainClass_extends({},r[e],{type:"pause"}))):Object.keys(r).forEach(function(e){t._pause(e),t.logger.send(MainClass_extends({},r[e],{type:"pause"}))})}}]),MainClass}();const ze={checkFile:function checkFile(e){return e instanceof Blob},checkStsToken:function checkStsToken(e){return!e||e.SessionToken&&e.SecretAccessKey&&(e.AccessKeyId||e.AccessKeyID)}};function entry_typeof(e){return(entry_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function entry_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,function entry_toPropertyKey(e){e=function entry_toPrimitive(e,t){if("object"!==entry_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==entry_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===entry_typeof(e)?e:String(e)}(n.key),n)}}function entry_setPrototypeOf(e,t){return(entry_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function entry_createSuper(r){var n=function entry_isNativeReflectConstruct(){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(e){return!1}}();return function _createSuperInternal(){var e,t=entry_getPrototypeOf(r);return function entry_possibleConstructorReturn(e,t){{if(t&&("object"===entry_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function entry_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,n?(e=entry_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function entry_getPrototypeOf(e){return(entry_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var He=function(){!function entry_inherits(e,t){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&&entry_setPrototypeOf(e,t)}(TTUploader,Ne);var e=entry_createSuper(TTUploader);function TTUploader(){return function entry_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,TTUploader),e.apply(this,arguments)}return function entry_createClass(e,t,r){t&&entry_defineProperties(e.prototype,t),r&&entry_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(TTUploader,[{key:"use",value:function use(e){this._use(e)}},{key:"start",value:function start(e){this.abort=!1,e?this._run(e):this._batchAction(this._run.bind(this))}},{key:"addFile",value:function addFile(e){var t;return e&&ze.checkStsToken(e.stsToken)?e.file?(t=x.getUnique("file"),this._addAllUploadProcess(e,t,m),t):null:(this.emit("error",{extra:{message:Ie,errorCode:we}}),null)}},{key:"addImageFile",value:function addImageFile(e){var t;return e&&ze.checkStsToken(e.stsToken)?e.file?(e.type=h,t=x.getUnique("file"),this._addAllUploadProcess(e,t,b),t):null:(this.emit("error",{extra:{message:Ie,errorCode:we}}),null)}},{key:"addImageXFile",value:function addImageXFile(e){return this.addImageFile(e)}},{key:"setServiceId",value:function setServiceId(e){this._setServiceId(e)}},{key:"getServiceId",value:function getServiceId(){return this._getServiceId()}},{key:"removeFile",value:function removeFile(e){e&&this._removeFile(e)}},{key:"cancel",value:function cancel(e){e?this._userCancel(e):this._batchAction(this._userCancel.bind(this))}},{key:"pause",value:function pause(e){this._userPause(e)}},{key:"restart",value:function restart(e){e?this._restart(e):this._batchAction(this._restart.bind(this))}},{key:"refreshAuth",value:function refreshAuth(e){this._refreshAuth(e)}},{key:"setOption",value:function setOption(e){this._setOption(e)}},{key:"getOption",value:function getOption(e){return this._getOption(e)}}]),TTUploader}()})(),Le.default})());
|