From b915a892f10fb16054ac387a17b2fdba25b85610 Mon Sep 17 00:00:00 2001 From: carsonxu <459452372@qq.com> Date: Fri, 12 Jan 2018 22:36:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20test-123-1250000000=20buck?= =?UTF-8?q?et=20=E5=88=86=E7=89=87=E4=B8=8A=E4=BC=A0=E5=87=BA=E9=94=99?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/cos-js-sdk-v5.js | 152 ++++++++++++++------------------------ dist/cos-js-sdk-v5.min.js | 4 +- package.json | 2 +- src/advance.js | 18 ----- src/base.js | 66 +++-------------- src/cos.js | 4 +- src/event.js | 2 +- src/task.js | 1 + src/util.js | 27 +++---- test/test.js | 4 +- 10 files changed, 90 insertions(+), 190 deletions(-) diff --git a/dist/cos-js-sdk-v5.js b/dist/cos-js-sdk-v5.js index 148c202..7960278 100644 --- a/dist/cos-js-sdk-v5.js +++ b/dist/cos-js-sdk-v5.js @@ -324,22 +324,21 @@ var apiWrapper = function (apiName, apiFn) { return; } // 兼容不带 AppId 的 Bucket - var appId, - m, - bucket = params.Bucket; - if (bucket) { - if (m = bucket.match(/^(.+)-(\d+)$/)) { - appId = m[2]; - bucket = m[1]; - params.AppId = appId; - params.Bucket = bucket; - } else if (!params.AppId) { - if (this.options.AppId) { - params.AppId = this.options.AppId; + if (params.Bucket) { + if (!/^(.+)-(\d+)$/.test(params.Bucket)) { + if (params.AppId) { + params.Bucket = params.Bucket + '-' + params.AppId; + } else if (this.options.AppId) { + params.Bucket = params.Bucket + '-' + this.options.AppId; } else { callback({ error: 'Bucket should format as "test-1250000000".' }); + return; } } + if (params.AppId) { + console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g Bucket:"test-1250000000" ).'); + delete params.AppId; + } } // 兼容带有斜杠开头的 Key if (params.Key && params.Key.substr(0, 1) === '/') { @@ -419,9 +418,9 @@ var util = { filter: filter, clone: clone, uuid: uuid, - fileSlice: fileSlice, throttleOnProgress: throttleOnProgress, - isBrowser: !!global.document + isBrowser: !!global.document, + fileSlice: fileSlice }; module.exports = util; @@ -2263,7 +2262,7 @@ var initEvent = function (cos) { }; cos.on = function (action, callback) { if (action === 'task-list-update') { - console.warn('Event "' + action + '" has been deprecated. Please use "list-update" instead.'); + console.warn('warning: Event "' + action + '" has been deprecated. Please use "list-update" instead.'); } getList(action).push(callback); }; @@ -2337,7 +2336,7 @@ var defaultOptions = { // 对外暴露的类 var COS = function (options) { if (options.AppId) { - console.warn('AppId has been deprecated, Please put it at the end of parameter Bucket(E.g: "test-1250000000").'); + console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g: "test-1250000000").'); } this.options = util.extend(util.clone(defaultOptions), options || {}); event.init(this); @@ -2348,7 +2347,7 @@ util.extend(COS.prototype, base); util.extend(COS.prototype, advance); COS.getAuthorization = util.getAuth; -COS.version = '0.3.3'; +COS.version = '0.3.6'; module.exports = COS; @@ -3456,6 +3455,7 @@ var initTask = function (cos) { var killTask = function (id, switchToState) { var task = tasks[id]; + if (!task) return; var waiting = task && task.state === 'waiting'; var running = task && (task.state === 'checking' || task.state === 'uploading'); if (switchToState === 'canceled' && task.state !== 'canceled' || switchToState === 'paused' && waiting || switchToState === 'paused' && running) { @@ -3598,7 +3598,6 @@ function headBucket(params, callback) { submitRequest.call(this, { Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, method: 'HEAD' }, function (err, data) { var exist, auth, statusCode; @@ -3657,7 +3656,6 @@ function getBucket(params, callback) { method: 'GET', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, qs: reqParams }, function (err, data) { if (err) { @@ -3695,8 +3693,7 @@ function deleteBucket(params, callback) { submitRequest.call(this, { method: 'DELETE', Bucket: params.Bucket, - Region: params.Region, - AppId: params.AppId + Region: params.Region }, function (err, data) { if (err && err.statusCode === 204) { return callback(null, { statusCode: err.statusCode }); @@ -3725,7 +3722,6 @@ function getBucketAcl(params, callback) { method: 'GET', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, action: '/?acl' }, function (err, data) { if (err) { @@ -3788,7 +3784,6 @@ function putBucketAcl(params, callback) { method: 'PUT', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, action: '/?acl', headers: headers, body: xml @@ -3818,7 +3813,6 @@ function getBucketCors(params, callback) { method: 'GET', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, action: '/?cors' }, function (err, data) { if (err) { @@ -3889,7 +3883,6 @@ function putBucketCors(params, callback) { method: 'PUT', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, body: xml, action: '/?cors', headers: headers @@ -3918,7 +3911,6 @@ function deleteBucketCors(params, callback) { method: 'DELETE', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, action: '/?cors' }, function (err, data) { if (err && err.statusCode === 204) { @@ -3954,7 +3946,6 @@ function putBucketPolicy(params, callback) { method: 'PUT', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, action: '/?policy', body: util.isBrowser ? PolicyStr : Policy, headers: headers, @@ -3986,7 +3977,6 @@ function getBucketLocation(params, callback) { method: 'GET', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, action: '/?location' }, function (err, data) { if (err) { @@ -4010,7 +4000,6 @@ function getBucketPolicy(params, callback) { method: 'GET', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, action: '/?policy', rawBody: true }, function (err, data) { @@ -4052,7 +4041,6 @@ function getBucketTagging(params, callback) { method: 'GET', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, action: '/?tagging' }, function (err, data) { if (err) { @@ -4106,7 +4094,6 @@ function putBucketTagging(params, callback) { method: 'PUT', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, body: xml, action: '/?tagging', headers: headers @@ -4137,7 +4124,6 @@ function deleteBucketTagging(params, callback) { method: 'DELETE', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, action: '/?tagging' }, function (err, data) { if (err && err.statusCode === 204) { @@ -4167,7 +4153,6 @@ function putBucketLifecycle(params, callback) { method: 'PUT', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, body: xml, action: '/?lifecycle', headers: headers @@ -4189,7 +4174,6 @@ function getBucketLifecycle(params, callback) { method: 'GET', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, action: '/?lifecycle' }, function (err, data) { if (err) { @@ -4223,7 +4207,6 @@ function deleteBucketLifecycle(params, callback) { method: 'DELETE', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, action: '/?lifecycle' }, function (err, data) { if (err && err.statusCode === 204) { @@ -4251,7 +4234,6 @@ function putBucketVersioning(params, callback) { method: 'PUT', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, body: xml, action: '/?versioning', headers: headers @@ -4273,7 +4255,6 @@ function getBucketVersioning(params, callback) { method: 'GET', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, action: '/?versioning' }, function (err, data) { if (!err) { @@ -4299,7 +4280,6 @@ function putBucketReplication(params, callback) { method: 'PUT', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, body: xml, action: '/?replication', headers: headers @@ -4321,7 +4301,6 @@ function getBucketReplication(params, callback) { method: 'GET', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, action: '/?replication' }, function (err, data) { if (err) { @@ -4349,7 +4328,6 @@ function deleteBucketReplication(params, callback) { method: 'DELETE', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, action: '/?replication' }, function (err, data) { if (err && err.statusCode === 204) { @@ -4386,7 +4364,6 @@ function headObject(params, callback) { method: 'HEAD', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, Key: params.Key, headers: headers }, function (err, data) { @@ -4452,7 +4429,6 @@ function getObject(params, callback) { method: 'GET', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, Key: params.Key, headers: headers, qs: reqParams, @@ -4531,8 +4507,11 @@ function putObject(params, callback) { var Body = params.Body; var readStream; - if (util.isBrowser && (typeof Body === 'string' || Body instanceof global.Blob || Body instanceof global.File)) { - // 在浏览器传入 String、Blob 或者 File 文件内容 + if (util.isBrowser && Body && (Body instanceof global.Blob || Body instanceof global.File)) { + // 在浏览器允许传入 Blob 或者 File 文件内容 + headers['Content-Length'] = Body.size; + } else if (util.isBrowser && Body && typeof Body === 'string') { + // 在浏览器允许传入字符串作为内容 'hello' headers['Content-Length'] = Body.length; } else if (Body && Body instanceof Buffer) { // 传入 fs.readFileSync(filepath) 或者 文件内容 @@ -4545,14 +4524,10 @@ function putObject(params, callback) { callback({ error: 'lack of param ContentLength' }); return; } - } else if (Body && typeof Body === 'string' && util.isBrowser) { - // 在浏览器允许传入字符串作为内容 'hello' - headers['Content-Length'] = Body.length; } else { callback({ error: 'params body format error, Only allow Buffer, Stream, Blob.' }); return; } - var onProgress = util.throttleOnProgress.call(self, headers['Content-Length'], params.onProgress); submitRequest.call(this, { @@ -4560,7 +4535,6 @@ function putObject(params, callback) { method: 'PUT', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, Key: params.Key, headers: headers, body: Body, @@ -4571,7 +4545,14 @@ function putObject(params, callback) { return callback(err); } if (data && data.headers && data.headers['etag']) { + var url = getUrl({ + domain: self.options.Domain, + bucket: params.Bucket, + region: params.Region, + object: params.Key + }); return callback(null, { + Location: url, ETag: data.headers['etag'], statusCode: data.statusCode, headers: data.headers @@ -4596,7 +4577,6 @@ function deleteObject(params, callback) { method: 'DELETE', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, Key: params.Key }, function (err, data) { if (err) { @@ -4633,7 +4613,6 @@ function getObjectAcl(params, callback) { method: 'GET', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, Key: params.Key, action: '?acl' }, function (err, data) { @@ -4692,7 +4671,6 @@ function putObjectAcl(params, callback) { method: 'PUT', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, Key: params.Key, action: '?acl', headers: headers, @@ -4729,7 +4707,6 @@ function optionsObject(params, callback) { method: 'OPTIONS', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, Key: params.Key, headers: headers }, function (err, data) { @@ -4814,7 +4791,6 @@ function putObjectCopy(params, callback) { method: 'PUT', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, Key: params.Key, headers: headers }, function (err, data) { @@ -4846,7 +4822,6 @@ function uploadPartCopy(params, callback) { method: 'PUT', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, Key: params.Key, action: action, headers: headers @@ -4887,7 +4862,6 @@ function deleteMultipleObject(params, callback) { method: 'POST', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, body: xml, action: '/?delete', headers: headers @@ -4961,7 +4935,6 @@ function multipartInit(params, callback) { method: 'POST', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, Key: params.Key, action: '?uploads', headers: headers @@ -5010,7 +4983,6 @@ function multipartUpload(params, callback) { method: 'PUT', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, Key: params.Key, action: action, headers: headers, @@ -5044,6 +5016,7 @@ function multipartUpload(params, callback) { * @return {Object} data.CompleteMultipartUpload 完成分块上传后的文件信息,包括Location, Bucket, Key 和 ETag */ function multipartComplete(params, callback) { + var self = this; var headers = {}; headers['Content-Type'] = 'application/xml'; @@ -5076,7 +5049,6 @@ function multipartComplete(params, callback) { method: 'POST', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, Key: params.Key, action: action, body: xml, @@ -5085,7 +5057,15 @@ function multipartComplete(params, callback) { if (err) { return callback(err); } + var url = getUrl({ + domain: self.options.Domain, + bucket: params.Bucket, + region: params.Region, + object: params.Key, + isLocation: true + }); var result = util.extend(data.CompleteMultipartUploadResult, { + Location: url, statusCode: data.statusCode, headers: data.headers }); @@ -5127,7 +5107,6 @@ function multipartList(params, callback) { method: 'GET', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, action: '/?uploads&' + queryString.stringify(reqParams) }, function (err, data) { if (err) { @@ -5181,7 +5160,6 @@ function multipartListPart(params, callback) { method: 'GET', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, Key: params.Key, qs: reqParams }, function (err, data) { @@ -5220,7 +5198,6 @@ function multipartAbort(params, callback) { method: 'DELETE', Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, Key: params.Key, qs: reqParams }, function (err, data) { @@ -5270,9 +5247,12 @@ function getObjectUrl(params, callback) { domain: self.options.Domain, bucket: params.Bucket, region: params.Region, - appId: params.AppId || self.options.AppId || '', object: params.Key }); + if (params.Sign !== undefined && !params.Sign) { + callback(null, { Url: url }); + return url; + } var authorization = getAuthorizationAsync.call(this, { Method: params.Method || 'get', Key: params.Key @@ -5342,12 +5322,13 @@ function decodeAcl(AccessControlPolicy) { // 生成操作 url function getUrl(params) { + var longBucket = params.bucket; + var shortBucket = longBucket.substr(0, longBucket.lastIndexOf('-')); + var appId = longBucket.substr(longBucket.lastIndexOf('-') + 1); var domain = params.domain; - var bucket = params.bucket; var region = params.region; var object = params.object; var action = params.action; - var appId = params.appId; var protocol = util.isBrowser && location.protocol === 'https:' ? 'https:' : 'http:'; if (!domain) { if (['cn-south', 'cn-south-2', 'cn-north', 'cn-east', 'cn-southwest', 'sg'].indexOf(region) > -1) { @@ -5356,7 +5337,7 @@ function getUrl(params) { domain = '{{Bucket}}-{{AppId}}.cos.{{Region}}.myqcloud.com'; } } - domain = domain.replace(/\{\{AppId\}\}/ig, appId).replace(/\{\{Bucket\}\}/ig, bucket).replace(/\{\{Region\}\}/ig, region).replace(/\{\{.*?\}\}/ig, ''); + domain = domain.replace(/\{\{AppId\}\}/ig, appId).replace(/\{\{Bucket\}\}/ig, shortBucket).replace(/\{\{Region\}\}/ig, region).replace(/\{\{.*?\}\}/ig, ''); if (!/^[a-zA-Z]+:\/\//.test(domain)) { domain = protocol + '//' + domain; } @@ -5372,6 +5353,9 @@ function getUrl(params) { if (action) { url += action; } + if (params.isLocation) { + url = url.replace(/^https?:\/\//, ''); + } return url; } @@ -5392,10 +5376,8 @@ function getAuthorizationAsync(params, callback) { } else if (self.options.getSTS) { // 外部获取临时密钥 var Bucket = params.Bucket || ''; - var AppId = params.AppId || self.options.AppId || ''; - var StsBucket = Bucket ? Bucket + '-' + AppId : ''; self._StsMap = self._StsMap || {}; - var StsData = self._StsMap[StsBucket] || {}; + var StsData = self._StsMap[Bucket] || {}; var runTemp = function () { var Authorization = util.getAuth({ SecretId: StsData.SecretId, @@ -5418,9 +5400,9 @@ function getAuthorizationAsync(params, callback) { } else { // 如果有效时间小于 60 秒就重新获取临时密钥 self.options.getSTS.call(self, { - Bucket: StsBucket + Bucket: Bucket }, function (data) { - StsData = self._StsMap[StsBucket] = data || {}; + StsData = self._StsMap[Bucket] = data || {}; runTemp(); }); } @@ -5475,8 +5457,7 @@ function _submitRequest(params, callback) { bucket: bucket, region: region, object: object, - action: action, - appId: params.AppId || self.options.AppId + action: action }), method: method, headers: headers || {}, @@ -5499,7 +5480,7 @@ function _submitRequest(params, callback) { // progress if (params.onProgress && typeof params.onProgress === 'function') { - var contentLength = body && body.size || 0; + var contentLength = body && (body.size || body.length) || 0; opt.onProgress = function (e) { if (TaskId && !self._isRunningTask(TaskId)) return; var loaded = e ? e.loaded : 0; @@ -9982,7 +9963,6 @@ function sliceUploadFile(params, callback) { var Region = params.Region; var Key = params.Key; var Body = params.Body; - var AppId = params.AppId; var SliceSize = params.SliceSize || this.options.ChunkSize; var AsyncLimit = params.AsyncLimit; var StorageClass = params.StorageClass || 'Standard'; @@ -10009,7 +9989,6 @@ function sliceUploadFile(params, callback) { Bucket: Bucket, Region: Region, Key: Key, - AppId: AppId, UploadId: data.UploadId, SliceList: data.SliceList }, function (err, data) { @@ -10028,7 +10007,6 @@ function sliceUploadFile(params, callback) { Bucket: Bucket, Region: Region, Key: Key, - AppId: AppId, Body: Body, FileSize: FileSize, SliceSize: SliceSize, @@ -10053,7 +10031,6 @@ function sliceUploadFile(params, callback) { Bucket: Bucket, Region: Region, Key: Key, - AppId: AppId, StorageClass: StorageClass, Body: Body, FileSize: FileSize, @@ -10087,7 +10064,6 @@ function getUploadIdAndPartList(params, callback) { var Bucket = params.Bucket; var Region = params.Region; var Key = params.Key; - var AppId = params.AppId; var Body = params.Body; var StorageClass = params.StorageClass; var self = this; @@ -10099,9 +10075,6 @@ function getUploadIdAndPartList(params, callback) { var SliceCount = Math.ceil(FileSize / SliceSize); var FinishSliceCount = 0; var FinishSize = 0; - var progressTimer = 0; - var time0 = 0; - var size0 = 0; var onHashProgress = util.throttleOnProgress.call(self, FileSize, params.onHashProgress); var getChunkETag = function (PartNumber, callback) { var start = SliceSize * (PartNumber - 1); @@ -10208,7 +10181,6 @@ function getUploadIdAndPartList(params, callback) { Bucket: Bucket, Region: Region, Key: Key, - AppId: AppId, StorageClass: StorageClass }); self.multipartInit(_params, function (err, data) { @@ -10232,7 +10204,6 @@ function getUploadIdAndPartList(params, callback) { Bucket: Bucket, Region: Region, Key: Key, - AppId: AppId, UploadId: UploadId }, function (err, PartListData) { if (!self._isRunningTask(TaskId)) return; @@ -10271,8 +10242,7 @@ function getUploadIdAndPartList(params, callback) { wholeMultipartList.call(self, { Bucket: Bucket, Region: Region, - Key: Key, - AppId: AppId + Key: Key }, function (err, data) { if (!self._isRunningTask(TaskId)) return; if (err) { @@ -10298,7 +10268,6 @@ function wholeMultipartList(params, callback) { var sendParams = { Bucket: params.Bucket, Region: params.Region, - AppId: params.AppId, Prefix: params.Key }; var next = function () { @@ -10326,7 +10295,6 @@ function wholeMultipartListPart(params, callback) { Bucket: params.Bucket, Region: params.Region, Key: params.Key, - AppId: params.AppId, UploadId: params.UploadId }; var next = function () { @@ -10361,7 +10329,6 @@ function uploadSliceList(params, cb) { var Bucket = params.Bucket; var Region = params.Region; var Key = params.Key; - var AppId = params.AppId; var UploadData = params.UploadData; var FileSize = params.FileSize; var SliceSize = params.SliceSize; @@ -10388,7 +10355,6 @@ function uploadSliceList(params, cb) { Bucket: Bucket, Region: Region, Key: Key, - AppId: AppId, SliceSize: SliceSize, FileSize: FileSize, PartNumber: PartNumber, @@ -10431,7 +10397,6 @@ function uploadSliceItem(params, callback) { var Bucket = params.Bucket; var Region = params.Region; var Key = params.Key; - var AppId = params.AppId; var FileSize = params.FileSize; var FileBody = params.Body; var PartNumber = params.PartNumber * 1; @@ -10461,7 +10426,6 @@ function uploadSliceItem(params, callback) { Bucket: Bucket, Region: Region, Key: Key, - AppId: AppId, ContentLength: ContentLength, ContentSha1: ContentSha1, PartNumber: PartNumber, @@ -10488,7 +10452,6 @@ function uploadSliceComplete(params, callback) { var Bucket = params.Bucket; var Region = params.Region; var Key = params.Key; - var AppId = params.AppId; var UploadId = params.UploadId; var SliceList = params.SliceList; var self = this; @@ -10503,7 +10466,6 @@ function uploadSliceComplete(params, callback) { Bucket: Bucket, Region: Region, Key: Key, - AppId: AppId, UploadId: UploadId, Parts: Parts }, function (err, data) { @@ -10525,7 +10487,6 @@ function abortUploadTask(params, callback) { var Bucket = params.Bucket; var Region = params.Region; var Key = params.Key; - var AppId = params.AppId; var UploadId = params.UploadId; var Level = params.Level || 'task'; var AsyncLimit = params.AsyncLimit; @@ -10543,7 +10504,6 @@ function abortUploadTask(params, callback) { Bucket: Bucket, Region: Region, Key: Key, - AppId: AppId, AsyncLimit: AsyncLimit, AbortArray: AbortArray }, function (err, data) { diff --git a/dist/cos-js-sdk-v5.min.js b/dist/cos-js-sdk-v5.min.js index 2c53e52..2d74eed 100644 --- a/dist/cos-js-sdk-v5.min.js +++ b/dist/cos-js-sdk-v5.min.js @@ -1,7 +1,7 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.COS=t():e.COS=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=5)}([function(e,t,n){"use strict";(function(t,r){function o(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function i(e){return c(e,function(e){return"object"==typeof e?i(e):e})}function a(e,t){return u(t,function(n,r){e[r]=t[r]}),e}function s(e){return e instanceof Array}function u(e,t){for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)}function c(e,t){var n=s(e)?[]:{};for(var r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r],r));return n}function l(e,t){var n=s(e),r=n?[]:{};for(var o in e)e.hasOwnProperty(o)&&t(e[o],o)&&(n?r.push(e[o]):r[o]=e[o]);return r}var d=n(10),f=n(11),p=n(12),h=n(13),g=function(e){e=e||{};var t=e.SecretId,n=e.SecretKey,r=(e.method||e.Method||"get").toLowerCase(),i=e.pathname||e.Key||"/",a=e.params||"",s=e.headers||"";if(0!==i.indexOf("/")&&(i="/"+i),!t)return console.error("lack of param SecretId");if(!n)return console.error("lack of param SecretKey");var u=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t.sort()},c=function(e){var t,n,r,i=[],a=u(e);for(t=0;t-1||"deleteMultipleObject"===e||"multipartList"===e?n&&r:!(e.indexOf("Object")>-1||e.indexOf("multipart")>-1||"sliceUploadFile"===e||"abortUploadTask"===e)||n&&r&&o},x=function(e,t){var n={gz:"ap-guangzhou",tj:"ap-beijing-2",sh:"ap-shanghai",cd:"ap-chengdu"};return function(r,o){if(o=o||function(){},"getService"!==e&&"abortUploadTask"!==e){if(!b(e,r))return void o({error:"lack of required params"});if(r.Region&&n[r.Region])return void o({error:"Region should be "+n[r.Region]});if(r.Region&&r.Region.indexOf("cos.")>-1)return void o({error:'Region should not be start with "cos."'});var i,a,s=r.Bucket;s&&((a=s.match(/^(.+)-(\d+)$/))?(i=a[2],s=a[1],r.AppId=i,r.Bucket=s):r.AppId||(this.options.AppId?r.AppId=this.options.AppId:o({error:'Bucket should format as "test-1250000000".'}))),r.Key&&"/"===r.Key.substr(0,1)&&(r.Key=r.Key.substr(1))}var u=t.call(this,r,o);if("getAuth"===e||"getObjectUrl"===e)return u}},w=function(e,t){function n(){if(o=0,t&&"function"==typeof t){r=Date.now();var n,i=Math.max(0,Math.round((s-a)/((r-u)/1e3)*100)/100);n=0===s&&0===e?1:Math.round(s/e*100)/100||0,u=r,a=s;try{t({loaded:s,total:e,speed:i,percent:n})}catch(e){}}}var r,o,i=this,a=0,s=0,u=Date.now();return function(t,r){if(t&&(s=t.loaded,e=t.total),r)clearTimeout(o),n();else{if(o)return;o=setTimeout(n,i.options.ProgressInterval)}}},k=function(e,t,n){return e.slice?e.slice(t,n):e.mozSlice?e.mozSlice(t,n):e.webkitSlice?e.webkitSlice(t,n):void 0},R={apiWrapper:x,getAuth:g,xml2json:p,json2xml:h,md5:d,clearKey:y,getFileMd5:m,binaryBase64:C,extend:a,isArray:s,each:u,map:c,filter:l,clone:i,uuid:A,fileSlice:k,throttleOnProgress:w,isBrowser:!!r.document};e.exports=R}).call(t,n(2).Buffer,n(1))},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";(function(e){function r(){return i.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(r()=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function g(e){return+e!=e&&(e=0),i.alloc(+e)}function y(e,t){if(i.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return W(e).length;default:if(r)return q(e).length;t=(""+t).toLowerCase(),r=!0}}function v(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return B(this,t,n);case"latin1":case"binary":return _(this,t,n);case"base64":return S(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function C(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=i.from(t,r)),i.isBuffer(t))return 0===t.length?-1:A(e,t,n,r,o);if("number"==typeof t)return t&=255,i.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):A(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function A(e,t,n,r,o){function i(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}var c;if(o){var l=-1;for(c=n;cs&&(n=s-u),c=n;c>=0;c--){for(var d=!0,f=0;fo&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a239?4:i>223?3:i>191?2:1;if(o+s<=n){var u,c,l,d;switch(s){case 1:i<128&&(a=i);break;case 2:u=e[o+1],128==(192&u)&&(d=(31&i)<<6|63&u)>127&&(a=d);break;case 3:u=e[o+1],c=e[o+2],128==(192&u)&&128==(192&c)&&(d=(15&i)<<12|(63&u)<<6|63&c)>2047&&(d<55296||d>57343)&&(a=d);break;case 4:u=e[o+1],c=e[o+2],l=e[o+3],128==(192&u)&&128==(192&c)&&128==(192&l)&&(d=(15&i)<<18|(63&u)<<12|(63&c)<<6|63&l)>65535&&d<1114112&&(a=d)}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),o+=s}return E(r)}function E(e){var t=e.length;if(t<=Q)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,n,r,o,a){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function U(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function O(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function M(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(e,t,n,r,o){return o||M(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,n,r,23,4),n+4}function F(e,t,n,r,o){return o||M(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,n,r,52,8),n+8}function K(e){if(e=z(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function H(e){return e<16?"0"+e.toString(16):e.toString(16)}function q(e,t){t=t||1/0;for(var n,r=e.length,o=null,i=[],a=0;a55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){for(var t=[],n=0;n>8,o=n%256,i.push(o),i.push(r);return i}function W(e){return V.toByteArray(K(e))}function X(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function $(e){return e!==e}/*! +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.COS=t():e.COS=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=5)}([function(e,t,n){"use strict";(function(t,r){function o(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function i(e){return c(e,function(e){return"object"==typeof e?i(e):e})}function a(e,t){return u(t,function(n,r){e[r]=t[r]}),e}function s(e){return e instanceof Array}function u(e,t){for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)}function c(e,t){var n=s(e)?[]:{};for(var r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r],r));return n}function l(e,t){var n=s(e),r=n?[]:{};for(var o in e)e.hasOwnProperty(o)&&t(e[o],o)&&(n?r.push(e[o]):r[o]=e[o]);return r}var f=n(10),d=n(11),h=n(12),p=n(13),g=function(e){e=e||{};var t=e.SecretId,n=e.SecretKey,r=(e.method||e.Method||"get").toLowerCase(),i=e.pathname||e.Key||"/",a=e.params||"",s=e.headers||"";if(0!==i.indexOf("/")&&(i="/"+i),!t)return console.error("lack of param SecretId");if(!n)return console.error("lack of param SecretKey");var u=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t.sort()},c=function(e){var t,n,r,i=[],a=u(e);for(t=0;t-1||"deleteMultipleObject"===e||"multipartList"===e?n&&r:!(e.indexOf("Object")>-1||e.indexOf("multipart")>-1||"sliceUploadFile"===e||"abortUploadTask"===e)||n&&r&&o},w=function(e,t){var n={gz:"ap-guangzhou",tj:"ap-beijing-2",sh:"ap-shanghai",cd:"ap-chengdu"};return function(r,o){if(o=o||function(){},"getService"!==e&&"abortUploadTask"!==e){if(!x(e,r))return void o({error:"lack of required params"});if(r.Region&&n[r.Region])return void o({error:"Region should be "+n[r.Region]});if(r.Region&&r.Region.indexOf("cos.")>-1)return void o({error:'Region should not be start with "cos."'});if(r.Bucket){if(!/^(.+)-(\d+)$/.test(r.Bucket))if(r.AppId)r.Bucket=r.Bucket+"-"+r.AppId;else{if(!this.options.AppId)return void o({error:'Bucket should format as "test-1250000000".'});r.Bucket=r.Bucket+"-"+this.options.AppId}r.AppId&&(console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g Bucket:"test-1250000000" ).'),delete r.AppId)}r.Key&&"/"===r.Key.substr(0,1)&&(r.Key=r.Key.substr(1))}var i=t.call(this,r,o);if("getAuth"===e||"getObjectUrl"===e)return i}},k=function(e,t){function n(){if(o=0,t&&"function"==typeof t){r=Date.now();var n,i=Math.max(0,Math.round((s-a)/((r-u)/1e3)*100)/100);n=0===s&&0===e?1:Math.round(s/e*100)/100||0,u=r,a=s;try{t({loaded:s,total:e,speed:i,percent:n})}catch(e){}}}var r,o,i=this,a=0,s=0,u=Date.now();return function(t,r){if(t&&(s=t.loaded,e=t.total),r)clearTimeout(o),n();else{if(o)return;o=setTimeout(n,i.options.ProgressInterval)}}},R=function(e,t,n){return e.slice?e.slice(t,n):e.mozSlice?e.mozSlice(t,n):e.webkitSlice?e.webkitSlice(t,n):void 0},T={apiWrapper:w,getAuth:g,xml2json:h,json2xml:p,md5:f,clearKey:y,getFileMd5:m,binaryBase64:C,extend:a,isArray:s,each:u,map:c,filter:l,clone:i,uuid:b,throttleOnProgress:k,isBrowser:!!r.document,fileSlice:R};e.exports=T}).call(t,n(2).Buffer,n(1))},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";(function(e){function r(){return i.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(r()=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function g(e){return+e!=e&&(e=0),i.alloc(+e)}function y(e,t){if(i.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return W(e).length;default:if(r)return q(e).length;t=(""+t).toLowerCase(),r=!0}}function v(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return L(this,t,n);case"utf8":case"utf-8":return B(this,t,n);case"ascii":return _(this,t,n);case"latin1":case"binary":return P(this,t,n);case"base64":return S(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function C(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=i.from(t,r)),i.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"==typeof t)return t&=255,i.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,o){function i(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}var c;if(o){var l=-1;for(c=n;cs&&(n=s-u),c=n;c>=0;c--){for(var f=!0,d=0;do&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a239?4:i>223?3:i>191?2:1;if(o+s<=n){var u,c,l,f;switch(s){case 1:i<128&&(a=i);break;case 2:u=e[o+1],128==(192&u)&&(f=(31&i)<<6|63&u)>127&&(a=f);break;case 3:u=e[o+1],c=e[o+2],128==(192&u)&&128==(192&c)&&(f=(15&i)<<12|(63&u)<<6|63&c)>2047&&(f<55296||f>57343)&&(a=f);break;case 4:u=e[o+1],c=e[o+2],l=e[o+3],128==(192&u)&&128==(192&c)&&128==(192&l)&&(f=(15&i)<<18|(63&u)<<12|(63&c)<<6|63&l)>65535&&f<1114112&&(a=f)}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),o+=s}return E(r)}function E(e){var t=e.length;if(t<=Q)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,n,r,o,a){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function U(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function O(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function M(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(e,t,n,r,o){return o||M(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,n,r,23,4),n+4}function F(e,t,n,r,o){return o||M(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,n,r,52,8),n+8}function K(e){if(e=z(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function H(e){return e<16?"0"+e.toString(16):e.toString(16)}function q(e,t){t=t||1/0;for(var n,r=e.length,o=null,i=[],a=0;a55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){for(var t=[],n=0;n>8,o=n%256,i.push(o),i.push(r);return i}function W(e){return V.toByteArray(K(e))}function X(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function $(e){return e!==e}/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -var V=n(7),J=n(8),Z=n(9);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=r(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,n){return a(null,e,t,n)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,n){return u(null,e,t,n)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,a=Math.min(n,r);o0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},i.prototype.compare=function(e,t,n,r,o){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,o>>>=0,this===e)return 0;for(var a=o-r,s=n-t,u=Math.min(a,s),c=this.slice(r,o),l=e.slice(t,n),d=0;do)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return k(this,e,t,n);case"base64":return R(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;i.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(o*=256);)r+=this[e+--t]*o;return r},i.prototype.readUInt8=function(e,t){return t||j(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||j(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||j(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var r=this[e],o=1,i=0;++i=o&&(r-=Math.pow(2,8*t)),r},i.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},i.prototype.readInt8=function(e,t){return t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||j(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(e,t){t||j(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(e,t){return t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return t||j(e,4,this.length),J.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||j(e,4,this.length),J.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||j(e,8,this.length),J.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||j(e,8,this.length),J.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){D(this,e,t,n,Math.pow(2,8*n)-1,0)}var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},i.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):U(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):U(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):O(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);D(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},i.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);D(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},i.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):U(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):U(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):O(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,n){return N(this,e,t,!0,n)},i.prototype.writeFloatBE=function(e,t,n){return N(this,e,t,!1,n)},i.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},i.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},i.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(a<1e3||!i.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;a=0;o--)t===r[o]&&r.splice(o,1)},e.emit=function(e,t){for(var r=n(e).map(function(e){return e}),o=0;o0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function o(e){return 3*e.length/4-r(e)}function i(e){var t,n,o,i,a,s=e.length;i=r(e),a=new d(3*s/4-i),n=i>0?s-4:s;var u=0;for(t=0;t>16&255,a[u++]=o>>8&255,a[u++]=255&o;return 2===i?(o=l[e.charCodeAt(t)]<<2|l[e.charCodeAt(t+1)]>>4,a[u++]=255&o):1===i&&(o=l[e.charCodeAt(t)]<<10|l[e.charCodeAt(t+1)]<<4|l[e.charCodeAt(t+2)]>>2,a[u++]=o>>8&255,a[u++]=255&o),a}function a(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}function s(e,t,n){for(var r,o=[],i=t;iu?u:a+16383));return 1===r?(t=e[n-1],o+=c[t>>2],o+=c[t<<4&63],o+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],o+=c[t>>10],o+=c[t>>4&63],o+=c[t<<2&63],o+="="),i.push(o),i.join("")}t.byteLength=o,t.toByteArray=i,t.fromByteArray=u;for(var c=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,h=f.length;p>1,l=-7,d=n?o-1:0,f=n?-1:1,p=e[t+d];for(d+=f,i=p&(1<<-l)-1,p>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=f,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=f,l-=8);if(0===i)i=1-c;else{if(i===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=c}return(p?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,u,c=8*i-o-1,l=(1<>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,h=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),t+=a+d>=1?f/u:f*Math.pow(2,1-d),t*u>=2&&(a++,u/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*u-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&s,p+=h,s/=256,o-=8);for(a=a<0;e[n+p]=255&a,p+=h,a/=256,c-=8);e[n+p-h]|=128*g}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){var n=function(e){function t(e,t){return e<>>32-t}function n(e,t){var n,r,o,i,a;return o=2147483648&e,i=2147483648&t,n=1073741824&e,r=1073741824&t,a=(1073741823&e)+(1073741823&t),n&r?2147483648^a^o^i:n|r?1073741824&a?3221225472^a^o^i:1073741824^a^o^i:a^o^i}function r(e,t,n){return e&t|~e&n}function o(e,t,n){return e&n|t&~n}function i(e,t,n){return e^t^n}function a(e,t,n){return t^(e|~n)}function s(e,o,i,a,s,u,c){return e=n(e,n(n(r(o,i,a),s),c)),n(t(e,u),o)}function u(e,r,i,a,s,u,c){return e=n(e,n(n(o(r,i,a),s),c)),n(t(e,u),r)}function c(e,r,o,a,s,u,c){return e=n(e,n(n(i(r,o,a),s),c)),n(t(e,u),r)}function l(e,r,o,i,s,u,c){return e=n(e,n(n(a(r,o,i),s),c)),n(t(e,u),r)}function d(e){var t,n,r="",o="";for(n=0;n<=3;n++)t=e>>>8*n&255,o="0"+t.toString(16),r+=o.substr(o.length-2,2);return r}var f,p,h,g,y,v,m,C,A,b=Array();for(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}(e),b=function(e){for(var t,n=e.length,r=n+8,o=(r-r%64)/64,i=16*(o+1),a=Array(i-1),s=0,u=0;u>>29,a}(e),v=1732584193,m=4023233417,C=2562383102,A=271733878,f=0;f>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(r+o)%4*8;else if(65535>>2]=n[o>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;r>>2]>>>24-r%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new a.init(n,t/2)}},c=s.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new a.init(n,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},d=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,o=n.sigBytes,i=this.blockSize,s=o/(4*i),s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0);if(t=s*i,o=e.min(4*t,o),t){for(var u=0;uc;c++){if(16>c)i[c]=0|e[t+c];else{var l=i[c-3]^i[c-8]^i[c-14]^i[c-16];i[c]=l<<1|l>>>31}l=(r<<5|r>>>27)+u+i[c],l=20>c?l+(1518500249+(o&a|~o&s)):40>c?l+(1859775393+(o^a^s)):60>c?l+((o&a|o&s|a&s)-1894007588):l+((o^a^s)-899497514),u=s,s=a,a=o<<30|o>>>2,o=r,r=l}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+s|0,n[4]=n[4]+u|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=o._createHelper(t),e.HmacSHA1=o._createHmacHelper(t)}(),function(){var e=r,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,o=4*r;n.sigBytes>o&&(n=e.finalize(n)),n.clamp();for(var i=this._oKey=n.clone(),a=this._iKey=n.clone(),s=i.words,u=a.words,c=0;c>>2]>>>24-i%4*8&255,s=t[i+1>>>2]>>>24-(i+1)%4*8&255,u=t[i+2>>>2]>>>24-(i+2)%4*8&255,c=a<<16|s<<8|u,l=0;l<4&&i+.75*l>>6*(3-l)&63));var d=r.charAt(64);if(d)for(;o.length%4;)o.push(d);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=r.charAt(64);if(o){var i=e.indexOf(o);-1!=i&&(t=i)}for(var a=[],s=0,u=0;u>>6-u%4*2;a[s>>>2]|=(c|l)<<24-s%4*8,s++}return n.create(a,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.exports=r},function(e,t){var n=function(){this.version="1.3.5";var e={mergeCDATA:!0,normalize:!0,stripElemPrefix:!0},t=new RegExp(/(?!xmlns)^.*:/),r=new RegExp(/^\s+|\s+$/g);return this.grokType=function(e){return/^\s*$/.test(e)?null:/^(?:true|false)$/i.test(e)?"true"===e.toLowerCase():isFinite(e)?parseFloat(e):e},this.parseString=function(e,t){if(e){var n=this.stringToXML(e);return n.getElementsByTagName("parsererror").length?null:this.parseXML(n,t)}return null},this.parseXML=function(o,i){for(var a in i)e[a]=i[a];var s={},u=0,c="";if(o.childNodes.length)for(var l,d,f,p=0;p/g,">").replace(/'/g,"'").replace(/"/g,""").replace(o,"")}var r=new RegExp("^([^a-zA-Z_À-ÖØ-öø-ÿͰ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿿、-퟿豈-﷏ﷰ-�])|^((x|X)(m|M)(l|L))|([^a-zA-Z_À-ÖØ-öø-ÿͰ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿿、-퟿豈-﷏ﷰ-�-.0-9·̀-ͯ‿⁀])","g"),o=/[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm,i=function(e){var t=[];if(e instanceof Object)for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t},a=function(e,t){var o=function(e,n,o,i,a){var s=void 0!==t.indent?t.indent:"\t",u=t.prettyPrint?"\n"+new Array(i).join(s):"";t.removeIllegalNameCharacters&&(e=e.replace(r,"_"));var c=[u,"<",e,o||""];return n&&n.length>0?(c.push(">"),c.push(n),a&&c.push(u),c.push("")):c.push("/>"),c.join("")};return function e(r,a,s){var u=typeof r;switch((Array.isArray?Array.isArray(r):r instanceof Array)?u="array":r instanceof Date&&(u="date"),u){case"array":var c=[];return r.map(function(t){c.push(e(t,1,s+1))}),t.prettyPrint&&c.push("\n"),c.join("");case"date":return r.toJSON?r.toJSON():r+"";case"object":var l=[];for(var d in r)if(r[d]instanceof Array)for(var f in r[d])l.push(o(d,e(r[d][f],0,s+1),null,s+1,i(r[d][f]).length));else l.push(o(d,e(r[d],0,s+1),null,s+1));return t.prettyPrint&&l.length>0&&l.push("\n"),l.join("");case"function":return r();default:return t.escape?n(r):""+r}}(e,0,0)},s=function(e){var t=['"),t.join("")};e.exports=function(e,t){t||(t={xmlHeader:{standalone:!0},prettyPrint:!0,indent:" "});var n=this.Buffer||function(){};if("string"==typeof e||e instanceof n)try{e=JSON.parse(e.toString())}catch(e){return!1}var r="",o="";return t&&("object"==typeof t?(t.xmlHeader&&(r=s(!!t.xmlHeader.standalone)),void 0!==t.docType&&(o="")):r=s()),t=t||{},[r,t.prettyPrint&&o?"\n":"",o,a(e,t)].join("").replace(/\n{2,}/g,"\n").replace(/\s+$/g,"")}},function(e,t,n){var r=n(0),o=function(e){var t=[],n={},o=0,i=0,a={};r.each(["putObject","sliceUploadFile"],function(t){a[t]=e[t],e[t]=function(n,r){e._addTask(t,n,r)}});var s=function(e){var t={id:e.id,Bucket:e.Bucket,Region:e.Region,Key:e.Key,FilePath:e.FilePath,state:e.state,loaded:e.loaded,size:e.size,speed:e.speed,percent:e.percent,hashPercent:e.hashPercent,error:e.error};return e.FilePath&&(t.FilePath=e.FilePath),t},u=function(){e.emit("task-list-update",{list:r.map(t,s)}),e.emit("list-update",{list:r.map(t,s)})},c=function(){if(i-1&&(i[a]=t[a]);var s=t.Body;if(J.isBrowser&&("string"==typeof s||s instanceof e.Blob||s instanceof e.File))i["Content-Length"]=s.length;else if(s&&s instanceof r)i["Content-Length"]=s.length;else if(s&&"function"==typeof s.pipe){if(s,s=null,void 0===i["Content-Length"])return void n({error:"lack of param ContentLength"})}else{if(!s||"string"!=typeof s||!J.isBrowser)return void n({error:"params body format error, Only allow Buffer, Stream, Blob."});i["Content-Length"]=s.length}var u=J.throttleOnProgress.call(o,i["Content-Length"],t.onProgress);W.call(this,{TaskId:t.TaskId,method:"PUT",Bucket:t.Bucket,Region:t.Region,AppId:t.AppId,Key:t.Key,headers:i,body:s,onProgress:u},function(e,r){if(u(null,!0),e)return n(e);if(r&&r.headers&&r.headers.etag){var i=G({domain:o.options.Domain,bucket:t.Bucket,region:t.Region,appId:t.AppId,object:t.Key});return n(null,{Location:i,ETag:r.headers.etag,statusCode:r.statusCode,headers:r.headers})}n(null,r)})}function E(e,t){W.call(this,{method:"DELETE",Bucket:e.Bucket,Region:e.Region,AppId:e.AppId,Key:e.Key},function(e,n){if(e){var r=e.statusCode;return r&&204===r?t(null,{statusCode:r}):r&&404===r?t(null,{BucketNotFound:!0,statusCode:r}):t(e)}t(null,{statusCode:n.statusCode,headers:n.headers})})}function B(e,t){W.call(this,{method:"GET",Bucket:e.Bucket,Region:e.Region,AppId:e.AppId,Key:e.Key,action:"?acl"},function(e,n){if(e)return t(e);var r=n.AccessControlPolicy.Owner||{},o=n.AccessControlPolicy.AccessControlList.Grant||[];o=J.isArray(o)?o:[o];var i=q(n.AccessControlPolicy);n.headers&&n.headers["x-cos-acl"]&&(i.ACL=n.headers["x-cos-acl"]),i=J.extend(i,{Owner:r,Grants:o,statusCode:n.statusCode,headers:n.headers}),t(null,i)})}function _(e,t){var n={};n["x-cos-acl"]=e.ACL,n["x-cos-grant-read"]=e.GrantRead,n["x-cos-grant-write"]=e.GrantWrite,n["x-cos-grant-full-control"]=e.GrantFullControl;var r="";if(e.AccessControlPolicy){var o=J.clone(e.AccessControlPolicy||{}),i=o.Grants||o.Grant;i=J.isArray(i)?i:[i],delete o.Grant,delete o.Grants,o.AccessControlList={Grant:i},r=J.json2xml({AccessControlPolicy:o}),n["Content-MD5"]=J.binaryBase64(J.md5(r)),n["Content-Type"]="application/xml"}W.call(this,{method:"PUT",Bucket:e.Bucket,Region:e.Region,AppId:e.AppId,Key:e.Key,action:"?acl",headers:n,body:r},function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})})}function P(e,t){var n={};n.Origin=e.Origin,n["Access-Control-Request-Method"]=e.AccessControlRequestMethod,n["Access-Control-Request-Headers"]=e.AccessControlRequestHeaders,W.call(this,{method:"OPTIONS",Bucket:e.Bucket,Region:e.Region,AppId:e.AppId,Key:e.Key,headers:n},function(e,n){if(e)return e.statusCode&&403==e.statusCode?t(null,{OptionsForbidden:!0,statusCode:e.statusCode}):t(e);var r=n.headers||{};t(null,{AccessControlAllowOrigin:r["access-control-allow-origin"],AccessControlAllowMethods:r["access-control-allow-methods"],AccessControlAllowHeaders:r["access-control-allow-headers"],AccessControlExposeHeaders:r["access-control-expose-headers"],AccessControlMaxAge:r["access-control-max-age"],statusCode:n.statusCode,headers:n.headers})})}function L(e,t){var n={};n["x-cos-copy-source"]=e.CopySource,n["x-cos-metadata-directive"]=e.MetadataDirective,n["x-cos-copy-source-If-Modified-Since"]=e.CopySourceIfModifiedSince,n["x-cos-copy-source-If-Unmodified-Since"]=e.CopySourceIfUnmodifiedSince,n["x-cos-copy-source-If-Match"]=e.CopySourceIfMatch,n["x-cos-copy-source-If-None-Match"]=e.CopySourceIfNoneMatch,n["x-cos-storage-class"]=e.StorageClass,n["x-cos-acl"]=e.ACL,n["x-cos-grant-read"]=e.GrantRead,n["x-cos-grant-write"]=e.GrantWrite,n["x-cos-grant-full-control"]=e.GrantFullControl,n["Cache-Control"]=e.CacheControl,n["Content-Disposition"]=e.ContentDisposition,n["Content-Encoding"]=e.ContentEncoding,n["Content-Length"]=e.ContentLength,n["Content-Type"]=e.ContentType,n.Expect=e.Expect,n.Expires=e.Expires;for(var r in e)r.indexOf("x-cos-meta-")>-1&&(n[r]=e[r]);W.call(this,{method:"PUT",Bucket:e.Bucket,Region:e.Region,AppId:e.AppId,Key:e.Key,headers:n},function(e,n){if(e)return t(e);var r=J.clone(n.CopyObjectResult);J.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)})}function j(e,t){var n={};n["x-cos-copy-source"]=e.CopySource,n["x-cos-copy-source-Range"]=e.CopySourceRange,n["x-cos-copy-source-If-Modified-Since"]=e.CopySourceIfModifiedSince,n["x-cos-copy-source-If-Unmodified-Since"]=e.CopySourceIfUnmodifiedSince,n["x-cos-copy-source-If-Match"]=e.CopySourceIfMatch,n["x-cos-copy-source-If-None-Match"]=e.CopySourceIfNoneMatch;var r="?partNumber="+e.PartNumber+"&uploadId="+e.UploadId;W.call(this,{method:"PUT",Bucket:e.Bucket,Region:e.Region,AppId:e.AppId,Key:e.Key,action:r,headers:n},function(e,n){if(e)return t(e);var r=J.clone(n.CopyObjectResult);J.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)})}function D(e,t){var n={};n["Content-Type"]="application/xml";var o=e.Objects||{},i=e.Quiet,a={Delete:{Object:o,Quiet:i||!1}},s=J.json2xml(a);n["Content-MD5"]=J.binaryBase64(J.md5(s)),n["Content-Length"]=r.byteLength(s,"utf8"),W.call(this,{method:"POST",Bucket:e.Bucket,Region:e.Region,AppId:e.AppId,body:s,action:"/?delete",headers:n},function(e,n){if(e)return t(e);var r=n.DeleteResult.Deleted||[],o=n.DeleteResult.Error||[];r=J.isArray(r)?r:[r],o=J.isArray(o)?o:[o];var i=J.clone(n.DeleteResult);J.extend(i,{Error:o,Deleted:r,statusCode:n.statusCode,headers:n.headers}),t(null,i)})}function U(e,t){var n={};n["Cache-Control"]=e.CacheControl,n["Content-Disposition"]=e.ContentDisposition,n["Content-Encoding"]=e.ContentEncoding,n["Content-Type"]=e.ContentType,n.Expires=e.Expires,n["x-cos-acl"]=e.ACL,n["x-cos-grant-read"]=e.GrantRead,n["x-cos-grant-write"]=e.GrantWrite,n["x-cos-grant-full-control"]=e.GrantFullControl,n["x-cos-storage-class"]=e.StorageClass;for(var r in e)r.indexOf("x-cos-meta-")>-1&&(n[r]=e[r]);W.call(this,{method:"POST",Bucket:e.Bucket,Region:e.Region,AppId:e.AppId,Key:e.Key,action:"?uploads",headers:n},function(e,n){return e?t(e):(n=J.clone(n||{}))&&n.InitiateMultipartUploadResult?t(null,J.extend(n.InitiateMultipartUploadResult,{statusCode:n.statusCode,headers:n.headers})):void t(null,n)})}function O(e,t){var n={};n["Content-Length"]=e.ContentLength,n.Expect=e.Expect;var r=e.PartNumber,o=e.UploadId,i="?partNumber="+r+"&uploadId="+o;W.call(this,{TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,AppId:e.AppId,Key:e.Key,action:i,headers:n,onProgress:e.onProgress,body:e.Body||null},function(e,n){if(e)return t(e);n.headers=n.headers||{},t(null,{ETag:n.headers.etag||"",statusCode:n.statusCode,headers:n.headers})})}function M(e,t){var n=this,o={};o["Content-Type"]="application/xml";for(var i=e.UploadId,a="?uploadId="+i,s=e.Parts,u=0,c=s.length;u-1?"{{Bucket}}-{{AppId}}.{{Region}}.myqcloud.com":"{{Bucket}}-{{AppId}}.cos.{{Region}}.myqcloud.com"),t=t.replace(/\{\{AppId\}\}/gi,a).replace(/\{\{Bucket\}\}/gi,n).replace(/\{\{Region\}\}/gi,r).replace(/\{\{.*?\}\}/gi,""),/^[a-zA-Z]+:\/\//.test(t)||(t=s+"//"+t),"/"===t.slice(-1)&&(t=t.slice(0,-1));var u=t;return o&&(u+="/"+encodeURIComponent(o).replace(/%2F/g,"/")),i&&(u+=i),e.isLocation&&(u=u.replace(/^https?:\/\//,"")),u}function Y(e,t){var n=this;if(n.options.getAuthorization)n.options.getAuthorization.call(n,{Method:e.Method,Key:e.Key},function(e){"string"==typeof e&&(e={Authorization:e}),t&&t(e)});else{if(!n.options.getSTS){var r=J.getAuth({SecretId:e.SecretId||n.options.SecretId,SecretKey:e.SecretKey||n.options.SecretKey,Method:e.Method,Key:e.Key});return t&&t({Authorization:r}),r}var o=e.Bucket||"",i=e.AppId||n.options.AppId||"",a=o?o+"-"+i:"";n._StsMap=n._StsMap||{};var s=n._StsMap[a]||{},u=function(){var n=J.getAuth({SecretId:s.SecretId,SecretKey:s.SecretKey,Method:e.Method,Key:e.Key}),r={Authorization:n,XCosSecurityToken:s.XCosSecurityToken||"",Token:s.Token||"",ClientIP:s.ClientIP||"",ClientUA:s.ClientUA||""};t&&t(r)};s.ExpiredTime&&s.ExpiredTime-(Date.now()/1e3>60)?u():n.options.getSTS.call(n,{Bucket:a},function(e){s=n._StsMap[a]=e||{},u()})}return""}function W(e,t){var n=this;Y.call(n,{Method:e.method,Key:e.Key},function(r){e.AuthData=r,X.call(n,e,t)})}function X(e,t){var n=this,r=e.TaskId;if(!r||n._isRunningTask(r)){var o=e.Bucket,i=e.Region,a=e.Key,s=e.action,u=e.method||"GET",c=e.headers||{},l=e.url,d=e.body,f=e.json,p=e.rawBody,h=e.qs,g={url:l||G({domain:n.options.Domain,bucket:o,region:i,object:a,action:s,appId:e.AppId||n.options.AppId}),method:u,headers:c||{},qs:h,body:d,json:f};if(g.headers.Authorization=e.AuthData.Authorization,e.AuthData.Token&&(g.headers.token=e.AuthData.Token),e.AuthData.ClientIP&&(g.headers.clientIP=e.AuthData.ClientIP),e.AuthData.ClientUA&&(g.headers.clientUA=e.AuthData.ClientUA),e.AuthData.XCosSecurityToken&&(g.headers["x-cos-security-token"]=e.AuthData.XCosSecurityToken),g.headers&&(g.headers=J.clearKey(g.headers)),g.qs&&(g.qs=J.clearKey(g.qs)),g=J.clearKey(g),e.onProgress&&"function"==typeof e.onProgress){var y=d&&d.size||0;g.onProgress=function(t){if(!r||n._isRunningTask(r)){var o=t?t.loaded:0;e.onProgress({loaded:o,total:y})}}}var v=V(g,function(e,o,i){var a=function(e,i){r&&n.off("inner-kill-task",m),r&&!n._isRunningTask(r)||(e?(e=e||{},o&&o.statusCode&&(e.statusCode=o.statusCode),o&&o.headers&&(e.headers=o.headers),t(e,null)):(i=i||{},o&&o.statusCode&&(i.statusCode=o.statusCode),o&&o.headers&&(i.headers=o.headers),t(null,i)))};if(e)return void a({error:e});var s;try{s=J.xml2json(i)||{}}catch(e){s=i||{}}var u=o.statusCode;return 200!==u&&204!==u&&206!==u?void a({error:s.Error||s}):(p&&(s={},s.body=i),s.Error?void a({error:s.Error}):void a(null,s))}),m=function(e){e.TaskId===r&&(v&&v.abort&&v.abort(),n.off("inner-kill-task",m))};r&&n.on("inner-kill-task",m)}}var $=n(4),V=n(18),J=n(0),Z={getBucket:i,headBucket:o,deleteBucket:a,getBucketAcl:s,putBucketAcl:u,getBucketCors:c,putBucketCors:l,deleteBucketCors:d,getBucketLocation:p,putBucketTagging:y,getBucketTagging:g,deleteBucketTagging:v,getBucketPolicy:h,putBucketPolicy:f,getBucketLifecycle:C,putBucketLifecycle:m,deleteBucketLifecycle:A,putBucketVersioning:b,getBucketVersioning:x,putBucketReplication:w,getBucketReplication:k,deleteBucketReplication:R,getObject:S,headObject:T,putObject:I,deleteObject:E,getObjectAcl:B,putObjectAcl:_,optionsObject:P,putObjectCopy:L,uploadPartCopy:j,multipartInit:U,multipartUpload:O,multipartComplete:M,multipartList:N,multipartListPart:F,multipartAbort:K,deleteMultipleObject:D,getObjectUrl:H,getAuth:z};J.each(Z,function(e,n){t[n]=J.apiWrapper(n,e)})}).call(t,n(1),n(2).Buffer)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l=0?(d=g.substr(0,y),f=g.substr(y+1)):(d=g,f=""),p=decodeURIComponent(d),h=decodeURIComponent(f),r(a,p)?o(a[p])?a[p].push(h):a[p]=[a[p],h]:a[p]=h}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";function r(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r0&&t-1 in e))}function t(e){var t=O[e]={};return I.each(e.match(U)||[],function(e,n){t[n]=!0}),t}function n(){j.addEventListener?(j.removeEventListener("DOMContentLoaded",r,!1),window.removeEventListener("load",r,!1)):(j.detachEvent("onreadystatechange",r),window.detachEvent("onload",r))}function r(){(j.addEventListener||"load"===event.type||"complete"===j.readyState)&&(n(),I.ready())}function o(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(K,"-$1").toLowerCase();if("string"==typeof(n=e.getAttribute(r))){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:F.test(n)?I.parseJSON(n):n)}catch(e){}I.data(e,t,n)}else n=void 0}return n}function i(e){var t;for(t in e)if(("data"!==t||!I.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function a(e,t,n,r){if(I.acceptData(e)){var o,i,a=I.expando,s=e.nodeType,u=s?I.cache:e,c=s?e[a]:e[a]&&a;if(c&&u[c]&&(r||u[c].data)||void 0!==n||"string"!=typeof t)return c||(c=s?e[a]=m.pop()||I.guid++:a),u[c]||(u[c]=s?{}:{toJSON:I.noop}),"object"!=typeof t&&"function"!=typeof t||(r?u[c]=I.extend(u[c],t):u[c].data=I.extend(u[c].data,t)),i=u[c],r||(i.data||(i.data={}),i=i.data),void 0!==n&&(i[I.camelCase(t)]=n),"string"==typeof t?null==(o=i[t])&&(o=i[I.camelCase(t)]):o=i,o}}function s(e,t,n){if(I.acceptData(e)){var r,o,a=e.nodeType,s=a?I.cache:e,u=a?e[I.expando]:I.expando;if(s[u]){if(t&&(r=n?s[u]:s[u].data)){I.isArray(t)?t=t.concat(I.map(t,I.camelCase)):t in r?t=[t]:(t=I.camelCase(t),t=t in r?[t]:t.split(" ")),o=t.length;for(;o--;)delete r[t[o]];if(n?!i(r):!I.isEmptyObject(r))return}(n||(delete s[u].data,i(s[u])))&&(a?I.cleanData([e],!0):T.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}function u(){return!0}function c(){return!1}function l(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,o=0,i=t.toLowerCase().match(U)||[];if(I.isFunction(n))for(;r=i[o++];)"+"===r.charAt(0)?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function d(e,t,n,r){function o(s){var u;return i[s]=!0,I.each(e[s]||[],function(e,s){var c=s(t,n,r);return"string"!=typeof c||a||i[c]?a?!(u=c):void 0:(t.dataTypes.unshift(c),o(c),!1)}),u}var i={},a=e===ae;return o(t.dataTypes[0])||!i["*"]&&o("*")}function f(e,t){var n,r,o=I.ajaxSettings.flatOptions||{};for(r in t)void 0!==t[r]&&((o[r]?e:n||(n={}))[r]=t[r]);return n&&I.extend(!0,e,n),e}function p(e,t,n){for(var r,o,i,a,s=e.contents,u=e.dataTypes;"*"===u[0];)u.shift(),void 0===o&&(o=e.mimeType||t.getResponseHeader("Content-Type"));if(o)for(a in s)if(s[a]&&s[a].test(o)){u.unshift(a);break}if(u[0]in n)i=u[0];else{for(a in n){if(!u[0]||e.converters[a+" "+u[0]]){i=a;break}r||(r=a)}i=i||r}if(i)return i!==u[0]&&u.unshift(i),n[i]}function h(e,t,n,r){var o,i,a,s,u,c={},l=e.dataTypes.slice();if(l[1])for(a in e.converters)c[a.toLowerCase()]=e.converters[a];for(i=l.shift();i;)if(e.responseFields[i]&&(n[e.responseFields[i]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=i,i=l.shift())if("*"===i)i=u;else if("*"!==u&&u!==i){if(!(a=c[u+" "+i]||c["* "+i]))for(o in c)if(s=o.split(" "),s[1]===i&&(a=c[u+" "+s[0]]||c["* "+s[0]])){!0===a?a=c[o]:!0!==c[o]&&(i=s[0],l.unshift(s[1]));break}if(!0!==a)if(a&&e.throws)t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+i}}}return{state:"success",data:t}}function g(e,t,n,r){var o;if(I.isArray(t))I.each(t,function(t,o){n||ce.test(e)?r(e,o):g(e+"["+("object"==typeof o?t:"")+"]",o,n,r)});else if(n||"object"!==I.type(t))r(e,t);else for(o in t)g(e+"["+o+"]",t[o],n,r)}function y(){try{return new window.XMLHttpRequest}catch(e){}}function v(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}var m=[],C=m.slice,A=m.concat,b=m.push,x=m.indexOf,w={},k=w.toString,R=w.hasOwnProperty,T={},S="1.11.1 -css,-css/addGetHookIf,-css/curCSS,-css/defaultDisplay,-css/hiddenVisibleSelectors,-css/support,-css/swap,-css/var/cssExpand,-css/var/isHidden,-css/var/rmargin,-css/var/rnumnonpx,-effects,-effects/Tween,-effects/animatedSelector,-effects/support,-dimensions,-offset,-deprecated,-event-alias,-wrap",I=function(e,t){return new I.fn.init(e,t)},E=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,B=/^-ms-/,_=/-([\da-z])/gi,P=function(e,t){return t.toUpperCase()};I.fn=I.prototype={jquery:S,constructor:I,selector:"",length:0,toArray:function(){return C.call(this)},get:function(e){return null!=e?e<0?this[e+this.length]:this[e]:C.call(this)},pushStack:function(e){var t=I.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return I.each(this,e,t)},map:function(e){return this.pushStack(I.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(C.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==I.type(e)||e.nodeType||I.isWindow(e))return!1;try{if(e.constructor&&!R.call(e,"constructor")&&!R.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}if(T.ownLast)for(t in e)return R.call(e,t);for(t in e);return void 0===t||R.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?w[k.call(e)]||"object":typeof e},globalEval:function(e){e&&I.trim(e)&&(window.execScript||function(e){window.eval.call(window,e)})(e)},camelCase:function(e){return e.replace(B,"ms-").replace(_,P)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(t,n,r){var o=0,i=t.length,a=e(t);if(r){if(a)for(;o)[^>]*|#([\w-]*))$/;(I.fn.init=function(e,t){var n,r;if(!e)return this;if("string"==typeof e){if(!(n="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:D.exec(e))||!n[1]&&t)return!t||t.jquery?(t||L).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof I?t[0]:t,I.merge(this,I.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:j,!0)),rsingleTag.test(n[1])&&I.isPlainObject(t))for(n in t)I.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}if((r=j.getElementById(n[2]))&&r.parentNode){if(r.id!==n[2])return L.find(e);this.length=1,this[0]=r}return this.context=j,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):I.isFunction(e)?void 0!==L.ready?L.ready(e):e(I):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),I.makeArray(e,this))}).prototype=I.fn,L=I(j);var U=/\S+/g,O={};I.Callbacks=function(e){e="string"==typeof e?O[e]||t(e):I.extend({},e);var n,r,o,i,a,s,u=[],c=!e.once&&[],l=function(t){for(r=e.memory&&t,o=!0,a=s||0,s=0,i=u.length,n=!0;u&&a-1;)u.splice(r,1),n&&(r<=i&&i--,r<=a&&a--)}),this},has:function(e){return e?I.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],i=0,this},disable:function(){return u=c=r=void 0,this},disabled:function(){return!u},lock:function(){return c=void 0,r||d.disable(),this},locked:function(){return!c},fireWith:function(e,t){return!u||o&&!c||(t=t||[],t=[e,t.slice?t.slice():t],n?c.push(t):l(t)),this},fire:function(){return d.fireWith(this,arguments),this},fired:function(){return!!o}};return d},I.extend({Deferred:function(e){var t=[["resolve","done",I.Callbacks("once memory"),"resolved"],["reject","fail",I.Callbacks("once memory"),"rejected"],["notify","progress",I.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var e=arguments;return I.Deferred(function(n){I.each(t,function(t,i){var a=I.isFunction(e[t])&&e[t];o[i[1]](function(){var e=a&&a.apply(this,arguments);e&&I.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[i[0]+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?I.extend(e,r):r}},o={};return r.pipe=r.then,I.each(t,function(e,i){var a=i[2],s=i[3];r[i[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),o[i[0]]=function(){return o[i[0]+"With"](this===o?r:this,arguments),this},o[i[0]+"With"]=a.fireWith}),r.promise(o),e&&e.call(o,o),o},when:function(e){var t,n,r,o=0,i=C.call(arguments),a=i.length,s=1!==a||e&&I.isFunction(e.promise)?a:0,u=1===s?e:I.Deferred(),c=function(e,n,r){return function(o){n[e]=this,r[e]=arguments.length>1?C.call(arguments):o,r===t?u.notifyWith(n,r):--s||u.resolveWith(n,r)}};if(a>1)for(t=new Array(a),n=new Array(a),r=new Array(a);o0||(M.resolveWith(j,[I]),I.fn.triggerHandler&&(I(j).triggerHandler("ready"),I(j).off("ready")))}}}),I.ready.promise=function(e){if(!M)if(M=I.Deferred(),"complete"===j.readyState)setTimeout(I.ready);else if(j.addEventListener)j.addEventListener("DOMContentLoaded",r,!1),window.addEventListener("load",r,!1);else{j.attachEvent("onreadystatechange",r),window.attachEvent("onload",r);var t=!1;try{t=null==window.frameElement&&j.documentElement}catch(e){}t&&t.doScroll&&function e(){if(!I.isReady){try{t.doScroll("left")}catch(t){return setTimeout(e,50)}n(),I.ready()}}()}return M.promise(e)};var N;for(N in I(T))break;T.ownLast="0"!==N,T.inlineBlockNeedsLayout=!1,I(function(){var e,t,n,r;(n=j.getElementsByTagName("body")[0])&&n.style&&(t=j.createElement("div"),r=j.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),void 0!==t.style.zoom&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",T.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(n.style.zoom=1)),n.removeChild(r))}),function(){var e=j.createElement("div");if(null==T.deleteExpando){T.deleteExpando=!0;try{delete e.test}catch(e){T.deleteExpando=!1}}e=null}(),I.acceptData=function(e){var t=I.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return(1===n||9===n)&&(!t||!0!==t&&e.getAttribute("classid")===t)};var F=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,K=/([A-Z])/g;I.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return!!(e=e.nodeType?I.cache[e[I.expando]]:e[I.expando])&&!i(e)},data:function(e,t,n){return a(e,t,n)},removeData:function(e,t){return s(e,t)},_data:function(e,t,n){return a(e,t,n,!0)},_removeData:function(e,t){return s(e,t,!0)}}),I.fn.extend({data:function(e,t){var n,r,i,a=this[0],s=a&&a.attributes;if(void 0===e){if(this.length&&(i=I.data(a),1===a.nodeType&&!I._data(a,"parsedAttrs"))){for(n=s.length;n--;)s[n]&&(r=s[n].name,0===r.indexOf("data-")&&(r=I.camelCase(r.slice(5)),o(a,r,i[r])));I._data(a,"parsedAttrs",!0)}return i}return"object"==typeof e?this.each(function(){I.data(this,e)}):arguments.length>1?this.each(function(){I.data(this,e,t)}):a?o(a,e,I.data(a,e)):void 0},removeData:function(e){return this.each(function(){I.removeData(this,e)})}}),I.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=I._data(e,t),n&&(!r||I.isArray(n)?r=I._data(e,t,I.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=I.queue(e,t),r=n.length,o=n.shift(),i=I._queueHooks(e,t),a=function(){I.dequeue(e,t)};"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===t&&n.unshift("inprogress"),delete i.stop,o.call(e,a,i)),!r&&i&&i.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return I._data(e,n)||I._data(e,n,{empty:I.Callbacks("once memory").add(function(){I._removeData(e,t+"queue"),I._removeData(e,n)})})}}),I.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length=0&&(p=f.split("."),f=p.shift(),p.sort()),i=f.indexOf(":")<0&&"on"+f,e=e[I.expando]?e:new I.Event(f,"object"==typeof e&&e),e.isTrigger=r?2:3,e.namespace=p.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:I.makeArray(t,[e]),u=I.event.special[f]||{},r||!u.trigger||!1!==u.trigger.apply(n,t))){if(!r&&!u.noBubble&&!I.isWindow(n)){for(s=u.delegateType||f,G.test(s+f)||(a=a.parentNode);a;a=a.parentNode)d.push(a),c=a;c===(n.ownerDocument||j)&&d.push(c.defaultView||c.parentWindow||window)}for(l=0;(a=d[l++])&&!e.isPropagationStopped();)e.type=l>1?s:u.bindType||f,o=(I._data(a,"events")||{})[e.type]&&I._data(a,"handle"),o&&o.apply(a,t),(o=i&&a[i])&&o.apply&&I.acceptData(a)&&(e.result=o.apply(a,t),!1===e.result&&e.preventDefault());if(e.type=f,!r&&!e.isDefaultPrevented()&&(!u._default||!1===u._default.apply(d.pop(),t))&&I.acceptData(n)&&i&&n[f]&&!I.isWindow(n)){c=n[i],c&&(n[i]=null),I.event.triggered=f;try{n[f]()}catch(e){}I.event.triggered=void 0,c&&(n[i]=c)}return e.result}},dispatch:function(e){e=I.event.fix(e);var t,n,r,o,i,a=[],s=C.call(arguments),u=(I._data(this,"events")||{})[e.type]||[],c=I.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,e)){for(a=I.event.handlers.call(this,e,u),t=0;(o=a[t++])&&!e.isPropagationStopped();)for(e.currentTarget=o.elem,i=0;(r=o.handlers[i++])&&!e.isImmediatePropagationStopped();)e.namespace_re&&!e.namespace_re.test(r.namespace)||(e.handleObj=r,e.data=r.data,void 0!==(n=((I.event.special[r.origType]||{}).handle||r.handler).apply(o.elem,s))&&!1===(e.result=n)&&(e.preventDefault(),e.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,o,i,a=[],s=t.delegateCount,u=e.target;if(s&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(!0!==u.disabled||"click"!==e.type)){for(o=[],i=0;i=0:I.find(n,this,null,[u]).length),o[n]&&o.push(r);o.length&&a.push({elem:u,handlers:o})}return s0?4:0,o=e>=200&&e<300||304===e,n&&(A=p(f,k,n)),A=h(f,A,k,o),o?(f.ifModified&&(b=k.getResponseHeader("Last-Modified"),b&&(I.lastModified[i]=b),(b=k.getResponseHeader("etag"))&&(I.etag[i]=b)),204===e||"HEAD"===f.type?w="nocontent":304===e?w="notmodified":(w=A.state,l=A.data,d=A.error,o=!d)):(d=w,!e&&w||(w="error",e<0&&(e=0))),k.status=e,k.statusText=(t||w)+"",o?v.resolveWith(g,[l,w,k]):v.rejectWith(g,[k,w,d]),k.statusCode(C),C=void 0,u&&y.trigger(o?"ajaxSuccess":"ajaxError",[k,f,o?l:d]),m.fireWith(g,[k,w]),u&&(y.trigger("ajaxComplete",[k,f]),--I.active||I.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,o,i,a,s,u,c,l,f=I.ajaxSetup({},t),g=f.context||f,y=f.context&&(g.nodeType||g.jquery)?I(g):I.event,v=I.Deferred(),m=I.Callbacks("once memory"),C=f.statusCode||{},A={},b={},x=0,w="canceled",k={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!l)for(l={};t=ee.exec(a);)l[t[1].toLowerCase()]=t[2];t=l[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=b[n]=b[n]||e,A[e]=t),this},overrideMimeType:function(e){return x||(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(x<2)for(t in e)C[t]=[C[t],e[t]];else k.always(e[k.status]);return this},abort:function(e){var t=e||w;return c&&c.abort(t),n(0,t),this}};if(v.promise(k).complete=m.add,k.success=k.done,k.error=k.fail,f.url=((e||f.url||J)+"").replace(Z,"").replace(re,V[1]+"//"),f.type=t.method||t.type||f.method||f.type,f.dataTypes=I.trim(f.dataType||"*").toLowerCase().match(U)||[""],null==f.crossDomain&&(r=oe.exec(f.url.toLowerCase()),f.crossDomain=!(!r||r[1]===V[1]&&r[2]===V[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(V[3]||("http:"===V[1]?"80":"443")))),f.data&&f.processData&&"string"!=typeof f.data&&(f.data=I.param(f.data,f.traditional)),d(ie,f,t,k),2===x)return k;u=f.global,u&&0==I.active++&&I.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!ne.test(f.type),i=f.url,f.hasContent||(f.data&&(i=f.url+=(X.test(i)?"&":"?")+f.data,delete f.data),!1===f.cache&&(f.url=Q.test(i)?i.replace(Q,"$1_="+W++):i+(X.test(i)?"&":"?")+"_="+W++)),f.ifModified&&(I.lastModified[i]&&k.setRequestHeader("If-Modified-Since",I.lastModified[i]),I.etag[i]&&k.setRequestHeader("If-None-Match",I.etag[i])),(f.data&&f.hasContent&&!1!==f.contentType||t.contentType)&&k.setRequestHeader("Content-Type",f.contentType);for(o in f.headers)k.setRequestHeader(o,f.headers[o]);if(f.beforeSend&&(!1===f.beforeSend.call(g,k,f)||2===x))return k.abort();w="abort";for(o in{success:1,error:1,complete:1})k[o](f[o]);if(c=d(ae,f,t,k)){k.readyState=1,u&&y.trigger("ajaxSend",[k,f]),f.async&&f.timeout>0&&(s=setTimeout(function(){k.abort("timeout")},f.timeout));try{x=1,c.send(A,n)}catch(e){if(!(x<2))throw e;n(-1,e)}}else n(-1,"No Transport");return k},getJSON:function(e,t,n){return I.get(e,t,n,"json")},getScript:function(e,t){return I.get(e,void 0,t,"script")}}),I.each(["get","post"],function(e,t){I[t]=function(e,n,r,o){return I.isFunction(n)&&(o=o||r,r=n,n=void 0),I.ajax({url:e,type:t,dataType:o,data:n,success:r})}}),I.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){I.fn[t]=function(e){return this.on(t,e)}}),I._evalUrl=function(e){return I.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})};var ue=/%20/g,ce=/\[\]$/,le=/\r?\n/g,de=/^(?:submit|button|image|reset|file)$/i,fe=/^(?:input|select|textarea|keygen)/i;I.param=function(e,t){var n,r=[],o=function(e,t){t=I.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=I.ajaxSettings&&I.ajaxSettings.traditional),I.isArray(e)||e.jquery&&!I.isPlainObject(e))I.each(e,function(){o(this.name,this.value)});else for(n in e)g(n,e[n],t,o);return r.join("&").replace(ue,"+")},I.fn.extend({serialize:function(){return I.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=I.prop(this,"elements");return e?I.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!I(this).is(":disabled")&&fe.test(this.nodeName)&&!de.test(e)&&(this.checked||!rcheckableType.test(e))}).map(function(e,t){var n=I(this).val();return null==n?null:I.isArray(n)?I.map(n,function(e){return{name:t.name,value:e.replace(le,"\r\n")}}):{name:t.name,value:n.replace(le,"\r\n")}}).get()}}),I.ajaxSettings.xhr=void 0!==window.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&y()||v()}:y;var pe=0,he={},ge=I.ajaxSettings.xhr();window.ActiveXObject&&I(window).on("unload",function(){for(var e in he)he[e](void 0,!0)}),T.cors=!!ge&&"withCredentials"in ge,ge=T.ajax=!!ge,ge&&I.ajaxTransport(function(e){if(!e.crossDomain||T.cors){var t;return{send:function(n,r){var o,i=e.xhr(),a=++pe;if(i.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)i[o]=e.xhrFields[o];e.mimeType&&i.overrideMimeType&&i.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(o in n)void 0!==n[o]&&i.setRequestHeader(o,n[o]+"");i.upload&&e.progress&&(i.upload.onprogress=e.progress),i.send(e.hasContent&&(e.body||e.data)||null),t=function(n,o){var s,u,c;if(t&&(o||4===i.readyState))if(delete he[a],t=void 0,i.onreadystatechange=I.noop,o)4!==i.readyState&&i.abort();else{c={},s=i.status,"string"==typeof i.responseText&&(c.text=i.responseText);try{u=i.statusText}catch(e){u=""}s||!e.isLocal||e.crossDomain?1223===s&&(s=204):s=c.text?200:404}c&&r(s,u,c,i.getAllResponseHeaders())},e.async?4===i.readyState?setTimeout(t):i.onreadystatechange=he[a]=t:t()},abort:function(){t&&t(void 0,!0)}}}}),I.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return I.globalEval(e),e}}}),I.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),I.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=j.head||I("head")[0]||j.documentElement;return{send:function(r,o){t=j.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||o(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var ye=[],ve=/(=)\?(?=&|$)|\?\?/;return I.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=ye.pop()||I.expando+"_"+W++;return this[e]=!0,e}}),I.ajaxPrefilter("json jsonp",function(e,t,n){var r,o,i,a=!1!==e.jsonp&&(ve.test(e.url)?"url":"string"==typeof e.data&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&ve.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=I.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(ve,"$1"+r):!1!==e.jsonp&&(e.url+=(X.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return i||I.error(r+" was not called"),i[0]},e.dataTypes[0]="json",o=window[r],window[r]=function(){i=arguments},n.always(function(){window[r]=o,e[r]&&(e.jsonpCallback=t.jsonpCallback,ye.push(r)),i&&I.isFunction(o)&&o(i[0]),i=o=void 0}),"script"}),I.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||j;var r=rsingleTag.exec(e),o=!n&&[];return r?[t.createElement(r[1])]:(r=I.buildFragment([e],t,o),o&&o.length&&I(o).remove(),I.merge([],r.childNodes))},I}(),i=function(e,t){if(e=o.extend(!0,{headers:{},qs:{}},e),e.type=e.method,delete e.method,e.onProgress&&(e.progress=e.onProgress,delete e.onProgress),e.qs){var n=r.stringify(e.qs);n&&(e.url+=(-1===e.url.indexOf("?")?"?":"&")+n),delete e.qs}if(e.json&&(e.data=e.body,delete e.json,delete e.body,!e.headers&&(e.headers={}),e.headers["Content-Type"]="application/json"),e.body&&e.body.constructor!==window.File&&e.body.constructor!==window.Blob&&(e.data=e.body,delete e.body),e.headers){var i=e.headers;delete e.headers,e.beforeSend=function(e){for(var t in i)i.hasOwnProperty(t)&&"content-length"!==t.toLowerCase()&&"user-agent"!==t.toLowerCase()&&"origin"!==t.toLowerCase()&&"host"!==t.toLowerCase()&&e.setRequestHeader(t,i[t])}}var a=function(e){var t={};return e.getAllResponseHeaders().trim().split("\n").forEach(function(e){if(e){var n=e.indexOf(":"),r=e.substr(0,n).trim().toLowerCase(),o=e.substr(n+1).trim();t[r]=o}}),{statusCode:e.status,statusMessage:e.statusText,headers:t}};return e.success=function(e,n,r){t(null,a(r),e)},e.error=function(e){e.responseText?t(null,a(e),e.responseText):t(e.statusText,a(e),e.responseText)},e.dataType="text",o.ajax(e)};e.exports=i},function(e,t,n){function r(e,t){var n,r=new h,i=e.TaskId,a=e.Bucket,u=e.Region,l=e.Key,d=e.Body,f=e.AppId,p=e.SliceSize||this.options.ChunkSize,y=e.AsyncLimit,v=e.StorageClass||"Standard",m=this,C=e.onProgress,A=e.onHashProgress;r.on("error",function(e){if(m._isRunningTask(i))return t(e)}),r.on("upload_complete",function(e){t(null,e)}),r.on("upload_slice_complete",function(e){c.call(m,{Bucket:a,Region:u,Key:l,AppId:f,UploadId:e.UploadId,SliceList:e.SliceList},function(e,t){if(m._isRunningTask(i))return e?r.emit("error",e):void r.emit("upload_complete",t)})}),r.on("get_upload_data_finish",function(e){s.call(m,{TaskId:i,Bucket:a,Region:u,Key:l,AppId:f,Body:d,FileSize:n,SliceSize:p,AsyncLimit:y,UploadData:e,onProgress:C},function(e,t){if(m._isRunningTask(i))return e?r.emit("error",e):void r.emit("upload_slice_complete",t)})}),r.on("get_file_size_finish",function(){if(e.UploadData.UploadId)r.emit("get_upload_data_finish",e.UploadData);else{var t=g.extend({},e);t=g.extend(t,{TaskId:i,Bucket:a,Region:u,Key:l,AppId:f,StorageClass:v,Body:d,FileSize:n,SliceSize:p,onHashProgress:A}),o.call(m,t,function(t,n){if(m._isRunningTask(i)){if(t)return r.emit("error",t);e.UploadData.UploadId=n.UploadId,e.UploadData.PartList=n.PartList,r.emit("get_upload_data_finish",e.UploadData)}})}}),n=d.size||e.ContentLength,0===n?(e.Body="",m.putObject(e,t)):r.emit("get_file_size_finish")}function o(e,t){var n=e.TaskId,r=e.Bucket,o=e.Region,s=e.Key,u=e.AppId,c=e.Body,l=e.StorageClass,d=this,f={},y=e.FileSize,v=e.SliceSize,m=Math.ceil(y/v),C=0,A=0,b=g.throttleOnProgress.call(d,y,e.onHashProgress),x=function(e,t){var n=v*(e-1),r=Math.min(n+v,y),o=r-n;if(f[e])t(null,{PartNumber:e,ETag:f[e],Size:o});else{var i=g.fileSlice(c,n,r);g.getFileMd5(i,function(n,r){if(n)return t(n);var i='"'+r+'"';f[e]=i,C+=1,A+=o,t(n,{PartNumber:e,ETag:i,Size:o}),b({loaded:A,total:y})})}},w=function(e,t){var n=e.length;if(0===n)return t(null,!0);if(n>m)return t(null,!1);if(n>1){if(Math.max(e[0].Size,e[1].Size)!==v)return t(null,!1)}var r=function(o){if(o=y?l%d||d:d),!e.Uploaded}),C=g.throttleOnProgress.call(n,l,e.onProgress);p.eachLimit(m,f,function(e,t){if(n._isRunningTask(r)){var f=e.PartNumber,p=Math.min(l,e.PartNumber*d)-(e.PartNumber-1)*d,g=0;u.call(n,{TaskId:r,Bucket:o,Region:i,Key:a,AppId:s,SliceSize:d,FileSize:l,PartNumber:f,Body:h,UploadData:c,onProgress:function(e){v+=e.loaded-g,g=e.loaded,C({loaded:v,total:l})}},function(o,i){n._isRunningTask(r)&&(o||i.ETag||(o='get ETag error, please add "ETag" to CORS ExposeHeader setting.'),o?v-=g:(v+=p-g,e.ETag=i.ETag),t(o||null,i))})}},function(e){if(n._isRunningTask(r)){if(C(null,!0),e)return t(e);t(null,{UploadId:c.UploadId,SliceList:c.PartList})}})}function u(e,t){var n=e.TaskId,r=e.Bucket,o=e.Region,i=e.Key,a=e.AppId,s=e.FileSize,u=e.Body,c=1*e.PartNumber,l=e.SliceSize,d=e.UploadData,f=this,h=l*(c-1),y=l,v=h+l;v>s&&(v=s,y=v-h);var m=g.fileSlice(u,h,v),C=d.PartList[c-1],A=C.ETag;p.retry(3,function(t){f._isRunningTask(n)&&f.multipartUpload({TaskId:n,Bucket:r,Region:o,Key:i,AppId:a,ContentLength:y,ContentSha1:A,PartNumber:c,UploadId:d.UploadId,Body:m,onProgress:e.onProgress},function(e,r){if(f._isRunningTask(n))return e?t(e):(C.Uploaded=!0,t(null,r))})},function(e,r){if(f._isRunningTask(n))return t(e,r)})}function c(e,t){var n=e.Bucket,r=e.Region,o=e.Key,i=e.AppId,a=e.UploadId,s=e.SliceList,u=this,c=s.map(function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}});u.multipartComplete({Bucket:n,Region:r,Key:o,AppId:i,UploadId:a,Parts:c},function(e,n){if(e)return t(e);t(null,n)})}function l(e,t){var n=e.Bucket,r=e.Region,o=e.Key,a=e.AppId,s=e.UploadId,u=e.Level||"task",c=e.AsyncLimit,l=this,f=new h;if(f.on("error",function(e){return t(e)}),f.on("get_abort_array",function(e){d.call(l,{Bucket:n,Region:r,Key:o,AppId:a,AsyncLimit:c,AbortArray:e},function(e,n){if(e)return t(e);t(null,n)})}),"bucket"===u)i.call(l,{Bucket:n,Region:r},function(e,n){if(e)return t(e);f.emit("get_abort_array",n.UploadList||[])});else if("file"===u){if(!o)return t({error:"abort_upload_task_no_key"});i.call(l,{Bucket:n,Region:r,Key:o},function(e,n){if(e)return t(e);f.emit("get_abort_array",n.UploadList||[])})}else{if("task"!==u)return t({error:"abort_unknown_level"});if(!s)return t({error:"abort_upload_task_no_id"});if(!o)return t({error:"abort_upload_task_no_key"});f.emit("get_abort_array",[{Key:o,UploadId:s}])}}function d(e,t){var n=e.Bucket,r=e.Region,o=e.Key,i=e.AbortArray,a=e.AsyncLimit||1,s=this,u=0,c=new Array(i.length);p.eachLimit(i,a,function(e,t){var i=u;if(o&&o!=e.Key)return t(null,{KeyNotMatch:!0});var a=e.UploadId||e.UploadID;s.multipartAbort({Bucket:n,Region:r,Key:e.Key,UploadId:a},function(o,s){var u={Bucket:n,Region:r,Key:e.Key,UploadId:a};c[i]={error:o,task:u},t(null)}),u++},function(e){if(e)return t(e);for(var n=[],r=[],o=0,i=c.length;o=r?"sliceUploadFile":"putObject",params:e,callback:m})}),n._addTasks(d)}var p=n(20),h=n(3).EventProxy,g=n(0),y={sliceUploadFile:r,abortUploadTask:l,uploadFiles:f};g.each(y,function(e,n){t[n]=g.apiWrapper(n,e)})},function(e,t){var n=function(e,t,n,r){if(r=r||function(){},!e.length||t<=0)return r();var o=0,i=0,a=0;!function s(){if(o>=e.length)return r();for(;a=e.length?r():s())})}()},r=function(e,t,n){var r=function(o){t(function(t,i){t&&o0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},i.prototype.compare=function(e,t,n,r,o){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,o>>>=0,this===e)return 0;for(var a=o-r,s=n-t,u=Math.min(a,s),c=this.slice(r,o),l=e.slice(t,n),f=0;fo)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return x(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return k(this,e,t,n);case"latin1":case"binary":return R(this,e,t,n);case"base64":return T(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;i.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(o*=256);)r+=this[e+--t]*o;return r},i.prototype.readUInt8=function(e,t){return t||j(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||j(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||j(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var r=this[e],o=1,i=0;++i=o&&(r-=Math.pow(2,8*t)),r},i.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},i.prototype.readInt8=function(e,t){return t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||j(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(e,t){t||j(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(e,t){return t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return t||j(e,4,this.length),J.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||j(e,4,this.length),J.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||j(e,8,this.length),J.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||j(e,8,this.length),J.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){D(this,e,t,n,Math.pow(2,8*n)-1,0)}var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},i.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):U(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):U(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):O(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);D(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},i.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);D(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},i.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):U(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):U(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):O(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,n){return N(this,e,t,!0,n)},i.prototype.writeFloatBE=function(e,t,n){return N(this,e,t,!1,n)},i.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},i.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},i.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(a<1e3||!i.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;a=0;o--)t===r[o]&&r.splice(o,1)},e.emit=function(e,t){for(var r=n(e).map(function(e){return e}),o=0;o0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function o(e){return 3*e.length/4-r(e)}function i(e){var t,n,o,i,a,s=e.length;i=r(e),a=new f(3*s/4-i),n=i>0?s-4:s;var u=0;for(t=0;t>16&255,a[u++]=o>>8&255,a[u++]=255&o;return 2===i?(o=l[e.charCodeAt(t)]<<2|l[e.charCodeAt(t+1)]>>4,a[u++]=255&o):1===i&&(o=l[e.charCodeAt(t)]<<10|l[e.charCodeAt(t+1)]<<4|l[e.charCodeAt(t+2)]>>2,a[u++]=o>>8&255,a[u++]=255&o),a}function a(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}function s(e,t,n){for(var r,o=[],i=t;iu?u:a+16383));return 1===r?(t=e[n-1],o+=c[t>>2],o+=c[t<<4&63],o+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],o+=c[t>>10],o+=c[t>>4&63],o+=c[t<<2&63],o+="="),i.push(o),i.join("")}t.byteLength=o,t.toByteArray=i,t.fromByteArray=u;for(var c=[],l=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,p=d.length;h>1,l=-7,f=n?o-1:0,d=n?-1:1,h=e[t+f];for(f+=d,i=h&(1<<-l)-1,h>>=-l,l+=s;l>0;i=256*i+e[t+f],f+=d,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+f],f+=d,l-=8);if(0===i)i=1-c;else{if(i===u)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),i-=c}return(h?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,u,c=8*i-o-1,l=(1<>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),t+=a+f>=1?d/u:d*Math.pow(2,1-f),t*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(t*u-1)*Math.pow(2,o),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;e[n+h]=255&s,h+=p,s/=256,o-=8);for(a=a<0;e[n+h]=255&a,h+=p,a/=256,c-=8);e[n+h-p]|=128*g}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){var n=function(e){function t(e,t){return e<>>32-t}function n(e,t){var n,r,o,i,a;return o=2147483648&e,i=2147483648&t,n=1073741824&e,r=1073741824&t,a=(1073741823&e)+(1073741823&t),n&r?2147483648^a^o^i:n|r?1073741824&a?3221225472^a^o^i:1073741824^a^o^i:a^o^i}function r(e,t,n){return e&t|~e&n}function o(e,t,n){return e&n|t&~n}function i(e,t,n){return e^t^n}function a(e,t,n){return t^(e|~n)}function s(e,o,i,a,s,u,c){return e=n(e,n(n(r(o,i,a),s),c)),n(t(e,u),o)}function u(e,r,i,a,s,u,c){return e=n(e,n(n(o(r,i,a),s),c)),n(t(e,u),r)}function c(e,r,o,a,s,u,c){return e=n(e,n(n(i(r,o,a),s),c)),n(t(e,u),r)}function l(e,r,o,i,s,u,c){return e=n(e,n(n(a(r,o,i),s),c)),n(t(e,u),r)}function f(e){var t,n,r="",o="";for(n=0;n<=3;n++)t=e>>>8*n&255,o="0"+t.toString(16),r+=o.substr(o.length-2,2);return r}var d,h,p,g,y,v,m,C,b,x=Array();for(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}(e),x=function(e){for(var t,n=e.length,r=n+8,o=(r-r%64)/64,i=16*(o+1),a=Array(i-1),s=0,u=0;u>>29,a}(e),v=1732584193,m=4023233417,C=2562383102,b=271733878,d=0;d>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(r+o)%4*8;else if(65535>>2]=n[o>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;r>>2]>>>24-r%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new a.init(n,t/2)}},c=s.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new a.init(n,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,o=n.sigBytes,i=this.blockSize,s=o/(4*i),s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0);if(t=s*i,o=e.min(4*t,o),t){for(var u=0;uc;c++){if(16>c)i[c]=0|e[t+c];else{var l=i[c-3]^i[c-8]^i[c-14]^i[c-16];i[c]=l<<1|l>>>31}l=(r<<5|r>>>27)+u+i[c],l=20>c?l+(1518500249+(o&a|~o&s)):40>c?l+(1859775393+(o^a^s)):60>c?l+((o&a|o&s|a&s)-1894007588):l+((o^a^s)-899497514),u=s,s=a,a=o<<30|o>>>2,o=r,r=l}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+s|0,n[4]=n[4]+u|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=o._createHelper(t),e.HmacSHA1=o._createHmacHelper(t)}(),function(){var e=r,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,o=4*r;n.sigBytes>o&&(n=e.finalize(n)),n.clamp();for(var i=this._oKey=n.clone(),a=this._iKey=n.clone(),s=i.words,u=a.words,c=0;c>>2]>>>24-i%4*8&255,s=t[i+1>>>2]>>>24-(i+1)%4*8&255,u=t[i+2>>>2]>>>24-(i+2)%4*8&255,c=a<<16|s<<8|u,l=0;l<4&&i+.75*l>>6*(3-l)&63));var f=r.charAt(64);if(f)for(;o.length%4;)o.push(f);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=r.charAt(64);if(o){var i=e.indexOf(o);-1!=i&&(t=i)}for(var a=[],s=0,u=0;u>>6-u%4*2;a[s>>>2]|=(c|l)<<24-s%4*8,s++}return n.create(a,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.exports=r},function(e,t){var n=function(){this.version="1.3.5";var e={mergeCDATA:!0,normalize:!0,stripElemPrefix:!0},t=new RegExp(/(?!xmlns)^.*:/),r=new RegExp(/^\s+|\s+$/g);return this.grokType=function(e){return/^\s*$/.test(e)?null:/^(?:true|false)$/i.test(e)?"true"===e.toLowerCase():isFinite(e)?parseFloat(e):e},this.parseString=function(e,t){if(e){var n=this.stringToXML(e);return n.getElementsByTagName("parsererror").length?null:this.parseXML(n,t)}return null},this.parseXML=function(o,i){for(var a in i)e[a]=i[a];var s={},u=0,c="";if(o.childNodes.length)for(var l,f,d,h=0;h/g,">").replace(/'/g,"'").replace(/"/g,""").replace(o,"")}var r=new RegExp("^([^a-zA-Z_À-ÖØ-öø-ÿͰ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿿、-퟿豈-﷏ﷰ-�])|^((x|X)(m|M)(l|L))|([^a-zA-Z_À-ÖØ-öø-ÿͰ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿿、-퟿豈-﷏ﷰ-�-.0-9·̀-ͯ‿⁀])","g"),o=/[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm,i=function(e){var t=[];if(e instanceof Object)for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t},a=function(e,t){var o=function(e,n,o,i,a){var s=void 0!==t.indent?t.indent:"\t",u=t.prettyPrint?"\n"+new Array(i).join(s):"";t.removeIllegalNameCharacters&&(e=e.replace(r,"_"));var c=[u,"<",e,o||""];return n&&n.length>0?(c.push(">"),c.push(n),a&&c.push(u),c.push("")):c.push("/>"),c.join("")};return function e(r,a,s){var u=typeof r;switch((Array.isArray?Array.isArray(r):r instanceof Array)?u="array":r instanceof Date&&(u="date"),u){case"array":var c=[];return r.map(function(t){c.push(e(t,1,s+1))}),t.prettyPrint&&c.push("\n"),c.join("");case"date":return r.toJSON?r.toJSON():r+"";case"object":var l=[];for(var f in r)if(r[f]instanceof Array)for(var d in r[f])l.push(o(f,e(r[f][d],0,s+1),null,s+1,i(r[f][d]).length));else l.push(o(f,e(r[f],0,s+1),null,s+1));return t.prettyPrint&&l.length>0&&l.push("\n"),l.join("");case"function":return r();default:return t.escape?n(r):""+r}}(e,0,0)},s=function(e){var t=['"),t.join("")};e.exports=function(e,t){t||(t={xmlHeader:{standalone:!0},prettyPrint:!0,indent:" "});var n=this.Buffer||function(){};if("string"==typeof e||e instanceof n)try{e=JSON.parse(e.toString())}catch(e){return!1}var r="",o="";return t&&("object"==typeof t?(t.xmlHeader&&(r=s(!!t.xmlHeader.standalone)),void 0!==t.docType&&(o="")):r=s()),t=t||{},[r,t.prettyPrint&&o?"\n":"",o,a(e,t)].join("").replace(/\n{2,}/g,"\n").replace(/\s+$/g,"")}},function(e,t,n){var r=n(0),o=function(e){var t=[],n={},o=0,i=0,a={};r.each(["putObject","sliceUploadFile"],function(t){a[t]=e[t],e[t]=function(n,r){e._addTask(t,n,r)}});var s=function(e){var t={id:e.id,Bucket:e.Bucket,Region:e.Region,Key:e.Key,FilePath:e.FilePath,state:e.state,loaded:e.loaded,size:e.size,speed:e.speed,percent:e.percent,hashPercent:e.hashPercent,error:e.error};return e.FilePath&&(t.FilePath=e.FilePath),t},u=function(){e.emit("task-list-update",{list:r.map(t,s)}),e.emit("list-update",{list:r.map(t,s)})},c=function(){if(i-1&&(i[a]=t[a]);var s=t.Body;if(J.isBrowser&&s&&(s instanceof e.Blob||s instanceof e.File))i["Content-Length"]=s.size;else if(J.isBrowser&&s&&"string"==typeof s)i["Content-Length"]=s.length;else if(s&&s instanceof r)i["Content-Length"]=s.length;else{if(!s||"function"!=typeof s.pipe)return void n({error:"params body format error, Only allow Buffer, Stream, Blob."});if(s,s=null,void 0===i["Content-Length"])return void n({error:"lack of param ContentLength"})}var u=J.throttleOnProgress.call(o,i["Content-Length"],t.onProgress);W.call(this,{TaskId:t.TaskId,method:"PUT",Bucket:t.Bucket,Region:t.Region,Key:t.Key,headers:i,body:s,onProgress:u},function(e,r){if(u(null,!0),e)return n(e);if(r&&r.headers&&r.headers.etag){var i=G({domain:o.options.Domain,bucket:t.Bucket,region:t.Region,object:t.Key});return n(null,{Location:i,ETag:r.headers.etag,statusCode:r.statusCode,headers:r.headers})}n(null,r)})}function E(e,t){W.call(this,{method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key},function(e,n){if(e){var r=e.statusCode;return r&&204===r?t(null,{statusCode:r}):r&&404===r?t(null,{BucketNotFound:!0,statusCode:r}):t(e)}t(null,{statusCode:n.statusCode,headers:n.headers})})}function _(e,t){W.call(this,{method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"?acl"},function(e,n){if(e)return t(e);var r=n.AccessControlPolicy.Owner||{},o=n.AccessControlPolicy.AccessControlList.Grant||[];o=J.isArray(o)?o:[o];var i=q(n.AccessControlPolicy);n.headers&&n.headers["x-cos-acl"]&&(i.ACL=n.headers["x-cos-acl"]),i=J.extend(i,{Owner:r,Grants:o,statusCode:n.statusCode,headers:n.headers}),t(null,i)})}function P(e,t){var n={};n["x-cos-acl"]=e.ACL,n["x-cos-grant-read"]=e.GrantRead,n["x-cos-grant-write"]=e.GrantWrite,n["x-cos-grant-full-control"]=e.GrantFullControl;var r="";if(e.AccessControlPolicy){var o=J.clone(e.AccessControlPolicy||{}),i=o.Grants||o.Grant;i=J.isArray(i)?i:[i],delete o.Grant,delete o.Grants,o.AccessControlList={Grant:i},r=J.json2xml({AccessControlPolicy:o}),n["Content-MD5"]=J.binaryBase64(J.md5(r)),n["Content-Type"]="application/xml"}W.call(this,{method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"?acl",headers:n,body:r},function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})})}function L(e,t){var n={};n.Origin=e.Origin,n["Access-Control-Request-Method"]=e.AccessControlRequestMethod,n["Access-Control-Request-Headers"]=e.AccessControlRequestHeaders,W.call(this,{method:"OPTIONS",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:n},function(e,n){if(e)return e.statusCode&&403==e.statusCode?t(null,{OptionsForbidden:!0,statusCode:e.statusCode}):t(e);var r=n.headers||{};t(null,{AccessControlAllowOrigin:r["access-control-allow-origin"],AccessControlAllowMethods:r["access-control-allow-methods"],AccessControlAllowHeaders:r["access-control-allow-headers"],AccessControlExposeHeaders:r["access-control-expose-headers"],AccessControlMaxAge:r["access-control-max-age"],statusCode:n.statusCode,headers:n.headers})})}function I(e,t){var n={};n["x-cos-copy-source"]=e.CopySource,n["x-cos-metadata-directive"]=e.MetadataDirective,n["x-cos-copy-source-If-Modified-Since"]=e.CopySourceIfModifiedSince,n["x-cos-copy-source-If-Unmodified-Since"]=e.CopySourceIfUnmodifiedSince,n["x-cos-copy-source-If-Match"]=e.CopySourceIfMatch,n["x-cos-copy-source-If-None-Match"]=e.CopySourceIfNoneMatch,n["x-cos-storage-class"]=e.StorageClass,n["x-cos-acl"]=e.ACL,n["x-cos-grant-read"]=e.GrantRead,n["x-cos-grant-write"]=e.GrantWrite,n["x-cos-grant-full-control"]=e.GrantFullControl,n["Cache-Control"]=e.CacheControl,n["Content-Disposition"]=e.ContentDisposition,n["Content-Encoding"]=e.ContentEncoding,n["Content-Length"]=e.ContentLength,n["Content-Type"]=e.ContentType,n.Expect=e.Expect,n.Expires=e.Expires;for(var r in e)r.indexOf("x-cos-meta-")>-1&&(n[r]=e[r]);W.call(this,{method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:n},function(e,n){if(e)return t(e);var r=J.clone(n.CopyObjectResult);J.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)})}function j(e,t){var n={};n["x-cos-copy-source"]=e.CopySource,n["x-cos-copy-source-Range"]=e.CopySourceRange,n["x-cos-copy-source-If-Modified-Since"]=e.CopySourceIfModifiedSince,n["x-cos-copy-source-If-Unmodified-Since"]=e.CopySourceIfUnmodifiedSince,n["x-cos-copy-source-If-Match"]=e.CopySourceIfMatch,n["x-cos-copy-source-If-None-Match"]=e.CopySourceIfNoneMatch;var r="?partNumber="+e.PartNumber+"&uploadId="+e.UploadId;W.call(this,{method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:r,headers:n},function(e,n){if(e)return t(e);var r=J.clone(n.CopyObjectResult);J.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)})}function D(e,t){var n={};n["Content-Type"]="application/xml";var o=e.Objects||{},i=e.Quiet,a={Delete:{Object:o,Quiet:i||!1}},s=J.json2xml(a);n["Content-MD5"]=J.binaryBase64(J.md5(s)),n["Content-Length"]=r.byteLength(s,"utf8"),W.call(this,{method:"POST",Bucket:e.Bucket,Region:e.Region,body:s,action:"/?delete",headers:n},function(e,n){if(e)return t(e);var r=n.DeleteResult.Deleted||[],o=n.DeleteResult.Error||[];r=J.isArray(r)?r:[r],o=J.isArray(o)?o:[o];var i=J.clone(n.DeleteResult);J.extend(i,{Error:o,Deleted:r,statusCode:n.statusCode,headers:n.headers}),t(null,i)})}function U(e,t){var n={};n["Cache-Control"]=e.CacheControl,n["Content-Disposition"]=e.ContentDisposition,n["Content-Encoding"]=e.ContentEncoding,n["Content-Type"]=e.ContentType,n.Expires=e.Expires,n["x-cos-acl"]=e.ACL,n["x-cos-grant-read"]=e.GrantRead,n["x-cos-grant-write"]=e.GrantWrite,n["x-cos-grant-full-control"]=e.GrantFullControl,n["x-cos-storage-class"]=e.StorageClass;for(var r in e)r.indexOf("x-cos-meta-")>-1&&(n[r]=e[r]);W.call(this,{method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"?uploads",headers:n},function(e,n){return e?t(e):(n=J.clone(n||{}))&&n.InitiateMultipartUploadResult?t(null,J.extend(n.InitiateMultipartUploadResult,{statusCode:n.statusCode,headers:n.headers})):void t(null,n)})}function O(e,t){var n={};n["Content-Length"]=e.ContentLength,n.Expect=e.Expect;var r=e.PartNumber,o=e.UploadId,i="?partNumber="+r+"&uploadId="+o;W.call(this,{TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:i,headers:n,onProgress:e.onProgress,body:e.Body||null},function(e,n){if(e)return t(e);n.headers=n.headers||{},t(null,{ETag:n.headers.etag||"",statusCode:n.statusCode,headers:n.headers})})}function M(e,t){var n=this,o={};o["Content-Type"]="application/xml";for(var i=e.UploadId,a="?uploadId="+i,s=e.Parts,u=0,c=s.length;u-1?"{{Bucket}}-{{AppId}}.{{Region}}.myqcloud.com":"{{Bucket}}-{{AppId}}.cos.{{Region}}.myqcloud.com"),o=o.replace(/\{\{AppId\}\}/gi,r).replace(/\{\{Bucket\}\}/gi,n).replace(/\{\{Region\}\}/gi,i).replace(/\{\{.*?\}\}/gi,""),/^[a-zA-Z]+:\/\//.test(o)||(o=u+"//"+o),"/"===o.slice(-1)&&(o=o.slice(0,-1));var c=o;return a&&(c+="/"+encodeURIComponent(a).replace(/%2F/g,"/")),s&&(c+=s),e.isLocation&&(c=c.replace(/^https?:\/\//,"")),c}function Y(e,t){var n=this;if(n.options.getAuthorization)n.options.getAuthorization.call(n,{Method:e.Method,Key:e.Key},function(e){"string"==typeof e&&(e={Authorization:e}),t&&t(e)});else{if(!n.options.getSTS){var r=J.getAuth({SecretId:e.SecretId||n.options.SecretId,SecretKey:e.SecretKey||n.options.SecretKey,Method:e.Method,Key:e.Key});return t&&t({Authorization:r}),r}var o=e.Bucket||"";n._StsMap=n._StsMap||{};var i=n._StsMap[o]||{},a=function(){var n=J.getAuth({SecretId:i.SecretId,SecretKey:i.SecretKey,Method:e.Method,Key:e.Key}),r={Authorization:n,XCosSecurityToken:i.XCosSecurityToken||"",Token:i.Token||"",ClientIP:i.ClientIP||"",ClientUA:i.ClientUA||""};t&&t(r)};i.ExpiredTime&&i.ExpiredTime-(Date.now()/1e3>60)?a():n.options.getSTS.call(n,{Bucket:o},function(e){i=n._StsMap[o]=e||{},a()})}return""}function W(e,t){var n=this;Y.call(n,{Method:e.method,Key:e.Key},function(r){e.AuthData=r,X.call(n,e,t)})}function X(e,t){var n=this,r=e.TaskId;if(!r||n._isRunningTask(r)){var o=e.Bucket,i=e.Region,a=e.Key,s=e.action,u=e.method||"GET",c=e.headers||{},l=e.url,f=e.body,d=e.json,h=e.rawBody,p=e.qs,g={url:l||G({domain:n.options.Domain,bucket:o,region:i,object:a,action:s}),method:u,headers:c||{},qs:p,body:f,json:d};if(g.headers.Authorization=e.AuthData.Authorization,e.AuthData.Token&&(g.headers.token=e.AuthData.Token),e.AuthData.ClientIP&&(g.headers.clientIP=e.AuthData.ClientIP),e.AuthData.ClientUA&&(g.headers.clientUA=e.AuthData.ClientUA),e.AuthData.XCosSecurityToken&&(g.headers["x-cos-security-token"]=e.AuthData.XCosSecurityToken),g.headers&&(g.headers=J.clearKey(g.headers)),g.qs&&(g.qs=J.clearKey(g.qs)),g=J.clearKey(g),e.onProgress&&"function"==typeof e.onProgress){var y=f&&(f.size||f.length)||0;g.onProgress=function(t){if(!r||n._isRunningTask(r)){var o=t?t.loaded:0;e.onProgress({loaded:o,total:y})}}}var v=V(g,function(e,o,i){var a=function(e,i){r&&n.off("inner-kill-task",m),r&&!n._isRunningTask(r)||(e?(e=e||{},o&&o.statusCode&&(e.statusCode=o.statusCode),o&&o.headers&&(e.headers=o.headers),t(e,null)):(i=i||{},o&&o.statusCode&&(i.statusCode=o.statusCode),o&&o.headers&&(i.headers=o.headers),t(null,i)))};if(e)return void a({error:e});var s;try{s=J.xml2json(i)||{}}catch(e){s=i||{}}var u=o.statusCode;return 200!==u&&204!==u&&206!==u?void a({error:s.Error||s}):(h&&(s={},s.body=i),s.Error?void a({error:s.Error}):void a(null,s))}),m=function(e){e.TaskId===r&&(v&&v.abort&&v.abort(),n.off("inner-kill-task",m))};r&&n.on("inner-kill-task",m)}}var $=n(4),V=n(18),J=n(0),Z={getBucket:i,headBucket:o,deleteBucket:a,getBucketAcl:s,putBucketAcl:u,getBucketCors:c,putBucketCors:l,deleteBucketCors:f,getBucketLocation:h,putBucketTagging:y,getBucketTagging:g,deleteBucketTagging:v,getBucketPolicy:p,putBucketPolicy:d,getBucketLifecycle:C,putBucketLifecycle:m,deleteBucketLifecycle:b,putBucketVersioning:x,getBucketVersioning:w,putBucketReplication:k,getBucketReplication:R,deleteBucketReplication:T,getObject:S,headObject:A,putObject:B,deleteObject:E,getObjectAcl:_,putObjectAcl:P,optionsObject:L,putObjectCopy:I,uploadPartCopy:j,multipartInit:U,multipartUpload:O,multipartComplete:M,multipartList:N,multipartListPart:F,multipartAbort:K,deleteMultipleObject:D,getObjectUrl:H,getAuth:z};J.each(Z,function(e,n){t[n]=J.apiWrapper(n,e)})}).call(t,n(1),n(2).Buffer)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l=0?(f=g.substr(0,y),d=g.substr(y+1)):(f=g,d=""),h=decodeURIComponent(f),p=decodeURIComponent(d),r(a,h)?o(a[h])?a[h].push(p):a[h]=[a[h],p]:a[h]=p}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";function r(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r0&&t-1 in e))}function t(e){var t=O[e]={};return B.each(e.match(U)||[],function(e,n){t[n]=!0}),t}function n(){j.addEventListener?(j.removeEventListener("DOMContentLoaded",r,!1),window.removeEventListener("load",r,!1)):(j.detachEvent("onreadystatechange",r),window.detachEvent("onload",r))}function r(){(j.addEventListener||"load"===event.type||"complete"===j.readyState)&&(n(),B.ready())}function o(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(K,"-$1").toLowerCase();if("string"==typeof(n=e.getAttribute(r))){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:F.test(n)?B.parseJSON(n):n)}catch(e){}B.data(e,t,n)}else n=void 0}return n}function i(e){var t;for(t in e)if(("data"!==t||!B.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function a(e,t,n,r){if(B.acceptData(e)){var o,i,a=B.expando,s=e.nodeType,u=s?B.cache:e,c=s?e[a]:e[a]&&a;if(c&&u[c]&&(r||u[c].data)||void 0!==n||"string"!=typeof t)return c||(c=s?e[a]=m.pop()||B.guid++:a),u[c]||(u[c]=s?{}:{toJSON:B.noop}),"object"!=typeof t&&"function"!=typeof t||(r?u[c]=B.extend(u[c],t):u[c].data=B.extend(u[c].data,t)),i=u[c],r||(i.data||(i.data={}),i=i.data),void 0!==n&&(i[B.camelCase(t)]=n),"string"==typeof t?null==(o=i[t])&&(o=i[B.camelCase(t)]):o=i,o}}function s(e,t,n){if(B.acceptData(e)){var r,o,a=e.nodeType,s=a?B.cache:e,u=a?e[B.expando]:B.expando;if(s[u]){if(t&&(r=n?s[u]:s[u].data)){B.isArray(t)?t=t.concat(B.map(t,B.camelCase)):t in r?t=[t]:(t=B.camelCase(t),t=t in r?[t]:t.split(" ")),o=t.length;for(;o--;)delete r[t[o]];if(n?!i(r):!B.isEmptyObject(r))return}(n||(delete s[u].data,i(s[u])))&&(a?B.cleanData([e],!0):A.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}function u(){return!0}function c(){return!1}function l(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,o=0,i=t.toLowerCase().match(U)||[];if(B.isFunction(n))for(;r=i[o++];)"+"===r.charAt(0)?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function f(e,t,n,r){function o(s){var u;return i[s]=!0,B.each(e[s]||[],function(e,s){var c=s(t,n,r);return"string"!=typeof c||a||i[c]?a?!(u=c):void 0:(t.dataTypes.unshift(c),o(c),!1)}),u}var i={},a=e===ae;return o(t.dataTypes[0])||!i["*"]&&o("*")}function d(e,t){var n,r,o=B.ajaxSettings.flatOptions||{};for(r in t)void 0!==t[r]&&((o[r]?e:n||(n={}))[r]=t[r]);return n&&B.extend(!0,e,n),e}function h(e,t,n){for(var r,o,i,a,s=e.contents,u=e.dataTypes;"*"===u[0];)u.shift(),void 0===o&&(o=e.mimeType||t.getResponseHeader("Content-Type"));if(o)for(a in s)if(s[a]&&s[a].test(o)){u.unshift(a);break}if(u[0]in n)i=u[0];else{for(a in n){if(!u[0]||e.converters[a+" "+u[0]]){i=a;break}r||(r=a)}i=i||r}if(i)return i!==u[0]&&u.unshift(i),n[i]}function p(e,t,n,r){var o,i,a,s,u,c={},l=e.dataTypes.slice();if(l[1])for(a in e.converters)c[a.toLowerCase()]=e.converters[a];for(i=l.shift();i;)if(e.responseFields[i]&&(n[e.responseFields[i]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=i,i=l.shift())if("*"===i)i=u;else if("*"!==u&&u!==i){if(!(a=c[u+" "+i]||c["* "+i]))for(o in c)if(s=o.split(" "),s[1]===i&&(a=c[u+" "+s[0]]||c["* "+s[0]])){!0===a?a=c[o]:!0!==c[o]&&(i=s[0],l.unshift(s[1]));break}if(!0!==a)if(a&&e.throws)t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+i}}}return{state:"success",data:t}}function g(e,t,n,r){var o;if(B.isArray(t))B.each(t,function(t,o){n||ce.test(e)?r(e,o):g(e+"["+("object"==typeof o?t:"")+"]",o,n,r)});else if(n||"object"!==B.type(t))r(e,t);else for(o in t)g(e+"["+o+"]",t[o],n,r)}function y(){try{return new window.XMLHttpRequest}catch(e){}}function v(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}var m=[],C=m.slice,b=m.concat,x=m.push,w=m.indexOf,k={},R=k.toString,T=k.hasOwnProperty,A={},S="1.11.1 -css,-css/addGetHookIf,-css/curCSS,-css/defaultDisplay,-css/hiddenVisibleSelectors,-css/support,-css/swap,-css/var/cssExpand,-css/var/isHidden,-css/var/rmargin,-css/var/rnumnonpx,-effects,-effects/Tween,-effects/animatedSelector,-effects/support,-dimensions,-offset,-deprecated,-event-alias,-wrap",B=function(e,t){return new B.fn.init(e,t)},E=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,_=/^-ms-/,P=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()};B.fn=B.prototype={jquery:S,constructor:B,selector:"",length:0,toArray:function(){return C.call(this)},get:function(e){return null!=e?e<0?this[e+this.length]:this[e]:C.call(this)},pushStack:function(e){var t=B.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return B.each(this,e,t)},map:function(e){return this.pushStack(B.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(C.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==B.type(e)||e.nodeType||B.isWindow(e))return!1;try{if(e.constructor&&!T.call(e,"constructor")&&!T.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}if(A.ownLast)for(t in e)return T.call(e,t);for(t in e);return void 0===t||T.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?k[R.call(e)]||"object":typeof e},globalEval:function(e){e&&B.trim(e)&&(window.execScript||function(e){window.eval.call(window,e)})(e)},camelCase:function(e){return e.replace(_,"ms-").replace(P,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(t,n,r){var o=0,i=t.length,a=e(t);if(r){if(a)for(;o)[^>]*|#([\w-]*))$/;(B.fn.init=function(e,t){var n,r;if(!e)return this;if("string"==typeof e){if(!(n="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:D.exec(e))||!n[1]&&t)return!t||t.jquery?(t||I).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof B?t[0]:t,B.merge(this,B.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:j,!0)),rsingleTag.test(n[1])&&B.isPlainObject(t))for(n in t)B.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}if((r=j.getElementById(n[2]))&&r.parentNode){if(r.id!==n[2])return I.find(e);this.length=1,this[0]=r}return this.context=j,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):B.isFunction(e)?void 0!==I.ready?I.ready(e):e(B):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),B.makeArray(e,this))}).prototype=B.fn,I=B(j);var U=/\S+/g,O={};B.Callbacks=function(e){e="string"==typeof e?O[e]||t(e):B.extend({},e);var n,r,o,i,a,s,u=[],c=!e.once&&[],l=function(t){for(r=e.memory&&t,o=!0,a=s||0,s=0,i=u.length,n=!0;u&&a-1;)u.splice(r,1),n&&(r<=i&&i--,r<=a&&a--)}),this},has:function(e){return e?B.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],i=0,this},disable:function(){return u=c=r=void 0,this},disabled:function(){return!u},lock:function(){return c=void 0,r||f.disable(),this},locked:function(){return!c},fireWith:function(e,t){return!u||o&&!c||(t=t||[],t=[e,t.slice?t.slice():t],n?c.push(t):l(t)),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},B.extend({Deferred:function(e){var t=[["resolve","done",B.Callbacks("once memory"),"resolved"],["reject","fail",B.Callbacks("once memory"),"rejected"],["notify","progress",B.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var e=arguments;return B.Deferred(function(n){B.each(t,function(t,i){var a=B.isFunction(e[t])&&e[t];o[i[1]](function(){var e=a&&a.apply(this,arguments);e&&B.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[i[0]+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?B.extend(e,r):r}},o={};return r.pipe=r.then,B.each(t,function(e,i){var a=i[2],s=i[3];r[i[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),o[i[0]]=function(){return o[i[0]+"With"](this===o?r:this,arguments),this},o[i[0]+"With"]=a.fireWith}),r.promise(o),e&&e.call(o,o),o},when:function(e){var t,n,r,o=0,i=C.call(arguments),a=i.length,s=1!==a||e&&B.isFunction(e.promise)?a:0,u=1===s?e:B.Deferred(),c=function(e,n,r){return function(o){n[e]=this,r[e]=arguments.length>1?C.call(arguments):o,r===t?u.notifyWith(n,r):--s||u.resolveWith(n,r)}};if(a>1)for(t=new Array(a),n=new Array(a),r=new Array(a);o0||(M.resolveWith(j,[B]),B.fn.triggerHandler&&(B(j).triggerHandler("ready"),B(j).off("ready")))}}}),B.ready.promise=function(e){if(!M)if(M=B.Deferred(),"complete"===j.readyState)setTimeout(B.ready);else if(j.addEventListener)j.addEventListener("DOMContentLoaded",r,!1),window.addEventListener("load",r,!1);else{j.attachEvent("onreadystatechange",r),window.attachEvent("onload",r);var t=!1;try{t=null==window.frameElement&&j.documentElement}catch(e){}t&&t.doScroll&&function e(){if(!B.isReady){try{t.doScroll("left")}catch(t){return setTimeout(e,50)}n(),B.ready()}}()}return M.promise(e)};var N;for(N in B(A))break;A.ownLast="0"!==N,A.inlineBlockNeedsLayout=!1,B(function(){var e,t,n,r;(n=j.getElementsByTagName("body")[0])&&n.style&&(t=j.createElement("div"),r=j.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),void 0!==t.style.zoom&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",A.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(n.style.zoom=1)),n.removeChild(r))}),function(){var e=j.createElement("div");if(null==A.deleteExpando){A.deleteExpando=!0;try{delete e.test}catch(e){A.deleteExpando=!1}}e=null}(),B.acceptData=function(e){var t=B.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return(1===n||9===n)&&(!t||!0!==t&&e.getAttribute("classid")===t)};var F=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,K=/([A-Z])/g;B.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return!!(e=e.nodeType?B.cache[e[B.expando]]:e[B.expando])&&!i(e)},data:function(e,t,n){return a(e,t,n)},removeData:function(e,t){return s(e,t)},_data:function(e,t,n){return a(e,t,n,!0)},_removeData:function(e,t){return s(e,t,!0)}}),B.fn.extend({data:function(e,t){var n,r,i,a=this[0],s=a&&a.attributes;if(void 0===e){if(this.length&&(i=B.data(a),1===a.nodeType&&!B._data(a,"parsedAttrs"))){for(n=s.length;n--;)s[n]&&(r=s[n].name,0===r.indexOf("data-")&&(r=B.camelCase(r.slice(5)),o(a,r,i[r])));B._data(a,"parsedAttrs",!0)}return i}return"object"==typeof e?this.each(function(){B.data(this,e)}):arguments.length>1?this.each(function(){B.data(this,e,t)}):a?o(a,e,B.data(a,e)):void 0},removeData:function(e){return this.each(function(){B.removeData(this,e)})}}),B.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=B._data(e,t),n&&(!r||B.isArray(n)?r=B._data(e,t,B.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=B.queue(e,t),r=n.length,o=n.shift(),i=B._queueHooks(e,t),a=function(){B.dequeue(e,t)};"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===t&&n.unshift("inprogress"),delete i.stop,o.call(e,a,i)),!r&&i&&i.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return B._data(e,n)||B._data(e,n,{empty:B.Callbacks("once memory").add(function(){B._removeData(e,t+"queue"),B._removeData(e,n)})})}}),B.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length=0&&(h=d.split("."),d=h.shift(),h.sort()),i=d.indexOf(":")<0&&"on"+d,e=e[B.expando]?e:new B.Event(d,"object"==typeof e&&e),e.isTrigger=r?2:3,e.namespace=h.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:B.makeArray(t,[e]),u=B.event.special[d]||{},r||!u.trigger||!1!==u.trigger.apply(n,t))){if(!r&&!u.noBubble&&!B.isWindow(n)){for(s=u.delegateType||d,G.test(s+d)||(a=a.parentNode);a;a=a.parentNode)f.push(a),c=a;c===(n.ownerDocument||j)&&f.push(c.defaultView||c.parentWindow||window)}for(l=0;(a=f[l++])&&!e.isPropagationStopped();)e.type=l>1?s:u.bindType||d,o=(B._data(a,"events")||{})[e.type]&&B._data(a,"handle"),o&&o.apply(a,t),(o=i&&a[i])&&o.apply&&B.acceptData(a)&&(e.result=o.apply(a,t),!1===e.result&&e.preventDefault());if(e.type=d,!r&&!e.isDefaultPrevented()&&(!u._default||!1===u._default.apply(f.pop(),t))&&B.acceptData(n)&&i&&n[d]&&!B.isWindow(n)){c=n[i],c&&(n[i]=null),B.event.triggered=d;try{n[d]()}catch(e){}B.event.triggered=void 0,c&&(n[i]=c)}return e.result}},dispatch:function(e){e=B.event.fix(e);var t,n,r,o,i,a=[],s=C.call(arguments),u=(B._data(this,"events")||{})[e.type]||[],c=B.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,e)){for(a=B.event.handlers.call(this,e,u),t=0;(o=a[t++])&&!e.isPropagationStopped();)for(e.currentTarget=o.elem,i=0;(r=o.handlers[i++])&&!e.isImmediatePropagationStopped();)e.namespace_re&&!e.namespace_re.test(r.namespace)||(e.handleObj=r,e.data=r.data,void 0!==(n=((B.event.special[r.origType]||{}).handle||r.handler).apply(o.elem,s))&&!1===(e.result=n)&&(e.preventDefault(),e.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,o,i,a=[],s=t.delegateCount,u=e.target;if(s&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(!0!==u.disabled||"click"!==e.type)){for(o=[],i=0;i=0:B.find(n,this,null,[u]).length),o[n]&&o.push(r);o.length&&a.push({elem:u,handlers:o})}return s0?4:0,o=e>=200&&e<300||304===e,n&&(b=h(d,R,n)),b=p(d,b,R,o),o?(d.ifModified&&(x=R.getResponseHeader("Last-Modified"),x&&(B.lastModified[i]=x),(x=R.getResponseHeader("etag"))&&(B.etag[i]=x)),204===e||"HEAD"===d.type?k="nocontent":304===e?k="notmodified":(k=b.state,l=b.data,f=b.error,o=!f)):(f=k,!e&&k||(k="error",e<0&&(e=0))),R.status=e,R.statusText=(t||k)+"",o?v.resolveWith(g,[l,k,R]):v.rejectWith(g,[R,k,f]),R.statusCode(C),C=void 0,u&&y.trigger(o?"ajaxSuccess":"ajaxError",[R,d,o?l:f]),m.fireWith(g,[R,k]),u&&(y.trigger("ajaxComplete",[R,d]),--B.active||B.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,o,i,a,s,u,c,l,d=B.ajaxSetup({},t),g=d.context||d,y=d.context&&(g.nodeType||g.jquery)?B(g):B.event,v=B.Deferred(),m=B.Callbacks("once memory"),C=d.statusCode||{},b={},x={},w=0,k="canceled",R={readyState:0,getResponseHeader:function(e){var t;if(2===w){if(!l)for(l={};t=ee.exec(a);)l[t[1].toLowerCase()]=t[2];t=l[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===w?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return w||(e=x[n]=x[n]||e,b[e]=t),this},overrideMimeType:function(e){return w||(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(w<2)for(t in e)C[t]=[C[t],e[t]];else R.always(e[R.status]);return this},abort:function(e){var t=e||k;return c&&c.abort(t),n(0,t),this}};if(v.promise(R).complete=m.add,R.success=R.done,R.error=R.fail,d.url=((e||d.url||J)+"").replace(Z,"").replace(re,V[1]+"//"),d.type=t.method||t.type||d.method||d.type,d.dataTypes=B.trim(d.dataType||"*").toLowerCase().match(U)||[""],null==d.crossDomain&&(r=oe.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]===V[1]&&r[2]===V[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(V[3]||("http:"===V[1]?"80":"443")))),d.data&&d.processData&&"string"!=typeof d.data&&(d.data=B.param(d.data,d.traditional)),f(ie,d,t,R),2===w)return R;u=d.global,u&&0==B.active++&&B.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!ne.test(d.type),i=d.url,d.hasContent||(d.data&&(i=d.url+=(X.test(i)?"&":"?")+d.data,delete d.data),!1===d.cache&&(d.url=Q.test(i)?i.replace(Q,"$1_="+W++):i+(X.test(i)?"&":"?")+"_="+W++)),d.ifModified&&(B.lastModified[i]&&R.setRequestHeader("If-Modified-Since",B.lastModified[i]),B.etag[i]&&R.setRequestHeader("If-None-Match",B.etag[i])),(d.data&&d.hasContent&&!1!==d.contentType||t.contentType)&&R.setRequestHeader("Content-Type",d.contentType);for(o in d.headers)R.setRequestHeader(o,d.headers[o]);if(d.beforeSend&&(!1===d.beforeSend.call(g,R,d)||2===w))return R.abort();k="abort";for(o in{success:1,error:1,complete:1})R[o](d[o]);if(c=f(ae,d,t,R)){R.readyState=1,u&&y.trigger("ajaxSend",[R,d]),d.async&&d.timeout>0&&(s=setTimeout(function(){R.abort("timeout")},d.timeout));try{w=1,c.send(b,n)}catch(e){if(!(w<2))throw e;n(-1,e)}}else n(-1,"No Transport");return R},getJSON:function(e,t,n){return B.get(e,t,n,"json")},getScript:function(e,t){return B.get(e,void 0,t,"script")}}),B.each(["get","post"],function(e,t){B[t]=function(e,n,r,o){return B.isFunction(n)&&(o=o||r,r=n,n=void 0),B.ajax({url:e,type:t,dataType:o,data:n,success:r})}}),B.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){B.fn[t]=function(e){return this.on(t,e)}}),B._evalUrl=function(e){return B.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})};var ue=/%20/g,ce=/\[\]$/,le=/\r?\n/g,fe=/^(?:submit|button|image|reset|file)$/i,de=/^(?:input|select|textarea|keygen)/i;B.param=function(e,t){var n,r=[],o=function(e,t){t=B.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=B.ajaxSettings&&B.ajaxSettings.traditional),B.isArray(e)||e.jquery&&!B.isPlainObject(e))B.each(e,function(){o(this.name,this.value)});else for(n in e)g(n,e[n],t,o);return r.join("&").replace(ue,"+")},B.fn.extend({serialize:function(){return B.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=B.prop(this,"elements");return e?B.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!B(this).is(":disabled")&&de.test(this.nodeName)&&!fe.test(e)&&(this.checked||!rcheckableType.test(e))}).map(function(e,t){var n=B(this).val();return null==n?null:B.isArray(n)?B.map(n,function(e){return{name:t.name,value:e.replace(le,"\r\n")}}):{name:t.name,value:n.replace(le,"\r\n")}}).get()}}),B.ajaxSettings.xhr=void 0!==window.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&y()||v()}:y;var he=0,pe={},ge=B.ajaxSettings.xhr();window.ActiveXObject&&B(window).on("unload",function(){for(var e in pe)pe[e](void 0,!0)}),A.cors=!!ge&&"withCredentials"in ge,ge=A.ajax=!!ge,ge&&B.ajaxTransport(function(e){if(!e.crossDomain||A.cors){var t;return{send:function(n,r){var o,i=e.xhr(),a=++he;if(i.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)i[o]=e.xhrFields[o];e.mimeType&&i.overrideMimeType&&i.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(o in n)void 0!==n[o]&&i.setRequestHeader(o,n[o]+"");i.upload&&e.progress&&(i.upload.onprogress=e.progress),i.send(e.hasContent&&(e.body||e.data)||null),t=function(n,o){var s,u,c;if(t&&(o||4===i.readyState))if(delete pe[a],t=void 0,i.onreadystatechange=B.noop,o)4!==i.readyState&&i.abort();else{c={},s=i.status,"string"==typeof i.responseText&&(c.text=i.responseText);try{u=i.statusText}catch(e){u=""}s||!e.isLocal||e.crossDomain?1223===s&&(s=204):s=c.text?200:404}c&&r(s,u,c,i.getAllResponseHeaders())},e.async?4===i.readyState?setTimeout(t):i.onreadystatechange=pe[a]=t:t()},abort:function(){t&&t(void 0,!0)}}}}),B.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return B.globalEval(e),e}}}),B.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),B.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=j.head||B("head")[0]||j.documentElement;return{send:function(r,o){t=j.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||o(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var ye=[],ve=/(=)\?(?=&|$)|\?\?/;return B.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=ye.pop()||B.expando+"_"+W++;return this[e]=!0,e}}),B.ajaxPrefilter("json jsonp",function(e,t,n){var r,o,i,a=!1!==e.jsonp&&(ve.test(e.url)?"url":"string"==typeof e.data&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&ve.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=B.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(ve,"$1"+r):!1!==e.jsonp&&(e.url+=(X.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return i||B.error(r+" was not called"),i[0]},e.dataTypes[0]="json",o=window[r],window[r]=function(){i=arguments},n.always(function(){window[r]=o,e[r]&&(e.jsonpCallback=t.jsonpCallback,ye.push(r)),i&&B.isFunction(o)&&o(i[0]),i=o=void 0}),"script"}),B.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||j;var r=rsingleTag.exec(e),o=!n&&[];return r?[t.createElement(r[1])]:(r=B.buildFragment([e],t,o),o&&o.length&&B(o).remove(),B.merge([],r.childNodes))},B}(),i=function(e,t){if(e=o.extend(!0,{headers:{},qs:{}},e),e.type=e.method,delete e.method,e.onProgress&&(e.progress=e.onProgress,delete e.onProgress),e.qs){var n=r.stringify(e.qs);n&&(e.url+=(-1===e.url.indexOf("?")?"?":"&")+n),delete e.qs}if(e.json&&(e.data=e.body,delete e.json,delete e.body,!e.headers&&(e.headers={}),e.headers["Content-Type"]="application/json"),e.body&&e.body.constructor!==window.File&&e.body.constructor!==window.Blob&&(e.data=e.body,delete e.body),e.headers){var i=e.headers;delete e.headers,e.beforeSend=function(e){for(var t in i)i.hasOwnProperty(t)&&"content-length"!==t.toLowerCase()&&"user-agent"!==t.toLowerCase()&&"origin"!==t.toLowerCase()&&"host"!==t.toLowerCase()&&e.setRequestHeader(t,i[t])}}var a=function(e){var t={};return e.getAllResponseHeaders().trim().split("\n").forEach(function(e){if(e){var n=e.indexOf(":"),r=e.substr(0,n).trim().toLowerCase(),o=e.substr(n+1).trim();t[r]=o}}),{statusCode:e.status,statusMessage:e.statusText,headers:t}};return e.success=function(e,n,r){t(null,a(r),e)},e.error=function(e){e.responseText?t(null,a(e),e.responseText):t(e.statusText,a(e),e.responseText)},e.dataType="text",o.ajax(e)};e.exports=i},function(e,t,n){function r(e,t){var n,r=new p,i=e.TaskId,a=e.Bucket,u=e.Region,l=e.Key,f=e.Body,d=e.SliceSize||this.options.ChunkSize,h=e.AsyncLimit,y=e.StorageClass||"Standard",v=this,m=e.onProgress,C=e.onHashProgress;r.on("error",function(e){if(v._isRunningTask(i))return t(e)}),r.on("upload_complete",function(e){t(null,e)}),r.on("upload_slice_complete",function(e){c.call(v,{Bucket:a,Region:u,Key:l,UploadId:e.UploadId,SliceList:e.SliceList},function(e,t){if(v._isRunningTask(i))return e?r.emit("error",e):void r.emit("upload_complete",t)})}),r.on("get_upload_data_finish",function(e){s.call(v,{TaskId:i,Bucket:a,Region:u,Key:l,Body:f,FileSize:n,SliceSize:d,AsyncLimit:h,UploadData:e,onProgress:m},function(e,t){if(v._isRunningTask(i))return e?r.emit("error",e):void r.emit("upload_slice_complete",t)})}),r.on("get_file_size_finish",function(){if(e.UploadData.UploadId)r.emit("get_upload_data_finish",e.UploadData);else{var t=g.extend({},e);t=g.extend(t,{TaskId:i,Bucket:a,Region:u,Key:l,StorageClass:y,Body:f,FileSize:n,SliceSize:d,onHashProgress:C}),o.call(v,t,function(t,n){if(v._isRunningTask(i)){if(t)return r.emit("error",t);e.UploadData.UploadId=n.UploadId,e.UploadData.PartList=n.PartList,r.emit("get_upload_data_finish",e.UploadData)}})}}),n=f.size||e.ContentLength,0===n?(e.Body="",v.putObject(e,t)):r.emit("get_file_size_finish")}function o(e,t){var n=e.TaskId,r=e.Bucket,o=e.Region,s=e.Key,u=e.Body,c=e.StorageClass,l=this,f={},d=e.FileSize,y=e.SliceSize,v=Math.ceil(d/y),m=0,C=0,b=g.throttleOnProgress.call(l,d,e.onHashProgress),x=function(e,t){var n=y*(e-1),r=Math.min(n+y,d),o=r-n;if(f[e])t(null,{PartNumber:e,ETag:f[e],Size:o});else{var i=g.fileSlice(u,n,r);g.getFileMd5(i,function(n,r){if(n)return t(n);var i='"'+r+'"';f[e]=i,m+=1,C+=o,t(n,{PartNumber:e,ETag:i,Size:o}),b({loaded:C,total:d})})}},w=function(e,t){var n=e.length;if(0===n)return t(null,!0);if(n>v)return t(null,!1);if(n>1){if(Math.max(e[0].Size,e[1].Size)!==y)return t(null,!1)}var r=function(o){if(o=p?c%l||l:l),!e.Uploaded}),m=g.throttleOnProgress.call(n,c,e.onProgress);h.eachLimit(v,f,function(e,t){if(n._isRunningTask(r)){var f=e.PartNumber,h=Math.min(c,e.PartNumber*l)-(e.PartNumber-1)*l,p=0;u.call(n,{TaskId:r,Bucket:o,Region:i,Key:a,SliceSize:l,FileSize:c,PartNumber:f,Body:d,UploadData:s,onProgress:function(e){y+=e.loaded-p,p=e.loaded,m({loaded:y,total:c})}},function(o,i){n._isRunningTask(r)&&(o||i.ETag||(o='get ETag error, please add "ETag" to CORS ExposeHeader setting.'),o?y-=p:(y+=h-p,e.ETag=i.ETag),t(o||null,i))})}},function(e){if(n._isRunningTask(r)){if(m(null,!0),e)return t(e);t(null,{UploadId:s.UploadId,SliceList:s.PartList})}})}function u(e,t){var n=e.TaskId,r=e.Bucket,o=e.Region,i=e.Key,a=e.FileSize,s=e.Body,u=1*e.PartNumber,c=e.SliceSize,l=e.UploadData,f=this,d=c*(u-1),p=c,y=d+c;y>a&&(y=a,p=y-d);var v=g.fileSlice(s,d,y),m=l.PartList[u-1],C=m.ETag;h.retry(3,function(t){f._isRunningTask(n)&&f.multipartUpload({TaskId:n,Bucket:r,Region:o,Key:i,ContentLength:p,ContentSha1:C,PartNumber:u,UploadId:l.UploadId,Body:v,onProgress:e.onProgress},function(e,r){if(f._isRunningTask(n))return e?t(e):(m.Uploaded=!0,t(null,r))})},function(e,r){if(f._isRunningTask(n))return t(e,r)})}function c(e,t){var n=e.Bucket,r=e.Region,o=e.Key,i=e.UploadId,a=e.SliceList,s=this,u=a.map(function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}});s.multipartComplete({Bucket:n,Region:r,Key:o,UploadId:i,Parts:u},function(e,n){if(e)return t(e);t(null,n)})}function l(e,t){var n=e.Bucket,r=e.Region,o=e.Key,a=e.UploadId,s=e.Level||"task",u=e.AsyncLimit,c=this,l=new p;if(l.on("error",function(e){return t(e)}),l.on("get_abort_array",function(e){f.call(c,{Bucket:n,Region:r,Key:o,AsyncLimit:u,AbortArray:e},function(e,n){if(e)return t(e);t(null,n)})}),"bucket"===s)i.call(c,{Bucket:n,Region:r},function(e,n){if(e)return t(e);l.emit("get_abort_array",n.UploadList||[])});else if("file"===s){if(!o)return t({error:"abort_upload_task_no_key"});i.call(c,{Bucket:n,Region:r,Key:o},function(e,n){if(e)return t(e);l.emit("get_abort_array",n.UploadList||[])})}else{if("task"!==s)return t({error:"abort_unknown_level"});if(!a)return t({error:"abort_upload_task_no_id"});if(!o)return t({error:"abort_upload_task_no_key"});l.emit("get_abort_array",[{Key:o,UploadId:a}])}}function f(e,t){var n=e.Bucket,r=e.Region,o=e.Key,i=e.AbortArray,a=e.AsyncLimit||1,s=this,u=0,c=new Array(i.length);h.eachLimit(i,a,function(e,t){var i=u;if(o&&o!=e.Key)return t(null,{KeyNotMatch:!0});var a=e.UploadId||e.UploadID;s.multipartAbort({Bucket:n,Region:r,Key:e.Key,UploadId:a},function(o,s){var u={Bucket:n,Region:r,Key:e.Key,UploadId:a};c[i]={error:o,task:u},t(null)}),u++},function(e){if(e)return t(e);for(var n=[],r=[],o=0,i=c.length;o=r?"sliceUploadFile":"putObject",params:e,callback:m})}),n._addTasks(f)}var h=n(20),p=n(3).EventProxy,g=n(0),y={sliceUploadFile:r,abortUploadTask:l,uploadFiles:d};g.each(y,function(e,n){t[n]=g.apiWrapper(n,e)})},function(e,t){var n=function(e,t,n,r){if(r=r||function(){},!e.length||t<=0)return r();var o=0,i=0,a=0;!function s(){if(o>=e.length)return r();for(;a=e.length?r():s())})}()},r=function(e,t,n){var r=function(o){t(function(t,i){t&&o -1) { @@ -1806,7 +1765,7 @@ function getUrl(params) { } } domain = domain.replace(/\{\{AppId\}\}/ig, appId) - .replace(/\{\{Bucket\}\}/ig, bucket) + .replace(/\{\{Bucket\}\}/ig, shortBucket) .replace(/\{\{Region\}\}/ig, region) .replace(/\{\{.*?\}\}/ig, ''); if (!/^[a-zA-Z]+:\/\//.test(domain)) { @@ -1845,10 +1804,8 @@ function getAuthorizationAsync(params, callback) { }); } else if (self.options.getSTS) { // 外部获取临时密钥 var Bucket = params.Bucket || ''; - var AppId = params.AppId || self.options.AppId || ''; - var StsBucket = Bucket ? Bucket + '-' + AppId : ''; self._StsMap = self._StsMap || {}; - var StsData = self._StsMap[StsBucket] || {}; + var StsData = self._StsMap[Bucket] || {}; var runTemp = function () { var Authorization = util.getAuth({ SecretId: StsData.SecretId, @@ -1869,9 +1826,9 @@ function getAuthorizationAsync(params, callback) { runTemp(); } else { // 如果有效时间小于 60 秒就重新获取临时密钥 self.options.getSTS.call(self, { - Bucket: StsBucket + Bucket: Bucket }, function (data) { - StsData = self._StsMap[StsBucket] = data || {}; + StsData = self._StsMap[Bucket] = data || {}; runTemp(); }); } @@ -1926,7 +1883,6 @@ function _submitRequest(params, callback) { region: region, object: object, action: action, - appId: params.AppId || self.options.AppId, }), method: method, headers: headers || {}, @@ -1949,7 +1905,7 @@ function _submitRequest(params, callback) { // progress if (params.onProgress && typeof params.onProgress === 'function') { - var contentLength = body && body.size || 0; + var contentLength = body && (body.size || body.length) || 0; opt.onProgress = function (e) { if (TaskId && !self._isRunningTask(TaskId)) return; var loaded = e ? e.loaded : 0; diff --git a/src/cos.js b/src/cos.js index dd5291f..eb6d0fd 100644 --- a/src/cos.js +++ b/src/cos.js @@ -22,7 +22,7 @@ var defaultOptions = { // 对外暴露的类 var COS = function (options) { if (options.AppId) { - console.warn('AppId has been deprecated, Please put it at the end of parameter Bucket(E.g: "test-1250000000").'); + console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g: "test-1250000000").'); } this.options = util.extend(util.clone(defaultOptions), options || {}); event.init(this); @@ -33,6 +33,6 @@ util.extend(COS.prototype, base); util.extend(COS.prototype, advance); COS.getAuthorization = util.getAuth; -COS.version = '0.3.4'; +COS.version = '0.3.6'; module.exports = COS; diff --git a/src/event.js b/src/event.js index 75c1827..6f5765c 100644 --- a/src/event.js +++ b/src/event.js @@ -6,7 +6,7 @@ var initEvent = function (cos) { }; cos.on = function (action, callback) { if (action === 'task-list-update') { - console.warn('Event "' + action + '" has been deprecated. Please use "list-update" instead.'); + console.warn('warning: Event "' + action + '" has been deprecated. Please use "list-update" instead.'); } getList(action).push(callback); }; diff --git a/src/task.js b/src/task.js index f91ce86..8152438 100644 --- a/src/task.js +++ b/src/task.js @@ -77,6 +77,7 @@ var initTask = function (cos) { var killTask = function (id, switchToState) { var task = tasks[id]; + if (!task) return; var waiting = task && task.state === 'waiting'; var running = task && (task.state === 'checking' || task.state === 'uploading'); if (switchToState === 'canceled' && task.state !== 'canceled' || diff --git a/src/util.js b/src/util.js index 7647db5..44a82f5 100644 --- a/src/util.js +++ b/src/util.js @@ -237,7 +237,7 @@ var apiWrapper = function (apiName, apiFn) { }; return function (params, callback) { callback = callback || function () { - }; + }; if (apiName !== 'getService' && apiName !== 'abortUploadTask') { // 判断参数是否完整 if (!checkParams(apiName, params)) { @@ -255,20 +255,21 @@ var apiWrapper = function (apiName, apiFn) { return; } // 兼容不带 AppId 的 Bucket - var appId, m, bucket = params.Bucket; - if (bucket) { - if (m = bucket.match(/^(.+)-(\d+)$/)) { - appId = m[2]; - bucket = m[1]; - params.AppId = appId; - params.Bucket = bucket; - } else if (!params.AppId) { - if (this.options.AppId) { - params.AppId = this.options.AppId; + if (params.Bucket) { + if (!/^(.+)-(\d+)$/.test(params.Bucket)) { + if (params.AppId) { + params.Bucket = params.Bucket + '-' + params.AppId; + } else if (this.options.AppId) { + params.Bucket = params.Bucket + '-' + this.options.AppId; } else { callback({error: 'Bucket should format as "test-1250000000".'}); + return; } } + if (params.AppId) { + console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g Bucket:"test-1250000000" ).'); + delete params.AppId; + } } // 兼容带有斜杠开头的 Key if (params.Key && params.Key.substr(0, 1) === '/') { @@ -349,9 +350,9 @@ var util = { filter: filter, clone: clone, uuid: uuid, - fileSlice: fileSlice, throttleOnProgress: throttleOnProgress, - isBrowser: !!global.document + isBrowser: !!global.document, + fileSlice: fileSlice, }; diff --git a/test/test.js b/test/test.js index d3bf14c..3d35f93 100644 --- a/test/test.js +++ b/test/test.js @@ -1,5 +1,5 @@ var config = { - Bucket: 'test-1251902136', + Bucket: 'test-1250000000', Region: 'ap-guangzhou' }; @@ -62,7 +62,7 @@ var cos = new COS({ ProgressInterval: 1, // 控制 onProgress 回调的间隔 }); -var AppId; +var AppId = config.AppId; var Bucket = config.Bucket; var BucketShortName = Bucket; var BucketLongName = Bucket + '-' + AppId;