From 10df7f7897b54cbc1fac4650ba5f774cd1de8836 Mon Sep 17 00:00:00 2001 From: chrisftian Date: Thu, 20 Oct 2022 14:55:29 +0800 Subject: [PATCH] Feat/1.4.9 (#161) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix 1.4.8 * upd * feat:1.4.9 1、修复getSourceParams使用不当部分 2、protocol兼容不带冒号的http、https 3、合法域名校验支持cos内网、cn域名 4、d.ts补充 * upd:ios qq里兼容处理 * upd tracker --- dist/cos-js-sdk-v5.js | 59 +++++++++++++++++++++++++++++---------- dist/cos-js-sdk-v5.min.js | 2 +- index.d.ts | 6 +++- package.json | 2 +- src/base.js | 19 ++++++++----- src/tracker.js | 3 +- src/util.js | 27 ++++++++++++++---- 7 files changed, 87 insertions(+), 31 deletions(-) diff --git a/dist/cos-js-sdk-v5.js b/dist/cos-js-sdk-v5.js index 6fca392..e058f5d 100644 --- a/dist/cos-js-sdk-v5.js +++ b/dist/cos-js-sdk-v5.js @@ -7212,7 +7212,7 @@ module.exports = function(module) { /*! exports provided: name, version, description, main, types, scripts, repository, keywords, author, license, bugs, homepage, dependencies, devDependencies, default */ /***/ (function(module) { -module.exports = JSON.parse("{\"name\":\"cos-js-sdk-v5\",\"version\":\"1.4.8\",\"description\":\"JavaScript SDK for [腾讯云对象存储](https://cloud.tencent.com/product/cos)\",\"main\":\"dist/cos-js-sdk-v5.js\",\"types\":\"index.d.ts\",\"scripts\":{\"server\":\"node server/sts.js\",\"dev\":\"cross-env NODE_ENV=development webpack -w --mode=development\",\"build\":\"cross-env NODE_ENV=production webpack --mode=production\",\"cos-auth.min.js\":\"uglifyjs ./demo/common/cos-auth.js -o ./demo/common/cos-auth.min.js -c -m\"},\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/tencentyun/cos-js-sdk-v5.git\"},\"keywords\":[],\"author\":\"carsonxu\",\"license\":\"ISC\",\"bugs\":{\"url\":\"https://github.com/tencentyun/cos-js-sdk-v5/issues\"},\"homepage\":\"https://github.com/tencentyun/cos-js-sdk-v5#readme\",\"dependencies\":{\"@xmldom/xmldom\":\"^0.8.2\"},\"devDependencies\":{\"@babel/core\":\"7.17.9\",\"@babel/plugin-transform-runtime\":\"7.18.10\",\"@babel/preset-env\":\"7.16.11\",\"babel-loader\":\"8.2.5\",\"body-parser\":\"^1.18.3\",\"cross-env\":\"^5.2.0\",\"express\":\"^4.16.4\",\"qcloud-cos-sts\":\"^3.0.2\",\"request\":\"^2.87.0\",\"terser-webpack-plugin\":\"4.2.3\",\"webpack\":\"4.46.0\",\"webpack-cli\":\"4.10.0\"}}"); +module.exports = JSON.parse("{\"name\":\"cos-js-sdk-v5\",\"version\":\"1.4.9\",\"description\":\"JavaScript SDK for [腾讯云对象存储](https://cloud.tencent.com/product/cos)\",\"main\":\"dist/cos-js-sdk-v5.js\",\"types\":\"index.d.ts\",\"scripts\":{\"server\":\"node server/sts.js\",\"dev\":\"cross-env NODE_ENV=development webpack -w --mode=development\",\"build\":\"cross-env NODE_ENV=production webpack --mode=production\",\"cos-auth.min.js\":\"uglifyjs ./demo/common/cos-auth.js -o ./demo/common/cos-auth.min.js -c -m\"},\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/tencentyun/cos-js-sdk-v5.git\"},\"keywords\":[],\"author\":\"carsonxu\",\"license\":\"ISC\",\"bugs\":{\"url\":\"https://github.com/tencentyun/cos-js-sdk-v5/issues\"},\"homepage\":\"https://github.com/tencentyun/cos-js-sdk-v5#readme\",\"dependencies\":{\"@xmldom/xmldom\":\"^0.8.2\"},\"devDependencies\":{\"@babel/core\":\"7.17.9\",\"@babel/plugin-transform-runtime\":\"7.18.10\",\"@babel/preset-env\":\"7.16.11\",\"babel-loader\":\"8.2.5\",\"body-parser\":\"^1.18.3\",\"cross-env\":\"^5.2.0\",\"express\":\"^4.16.4\",\"qcloud-cos-sts\":\"^3.0.2\",\"request\":\"^2.87.0\",\"terser-webpack-plugin\":\"4.2.3\",\"webpack\":\"4.46.0\",\"webpack-cli\":\"4.10.0\"}}"); /***/ }), @@ -11087,9 +11087,9 @@ function putObjectCopy(params, callback) { return; } - var SourceBucket = m[1]; - var SourceRegion = m[3]; - var SourceKey = decodeURIComponent(m[4]); + var SourceBucket = m.Bucket; + var SourceRegion = m.Region; + var SourceKey = decodeURIComponent(m.Key); submitRequest.call(this, { Scope: [{ action: 'name/cos:GetObject', @@ -11138,9 +11138,9 @@ function uploadPartCopy(params, callback) { return; } - var SourceBucket = m[1]; - var SourceRegion = m[3]; - var SourceKey = decodeURIComponent(m[4]); + var SourceBucket = m.Bucket; + var SourceRegion = m.Region; + var SourceKey = decodeURIComponent(m.Key); submitRequest.call(this, { Scope: [{ action: 'name/cos:GetObject', @@ -12130,6 +12130,11 @@ function getUrl(params) { Bucket: longBucket, Region: region }); + } // 兼容不带冒号的http、https + + + if (['http', 'https'].includes(params.protocol)) { + params.protocol = params.protocol + ':'; } var protocol = params.protocol || (util.isBrowser && location.protocol === 'http:' ? 'http:' : 'https:'); @@ -12550,7 +12555,8 @@ function _submitRequest(params, callback) { }); if (params.action) { - url = url + '?' + params.action; + // 已知问题,某些版本的qq会对url自动拼接(比如/upload被拼接成/upload=(null))导致签名错误,这里做下兼容。 + url = url + '?' + (util.isIOS_QQ ? "".concat(params.action, "=") : params.action); } if (params.qsStr) { @@ -13462,12 +13468,13 @@ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_m var pkg = __webpack_require__(/*! ../package.json */ "./package.json"); -var BeaconAction = __webpack_require__(/*! ../lib/beacon.min */ "./lib/beacon.min.js"); - var beacon = null; var getBeacon = function getBeacon(delay) { if (!beacon) { + // 不放在顶层是避免首次引入就被加载,从而避免在某些环境比如webworker里加载灯塔sdk内window相关对象报错 + var BeaconAction = __webpack_require__(/*! ../lib/beacon.min */ "./lib/beacon.min.js"); + beacon = new BeaconAction({ appkey: "0AND0VEVB24UBGDU", versionCode: pkg.version, @@ -14112,12 +14119,12 @@ var parseSelectPayload = function parseSelectPayload(chunk) { var getSourceParams = function getSourceParams(source) { var parser = this.options.CopySourceParser; if (parser) return parser(source); - var m = source.match(/^([^.]+-\d+)\.cos(v6|-cdc)?\.([^.]+)\.myqcloud\.com\/(.+)$/); + var m = source.match(/^([^.]+-\d+)\.cos(v6|-cdc|-internal)?\.([^.]+)\.((myqcloud\.com)|(tencentcos\.cn))\/(.+)$/); if (!m) return null; return { Bucket: m[1], Region: m[3], - Key: m[4] + Key: m[7] }; }; @@ -14584,7 +14591,7 @@ var apiWrapper = function apiWrapper(apiName, apiFn) { }; var errMsg = checkParams(); - var isSync = apiName === 'getAuth' || apiName === 'getObjectUrl'; + var isSync = apiName === 'getAuth'; if (typeof Promise === 'function' && !isSync && !callback) { return new Promise(function (resolve, reject) { @@ -14725,7 +14732,28 @@ var isNode = function isNode() { var isCIHost = function isCIHost(url) { return /^https?:\/\/([^/]+\.)?ci\.[^/]+/.test(url); -}; +}; //判断是否是ios + + +var isIOS = function () { + if ((typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) !== 'object') { + return false; + } + + var u = navigator.userAgent; + var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 + + return isIOS; +}(); // 判断是qq内置浏览器 + + +var isQQ = function () { + if ((typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) !== 'object') { + return false; + } + + return /\sQQ/i.test(navigator.userAgent); +}(); var util = { noop: noop, @@ -14760,7 +14788,8 @@ var util = { getSourceParams: getSourceParams, isBrowser: true, isNode: isNode, - isCIHost: isCIHost + isCIHost: isCIHost, + isIOS_QQ: isIOS && isQQ }; module.exports = util; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node_modules/process/browser.js */ "./node_modules/process/browser.js"))) diff --git a/dist/cos-js-sdk-v5.min.js b/dist/cos-js-sdk-v5.min.js index f6042db..cd0246f 100644 --- a/dist/cos-js-sdk-v5.min.js +++ b/dist/cos-js-sdk-v5.min.js @@ -1 +1 @@ -!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()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist/",n(n.s=11)}([function(e,t){function n(t){return e.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,n(t)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){"use strict";(function(t){var r=n(0),o=n(13),i=n(15),a=n(16),s=n(21),c=n(7);function u(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function l(e,t){var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(t?u(r).toLowerCase():r);return n.sort((function(e,t){return(e=e.toLowerCase())===(t=t.toLowerCase())?0:e>t?1:-1}))}var d,p=["content-disposition","content-encoding","content-length","content-md5","expect","host","if-match","if-modified-since","if-none-match","if-unmodified-since","origin","range","response-cache-control","response-content-disposition","response-content-encoding","response-content-language","response-content-type","response-expires","transfer-encoding","versionid"],f=function(e,t,n){var r=t/8,o=e.slice(n,n+r);return new Uint8Array(o).reverse(),new{8:Uint8Array,16:Uint16Array,32:Uint32Array}[t](o)[0]},h=function(e,t,n,r){var o=e.slice(t,n),i="";return new Uint8Array(o).forEach((function(e){i+=String.fromCharCode(e)})),r&&(i=decodeURIComponent(escape(i))),i},m=function(){},g=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&void 0!==e[n]&&null!==e[n]&&(t[n]=e[n]);return t},y=(d=function(e,t){e=e.split("."),t=t.split(".");for(var n=0;nparseInt(t[n])?1:-1;return 0},function(e){if(!e)return!1;var t=(e.match(/Chrome\/([.\d]+)/)||[])[1],n=(e.match(/QBCore\/([.\d]+)/)||[])[1],r=(e.match(/QQBrowser\/([.\d]+)/)||[])[1];return t&&d(t,"53.0.2785.116")<0&&n&&d(n,"3.53.991.400")<0&&r&&d(r,"9.0.2524.400")<=0||!1}("undefined"!=typeof navigator&&navigator.userAgent)),v=1048576;function C(e){return w(e,(function(e){return"object"===r(e)&&null!==e?C(e):e}))}function k(e,t){return b(t,(function(n,r){e[r]=t[r]})),e}function S(e){return e instanceof Array}function b(e,t){for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)}function w(e,t){var n=S(e)?[]:{};for(var r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r],r));return n}var T=function(e,t){var n=t.Bucket,r=t.Region,o=t.Key,i=this.options.Domain,a=!i||"string"==typeof i&&i.indexOf("{Bucket}")>-1,s=!i||"string"==typeof i&&i.indexOf("{Region}")>-1;if(e.indexOf("Bucket")>-1||"deleteMultipleObject"===e||"multipartList"===e||"listObjectVersions"===e){if(a&&!n)return"Bucket";if(s&&!r)return"Region"}else if(e.indexOf("Object")>-1||e.indexOf("multipart")>-1||"sliceUploadFile"===e||"abortUploadTask"===e){if(a&&!n)return"Bucket";if(s&&!r)return"Region";if(!o)return"Key"}return!1},R=function(e,t){if(t=k({},t),"getAuth"!==e&&"getV4Auth"!==e&&"getObjectUrl"!==e){var n=t.Headers||{};if(t&&"object"===r(t)){!function(){for(var e in t)t.hasOwnProperty(e)&&e.indexOf("x-cos-")>-1&&(n[e]=t[e])}();x.each({"x-cos-mfa":"MFA","Content-MD5":"ContentMD5","Content-Length":"ContentLength","Content-Type":"ContentType",Expect:"Expect",Expires:"Expires","Cache-Control":"CacheControl","Content-Disposition":"ContentDisposition","Content-Encoding":"ContentEncoding",Range:"Range","If-Modified-Since":"IfModifiedSince","If-Unmodified-Since":"IfUnmodifiedSince","If-Match":"IfMatch","If-None-Match":"IfNoneMatch","x-cos-copy-source":"CopySource","x-cos-copy-source-Range":"CopySourceRange","x-cos-metadata-directive":"MetadataDirective","x-cos-copy-source-If-Modified-Since":"CopySourceIfModifiedSince","x-cos-copy-source-If-Unmodified-Since":"CopySourceIfUnmodifiedSince","x-cos-copy-source-If-Match":"CopySourceIfMatch","x-cos-copy-source-If-None-Match":"CopySourceIfNoneMatch","x-cos-acl":"ACL","x-cos-grant-read":"GrantRead","x-cos-grant-write":"GrantWrite","x-cos-grant-full-control":"GrantFullControl","x-cos-grant-read-acp":"GrantReadAcp","x-cos-grant-write-acp":"GrantWriteAcp","x-cos-storage-class":"StorageClass","x-cos-traffic-limit":"TrafficLimit","x-cos-mime-limit":"MimeLimit","x-cos-server-side-encryption-customer-algorithm":"SSECustomerAlgorithm","x-cos-server-side-encryption-customer-key":"SSECustomerKey","x-cos-server-side-encryption-customer-key-MD5":"SSECustomerKeyMD5","x-cos-server-side-encryption":"ServerSideEncryption","x-cos-server-side-encryption-cos-kms-key-id":"SSEKMSKeyId","x-cos-server-side-encryption-context":"SSEContext"},(function(e,r){void 0!==t[e]&&(n[r]=t[e])})),t.Headers=g(n)}}return t},E=function(e){return Date.now()+(e||0)},x={noop:m,formatParams:R,apiWrapper:function(e,t){return function(n,r){var o,i=this;if("function"==typeof n&&(r=n,n={}),n=R(e,n),i.options.EnableTracker)if("sliceUploadFile"===n.calledBySdk)o=n.tracker&&n.tracker.generateSubTracker({apiName:e});else if(["uploadFile","uploadFiles"].includes(e))o=null;else{var a=-1;n.Body&&(a="string"==typeof n.Body?n.Body.length:n.Body.size||n.Body.byteLength||-1),o=new c({bucket:n.Bucket,region:n.Region,apiName:e,fileKey:n.Key,fileSize:a,deepTracker:i.options.DeepTracker,customId:i.options.CustomId,delay:i.options.TrackerDelay})}n.tracker=o;var s=function(e){return e&&e.headers&&(e.headers["x-cos-request-id"]&&(e.RequestId=e.headers["x-cos-request-id"]),e.headers["x-ci-request-id"]&&(e.RequestId=e.headers["x-ci-request-id"]),e.headers["x-cos-version-id"]&&(e.VersionId=e.headers["x-cos-version-id"]),e.headers["x-cos-delete-marker"]&&(e.DeleteMarker=e.headers["x-cos-delete-marker"])),e},u=function(e,t){o&&o.formatResult(e,t),r&&r(s(e),s(t))},l=function(){if("getService"!==e&&"abortUploadTask"!==e){var t=T.call(i,e,n);if(t)return"missing param "+t;if(n.Region){if(i.options.CompatibilityMode){if(!/^([a-z\d-.]+)$/.test(n.Region))return"Region format error."}else{if(n.Region.indexOf("cos.")>-1)return'param Region should not be start with "cos."';if(!/^([a-z\d-]+)$/.test(n.Region))return"Region format error."}!i.options.CompatibilityMode&&-1===n.Region.indexOf("-")&&"yfb"!==n.Region&&"default"!==n.Region&&n.Region}if(n.Bucket){if(!/^([a-z\d-]+)-(\d+)$/.test(n.Bucket))if(n.AppId)n.Bucket=n.Bucket+"-"+n.AppId;else{if(!i.options.AppId)return'Bucket should format as "test-1250000000".';n.Bucket=n.Bucket+"-"+i.options.AppId}n.AppId&&delete n.AppId}!i.options.UseRawKey&&n.Key&&"/"===n.Key.substr(0,1)&&(n.Key=n.Key.substr(1))}}(),d="getAuth"===e||"getObjectUrl"===e;if("function"==typeof Promise&&!d&&!r)return new Promise((function(e,o){if(r=function(t,n){t?o(t):e(n)},l)return u(x.error(new Error(l)));t.call(i,n,u)}));if(l)return u(x.error(new Error(l)));var p=t.call(i,n,u);return d?p:void 0}},xml2json:a,json2xml:s,md5:o,clearKey:g,fileSlice:function(e,t,n,r,o){var i;if(e.slice?i=e.slice(t,n):e.mozSlice?i=e.mozSlice(t,n):e.webkitSlice&&(i=e.webkitSlice(t,n)),r&&y){var a=new FileReader;a.onload=function(e){i=null,o(new Blob([a.result]))},a.readAsArrayBuffer(i)}else o(i)},getBodyMd5:function(e,t,n,r){n=n||m,e?"string"==typeof t?n(x.md5(t,!0)):Blob&&t instanceof Blob?x.getFileMd5(t,(function(e,t){n(t)}),r):n():n()},getFileMd5:function(e,t,n){var r=e.size,i=0,a=o.getCtx();!function o(s){if(s>=r){var c=a.digest("hex");t(null,c)}else{var u=Math.min(r,s+v);x.fileSlice(e,s,u,!1,(function(e){!function(e,t){var n,r=new FileReader;FileReader.prototype.readAsBinaryString?(n=FileReader.prototype.readAsBinaryString,r.onload=function(){t(this.result)}):FileReader.prototype.readAsArrayBuffer&&(n=function(e){var n="",r=new FileReader;r.onload=function(e){for(var o=new Uint8Array(r.result),i=o.byteLength,a=0;a-1||p.indexOf(r)>-1)&&(t[n]=e[n])}return t}(C(e.Headers||e.headers||{})),u=e.Key||"";e.UseRawKey?t=e.Pathname||e.pathname||"/"+u:0!==(t=e.Pathname||e.pathname||u).indexOf("/")&&(t="/"+t);var d=!1!==e.ForceSignHost;if(!c.Host&&!c.host&&e.Bucket&&e.Region&&d&&(c.Host=e.Bucket+".cos."+e.Region+".myqcloud.com"),!n)throw new Error("missing param SecretId");if(!r)throw new Error("missing param SecretKey");var f=Math.round(E(e.SystemClockOffset)/1e3)-1,h=f,m=e.Expires||e.expires;h+=void 0===m?900:1*m||0;var g=n,y=o||f+";"+h,v=o||f+";"+h,k=l(c,!0).join(";").toLowerCase(),S=l(s,!0).join(";").toLowerCase(),b=i.HmacSHA1(v,r).toString(),w=[a,t,x.obj2str(s,!0),x.obj2str(c,!0),""].join("\n"),T=["sha1",y,i.SHA1(w).toString(),""].join("\n");return["q-sign-algorithm=sha1","q-ak="+g,"q-sign-time="+y,"q-key-time="+v,"q-header-list="+k,"q-url-param-list="+S,"q-signature="+i.HmacSHA1(T,b).toString()].join("&")},parseSelectPayload:function(e){for(var t={},n=h(e),r={records:[]};e.byteLength;){var o,i=f(e,32,0),a=f(e,32,4),s=i-a-16,c=0;for(e=e.slice(12);c1)for(var n=1;n=0))throw x(R,new Error(e.tagName+"@"+n));for(var o=t.length-1;r"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function L(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(L(e,t))return!0}while(e=e.nextSibling)}function H(){}function j(e,t,n,o){e&&e._inc++,n.namespaceURI===r.XMLNS&&delete t._nsMap[n.prefix?n.localName:""]}function F(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n)r[r.length++]=n;else{for(var o=t.firstChild,i=0;o;)r[i++]=o,o=o.nextSibling;r.length=i,delete r[r.length]}}}function K(e,t){var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,F(e.ownerDocument,e),t}function q(e,t,n){var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===k){var o=t.firstChild;if(null==o)return t;var i=t.lastChild}else o=i=t;var a=n?n.previousSibling:e.lastChild;o.previousSibling=a,i.nextSibling=n,a?a.nextSibling=o:e.firstChild=o,null==n?e.lastChild=i:n.previousSibling=i;do{o.parentNode=e}while(o!==i&&(o=o.nextSibling));return F(e.ownerDocument||e,e),t.nodeType==k&&(t.firstChild=t.lastChild=null),t}function z(){this._nsMap={}}function G(){}function V(){}function X(){}function W(){}function J(){}function Q(){}function $(){}function Y(){}function Z(){}function ee(){}function te(){}function ne(){}function re(e,t){var n=[],r=9==this.nodeType&&this.documentElement||this,o=r.prefix,i=r.namespaceURI;if(i&&null==o&&null==(o=r.lookupPrefix(i)))var a=[{namespace:i,prefix:null}];return ae(this,n,e,t,a),n.join("")}function oe(e,t,n){var o=e.prefix||"",i=e.namespaceURI;if(!i)return!1;if("xml"===o&&i===r.XML||i===r.XMLNS)return!1;for(var a=n.length;a--;){var s=n[a];if(s.prefix===o)return s.namespace!==i}return!0}function ie(e,t,n){e.push(" ",t,'="',n.replace(/[<>&"\t\n\r]/g,M),'"')}function ae(e,t,n,o,i){if(i||(i=[]),o){if(!(e=o(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case l:var a=e.attributes,s=a.length,c=e.firstChild,u=e.tagName,m=u;if(!(n=r.isHTML(e.namespaceURI)||n)&&!e.prefix&&e.namespaceURI){for(var S,b=0;b=0;w--){if(""===(T=i[w]).prefix&&T.namespace===e.namespaceURI){S=T.namespace;break}}if(S!==e.namespaceURI)for(w=i.length-1;w>=0;w--){var T;if((T=i[w]).namespace===e.namespaceURI){T.prefix&&(m=T.prefix+":"+u);break}}}t.push("<",m);for(var R=0;R"),n&&/^script$/i.test(u))for(;c;)c.data?t.push(c.data):ae(c,t,n,o,i.slice()),c=c.nextSibling;else for(;c;)ae(c,t,n,o,i.slice()),c=c.nextSibling;t.push("")}else t.push("/>");return;case v:case k:for(c=e.firstChild;c;)ae(c,t,n,o,i.slice()),c=c.nextSibling;return;case d:return ie(t,e.name,e.value);case p:return t.push(e.data.replace(/[<&>]/g,M));case f:return t.push("");case y:return t.push("\x3c!--",e.data,"--\x3e");case C:var B=e.publicId,I=e.systemId;if(t.push("");else if(I&&"."!=I)t.push(" SYSTEM ",I,">");else{var _=e.internalSubset;_&&t.push(" [",_,"]"),t.push(">")}return;case g:return t.push("");case h:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function se(e,t,n){var r;switch(t.nodeType){case l:(r=t.cloneNode(!1)).ownerDocument=e;case k:break;case d:n=!0}if(r||(r=t.cloneNode(!1)),r.ownerDocument=e,r.parentNode=null,n)for(var o=t.firstChild;o;)r.appendChild(se(e,o,n)),o=o.nextSibling;return r}function ce(e,t,n){var r=new t.constructor;for(var o in t){var i=t[o];"object"!=typeof i&&i!=r[o]&&(r[o]=i)}switch(t.childNodes&&(r.childNodes=new A),r.ownerDocument=e,r.nodeType){case l:var a=t.attributes,s=r.attributes=new _,c=a.length;s._ownerElement=r;for(var u=0;u0},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n)for(var r in n)if(n[r]==e)return r;t=t.nodeType==d?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&e in n)return n[e];t=t.nodeType==d?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},s(u,U),s(u,U.prototype),H.prototype={nodeName:"#document",nodeType:v,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==k){for(var n=e.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,t),n=r}return e}return null==this.documentElement&&e.nodeType==l&&(this.documentElement=e),q(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),K(this,e)},importNode:function(e,t){return se(this,e,t)},getElementById:function(e){var t=null;return L(this.documentElement,(function(n){if(n.nodeType==l&&n.getAttribute("id")==e)return t=n,!0})),t},getElementsByClassName:function(e){var t=a(e);return new B(this,(function(n){var r=[];return t.length>0&&L(n.documentElement,(function(o){if(o!==n&&o.nodeType===l){var i=o.getAttribute("class");if(i){var s=e===i;if(!s){var c=a(i);s=t.every((u=c,function(e){return u&&-1!==u.indexOf(e)}))}s&&r.push(o)}}var u})),r}))},createElement:function(e){var t=new z;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new A,(t.attributes=new _)._ownerElement=t,t},createDocumentFragment:function(){var e=new ee;return e.ownerDocument=this,e.childNodes=new A,e},createTextNode:function(e){var t=new X;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new W;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new J;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new te;return n.ownerDocument=this,n.tagName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new G;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Z;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new z,r=t.split(":"),o=n.attributes=new _;return n.childNodes=new A,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,o._ownerElement=n,n},createAttributeNS:function(e,t){var n=new G,r=t.split(":");return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,n}},c(H,U),z.prototype={nodeType:l,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===k?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,F(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||""},setAttributeNS:function(e,t,n){var r=this.ownerDocument.createAttributeNS(e,t);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new B(this,(function(t){var n=[];return L(t,(function(r){r===t||r.nodeType!=l||"*"!==e&&r.tagName!=e||n.push(r)})),n}))},getElementsByTagNameNS:function(e,t){return new B(this,(function(n){var r=[];return L(n,(function(o){o===n||o.nodeType!==l||"*"!==e&&o.namespaceURI!==e||"*"!==t&&o.localName!=t||r.push(o)})),r}))}},H.prototype.getElementsByTagName=z.prototype.getElementsByTagName,H.prototype.getElementsByTagNameNS=z.prototype.getElementsByTagNameNS,c(z,U),G.prototype.nodeType=d,c(G,U),V.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(w[T])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,n){n=this.data.substring(0,e)+n+this.data.substring(e+t),this.nodeValue=this.data=n,this.length=n.length}},c(V,U),X.prototype={nodeName:"#text",nodeType:p,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},c(X,V),W.prototype={nodeName:"#comment",nodeType:y},c(W,V),J.prototype={nodeName:"#cdata-section",nodeType:f},c(J,V),Q.prototype.nodeType=C,c(Q,U),$.prototype.nodeType=S,c($,U),Y.prototype.nodeType=m,c(Y,U),Z.prototype.nodeType=h,c(Z,U),ee.prototype.nodeName="#document-fragment",ee.prototype.nodeType=k,c(ee,U),te.prototype.nodeType=g,c(te,U),ne.prototype.serializeToString=function(e,t,n){return re.call(e,t,n)},U.prototype.toString=re;try{if(Object.defineProperty){function le(e){switch(e.nodeType){case l:case k:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(le(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(B.prototype,"length",{get:function(){return I(this),this.$$length}}),Object.defineProperty(U.prototype,"textContent",{get:function(){return le(this)},set:function(e){switch(this.nodeType){case l:case k:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),ue=function(e,t,n){e["$$"+t]=n}}}catch(de){}t.DocumentType=Q,t.DOMException=x,t.DOMImplementation=N,t.Element=z,t.Node=U,t.NodeList=A,t.XMLSerializer=ne},function(e,t,n){var r=n(22),o=n(23),i=n(0),a=n(8),s=n(24),c=null,u=function(e){return c||(c=new s({appkey:"0AND0VEVB24UBGDU",versionCode:a.version,channelID:"js_sdk",openid:"openid",unionid:"unid",strictMode:!1,delay:e,sessionDuration:6e4})),c},l=function(){var e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},d=function(){if("object"===("undefined"==typeof navigator?"undefined":i(navigator))){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return(null==e?void 0:e.type)||(null==e?void 0:e.effectiveType)||"unknown"}return"unknown"},p=function(){if("object"!==("undefined"==typeof navigator?"undefined":i(navigator)))return"unknown os";var e=navigator.userAgent.toLowerCase(),t=/macintosh|mac os x/i.test(navigator.userAgent);return e.indexOf("win32")>=0||e.indexOf("wow32")>=0?"win32":e.indexOf("win64")>=0||e.indexOf("wow64")>=0?"win64":t?"mac":"unknown os"},f=function(){return!("object"!==("undefined"==typeof navigator?"undefined":i(navigator))||!navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))},h=function(){return!("object"!==("undefined"==typeof navigator?"undefined":i(navigator))||!navigator.userAgent.match(/(Android|Adr|Linux)/i))},m=function(){return!("object"!==("undefined"==typeof navigator?"undefined":i(navigator))||!navigator.userAgent.match(/(iPhone|iPod|iPad|iOS)/i))},g=function(){if("object"!==("undefined"==typeof navigator?"undefined":i(navigator)))return"unknown device";var e=navigator.userAgent.toLowerCase();if(e.includes("app/tencent_wemeet"))return"tencent_wemeet";if(e.indexOf("maxthon")>=0){var t=e.match(/maxthon\/([\d.]+)/),n=t&&t[1]||"";return"傲游浏览器 ".concat(n).trim()}if(e.indexOf("qqbrowser")>=0){var r=e.match(/qqbrowser\/([\d.]+)/),o=r&&r[1]||"";return"QQ浏览器 ".concat(o).trim()}if(e.indexOf("se 2.x")>=0)return"搜狗浏览器";if(e.indexOf("wxwork")>=0)return"微信内置浏览器";if(e.indexOf("msie")>=0){var a=e.match(/msie ([\d.]+)/),s=a&&a[1]||"";return"IE ".concat(s).trim()}if(e.indexOf("firefox")>=0){var c=e.match(/firefox\/([\d.]+)/),u=c&&c[1]||"";return"Firefox ".concat(u).trim()}if(e.indexOf("chrome")>=0){var l=e.match(/chrome\/([\d.]+)/),d=l&&l[1]||"";return"Chrome ".concat(d).trim()}if(e.indexOf("opera")>=0){var p=e.match(/opera.([\d.]+)/),f=p&&p[1]||"";return"Opera ".concat(f).trim()}if(e.indexOf("safari")>=0){var h=e.match(/version\/([\d.]+)/),m=h&&h[1]||"";return"Safari ".concat(m).trim()}if(e.indexOf("edge")>=0){var g=e.match(/edge\/([\d.]+)/),y=g&&g[1]||"";return"edge ".concat(y).trim()}return e.substr(0,200)},y={isMobile:f(),isBrowser:!f(),mobileOsType:h()?"android":m?"ios":"other_mobile",pcOsType:p()},v={deviceType:y.isMobile?"mobile":y.isBrowser?"browser":"unknown",devicePlatform:y.isMobile?y.mobileOsType:y.pcOsType,deviceName:g()},C=["multipartInit","multipartUpload","multipartComplete","multipartList","multipartListPart","multipartAbort"],k=["putObject","postObject","appendObject","sliceUploadFile","uploadFile","uploadFiles"].concat(C),S=["getObject"];function b(e){return e.replace(/([A-Z])/g,"_$1").toLowerCase()}var w=function(){"use strict";function e(t){r(this,e);var n=t.parent,o=t.traceId,i=t.bucket,s=t.region,c=t.apiName,d=t.fileKey,p=t.fileSize,f=t.accelerate,h=t.customId,m=t.delay,g=t.deepTracker,y=i&&i.substr(i.lastIndexOf("-")+1)||"";this.parent=n,this.deepTracker=g,this.delay=m,this.params={cossdkVersion:a.version,region:s,networkType:"",host:"",accelerate:f?"Y":"N",requestPath:d||"",size:p||-1,httpMd5:0,httpSign:0,httpFull:0,name:c||"",result:"",tookTime:0,errorNode:"",errorCode:"",errorMessage:"",errorRequestId:"",errorStatusCode:0,errorServiceName:"",tracePlatform:"cos-js-sdk-v5",traceId:o||l(),bucket:i,appid:y,partNumber:0,retryTimes:0,reqUrl:"",customId:h||"",deviceType:v.deviceType,devicePlatform:v.devicePlatform,deviceName:v.deviceName,md5StartTime:0,md5EndTime:0,signStartTime:0,signEndTime:0,httpStartTime:0,httpEndTime:0,startTime:(new Date).getTime(),endTime:0},this.beacon=u(m)}return o(e,[{key:"formatResult",value:function(e,t){var n,r,o,i,a,s,c=(new Date).getTime()-this.params.startTime,u=d(),l=e?(null==e?void 0:e.code)||(null==e||null===(n=e.error)||void 0===n?void 0:n.code)||(null==e||null===(r=e.error)||void 0===r?void 0:r.Code):"",p=e?(null==e?void 0:e.message)||(null==e||null===(o=e.error)||void 0===o?void 0:o.message)||(null==e||null===(i=e.error)||void 0===i?void 0:i.Message):"",f=e?(null==e?void 0:e.resource)||(null==e||null===(a=e.error)||void 0===a?void 0:a.resource)||(null==e||null===(s=e.error)||void 0===s?void 0:s.Resource):"",h=e?null==e?void 0:e.statusCode:t.statusCode,m=e?(null==e?void 0:e.headers)&&(null==e?void 0:e.headers["x-cos-request-id"]):(null==t?void 0:t.headers)&&(null==t?void 0:t.headers["x-cos-request-id"]),g=e?m?"Server":"Client":"";if(Object.assign(this.params,{tookTime:c,networkType:u,httpMd5:this.params.md5EndTime-this.params.md5StartTime,httpSign:this.params.signEndTime-this.params.signStartTime,httpFull:this.params.httpEndTime-this.params.httpStartTime,result:e?"Fail":"Success",errorType:g,errorCode:l,errorStatusCode:h,errorMessage:p,errorServiceName:f,errorRequestId:m}),!e||l&&p||(this.params.fullError=e?JSON.stringify(e):""),"getObject"===this.params.name&&(this.params.size=t?t.headers&&t.headers["content-length"]:-1),this.params.reqUrl)try{var y=/^http(s)?:\/\/(.*?)\//.exec(this.params.reqUrl);this.params.host=y[2]}catch(e){this.params.host=this.params.reqUrl}this.sendEvents()}},{key:"setParams",value:function(e){Object.assign(this.params,e)}},{key:"sendEvents",value:function(){if(!C.includes(this.params.name)||this.deepTracker){var e,t=(e=this.params.name,k.includes(e)?"cos_upload":S.includes(e)?"cos_download":"base_service"),n=function(e){var t={},n="Success"===e.result?["tracePlatform","cossdkVersion","region","bucket","appid","networkType","host","accelerate","requestPath","partNumber","size","name","result","tookTime","errorRequestId","retryTimes","reqUrl","customId","deviceType","devicePlatform","deviceName"]:["tracePlatform","cossdkVersion","region","networkType","host","accelerate","requestPath","size","httpMd5","httpSign","httpFull","name","result","tookTime","errorNode","errorCode","errorMessage","errorRequestId","errorStatusCode","errorServiceName","errorType","traceId","bucket","appid","partNumber","retryTimes","reqUrl","customId","fullError","deviceType","devicePlatform","deviceName"];for(var r in e)n.includes(r)&&(t[b(r)]=e[r]);return t}(this.params);this.beacon||(this.beacon=u(this.delay||5e3)),0===this.delay?this.beacon&&this.beacon.onDirectUserAction(t,n):this.beacon&&this.beacon.onUserAction(t,n)}}},{key:"generateSubTracker",value:function(t){return Object.assign(t,{parent:this,deepTracker:this.deepTracker,traceId:this.params.traceId,bucket:this.params.bucket,region:this.params.region,fileKey:this.params.requestPath,customId:this.params.customId,delay:this.delay}),new e(t)}}]),e}();e.exports=w},function(e){e.exports=JSON.parse('{"name":"cos-js-sdk-v5","version":"1.4.8","description":"JavaScript SDK for [腾讯云对象存储](https://cloud.tencent.com/product/cos)","main":"dist/cos-js-sdk-v5.js","types":"index.d.ts","scripts":{"server":"node server/sts.js","dev":"cross-env NODE_ENV=development webpack -w --mode=development","build":"cross-env NODE_ENV=production webpack --mode=production","cos-auth.min.js":"uglifyjs ./demo/common/cos-auth.js -o ./demo/common/cos-auth.min.js -c -m"},"repository":{"type":"git","url":"git+https://github.com/tencentyun/cos-js-sdk-v5.git"},"keywords":[],"author":"carsonxu","license":"ISC","bugs":{"url":"https://github.com/tencentyun/cos-js-sdk-v5/issues"},"homepage":"https://github.com/tencentyun/cos-js-sdk-v5#readme","dependencies":{"@xmldom/xmldom":"^0.8.2"},"devDependencies":{"@babel/core":"7.17.9","@babel/plugin-transform-runtime":"7.18.10","@babel/preset-env":"7.16.11","babel-loader":"8.2.5","body-parser":"^1.18.3","cross-env":"^5.2.0","express":"^4.16.4","qcloud-cos-sts":"^3.0.2","request":"^2.87.0","terser-webpack-plugin":"4.2.3","webpack":"4.46.0","webpack-cli":"4.10.0"}}')},function(e,t){var n=function(e){var t={},n=function(e){return!t[e]&&(t[e]=[]),t[e]};e.on=function(e,t){n(e).push(t)},e.off=function(e,t){for(var r=n(e),o=r.length-1;o>=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;o=0;n--){var o=r[n][2];(!o||o+2592e3=0;o--){var i=r[o];i[0]===e&&i[1]===t&&r.splice(o,1)}r.unshift([e,t,Math.round(Date.now()/1e3)]),r.length>n&&r.splice(n),l()}},removeUploadId:function(e){u.call(this),delete d.using[e];for(var t=r.length-1;t>=0;t--)r[t][1]===e&&r.splice(t,1);l()}};e.exports=d},function(e,t,n){var r=n(12);e.exports=r},function(e,t,n){"use strict";var r=n(1),o=n(9),i=n(25),a=n(26),s=n(28),c=n(8),u={AppId:"",SecretId:"",SecretKey:"",SecurityToken:"",ChunkRetryTimes:2,FileParallelLimit:3,ChunkParallelLimit:3,ChunkSize:1048576,SliceSize:1048576,CopyChunkParallelLimit:20,CopyChunkSize:10485760,CopySliceSize:10485760,MaxPartNumber:1e4,ProgressInterval:1e3,Domain:"",ServiceDomain:"",Protocol:"",CompatibilityMode:!1,ForcePathStyle:!1,UseRawKey:!1,Timeout:0,CorrectClockSkew:!0,SystemClockOffset:0,UploadCheckContentMd5:!1,UploadQueueSize:1e4,UploadAddMetaMd5:!1,UploadIdCacheLimit:50,UseAccelerate:!1,ForceSignHost:!0,EnableTracker:!1,DeepTracker:!1,TrackerDelay:5e3,CustomId:""},l=function(e){this.options=r.extend(r.clone(u),e||{}),this.options.FileParallelLimit=Math.max(1,this.options.FileParallelLimit),this.options.ChunkParallelLimit=Math.max(1,this.options.ChunkParallelLimit),this.options.ChunkRetryTimes=Math.max(0,this.options.ChunkRetryTimes),this.options.ChunkSize=Math.max(1048576,this.options.ChunkSize),this.options.CopyChunkParallelLimit=Math.max(1,this.options.CopyChunkParallelLimit),this.options.CopyChunkSize=Math.max(1048576,this.options.CopyChunkSize),this.options.CopySliceSize=Math.max(0,this.options.CopySliceSize),this.options.MaxPartNumber=Math.max(1024,Math.min(1e4,this.options.MaxPartNumber)),this.options.Timeout=Math.max(0,this.options.Timeout),this.options.AppId,this.options.SecretId&&this.options.SecretId.indexOf(" "),this.options.SecretKey&&this.options.SecretKey.indexOf(" "),r.isNode(),o.init(this),i.init(this)};a.init(l,i),s.init(l,i),l.util={md5:r.md5,xml2json:r.xml2json,json2xml:r.json2xml},l.getAuthorization=r.getAuth,l.version=c.version,e.exports=l},function(module,exports,__webpack_require__){(function(process,global,module){var __WEBPACK_AMD_DEFINE_RESULT__,_typeof=__webpack_require__(0);(function(){"use strict";var ERROR="input is invalid type",WINDOW="object"===("undefined"==typeof window?"undefined":_typeof(window)),root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"===("undefined"==typeof self?"undefined":_typeof(self)),NODE_JS=!root.JS_MD5_NO_NODE_JS&&"object"===(void 0===process?"undefined":_typeof(process))&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&"object"===_typeof(module)&&module.exports,AMD=__webpack_require__(14),ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}!root.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===_typeof(e)&&e.buffer&&e.buffer.constructor===ArrayBuffer});var createOutputMethod=function(e){return function(t,n){return new Md5(!0).update(t,n)[e]()}},createMethod=function(){var e=createOutputMethod("hex");NODE_JS&&(e=nodeWrap(e)),e.getCtx=e.create=function(){return new Md5},e.update=function(t){return e.create().update(t)};for(var t=0;t>6,s[r++]=128|63&n):n<55296||n>=57344?(s[r++]=224|n>>12,s[r++]=128|n>>6&63,s[r++]=128|63&n):(n=65536+((1023&n)<<10|1023&e.charCodeAt(++o)),s[r++]=240|n>>18,s[r++]=128|n>>12&63,s[r++]=128|n>>6&63,s[r++]=128|63&n);else for(r=this.start;o>2]|=n<>2]|=(192|n>>6)<>2]|=(128|63&n)<=57344?(a[r>>2]|=(224|n>>12)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<=64?(this.start=r-64,this.hash(),this.hashed=!0):this.start=r}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>2]|=EXTRA[3&t],t>=56&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var e,t,n,r,o,i,a=this.blocks;this.first?t=((t=((e=((e=a[0]-680876937)<<7|e>>>25)-271733879<<0)^(n=((n=(-271733879^(r=((r=(-1732584194^2004318071&e)+a[1]-117830708)<<12|r>>>20)+e<<0)&(-271733879^e))+a[2]-1126478375)<<17|n>>>15)+r<<0)&(r^e))+a[3]-1316259209)<<22|t>>>10)+n<<0:(e=this.h0,t=this.h1,n=this.h2,t=((t+=((e=((e+=((r=this.h3)^t&(n^r))+a[0]-680876936)<<7|e>>>25)+t<<0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+a[1]-389564586)<<12|r>>>20)+e<<0)&(e^t))+a[2]+606105819)<<17|n>>>15)+r<<0)&(r^e))+a[3]-1044525330)<<22|t>>>10)+n<<0),t=((t+=((e=((e+=(r^t&(n^r))+a[4]-176418897)<<7|e>>>25)+t<<0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+a[5]+1200080426)<<12|r>>>20)+e<<0)&(e^t))+a[6]-1473231341)<<17|n>>>15)+r<<0)&(r^e))+a[7]-45705983)<<22|t>>>10)+n<<0,t=((t+=((e=((e+=(r^t&(n^r))+a[8]+1770035416)<<7|e>>>25)+t<<0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+a[9]-1958414417)<<12|r>>>20)+e<<0)&(e^t))+a[10]-42063)<<17|n>>>15)+r<<0)&(r^e))+a[11]-1990404162)<<22|t>>>10)+n<<0,t=((t+=((e=((e+=(r^t&(n^r))+a[12]+1804603682)<<7|e>>>25)+t<<0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+a[13]-40341101)<<12|r>>>20)+e<<0)&(e^t))+a[14]-1502002290)<<17|n>>>15)+r<<0)&(r^e))+a[15]+1236535329)<<22|t>>>10)+n<<0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+a[1]-165796510)<<5|e>>>27)+t<<0)^t))+a[6]-1069501632)<<9|r>>>23)+e<<0)^e&((n=((n+=(e^t&(r^e))+a[11]+643717713)<<14|n>>>18)+r<<0)^r))+a[0]-373897302)<<20|t>>>12)+n<<0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+a[5]-701558691)<<5|e>>>27)+t<<0)^t))+a[10]+38016083)<<9|r>>>23)+e<<0)^e&((n=((n+=(e^t&(r^e))+a[15]-660478335)<<14|n>>>18)+r<<0)^r))+a[4]-405537848)<<20|t>>>12)+n<<0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+a[9]+568446438)<<5|e>>>27)+t<<0)^t))+a[14]-1019803690)<<9|r>>>23)+e<<0)^e&((n=((n+=(e^t&(r^e))+a[3]-187363961)<<14|n>>>18)+r<<0)^r))+a[8]+1163531501)<<20|t>>>12)+n<<0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+a[13]-1444681467)<<5|e>>>27)+t<<0)^t))+a[2]-51403784)<<9|r>>>23)+e<<0)^e&((n=((n+=(e^t&(r^e))+a[7]+1735328473)<<14|n>>>18)+r<<0)^r))+a[12]-1926607734)<<20|t>>>12)+n<<0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+a[5]-378558)<<4|e>>>28)+t<<0))+a[8]-2022574463)<<11|r>>>21)+e<<0)^e)^(n=((n+=(i^t)+a[11]+1839030562)<<16|n>>>16)+r<<0))+a[14]-35309556)<<23|t>>>9)+n<<0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+a[1]-1530992060)<<4|e>>>28)+t<<0))+a[4]+1272893353)<<11|r>>>21)+e<<0)^e)^(n=((n+=(i^t)+a[7]-155497632)<<16|n>>>16)+r<<0))+a[10]-1094730640)<<23|t>>>9)+n<<0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+a[13]+681279174)<<4|e>>>28)+t<<0))+a[0]-358537222)<<11|r>>>21)+e<<0)^e)^(n=((n+=(i^t)+a[3]-722521979)<<16|n>>>16)+r<<0))+a[6]+76029189)<<23|t>>>9)+n<<0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+a[9]-640364487)<<4|e>>>28)+t<<0))+a[12]-421815835)<<11|r>>>21)+e<<0)^e)^(n=((n+=(i^t)+a[15]+530742520)<<16|n>>>16)+r<<0))+a[2]-995338651)<<23|t>>>9)+n<<0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+a[0]-198630844)<<6|e>>>26)+t<<0)|~n))+a[7]+1126891415)<<10|r>>>22)+e<<0)^((n=((n+=(e^(r|~t))+a[14]-1416354905)<<15|n>>>17)+r<<0)|~e))+a[5]-57434055)<<21|t>>>11)+n<<0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+a[12]+1700485571)<<6|e>>>26)+t<<0)|~n))+a[3]-1894986606)<<10|r>>>22)+e<<0)^((n=((n+=(e^(r|~t))+a[10]-1051523)<<15|n>>>17)+r<<0)|~e))+a[1]-2054922799)<<21|t>>>11)+n<<0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+a[8]+1873313359)<<6|e>>>26)+t<<0)|~n))+a[15]-30611744)<<10|r>>>22)+e<<0)^((n=((n+=(e^(r|~t))+a[6]-1560198380)<<15|n>>>17)+r<<0)|~e))+a[13]+1309151649)<<21|t>>>11)+n<<0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+a[4]-145523070)<<6|e>>>26)+t<<0)|~n))+a[11]-1120210379)<<10|r>>>22)+e<<0)^((n=((n+=(e^(r|~t))+a[2]+718787259)<<15|n>>>17)+r<<0)|~e))+a[9]-343485551)<<21|t>>>11)+n<<0,this.first?(this.h0=e+1732584193<<0,this.h1=t-271733879<<0,this.h2=n-1732584194<<0,this.h3=r+271733878<<0,this.first=!1):(this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+n<<0,this.h3=this.h3+r<<0)},Md5.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(e){if("hex"===e)return this.hex();this.finalize();var t=this.h0,n=this.h1,r=this.h2,o=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255,255&o,o>>8&255,o>>16&255,o>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var e,t,n,r="",o=this.array(),i=0;i<15;)e=o[i++],t=o[i++],n=o[i++],r+=BASE64_ENCODE_CHAR[e>>>2]+BASE64_ENCODE_CHAR[63&(e<<4|t>>>4)]+BASE64_ENCODE_CHAR[63&(t<<2|n>>>6)]+BASE64_ENCODE_CHAR[63&n];return e=o[i],r+=BASE64_ENCODE_CHAR[e>>>2]+BASE64_ENCODE_CHAR[e<<4&63]+"=="};var exports=createMethod();COMMON_JS?module.exports=exports:(root.md5=exports,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()}).call(this,__webpack_require__(3),__webpack_require__(4),__webpack_require__(5)(module))},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t,n){(function(e){var t,r,o,i,a,s,c,u=n(0),l=l||function(e,t){var n={},r=n.lib={},o=function(){},i=r.Base={extend:function(e){o.prototype=this;var t=new o;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},a=r.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes;if(e=e.sigBytes,this.clamp(),r%4)for(var o=0;o>>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)}},u=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(u.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return u.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);if(t=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*i,o=e.min(4*t,o),t){for(var c=0;cu;u++){if(16>u)i[u]=0|e[t+u];else{var l=i[u-3]^i[u-8]^i[u-14]^i[u-16];i[u]=l<<1|l>>>31}l=(r<<5|r>>>27)+c+i[u],l=20>u?l+(1518500249+(o&a|~o&s)):40>u?l+(1859775393+(o^a^s)):60>u?l+((o&a|o&s|a&s)-1894007588):l+((o^a^s)-899497514),c=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]+c|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}}),t.SHA1=o._createHelper(a),t.HmacSHA1=o._createHmacHelper(a),function(){var e=l,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,c=a.words,u=0;u>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s>>6*(3-s)&63));var c=r.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,n=this._map,r=n.charAt(64);if(r){var o=e.indexOf(r);-1!=o&&(t=o)}for(var i=[],a=0,s=0;s>>6-s%4*2;i[a>>>2]|=(u|l)<<24-a%4*8,a++}return c.create(i,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},"object"===u(e)?e.exports=l:window.CryptoJS=l}).call(this,n(5)(e))},function(e,t,n){var r=n(17).DOMParser,o=function(){this.version="1.3.5";var e={mergeCDATA:!0,normalize:!0,stripElemPrefix:!0},t=new RegExp(/(?!xmlns)^.*:/);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(n,r){for(var i in r)e[i]=r[i];var a={},s=0,c="";if(n.childNodes.length)for(var u,l,d,p=0;p=t+n||t?new java.lang.String(e,t,n)+"":e}function g(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}p.prototype.parseFromString=function(e,t){var n=this.options,r=new l,o=n.domBuilder||new f,a=n.errorHandler,s=n.locator,u=n.xmlns||{},p=/\/x?html?$/.test(t),h=p?i.HTML_ENTITIES:i.XML_ENTITIES;s&&o.setDocumentLocator(s),r.errorHandler=function(e,t,n){if(!e){if(t instanceof f)return t;e=t}var r={},o=e instanceof Function;function i(t){var i=e[t];!i&&o&&(i=2==e.length?function(n){e(t,n)}:e),r[t]=i&&function(e){i("[xmldom "+t+"]\t"+e+function(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}(n))}||function(){}}return n=n||{},i("warning"),i("error"),i("fatalError"),r}(a,o,s),r.domBuilder=n.domBuilder||o,p&&(u[""]=c.HTML),u.xml=u.xml||c.XML;var m=n.normalizeLineEndings||d;return e&&"string"==typeof e?r.parse(m(e),u,h):r.errorHandler.error("invalid doc source"),o.doc},f.prototype={startDocument:function(){this.doc=(new s).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,r){var o=this.doc,i=o.createElementNS(e,n||t),a=r.length;g(this,i),this.currentElement=i,this.locator&&h(this.locator,i);for(var s=0;s",lt:"<",quot:'"'}),t.HTML_ENTITIES=r({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),t.entityMap=t.HTML_ENTITIES},function(e,t,n){var r=n(2).NAMESPACE,o=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,i=new RegExp("[\\-\\.0-9"+o.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),a=new RegExp("^"+o.source+i.source+"*(?::"+o.source+i.source+"*)?$");function s(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,s)}function c(){}function u(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function l(e,t,n,o,i,a){function s(e,t,r){n.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),n.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),r)}for(var c,u=++t,l=0;;){var d=e.charAt(u);switch(d){case"=":if(1===l)c=e.slice(t,u),l=3;else{if(2!==l)throw new Error("attribute equal must after attrName");l=3}break;case"'":case'"':if(3===l||1===l){if(1===l&&(a.warning('attribute value must after "="'),c=e.slice(t,u)),t=u+1,!((u=e.indexOf(d,t))>0))throw new Error("attribute value no end '"+d+"' match");s(c,p=e.slice(t,u),t-1),l=5}else{if(4!=l)throw new Error('attribute value must after "="');s(c,p=e.slice(t,u),t),a.warning('attribute "'+c+'" missed start quot('+d+")!!"),t=u+1,l=5}break;case"/":switch(l){case 0:n.setTagName(e.slice(t,u));case 5:case 6:case 7:l=7,n.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),0==l&&n.setTagName(e.slice(t,u)),u;case">":switch(l){case 0:n.setTagName(e.slice(t,u));case 5:case 6:case 7:break;case 4:case 1:"/"===(p=e.slice(t,u)).slice(-1)&&(n.closed=!0,p=p.slice(0,-1));case 2:2===l&&(p=c),4==l?(a.warning('attribute "'+p+'" missed quot(")!'),s(c,p,t)):(r.isHTML(o[""])&&p.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+p+'" missed value!! "'+p+'" instead!!'),s(p,p,t));break;case 3:throw new Error("attribute value missed!!")}return u;case"€":d=" ";default:if(d<=" ")switch(l){case 0:n.setTagName(e.slice(t,u)),l=6;break;case 1:c=e.slice(t,u),l=2;break;case 4:var p=e.slice(t,u);a.warning('attribute "'+p+'" missed quot(")!!'),s(c,p,t);case 5:l=6}else switch(l){case 2:n.tagName;r.isHTML(o[""])&&c.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),s(c,c,t),t=u,l=1;break;case 5:a.warning('attribute space is required"'+c+'"!!');case 6:l=1,t=u;break;case 3:l=4,t=u;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function d(e,t,n){for(var o=e.tagName,i=null,a=e.length;a--;){var s=e[a],c=s.qName,u=s.value;if((f=c.indexOf(":"))>0)var l=s.prefix=c.slice(0,f),d=c.slice(f+1),p="xmlns"===l&&d;else d=c,l=null,p="xmlns"===c&&"";s.localName=d,!1!==p&&(null==i&&(i={},h(n,n={})),n[p]=i[p]=u,s.uri=r.XMLNS,t.startPrefixMapping(p,u))}for(a=e.length;a--;){(l=(s=e[a]).prefix)&&("xml"===l&&(s.uri=r.XML),"xmlns"!==l&&(s.uri=n[l||""]))}var f;(f=o.indexOf(":"))>0?(l=e.prefix=o.slice(0,f),d=e.localName=o.slice(f+1)):(l=null,d=e.localName=o);var m=e.uri=n[l||""];if(t.startElement(m,d,o,e),!e.closed)return e.currentNSMap=n,e.localNSMap=i,!0;if(t.endElement(m,d,o),i)for(l in i)t.endPrefixMapping(l)}function p(e,t,n,r,o){if(/^(?:script|textarea)$/i.test(n)){var i=e.indexOf("",t),a=e.substring(t+1,i);if(/[&<]/.test(a))return/^script$/i.test(n)?(o.characters(a,0,a.length),i):(a=a.replace(/&#?\w+;/g,r),o.characters(a,0,a.length),i)}return t+1}function f(e,t,n,r){var o=r[n];return null==o&&((o=e.lastIndexOf(""))t?(n.comment(e,t+4,o-t-4),o+3):(r.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var o=e.indexOf("]]>",t+9);return n.startCDATA(),n.characters(e,t+9,o-t-9),n.endCDATA(),o+3}var i=function(e,t){var n,r=[],o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;o.lastIndex=t,o.exec(e);for(;n=o.exec(e);)if(r.push(n),n[1])return r}(e,t),a=i.length;if(a>1&&/!doctype/i.test(i[0][0])){var s=i[1][0],c=!1,u=!1;a>3&&(/^public$/i.test(i[2][0])?(c=i[3][0],u=a>4&&i[4][0]):/^system$/i.test(i[2][0])&&(u=i[3][0]));var l=i[a-1];return n.startDTD(s,c,u),n.endDTD(),l.index+l[0].length}return-1}function g(e,t,n){var r=e.indexOf("?>",t);if(r){var o=e.substring(t,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(o){o[0].length;return n.processingInstruction(o[1],o[2]),r+2}return-1}return-1}function y(){this.attributeNames={}}s.prototype=new Error,s.prototype.name=s.name,c.prototype={parse:function(e,t,n){var o=this.domBuilder;o.startDocument(),h(t,t={}),function(e,t,n,o,i){function a(e){if(e>65535){var t=55296+((e-=65536)>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function c(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(n,t)?n[t]:"#"===t.charAt(0)?a(parseInt(t.substr(1).replace("x","0x"))):(i.error("entity not found:"+e),e)}function h(t){if(t>R){var n=e.substring(R,t).replace(/&#?\w+;/g,c);b&&v(R),o.characters(n,0,t-R),R=t}}function v(t,n){for(;t>=k&&(n=S.exec(e));)C=n.index,k=C+n[0].length,b.lineNumber++;b.columnNumber=t-C+1}var C=0,k=0,S=/.*(?:\r\n?|\n)|.*$/g,b=o.locator,w=[{currentNSMap:t}],T={},R=0;for(;;){try{var E=e.indexOf("<",R);if(E<0){if(!e.substr(R).match(/^\s*$/)){var x=o.doc,A=x.createTextNode(e.substr(R));x.appendChild(A),o.currentElement=A}return}switch(E>R&&h(E),e.charAt(E+1)){case"/":var B=e.indexOf(">",E+3),I=e.substring(E+2,B).replace(/[ \t\n\r]+$/g,""),_=w.pop();B<0?(I=e.substring(E+2).replace(/[\s<].*/,""),i.error("end tag name: "+I+" is not complete:"+_.tagName),B=E+1+I.length):I.match(/\sR?R=B:h(Math.max(E,R)+1)}}(e,t,n,o,this.errorHandler),o.endDocument()}},y.prototype={setTagName:function(e){if(!a.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,n){if(!a.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},t.XMLReader=c,t.ParseError=s},function(e,t,n){var r=n(0),o="a-zA-Z_À-ÖØ-öø-ÿͰ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿿、-퟿豈-﷏ﷰ-�",i=new RegExp("^([^"+o+"])|^((x|X)(m|M)(l|L))|([^"+o+"-.0-9·̀-ͯ‿⁀])","g"),a=/[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm,s=function(e){var t=[];if(e instanceof Object)for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t},c=function(e,t){var n=function(e,n,r,o,a){var s=void 0!==t.indent?t.indent:"\t",c=t.prettyPrint?"\n"+new Array(o).join(s):"";t.removeIllegalNameCharacters&&(e=e.replace(i,"_"));var u=[c,"<",e,r||""];return n&&n.length>0?(u.push(">"),u.push(n),a&&u.push(c),u.push("")):u.push("/>"),u.join("")};return function e(o,i,c){var u=r(o);switch((Array.isArray?Array.isArray(o):o instanceof Array)?u="array":o instanceof Date&&(u="date"),u){case"array":var l=[];return o.map((function(t){l.push(e(t,1,c+1))})),t.prettyPrint&&l.push("\n"),l.join("");case"date":return o.toJSON?o.toJSON():o+"";case"object":var d=[];for(var p in o)if(o.hasOwnProperty(p))if(o[p]instanceof Array)for(var f=0;f0&&d.push("\n"),d.join("");case"function":return o();default:return t.escape?(""+o).replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""").replace(a,""):""+o}}(e,0,0)},u=function(e){var t=['"),t.join("")};e.exports=function(e,t){if(t||(t={xmlHeader:{standalone:!0},prettyPrint:!0,indent:" ",escape:!0}),"string"==typeof e)try{e=JSON.parse(e.toString())}catch(e){return!1}var n="",o="";return t&&("object"==r(t)?(t.xmlHeader&&(n=u(!!t.xmlHeader.standalone)),void 0!==t.docType&&(o="")):n=u()),[n,(t=t||{}).prettyPrint&&o?"\n":"",o,c(e,t)].join("").replace(/\n{2,}/g,"\n").replace(/\s+$/g,"")}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){function n(e,t){for(var n=0;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]60*this.strategy.requestInterval*1e3},e.prototype.getUploadUrl=function(){return this.strategy.httpsUploadUrl+"?appkey="+this.appkey},e.prototype.isBlackEvent=function(e){return-1!=this.strategy.blacklist.indexOf(e)},e.prototype.isEventUpOnOff=function(){return this.strategy.isEventUpOnOff},e.prototype.isSampleEvent=function(e){return!!Object.prototype.hasOwnProperty.call(this.realSample,e)&&this.realSample[e]this.duration)return this.createSession();t=r.sessionId,n=r.sessionStart}catch(e){}return{sessionId:t,sessionStart:n}},e.prototype.createSession=function(){var e=Date.now(),t={sessionId:this.appkey+"_"+e.toString(),sessionStart:e};this.storage.setItem(k,JSON.stringify(t)),this.storage.setItem(c,e.toString());var n="is_new_user",r=this.storage.getItem(n);return this.beacon.onDirectUserAction("rqd_applaunched",{A21:r?"N":"Y"}),this.storage.setItem(n,JSON.stringify(!1)),t},e}();function b(){var e=navigator.userAgent,t=e.indexOf("compatible")>-1&&e.indexOf("MSIE")>-1,n=e.indexOf("Edge")>-1&&!t,r=e.indexOf("Trident")>-1&&e.indexOf("rv:11.0")>-1;if(t){new RegExp("MSIE (\\d+\\.\\d+);").test(e);var o=parseFloat(RegExp.$1);return 7==o?7:8==o?8:9==o?9:10==o?10:6}return n?-2:r?11:-1}var w,T,R=function(){return(R=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0||!window.indexedDB||/X5Lite/.test(navigator.userAgent)?(this.store=new I(t),this.dbEventCount=this.store.getCount()):(this.store=new B(e),this.getCount().then((function(e){n.dbEventCount=e})))}return e.prototype.getCount=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.store.getCount()];case 1:return[2,e.sent()];case 2:return e.sent(),[2,Promise.reject()];case 3:return[2]}}))}))},e.prototype.insertEvent=function(e,t){return n(this,void 0,void 0,(function(){var n,r;return o(this,(function(o){switch(o.label){case 0:if(this.dbEventCount>=1e4)return[2,Promise.reject()];n=m(e.mapValue),o.label=1;case 1:return o.trys.push([1,3,,4]),this.dbEventCount++,[4,this.store.setItem(n,e)];case 2:return[2,o.sent()];case 3:return r=o.sent(),t&&t(r,e),this.dbEventCount--,[2,Promise.reject()];case 4:return[2]}}))}))},e.prototype.getEvents=function(){return n(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:e=[],t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.store.iterate((function(t){e.push(t)}))];case 2:case 3:return t.sent(),[2,Promise.all(e)];case 4:return[2]}}))}))},e.prototype.removeEvent=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:t=m(e.mapValue),n.label=1;case 1:return n.trys.push([1,3,,4]),this.dbEventCount--,[4,this.store.removeItem(t)];case 2:return[2,n.sent()];case 3:return n.sent(),this.dbEventCount++,[2,Promise.reject()];case 4:return[2]}}))}))},e}(),O=function(){return(O=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]},r=function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]},o=function(e,t){return 32==(t%=64)?[e[1],e[0]]:t<32?[e[0]<>>32-t,e[1]<>>32-t]:[e[1]<<(t-=32)|e[0]>>>32-t,e[0]<>>32-t]},i=function(e,t){return 0==(t%=64)?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=r(e,[4283543511,3981806797]),e=a(e,[0,e[0]>>>1]),e=r(e,[3301882366,444984403]),a(e,[0,e[0]>>>1])},c=(e=e||"").length%16,u=e.length-c,l=[0,t=t||0],d=[0,t],p=[0,0],f=[0,0],h=[2277735313,289559509],m=[1291169091,658871167],g=0;g>>0).toString(16)).slice(-8)+("00000000"+(l[1]>>>0).toString(16)).slice(-8)+("00000000"+(d[0]>>>0).toString(16)).slice(-8)+("00000000"+(d[1]>>>0).toString(16)).slice(-8)}}])&&t(o.prototype,i),n}()}()}(W={exports:{}}),W.exports),Q="logid_start",$="4.5.6-web";return function(n){function r(e){var t=n.call(this,e)||this;t.qimei36="",t.uselessCycleTaskNum=0,t.underWeakNet=!1,t.send=function(e,n,r){t.storage.setItem(c,Date.now().toString()),t.network.post(t.uploadUrl||t.strategy.getUploadUrl(),e.data).then((function(r){var o;100==(null===(o=null==r?void 0:r.data)||void 0===o?void 0:o.result)?t.delayTime=1e3*r.data.delayTime:t.delayTime=0,n&&n(e.data),e.data.events.forEach((function(e){t.store.removeEvent(e).then((function(){t.removeSendingId(m(e.mapValue))}))})),t.doCustomCycleTask()})).catch((function(n){var o=e.data.events;t.errorReport.reportError(n.code?n.code.toString():"600",n.message),r&&r(e.data);var i=JSON.parse(t.storage.getItem(u));o.forEach((function(e){i&&-1!=i.indexOf(m(e))&&t.store.insertEvent(e,(function(e,n){e&&t.errorReport.reportError("604","insertEvent fail!")})),t.removeSendingId(m(e))})),t.monitorUploadFailed()}))};var r,o,i=b();return t.isUnderIE8=i>0&&i<8,t.isUnderIE8||(t.isUnderIE=i>0,e.needInitQimei&&t.initQimei(e.appkey),t.network=new V(e),t.storage=new X(e.appkey),t.initCommonInfo(e),t.store=new _(e.appkey,t.storage),t.errorReport=new v(t.config,t.commonInfo,"web",t.network),t.strategy=new C(t.config,t.commonInfo,t.storage,t.network),t.logidStartTime=t.storage.getItem(Q),t.logidStartTime||(t.logidStartTime=Date.now().toString(),t.storage.setItem(Q,t.logidStartTime)),r=t.logidStartTime,o=Date.now()-Number.parseFloat(r),Math.floor(o/864e5)>=365&&t.storage.clear(),t.initSession(e),t.onDirectUserAction("rqd_js_init",{}),setTimeout((function(){return t.lifeCycle.emit("init")}),0),t.initDelayTime=e.delay?e.delay:1e3,t.cycleTask(t.initDelayTime)),t}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(r,n),r.prototype.initQimei=function(e){var t=this;(new J).getQimei36(e,(function(e){t.qimei36=e.q36}))},r.prototype.initSession=function(e){var t=18e5;e.sessionDuration&&e.sessionDuration>3e4&&(t=e.sessionDuration),this.beaconSession=new S(this.storage,t,this)},r.prototype.initCommonInfo=function(e){var t=Number(this.storage.getItem(c));try{var n=JSON.parse(this.storage.getItem(u));(Date.now()-t>3e4||!n)&&this.storage.setItem(u,JSON.stringify([]))}catch(e){}e.uploadUrl&&(this.uploadUrl=e.uploadUrl+"?appkey="+e.appkey);var r=[window.screen.width,window.screen.height];window.devicePixelRatio&&r.push(window.devicePixelRatio),this.commonInfo={deviceId:this.storage.createDeviceId(),language:navigator&&navigator.language||"zh_CN",query:window.location.search,userAgent:navigator.userAgent,pixel:r.join("*"),channelID:e.channelID?String(e.channelID):"",openid:e.openid?String(e.openid):"",unid:e.unionid?String(e.unionid):"",sdkVersion:$},this.config.appVersion=e.versionCode?String(e.versionCode):"",this.config.strictMode=e.strictMode},r.prototype.cycleTask=function(e){var t=this;this.intervalID=window.setInterval((function(){t.store.getEvents().then((function(e){var n=[],r=JSON.parse(t.storage.getItem(u));r||(r=[]),e&&e.forEach((function(e){var t=m(e.mapValue);-1==r.indexOf(t)&&(n.push(e),r.push(t))})),0!=n.length&&(t.storage.setItem(u,JSON.stringify(r)),t._normalLogPipeline(t.assembleData(n)))})).catch((function(e){}))}),e)},r.prototype.onReport=function(e,t,n){var r=this;if(this.isUnderIE8)this.errorReport.reportError("601","UnderIE8");else{var o=this.generateData(e,t,n);if(n&&0==this.delayTime&&!this.underWeakNet)this._normalLogPipeline(this.assembleData(o));else{var i=o.shift();i&&this.store.insertEvent(i,(function(e){e&&r.errorReport.reportError("604","insertEvent fail!")})).catch((function(e){r._normalLogPipeline(r.assembleData(o))}))}}},r.prototype.onSendBeacon=function(e,t){if(this.isUnderIE)this.errorReport.reportError("605","UnderIE");else{var n=this.assembleData(this.generateData(e,t,!0));"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(this.uploadUrl||this.strategy.getUploadUrl(),JSON.stringify(n))}},r.prototype.generateData=function(e,n,r){var o=[],i="4.5.6-web_"+(r?"direct_log_id":"normal_log_id"),a=Number(this.storage.getItem(i));return a=a||1,n=t(t({},n),{A99:r?"Y":"N",A100:a.toString(),A72:$,A88:this.logidStartTime}),a++,this.storage.setItem(i,a.toString()),o.push({eventCode:e,eventTime:Date.now().toString(),mapValue:f(n,this.config.strictMode)}),o},r.prototype.assembleData=function(e){var n=this.beaconSession.getSession();return{appVersion:this.config.appVersion?h(this.config.appVersion):"",sdkId:"js",sdkVersion:$,mainAppKey:this.config.appkey,platformId:3,common:f(t(t({},this.additionalParams),{A2:this.commonInfo.deviceId,A8:this.commonInfo.openid,A12:this.commonInfo.language,A17:this.commonInfo.pixel,A23:this.commonInfo.channelID,A50:this.commonInfo.unid,A76:n.sessionId,A101:this.commonInfo.userAgent,A102:window.location.href,A104:document.referrer,A119:this.commonInfo.query,A153:this.qimei36}),!1),events:e}},r.prototype.monitorUploadFailed=function(){this.uselessCycleTaskNum++,this.uselessCycleTaskNum>=5&&(window.clearInterval(this.intervalID),this.cycleTask(6e4),this.underWeakNet=!0)},r.prototype.doCustomCycleTask=function(){this.uselessCycleTaskNum>=5&&(window.clearInterval(this.intervalID),this.cycleTask(this.initDelayTime)),this.uselessCycleTaskNum=0,this.underWeakNet=!1},r}(y)},"object"==s(t)&&void 0!==e?e.exports=a():void 0===(i="function"==typeof(o=a)?o.call(t,n,t,e):o)||(e.exports=i)}).call(this,n(4))},function(e,t,n){var r=n(10),o=n(1),i={};e.exports.transferToTaskMethod=function(e,t){i[t]=e[t],e[t]=function(e,n){e.SkipTask?i[t].call(this,e,n):this._addTask(t,e,n)}},e.exports.init=function(e){var t,n,a=[],s={},c=0,u=0,l=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),e._custom&&(t._custom=e._custom),t},d=(n=function(){t=0,e.emit("task-list-update",{list:o.map(a,l)}),e.emit("list-update",{list:o.map(a,l)})},function(){t||(t=setTimeout(n))}),p=function(){if(!(a.length<=e.options.UploadQueueSize)){for(var t=0;te.options.UploadQueueSize;){var n="waiting"===a[t].state||"checking"===a[t].state||"uploading"===a[t].state;a[t]&&n?t++:(s[a[t].id]&&delete s[a[t].id],a.splice(t,1),u--)}d()}},f=function t(){if(!(c>=e.options.FileParallelLimit)){for(;a[u]&&"waiting"!==a[u].state;)u++;if(!(u>=a.length)){var n=a[u];u++,c++,n.state="checking",n.params.onTaskStart&&n.params.onTaskStart(l(n)),!n.params.UploadData&&(n.params.UploadData={});var r=o.formatParams(n.api,n.params);i[n.api].call(e,r,(function(r,o){e._isRunningTask(n.id)&&("checking"!==n.state&&"uploading"!==n.state||(n.state=r?"error":"success",r&&(n.error=r),c--,d(),t(),n.callback&&n.callback(r,o),"success"===n.state&&(n.params&&(delete n.params.UploadData,delete n.params.Body,delete n.params),delete n.callback)),p())})),d(),setTimeout(t)}}},h=function(t,n){var o=s[t];if(o){var i=o&&"waiting"===o.state,a=o&&("checking"===o.state||"uploading"===o.state);if("canceled"===n&&"canceled"!==o.state||"paused"===n&&i||"paused"===n&&a){if("paused"===n&&o.params.Body&&"function"==typeof o.params.Body.pipe)return;o.state=n,e.emit("inner-kill-task",{TaskId:t,toState:n});try{var u=o&&o.params&&o.params.UploadData.UploadId}catch(e){}"canceled"===n&&u&&r.removeUsing(u),d(),a&&(c--,f()),"canceled"===n&&(o.params&&(delete o.params.UploadData,delete o.params.Body,delete o.params),delete o.callback)}p()}};e._addTasks=function(t){o.each(t,(function(t){e._addTask(t.api,t.params,t.callback,!0)})),d()};e._addTask=function(t,n,r,i){n=o.formatParams(t,n);var c=o.uuid();n.TaskId=c,n.onTaskReady&&n.onTaskReady(c),n.TaskReady&&(n.TaskReady(c),!1);var u={params:n,callback:r,api:t,index:a.length,id:c,Bucket:n.Bucket,Region:n.Region,Key:n.Key,FilePath:n.FilePath||"",state:"waiting",loaded:0,size:0,speed:0,percent:0,hashPercent:0,error:null,_custom:n._custom},l=n.onHashProgress;n.onHashProgress=function(t){e._isRunningTask(u.id)&&(u.hashPercent=t.percent,l&&l(t),d())};var h=n.onProgress;return n.onProgress=function(t){e._isRunningTask(u.id)&&("checking"===u.state&&(u.state="uploading"),u.loaded=t.loaded,u.speed=t.speed,u.percent=t.percent,h&&h(t),d())},o.getFileSize(t,n,(function(e,t){if(e)return r(o.error(e));s[c]=u,a.push(u),u.size=t,!i&&d(),f(),p()})),c},e._isRunningTask=function(e){var t=s[e];return!(!t||"checking"!==t.state&&"uploading"!==t.state)},e.getTaskList=function(){return o.map(a,l)},e.cancelTask=function(e){h(e,"canceled")},e.pauseTask=function(e){h(e,"paused")},e.restartTask=function(e){var t=s[e];!t||"paused"!==t.state&&"error"!==t.state||(t.state="waiting",d(),u=Math.min(u,t.index),f())},e.isUploadRunning=function(){return c||u-1?"{Region}.myqcloud.com":"cos.{Region}.myqcloud.com",e.ForcePathStyle||(a="{Bucket}."+a)),a=(a=a.replace(/\{\{AppId\}\}/gi,i).replace(/\{\{Bucket\}\}/gi,r).replace(/\{\{Region\}\}/gi,t).replace(/\{\{.*?\}\}/gi,"")).replace(/\{AppId\}/gi,i).replace(/\{BucketName\}/gi,r).replace(/\{Bucket\}/gi,n).replace(/\{Region\}/gi,t).replace(/\{.*?\}/gi,""),/^[a-zA-Z]+:\/\//.test(a)||(a=c+"//"+a),"/"===a.slice(-1)&&(a=a.slice(0,-1));var u=a;return e.ForcePathStyle&&(u+="/"+n),u+="/",s&&(u+=o.camSafeUrlEncode(s).replace(/%2F/g,"/")),e.isLocation&&(u=u.replace(/^https?:\/\//,"")),u}var c=function(e){if(!e.Bucket||!e.Region)return"";var t=void 0===e.UseAccelerate?this.options.UseAccelerate:e.UseAccelerate,n=(e.Url||s({ForcePathStyle:this.options.ForcePathStyle,protocol:this.options.Protocol,domain:this.options.Domain,bucket:e.Bucket,region:t?"accelerate":e.Region})).replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1");return new RegExp("^([a-z\\d-]+-\\d+\\.)?(cos|cosv6|ci|pic)\\.([a-z\\d-]+)\\.myqcloud\\.com$").test(n)?n:""};function u(e,t){var n=o.clone(e.Headers),r="";o.each(n,(function(e,t){(""===e||["content-type","cache-control","expires"].indexOf(t.toLowerCase())>-1)&&delete n[t],"host"===t.toLowerCase()&&(r=e)}));var i=!1!==e.ForceSignHost;!r&&e.SignHost&&i&&(n.Host=e.SignHost);var a=!1,s=function(e,n){a||(a=!0,n&&n.XCosSecurityToken&&!n.SecurityToken&&((n=o.clone(n)).SecurityToken=n.XCosSecurityToken,delete n.XCosSecurityToken),t&&t(e,n))},c=this,u=e.Bucket||"",l=e.Region||"",d=e.Key||"";c.options.ForcePathStyle&&u&&(d=u+"/"+d);var p="/"+d,f={},h=e.Scope;if(!h){var m=e.Action||"",g=e.ResourceKey||e.Key||"";h=e.Scope||[{action:m,bucket:u,region:l,prefix:g}]}var y=o.md5(JSON.stringify(h));c._StsCache=c._StsCache||[],function(){var e,t;for(e=c._StsCache.length-1;e>=0;e--){t=c._StsCache[e];var n=Math.round(o.getSkewTime(c.options.SystemClockOffset)/1e3)+30;if(t.StartTime&&n=t.ExpiredTime)c._StsCache.splice(e,1);else if(!t.ScopeLimit||t.ScopeLimit&&t.ScopeKey===y){f=t;break}}}();var v,C=function(){var t="";f.StartTime&&e.Expires?t=f.StartTime+";"+(f.StartTime+1*e.Expires):f.StartTime&&f.ExpiredTime&&(t=f.StartTime+";"+f.ExpiredTime);var r={Authorization:o.getAuth({SecretId:f.TmpSecretId,SecretKey:f.TmpSecretKey,Method:e.Method,Pathname:p,Query:e.Query,Headers:n,Expires:e.Expires,UseRawKey:c.options.UseRawKey,SystemClockOffset:c.options.SystemClockOffset,KeyTime:t,ForceSignHost:i}),SecurityToken:f.SecurityToken||f.XCosSecurityToken||"",Token:f.Token||"",ClientIP:f.ClientIP||"",ClientUA:f.ClientUA||""};s(null,r)},k=function(e){if(e.Authorization){var t=!1,n=e.Authorization;if(n)if(n.indexOf(" ")>-1)t=!1;else if(n.indexOf("q-sign-algorithm=")>-1&&n.indexOf("q-ak=")>-1&&n.indexOf("q-sign-time=")>-1&&n.indexOf("q-key-time=")>-1&&n.indexOf("q-url-param-list=")>-1)t=!0;else try{(n=atob(n)).indexOf("a=")>-1&&n.indexOf("k=")>-1&&n.indexOf("t=")>-1&&n.indexOf("r=")>-1&&n.indexOf("b=")>-1&&(t=!0)}catch(e){}if(!t)return o.error(new Error("getAuthorization callback params format error"))}else{if(!e.TmpSecretId)return o.error(new Error('getAuthorization callback params missing "TmpSecretId"'));if(!e.TmpSecretKey)return o.error(new Error('getAuthorization callback params missing "TmpSecretKey"'));if(!e.SecurityToken&&!e.XCosSecurityToken)return o.error(new Error('getAuthorization callback params missing "SecurityToken"'));if(!e.ExpiredTime)return o.error(new Error('getAuthorization callback params missing "ExpiredTime"'));if(e.ExpiredTime&&10!==e.ExpiredTime.toString().length)return o.error(new Error('getAuthorization callback params "ExpiredTime" should be 10 digits'));if(e.StartTime&&10!==e.StartTime.toString().length)return o.error(new Error('getAuthorization callback params "StartTime" should be 10 StartTime'))}return!1};if(f.ExpiredTime&&f.ExpiredTime-o.getSkewTime(c.options.SystemClockOffset)/1e3>60)C();else if(c.options.getAuthorization)c.options.getAuthorization.call(c,{Bucket:u,Region:l,Method:e.Method,Key:d,Pathname:p,Query:e.Query,Headers:n,Scope:h,SystemClockOffset:c.options.SystemClockOffset,ForceSignHost:i},(function(e){"string"==typeof e&&(e={Authorization:e});var t=k(e);if(t)return s(t);e.Authorization?s(null,e):((f=e||{}).Scope=h,f.ScopeKey=y,c._StsCache.push(f),C())}));else{if(!c.options.getSTS)return v={Authorization:o.getAuth({SecretId:e.SecretId||c.options.SecretId,SecretKey:e.SecretKey||c.options.SecretKey,Method:e.Method,Pathname:p,Query:e.Query,Headers:n,Expires:e.Expires,UseRawKey:c.options.UseRawKey,SystemClockOffset:c.options.SystemClockOffset,ForceSignHost:i}),SecurityToken:c.options.SecurityToken||c.options.XCosSecurityToken},s(null,v),v;c.options.getSTS.call(c,{Bucket:u,Region:l},(function(e){(f=e||{}).Scope=h,f.ScopeKey=y,f.TmpSecretId||(f.TmpSecretId=f.SecretId),f.TmpSecretKey||(f.TmpSecretKey=f.SecretKey);var t=k(f);if(t)return s(t);c._StsCache.push(f),C()}))}return""}function l(e){var t=!1,n=!1,r=e.headers&&(e.headers.date||e.headers.Date)||e.error&&e.error.ServerTime;try{var i=e.error.Code,a=e.error.Message;("RequestTimeTooSkewed"===i||"AccessDenied"===i&&"Request has expired"===a)&&(n=!0)}catch(e){}if(e)if(n&&r){var s=Date.parse(r);this.options.CorrectClockSkew&&Math.abs(o.getSkewTime(this.options.SystemClockOffset)-s)>=3e4&&(this.options.SystemClockOffset=s-Date.now(),t=!0)}else 5===Math.floor(e.statusCode/100)&&(t=!0);return t}function d(e,t){var n=this;!e.headers&&(e.headers={}),!e.qs&&(e.qs={}),e.VersionId&&(e.qs.versionId=e.VersionId),e.qs=o.clearKey(e.qs),e.headers&&(e.headers=o.clearKey(e.headers)),e.qs&&(e.qs=o.clearKey(e.qs));var r=o.clone(e.qs);e.action&&(r[e.action]="");var i=e.url||e.Url,a=e.SignHost||c.call(this,{Bucket:e.Bucket,Region:e.Region,Url:i}),s=e.tracker;!function o(i){var c=n.options.SystemClockOffset;s&&s.setParams({signStartTime:(new Date).getTime(),retryTimes:i-1}),u.call(n,{Bucket:e.Bucket||"",Region:e.Region||"",Method:e.method,Key:e.Key,Query:r,Headers:e.headers,SignHost:a,Action:e.Action,ResourceKey:e.ResourceKey,Scope:e.Scope,ForceSignHost:n.options.ForceSignHost},(function(r,a){r?t(r):(s&&s.setParams({signEndTime:(new Date).getTime(),httpStartTime:(new Date).getTime()}),e.AuthData=a,p.call(n,e,(function(r,a){s&&s.setParams({httpEndTime:(new Date).getTime()}),r&&i<2&&(c!==n.options.SystemClockOffset||l.call(n,r))?(e.headers&&(delete e.headers.Authorization,delete e.headers.token,delete e.headers.clientIP,delete e.headers.clientUA,e.headers["x-cos-security-token"]&&delete e.headers["x-cos-security-token"],e.headers["x-ci-security-token"]&&delete e.headers["x-ci-security-token"]),o(i+1)):t(r,a)})))}))}(1)}function p(e,t){var n=this,i=e.TaskId;if(!i||n._isRunningTask(i)){var a=e.Bucket,c=e.Region,u=e.Key,l=e.method||"GET",d=e.Url||e.url,p=e.body,f=e.rawBody;n.options.UseAccelerate&&(c="accelerate"),d=d||s({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:a,region:c,object:u}),e.action&&(d=d+"?"+e.action),e.qsStr&&(d=d.indexOf("?")>-1?d+"&"+e.qsStr:d+"?"+e.qsStr);var h={method:l,url:d,headers:e.headers,qs:e.qs,body:p},m="x-cos-security-token";if(o.isCIHost(d)&&(m="x-ci-security-token"),h.headers.Authorization=e.AuthData.Authorization,e.AuthData.Token&&(h.headers.token=e.AuthData.Token),e.AuthData.ClientIP&&(h.headers.clientIP=e.AuthData.ClientIP),e.AuthData.ClientUA&&(h.headers.clientUA=e.AuthData.ClientUA),e.AuthData.SecurityToken&&(h.headers[m]=e.AuthData.SecurityToken),h.headers&&(h.headers=o.clearKey(h.headers)),h=o.clearKey(h),e.onProgress&&"function"==typeof e.onProgress){var g=p&&(p.size||p.length)||0;h.onProgress=function(t){if(!i||n._isRunningTask(i)){var r=t?t.loaded:0;e.onProgress({loaded:r,total:g})}}}e.onDownloadProgress&&(h.onDownloadProgress=e.onDownloadProgress),e.DataType&&(h.dataType=e.DataType),this.options.Timeout&&(h.timeout=this.options.Timeout),n.options.ForcePathStyle&&(h.pathStyle=n.options.ForcePathStyle),n.emit("before-send",h);var y=h.url.includes("accelerate."),v=h.qs?Object.keys(h.qs).map((function(e){return"".concat(e,"=").concat(h.qs[e])})).join("&"):"",C=v?h.url+"?"+v:h.url;e.tracker&&e.tracker.setParams({reqUrl:C,accelerate:y?"Y":"N"}),e.tracker&&e.tracker.parent&&e.tracker.parent.setParams({reqUrl:C,accelerate:y?"Y":"N"});var k=(n.options.Request||r)(h,(function(e){if("abort"!==e.error){var r={options:h,error:c,statusCode:s&&s.statusCode||0,headers:s&&s.headers||{},body:u};n.emit("after-receive",r),c=r.error,u=r.body,s={statusCode:r.statusCode,headers:r.headers},n.emit("after-receive",e);var a,s={statusCode:e.statusCode,statusMessage:e.statusMessage,headers:e.headers},c=e.error,u=e.body,l=function(e,r){if(i&&n.off("inner-kill-task",S),!a){a=!0;var c={};s&&s.statusCode&&(c.statusCode=s.statusCode),s&&s.headers&&(c.headers=s.headers),e?(e=o.extend(e||{},c),t(e,null)):(r=o.extend(r||{},c),t(null,r)),k=null}};if(c)return l(o.error(c));var d,p=s.statusCode,m=2===Math.floor(p/100);if(f&&m)return l(null,{body:u});try{d=u&&u.indexOf("<")>-1&&u.indexOf(">")>-1&&o.xml2json(u)||{}}catch(e){d={}}var g=d&&d.Error;m?l(null,d):g?l(o.error(new Error(g.Message),{code:g.Code,error:g})):p?l(o.error(new Error(s.statusMessage),{code:""+p})):p&&l(o.error(new Error("statusCode error")))}})),S=function e(t){t.TaskId===i&&(k&&k.abort&&k.abort(),n.off("inner-kill-task",e))};i&&n.on("inner-kill-task",S)}}var f={getService:function(e,t){"function"==typeof e&&(t=e,e={});var n=this.options.Protocol||(o.isBrowser&&"http:"===location.protocol?"http:":"https:"),r=this.options.ServiceDomain,i=e.AppId||this.options.appId,a=e.Region;r?(r=r.replace(/\{\{AppId\}\}/gi,i||"").replace(/\{\{Region\}\}/gi,a||"").replace(/\{\{.*?\}\}/gi,""),/^[a-zA-Z]+:\/\//.test(r)||(r=n+"//"+r),"/"===r.slice(-1)&&(r=r.slice(0,-1))):r=a?n+"//cos."+a+".myqcloud.com":n+"//service.cos.myqcloud.com";var s="",c=a?"cos."+a+".myqcloud.com":"service.cos.myqcloud.com";c===r.replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1")&&(s=c),d.call(this,{Action:"name/cos:GetService",url:r,method:"GET",headers:e.Headers,SignHost:s},(function(e,n){if(e)return t(e);var r=n&&n.ListAllMyBucketsResult&&n.ListAllMyBucketsResult.Buckets&&n.ListAllMyBucketsResult.Buckets.Bucket||[];r=o.isArray(r)?r:[r];var i=n&&n.ListAllMyBucketsResult&&n.ListAllMyBucketsResult.Owner||{};t(null,{Buckets:r,Owner:i,statusCode:n.statusCode,headers:n.headers})}))},putBucket:function(e,t){var n=this,r="";if(e.BucketAZConfig){var i={BucketAZConfig:e.BucketAZConfig};r=o.json2xml({CreateBucketConfiguration:i})}d.call(this,{Action:"name/cos:PutBucket",method:"PUT",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,body:r},(function(r,o){if(r)return t(r);var i=s({protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,isLocation:!0});t(null,{Location:i,statusCode:o.statusCode,headers:o.headers})}))},headBucket:function(e,t){d.call(this,{Action:"name/cos:HeadBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"HEAD"},t)},getBucket:function(e,t){var n={};n.prefix=e.Prefix||"",n.delimiter=e.Delimiter,n.marker=e.Marker,n["max-keys"]=e.MaxKeys,n["encoding-type"]=e.EncodingType,d.call(this,{Action:"name/cos:GetBucket",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n},(function(e,n){if(e)return t(e);var r=n.ListBucketResult||{},i=r.Contents||[],a=r.CommonPrefixes||[];i=o.isArray(i)?i:[i],a=o.isArray(a)?a:[a];var s=o.clone(r);o.extend(s,{Contents:i,CommonPrefixes:a,statusCode:n.statusCode,headers:n.headers}),t(null,s)}))},deleteBucket:function(e,t){d.call(this,{Action:"name/cos:DeleteBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"DELETE"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketAcl:function(e,t){var n=e.Headers,r="";if(e.AccessControlPolicy){var i=o.clone(e.AccessControlPolicy||{}),s=i.Grants||i.Grant;s=o.isArray(s)?s:[s],delete i.Grant,delete i.Grants,i.AccessControlList={Grant:s},r=o.json2xml({AccessControlPolicy:i}),n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(r))}o.each(n,(function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=a(n[t]))})),d.call(this,{Action:"name/cos:PutBucketACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,headers:n,action:"acl",body:r},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketAcl:function(e,t){d.call(this,{Action:"name/cos:GetBucketACL",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"acl"},(function(e,n){if(e)return t(e);var r=n.AccessControlPolicy||{},a=r.Owner||{},s=r.AccessControlList.Grant||[];s=o.isArray(s)?s:[s];var c=i(r);n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=o.extend(c,{Owner:a,Grants:s,statusCode:n.statusCode,headers:n.headers}),t(null,c)}))},putBucketCors:function(e,t){var n=(e.CORSConfiguration||{}).CORSRules||e.CORSRules||[];n=o.clone(o.isArray(n)?n:[n]),o.each(n,(function(e){o.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],(function(t){var n=t+"s",r=e[n]||e[t]||[];delete e[n],e[t]=o.isArray(r)?r:[r]}))}));var r={CORSRule:n};e.ResponseVary&&(r.ResponseVary=e.ResponseVary);var i=o.json2xml({CORSConfiguration:r}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(i)),d.call(this,{Action:"name/cos:PutBucketCORS",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"cors",headers:a},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketCors:function(e,t){d.call(this,{Action:"name/cos:GetBucketCORS",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors"},(function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchCORSConfiguration"===e.error.Code){var r={CORSRules:[],statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var i=n.CORSConfiguration||{},a=i.CORSRules||i.CORSRule||[];a=o.clone(o.isArray(a)?a:[a]);var s=i.ResponseVary;o.each(a,(function(e){o.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],(function(t){var n=t+"s",r=e[n]||e[t]||[];delete e[t],e[n]=o.isArray(r)?r:[r]}))})),t(null,{CORSRules:a,ResponseVary:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketCors:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketCORS",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode||e.statusCode,headers:n.headers})}))},getBucketLocation:function(e,t){d.call(this,{Action:"name/cos:GetBucketLocation",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"location"},t)},getBucketPolicy:function(e,t){d.call(this,{Action:"name/cos:GetBucketPolicy",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy",rawBody:!0},(function(e,n){if(e)return e.statusCode&&403===e.statusCode?t(o.error(e,{ErrorStatus:"Access Denied"})):e.statusCode&&405===e.statusCode?t(o.error(e,{ErrorStatus:"Method Not Allowed"})):e.statusCode&&404===e.statusCode?t(o.error(e,{ErrorStatus:"Policy Not Found"})):t(e);var r={};try{r=JSON.parse(n.body)}catch(e){}t(null,{Policy:r,statusCode:n.statusCode,headers:n.headers})}))},putBucketPolicy:function(e,t){var n=e.Policy;try{"string"==typeof n&&(n=JSON.parse(n))}catch(e){}if(!n||"string"==typeof n)return t(o.error(new Error("Policy format error")));var r=JSON.stringify(n);n.version||(n.version="2.0");var i=e.Headers;i["Content-Type"]="application/json",i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:PutBucketPolicy",method:"PUT",Bucket:e.Bucket,Region:e.Region,action:"policy",body:r,headers:i},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},deleteBucketPolicy:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketPolicy",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode||e.statusCode,headers:n.headers})}))},putBucketTagging:function(e,t){var n=e.Tagging||{},r=n.TagSet||n.Tags||e.Tags||[];r=o.clone(o.isArray(r)?r:[r]);var i=o.json2xml({Tagging:{TagSet:{Tag:r}}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(i)),d.call(this,{Action:"name/cos:PutBucketTagging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"tagging",headers:a},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketTagging:function(e,t){d.call(this,{Action:"name/cos:GetBucketTagging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging"},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"NoSuchTagSet"!==e.error.Code)t(e);else{var r={Tags:[],statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else{var i=[];try{i=n.Tagging.TagSet.Tag||[]}catch(e){}i=o.clone(o.isArray(i)?i:[i]),t(null,{Tags:i,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketTagging:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketTagging",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketLifecycle:function(e,t){var n=(e.LifecycleConfiguration||{}).Rules||e.Rules||[];n=o.clone(n);var r=o.json2xml({LifecycleConfiguration:{Rule:n}}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:PutBucketLifecycle",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"lifecycle",headers:i},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketLifecycle:function(e,t){d.call(this,{Action:"name/cos:GetBucketLifecycle",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle"},(function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchLifecycleConfiguration"===e.error.Code){var r={Rules:[],statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var i=[];try{i=n.LifecycleConfiguration.Rule||[]}catch(e){}i=o.clone(o.isArray(i)?i:[i]),t(null,{Rules:i,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketLifecycle:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketLifecycle",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketVersioning:function(e,t){if(e.VersioningConfiguration){var n=e.VersioningConfiguration||{},r=o.json2xml({VersioningConfiguration:n}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:PutBucketVersioning",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"versioning",headers:i},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t(o.error(new Error("missing param VersioningConfiguration")))},getBucketVersioning:function(e,t){d.call(this,{Action:"name/cos:GetBucketVersioning",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"versioning"},(function(e,n){e||!n.VersioningConfiguration&&(n.VersioningConfiguration={}),t(e,n)}))},putBucketReplication:function(e,t){var n=o.clone(e.ReplicationConfiguration),r=o.json2xml({ReplicationConfiguration:n});r=(r=r.replace(/<(\/?)Rules>/gi,"<$1Rule>")).replace(/<(\/?)Tags>/gi,"<$1Tag>");var i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:PutBucketReplication",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"replication",headers:i},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketReplication:function(e,t){d.call(this,{Action:"name/cos:GetBucketReplication",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"ReplicationConfigurationnotFoundError"!==e.error.Code)t(e);else{var r={ReplicationConfiguration:{Rules:[]},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else!n.ReplicationConfiguration&&(n.ReplicationConfiguration={}),n.ReplicationConfiguration.Rule&&(n.ReplicationConfiguration.Rules=o.makeArray(n.ReplicationConfiguration.Rule),delete n.ReplicationConfiguration.Rule),t(e,n)}))},deleteBucketReplication:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketWebsite:function(e,t){if(e.WebsiteConfiguration){var n=o.clone(e.WebsiteConfiguration||{}),r=n.RoutingRules||n.RoutingRule||[];r=o.isArray(r)?r:[r],delete n.RoutingRule,delete n.RoutingRules,r.length&&(n.RoutingRules={RoutingRule:r});var i=o.json2xml({WebsiteConfiguration:n}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(i)),d.call(this,{Action:"name/cos:PutBucketWebsite",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"website",headers:a},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t(o.error(new Error("missing param WebsiteConfiguration")))},getBucketWebsite:function(e,t){d.call(this,{Action:"name/cos:GetBucketWebsite",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"website"},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchWebsiteConfiguration"===e.error.Code){var r={WebsiteConfiguration:{},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var i=n.WebsiteConfiguration||{};if(i.RoutingRules){var a=o.clone(i.RoutingRules.RoutingRule||[]);a=o.makeArray(a),i.RoutingRules=a}t(null,{WebsiteConfiguration:i,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketWebsite:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketWebsite",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"website"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketReferer:function(e,t){if(e.RefererConfiguration){var n=o.clone(e.RefererConfiguration||{}),r=n.DomainList||{},i=r.Domains||r.Domain||[];(i=o.isArray(i)?i:[i]).length&&(n.DomainList={Domain:i});var a=o.json2xml({RefererConfiguration:n}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(a)),d.call(this,{Action:"name/cos:PutBucketReferer",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:a,action:"referer",headers:s},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t(o.error(new Error("missing param RefererConfiguration")))},getBucketReferer:function(e,t){d.call(this,{Action:"name/cos:GetBucketReferer",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"referer"},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchRefererConfiguration"===e.error.Code){var r={WebsiteConfiguration:{},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var i=n.RefererConfiguration||{};if(i.DomainList){var a=o.makeArray(i.DomainList.Domain||[]);i.DomainList={Domains:a}}t(null,{RefererConfiguration:i,statusCode:n.statusCode,headers:n.headers})}}))},putBucketDomain:function(e,t){var n=(e.DomainConfiguration||{}).DomainRule||e.DomainRule||[];n=o.clone(n);var r=o.json2xml({DomainConfiguration:{DomainRule:n}}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:PutBucketDomain",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"domain",headers:i},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketDomain:function(e,t){d.call(this,{Action:"name/cos:GetBucketDomain",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain"},(function(e,n){if(e)return t(e);var r=[];try{r=n.DomainConfiguration.DomainRule||[]}catch(e){}r=o.clone(o.isArray(r)?r:[r]),t(null,{DomainRule:r,statusCode:n.statusCode,headers:n.headers})}))},deleteBucketDomain:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketDomain",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketOrigin:function(e,t){var n=(e.OriginConfiguration||{}).OriginRule||e.OriginRule||[];n=o.clone(n);var r=o.json2xml({OriginConfiguration:{OriginRule:n}}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:PutBucketOrigin",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"origin",headers:i},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketOrigin:function(e,t){d.call(this,{Action:"name/cos:GetBucketOrigin",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin"},(function(e,n){if(e)return t(e);var r=[];try{r=n.OriginConfiguration.OriginRule||[]}catch(e){}r=o.clone(o.isArray(r)?r:[r]),t(null,{OriginRule:r,statusCode:n.statusCode,headers:n.headers})}))},deleteBucketOrigin:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketOrigin",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketLogging:function(e,t){var n=o.json2xml({BucketLoggingStatus:e.BucketLoggingStatus||""}),r=e.Headers;r["Content-Type"]="application/xml",r["Content-MD5"]=o.binaryBase64(o.md5(n)),d.call(this,{Action:"name/cos:PutBucketLogging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:n,action:"logging",headers:r},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketLogging:function(e,t){d.call(this,{Action:"name/cos:GetBucketLogging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"logging"},(function(e,n){if(e)return t(e);t(null,{BucketLoggingStatus:n.BucketLoggingStatus,statusCode:n.statusCode,headers:n.headers})}))},putBucketInventory:function(e,t){var n=o.clone(e.InventoryConfiguration);if(n.OptionalFields){var r=n.OptionalFields||[];n.OptionalFields={Field:r}}if(n.Destination&&n.Destination.COSBucketDestination&&n.Destination.COSBucketDestination.Encryption){var i=n.Destination.COSBucketDestination.Encryption;Object.keys(i).indexOf("SSECOS")>-1&&(i["SSE-COS"]=i.SSECOS,delete i.SSECOS)}var a=o.json2xml({InventoryConfiguration:n}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(a)),d.call(this,{Action:"name/cos:PutBucketInventory",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:a,action:"inventory",qs:{id:e.Id},headers:s},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketInventory:function(e,t){d.call(this,{Action:"name/cos:GetBucketInventory",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id}},(function(e,n){if(e)return t(e);var r=n.InventoryConfiguration;if(r&&r.OptionalFields&&r.OptionalFields.Field){var i=r.OptionalFields.Field;o.isArray(i)||(i=[i]),r.OptionalFields=i}if(r.Destination&&r.Destination.COSBucketDestination&&r.Destination.COSBucketDestination.Encryption){var a=r.Destination.COSBucketDestination.Encryption;Object.keys(a).indexOf("SSE-COS")>-1&&(a.SSECOS=a["SSE-COS"],delete a["SSE-COS"])}t(null,{InventoryConfiguration:r,statusCode:n.statusCode,headers:n.headers})}))},listBucketInventory:function(e,t){d.call(this,{Action:"name/cos:ListBucketInventory",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{"continuation-token":e.ContinuationToken}},(function(e,n){if(e)return t(e);var r=n.ListInventoryConfigurationResult,i=r.InventoryConfiguration||[];i=o.isArray(i)?i:[i],delete r.InventoryConfiguration,o.each(i,(function(e){if(e&&e.OptionalFields&&e.OptionalFields.Field){var t=e.OptionalFields.Field;o.isArray(t)||(t=[t]),e.OptionalFields=t}if(e.Destination&&e.Destination.COSBucketDestination&&e.Destination.COSBucketDestination.Encryption){var n=e.Destination.COSBucketDestination.Encryption;Object.keys(n).indexOf("SSE-COS")>-1&&(n.SSECOS=n["SSE-COS"],delete n["SSE-COS"])}})),r.InventoryConfigurations=i,o.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)}))},deleteBucketInventory:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketInventory",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id}},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketAccelerate:function(e,t){if(e.AccelerateConfiguration){var n={AccelerateConfiguration:e.AccelerateConfiguration||{}},r=o.json2xml(n),i={"Content-Type":"application/xml"};i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:PutBucketAccelerate",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"accelerate",headers:i},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t(o.error(new Error("missing param AccelerateConfiguration")))},getBucketAccelerate:function(e,t){d.call(this,{Action:"name/cos:GetBucketAccelerate",method:"GET",Bucket:e.Bucket,Region:e.Region,action:"accelerate"},(function(e,n){e||!n.AccelerateConfiguration&&(n.AccelerateConfiguration={}),t(e,n)}))},putBucketEncryption:function(e,t){var n=e.ServerSideEncryptionConfiguration||{},r=n.Rule||n.Rules||[],i=o.json2xml({ServerSideEncryptionConfiguration:{Rule:r}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(i)),d.call(this,{Action:"name/cos:PutBucketEncryption",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"encryption",headers:a},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketEncryption:function(e,t){d.call(this,{Action:"name/cos:GetBucketEncryption",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"encryption"},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchEncryptionConfiguration"===e.code){var r={EncryptionConfiguration:{Rules:[]},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var i=o.makeArray(n.EncryptionConfiguration&&n.EncryptionConfiguration.Rule||[]);n.EncryptionConfiguration={Rules:i},t(e,n)}}))},deleteBucketEncryption:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"encryption"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getObject:function(e,t){var n=e.Query||{},r=e.QueryString||"",i=o.throttleOnProgress.call(this,0,e.onProgress),a=e.tracker;a&&a.setParams({signStartTime:(new Date).getTime()}),n["response-content-type"]=e.ResponseContentType,n["response-content-language"]=e.ResponseContentLanguage,n["response-expires"]=e.ResponseExpires,n["response-cache-control"]=e.ResponseCacheControl,n["response-content-disposition"]=e.ResponseContentDisposition,n["response-content-encoding"]=e.ResponseContentEncoding,d.call(this,{Action:"name/cos:GetObject",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,DataType:e.DataType,headers:e.Headers,qs:n,qsStr:r,rawBody:!0,onDownloadProgress:i,tracker:a},(function(n,r){if(i(null,!0),n){var a=n.statusCode;return e.Headers["If-Modified-Since"]&&a&&304===a?t(null,{NotModified:!0}):t(n)}t(null,{Body:r.body,ETag:o.attr(r.headers,"etag",""),statusCode:r.statusCode,headers:r.headers})}))},headObject:function(e,t){d.call(this,{Action:"name/cos:HeadObject",method:"HEAD",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers},(function(n,r){if(n){var i=n.statusCode;return e.Headers["If-Modified-Since"]&&i&&304===i?t(null,{NotModified:!0,statusCode:i}):t(n)}r.ETag=o.attr(r.headers,"etag",""),t(null,r)}))},listObjectVersions:function(e,t){var n={};n.prefix=e.Prefix||"",n.delimiter=e.Delimiter,n["key-marker"]=e.KeyMarker,n["version-id-marker"]=e.VersionIdMarker,n["max-keys"]=e.MaxKeys,n["encoding-type"]=e.EncodingType,d.call(this,{Action:"name/cos:GetBucketObjectVersions",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,action:"versions"},(function(e,n){if(e)return t(e);var r=n.ListVersionsResult||{},i=r.DeleteMarker||[];i=o.isArray(i)?i:[i];var a=r.Version||[];a=o.isArray(a)?a:[a];var s=o.clone(r);delete s.DeleteMarker,delete s.Version,o.extend(s,{DeleteMarkers:i,Versions:a,statusCode:n.statusCode,headers:n.headers}),t(null,s)}))},putObject:function(e,t){var n=this,r=e.ContentLength,i=o.throttleOnProgress.call(n,r,e.onProgress),a=e.Headers;a["Cache-Control"]||a["cache-control"]||(a["Cache-Control"]=""),a["Content-Type"]||a["content-type"]||(a["Content-Type"]=e.Body&&e.Body.type||"");var c=e.UploadAddMetaMd5||n.options.UploadAddMetaMd5||n.options.UploadCheckContentMd5,u=e.tracker;c&&u&&u.setParams({md5StartTime:(new Date).getTime()}),o.getBodyMd5(c,e.Body,(function(c){c&&(u&&u.setParams({md5EndTime:(new Date).getTime()}),n.options.UploadCheckContentMd5&&(a["Content-MD5"]=o.binaryBase64(c)),(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5)&&(a["x-cos-meta-md5"]=c)),void 0!==e.ContentLength&&(a["Content-Length"]=e.ContentLength),i(null,!0),d.call(n,{Action:"name/cos:PutObject",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,qs:e.Query,body:e.Body,onProgress:i,tracker:u},(function(a,c){if(a)return i(null,!0),t(a);i({loaded:r,total:r},!0);var u=s({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:n.options.UseAccelerate?"accelerate":e.Region,object:e.Key});u=u.substr(u.indexOf("://")+3),c.Location=u,c.ETag=o.attr(c.headers,"etag",""),t(null,c)}))}),e.onHashProgress)},deleteObject:function(e,t){d.call(this,{Action:"name/cos:DeleteObject",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,VersionId:e.VersionId,action:e.Recursive?"recursive":""},(function(e,n){if(e){var r=e.statusCode;return r&&404===r?t(null,{BucketNotFound:!0,statusCode:r}):t(e)}t(null,{statusCode:n.statusCode,headers:n.headers})}))},getObjectAcl:function(e,t){d.call(this,{Action:"name/cos:GetObjectACL",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"acl"},(function(e,n){if(e)return t(e);var r=n.AccessControlPolicy||{},a=r.Owner||{},s=r.AccessControlList&&r.AccessControlList.Grant||[];s=o.isArray(s)?s:[s];var c=i(r);delete c.GrantWrite,n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=o.extend(c,{Owner:a,Grants:s,statusCode:n.statusCode,headers:n.headers}),t(null,c)}))},putObjectAcl:function(e,t){var n=e.Headers,r="";if(e.AccessControlPolicy){var i=o.clone(e.AccessControlPolicy||{}),s=i.Grants||i.Grant;s=o.isArray(s)?s:[s],delete i.Grant,delete i.Grants,i.AccessControlList={Grant:s},r=o.json2xml({AccessControlPolicy:i}),n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(r))}o.each(n,(function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=a(n[t]))})),d.call(this,{Action:"name/cos:PutObjectACL",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})}))},optionsObject:function(e,t){var n=e.Headers;n.Origin=e.Origin,n["Access-Control-Request-Method"]=e.AccessControlRequestMethod,n["Access-Control-Request-Headers"]=e.AccessControlRequestHeaders,d.call(this,{Action:"name/cos:OptionsObject",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})}))},putObjectCopy:function(e,t){var n=this,r=e.Headers;r["Cache-Control"]||r["cache-control"]||(r["Cache-Control"]="");var i=e.CopySource||"",a=o.getSourceParams.call(this,i);if(a){var c=a[1],u=a[3],l=decodeURIComponent(a[4]);d.call(this,{Scope:[{action:"name/cos:GetObject",bucket:c,region:u,prefix:l},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers},(function(r,i){if(r)return t(r);var a=o.clone(i.CopyObjectResult||{}),c=s({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,object:e.Key,isLocation:!0});o.extend(a,{Location:c,statusCode:i.statusCode,headers:i.headers}),t(null,a)}))}else t(o.error(new Error("CopySource format error")))},deleteMultipleObject:function(e,t){var n=e.Objects||[],r=e.Quiet;n=o.isArray(n)?n:[n];var i=o.json2xml({Delete:{Object:n,Quiet:r||!1}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(i));var s=o.map(n,(function(t){return{action:"name/cos:DeleteObject",bucket:e.Bucket,region:e.Region,prefix:t.Key}}));d.call(this,{Scope:s,method:"POST",Bucket:e.Bucket,Region:e.Region,body:i,action:"delete",headers:a},(function(e,n){if(e)return t(e);var r=n.DeleteResult||{},i=r.Deleted||[],a=r.Error||[];i=o.isArray(i)?i:[i],a=o.isArray(a)?a:[a];var s=o.clone(r);o.extend(s,{Error:a,Deleted:i,statusCode:n.statusCode,headers:n.headers}),t(null,s)}))},restoreObject:function(e,t){var n=e.Headers;if(e.RestoreRequest){var r=e.RestoreRequest||{},i=o.json2xml({RestoreRequest:r});n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(i)),d.call(this,{Action:"name/cos:RestoreObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,body:i,action:"restore",headers:n},t)}else t(o.error(new Error("missing param RestoreRequest")))},putObjectTagging:function(e,t){var n=e.Tagging||{},r=n.TagSet||n.Tags||e.Tags||[];r=o.clone(o.isArray(r)?r:[r]);var i=o.json2xml({Tagging:{TagSet:{Tag:r}}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(i)),d.call(this,{Action:"name/cos:PutObjectTagging",method:"PUT",Bucket:e.Bucket,Key:e.Key,Region:e.Region,body:i,action:"tagging",headers:a,VersionId:e.VersionId},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getObjectTagging:function(e,t){d.call(this,{Action:"name/cos:GetObjectTagging",method:"GET",Key:e.Key,Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging",VersionId:e.VersionId},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"NoSuchTagSet"!==e.error.Code)t(e);else{var r={Tags:[],statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else{var i=[];try{i=n.Tagging.TagSet.Tag||[]}catch(e){}i=o.clone(o.isArray(i)?i:[i]),t(null,{Tags:i,statusCode:n.statusCode,headers:n.headers})}}))},deleteObjectTagging:function(e,t){d.call(this,{Action:"name/cos:DeleteObjectTagging",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"tagging",VersionId:e.VersionId},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},selectObjectContent:function(e,t){if(!e.SelectType)return t(o.error(new Error("missing param SelectType")));var n=e.SelectRequest||{},r=o.json2xml({SelectRequest:n}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:GetObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"select",qs:{"select-type":e.SelectType},VersionId:e.VersionId,body:r,DataType:"arraybuffer",rawBody:!0},(function(e,n){if(e&&204===e.statusCode)return t(null,{statusCode:e.statusCode});if(e)return t(e);var r=o.parseSelectPayload(n.body);t(null,{statusCode:n.statusCode,headers:n.headers,Body:r.body,Payload:r.payload})}))},appendObject:function(e,t){var n=e.Headers;n["Cache-Control"]||n["cache-control"]||(n["Cache-Control"]=""),n["Content-Type"]||n["content-type"]||(n["Content-Type"]=e.Body&&e.Body.type||""),d.call(this,{Action:"name/cos:AppendObject",method:"POST",Bucket:e.Bucket,Region:e.Region,action:"append",Key:e.Key,body:e.Body,qs:{position:e.Position},headers:e.Headers},(function(e,n){if(e)return t(e);t(null,n)}))},uploadPartCopy:function(e,t){var n=e.CopySource||"",r=o.getSourceParams.call(this,n);if(r){var i=r[1],a=r[3],s=decodeURIComponent(r[4]);d.call(this,{Scope:[{action:"name/cos:GetObject",bucket:i,region:a,prefix:s},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers},(function(e,n){if(e)return t(e);var r=o.clone(n.CopyPartResult||{});o.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)}))}else t(o.error(new Error("CopySource format error")))},multipartInit:function(e,t){var n=this,r=e.Headers,i=e.tracker;r["Cache-Control"]||r["cache-control"]||(r["Cache-Control"]=""),r["Content-Type"]||r["content-type"]||(r["Content-Type"]=e.Body&&e.Body.type||"");var a=e.Body&&(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5);a&&i&&i.setParams({md5StartTime:(new Date).getTime()}),o.getBodyMd5(a,e.Body,(function(r){r&&(e.Headers["x-cos-meta-md5"]=r),a&&i&&i.setParams({md5EndTime:(new Date).getTime()}),d.call(n,{Action:"name/cos:InitiateMultipartUpload",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"uploads",headers:e.Headers,qs:e.Query,tracker:i},(function(e,n){return e?(i&&i.parent&&i.parent.setParams({errorNode:"multipartInit"}),t(e)):(n=o.clone(n||{}))&&n.InitiateMultipartUploadResult?t(null,o.extend(n.InitiateMultipartUploadResult,{statusCode:n.statusCode,headers:n.headers})):void t(null,n)}))}),e.onHashProgress)},multipartUpload:function(e,t){var n=this;o.getFileSize("multipartUpload",e,(function(){var r=e.tracker,i=n.options.UploadCheckContentMd5;i&&r&&r.setParams({md5StartTime:(new Date).getTime()}),o.getBodyMd5(i,e.Body,(function(a){a&&(e.Headers["Content-MD5"]=o.binaryBase64(a)),i&&r&&r.setParams({md5EndTime:(new Date).getTime()}),r&&r.setParams({partNumber:e.PartNumber}),d.call(n,{Action:"name/cos:UploadPart",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers,onProgress:e.onProgress,body:e.Body||null,tracker:r},(function(e,n){if(e)return r&&r.parent&&r.parent.setParams({errorNode:"multipartUpload"}),t(e);t(null,{ETag:o.attr(n.headers,"etag",""),statusCode:n.statusCode,headers:n.headers})}))}))}))},multipartComplete:function(e,t){for(var n=this,r=e.UploadId,i=e.Parts,a=e.tracker,c=0,u=i.length;c-1?function(e){var t=e.match(/q-url-param-list.*?(?=&)/g)[0],n="q-url-param-list="+encodeURIComponent(t.replace(/q-url-param-list=/,"")).toLowerCase(),r=new RegExp(t,"g");return e.replace(r,n)}(n.Authorization):"sign="+encodeURIComponent(n.Authorization)),n.SecurityToken&&(r+="&x-cos-security-token="+n.SecurityToken),n.ClientIP&&(r+="&clientIP="+n.ClientIP),n.ClientUA&&(r+="&clientUA="+n.ClientUA),n.Token&&(r+="&token="+n.Token),a&&(r+="&"+a),setTimeout((function(){t(null,{Url:r})}))}}));return p?(l+="?"+p.Authorization+(p.SecurityToken?"&x-cos-security-token="+p.SecurityToken:""),a&&(l+="&"+a)):a&&(l+="?"+a),l},getAuth:function(e){return o.getAuth({SecretId:e.SecretId||this.options.SecretId||"",SecretKey:e.SecretKey||this.options.SecretKey||"",Bucket:e.Bucket,Region:e.Region,Method:e.Method,Key:e.Key,Query:e.Query,Headers:e.Headers,Expires:e.Expires,UseRawKey:this.options.UseRawKey,SystemClockOffset:this.options.SystemClockOffset})}};e.exports.init=function(e,t){t.transferToTaskMethod(f,"putObject"),o.each(f,(function(t,n){e.prototype[n]=o.apiWrapper(n,t),function(e,t,n){o.each(["Cors","Acl"],(function(r){if(e.slice(-r.length)===r){var i=e.slice(0,-r.length)+r.toUpperCase(),a=o.apiWrapper(e,t);n[i]=function(){a.apply(this,arguments)}}}))}(n,t,e.prototype)}))}},function(e,t,n){var r=n(0),o=function(e){switch(r(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},i=function(e,t,n){var r={};return t.getAllResponseHeaders().trim().split("\n").forEach((function(e){if(e){var t=e.indexOf(":"),n=e.substr(0,t).trim().toLowerCase(),o=e.substr(t+1).trim();r[n]=o}})),{error:e,statusCode:t.status,statusMessage:t.statusText,headers:r,body:n}},a=function(e,t){return t||"text"!==t?e.response:e.responseText};e.exports=function(e,t){var n,s,c,u,l=(e.method||"GET").toUpperCase(),d=e.url;if(e.qs){var p=(n=e.qs,s=s||"&",c=c||"=",null===n&&(n=void 0),"object"===r(n)?Object.keys(n).map((function(e){var t=encodeURIComponent(o(e))+c;return Array.isArray(n[e])?n[e].map((function(e){return t+encodeURIComponent(o(e))})).join(s):t+encodeURIComponent(o(n[e]))})).filter(Boolean).join(s):u?encodeURIComponent(o(u))+c+encodeURIComponent(o(n)):"");p&&(d+=(-1===d.indexOf("?")?"?":"&")+p)}var f=new XMLHttpRequest;if(f.open(l,d,!0),f.responseType=e.dataType||"text",e.xhrFields)for(var h in e.xhrFields)f[h]=e.xhrFields[h];var m=e.headers;if(m)for(var g in m)m.hasOwnProperty(g)&&"content-length"!==g.toLowerCase()&&"user-agent"!==g.toLowerCase()&&"origin"!==g.toLowerCase()&&"host"!==g.toLowerCase()&&f.setRequestHeader(g,m[g]);return e.onProgress&&f.upload&&(f.upload.onprogress=e.onProgress),e.onDownloadProgress&&(f.onprogress=e.onDownloadProgress),e.timeout&&(f.timeout=e.timeout),f.ontimeout=function(e){var n=new Error("timeout");t(i(n,f))},f.onload=function(){t(i(null,f,a(f,e.dataType)))},f.onerror=function(n){var r=a(f,e.dataType);if(r)t(i(null,f,r));else{var o=f.statusText;o||0!==f.status||(o=new Error("CORS blocked or network error")),t(i(o,f,r))}},f.send(e.body||""),f}},function(e,t,n){var r=n(0),o=n(10),i=n(29),a=n(9).EventProxy,s=n(1),c=n(7);function u(e,t){var n=e.TaskId,r=e.Bucket,c=e.Region,u=e.Key,p=e.StorageClass,f=this,h={},m=e.FileSize,g=e.SliceSize,y=Math.ceil(m/g),v=0,C=s.throttleOnProgress.call(f,m,e.onHashProgress),k=function(t,n){var r=t.length;if(0===r)return n(null,!0);if(r>y)return n(null,!1);if(r>1&&Math.max(t[0].Size,t[1].Size)!==g)return n(null,!1);!function o(i){if(i=a.length)S.emit("has_and_check_upload_id",t);else{var p=a[l];if(!s.isInArray(t,p))return o.removeUploadId.call(f,p),void i(l+1);o.using[p]?i(l+1):d.call(f,{Bucket:r,Region:c,Key:u,UploadId:p,tracker:e.tracker},(function(e,t){f._isRunningTask(n)&&(e?(o.removeUploadId.call(f,p),i(l+1)):S.emit("upload_id_available",{UploadId:p,PartList:t.PartList}))}))}}(0)}else S.emit("has_and_check_upload_id",t)})),S.on("get_remote_upload_id_list",(function(){l.call(f,{Bucket:r,Region:c,Key:u,tracker:e.tracker},(function(t,i){if(f._isRunningTask(n)){if(t)return S.emit("error",t);var a=s.filter(i.UploadList,(function(e){return e.Key===u&&(!p||e.StorageClass.toUpperCase()===p.toUpperCase())})).reverse().map((function(e){return e.UploadId||e.UploadID}));if(a.length)S.emit("seek_local_avail_upload_id",a);else{var c,l=o.getFileId(e.Body,e.ChunkSize,r,u);l&&(c=o.getUploadIdList.call(f,l))&&s.each(c,(function(e){o.removeUploadId.call(f,e)})),S.emit("no_available_upload_id")}}}))})),S.emit("get_remote_upload_id_list")}function l(e,t){var n=this,r=[],o={Bucket:e.Bucket,Region:e.Region,Prefix:e.Key,calledBySdk:e.calledBySdk||"sliceUploadFile",tracker:e.tracker};!function e(){n.multipartList(o,(function(n,i){if(n)return t(n);r.push.apply(r,i.Upload||[]),"true"===i.IsTruncated?(o.KeyMarker=i.NextKeyMarker,o.UploadIdMarker=i.NextUploadIdMarker,e()):t(null,{UploadList:r})}))}()}function d(e,t){var n=this,r=[],o={Bucket:e.Bucket,Region:e.Region,Key:e.Key,UploadId:e.UploadId,calledBySdk:"sliceUploadFile",tracker:e.tracker};!function e(){n.multipartListPart(o,(function(n,i){if(n)return t(n);r.push.apply(r,i.Part||[]),"true"===i.IsTruncated?(o.PartNumberMarker=i.NextPartNumberMarker,e()):t(null,{PartList:r})}))}()}function p(e,t){var n=this,r=e.TaskId,o=e.Bucket,a=e.Region,c=e.Key,u=e.UploadData,l=e.FileSize,d=e.SliceSize,p=Math.min(e.AsyncLimit||n.options.ChunkParallelLimit||1,256),h=e.Body,m=Math.ceil(l/d),g=0,y=e.ServerSideEncryption,v=e.Headers,C=s.filter(u.PartList,(function(e){return e.Uploaded&&(g+=e.PartNumber>=m&&l%d||d),!e.Uploaded})),k=e.onProgress;i.eachLimit(C,p,(function(t,i){if(n._isRunningTask(r)){var s=t.PartNumber,p=Math.min(l,t.PartNumber*d)-(t.PartNumber-1)*d,m=0;f.call(n,{TaskId:r,Bucket:o,Region:a,Key:c,SliceSize:d,FileSize:l,PartNumber:s,ServerSideEncryption:y,Body:h,UploadData:u,Headers:v,onProgress:function(e){g+=e.loaded-m,m=e.loaded,k({loaded:g,total:l})},tracker:e.tracker},(function(e,o){n._isRunningTask(r)&&(e||o.ETag||(e='get ETag error, please add "ETag" to CORS ExposeHeader setting.( 获取ETag失败,请在CORS ExposeHeader设置中添加ETag,请参考文档:https://cloud.tencent.com/document/product/436/13318 )'),e?g-=m:(g+=p-m,t.ETag=o.ETag),k({loaded:g,total:l}),i(e||null,o))}))}}),(function(e){if(n._isRunningTask(r))return e?t(e):void t(null,{UploadId:u.UploadId,SliceList:u.PartList})}))}function f(e,t){var n=this,r=e.TaskId,o=e.Bucket,a=e.Region,c=e.Key,u=e.FileSize,l=e.Body,d=1*e.PartNumber,p=e.SliceSize,f=e.ServerSideEncryption,h=e.UploadData,m=e.Headers||{},g=n.options.ChunkRetryTimes+1,y=p*(d-1),v=p,C=y+p;C>u&&(v=(C=u)-y);var k=["x-cos-traffic-limit","x-cos-mime-limit"],S={};s.each(m,(function(e,t){k.indexOf(t)>-1&&(S[t]=e)}));var b=h.PartList[d-1];i.retry(g,(function(t){n._isRunningTask(r)&&s.fileSlice(l,y,C,!0,(function(i){n.multipartUpload({TaskId:r,Bucket:o,Region:a,Key:c,ContentLength:v,PartNumber:d,UploadId:h.UploadId,ServerSideEncryption:f,Body:i,Headers:S,onProgress:e.onProgress,calledBySdk:"sliceUploadFile",tracker:e.tracker},(function(e,o){if(n._isRunningTask(r))return e?t(e):(b.Uploaded=!0,t(null,o))}))}))}),(function(e,o){if(n._isRunningTask(r))return t(e,o)}))}function h(e,t){var n=e.Bucket,r=e.Region,o=e.Key,a=e.UploadId,s=e.SliceList,c=this,u=this.options.ChunkRetryTimes+1,l=e.Headers,d=s.map((function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}}));i.retry(u,(function(t){c.multipartComplete({Bucket:n,Region:r,Key:o,UploadId:a,Parts:d,Headers:l,calledBySdk:"sliceUploadFile",tracker:e.tracker},t)}),(function(e,n){t(e,n)}))}function m(e,t){var n=e.Bucket,r=e.Region,o=e.Key,a=e.AbortArray,s=e.AsyncLimit||1,c=this,u=0,l=new Array(a.length);i.eachLimit(a,s,(function(t,i){var a=u;if(o&&o!==t.Key)return l[a]={error:{KeyNotMatch:!0}},void i(null);var s=t.UploadId||t.UploadID;c.multipartAbort({Bucket:n,Region:r,Key:t.Key,Headers:e.Headers,UploadId:s},(function(e){var o={Bucket:n,Region:r,Key:t.Key,UploadId:s};l[a]={error:e,task:o},i(null)})),u++}),(function(e){if(e)return t(e);for(var n=[],r=[],o=0,i=l.length;oo?"sliceUploadFile":"putObject",h=e.onFileFinish;i.push({api:f,params:e,callback:function(n,r){e.tracker&&e.tracker.formatResult(n,r),h&&h(n,r,l),t&&t(n,r)}}),n._addTasks(i)},uploadFiles:function(e,t){var n=this,o=void 0===e.SliceSize?n.options.SliceSize:e.SliceSize,i=0,a=0,u=s.throttleOnProgress.call(n,a,e.onProgress),l=e.files.length,d=e.onFileFinish,p=Array(l),f=function(e,n,r){u(null,!0),d&&d(e,n,r),p[r.Index]={options:r,error:e,data:n},--l<=0&&t&&t(null,{files:p})},h=[];s.each(e.files,(function(e,t){!function(){var l=e.Body,d=l.size||l.length||0,p={Index:t,TaskId:""};if(i+=d,n.options.EnableTracker){var m=n.options.UseAccelerate||"string"==typeof n.options.Domain&&n.options.Domain.includes("accelerate.");e.tracker=new c({bucket:e.Bucket,region:e.Region,apiName:"uploadFiles",fileKey:e.Key,fileSize:d,accelerate:m,deepTracker:n.options.DeepTracker,customId:n.options.CustomId,delay:n.options.TrackerDelay})}s.each(e,(function(e,t){"object"!==r(e)&&"function"!=typeof e&&(p[t]=e)}));var g=e.onTaskReady;e.onTaskReady=function(e){p.TaskId=e,g&&g(e)};var y=0,v=e.onProgress;e.onProgress=function(e){a=a-y+e.loaded,y=e.loaded,v&&v(e),u({loaded:a,total:i})};var C=d>o?"sliceUploadFile":"putObject",k=e.onFileFinish;h.push({api:C,params:e,callback:function(t,n){e.tracker&&e.tracker.formatResult(t,n),k&&k(t,n),f&&f(t,n,p)}})}()})),n._addTasks(h)},sliceCopyFile:function(e,t){var n=new a,r=this,c=e.Bucket,u=e.Region,l=e.Key,p=e.CopySource,f=s.getSourceParams.call(this,p);if(f){var h=f.Bucket,m=f.Region,y=decodeURIComponent(f.Key),v=void 0===e.CopySliceSize?r.options.CopySliceSize:e.CopySliceSize;v=Math.max(0,v);var C,k,S=e.CopyChunkSize||this.options.CopyChunkSize,b=this.options.CopyChunkParallelLimit,w=this.options.ChunkRetryTimes+1,T=0,R=0,E={},x={},A={};n.on("copy_slice_complete",(function(n){var a={};s.each(e.Headers,(function(e,t){0===t.toLowerCase().indexOf("x-cos-meta-")&&(a[t]=e)}));var d=s.map(n.PartList,(function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}}));i.retry(w,(function(e){r.multipartComplete({Bucket:c,Region:u,Key:l,UploadId:n.UploadId,Parts:d,calledBySdk:"sliceCopyFile"},e)}),(function(e,r){if(o.removeUsing(n.UploadId),e)return k(null,!0),t(e);o.removeUploadId(n.UploadId),k({loaded:C,total:C},!0),t(null,r)}))})),n.on("get_copy_data_finish",(function(e){var a=o.getCopyFileId(p,E,S,c,l);a&&o.saveUploadId(a,e.UploadId,r.options.UploadIdCacheLimit),o.setUsing(e.UploadId);var d=s.filter(e.PartList,(function(e){return e.Uploaded&&(R+=e.PartNumber>=T&&C%S||S),!e.Uploaded}));i.eachLimit(d,b,(function(t,n){var o=t.PartNumber,a=t.CopySourceRange,s=t.end-t.start;i.retry(w,(function(t){g.call(r,{Bucket:c,Region:u,Key:l,CopySource:p,UploadId:e.UploadId,PartNumber:o,CopySourceRange:a},t)}),(function(e,r){if(e)return n(e);k({loaded:R+=s,total:C}),t.ETag=r.ETag,n(e||null,r)}))}),(function(r){if(r)return o.removeUsing(e.UploadId),k(null,!0),t(r);n.emit("copy_slice_complete",e)}))})),n.on("get_chunk_size_finish",(function(){var i=function(){r.multipartInit({Bucket:c,Region:u,Key:l,Headers:A},(function(r,o){if(r)return t(r);e.UploadId=o.UploadId,n.emit("get_copy_data_finish",{UploadId:e.UploadId,PartList:e.PartList})}))},a=o.getCopyFileId(p,E,S,c,l),f=o.getUploadIdList(a);if(!a||!f)return i();!function t(a){if(a>=f.length)return i();var p=f[a];if(o.using[p])return t(a+1);d.call(r,{Bucket:c,Region:u,Key:l,UploadId:p},(function(r,i){if(r)o.removeUploadId(p),t(a+1);else{if(o.using[p])return t(a+1);var c={},u=0;s.each(i.PartList,(function(e){var t=parseInt(e.Size),n=u+t-1;c[e.PartNumber+"|"+u+"|"+n]=e.ETag,u+=t})),s.each(e.PartList,(function(e){var t=c[e.PartNumber+"|"+e.start+"|"+e.end];t&&(e.ETag=t,e.Uploaded=!0)})),n.emit("get_copy_data_finish",{UploadId:p,PartList:e.PartList})}}))}(0)})),n.on("get_file_size_finish",(function(){if(function(){for(var t=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],n=1048576,o=0;on.length&&(x[t]=e)})),n.emit("get_file_size_finish")}else t(s.error(new Error('get Content-Length error, please add "Content-Length" to CORS ExposeHeader setting.( 获取Content-Length失败,请在CORS ExposeHeader设置中添加Content-Length,请参考文档:https://cloud.tencent.com/document/product/436/13318 )')))}))}else t(s.error(new Error("CopySource format error")))}};e.exports.init=function(e,t){t.transferToTaskMethod(y,"sliceUploadFile"),s.each(y,(function(t,n){e.prototype[n]=s.apiWrapper(n,t)}))}},function(e,t){var n={eachLimit: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())}))}()},retry:function(e,t,n){e<1?n():function r(o){t((function(t,i){t&&ot?1:-1}))}var d,p=["content-disposition","content-encoding","content-length","content-md5","expect","host","if-match","if-modified-since","if-none-match","if-unmodified-since","origin","range","response-cache-control","response-content-disposition","response-content-encoding","response-content-language","response-content-type","response-expires","transfer-encoding","versionid"],f=function(e,t,n){var r=t/8,o=e.slice(n,n+r);return new Uint8Array(o).reverse(),new{8:Uint8Array,16:Uint16Array,32:Uint32Array}[t](o)[0]},h=function(e,t,n,r){var o=e.slice(t,n),i="";return new Uint8Array(o).forEach((function(e){i+=String.fromCharCode(e)})),r&&(i=decodeURIComponent(escape(i))),i},m=function(){},g=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&void 0!==e[n]&&null!==e[n]&&(t[n]=e[n]);return t},y=(d=function(e,t){e=e.split("."),t=t.split(".");for(var n=0;nparseInt(t[n])?1:-1;return 0},function(e){if(!e)return!1;var t=(e.match(/Chrome\/([.\d]+)/)||[])[1],n=(e.match(/QBCore\/([.\d]+)/)||[])[1],r=(e.match(/QQBrowser\/([.\d]+)/)||[])[1];return t&&d(t,"53.0.2785.116")<0&&n&&d(n,"3.53.991.400")<0&&r&&d(r,"9.0.2524.400")<=0||!1}("undefined"!=typeof navigator&&navigator.userAgent)),v=1048576;function C(e){return w(e,(function(e){return"object"===r(e)&&null!==e?C(e):e}))}function k(e,t){return b(t,(function(n,r){e[r]=t[r]})),e}function S(e){return e instanceof Array}function b(e,t){for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)}function w(e,t){var n=S(e)?[]:{};for(var r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r],r));return n}var T=function(e,t){var n=t.Bucket,r=t.Region,o=t.Key,i=this.options.Domain,a=!i||"string"==typeof i&&i.indexOf("{Bucket}")>-1,s=!i||"string"==typeof i&&i.indexOf("{Region}")>-1;if(e.indexOf("Bucket")>-1||"deleteMultipleObject"===e||"multipartList"===e||"listObjectVersions"===e){if(a&&!n)return"Bucket";if(s&&!r)return"Region"}else if(e.indexOf("Object")>-1||e.indexOf("multipart")>-1||"sliceUploadFile"===e||"abortUploadTask"===e){if(a&&!n)return"Bucket";if(s&&!r)return"Region";if(!o)return"Key"}return!1},R=function(e,t){if(t=k({},t),"getAuth"!==e&&"getV4Auth"!==e&&"getObjectUrl"!==e){var n=t.Headers||{};if(t&&"object"===r(t)){!function(){for(var e in t)t.hasOwnProperty(e)&&e.indexOf("x-cos-")>-1&&(n[e]=t[e])}();B.each({"x-cos-mfa":"MFA","Content-MD5":"ContentMD5","Content-Length":"ContentLength","Content-Type":"ContentType",Expect:"Expect",Expires:"Expires","Cache-Control":"CacheControl","Content-Disposition":"ContentDisposition","Content-Encoding":"ContentEncoding",Range:"Range","If-Modified-Since":"IfModifiedSince","If-Unmodified-Since":"IfUnmodifiedSince","If-Match":"IfMatch","If-None-Match":"IfNoneMatch","x-cos-copy-source":"CopySource","x-cos-copy-source-Range":"CopySourceRange","x-cos-metadata-directive":"MetadataDirective","x-cos-copy-source-If-Modified-Since":"CopySourceIfModifiedSince","x-cos-copy-source-If-Unmodified-Since":"CopySourceIfUnmodifiedSince","x-cos-copy-source-If-Match":"CopySourceIfMatch","x-cos-copy-source-If-None-Match":"CopySourceIfNoneMatch","x-cos-acl":"ACL","x-cos-grant-read":"GrantRead","x-cos-grant-write":"GrantWrite","x-cos-grant-full-control":"GrantFullControl","x-cos-grant-read-acp":"GrantReadAcp","x-cos-grant-write-acp":"GrantWriteAcp","x-cos-storage-class":"StorageClass","x-cos-traffic-limit":"TrafficLimit","x-cos-mime-limit":"MimeLimit","x-cos-server-side-encryption-customer-algorithm":"SSECustomerAlgorithm","x-cos-server-side-encryption-customer-key":"SSECustomerKey","x-cos-server-side-encryption-customer-key-MD5":"SSECustomerKeyMD5","x-cos-server-side-encryption":"ServerSideEncryption","x-cos-server-side-encryption-cos-kms-key-id":"SSEKMSKeyId","x-cos-server-side-encryption-context":"SSEContext"},(function(e,r){void 0!==t[e]&&(n[r]=t[e])})),t.Headers=g(n)}}return t},E=function(e){return Date.now()+(e||0)},x="object"===("undefined"==typeof navigator?"undefined":r(navigator))&&!!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),A="object"===("undefined"==typeof navigator?"undefined":r(navigator))&&/\sQQ/i.test(navigator.userAgent),B={noop:m,formatParams:R,apiWrapper:function(e,t){return function(n,r){var o,i=this;if("function"==typeof n&&(r=n,n={}),n=R(e,n),i.options.EnableTracker)if("sliceUploadFile"===n.calledBySdk)o=n.tracker&&n.tracker.generateSubTracker({apiName:e});else if(["uploadFile","uploadFiles"].includes(e))o=null;else{var a=-1;n.Body&&(a="string"==typeof n.Body?n.Body.length:n.Body.size||n.Body.byteLength||-1),o=new c({bucket:n.Bucket,region:n.Region,apiName:e,fileKey:n.Key,fileSize:a,deepTracker:i.options.DeepTracker,customId:i.options.CustomId,delay:i.options.TrackerDelay})}n.tracker=o;var s=function(e){return e&&e.headers&&(e.headers["x-cos-request-id"]&&(e.RequestId=e.headers["x-cos-request-id"]),e.headers["x-ci-request-id"]&&(e.RequestId=e.headers["x-ci-request-id"]),e.headers["x-cos-version-id"]&&(e.VersionId=e.headers["x-cos-version-id"]),e.headers["x-cos-delete-marker"]&&(e.DeleteMarker=e.headers["x-cos-delete-marker"])),e},u=function(e,t){o&&o.formatResult(e,t),r&&r(s(e),s(t))},l=function(){if("getService"!==e&&"abortUploadTask"!==e){var t=T.call(i,e,n);if(t)return"missing param "+t;if(n.Region){if(i.options.CompatibilityMode){if(!/^([a-z\d-.]+)$/.test(n.Region))return"Region format error."}else{if(n.Region.indexOf("cos.")>-1)return'param Region should not be start with "cos."';if(!/^([a-z\d-]+)$/.test(n.Region))return"Region format error."}!i.options.CompatibilityMode&&-1===n.Region.indexOf("-")&&"yfb"!==n.Region&&"default"!==n.Region&&n.Region}if(n.Bucket){if(!/^([a-z\d-]+)-(\d+)$/.test(n.Bucket))if(n.AppId)n.Bucket=n.Bucket+"-"+n.AppId;else{if(!i.options.AppId)return'Bucket should format as "test-1250000000".';n.Bucket=n.Bucket+"-"+i.options.AppId}n.AppId&&delete n.AppId}!i.options.UseRawKey&&n.Key&&"/"===n.Key.substr(0,1)&&(n.Key=n.Key.substr(1))}}(),d="getAuth"===e;if("function"==typeof Promise&&!d&&!r)return new Promise((function(e,o){if(r=function(t,n){t?o(t):e(n)},l)return u(B.error(new Error(l)));t.call(i,n,u)}));if(l)return u(B.error(new Error(l)));var p=t.call(i,n,u);return d?p:void 0}},xml2json:a,json2xml:s,md5:o,clearKey:g,fileSlice:function(e,t,n,r,o){var i;if(e.slice?i=e.slice(t,n):e.mozSlice?i=e.mozSlice(t,n):e.webkitSlice&&(i=e.webkitSlice(t,n)),r&&y){var a=new FileReader;a.onload=function(e){i=null,o(new Blob([a.result]))},a.readAsArrayBuffer(i)}else o(i)},getBodyMd5:function(e,t,n,r){n=n||m,e?"string"==typeof t?n(B.md5(t,!0)):Blob&&t instanceof Blob?B.getFileMd5(t,(function(e,t){n(t)}),r):n():n()},getFileMd5:function(e,t,n){var r=e.size,i=0,a=o.getCtx();!function o(s){if(s>=r){var c=a.digest("hex");t(null,c)}else{var u=Math.min(r,s+v);B.fileSlice(e,s,u,!1,(function(e){!function(e,t){var n,r=new FileReader;FileReader.prototype.readAsBinaryString?(n=FileReader.prototype.readAsBinaryString,r.onload=function(){t(this.result)}):FileReader.prototype.readAsArrayBuffer&&(n=function(e){var n="",r=new FileReader;r.onload=function(e){for(var o=new Uint8Array(r.result),i=o.byteLength,a=0;a-1||p.indexOf(r)>-1)&&(t[n]=e[n])}return t}(C(e.Headers||e.headers||{})),u=e.Key||"";e.UseRawKey?t=e.Pathname||e.pathname||"/"+u:0!==(t=e.Pathname||e.pathname||u).indexOf("/")&&(t="/"+t);var d=!1!==e.ForceSignHost;if(!c.Host&&!c.host&&e.Bucket&&e.Region&&d&&(c.Host=e.Bucket+".cos."+e.Region+".myqcloud.com"),!n)throw new Error("missing param SecretId");if(!r)throw new Error("missing param SecretKey");var f=Math.round(E(e.SystemClockOffset)/1e3)-1,h=f,m=e.Expires||e.expires;h+=void 0===m?900:1*m||0;var g=n,y=o||f+";"+h,v=o||f+";"+h,k=l(c,!0).join(";").toLowerCase(),S=l(s,!0).join(";").toLowerCase(),b=i.HmacSHA1(v,r).toString(),w=[a,t,B.obj2str(s,!0),B.obj2str(c,!0),""].join("\n"),T=["sha1",y,i.SHA1(w).toString(),""].join("\n");return["q-sign-algorithm=sha1","q-ak="+g,"q-sign-time="+y,"q-key-time="+v,"q-header-list="+k,"q-url-param-list="+S,"q-signature="+i.HmacSHA1(T,b).toString()].join("&")},parseSelectPayload:function(e){for(var t={},n=h(e),r={records:[]};e.byteLength;){var o,i=f(e,32,0),a=f(e,32,4),s=i-a-16,c=0;for(e=e.slice(12);c1)for(var n=1;n=0))throw x(R,new Error(e.tagName+"@"+n));for(var o=t.length-1;r"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function L(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(L(e,t))return!0}while(e=e.nextSibling)}function H(){}function j(e,t,n,o){e&&e._inc++,n.namespaceURI===r.XMLNS&&delete t._nsMap[n.prefix?n.localName:""]}function F(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n)r[r.length++]=n;else{for(var o=t.firstChild,i=0;o;)r[i++]=o,o=o.nextSibling;r.length=i,delete r[r.length]}}}function K(e,t){var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,F(e.ownerDocument,e),t}function q(e,t,n){var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===k){var o=t.firstChild;if(null==o)return t;var i=t.lastChild}else o=i=t;var a=n?n.previousSibling:e.lastChild;o.previousSibling=a,i.nextSibling=n,a?a.nextSibling=o:e.firstChild=o,null==n?e.lastChild=i:n.previousSibling=i;do{o.parentNode=e}while(o!==i&&(o=o.nextSibling));return F(e.ownerDocument||e,e),t.nodeType==k&&(t.firstChild=t.lastChild=null),t}function z(){this._nsMap={}}function G(){}function V(){}function X(){}function W(){}function Q(){}function J(){}function $(){}function Y(){}function Z(){}function ee(){}function te(){}function ne(){}function re(e,t){var n=[],r=9==this.nodeType&&this.documentElement||this,o=r.prefix,i=r.namespaceURI;if(i&&null==o&&null==(o=r.lookupPrefix(i)))var a=[{namespace:i,prefix:null}];return ae(this,n,e,t,a),n.join("")}function oe(e,t,n){var o=e.prefix||"",i=e.namespaceURI;if(!i)return!1;if("xml"===o&&i===r.XML||i===r.XMLNS)return!1;for(var a=n.length;a--;){var s=n[a];if(s.prefix===o)return s.namespace!==i}return!0}function ie(e,t,n){e.push(" ",t,'="',n.replace(/[<>&"\t\n\r]/g,M),'"')}function ae(e,t,n,o,i){if(i||(i=[]),o){if(!(e=o(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case l:var a=e.attributes,s=a.length,c=e.firstChild,u=e.tagName,m=u;if(!(n=r.isHTML(e.namespaceURI)||n)&&!e.prefix&&e.namespaceURI){for(var S,b=0;b=0;w--){if(""===(T=i[w]).prefix&&T.namespace===e.namespaceURI){S=T.namespace;break}}if(S!==e.namespaceURI)for(w=i.length-1;w>=0;w--){var T;if((T=i[w]).namespace===e.namespaceURI){T.prefix&&(m=T.prefix+":"+u);break}}}t.push("<",m);for(var R=0;R"),n&&/^script$/i.test(u))for(;c;)c.data?t.push(c.data):ae(c,t,n,o,i.slice()),c=c.nextSibling;else for(;c;)ae(c,t,n,o,i.slice()),c=c.nextSibling;t.push("")}else t.push("/>");return;case v:case k:for(c=e.firstChild;c;)ae(c,t,n,o,i.slice()),c=c.nextSibling;return;case d:return ie(t,e.name,e.value);case p:return t.push(e.data.replace(/[<&>]/g,M));case f:return t.push("");case y:return t.push("\x3c!--",e.data,"--\x3e");case C:var B=e.publicId,I=e.systemId;if(t.push("");else if(I&&"."!=I)t.push(" SYSTEM ",I,">");else{var _=e.internalSubset;_&&t.push(" [",_,"]"),t.push(">")}return;case g:return t.push("");case h:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function se(e,t,n){var r;switch(t.nodeType){case l:(r=t.cloneNode(!1)).ownerDocument=e;case k:break;case d:n=!0}if(r||(r=t.cloneNode(!1)),r.ownerDocument=e,r.parentNode=null,n)for(var o=t.firstChild;o;)r.appendChild(se(e,o,n)),o=o.nextSibling;return r}function ce(e,t,n){var r=new t.constructor;for(var o in t){var i=t[o];"object"!=typeof i&&i!=r[o]&&(r[o]=i)}switch(t.childNodes&&(r.childNodes=new A),r.ownerDocument=e,r.nodeType){case l:var a=t.attributes,s=r.attributes=new _,c=a.length;s._ownerElement=r;for(var u=0;u0},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n)for(var r in n)if(n[r]==e)return r;t=t.nodeType==d?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&e in n)return n[e];t=t.nodeType==d?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},s(u,U),s(u,U.prototype),H.prototype={nodeName:"#document",nodeType:v,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==k){for(var n=e.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,t),n=r}return e}return null==this.documentElement&&e.nodeType==l&&(this.documentElement=e),q(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),K(this,e)},importNode:function(e,t){return se(this,e,t)},getElementById:function(e){var t=null;return L(this.documentElement,(function(n){if(n.nodeType==l&&n.getAttribute("id")==e)return t=n,!0})),t},getElementsByClassName:function(e){var t=a(e);return new B(this,(function(n){var r=[];return t.length>0&&L(n.documentElement,(function(o){if(o!==n&&o.nodeType===l){var i=o.getAttribute("class");if(i){var s=e===i;if(!s){var c=a(i);s=t.every((u=c,function(e){return u&&-1!==u.indexOf(e)}))}s&&r.push(o)}}var u})),r}))},createElement:function(e){var t=new z;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new A,(t.attributes=new _)._ownerElement=t,t},createDocumentFragment:function(){var e=new ee;return e.ownerDocument=this,e.childNodes=new A,e},createTextNode:function(e){var t=new X;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new W;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new Q;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new te;return n.ownerDocument=this,n.tagName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new G;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Z;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new z,r=t.split(":"),o=n.attributes=new _;return n.childNodes=new A,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,o._ownerElement=n,n},createAttributeNS:function(e,t){var n=new G,r=t.split(":");return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,n}},c(H,U),z.prototype={nodeType:l,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===k?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,F(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||""},setAttributeNS:function(e,t,n){var r=this.ownerDocument.createAttributeNS(e,t);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new B(this,(function(t){var n=[];return L(t,(function(r){r===t||r.nodeType!=l||"*"!==e&&r.tagName!=e||n.push(r)})),n}))},getElementsByTagNameNS:function(e,t){return new B(this,(function(n){var r=[];return L(n,(function(o){o===n||o.nodeType!==l||"*"!==e&&o.namespaceURI!==e||"*"!==t&&o.localName!=t||r.push(o)})),r}))}},H.prototype.getElementsByTagName=z.prototype.getElementsByTagName,H.prototype.getElementsByTagNameNS=z.prototype.getElementsByTagNameNS,c(z,U),G.prototype.nodeType=d,c(G,U),V.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(w[T])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,n){n=this.data.substring(0,e)+n+this.data.substring(e+t),this.nodeValue=this.data=n,this.length=n.length}},c(V,U),X.prototype={nodeName:"#text",nodeType:p,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},c(X,V),W.prototype={nodeName:"#comment",nodeType:y},c(W,V),Q.prototype={nodeName:"#cdata-section",nodeType:f},c(Q,V),J.prototype.nodeType=C,c(J,U),$.prototype.nodeType=S,c($,U),Y.prototype.nodeType=m,c(Y,U),Z.prototype.nodeType=h,c(Z,U),ee.prototype.nodeName="#document-fragment",ee.prototype.nodeType=k,c(ee,U),te.prototype.nodeType=g,c(te,U),ne.prototype.serializeToString=function(e,t,n){return re.call(e,t,n)},U.prototype.toString=re;try{if(Object.defineProperty){function le(e){switch(e.nodeType){case l:case k:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(le(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(B.prototype,"length",{get:function(){return I(this),this.$$length}}),Object.defineProperty(U.prototype,"textContent",{get:function(){return le(this)},set:function(e){switch(this.nodeType){case l:case k:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),ue=function(e,t,n){e["$$"+t]=n}}}catch(de){}t.DocumentType=J,t.DOMException=x,t.DOMImplementation=N,t.Element=z,t.Node=U,t.NodeList=A,t.XMLSerializer=ne},function(e,t,n){var r=n(22),o=n(23),i=n(0),a=n(8),s=null,c=function(e){if(!s){var t=n(24);s=new t({appkey:"0AND0VEVB24UBGDU",versionCode:a.version,channelID:"js_sdk",openid:"openid",unionid:"unid",strictMode:!1,delay:e,sessionDuration:6e4})}return s},u=function(){var e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},l=function(){if("object"===("undefined"==typeof navigator?"undefined":i(navigator))){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return(null==e?void 0:e.type)||(null==e?void 0:e.effectiveType)||"unknown"}return"unknown"},d=function(){if("object"!==("undefined"==typeof navigator?"undefined":i(navigator)))return"unknown os";var e=navigator.userAgent.toLowerCase(),t=/macintosh|mac os x/i.test(navigator.userAgent);return e.indexOf("win32")>=0||e.indexOf("wow32")>=0?"win32":e.indexOf("win64")>=0||e.indexOf("wow64")>=0?"win64":t?"mac":"unknown os"},p=function(){return!("object"!==("undefined"==typeof navigator?"undefined":i(navigator))||!navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))},f=function(){return!("object"!==("undefined"==typeof navigator?"undefined":i(navigator))||!navigator.userAgent.match(/(Android|Adr|Linux)/i))},h=function(){return!("object"!==("undefined"==typeof navigator?"undefined":i(navigator))||!navigator.userAgent.match(/(iPhone|iPod|iPad|iOS)/i))},m=function(){if("object"!==("undefined"==typeof navigator?"undefined":i(navigator)))return"unknown device";var e=navigator.userAgent.toLowerCase();if(e.includes("app/tencent_wemeet"))return"tencent_wemeet";if(e.indexOf("maxthon")>=0){var t=e.match(/maxthon\/([\d.]+)/),n=t&&t[1]||"";return"傲游浏览器 ".concat(n).trim()}if(e.indexOf("qqbrowser")>=0){var r=e.match(/qqbrowser\/([\d.]+)/),o=r&&r[1]||"";return"QQ浏览器 ".concat(o).trim()}if(e.indexOf("se 2.x")>=0)return"搜狗浏览器";if(e.indexOf("wxwork")>=0)return"微信内置浏览器";if(e.indexOf("msie")>=0){var a=e.match(/msie ([\d.]+)/),s=a&&a[1]||"";return"IE ".concat(s).trim()}if(e.indexOf("firefox")>=0){var c=e.match(/firefox\/([\d.]+)/),u=c&&c[1]||"";return"Firefox ".concat(u).trim()}if(e.indexOf("chrome")>=0){var l=e.match(/chrome\/([\d.]+)/),d=l&&l[1]||"";return"Chrome ".concat(d).trim()}if(e.indexOf("opera")>=0){var p=e.match(/opera.([\d.]+)/),f=p&&p[1]||"";return"Opera ".concat(f).trim()}if(e.indexOf("safari")>=0){var h=e.match(/version\/([\d.]+)/),m=h&&h[1]||"";return"Safari ".concat(m).trim()}if(e.indexOf("edge")>=0){var g=e.match(/edge\/([\d.]+)/),y=g&&g[1]||"";return"edge ".concat(y).trim()}return e.substr(0,200)},g={isMobile:p(),isBrowser:!p(),mobileOsType:f()?"android":h?"ios":"other_mobile",pcOsType:d()},y={deviceType:g.isMobile?"mobile":g.isBrowser?"browser":"unknown",devicePlatform:g.isMobile?g.mobileOsType:g.pcOsType,deviceName:m()},v=["multipartInit","multipartUpload","multipartComplete","multipartList","multipartListPart","multipartAbort"],C=["putObject","postObject","appendObject","sliceUploadFile","uploadFile","uploadFiles"].concat(v),k=["getObject"];function S(e){return e.replace(/([A-Z])/g,"_$1").toLowerCase()}var b=function(){"use strict";function e(t){r(this,e);var n=t.parent,o=t.traceId,i=t.bucket,s=t.region,l=t.apiName,d=t.fileKey,p=t.fileSize,f=t.accelerate,h=t.customId,m=t.delay,g=t.deepTracker,v=i&&i.substr(i.lastIndexOf("-")+1)||"";this.parent=n,this.deepTracker=g,this.delay=m,this.params={cossdkVersion:a.version,region:s,networkType:"",host:"",accelerate:f?"Y":"N",requestPath:d||"",size:p||-1,httpMd5:0,httpSign:0,httpFull:0,name:l||"",result:"",tookTime:0,errorNode:"",errorCode:"",errorMessage:"",errorRequestId:"",errorStatusCode:0,errorServiceName:"",tracePlatform:"cos-js-sdk-v5",traceId:o||u(),bucket:i,appid:v,partNumber:0,retryTimes:0,reqUrl:"",customId:h||"",deviceType:y.deviceType,devicePlatform:y.devicePlatform,deviceName:y.deviceName,md5StartTime:0,md5EndTime:0,signStartTime:0,signEndTime:0,httpStartTime:0,httpEndTime:0,startTime:(new Date).getTime(),endTime:0},this.beacon=c(m)}return o(e,[{key:"formatResult",value:function(e,t){var n,r,o,i,a,s,c=(new Date).getTime()-this.params.startTime,u=l(),d=e?(null==e?void 0:e.code)||(null==e||null===(n=e.error)||void 0===n?void 0:n.code)||(null==e||null===(r=e.error)||void 0===r?void 0:r.Code):"",p=e?(null==e?void 0:e.message)||(null==e||null===(o=e.error)||void 0===o?void 0:o.message)||(null==e||null===(i=e.error)||void 0===i?void 0:i.Message):"",f=e?(null==e?void 0:e.resource)||(null==e||null===(a=e.error)||void 0===a?void 0:a.resource)||(null==e||null===(s=e.error)||void 0===s?void 0:s.Resource):"",h=e?null==e?void 0:e.statusCode:t.statusCode,m=e?(null==e?void 0:e.headers)&&(null==e?void 0:e.headers["x-cos-request-id"]):(null==t?void 0:t.headers)&&(null==t?void 0:t.headers["x-cos-request-id"]),g=e?m?"Server":"Client":"";if(Object.assign(this.params,{tookTime:c,networkType:u,httpMd5:this.params.md5EndTime-this.params.md5StartTime,httpSign:this.params.signEndTime-this.params.signStartTime,httpFull:this.params.httpEndTime-this.params.httpStartTime,result:e?"Fail":"Success",errorType:g,errorCode:d,errorStatusCode:h,errorMessage:p,errorServiceName:f,errorRequestId:m}),!e||d&&p||(this.params.fullError=e?JSON.stringify(e):""),"getObject"===this.params.name&&(this.params.size=t?t.headers&&t.headers["content-length"]:-1),this.params.reqUrl)try{var y=/^http(s)?:\/\/(.*?)\//.exec(this.params.reqUrl);this.params.host=y[2]}catch(e){this.params.host=this.params.reqUrl}this.sendEvents()}},{key:"setParams",value:function(e){Object.assign(this.params,e)}},{key:"sendEvents",value:function(){if(!v.includes(this.params.name)||this.deepTracker){var e,t=(e=this.params.name,C.includes(e)?"cos_upload":k.includes(e)?"cos_download":"base_service"),n=function(e){var t={},n="Success"===e.result?["tracePlatform","cossdkVersion","region","bucket","appid","networkType","host","accelerate","requestPath","partNumber","size","name","result","tookTime","errorRequestId","retryTimes","reqUrl","customId","deviceType","devicePlatform","deviceName"]:["tracePlatform","cossdkVersion","region","networkType","host","accelerate","requestPath","size","httpMd5","httpSign","httpFull","name","result","tookTime","errorNode","errorCode","errorMessage","errorRequestId","errorStatusCode","errorServiceName","errorType","traceId","bucket","appid","partNumber","retryTimes","reqUrl","customId","fullError","deviceType","devicePlatform","deviceName"];for(var r in e)n.includes(r)&&(t[S(r)]=e[r]);return t}(this.params);this.beacon||(this.beacon=c(this.delay||5e3)),0===this.delay?this.beacon&&this.beacon.onDirectUserAction(t,n):this.beacon&&this.beacon.onUserAction(t,n)}}},{key:"generateSubTracker",value:function(t){return Object.assign(t,{parent:this,deepTracker:this.deepTracker,traceId:this.params.traceId,bucket:this.params.bucket,region:this.params.region,fileKey:this.params.requestPath,customId:this.params.customId,delay:this.delay}),new e(t)}}]),e}();e.exports=b},function(e){e.exports=JSON.parse('{"name":"cos-js-sdk-v5","version":"1.4.9","description":"JavaScript SDK for [腾讯云对象存储](https://cloud.tencent.com/product/cos)","main":"dist/cos-js-sdk-v5.js","types":"index.d.ts","scripts":{"server":"node server/sts.js","dev":"cross-env NODE_ENV=development webpack -w --mode=development","build":"cross-env NODE_ENV=production webpack --mode=production","cos-auth.min.js":"uglifyjs ./demo/common/cos-auth.js -o ./demo/common/cos-auth.min.js -c -m"},"repository":{"type":"git","url":"git+https://github.com/tencentyun/cos-js-sdk-v5.git"},"keywords":[],"author":"carsonxu","license":"ISC","bugs":{"url":"https://github.com/tencentyun/cos-js-sdk-v5/issues"},"homepage":"https://github.com/tencentyun/cos-js-sdk-v5#readme","dependencies":{"@xmldom/xmldom":"^0.8.2"},"devDependencies":{"@babel/core":"7.17.9","@babel/plugin-transform-runtime":"7.18.10","@babel/preset-env":"7.16.11","babel-loader":"8.2.5","body-parser":"^1.18.3","cross-env":"^5.2.0","express":"^4.16.4","qcloud-cos-sts":"^3.0.2","request":"^2.87.0","terser-webpack-plugin":"4.2.3","webpack":"4.46.0","webpack-cli":"4.10.0"}}')},function(e,t){var n=function(e){var t={},n=function(e){return!t[e]&&(t[e]=[]),t[e]};e.on=function(e,t){n(e).push(t)},e.off=function(e,t){for(var r=n(e),o=r.length-1;o>=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;o=0;n--){var o=r[n][2];(!o||o+2592e3=0;o--){var i=r[o];i[0]===e&&i[1]===t&&r.splice(o,1)}r.unshift([e,t,Math.round(Date.now()/1e3)]),r.length>n&&r.splice(n),l()}},removeUploadId:function(e){u.call(this),delete d.using[e];for(var t=r.length-1;t>=0;t--)r[t][1]===e&&r.splice(t,1);l()}};e.exports=d},function(e,t,n){var r=n(12);e.exports=r},function(e,t,n){"use strict";var r=n(1),o=n(9),i=n(25),a=n(26),s=n(28),c=n(8),u={AppId:"",SecretId:"",SecretKey:"",SecurityToken:"",ChunkRetryTimes:2,FileParallelLimit:3,ChunkParallelLimit:3,ChunkSize:1048576,SliceSize:1048576,CopyChunkParallelLimit:20,CopyChunkSize:10485760,CopySliceSize:10485760,MaxPartNumber:1e4,ProgressInterval:1e3,Domain:"",ServiceDomain:"",Protocol:"",CompatibilityMode:!1,ForcePathStyle:!1,UseRawKey:!1,Timeout:0,CorrectClockSkew:!0,SystemClockOffset:0,UploadCheckContentMd5:!1,UploadQueueSize:1e4,UploadAddMetaMd5:!1,UploadIdCacheLimit:50,UseAccelerate:!1,ForceSignHost:!0,EnableTracker:!1,DeepTracker:!1,TrackerDelay:5e3,CustomId:""},l=function(e){this.options=r.extend(r.clone(u),e||{}),this.options.FileParallelLimit=Math.max(1,this.options.FileParallelLimit),this.options.ChunkParallelLimit=Math.max(1,this.options.ChunkParallelLimit),this.options.ChunkRetryTimes=Math.max(0,this.options.ChunkRetryTimes),this.options.ChunkSize=Math.max(1048576,this.options.ChunkSize),this.options.CopyChunkParallelLimit=Math.max(1,this.options.CopyChunkParallelLimit),this.options.CopyChunkSize=Math.max(1048576,this.options.CopyChunkSize),this.options.CopySliceSize=Math.max(0,this.options.CopySliceSize),this.options.MaxPartNumber=Math.max(1024,Math.min(1e4,this.options.MaxPartNumber)),this.options.Timeout=Math.max(0,this.options.Timeout),this.options.AppId,this.options.SecretId&&this.options.SecretId.indexOf(" "),this.options.SecretKey&&this.options.SecretKey.indexOf(" "),r.isNode(),o.init(this),i.init(this)};a.init(l,i),s.init(l,i),l.util={md5:r.md5,xml2json:r.xml2json,json2xml:r.json2xml},l.getAuthorization=r.getAuth,l.version=c.version,e.exports=l},function(module,exports,__webpack_require__){(function(process,global,module){var __WEBPACK_AMD_DEFINE_RESULT__,_typeof=__webpack_require__(0);(function(){"use strict";var ERROR="input is invalid type",WINDOW="object"===("undefined"==typeof window?"undefined":_typeof(window)),root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"===("undefined"==typeof self?"undefined":_typeof(self)),NODE_JS=!root.JS_MD5_NO_NODE_JS&&"object"===(void 0===process?"undefined":_typeof(process))&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&"object"===_typeof(module)&&module.exports,AMD=__webpack_require__(14),ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}!root.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===_typeof(e)&&e.buffer&&e.buffer.constructor===ArrayBuffer});var createOutputMethod=function(e){return function(t,n){return new Md5(!0).update(t,n)[e]()}},createMethod=function(){var e=createOutputMethod("hex");NODE_JS&&(e=nodeWrap(e)),e.getCtx=e.create=function(){return new Md5},e.update=function(t){return e.create().update(t)};for(var t=0;t>6,s[r++]=128|63&n):n<55296||n>=57344?(s[r++]=224|n>>12,s[r++]=128|n>>6&63,s[r++]=128|63&n):(n=65536+((1023&n)<<10|1023&e.charCodeAt(++o)),s[r++]=240|n>>18,s[r++]=128|n>>12&63,s[r++]=128|n>>6&63,s[r++]=128|63&n);else for(r=this.start;o>2]|=n<>2]|=(192|n>>6)<>2]|=(128|63&n)<=57344?(a[r>>2]|=(224|n>>12)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<=64?(this.start=r-64,this.hash(),this.hashed=!0):this.start=r}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>2]|=EXTRA[3&t],t>=56&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var e,t,n,r,o,i,a=this.blocks;this.first?t=((t=((e=((e=a[0]-680876937)<<7|e>>>25)-271733879<<0)^(n=((n=(-271733879^(r=((r=(-1732584194^2004318071&e)+a[1]-117830708)<<12|r>>>20)+e<<0)&(-271733879^e))+a[2]-1126478375)<<17|n>>>15)+r<<0)&(r^e))+a[3]-1316259209)<<22|t>>>10)+n<<0:(e=this.h0,t=this.h1,n=this.h2,t=((t+=((e=((e+=((r=this.h3)^t&(n^r))+a[0]-680876936)<<7|e>>>25)+t<<0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+a[1]-389564586)<<12|r>>>20)+e<<0)&(e^t))+a[2]+606105819)<<17|n>>>15)+r<<0)&(r^e))+a[3]-1044525330)<<22|t>>>10)+n<<0),t=((t+=((e=((e+=(r^t&(n^r))+a[4]-176418897)<<7|e>>>25)+t<<0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+a[5]+1200080426)<<12|r>>>20)+e<<0)&(e^t))+a[6]-1473231341)<<17|n>>>15)+r<<0)&(r^e))+a[7]-45705983)<<22|t>>>10)+n<<0,t=((t+=((e=((e+=(r^t&(n^r))+a[8]+1770035416)<<7|e>>>25)+t<<0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+a[9]-1958414417)<<12|r>>>20)+e<<0)&(e^t))+a[10]-42063)<<17|n>>>15)+r<<0)&(r^e))+a[11]-1990404162)<<22|t>>>10)+n<<0,t=((t+=((e=((e+=(r^t&(n^r))+a[12]+1804603682)<<7|e>>>25)+t<<0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+a[13]-40341101)<<12|r>>>20)+e<<0)&(e^t))+a[14]-1502002290)<<17|n>>>15)+r<<0)&(r^e))+a[15]+1236535329)<<22|t>>>10)+n<<0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+a[1]-165796510)<<5|e>>>27)+t<<0)^t))+a[6]-1069501632)<<9|r>>>23)+e<<0)^e&((n=((n+=(e^t&(r^e))+a[11]+643717713)<<14|n>>>18)+r<<0)^r))+a[0]-373897302)<<20|t>>>12)+n<<0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+a[5]-701558691)<<5|e>>>27)+t<<0)^t))+a[10]+38016083)<<9|r>>>23)+e<<0)^e&((n=((n+=(e^t&(r^e))+a[15]-660478335)<<14|n>>>18)+r<<0)^r))+a[4]-405537848)<<20|t>>>12)+n<<0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+a[9]+568446438)<<5|e>>>27)+t<<0)^t))+a[14]-1019803690)<<9|r>>>23)+e<<0)^e&((n=((n+=(e^t&(r^e))+a[3]-187363961)<<14|n>>>18)+r<<0)^r))+a[8]+1163531501)<<20|t>>>12)+n<<0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+a[13]-1444681467)<<5|e>>>27)+t<<0)^t))+a[2]-51403784)<<9|r>>>23)+e<<0)^e&((n=((n+=(e^t&(r^e))+a[7]+1735328473)<<14|n>>>18)+r<<0)^r))+a[12]-1926607734)<<20|t>>>12)+n<<0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+a[5]-378558)<<4|e>>>28)+t<<0))+a[8]-2022574463)<<11|r>>>21)+e<<0)^e)^(n=((n+=(i^t)+a[11]+1839030562)<<16|n>>>16)+r<<0))+a[14]-35309556)<<23|t>>>9)+n<<0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+a[1]-1530992060)<<4|e>>>28)+t<<0))+a[4]+1272893353)<<11|r>>>21)+e<<0)^e)^(n=((n+=(i^t)+a[7]-155497632)<<16|n>>>16)+r<<0))+a[10]-1094730640)<<23|t>>>9)+n<<0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+a[13]+681279174)<<4|e>>>28)+t<<0))+a[0]-358537222)<<11|r>>>21)+e<<0)^e)^(n=((n+=(i^t)+a[3]-722521979)<<16|n>>>16)+r<<0))+a[6]+76029189)<<23|t>>>9)+n<<0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+a[9]-640364487)<<4|e>>>28)+t<<0))+a[12]-421815835)<<11|r>>>21)+e<<0)^e)^(n=((n+=(i^t)+a[15]+530742520)<<16|n>>>16)+r<<0))+a[2]-995338651)<<23|t>>>9)+n<<0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+a[0]-198630844)<<6|e>>>26)+t<<0)|~n))+a[7]+1126891415)<<10|r>>>22)+e<<0)^((n=((n+=(e^(r|~t))+a[14]-1416354905)<<15|n>>>17)+r<<0)|~e))+a[5]-57434055)<<21|t>>>11)+n<<0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+a[12]+1700485571)<<6|e>>>26)+t<<0)|~n))+a[3]-1894986606)<<10|r>>>22)+e<<0)^((n=((n+=(e^(r|~t))+a[10]-1051523)<<15|n>>>17)+r<<0)|~e))+a[1]-2054922799)<<21|t>>>11)+n<<0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+a[8]+1873313359)<<6|e>>>26)+t<<0)|~n))+a[15]-30611744)<<10|r>>>22)+e<<0)^((n=((n+=(e^(r|~t))+a[6]-1560198380)<<15|n>>>17)+r<<0)|~e))+a[13]+1309151649)<<21|t>>>11)+n<<0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+a[4]-145523070)<<6|e>>>26)+t<<0)|~n))+a[11]-1120210379)<<10|r>>>22)+e<<0)^((n=((n+=(e^(r|~t))+a[2]+718787259)<<15|n>>>17)+r<<0)|~e))+a[9]-343485551)<<21|t>>>11)+n<<0,this.first?(this.h0=e+1732584193<<0,this.h1=t-271733879<<0,this.h2=n-1732584194<<0,this.h3=r+271733878<<0,this.first=!1):(this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+n<<0,this.h3=this.h3+r<<0)},Md5.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(e){if("hex"===e)return this.hex();this.finalize();var t=this.h0,n=this.h1,r=this.h2,o=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255,255&o,o>>8&255,o>>16&255,o>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var e,t,n,r="",o=this.array(),i=0;i<15;)e=o[i++],t=o[i++],n=o[i++],r+=BASE64_ENCODE_CHAR[e>>>2]+BASE64_ENCODE_CHAR[63&(e<<4|t>>>4)]+BASE64_ENCODE_CHAR[63&(t<<2|n>>>6)]+BASE64_ENCODE_CHAR[63&n];return e=o[i],r+=BASE64_ENCODE_CHAR[e>>>2]+BASE64_ENCODE_CHAR[e<<4&63]+"=="};var exports=createMethod();COMMON_JS?module.exports=exports:(root.md5=exports,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()}).call(this,__webpack_require__(3),__webpack_require__(4),__webpack_require__(5)(module))},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t,n){(function(e){var t,r,o,i,a,s,c,u=n(0),l=l||function(e,t){var n={},r=n.lib={},o=function(){},i=r.Base={extend:function(e){o.prototype=this;var t=new o;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},a=r.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes;if(e=e.sigBytes,this.clamp(),r%4)for(var o=0;o>>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)}},u=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(u.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return u.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);if(t=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*i,o=e.min(4*t,o),t){for(var c=0;cu;u++){if(16>u)i[u]=0|e[t+u];else{var l=i[u-3]^i[u-8]^i[u-14]^i[u-16];i[u]=l<<1|l>>>31}l=(r<<5|r>>>27)+c+i[u],l=20>u?l+(1518500249+(o&a|~o&s)):40>u?l+(1859775393+(o^a^s)):60>u?l+((o&a|o&s|a&s)-1894007588):l+((o^a^s)-899497514),c=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]+c|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}}),t.SHA1=o._createHelper(a),t.HmacSHA1=o._createHmacHelper(a),function(){var e=l,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,c=a.words,u=0;u>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s>>6*(3-s)&63));var c=r.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,n=this._map,r=n.charAt(64);if(r){var o=e.indexOf(r);-1!=o&&(t=o)}for(var i=[],a=0,s=0;s>>6-s%4*2;i[a>>>2]|=(u|l)<<24-a%4*8,a++}return c.create(i,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},"object"===u(e)?e.exports=l:window.CryptoJS=l}).call(this,n(5)(e))},function(e,t,n){var r=n(17).DOMParser,o=function(){this.version="1.3.5";var e={mergeCDATA:!0,normalize:!0,stripElemPrefix:!0},t=new RegExp(/(?!xmlns)^.*:/);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(n,r){for(var i in r)e[i]=r[i];var a={},s=0,c="";if(n.childNodes.length)for(var u,l,d,p=0;p=t+n||t?new java.lang.String(e,t,n)+"":e}function g(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}p.prototype.parseFromString=function(e,t){var n=this.options,r=new l,o=n.domBuilder||new f,a=n.errorHandler,s=n.locator,u=n.xmlns||{},p=/\/x?html?$/.test(t),h=p?i.HTML_ENTITIES:i.XML_ENTITIES;s&&o.setDocumentLocator(s),r.errorHandler=function(e,t,n){if(!e){if(t instanceof f)return t;e=t}var r={},o=e instanceof Function;function i(t){var i=e[t];!i&&o&&(i=2==e.length?function(n){e(t,n)}:e),r[t]=i&&function(e){i("[xmldom "+t+"]\t"+e+function(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}(n))}||function(){}}return n=n||{},i("warning"),i("error"),i("fatalError"),r}(a,o,s),r.domBuilder=n.domBuilder||o,p&&(u[""]=c.HTML),u.xml=u.xml||c.XML;var m=n.normalizeLineEndings||d;return e&&"string"==typeof e?r.parse(m(e),u,h):r.errorHandler.error("invalid doc source"),o.doc},f.prototype={startDocument:function(){this.doc=(new s).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,r){var o=this.doc,i=o.createElementNS(e,n||t),a=r.length;g(this,i),this.currentElement=i,this.locator&&h(this.locator,i);for(var s=0;s",lt:"<",quot:'"'}),t.HTML_ENTITIES=r({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),t.entityMap=t.HTML_ENTITIES},function(e,t,n){var r=n(2).NAMESPACE,o=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,i=new RegExp("[\\-\\.0-9"+o.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),a=new RegExp("^"+o.source+i.source+"*(?::"+o.source+i.source+"*)?$");function s(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,s)}function c(){}function u(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function l(e,t,n,o,i,a){function s(e,t,r){n.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),n.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),r)}for(var c,u=++t,l=0;;){var d=e.charAt(u);switch(d){case"=":if(1===l)c=e.slice(t,u),l=3;else{if(2!==l)throw new Error("attribute equal must after attrName");l=3}break;case"'":case'"':if(3===l||1===l){if(1===l&&(a.warning('attribute value must after "="'),c=e.slice(t,u)),t=u+1,!((u=e.indexOf(d,t))>0))throw new Error("attribute value no end '"+d+"' match");s(c,p=e.slice(t,u),t-1),l=5}else{if(4!=l)throw new Error('attribute value must after "="');s(c,p=e.slice(t,u),t),a.warning('attribute "'+c+'" missed start quot('+d+")!!"),t=u+1,l=5}break;case"/":switch(l){case 0:n.setTagName(e.slice(t,u));case 5:case 6:case 7:l=7,n.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),0==l&&n.setTagName(e.slice(t,u)),u;case">":switch(l){case 0:n.setTagName(e.slice(t,u));case 5:case 6:case 7:break;case 4:case 1:"/"===(p=e.slice(t,u)).slice(-1)&&(n.closed=!0,p=p.slice(0,-1));case 2:2===l&&(p=c),4==l?(a.warning('attribute "'+p+'" missed quot(")!'),s(c,p,t)):(r.isHTML(o[""])&&p.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+p+'" missed value!! "'+p+'" instead!!'),s(p,p,t));break;case 3:throw new Error("attribute value missed!!")}return u;case"€":d=" ";default:if(d<=" ")switch(l){case 0:n.setTagName(e.slice(t,u)),l=6;break;case 1:c=e.slice(t,u),l=2;break;case 4:var p=e.slice(t,u);a.warning('attribute "'+p+'" missed quot(")!!'),s(c,p,t);case 5:l=6}else switch(l){case 2:n.tagName;r.isHTML(o[""])&&c.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),s(c,c,t),t=u,l=1;break;case 5:a.warning('attribute space is required"'+c+'"!!');case 6:l=1,t=u;break;case 3:l=4,t=u;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function d(e,t,n){for(var o=e.tagName,i=null,a=e.length;a--;){var s=e[a],c=s.qName,u=s.value;if((f=c.indexOf(":"))>0)var l=s.prefix=c.slice(0,f),d=c.slice(f+1),p="xmlns"===l&&d;else d=c,l=null,p="xmlns"===c&&"";s.localName=d,!1!==p&&(null==i&&(i={},h(n,n={})),n[p]=i[p]=u,s.uri=r.XMLNS,t.startPrefixMapping(p,u))}for(a=e.length;a--;){(l=(s=e[a]).prefix)&&("xml"===l&&(s.uri=r.XML),"xmlns"!==l&&(s.uri=n[l||""]))}var f;(f=o.indexOf(":"))>0?(l=e.prefix=o.slice(0,f),d=e.localName=o.slice(f+1)):(l=null,d=e.localName=o);var m=e.uri=n[l||""];if(t.startElement(m,d,o,e),!e.closed)return e.currentNSMap=n,e.localNSMap=i,!0;if(t.endElement(m,d,o),i)for(l in i)t.endPrefixMapping(l)}function p(e,t,n,r,o){if(/^(?:script|textarea)$/i.test(n)){var i=e.indexOf("",t),a=e.substring(t+1,i);if(/[&<]/.test(a))return/^script$/i.test(n)?(o.characters(a,0,a.length),i):(a=a.replace(/&#?\w+;/g,r),o.characters(a,0,a.length),i)}return t+1}function f(e,t,n,r){var o=r[n];return null==o&&((o=e.lastIndexOf(""))t?(n.comment(e,t+4,o-t-4),o+3):(r.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var o=e.indexOf("]]>",t+9);return n.startCDATA(),n.characters(e,t+9,o-t-9),n.endCDATA(),o+3}var i=function(e,t){var n,r=[],o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;o.lastIndex=t,o.exec(e);for(;n=o.exec(e);)if(r.push(n),n[1])return r}(e,t),a=i.length;if(a>1&&/!doctype/i.test(i[0][0])){var s=i[1][0],c=!1,u=!1;a>3&&(/^public$/i.test(i[2][0])?(c=i[3][0],u=a>4&&i[4][0]):/^system$/i.test(i[2][0])&&(u=i[3][0]));var l=i[a-1];return n.startDTD(s,c,u),n.endDTD(),l.index+l[0].length}return-1}function g(e,t,n){var r=e.indexOf("?>",t);if(r){var o=e.substring(t,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(o){o[0].length;return n.processingInstruction(o[1],o[2]),r+2}return-1}return-1}function y(){this.attributeNames={}}s.prototype=new Error,s.prototype.name=s.name,c.prototype={parse:function(e,t,n){var o=this.domBuilder;o.startDocument(),h(t,t={}),function(e,t,n,o,i){function a(e){if(e>65535){var t=55296+((e-=65536)>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function c(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(n,t)?n[t]:"#"===t.charAt(0)?a(parseInt(t.substr(1).replace("x","0x"))):(i.error("entity not found:"+e),e)}function h(t){if(t>R){var n=e.substring(R,t).replace(/&#?\w+;/g,c);b&&v(R),o.characters(n,0,t-R),R=t}}function v(t,n){for(;t>=k&&(n=S.exec(e));)C=n.index,k=C+n[0].length,b.lineNumber++;b.columnNumber=t-C+1}var C=0,k=0,S=/.*(?:\r\n?|\n)|.*$/g,b=o.locator,w=[{currentNSMap:t}],T={},R=0;for(;;){try{var E=e.indexOf("<",R);if(E<0){if(!e.substr(R).match(/^\s*$/)){var x=o.doc,A=x.createTextNode(e.substr(R));x.appendChild(A),o.currentElement=A}return}switch(E>R&&h(E),e.charAt(E+1)){case"/":var B=e.indexOf(">",E+3),I=e.substring(E+2,B).replace(/[ \t\n\r]+$/g,""),_=w.pop();B<0?(I=e.substring(E+2).replace(/[\s<].*/,""),i.error("end tag name: "+I+" is not complete:"+_.tagName),B=E+1+I.length):I.match(/\sR?R=B:h(Math.max(E,R)+1)}}(e,t,n,o,this.errorHandler),o.endDocument()}},y.prototype={setTagName:function(e){if(!a.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,n){if(!a.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},t.XMLReader=c,t.ParseError=s},function(e,t,n){var r=n(0),o="a-zA-Z_À-ÖØ-öø-ÿͰ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿿、-퟿豈-﷏ﷰ-�",i=new RegExp("^([^"+o+"])|^((x|X)(m|M)(l|L))|([^"+o+"-.0-9·̀-ͯ‿⁀])","g"),a=/[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm,s=function(e){var t=[];if(e instanceof Object)for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t},c=function(e,t){var n=function(e,n,r,o,a){var s=void 0!==t.indent?t.indent:"\t",c=t.prettyPrint?"\n"+new Array(o).join(s):"";t.removeIllegalNameCharacters&&(e=e.replace(i,"_"));var u=[c,"<",e,r||""];return n&&n.length>0?(u.push(">"),u.push(n),a&&u.push(c),u.push("")):u.push("/>"),u.join("")};return function e(o,i,c){var u=r(o);switch((Array.isArray?Array.isArray(o):o instanceof Array)?u="array":o instanceof Date&&(u="date"),u){case"array":var l=[];return o.map((function(t){l.push(e(t,1,c+1))})),t.prettyPrint&&l.push("\n"),l.join("");case"date":return o.toJSON?o.toJSON():o+"";case"object":var d=[];for(var p in o)if(o.hasOwnProperty(p))if(o[p]instanceof Array)for(var f=0;f0&&d.push("\n"),d.join("");case"function":return o();default:return t.escape?(""+o).replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""").replace(a,""):""+o}}(e,0,0)},u=function(e){var t=['"),t.join("")};e.exports=function(e,t){if(t||(t={xmlHeader:{standalone:!0},prettyPrint:!0,indent:" ",escape:!0}),"string"==typeof e)try{e=JSON.parse(e.toString())}catch(e){return!1}var n="",o="";return t&&("object"==r(t)?(t.xmlHeader&&(n=u(!!t.xmlHeader.standalone)),void 0!==t.docType&&(o="")):n=u()),[n,(t=t||{}).prettyPrint&&o?"\n":"",o,c(e,t)].join("").replace(/\n{2,}/g,"\n").replace(/\s+$/g,"")}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){function n(e,t){for(var n=0;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]60*this.strategy.requestInterval*1e3},e.prototype.getUploadUrl=function(){return this.strategy.httpsUploadUrl+"?appkey="+this.appkey},e.prototype.isBlackEvent=function(e){return-1!=this.strategy.blacklist.indexOf(e)},e.prototype.isEventUpOnOff=function(){return this.strategy.isEventUpOnOff},e.prototype.isSampleEvent=function(e){return!!Object.prototype.hasOwnProperty.call(this.realSample,e)&&this.realSample[e]this.duration)return this.createSession();t=r.sessionId,n=r.sessionStart}catch(e){}return{sessionId:t,sessionStart:n}},e.prototype.createSession=function(){var e=Date.now(),t={sessionId:this.appkey+"_"+e.toString(),sessionStart:e};this.storage.setItem(k,JSON.stringify(t)),this.storage.setItem(c,e.toString());var n="is_new_user",r=this.storage.getItem(n);return this.beacon.onDirectUserAction("rqd_applaunched",{A21:r?"N":"Y"}),this.storage.setItem(n,JSON.stringify(!1)),t},e}();function b(){var e=navigator.userAgent,t=e.indexOf("compatible")>-1&&e.indexOf("MSIE")>-1,n=e.indexOf("Edge")>-1&&!t,r=e.indexOf("Trident")>-1&&e.indexOf("rv:11.0")>-1;if(t){new RegExp("MSIE (\\d+\\.\\d+);").test(e);var o=parseFloat(RegExp.$1);return 7==o?7:8==o?8:9==o?9:10==o?10:6}return n?-2:r?11:-1}var w,T,R=function(){return(R=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0||!window.indexedDB||/X5Lite/.test(navigator.userAgent)?(this.store=new I(t),this.dbEventCount=this.store.getCount()):(this.store=new B(e),this.getCount().then((function(e){n.dbEventCount=e})))}return e.prototype.getCount=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.store.getCount()];case 1:return[2,e.sent()];case 2:return e.sent(),[2,Promise.reject()];case 3:return[2]}}))}))},e.prototype.insertEvent=function(e,t){return n(this,void 0,void 0,(function(){var n,r;return o(this,(function(o){switch(o.label){case 0:if(this.dbEventCount>=1e4)return[2,Promise.reject()];n=m(e.mapValue),o.label=1;case 1:return o.trys.push([1,3,,4]),this.dbEventCount++,[4,this.store.setItem(n,e)];case 2:return[2,o.sent()];case 3:return r=o.sent(),t&&t(r,e),this.dbEventCount--,[2,Promise.reject()];case 4:return[2]}}))}))},e.prototype.getEvents=function(){return n(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:e=[],t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.store.iterate((function(t){e.push(t)}))];case 2:case 3:return t.sent(),[2,Promise.all(e)];case 4:return[2]}}))}))},e.prototype.removeEvent=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:t=m(e.mapValue),n.label=1;case 1:return n.trys.push([1,3,,4]),this.dbEventCount--,[4,this.store.removeItem(t)];case 2:return[2,n.sent()];case 3:return n.sent(),this.dbEventCount++,[2,Promise.reject()];case 4:return[2]}}))}))},e}(),O=function(){return(O=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]},r=function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]},o=function(e,t){return 32==(t%=64)?[e[1],e[0]]:t<32?[e[0]<>>32-t,e[1]<>>32-t]:[e[1]<<(t-=32)|e[0]>>>32-t,e[0]<>>32-t]},i=function(e,t){return 0==(t%=64)?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=r(e,[4283543511,3981806797]),e=a(e,[0,e[0]>>>1]),e=r(e,[3301882366,444984403]),a(e,[0,e[0]>>>1])},c=(e=e||"").length%16,u=e.length-c,l=[0,t=t||0],d=[0,t],p=[0,0],f=[0,0],h=[2277735313,289559509],m=[1291169091,658871167],g=0;g>>0).toString(16)).slice(-8)+("00000000"+(l[1]>>>0).toString(16)).slice(-8)+("00000000"+(d[0]>>>0).toString(16)).slice(-8)+("00000000"+(d[1]>>>0).toString(16)).slice(-8)}}])&&t(o.prototype,i),n}()}()}(W={exports:{}}),W.exports),J="logid_start",$="4.5.6-web";return function(n){function r(e){var t=n.call(this,e)||this;t.qimei36="",t.uselessCycleTaskNum=0,t.underWeakNet=!1,t.send=function(e,n,r){t.storage.setItem(c,Date.now().toString()),t.network.post(t.uploadUrl||t.strategy.getUploadUrl(),e.data).then((function(r){var o;100==(null===(o=null==r?void 0:r.data)||void 0===o?void 0:o.result)?t.delayTime=1e3*r.data.delayTime:t.delayTime=0,n&&n(e.data),e.data.events.forEach((function(e){t.store.removeEvent(e).then((function(){t.removeSendingId(m(e.mapValue))}))})),t.doCustomCycleTask()})).catch((function(n){var o=e.data.events;t.errorReport.reportError(n.code?n.code.toString():"600",n.message),r&&r(e.data);var i=JSON.parse(t.storage.getItem(u));o.forEach((function(e){i&&-1!=i.indexOf(m(e))&&t.store.insertEvent(e,(function(e,n){e&&t.errorReport.reportError("604","insertEvent fail!")})),t.removeSendingId(m(e))})),t.monitorUploadFailed()}))};var r,o,i=b();return t.isUnderIE8=i>0&&i<8,t.isUnderIE8||(t.isUnderIE=i>0,e.needInitQimei&&t.initQimei(e.appkey),t.network=new V(e),t.storage=new X(e.appkey),t.initCommonInfo(e),t.store=new _(e.appkey,t.storage),t.errorReport=new v(t.config,t.commonInfo,"web",t.network),t.strategy=new C(t.config,t.commonInfo,t.storage,t.network),t.logidStartTime=t.storage.getItem(J),t.logidStartTime||(t.logidStartTime=Date.now().toString(),t.storage.setItem(J,t.logidStartTime)),r=t.logidStartTime,o=Date.now()-Number.parseFloat(r),Math.floor(o/864e5)>=365&&t.storage.clear(),t.initSession(e),t.onDirectUserAction("rqd_js_init",{}),setTimeout((function(){return t.lifeCycle.emit("init")}),0),t.initDelayTime=e.delay?e.delay:1e3,t.cycleTask(t.initDelayTime)),t}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(r,n),r.prototype.initQimei=function(e){var t=this;(new Q).getQimei36(e,(function(e){t.qimei36=e.q36}))},r.prototype.initSession=function(e){var t=18e5;e.sessionDuration&&e.sessionDuration>3e4&&(t=e.sessionDuration),this.beaconSession=new S(this.storage,t,this)},r.prototype.initCommonInfo=function(e){var t=Number(this.storage.getItem(c));try{var n=JSON.parse(this.storage.getItem(u));(Date.now()-t>3e4||!n)&&this.storage.setItem(u,JSON.stringify([]))}catch(e){}e.uploadUrl&&(this.uploadUrl=e.uploadUrl+"?appkey="+e.appkey);var r=[window.screen.width,window.screen.height];window.devicePixelRatio&&r.push(window.devicePixelRatio),this.commonInfo={deviceId:this.storage.createDeviceId(),language:navigator&&navigator.language||"zh_CN",query:window.location.search,userAgent:navigator.userAgent,pixel:r.join("*"),channelID:e.channelID?String(e.channelID):"",openid:e.openid?String(e.openid):"",unid:e.unionid?String(e.unionid):"",sdkVersion:$},this.config.appVersion=e.versionCode?String(e.versionCode):"",this.config.strictMode=e.strictMode},r.prototype.cycleTask=function(e){var t=this;this.intervalID=window.setInterval((function(){t.store.getEvents().then((function(e){var n=[],r=JSON.parse(t.storage.getItem(u));r||(r=[]),e&&e.forEach((function(e){var t=m(e.mapValue);-1==r.indexOf(t)&&(n.push(e),r.push(t))})),0!=n.length&&(t.storage.setItem(u,JSON.stringify(r)),t._normalLogPipeline(t.assembleData(n)))})).catch((function(e){}))}),e)},r.prototype.onReport=function(e,t,n){var r=this;if(this.isUnderIE8)this.errorReport.reportError("601","UnderIE8");else{var o=this.generateData(e,t,n);if(n&&0==this.delayTime&&!this.underWeakNet)this._normalLogPipeline(this.assembleData(o));else{var i=o.shift();i&&this.store.insertEvent(i,(function(e){e&&r.errorReport.reportError("604","insertEvent fail!")})).catch((function(e){r._normalLogPipeline(r.assembleData(o))}))}}},r.prototype.onSendBeacon=function(e,t){if(this.isUnderIE)this.errorReport.reportError("605","UnderIE");else{var n=this.assembleData(this.generateData(e,t,!0));"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(this.uploadUrl||this.strategy.getUploadUrl(),JSON.stringify(n))}},r.prototype.generateData=function(e,n,r){var o=[],i="4.5.6-web_"+(r?"direct_log_id":"normal_log_id"),a=Number(this.storage.getItem(i));return a=a||1,n=t(t({},n),{A99:r?"Y":"N",A100:a.toString(),A72:$,A88:this.logidStartTime}),a++,this.storage.setItem(i,a.toString()),o.push({eventCode:e,eventTime:Date.now().toString(),mapValue:f(n,this.config.strictMode)}),o},r.prototype.assembleData=function(e){var n=this.beaconSession.getSession();return{appVersion:this.config.appVersion?h(this.config.appVersion):"",sdkId:"js",sdkVersion:$,mainAppKey:this.config.appkey,platformId:3,common:f(t(t({},this.additionalParams),{A2:this.commonInfo.deviceId,A8:this.commonInfo.openid,A12:this.commonInfo.language,A17:this.commonInfo.pixel,A23:this.commonInfo.channelID,A50:this.commonInfo.unid,A76:n.sessionId,A101:this.commonInfo.userAgent,A102:window.location.href,A104:document.referrer,A119:this.commonInfo.query,A153:this.qimei36}),!1),events:e}},r.prototype.monitorUploadFailed=function(){this.uselessCycleTaskNum++,this.uselessCycleTaskNum>=5&&(window.clearInterval(this.intervalID),this.cycleTask(6e4),this.underWeakNet=!0)},r.prototype.doCustomCycleTask=function(){this.uselessCycleTaskNum>=5&&(window.clearInterval(this.intervalID),this.cycleTask(this.initDelayTime)),this.uselessCycleTaskNum=0,this.underWeakNet=!1},r}(y)},"object"==s(t)&&void 0!==e?e.exports=a():void 0===(i="function"==typeof(o=a)?o.call(t,n,t,e):o)||(e.exports=i)}).call(this,n(4))},function(e,t,n){var r=n(10),o=n(1),i={};e.exports.transferToTaskMethod=function(e,t){i[t]=e[t],e[t]=function(e,n){e.SkipTask?i[t].call(this,e,n):this._addTask(t,e,n)}},e.exports.init=function(e){var t,n,a=[],s={},c=0,u=0,l=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),e._custom&&(t._custom=e._custom),t},d=(n=function(){t=0,e.emit("task-list-update",{list:o.map(a,l)}),e.emit("list-update",{list:o.map(a,l)})},function(){t||(t=setTimeout(n))}),p=function(){if(!(a.length<=e.options.UploadQueueSize)){for(var t=0;te.options.UploadQueueSize;){var n="waiting"===a[t].state||"checking"===a[t].state||"uploading"===a[t].state;a[t]&&n?t++:(s[a[t].id]&&delete s[a[t].id],a.splice(t,1),u--)}d()}},f=function t(){if(!(c>=e.options.FileParallelLimit)){for(;a[u]&&"waiting"!==a[u].state;)u++;if(!(u>=a.length)){var n=a[u];u++,c++,n.state="checking",n.params.onTaskStart&&n.params.onTaskStart(l(n)),!n.params.UploadData&&(n.params.UploadData={});var r=o.formatParams(n.api,n.params);i[n.api].call(e,r,(function(r,o){e._isRunningTask(n.id)&&("checking"!==n.state&&"uploading"!==n.state||(n.state=r?"error":"success",r&&(n.error=r),c--,d(),t(),n.callback&&n.callback(r,o),"success"===n.state&&(n.params&&(delete n.params.UploadData,delete n.params.Body,delete n.params),delete n.callback)),p())})),d(),setTimeout(t)}}},h=function(t,n){var o=s[t];if(o){var i=o&&"waiting"===o.state,a=o&&("checking"===o.state||"uploading"===o.state);if("canceled"===n&&"canceled"!==o.state||"paused"===n&&i||"paused"===n&&a){if("paused"===n&&o.params.Body&&"function"==typeof o.params.Body.pipe)return;o.state=n,e.emit("inner-kill-task",{TaskId:t,toState:n});try{var u=o&&o.params&&o.params.UploadData.UploadId}catch(e){}"canceled"===n&&u&&r.removeUsing(u),d(),a&&(c--,f()),"canceled"===n&&(o.params&&(delete o.params.UploadData,delete o.params.Body,delete o.params),delete o.callback)}p()}};e._addTasks=function(t){o.each(t,(function(t){e._addTask(t.api,t.params,t.callback,!0)})),d()};e._addTask=function(t,n,r,i){n=o.formatParams(t,n);var c=o.uuid();n.TaskId=c,n.onTaskReady&&n.onTaskReady(c),n.TaskReady&&(n.TaskReady(c),!1);var u={params:n,callback:r,api:t,index:a.length,id:c,Bucket:n.Bucket,Region:n.Region,Key:n.Key,FilePath:n.FilePath||"",state:"waiting",loaded:0,size:0,speed:0,percent:0,hashPercent:0,error:null,_custom:n._custom},l=n.onHashProgress;n.onHashProgress=function(t){e._isRunningTask(u.id)&&(u.hashPercent=t.percent,l&&l(t),d())};var h=n.onProgress;return n.onProgress=function(t){e._isRunningTask(u.id)&&("checking"===u.state&&(u.state="uploading"),u.loaded=t.loaded,u.speed=t.speed,u.percent=t.percent,h&&h(t),d())},o.getFileSize(t,n,(function(e,t){if(e)return r(o.error(e));s[c]=u,a.push(u),u.size=t,!i&&d(),f(),p()})),c},e._isRunningTask=function(e){var t=s[e];return!(!t||"checking"!==t.state&&"uploading"!==t.state)},e.getTaskList=function(){return o.map(a,l)},e.cancelTask=function(e){h(e,"canceled")},e.pauseTask=function(e){h(e,"paused")},e.restartTask=function(e){var t=s[e];!t||"paused"!==t.state&&"error"!==t.state||(t.state="waiting",d(),u=Math.min(u,t.index),f())},e.isUploadRunning=function(){return c||u-1?"{Region}.myqcloud.com":"cos.{Region}.myqcloud.com",e.ForcePathStyle||(a="{Bucket}."+a)),a=(a=a.replace(/\{\{AppId\}\}/gi,i).replace(/\{\{Bucket\}\}/gi,r).replace(/\{\{Region\}\}/gi,t).replace(/\{\{.*?\}\}/gi,"")).replace(/\{AppId\}/gi,i).replace(/\{BucketName\}/gi,r).replace(/\{Bucket\}/gi,n).replace(/\{Region\}/gi,t).replace(/\{.*?\}/gi,""),/^[a-zA-Z]+:\/\//.test(a)||(a=c+"//"+a),"/"===a.slice(-1)&&(a=a.slice(0,-1));var u=a;return e.ForcePathStyle&&(u+="/"+n),u+="/",s&&(u+=o.camSafeUrlEncode(s).replace(/%2F/g,"/")),e.isLocation&&(u=u.replace(/^https?:\/\//,"")),u}var c=function(e){if(!e.Bucket||!e.Region)return"";var t=void 0===e.UseAccelerate?this.options.UseAccelerate:e.UseAccelerate,n=(e.Url||s({ForcePathStyle:this.options.ForcePathStyle,protocol:this.options.Protocol,domain:this.options.Domain,bucket:e.Bucket,region:t?"accelerate":e.Region})).replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1");return new RegExp("^([a-z\\d-]+-\\d+\\.)?(cos|cosv6|ci|pic)\\.([a-z\\d-]+)\\.myqcloud\\.com$").test(n)?n:""};function u(e,t){var n=o.clone(e.Headers),r="";o.each(n,(function(e,t){(""===e||["content-type","cache-control","expires"].indexOf(t.toLowerCase())>-1)&&delete n[t],"host"===t.toLowerCase()&&(r=e)}));var i=!1!==e.ForceSignHost;!r&&e.SignHost&&i&&(n.Host=e.SignHost);var a=!1,s=function(e,n){a||(a=!0,n&&n.XCosSecurityToken&&!n.SecurityToken&&((n=o.clone(n)).SecurityToken=n.XCosSecurityToken,delete n.XCosSecurityToken),t&&t(e,n))},c=this,u=e.Bucket||"",l=e.Region||"",d=e.Key||"";c.options.ForcePathStyle&&u&&(d=u+"/"+d);var p="/"+d,f={},h=e.Scope;if(!h){var m=e.Action||"",g=e.ResourceKey||e.Key||"";h=e.Scope||[{action:m,bucket:u,region:l,prefix:g}]}var y=o.md5(JSON.stringify(h));c._StsCache=c._StsCache||[],function(){var e,t;for(e=c._StsCache.length-1;e>=0;e--){t=c._StsCache[e];var n=Math.round(o.getSkewTime(c.options.SystemClockOffset)/1e3)+30;if(t.StartTime&&n=t.ExpiredTime)c._StsCache.splice(e,1);else if(!t.ScopeLimit||t.ScopeLimit&&t.ScopeKey===y){f=t;break}}}();var v,C=function(){var t="";f.StartTime&&e.Expires?t=f.StartTime+";"+(f.StartTime+1*e.Expires):f.StartTime&&f.ExpiredTime&&(t=f.StartTime+";"+f.ExpiredTime);var r={Authorization:o.getAuth({SecretId:f.TmpSecretId,SecretKey:f.TmpSecretKey,Method:e.Method,Pathname:p,Query:e.Query,Headers:n,Expires:e.Expires,UseRawKey:c.options.UseRawKey,SystemClockOffset:c.options.SystemClockOffset,KeyTime:t,ForceSignHost:i}),SecurityToken:f.SecurityToken||f.XCosSecurityToken||"",Token:f.Token||"",ClientIP:f.ClientIP||"",ClientUA:f.ClientUA||""};s(null,r)},k=function(e){if(e.Authorization){var t=!1,n=e.Authorization;if(n)if(n.indexOf(" ")>-1)t=!1;else if(n.indexOf("q-sign-algorithm=")>-1&&n.indexOf("q-ak=")>-1&&n.indexOf("q-sign-time=")>-1&&n.indexOf("q-key-time=")>-1&&n.indexOf("q-url-param-list=")>-1)t=!0;else try{(n=atob(n)).indexOf("a=")>-1&&n.indexOf("k=")>-1&&n.indexOf("t=")>-1&&n.indexOf("r=")>-1&&n.indexOf("b=")>-1&&(t=!0)}catch(e){}if(!t)return o.error(new Error("getAuthorization callback params format error"))}else{if(!e.TmpSecretId)return o.error(new Error('getAuthorization callback params missing "TmpSecretId"'));if(!e.TmpSecretKey)return o.error(new Error('getAuthorization callback params missing "TmpSecretKey"'));if(!e.SecurityToken&&!e.XCosSecurityToken)return o.error(new Error('getAuthorization callback params missing "SecurityToken"'));if(!e.ExpiredTime)return o.error(new Error('getAuthorization callback params missing "ExpiredTime"'));if(e.ExpiredTime&&10!==e.ExpiredTime.toString().length)return o.error(new Error('getAuthorization callback params "ExpiredTime" should be 10 digits'));if(e.StartTime&&10!==e.StartTime.toString().length)return o.error(new Error('getAuthorization callback params "StartTime" should be 10 StartTime'))}return!1};if(f.ExpiredTime&&f.ExpiredTime-o.getSkewTime(c.options.SystemClockOffset)/1e3>60)C();else if(c.options.getAuthorization)c.options.getAuthorization.call(c,{Bucket:u,Region:l,Method:e.Method,Key:d,Pathname:p,Query:e.Query,Headers:n,Scope:h,SystemClockOffset:c.options.SystemClockOffset,ForceSignHost:i},(function(e){"string"==typeof e&&(e={Authorization:e});var t=k(e);if(t)return s(t);e.Authorization?s(null,e):((f=e||{}).Scope=h,f.ScopeKey=y,c._StsCache.push(f),C())}));else{if(!c.options.getSTS)return v={Authorization:o.getAuth({SecretId:e.SecretId||c.options.SecretId,SecretKey:e.SecretKey||c.options.SecretKey,Method:e.Method,Pathname:p,Query:e.Query,Headers:n,Expires:e.Expires,UseRawKey:c.options.UseRawKey,SystemClockOffset:c.options.SystemClockOffset,ForceSignHost:i}),SecurityToken:c.options.SecurityToken||c.options.XCosSecurityToken},s(null,v),v;c.options.getSTS.call(c,{Bucket:u,Region:l},(function(e){(f=e||{}).Scope=h,f.ScopeKey=y,f.TmpSecretId||(f.TmpSecretId=f.SecretId),f.TmpSecretKey||(f.TmpSecretKey=f.SecretKey);var t=k(f);if(t)return s(t);c._StsCache.push(f),C()}))}return""}function l(e){var t=!1,n=!1,r=e.headers&&(e.headers.date||e.headers.Date)||e.error&&e.error.ServerTime;try{var i=e.error.Code,a=e.error.Message;("RequestTimeTooSkewed"===i||"AccessDenied"===i&&"Request has expired"===a)&&(n=!0)}catch(e){}if(e)if(n&&r){var s=Date.parse(r);this.options.CorrectClockSkew&&Math.abs(o.getSkewTime(this.options.SystemClockOffset)-s)>=3e4&&(this.options.SystemClockOffset=s-Date.now(),t=!0)}else 5===Math.floor(e.statusCode/100)&&(t=!0);return t}function d(e,t){var n=this;!e.headers&&(e.headers={}),!e.qs&&(e.qs={}),e.VersionId&&(e.qs.versionId=e.VersionId),e.qs=o.clearKey(e.qs),e.headers&&(e.headers=o.clearKey(e.headers)),e.qs&&(e.qs=o.clearKey(e.qs));var r=o.clone(e.qs);e.action&&(r[e.action]="");var i=e.url||e.Url,a=e.SignHost||c.call(this,{Bucket:e.Bucket,Region:e.Region,Url:i}),s=e.tracker;!function o(i){var c=n.options.SystemClockOffset;s&&s.setParams({signStartTime:(new Date).getTime(),retryTimes:i-1}),u.call(n,{Bucket:e.Bucket||"",Region:e.Region||"",Method:e.method,Key:e.Key,Query:r,Headers:e.headers,SignHost:a,Action:e.Action,ResourceKey:e.ResourceKey,Scope:e.Scope,ForceSignHost:n.options.ForceSignHost},(function(r,a){r?t(r):(s&&s.setParams({signEndTime:(new Date).getTime(),httpStartTime:(new Date).getTime()}),e.AuthData=a,p.call(n,e,(function(r,a){s&&s.setParams({httpEndTime:(new Date).getTime()}),r&&i<2&&(c!==n.options.SystemClockOffset||l.call(n,r))?(e.headers&&(delete e.headers.Authorization,delete e.headers.token,delete e.headers.clientIP,delete e.headers.clientUA,e.headers["x-cos-security-token"]&&delete e.headers["x-cos-security-token"],e.headers["x-ci-security-token"]&&delete e.headers["x-ci-security-token"]),o(i+1)):t(r,a)})))}))}(1)}function p(e,t){var n=this,i=e.TaskId;if(!i||n._isRunningTask(i)){var a=e.Bucket,c=e.Region,u=e.Key,l=e.method||"GET",d=e.Url||e.url,p=e.body,f=e.rawBody;n.options.UseAccelerate&&(c="accelerate"),d=d||s({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:a,region:c,object:u}),e.action&&(d=d+"?"+(o.isIOS_QQ?"".concat(e.action,"="):e.action)),e.qsStr&&(d=d.indexOf("?")>-1?d+"&"+e.qsStr:d+"?"+e.qsStr);var h={method:l,url:d,headers:e.headers,qs:e.qs,body:p},m="x-cos-security-token";if(o.isCIHost(d)&&(m="x-ci-security-token"),h.headers.Authorization=e.AuthData.Authorization,e.AuthData.Token&&(h.headers.token=e.AuthData.Token),e.AuthData.ClientIP&&(h.headers.clientIP=e.AuthData.ClientIP),e.AuthData.ClientUA&&(h.headers.clientUA=e.AuthData.ClientUA),e.AuthData.SecurityToken&&(h.headers[m]=e.AuthData.SecurityToken),h.headers&&(h.headers=o.clearKey(h.headers)),h=o.clearKey(h),e.onProgress&&"function"==typeof e.onProgress){var g=p&&(p.size||p.length)||0;h.onProgress=function(t){if(!i||n._isRunningTask(i)){var r=t?t.loaded:0;e.onProgress({loaded:r,total:g})}}}e.onDownloadProgress&&(h.onDownloadProgress=e.onDownloadProgress),e.DataType&&(h.dataType=e.DataType),this.options.Timeout&&(h.timeout=this.options.Timeout),n.options.ForcePathStyle&&(h.pathStyle=n.options.ForcePathStyle),n.emit("before-send",h);var y=h.url.includes("accelerate."),v=h.qs?Object.keys(h.qs).map((function(e){return"".concat(e,"=").concat(h.qs[e])})).join("&"):"",C=v?h.url+"?"+v:h.url;e.tracker&&e.tracker.setParams({reqUrl:C,accelerate:y?"Y":"N"}),e.tracker&&e.tracker.parent&&e.tracker.parent.setParams({reqUrl:C,accelerate:y?"Y":"N"});var k=(n.options.Request||r)(h,(function(e){if("abort"!==e.error){var r={options:h,error:c,statusCode:s&&s.statusCode||0,headers:s&&s.headers||{},body:u};n.emit("after-receive",r),c=r.error,u=r.body,s={statusCode:r.statusCode,headers:r.headers},n.emit("after-receive",e);var a,s={statusCode:e.statusCode,statusMessage:e.statusMessage,headers:e.headers},c=e.error,u=e.body,l=function(e,r){if(i&&n.off("inner-kill-task",S),!a){a=!0;var c={};s&&s.statusCode&&(c.statusCode=s.statusCode),s&&s.headers&&(c.headers=s.headers),e?(e=o.extend(e||{},c),t(e,null)):(r=o.extend(r||{},c),t(null,r)),k=null}};if(c)return l(o.error(c));var d,p=s.statusCode,m=2===Math.floor(p/100);if(f&&m)return l(null,{body:u});try{d=u&&u.indexOf("<")>-1&&u.indexOf(">")>-1&&o.xml2json(u)||{}}catch(e){d={}}var g=d&&d.Error;m?l(null,d):g?l(o.error(new Error(g.Message),{code:g.Code,error:g})):p?l(o.error(new Error(s.statusMessage),{code:""+p})):p&&l(o.error(new Error("statusCode error")))}})),S=function e(t){t.TaskId===i&&(k&&k.abort&&k.abort(),n.off("inner-kill-task",e))};i&&n.on("inner-kill-task",S)}}var f={getService:function(e,t){"function"==typeof e&&(t=e,e={});var n=this.options.Protocol||(o.isBrowser&&"http:"===location.protocol?"http:":"https:"),r=this.options.ServiceDomain,i=e.AppId||this.options.appId,a=e.Region;r?(r=r.replace(/\{\{AppId\}\}/gi,i||"").replace(/\{\{Region\}\}/gi,a||"").replace(/\{\{.*?\}\}/gi,""),/^[a-zA-Z]+:\/\//.test(r)||(r=n+"//"+r),"/"===r.slice(-1)&&(r=r.slice(0,-1))):r=a?n+"//cos."+a+".myqcloud.com":n+"//service.cos.myqcloud.com";var s="",c=a?"cos."+a+".myqcloud.com":"service.cos.myqcloud.com";c===r.replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1")&&(s=c),d.call(this,{Action:"name/cos:GetService",url:r,method:"GET",headers:e.Headers,SignHost:s},(function(e,n){if(e)return t(e);var r=n&&n.ListAllMyBucketsResult&&n.ListAllMyBucketsResult.Buckets&&n.ListAllMyBucketsResult.Buckets.Bucket||[];r=o.isArray(r)?r:[r];var i=n&&n.ListAllMyBucketsResult&&n.ListAllMyBucketsResult.Owner||{};t(null,{Buckets:r,Owner:i,statusCode:n.statusCode,headers:n.headers})}))},putBucket:function(e,t){var n=this,r="";if(e.BucketAZConfig){var i={BucketAZConfig:e.BucketAZConfig};r=o.json2xml({CreateBucketConfiguration:i})}d.call(this,{Action:"name/cos:PutBucket",method:"PUT",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,body:r},(function(r,o){if(r)return t(r);var i=s({protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,isLocation:!0});t(null,{Location:i,statusCode:o.statusCode,headers:o.headers})}))},headBucket:function(e,t){d.call(this,{Action:"name/cos:HeadBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"HEAD"},t)},getBucket:function(e,t){var n={};n.prefix=e.Prefix||"",n.delimiter=e.Delimiter,n.marker=e.Marker,n["max-keys"]=e.MaxKeys,n["encoding-type"]=e.EncodingType,d.call(this,{Action:"name/cos:GetBucket",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n},(function(e,n){if(e)return t(e);var r=n.ListBucketResult||{},i=r.Contents||[],a=r.CommonPrefixes||[];i=o.isArray(i)?i:[i],a=o.isArray(a)?a:[a];var s=o.clone(r);o.extend(s,{Contents:i,CommonPrefixes:a,statusCode:n.statusCode,headers:n.headers}),t(null,s)}))},deleteBucket:function(e,t){d.call(this,{Action:"name/cos:DeleteBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"DELETE"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketAcl:function(e,t){var n=e.Headers,r="";if(e.AccessControlPolicy){var i=o.clone(e.AccessControlPolicy||{}),s=i.Grants||i.Grant;s=o.isArray(s)?s:[s],delete i.Grant,delete i.Grants,i.AccessControlList={Grant:s},r=o.json2xml({AccessControlPolicy:i}),n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(r))}o.each(n,(function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=a(n[t]))})),d.call(this,{Action:"name/cos:PutBucketACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,headers:n,action:"acl",body:r},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketAcl:function(e,t){d.call(this,{Action:"name/cos:GetBucketACL",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"acl"},(function(e,n){if(e)return t(e);var r=n.AccessControlPolicy||{},a=r.Owner||{},s=r.AccessControlList.Grant||[];s=o.isArray(s)?s:[s];var c=i(r);n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=o.extend(c,{Owner:a,Grants:s,statusCode:n.statusCode,headers:n.headers}),t(null,c)}))},putBucketCors:function(e,t){var n=(e.CORSConfiguration||{}).CORSRules||e.CORSRules||[];n=o.clone(o.isArray(n)?n:[n]),o.each(n,(function(e){o.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],(function(t){var n=t+"s",r=e[n]||e[t]||[];delete e[n],e[t]=o.isArray(r)?r:[r]}))}));var r={CORSRule:n};e.ResponseVary&&(r.ResponseVary=e.ResponseVary);var i=o.json2xml({CORSConfiguration:r}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(i)),d.call(this,{Action:"name/cos:PutBucketCORS",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"cors",headers:a},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketCors:function(e,t){d.call(this,{Action:"name/cos:GetBucketCORS",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors"},(function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchCORSConfiguration"===e.error.Code){var r={CORSRules:[],statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var i=n.CORSConfiguration||{},a=i.CORSRules||i.CORSRule||[];a=o.clone(o.isArray(a)?a:[a]);var s=i.ResponseVary;o.each(a,(function(e){o.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],(function(t){var n=t+"s",r=e[n]||e[t]||[];delete e[t],e[n]=o.isArray(r)?r:[r]}))})),t(null,{CORSRules:a,ResponseVary:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketCors:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketCORS",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode||e.statusCode,headers:n.headers})}))},getBucketLocation:function(e,t){d.call(this,{Action:"name/cos:GetBucketLocation",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"location"},t)},getBucketPolicy:function(e,t){d.call(this,{Action:"name/cos:GetBucketPolicy",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy",rawBody:!0},(function(e,n){if(e)return e.statusCode&&403===e.statusCode?t(o.error(e,{ErrorStatus:"Access Denied"})):e.statusCode&&405===e.statusCode?t(o.error(e,{ErrorStatus:"Method Not Allowed"})):e.statusCode&&404===e.statusCode?t(o.error(e,{ErrorStatus:"Policy Not Found"})):t(e);var r={};try{r=JSON.parse(n.body)}catch(e){}t(null,{Policy:r,statusCode:n.statusCode,headers:n.headers})}))},putBucketPolicy:function(e,t){var n=e.Policy;try{"string"==typeof n&&(n=JSON.parse(n))}catch(e){}if(!n||"string"==typeof n)return t(o.error(new Error("Policy format error")));var r=JSON.stringify(n);n.version||(n.version="2.0");var i=e.Headers;i["Content-Type"]="application/json",i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:PutBucketPolicy",method:"PUT",Bucket:e.Bucket,Region:e.Region,action:"policy",body:r,headers:i},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},deleteBucketPolicy:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketPolicy",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode||e.statusCode,headers:n.headers})}))},putBucketTagging:function(e,t){var n=e.Tagging||{},r=n.TagSet||n.Tags||e.Tags||[];r=o.clone(o.isArray(r)?r:[r]);var i=o.json2xml({Tagging:{TagSet:{Tag:r}}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(i)),d.call(this,{Action:"name/cos:PutBucketTagging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"tagging",headers:a},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketTagging:function(e,t){d.call(this,{Action:"name/cos:GetBucketTagging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging"},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"NoSuchTagSet"!==e.error.Code)t(e);else{var r={Tags:[],statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else{var i=[];try{i=n.Tagging.TagSet.Tag||[]}catch(e){}i=o.clone(o.isArray(i)?i:[i]),t(null,{Tags:i,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketTagging:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketTagging",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketLifecycle:function(e,t){var n=(e.LifecycleConfiguration||{}).Rules||e.Rules||[];n=o.clone(n);var r=o.json2xml({LifecycleConfiguration:{Rule:n}}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:PutBucketLifecycle",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"lifecycle",headers:i},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketLifecycle:function(e,t){d.call(this,{Action:"name/cos:GetBucketLifecycle",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle"},(function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchLifecycleConfiguration"===e.error.Code){var r={Rules:[],statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var i=[];try{i=n.LifecycleConfiguration.Rule||[]}catch(e){}i=o.clone(o.isArray(i)?i:[i]),t(null,{Rules:i,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketLifecycle:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketLifecycle",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketVersioning:function(e,t){if(e.VersioningConfiguration){var n=e.VersioningConfiguration||{},r=o.json2xml({VersioningConfiguration:n}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:PutBucketVersioning",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"versioning",headers:i},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t(o.error(new Error("missing param VersioningConfiguration")))},getBucketVersioning:function(e,t){d.call(this,{Action:"name/cos:GetBucketVersioning",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"versioning"},(function(e,n){e||!n.VersioningConfiguration&&(n.VersioningConfiguration={}),t(e,n)}))},putBucketReplication:function(e,t){var n=o.clone(e.ReplicationConfiguration),r=o.json2xml({ReplicationConfiguration:n});r=(r=r.replace(/<(\/?)Rules>/gi,"<$1Rule>")).replace(/<(\/?)Tags>/gi,"<$1Tag>");var i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:PutBucketReplication",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"replication",headers:i},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketReplication:function(e,t){d.call(this,{Action:"name/cos:GetBucketReplication",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"ReplicationConfigurationnotFoundError"!==e.error.Code)t(e);else{var r={ReplicationConfiguration:{Rules:[]},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else!n.ReplicationConfiguration&&(n.ReplicationConfiguration={}),n.ReplicationConfiguration.Rule&&(n.ReplicationConfiguration.Rules=o.makeArray(n.ReplicationConfiguration.Rule),delete n.ReplicationConfiguration.Rule),t(e,n)}))},deleteBucketReplication:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketWebsite:function(e,t){if(e.WebsiteConfiguration){var n=o.clone(e.WebsiteConfiguration||{}),r=n.RoutingRules||n.RoutingRule||[];r=o.isArray(r)?r:[r],delete n.RoutingRule,delete n.RoutingRules,r.length&&(n.RoutingRules={RoutingRule:r});var i=o.json2xml({WebsiteConfiguration:n}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(i)),d.call(this,{Action:"name/cos:PutBucketWebsite",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"website",headers:a},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t(o.error(new Error("missing param WebsiteConfiguration")))},getBucketWebsite:function(e,t){d.call(this,{Action:"name/cos:GetBucketWebsite",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"website"},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchWebsiteConfiguration"===e.error.Code){var r={WebsiteConfiguration:{},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var i=n.WebsiteConfiguration||{};if(i.RoutingRules){var a=o.clone(i.RoutingRules.RoutingRule||[]);a=o.makeArray(a),i.RoutingRules=a}t(null,{WebsiteConfiguration:i,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketWebsite:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketWebsite",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"website"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketReferer:function(e,t){if(e.RefererConfiguration){var n=o.clone(e.RefererConfiguration||{}),r=n.DomainList||{},i=r.Domains||r.Domain||[];(i=o.isArray(i)?i:[i]).length&&(n.DomainList={Domain:i});var a=o.json2xml({RefererConfiguration:n}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(a)),d.call(this,{Action:"name/cos:PutBucketReferer",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:a,action:"referer",headers:s},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t(o.error(new Error("missing param RefererConfiguration")))},getBucketReferer:function(e,t){d.call(this,{Action:"name/cos:GetBucketReferer",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"referer"},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchRefererConfiguration"===e.error.Code){var r={WebsiteConfiguration:{},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var i=n.RefererConfiguration||{};if(i.DomainList){var a=o.makeArray(i.DomainList.Domain||[]);i.DomainList={Domains:a}}t(null,{RefererConfiguration:i,statusCode:n.statusCode,headers:n.headers})}}))},putBucketDomain:function(e,t){var n=(e.DomainConfiguration||{}).DomainRule||e.DomainRule||[];n=o.clone(n);var r=o.json2xml({DomainConfiguration:{DomainRule:n}}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:PutBucketDomain",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"domain",headers:i},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketDomain:function(e,t){d.call(this,{Action:"name/cos:GetBucketDomain",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain"},(function(e,n){if(e)return t(e);var r=[];try{r=n.DomainConfiguration.DomainRule||[]}catch(e){}r=o.clone(o.isArray(r)?r:[r]),t(null,{DomainRule:r,statusCode:n.statusCode,headers:n.headers})}))},deleteBucketDomain:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketDomain",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketOrigin:function(e,t){var n=(e.OriginConfiguration||{}).OriginRule||e.OriginRule||[];n=o.clone(n);var r=o.json2xml({OriginConfiguration:{OriginRule:n}}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:PutBucketOrigin",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"origin",headers:i},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketOrigin:function(e,t){d.call(this,{Action:"name/cos:GetBucketOrigin",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin"},(function(e,n){if(e)return t(e);var r=[];try{r=n.OriginConfiguration.OriginRule||[]}catch(e){}r=o.clone(o.isArray(r)?r:[r]),t(null,{OriginRule:r,statusCode:n.statusCode,headers:n.headers})}))},deleteBucketOrigin:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketOrigin",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketLogging:function(e,t){var n=o.json2xml({BucketLoggingStatus:e.BucketLoggingStatus||""}),r=e.Headers;r["Content-Type"]="application/xml",r["Content-MD5"]=o.binaryBase64(o.md5(n)),d.call(this,{Action:"name/cos:PutBucketLogging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:n,action:"logging",headers:r},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketLogging:function(e,t){d.call(this,{Action:"name/cos:GetBucketLogging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"logging"},(function(e,n){if(e)return t(e);t(null,{BucketLoggingStatus:n.BucketLoggingStatus,statusCode:n.statusCode,headers:n.headers})}))},putBucketInventory:function(e,t){var n=o.clone(e.InventoryConfiguration);if(n.OptionalFields){var r=n.OptionalFields||[];n.OptionalFields={Field:r}}if(n.Destination&&n.Destination.COSBucketDestination&&n.Destination.COSBucketDestination.Encryption){var i=n.Destination.COSBucketDestination.Encryption;Object.keys(i).indexOf("SSECOS")>-1&&(i["SSE-COS"]=i.SSECOS,delete i.SSECOS)}var a=o.json2xml({InventoryConfiguration:n}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(a)),d.call(this,{Action:"name/cos:PutBucketInventory",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:a,action:"inventory",qs:{id:e.Id},headers:s},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketInventory:function(e,t){d.call(this,{Action:"name/cos:GetBucketInventory",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id}},(function(e,n){if(e)return t(e);var r=n.InventoryConfiguration;if(r&&r.OptionalFields&&r.OptionalFields.Field){var i=r.OptionalFields.Field;o.isArray(i)||(i=[i]),r.OptionalFields=i}if(r.Destination&&r.Destination.COSBucketDestination&&r.Destination.COSBucketDestination.Encryption){var a=r.Destination.COSBucketDestination.Encryption;Object.keys(a).indexOf("SSE-COS")>-1&&(a.SSECOS=a["SSE-COS"],delete a["SSE-COS"])}t(null,{InventoryConfiguration:r,statusCode:n.statusCode,headers:n.headers})}))},listBucketInventory:function(e,t){d.call(this,{Action:"name/cos:ListBucketInventory",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{"continuation-token":e.ContinuationToken}},(function(e,n){if(e)return t(e);var r=n.ListInventoryConfigurationResult,i=r.InventoryConfiguration||[];i=o.isArray(i)?i:[i],delete r.InventoryConfiguration,o.each(i,(function(e){if(e&&e.OptionalFields&&e.OptionalFields.Field){var t=e.OptionalFields.Field;o.isArray(t)||(t=[t]),e.OptionalFields=t}if(e.Destination&&e.Destination.COSBucketDestination&&e.Destination.COSBucketDestination.Encryption){var n=e.Destination.COSBucketDestination.Encryption;Object.keys(n).indexOf("SSE-COS")>-1&&(n.SSECOS=n["SSE-COS"],delete n["SSE-COS"])}})),r.InventoryConfigurations=i,o.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)}))},deleteBucketInventory:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketInventory",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id}},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketAccelerate:function(e,t){if(e.AccelerateConfiguration){var n={AccelerateConfiguration:e.AccelerateConfiguration||{}},r=o.json2xml(n),i={"Content-Type":"application/xml"};i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:PutBucketAccelerate",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"accelerate",headers:i},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t(o.error(new Error("missing param AccelerateConfiguration")))},getBucketAccelerate:function(e,t){d.call(this,{Action:"name/cos:GetBucketAccelerate",method:"GET",Bucket:e.Bucket,Region:e.Region,action:"accelerate"},(function(e,n){e||!n.AccelerateConfiguration&&(n.AccelerateConfiguration={}),t(e,n)}))},putBucketEncryption:function(e,t){var n=e.ServerSideEncryptionConfiguration||{},r=n.Rule||n.Rules||[],i=o.json2xml({ServerSideEncryptionConfiguration:{Rule:r}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(i)),d.call(this,{Action:"name/cos:PutBucketEncryption",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"encryption",headers:a},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketEncryption:function(e,t){d.call(this,{Action:"name/cos:GetBucketEncryption",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"encryption"},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchEncryptionConfiguration"===e.code){var r={EncryptionConfiguration:{Rules:[]},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var i=o.makeArray(n.EncryptionConfiguration&&n.EncryptionConfiguration.Rule||[]);n.EncryptionConfiguration={Rules:i},t(e,n)}}))},deleteBucketEncryption:function(e,t){d.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"encryption"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getObject:function(e,t){var n=e.Query||{},r=e.QueryString||"",i=o.throttleOnProgress.call(this,0,e.onProgress),a=e.tracker;a&&a.setParams({signStartTime:(new Date).getTime()}),n["response-content-type"]=e.ResponseContentType,n["response-content-language"]=e.ResponseContentLanguage,n["response-expires"]=e.ResponseExpires,n["response-cache-control"]=e.ResponseCacheControl,n["response-content-disposition"]=e.ResponseContentDisposition,n["response-content-encoding"]=e.ResponseContentEncoding,d.call(this,{Action:"name/cos:GetObject",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,DataType:e.DataType,headers:e.Headers,qs:n,qsStr:r,rawBody:!0,onDownloadProgress:i,tracker:a},(function(n,r){if(i(null,!0),n){var a=n.statusCode;return e.Headers["If-Modified-Since"]&&a&&304===a?t(null,{NotModified:!0}):t(n)}t(null,{Body:r.body,ETag:o.attr(r.headers,"etag",""),statusCode:r.statusCode,headers:r.headers})}))},headObject:function(e,t){d.call(this,{Action:"name/cos:HeadObject",method:"HEAD",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers},(function(n,r){if(n){var i=n.statusCode;return e.Headers["If-Modified-Since"]&&i&&304===i?t(null,{NotModified:!0,statusCode:i}):t(n)}r.ETag=o.attr(r.headers,"etag",""),t(null,r)}))},listObjectVersions:function(e,t){var n={};n.prefix=e.Prefix||"",n.delimiter=e.Delimiter,n["key-marker"]=e.KeyMarker,n["version-id-marker"]=e.VersionIdMarker,n["max-keys"]=e.MaxKeys,n["encoding-type"]=e.EncodingType,d.call(this,{Action:"name/cos:GetBucketObjectVersions",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,action:"versions"},(function(e,n){if(e)return t(e);var r=n.ListVersionsResult||{},i=r.DeleteMarker||[];i=o.isArray(i)?i:[i];var a=r.Version||[];a=o.isArray(a)?a:[a];var s=o.clone(r);delete s.DeleteMarker,delete s.Version,o.extend(s,{DeleteMarkers:i,Versions:a,statusCode:n.statusCode,headers:n.headers}),t(null,s)}))},putObject:function(e,t){var n=this,r=e.ContentLength,i=o.throttleOnProgress.call(n,r,e.onProgress),a=e.Headers;a["Cache-Control"]||a["cache-control"]||(a["Cache-Control"]=""),a["Content-Type"]||a["content-type"]||(a["Content-Type"]=e.Body&&e.Body.type||"");var c=e.UploadAddMetaMd5||n.options.UploadAddMetaMd5||n.options.UploadCheckContentMd5,u=e.tracker;c&&u&&u.setParams({md5StartTime:(new Date).getTime()}),o.getBodyMd5(c,e.Body,(function(c){c&&(u&&u.setParams({md5EndTime:(new Date).getTime()}),n.options.UploadCheckContentMd5&&(a["Content-MD5"]=o.binaryBase64(c)),(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5)&&(a["x-cos-meta-md5"]=c)),void 0!==e.ContentLength&&(a["Content-Length"]=e.ContentLength),i(null,!0),d.call(n,{Action:"name/cos:PutObject",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,qs:e.Query,body:e.Body,onProgress:i,tracker:u},(function(a,c){if(a)return i(null,!0),t(a);i({loaded:r,total:r},!0);var u=s({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:n.options.UseAccelerate?"accelerate":e.Region,object:e.Key});u=u.substr(u.indexOf("://")+3),c.Location=u,c.ETag=o.attr(c.headers,"etag",""),t(null,c)}))}),e.onHashProgress)},deleteObject:function(e,t){d.call(this,{Action:"name/cos:DeleteObject",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,VersionId:e.VersionId,action:e.Recursive?"recursive":""},(function(e,n){if(e){var r=e.statusCode;return r&&404===r?t(null,{BucketNotFound:!0,statusCode:r}):t(e)}t(null,{statusCode:n.statusCode,headers:n.headers})}))},getObjectAcl:function(e,t){d.call(this,{Action:"name/cos:GetObjectACL",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"acl"},(function(e,n){if(e)return t(e);var r=n.AccessControlPolicy||{},a=r.Owner||{},s=r.AccessControlList&&r.AccessControlList.Grant||[];s=o.isArray(s)?s:[s];var c=i(r);delete c.GrantWrite,n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=o.extend(c,{Owner:a,Grants:s,statusCode:n.statusCode,headers:n.headers}),t(null,c)}))},putObjectAcl:function(e,t){var n=e.Headers,r="";if(e.AccessControlPolicy){var i=o.clone(e.AccessControlPolicy||{}),s=i.Grants||i.Grant;s=o.isArray(s)?s:[s],delete i.Grant,delete i.Grants,i.AccessControlList={Grant:s},r=o.json2xml({AccessControlPolicy:i}),n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(r))}o.each(n,(function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=a(n[t]))})),d.call(this,{Action:"name/cos:PutObjectACL",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})}))},optionsObject:function(e,t){var n=e.Headers;n.Origin=e.Origin,n["Access-Control-Request-Method"]=e.AccessControlRequestMethod,n["Access-Control-Request-Headers"]=e.AccessControlRequestHeaders,d.call(this,{Action:"name/cos:OptionsObject",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})}))},putObjectCopy:function(e,t){var n=this,r=e.Headers;r["Cache-Control"]||r["cache-control"]||(r["Cache-Control"]="");var i=e.CopySource||"",a=o.getSourceParams.call(this,i);if(a){var c=a.Bucket,u=a.Region,l=decodeURIComponent(a.Key);d.call(this,{Scope:[{action:"name/cos:GetObject",bucket:c,region:u,prefix:l},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers},(function(r,i){if(r)return t(r);var a=o.clone(i.CopyObjectResult||{}),c=s({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,object:e.Key,isLocation:!0});o.extend(a,{Location:c,statusCode:i.statusCode,headers:i.headers}),t(null,a)}))}else t(o.error(new Error("CopySource format error")))},deleteMultipleObject:function(e,t){var n=e.Objects||[],r=e.Quiet;n=o.isArray(n)?n:[n];var i=o.json2xml({Delete:{Object:n,Quiet:r||!1}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(i));var s=o.map(n,(function(t){return{action:"name/cos:DeleteObject",bucket:e.Bucket,region:e.Region,prefix:t.Key}}));d.call(this,{Scope:s,method:"POST",Bucket:e.Bucket,Region:e.Region,body:i,action:"delete",headers:a},(function(e,n){if(e)return t(e);var r=n.DeleteResult||{},i=r.Deleted||[],a=r.Error||[];i=o.isArray(i)?i:[i],a=o.isArray(a)?a:[a];var s=o.clone(r);o.extend(s,{Error:a,Deleted:i,statusCode:n.statusCode,headers:n.headers}),t(null,s)}))},restoreObject:function(e,t){var n=e.Headers;if(e.RestoreRequest){var r=e.RestoreRequest||{},i=o.json2xml({RestoreRequest:r});n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(i)),d.call(this,{Action:"name/cos:RestoreObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,body:i,action:"restore",headers:n},t)}else t(o.error(new Error("missing param RestoreRequest")))},putObjectTagging:function(e,t){var n=e.Tagging||{},r=n.TagSet||n.Tags||e.Tags||[];r=o.clone(o.isArray(r)?r:[r]);var i=o.json2xml({Tagging:{TagSet:{Tag:r}}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(i)),d.call(this,{Action:"name/cos:PutObjectTagging",method:"PUT",Bucket:e.Bucket,Key:e.Key,Region:e.Region,body:i,action:"tagging",headers:a,VersionId:e.VersionId},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getObjectTagging:function(e,t){d.call(this,{Action:"name/cos:GetObjectTagging",method:"GET",Key:e.Key,Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging",VersionId:e.VersionId},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"NoSuchTagSet"!==e.error.Code)t(e);else{var r={Tags:[],statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else{var i=[];try{i=n.Tagging.TagSet.Tag||[]}catch(e){}i=o.clone(o.isArray(i)?i:[i]),t(null,{Tags:i,statusCode:n.statusCode,headers:n.headers})}}))},deleteObjectTagging:function(e,t){d.call(this,{Action:"name/cos:DeleteObjectTagging",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"tagging",VersionId:e.VersionId},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},selectObjectContent:function(e,t){if(!e.SelectType)return t(o.error(new Error("missing param SelectType")));var n=e.SelectRequest||{},r=o.json2xml({SelectRequest:n}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),d.call(this,{Action:"name/cos:GetObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"select",qs:{"select-type":e.SelectType},VersionId:e.VersionId,body:r,DataType:"arraybuffer",rawBody:!0},(function(e,n){if(e&&204===e.statusCode)return t(null,{statusCode:e.statusCode});if(e)return t(e);var r=o.parseSelectPayload(n.body);t(null,{statusCode:n.statusCode,headers:n.headers,Body:r.body,Payload:r.payload})}))},appendObject:function(e,t){var n=e.Headers;n["Cache-Control"]||n["cache-control"]||(n["Cache-Control"]=""),n["Content-Type"]||n["content-type"]||(n["Content-Type"]=e.Body&&e.Body.type||""),d.call(this,{Action:"name/cos:AppendObject",method:"POST",Bucket:e.Bucket,Region:e.Region,action:"append",Key:e.Key,body:e.Body,qs:{position:e.Position},headers:e.Headers},(function(e,n){if(e)return t(e);t(null,n)}))},uploadPartCopy:function(e,t){var n=e.CopySource||"",r=o.getSourceParams.call(this,n);if(r){var i=r.Bucket,a=r.Region,s=decodeURIComponent(r.Key);d.call(this,{Scope:[{action:"name/cos:GetObject",bucket:i,region:a,prefix:s},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers},(function(e,n){if(e)return t(e);var r=o.clone(n.CopyPartResult||{});o.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)}))}else t(o.error(new Error("CopySource format error")))},multipartInit:function(e,t){var n=this,r=e.Headers,i=e.tracker;r["Cache-Control"]||r["cache-control"]||(r["Cache-Control"]=""),r["Content-Type"]||r["content-type"]||(r["Content-Type"]=e.Body&&e.Body.type||"");var a=e.Body&&(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5);a&&i&&i.setParams({md5StartTime:(new Date).getTime()}),o.getBodyMd5(a,e.Body,(function(r){r&&(e.Headers["x-cos-meta-md5"]=r),a&&i&&i.setParams({md5EndTime:(new Date).getTime()}),d.call(n,{Action:"name/cos:InitiateMultipartUpload",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"uploads",headers:e.Headers,qs:e.Query,tracker:i},(function(e,n){return e?(i&&i.parent&&i.parent.setParams({errorNode:"multipartInit"}),t(e)):(n=o.clone(n||{}))&&n.InitiateMultipartUploadResult?t(null,o.extend(n.InitiateMultipartUploadResult,{statusCode:n.statusCode,headers:n.headers})):void t(null,n)}))}),e.onHashProgress)},multipartUpload:function(e,t){var n=this;o.getFileSize("multipartUpload",e,(function(){var r=e.tracker,i=n.options.UploadCheckContentMd5;i&&r&&r.setParams({md5StartTime:(new Date).getTime()}),o.getBodyMd5(i,e.Body,(function(a){a&&(e.Headers["Content-MD5"]=o.binaryBase64(a)),i&&r&&r.setParams({md5EndTime:(new Date).getTime()}),r&&r.setParams({partNumber:e.PartNumber}),d.call(n,{Action:"name/cos:UploadPart",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers,onProgress:e.onProgress,body:e.Body||null,tracker:r},(function(e,n){if(e)return r&&r.parent&&r.parent.setParams({errorNode:"multipartUpload"}),t(e);t(null,{ETag:o.attr(n.headers,"etag",""),statusCode:n.statusCode,headers:n.headers})}))}))}))},multipartComplete:function(e,t){for(var n=this,r=e.UploadId,i=e.Parts,a=e.tracker,c=0,u=i.length;c-1?function(e){var t=e.match(/q-url-param-list.*?(?=&)/g)[0],n="q-url-param-list="+encodeURIComponent(t.replace(/q-url-param-list=/,"")).toLowerCase(),r=new RegExp(t,"g");return e.replace(r,n)}(n.Authorization):"sign="+encodeURIComponent(n.Authorization)),n.SecurityToken&&(r+="&x-cos-security-token="+n.SecurityToken),n.ClientIP&&(r+="&clientIP="+n.ClientIP),n.ClientUA&&(r+="&clientUA="+n.ClientUA),n.Token&&(r+="&token="+n.Token),a&&(r+="&"+a),setTimeout((function(){t(null,{Url:r})}))}}));return p?(l+="?"+p.Authorization+(p.SecurityToken?"&x-cos-security-token="+p.SecurityToken:""),a&&(l+="&"+a)):a&&(l+="?"+a),l},getAuth:function(e){return o.getAuth({SecretId:e.SecretId||this.options.SecretId||"",SecretKey:e.SecretKey||this.options.SecretKey||"",Bucket:e.Bucket,Region:e.Region,Method:e.Method,Key:e.Key,Query:e.Query,Headers:e.Headers,Expires:e.Expires,UseRawKey:this.options.UseRawKey,SystemClockOffset:this.options.SystemClockOffset})}};e.exports.init=function(e,t){t.transferToTaskMethod(f,"putObject"),o.each(f,(function(t,n){e.prototype[n]=o.apiWrapper(n,t),function(e,t,n){o.each(["Cors","Acl"],(function(r){if(e.slice(-r.length)===r){var i=e.slice(0,-r.length)+r.toUpperCase(),a=o.apiWrapper(e,t);n[i]=function(){a.apply(this,arguments)}}}))}(n,t,e.prototype)}))}},function(e,t,n){var r=n(0),o=function(e){switch(r(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},i=function(e,t,n){var r={};return t.getAllResponseHeaders().trim().split("\n").forEach((function(e){if(e){var t=e.indexOf(":"),n=e.substr(0,t).trim().toLowerCase(),o=e.substr(t+1).trim();r[n]=o}})),{error:e,statusCode:t.status,statusMessage:t.statusText,headers:r,body:n}},a=function(e,t){return t||"text"!==t?e.response:e.responseText};e.exports=function(e,t){var n,s,c,u,l=(e.method||"GET").toUpperCase(),d=e.url;if(e.qs){var p=(n=e.qs,s=s||"&",c=c||"=",null===n&&(n=void 0),"object"===r(n)?Object.keys(n).map((function(e){var t=encodeURIComponent(o(e))+c;return Array.isArray(n[e])?n[e].map((function(e){return t+encodeURIComponent(o(e))})).join(s):t+encodeURIComponent(o(n[e]))})).filter(Boolean).join(s):u?encodeURIComponent(o(u))+c+encodeURIComponent(o(n)):"");p&&(d+=(-1===d.indexOf("?")?"?":"&")+p)}var f=new XMLHttpRequest;if(f.open(l,d,!0),f.responseType=e.dataType||"text",e.xhrFields)for(var h in e.xhrFields)f[h]=e.xhrFields[h];var m=e.headers;if(m)for(var g in m)m.hasOwnProperty(g)&&"content-length"!==g.toLowerCase()&&"user-agent"!==g.toLowerCase()&&"origin"!==g.toLowerCase()&&"host"!==g.toLowerCase()&&f.setRequestHeader(g,m[g]);return e.onProgress&&f.upload&&(f.upload.onprogress=e.onProgress),e.onDownloadProgress&&(f.onprogress=e.onDownloadProgress),e.timeout&&(f.timeout=e.timeout),f.ontimeout=function(e){var n=new Error("timeout");t(i(n,f))},f.onload=function(){t(i(null,f,a(f,e.dataType)))},f.onerror=function(n){var r=a(f,e.dataType);if(r)t(i(null,f,r));else{var o=f.statusText;o||0!==f.status||(o=new Error("CORS blocked or network error")),t(i(o,f,r))}},f.send(e.body||""),f}},function(e,t,n){var r=n(0),o=n(10),i=n(29),a=n(9).EventProxy,s=n(1),c=n(7);function u(e,t){var n=e.TaskId,r=e.Bucket,c=e.Region,u=e.Key,p=e.StorageClass,f=this,h={},m=e.FileSize,g=e.SliceSize,y=Math.ceil(m/g),v=0,C=s.throttleOnProgress.call(f,m,e.onHashProgress),k=function(t,n){var r=t.length;if(0===r)return n(null,!0);if(r>y)return n(null,!1);if(r>1&&Math.max(t[0].Size,t[1].Size)!==g)return n(null,!1);!function o(i){if(i=a.length)S.emit("has_and_check_upload_id",t);else{var p=a[l];if(!s.isInArray(t,p))return o.removeUploadId.call(f,p),void i(l+1);o.using[p]?i(l+1):d.call(f,{Bucket:r,Region:c,Key:u,UploadId:p,tracker:e.tracker},(function(e,t){f._isRunningTask(n)&&(e?(o.removeUploadId.call(f,p),i(l+1)):S.emit("upload_id_available",{UploadId:p,PartList:t.PartList}))}))}}(0)}else S.emit("has_and_check_upload_id",t)})),S.on("get_remote_upload_id_list",(function(){l.call(f,{Bucket:r,Region:c,Key:u,tracker:e.tracker},(function(t,i){if(f._isRunningTask(n)){if(t)return S.emit("error",t);var a=s.filter(i.UploadList,(function(e){return e.Key===u&&(!p||e.StorageClass.toUpperCase()===p.toUpperCase())})).reverse().map((function(e){return e.UploadId||e.UploadID}));if(a.length)S.emit("seek_local_avail_upload_id",a);else{var c,l=o.getFileId(e.Body,e.ChunkSize,r,u);l&&(c=o.getUploadIdList.call(f,l))&&s.each(c,(function(e){o.removeUploadId.call(f,e)})),S.emit("no_available_upload_id")}}}))})),S.emit("get_remote_upload_id_list")}function l(e,t){var n=this,r=[],o={Bucket:e.Bucket,Region:e.Region,Prefix:e.Key,calledBySdk:e.calledBySdk||"sliceUploadFile",tracker:e.tracker};!function e(){n.multipartList(o,(function(n,i){if(n)return t(n);r.push.apply(r,i.Upload||[]),"true"===i.IsTruncated?(o.KeyMarker=i.NextKeyMarker,o.UploadIdMarker=i.NextUploadIdMarker,e()):t(null,{UploadList:r})}))}()}function d(e,t){var n=this,r=[],o={Bucket:e.Bucket,Region:e.Region,Key:e.Key,UploadId:e.UploadId,calledBySdk:"sliceUploadFile",tracker:e.tracker};!function e(){n.multipartListPart(o,(function(n,i){if(n)return t(n);r.push.apply(r,i.Part||[]),"true"===i.IsTruncated?(o.PartNumberMarker=i.NextPartNumberMarker,e()):t(null,{PartList:r})}))}()}function p(e,t){var n=this,r=e.TaskId,o=e.Bucket,a=e.Region,c=e.Key,u=e.UploadData,l=e.FileSize,d=e.SliceSize,p=Math.min(e.AsyncLimit||n.options.ChunkParallelLimit||1,256),h=e.Body,m=Math.ceil(l/d),g=0,y=e.ServerSideEncryption,v=e.Headers,C=s.filter(u.PartList,(function(e){return e.Uploaded&&(g+=e.PartNumber>=m&&l%d||d),!e.Uploaded})),k=e.onProgress;i.eachLimit(C,p,(function(t,i){if(n._isRunningTask(r)){var s=t.PartNumber,p=Math.min(l,t.PartNumber*d)-(t.PartNumber-1)*d,m=0;f.call(n,{TaskId:r,Bucket:o,Region:a,Key:c,SliceSize:d,FileSize:l,PartNumber:s,ServerSideEncryption:y,Body:h,UploadData:u,Headers:v,onProgress:function(e){g+=e.loaded-m,m=e.loaded,k({loaded:g,total:l})},tracker:e.tracker},(function(e,o){n._isRunningTask(r)&&(e||o.ETag||(e='get ETag error, please add "ETag" to CORS ExposeHeader setting.( 获取ETag失败,请在CORS ExposeHeader设置中添加ETag,请参考文档:https://cloud.tencent.com/document/product/436/13318 )'),e?g-=m:(g+=p-m,t.ETag=o.ETag),k({loaded:g,total:l}),i(e||null,o))}))}}),(function(e){if(n._isRunningTask(r))return e?t(e):void t(null,{UploadId:u.UploadId,SliceList:u.PartList})}))}function f(e,t){var n=this,r=e.TaskId,o=e.Bucket,a=e.Region,c=e.Key,u=e.FileSize,l=e.Body,d=1*e.PartNumber,p=e.SliceSize,f=e.ServerSideEncryption,h=e.UploadData,m=e.Headers||{},g=n.options.ChunkRetryTimes+1,y=p*(d-1),v=p,C=y+p;C>u&&(v=(C=u)-y);var k=["x-cos-traffic-limit","x-cos-mime-limit"],S={};s.each(m,(function(e,t){k.indexOf(t)>-1&&(S[t]=e)}));var b=h.PartList[d-1];i.retry(g,(function(t){n._isRunningTask(r)&&s.fileSlice(l,y,C,!0,(function(i){n.multipartUpload({TaskId:r,Bucket:o,Region:a,Key:c,ContentLength:v,PartNumber:d,UploadId:h.UploadId,ServerSideEncryption:f,Body:i,Headers:S,onProgress:e.onProgress,calledBySdk:"sliceUploadFile",tracker:e.tracker},(function(e,o){if(n._isRunningTask(r))return e?t(e):(b.Uploaded=!0,t(null,o))}))}))}),(function(e,o){if(n._isRunningTask(r))return t(e,o)}))}function h(e,t){var n=e.Bucket,r=e.Region,o=e.Key,a=e.UploadId,s=e.SliceList,c=this,u=this.options.ChunkRetryTimes+1,l=e.Headers,d=s.map((function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}}));i.retry(u,(function(t){c.multipartComplete({Bucket:n,Region:r,Key:o,UploadId:a,Parts:d,Headers:l,calledBySdk:"sliceUploadFile",tracker:e.tracker},t)}),(function(e,n){t(e,n)}))}function m(e,t){var n=e.Bucket,r=e.Region,o=e.Key,a=e.AbortArray,s=e.AsyncLimit||1,c=this,u=0,l=new Array(a.length);i.eachLimit(a,s,(function(t,i){var a=u;if(o&&o!==t.Key)return l[a]={error:{KeyNotMatch:!0}},void i(null);var s=t.UploadId||t.UploadID;c.multipartAbort({Bucket:n,Region:r,Key:t.Key,Headers:e.Headers,UploadId:s},(function(e){var o={Bucket:n,Region:r,Key:t.Key,UploadId:s};l[a]={error:e,task:o},i(null)})),u++}),(function(e){if(e)return t(e);for(var n=[],r=[],o=0,i=l.length;oo?"sliceUploadFile":"putObject",h=e.onFileFinish;i.push({api:f,params:e,callback:function(n,r){e.tracker&&e.tracker.formatResult(n,r),h&&h(n,r,l),t&&t(n,r)}}),n._addTasks(i)},uploadFiles:function(e,t){var n=this,o=void 0===e.SliceSize?n.options.SliceSize:e.SliceSize,i=0,a=0,u=s.throttleOnProgress.call(n,a,e.onProgress),l=e.files.length,d=e.onFileFinish,p=Array(l),f=function(e,n,r){u(null,!0),d&&d(e,n,r),p[r.Index]={options:r,error:e,data:n},--l<=0&&t&&t(null,{files:p})},h=[];s.each(e.files,(function(e,t){!function(){var l=e.Body,d=l.size||l.length||0,p={Index:t,TaskId:""};if(i+=d,n.options.EnableTracker){var m=n.options.UseAccelerate||"string"==typeof n.options.Domain&&n.options.Domain.includes("accelerate.");e.tracker=new c({bucket:e.Bucket,region:e.Region,apiName:"uploadFiles",fileKey:e.Key,fileSize:d,accelerate:m,deepTracker:n.options.DeepTracker,customId:n.options.CustomId,delay:n.options.TrackerDelay})}s.each(e,(function(e,t){"object"!==r(e)&&"function"!=typeof e&&(p[t]=e)}));var g=e.onTaskReady;e.onTaskReady=function(e){p.TaskId=e,g&&g(e)};var y=0,v=e.onProgress;e.onProgress=function(e){a=a-y+e.loaded,y=e.loaded,v&&v(e),u({loaded:a,total:i})};var C=d>o?"sliceUploadFile":"putObject",k=e.onFileFinish;h.push({api:C,params:e,callback:function(t,n){e.tracker&&e.tracker.formatResult(t,n),k&&k(t,n),f&&f(t,n,p)}})}()})),n._addTasks(h)},sliceCopyFile:function(e,t){var n=new a,r=this,c=e.Bucket,u=e.Region,l=e.Key,p=e.CopySource,f=s.getSourceParams.call(this,p);if(f){var h=f.Bucket,m=f.Region,y=decodeURIComponent(f.Key),v=void 0===e.CopySliceSize?r.options.CopySliceSize:e.CopySliceSize;v=Math.max(0,v);var C,k,S=e.CopyChunkSize||this.options.CopyChunkSize,b=this.options.CopyChunkParallelLimit,w=this.options.ChunkRetryTimes+1,T=0,R=0,E={},x={},A={};n.on("copy_slice_complete",(function(n){var a={};s.each(e.Headers,(function(e,t){0===t.toLowerCase().indexOf("x-cos-meta-")&&(a[t]=e)}));var d=s.map(n.PartList,(function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}}));i.retry(w,(function(e){r.multipartComplete({Bucket:c,Region:u,Key:l,UploadId:n.UploadId,Parts:d,calledBySdk:"sliceCopyFile"},e)}),(function(e,r){if(o.removeUsing(n.UploadId),e)return k(null,!0),t(e);o.removeUploadId(n.UploadId),k({loaded:C,total:C},!0),t(null,r)}))})),n.on("get_copy_data_finish",(function(e){var a=o.getCopyFileId(p,E,S,c,l);a&&o.saveUploadId(a,e.UploadId,r.options.UploadIdCacheLimit),o.setUsing(e.UploadId);var d=s.filter(e.PartList,(function(e){return e.Uploaded&&(R+=e.PartNumber>=T&&C%S||S),!e.Uploaded}));i.eachLimit(d,b,(function(t,n){var o=t.PartNumber,a=t.CopySourceRange,s=t.end-t.start;i.retry(w,(function(t){g.call(r,{Bucket:c,Region:u,Key:l,CopySource:p,UploadId:e.UploadId,PartNumber:o,CopySourceRange:a},t)}),(function(e,r){if(e)return n(e);k({loaded:R+=s,total:C}),t.ETag=r.ETag,n(e||null,r)}))}),(function(r){if(r)return o.removeUsing(e.UploadId),k(null,!0),t(r);n.emit("copy_slice_complete",e)}))})),n.on("get_chunk_size_finish",(function(){var i=function(){r.multipartInit({Bucket:c,Region:u,Key:l,Headers:A},(function(r,o){if(r)return t(r);e.UploadId=o.UploadId,n.emit("get_copy_data_finish",{UploadId:e.UploadId,PartList:e.PartList})}))},a=o.getCopyFileId(p,E,S,c,l),f=o.getUploadIdList(a);if(!a||!f)return i();!function t(a){if(a>=f.length)return i();var p=f[a];if(o.using[p])return t(a+1);d.call(r,{Bucket:c,Region:u,Key:l,UploadId:p},(function(r,i){if(r)o.removeUploadId(p),t(a+1);else{if(o.using[p])return t(a+1);var c={},u=0;s.each(i.PartList,(function(e){var t=parseInt(e.Size),n=u+t-1;c[e.PartNumber+"|"+u+"|"+n]=e.ETag,u+=t})),s.each(e.PartList,(function(e){var t=c[e.PartNumber+"|"+e.start+"|"+e.end];t&&(e.ETag=t,e.Uploaded=!0)})),n.emit("get_copy_data_finish",{UploadId:p,PartList:e.PartList})}}))}(0)})),n.on("get_file_size_finish",(function(){if(function(){for(var t=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],n=1048576,o=0;on.length&&(x[t]=e)})),n.emit("get_file_size_finish")}else t(s.error(new Error('get Content-Length error, please add "Content-Length" to CORS ExposeHeader setting.( 获取Content-Length失败,请在CORS ExposeHeader设置中添加Content-Length,请参考文档:https://cloud.tencent.com/document/product/436/13318 )')))}))}else t(s.error(new Error("CopySource format error")))}};e.exports.init=function(e,t){t.transferToTaskMethod(y,"sliceUploadFile"),s.each(y,(function(t,n){e.prototype[n]=s.apiWrapper(n,t)}))}},function(e,t){var n={eachLimit: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())}))}()},retry:function(e,t,n){e<1?n():function r(o){t((function(t,i){t&&o -1) { @@ -3578,7 +3582,8 @@ function _submitRequest(params, callback) { object: object, }); if (params.action) { - url = url + '?' + params.action; + // 已知问题,某些版本的qq会对url自动拼接(比如/upload被拼接成/upload=(null))导致签名错误,这里做下兼容。 + url = url + '?' + (util.isIOS_QQ ? `${params.action}=` : params.action); } if (params.qsStr) { if(url.indexOf('?') > -1){ diff --git a/src/tracker.js b/src/tracker.js index b713bdc..dd28e55 100644 --- a/src/tracker.js +++ b/src/tracker.js @@ -1,10 +1,11 @@ const pkg = require('../package.json'); -const BeaconAction = require('../lib/beacon.min'); let beacon = null; const getBeacon = (delay) => { if (!beacon) { + // 不放在顶层是避免首次引入就被加载,从而避免在某些环境比如webworker里加载灯塔sdk内window相关对象报错 + const BeaconAction = require('../lib/beacon.min'); beacon = new BeaconAction({ appkey: "0AND0VEVB24UBGDU", versionCode: pkg.version, diff --git a/src/util.js b/src/util.js index 8ad9433..e4fbaab 100644 --- a/src/util.js +++ b/src/util.js @@ -205,9 +205,9 @@ var parseSelectPayload = function (chunk) { var getSourceParams = function (source) { var parser = this.options.CopySourceParser; if (parser) return parser(source); - var m = source.match(/^([^.]+-\d+)\.cos(v6|-cdc)?\.([^.]+)\.myqcloud\.com\/(.+)$/); + var m = source.match(/^([^.]+-\d+)\.cos(v6|-cdc|-internal)?\.([^.]+)\.((myqcloud\.com)|(tencentcos\.cn))\/(.+)$/); if (!m) return null; - return { Bucket: m[1], Region: m[3], Key: m[4] }; + return { Bucket: m[1], Region: m[3], Key: m[7] }; }; var noop = function () { @@ -631,7 +631,7 @@ var apiWrapper = function (apiName, apiFn) { }; var errMsg = checkParams(); - var isSync = apiName === 'getAuth' || apiName === 'getObjectUrl'; + var isSync = apiName === 'getAuth'; if (typeof Promise === 'function' && !isSync && !callback) { return new Promise(function (resolve, reject) { callback = function (err, data) { @@ -750,12 +750,28 @@ var isNode = function () { return typeof window !== 'object' && typeof process === 'object' && typeof require === 'function' && !isWebWorker(); } - - var isCIHost = function(url) { return /^https?:\/\/([^/]+\.)?ci\.[^/]+/.test(url); } +//判断是否是ios +var isIOS = (function(){ + if (typeof navigator !== 'object') { + return false; + } + var u = navigator.userAgent; + var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 + return isIOS; +})(); + +// 判断是qq内置浏览器 +var isQQ = (function () { + if (typeof navigator !== 'object') { + return false; + } + return /\sQQ/i.test(navigator.userAgent) +})(); + var util = { noop: noop, formatParams: formatParams, @@ -790,6 +806,7 @@ var util = { isBrowser: true, isNode: isNode, isCIHost: isCIHost, + isIOS_QQ: isIOS && isQQ, }; module.exports = util; \ No newline at end of file