me?me=s:ie(Math.max(ge,me)+1)}}function ue(B,P){return P.lineNumber=B.lineNumber,P.columnNumber=B.columnNumber,P}function R(B,P,K,z,$,ne){function ce(Y,te,pe){K.attributeNames.hasOwnProperty(Y)&&ne.fatalError("Attribute "+Y+" redefined"),K.addValue(Y,te.replace(/[\t\n\r]/g," ").replace(/?\w+;/g,$),pe)}for(var ie,ee,le=++P,se=_;;){var ye=B.charAt(le);switch(ye){case"=":if(se===N)ie=B.slice(P,le),se=T;else if(se===O)se=T;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(se===T||se===N)if(se===N&&(ne.warning('attribute value must after "="'),ie=B.slice(P,le)),P=le+1,le=B.indexOf(ye,P),le>0)ee=B.slice(P,le),ce(ie,ee,P-1),se=X;else throw new Error("attribute value no end '"+ye+"' match");else if(se==H)ee=B.slice(P,le),ce(ie,ee,P),ne.warning('attribute "'+ie+'" missed start quot('+ye+")!!"),P=le+1,se=X;else throw new Error('attribute value must after "="');break;case"/":switch(se){case _:K.setTagName(B.slice(P,le));case X:case V:case U:se=U,K.closed=!0;case H:case N:break;case O:K.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return ne.error("unexpected end of input"),se==_&&K.setTagName(B.slice(P,le)),le;case">":switch(se){case _:K.setTagName(B.slice(P,le));case X:case V:case U:break;case H:case N:ee=B.slice(P,le),ee.slice(-1)==="/"&&(K.closed=!0,ee=ee.slice(0,-1));case O:se===O&&(ee=ie),se==H?(ne.warning('attribute "'+ee+'" missed quot(")!'),ce(ie,ee,P)):((!h.isHTML(z[""])||!ee.match(/^(?:disabled|checked|selected)$/i))&&ne.warning('attribute "'+ee+'" missed value!! "'+ee+'" instead!!'),ce(ee,ee,P));break;case T:throw new Error("attribute value missed!!")}return le;case"\x80":ye=" ";default:if(ye<=" ")switch(se){case _:K.setTagName(B.slice(P,le)),se=V;break;case N:ie=B.slice(P,le),se=O;break;case H:var ee=B.slice(P,le);ne.warning('attribute "'+ee+'" missed quot(")!!'),ce(ie,ee,P);case X:se=V;break}else switch(se){case O:K.tagName,(!h.isHTML(z[""])||!ie.match(/^(?:disabled|checked|selected)$/i))&&ne.warning('attribute "'+ie+'" missed value!! "'+ie+'" instead2!!'),ce(ie,ie,P),P=le,se=N;break;case X:ne.warning('attribute space is required"'+ie+'"!!');case V:se=N,P=le;break;case T:se=H,P=le;break;case U:throw new Error("elements closed character '/' and '>' must be connected to")}}le++}}function A(B,P,K){for(var z=B.tagName,$=null,ye=B.length;ye--;){var ne=B[ye],ce=ne.qName,ie=ne.value,Y=ce.indexOf(":");if(Y>0)var ee=ne.prefix=ce.slice(0,Y),le=ce.slice(Y+1),se=ee==="xmlns"&≤else le=ce,ee=null,se=ce==="xmlns"&&"";ne.localName=le,se!==!1&&($==null&&($={},p(K,K={})),K[se]=$[se]=ie,ne.uri=h.XMLNS,P.startPrefixMapping(se,ie))}for(var ye=B.length;ye--;){ne=B[ye];var ee=ne.prefix;ee&&(ee==="xml"&&(ne.uri=h.XML),ee!=="xmlns"&&(ne.uri=K[ee||""]))}var Y=z.indexOf(":");Y>0?(ee=B.prefix=z.slice(0,Y),le=B.localName=z.slice(Y+1)):(ee=null,le=B.localName=z);var te=B.uri=K[ee||""];if(P.startElement(te,le,z,B),B.closed){if(P.endElement(te,le,z),$)for(ee in $)Object.prototype.hasOwnProperty.call($,ee)&&P.endPrefixMapping(ee)}else return B.currentNSMap=K,B.localNSMap=$,!0}function v(B,P,K,z,$){if(/^(?:script|textarea)$/i.test(K)){var ne=B.indexOf(""+K+">",P),ce=B.substring(P+1,ne);if(/[&<]/.test(ce))return/^script$/i.test(K)?($.characters(ce,0,ce.length),ne):(ce=ce.replace(/?\w+;/g,z),$.characters(ce,0,ce.length),ne)}return P+1}function W(B,P,K,z){var $=z[K];return $==null&&($=B.lastIndexOf(""+K+">"),$",P+4);return ne>P?(K.comment(B,P+4,ne-P-4),ne+3):(z.error("Unclosed comment"),-1)}else return-1;default:if(B.substr(P+3,6)=="CDATA["){var ne=B.indexOf("]]>",P+9);return K.startCDATA(),K.characters(B,P+9,ne-P-9),K.endCDATA(),ne+3}var ce=L(B,P),ie=ce.length;if(ie>1&&/!doctype/i.test(ce[0][0])){var ee=ce[1][0],le=!1,se=!1;ie>3&&(/^public$/i.test(ce[2][0])?(le=ce[3][0],se=ie>4&&ce[4][0]):/^system$/i.test(ce[2][0])&&(se=ce[3][0]));var ye=ce[ie-1];return K.startDTD(ee,le,se),K.endDTD(),ye.index+ye[0].length}}return-1}function j(B,P,K){var z=B.indexOf("?>",P);if(z){var $=B.substring(P,z).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return $?($[0].length,K.processingInstruction($[1],$[2]),z+2):-1}return-1}function I(){this.attributeNames={}}I.prototype={setTagName:function(B){if(!S.test(B))throw new Error("invalid tagName:"+B);this.tagName=B},addValue:function(B,P,K){if(!S.test(B))throw new Error("invalid attribute:"+B);this.attributeNames[B]=this.length,this[this.length++]={qName:B,value:P,offset:K}},length:0,getLocalName:function(B){return this[B].localName},getLocator:function(B){return this[B].locator},getQName:function(B){return this[B].qName},getURI:function(B){return this[B].uri},getValue:function(B){return this[B].value}};function L(B,P){var K,z=[],$=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for($.lastIndex=P,$.exec(B);K=$.exec(B);)if(z.push(K),K[1])return z}m.XMLReader=re,m.ParseError=M},"./node_modules/process/browser.js":function(g,m){var u=g.exports={},h,x;function c(){throw new Error("setTimeout has not been defined")}function S(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?h=setTimeout:h=c}catch{h=c}try{typeof clearTimeout=="function"?x=clearTimeout:x=S}catch{x=S}})();function _(Q){if(h===setTimeout)return setTimeout(Q,0);if((h===c||!h)&&setTimeout)return h=setTimeout,setTimeout(Q,0);try{return h(Q,0)}catch{try{return h.call(null,Q,0)}catch{return h.call(this,Q,0)}}}function N(Q){if(x===clearTimeout)return clearTimeout(Q);if((x===S||!x)&&clearTimeout)return x=clearTimeout,clearTimeout(Q);try{return x(Q)}catch{try{return x.call(null,Q)}catch{return x.call(this,Q)}}}var O=[],T=!1,H,X=-1;function V(){!T||!H||(T=!1,H.length?O=H.concat(O):X=-1,O.length&&U())}function U(){if(!T){var Q=_(V);T=!0;for(var ue=O.length;ue;){for(H=O,O=[];++X1)for(var R=1;Rce)return pe(null,!1);if(me>1){var ge=Math.max(te[0].Size,te[1].Size);if(ge!==ne)return pe(null,!1)}var ve=function Ce(De){if(De=pe.length){ye.emit("has_and_check_upload_id",Y);return}var Ce=pe[ve];if(!_.isInArray(Y,Ce)){x.removeUploadId.call(K,Ce),ge(ve+1);return}if(x.using[Ce]){ge(ve+1);return}X.call(K,{Bucket:I,Region:L,Key:B,UploadId:Ce,tracker:p.tracker},function(De,be){!K._isRunningTask(j)||(De?(x.removeUploadId.call(K,Ce),ge(ve+1)):ye.emit("upload_id_available",{UploadId:Ce,PartList:be.PartList}))})};me(0)}),ye.on("get_remote_upload_id_list",function(){H.call(K,{Bucket:I,Region:L,Key:B,tracker:p.tracker},function(Y,te){if(!!K._isRunningTask(j)){if(Y)return ye.emit("error",Y);var pe=_.filter(te.UploadList,function(ve){return ve.Key===B&&(!P||ve.StorageClass.toUpperCase()===P.toUpperCase())}).reverse().map(function(ve){return ve.UploadId||ve.UploadID});if(pe.length)ye.emit("seek_local_avail_upload_id",pe);else{var me=x.getFileId(p.Body,p.ChunkSize,I,B),ge;me&&(ge=x.getUploadIdList.call(K,me))&&_.each(ge,function(ve){x.removeUploadId.call(K,ve)}),ye.emit("no_available_upload_id")}}})}),ye.emit("get_remote_upload_id_list")}function H(p,q){var j=this,I=[],L={Bucket:p.Bucket,Region:p.Region,Prefix:p.Key,calledBySdk:p.calledBySdk||"sliceUploadFile",tracker:p.tracker},B=function P(){j.multipartList(L,function(K,z){if(K)return q(K);I.push.apply(I,z.Upload||[]),z.IsTruncated==="true"?(L.KeyMarker=z.NextKeyMarker,L.UploadIdMarker=z.NextUploadIdMarker,P()):q(null,{UploadList:I})})};B()}function X(p,q){var j=this,I=[],L={Bucket:p.Bucket,Region:p.Region,Key:p.Key,UploadId:p.UploadId,calledBySdk:"sliceUploadFile",tracker:p.tracker},B=function P(){j.multipartListPart(L,function(K,z){if(K)return q(K);I.push.apply(I,z.Part||[]),z.IsTruncated==="true"?(L.PartNumberMarker=z.NextPartNumberMarker,P()):q(null,{PartList:I})})};B()}function V(p,q){var j=this,I=p.TaskId,L=p.Bucket,B=p.Region,P=p.Key,K=p.UploadData,z=p.FileSize,$=p.SliceSize,ne=Math.min(p.AsyncLimit||j.options.ChunkParallelLimit||1,256),ce=p.Body,ie=Math.ceil(z/$),ee=0,le=p.ServerSideEncryption,se=p.Headers,ye=_.filter(K.PartList,function(te){return te.Uploaded&&(ee+=te.PartNumber>=ie&&z%$||$),!te.Uploaded}),Y=p.onProgress;c.eachLimit(ye,ne,function(te,pe){if(!!j._isRunningTask(I)){var me=te.PartNumber,ge=Math.min(z,te.PartNumber*$)-(te.PartNumber-1)*$,ve=0;U.call(j,{TaskId:I,Bucket:L,Region:B,Key:P,SliceSize:$,FileSize:z,PartNumber:me,ServerSideEncryption:le,Body:ce,UploadData:K,Headers:se,onProgress:function(De){ee+=De.loaded-ve,ve=De.loaded,Y({loaded:ee,total:z})},tracker:p.tracker},function(Ce,De){!j._isRunningTask(I)||(!Ce&&!De.ETag&&(Ce='get ETag error, please add "ETag" to CORS ExposeHeader setting.( \u83B7\u53D6ETag\u5931\u8D25\uFF0C\u8BF7\u5728CORS ExposeHeader\u8BBE\u7F6E\u4E2D\u6DFB\u52A0ETag\uFF0C\u8BF7\u53C2\u8003\u6587\u6863\uFF1Ahttps://cloud.tencent.com/document/product/436/13318 )'),Ce?ee-=ve:(ee+=ge-ve,te.ETag=De.ETag),Y({loaded:ee,total:z}),pe(Ce||null,De))})}},function(te){if(!!j._isRunningTask(I)){if(te)return q(te);q(null,{UploadId:K.UploadId,SliceList:K.PartList})}})}function U(p,q){var j=this,I=p.TaskId,L=p.Bucket,B=p.Region,P=p.Key,K=p.FileSize,z=p.Body,$=p.PartNumber*1,ne=p.SliceSize,ce=p.ServerSideEncryption,ie=p.UploadData,ee=p.Headers||{},le=j.options.ChunkRetryTimes+1,se=ne*($-1),ye=ne,Y=se+ne;Y>K&&(Y=K,ye=Y-se);var te=["x-cos-traffic-limit","x-cos-mime-limit"],pe={};_.each(ee,function(ge,ve){te.indexOf(ve)>-1&&(pe[ve]=ge)});var me=ie.PartList[$-1];c.retry(le,function(ge){!j._isRunningTask(I)||_.fileSlice(z,se,Y,!0,function(ve){j.multipartUpload({TaskId:I,Bucket:L,Region:B,Key:P,ContentLength:ye,PartNumber:$,UploadId:ie.UploadId,ServerSideEncryption:ce,Body:ve,Headers:pe,onProgress:p.onProgress,calledBySdk:"sliceUploadFile",tracker:p.tracker},function(Ce,De){if(!!j._isRunningTask(I))return Ce?ge(Ce):(me.Uploaded=!0,ge(null,De))})})},function(ge,ve){if(!!j._isRunningTask(I))return q(ge,ve)})}function M(p,q){var j=p.Bucket,I=p.Region,L=p.Key,B=p.UploadId,P=p.SliceList,K=this,z=this.options.ChunkRetryTimes+1,$=p.Headers,ne=P.map(function(ce){return{PartNumber:ce.PartNumber,ETag:ce.ETag}});c.retry(z,function(ce){K.multipartComplete({Bucket:j,Region:I,Key:L,UploadId:B,Parts:ne,Headers:$,calledBySdk:"sliceUploadFile",tracker:p.tracker},ce)},function(ce,ie){q(ce,ie)})}function re(p,q){var j=p.Bucket,I=p.Region,L=p.Key,B=p.UploadId,P=p.Level||"task",K=p.AsyncLimit,z=this,$=new S;if($.on("error",function(ne){return q(ne)}),$.on("get_abort_array",function(ne){Q.call(z,{Bucket:j,Region:I,Key:L,Headers:p.Headers,AsyncLimit:K,AbortArray:ne},q)}),P==="bucket")H.call(z,{Bucket:j,Region:I,calledBySdk:"abortUploadTask"},function(ne,ce){if(ne)return q(ne);$.emit("get_abort_array",ce.UploadList||[])});else if(P==="file"){if(!L)return q(_.error(new Error("abort_upload_task_no_key")));H.call(z,{Bucket:j,Region:I,Key:L,calledBySdk:"abortUploadTask"},function(ne,ce){if(ne)return q(ne);$.emit("get_abort_array",ce.UploadList||[])})}else if(P==="task"){if(!B)return q(_.error(new Error("abort_upload_task_no_id")));if(!L)return q(_.error(new Error("abort_upload_task_no_key")));$.emit("get_abort_array",[{Key:L,UploadId:B}])}else return q(_.error(new Error("abort_unknown_level")))}function Q(p,q){var j=p.Bucket,I=p.Region,L=p.Key,B=p.AbortArray,P=p.AsyncLimit||1,K=this,z=0,$=new Array(B.length);c.eachLimit(B,P,function(ne,ce){var ie=z;if(L&&L!==ne.Key){$[ie]={error:{KeyNotMatch:!0}},ce(null);return}var ee=ne.UploadId||ne.UploadID;K.multipartAbort({Bucket:j,Region:I,Key:ne.Key,Headers:p.Headers,UploadId:ee},function(le){var se={Bucket:j,Region:I,Key:ne.Key,UploadId:ee};$[ie]={error:le,task:se},ce(null)}),z++},function(ne){if(ne)return q(ne);for(var ce=[],ie=[],ee=0,le=$.length;eeI?"sliceUploadFile":"putObject",ie=p.onFileFinish,ee=function(se,ye){p.tracker&&p.tracker.formatResult(se,ye),ie&&ie(se,ye,K),q&&q(se,ye)};L.push({api:ce,params:p,callback:ee}),j._addTasks(L)}function R(p,q){var j=this,I=p.SliceSize===void 0?j.options.SliceSize:p.SliceSize,L=0,B=0,P=_.throttleOnProgress.call(j,B,p.onProgress),K=p.files.length,z=p.onFileFinish,$=Array(K),ne=function(ee,le,se){P(null,!0),z&&z(ee,le,se),$[se.Index]={options:se,error:ee,data:le},--K<=0&&q&&q(null,{files:$})},ce=[];_.each(p.files,function(ie,ee){(function(){var le=ie.Body,se=le.size||le.length||0,ye={Index:ee,TaskId:""};if(!j.options.UseRawKey&&ie.Key&&ie.Key.substr(0,1)==="/"&&(ie.Key=ie.Key.substr(1)),L+=se,j.options.EnableTracker){var Y=j.options.UseAccelerate||typeof j.options.Domain=="string"&&j.options.Domain.includes("accelerate.");ie.tracker=new N({bucket:ie.Bucket,region:ie.Region,apiName:"uploadFiles",fileKey:ie.Key,fileSize:se,accelerate:Y,deepTracker:j.options.DeepTracker,customId:j.options.CustomId,delay:j.options.TrackerDelay})}_.each(ie,function(Te,ke){h(Te)!=="object"&&typeof Te!="function"&&(ye[ke]=Te)});var te=ie.onTaskReady,pe=function(ke){ye.TaskId=ke,te&&te(ke)};ie.onTaskReady=pe;var me=0,ge=ie.onProgress,ve=function(ke){B=B-me+ke.loaded,me=ke.loaded,ge&&ge(ke),P({loaded:B,total:L})};ie.onProgress=ve;var Ce=se>I?"sliceUploadFile":"putObject",De=ie.onFileFinish,be=function(ke,Fe){ie.tracker&&ie.tracker.formatResult(ke,Fe),De&&De(ke,Fe),ne&&ne(ke,Fe,ye)};ce.push({api:Ce,params:ie,callback:be})})()}),j._addTasks(ce)}function A(p,q){var j=new S,I=this,L=p.Bucket,B=p.Region,P=p.Key,K=p.CopySource,z=_.getSourceParams.call(this,K);if(!z){q(_.error(new Error("CopySource format error")));return}var $=z.Bucket,ne=z.Region,ce=decodeURIComponent(z.Key),ie=p.CopySliceSize===void 0?I.options.CopySliceSize:p.CopySliceSize;ie=Math.max(0,ie);var ee=p.CopyChunkSize||this.options.CopyChunkSize,le=this.options.CopyChunkParallelLimit,se=this.options.ChunkRetryTimes+1,ye=0,Y=0,te,pe,me={},ge={},ve={};j.on("copy_slice_complete",function(Ce){_.each(p.Headers,function(be,Te){Te.toLowerCase().indexOf("x-cos-meta-")});var De=_.map(Ce.PartList,function(be){return{PartNumber:be.PartNumber,ETag:be.ETag}});c.retry(se,function(be){I.multipartComplete({Bucket:L,Region:B,Key:P,UploadId:Ce.UploadId,Parts:De,calledBySdk:"sliceCopyFile"},be)},function(be,Te){if(x.removeUsing(Ce.UploadId),be)return pe(null,!0),q(be);x.removeUploadId(Ce.UploadId),pe({loaded:te,total:te},!0),q(null,Te)})}),j.on("get_copy_data_finish",function(Ce){var De=x.getCopyFileId(K,me,ee,L,P);De&&x.saveUploadId(De,Ce.UploadId,I.options.UploadIdCacheLimit),x.setUsing(Ce.UploadId);var be=_.filter(Ce.PartList,function(Te){return Te.Uploaded&&(Y+=Te.PartNumber>=ye&&te%ee||ee),!Te.Uploaded});c.eachLimit(be,le,function(Te,ke){var Fe=Te.PartNumber,Me=Te.CopySourceRange,Pe=Te.end-Te.start;c.retry(se,function(oe){v.call(I,{Bucket:L,Region:B,Key:P,CopySource:K,UploadId:Ce.UploadId,PartNumber:Fe,CopySourceRange:Me},oe)},function(oe,s){if(oe)return ke(oe);Y+=Pe,pe({loaded:Y,total:te}),Te.ETag=s.ETag,ke(oe||null,s)})},function(Te){if(Te)return x.removeUsing(Ce.UploadId),pe(null,!0),q(Te);j.emit("copy_slice_complete",Ce)})}),j.on("get_chunk_size_finish",function(){var Ce=function(){I.multipartInit({Bucket:L,Region:B,Key:P,Headers:ve},function(Fe,Me){if(Fe)return q(Fe);p.UploadId=Me.UploadId,j.emit("get_copy_data_finish",{UploadId:p.UploadId,PartList:p.PartList})})},De=x.getCopyFileId(K,me,ee,L,P),be=x.getUploadIdList(De);if(!De||!be)return Ce();var Te=function ke(Fe){if(Fe>=be.length)return Ce();var Me=be[Fe];if(x.using[Me])return ke(Fe+1);X.call(I,{Bucket:L,Region:B,Key:P,UploadId:Me},function(Pe,oe){if(Pe)x.removeUploadId(Me),ke(Fe+1);else{if(x.using[Me])return ke(Fe+1);var s={},n=0;_.each(oe.PartList,function(r){var o=parseInt(r.Size),f=n+o-1;s[r.PartNumber+"|"+n+"|"+f]=r.ETag,n+=o}),_.each(p.PartList,function(r){var o=s[r.PartNumber+"|"+r.start+"|"+r.end];o&&(r.ETag=o,r.Uploaded=!0)}),j.emit("get_copy_data_finish",{UploadId:Me,PartList:p.PartList})}})};Te(0)}),j.on("get_file_size_finish",function(){if(function(){for(var De=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],be=1024*1024,Te=0;TeFe.length&&(ge[ke]=Te)}),j.emit("get_file_size_finish")}})}function v(p,q){var j=p.TaskId,I=p.Bucket,L=p.Region,B=p.Key,P=p.CopySource,K=p.UploadId,z=p.PartNumber*1,$=p.CopySourceRange,ne=this.options.ChunkRetryTimes+1,ce=this;c.retry(ne,function(ie){ce.uploadPartCopy({TaskId:j,Bucket:I,Region:L,Key:B,CopySource:P,UploadId:K,PartNumber:z,CopySourceRange:$},function(ee,le){ie(ee||null,le)})},function(ie,ee){return q(ie,ee)})}var W={sliceUploadFile:O,abortUploadTask:re,uploadFile:ue,uploadFiles:R,sliceCopyFile:A};g.exports.init=function(p,q){q.transferToTaskMethod(W,"sliceUploadFile"),_.each(W,function(j,I){p.prototype[I]=_.apiWrapper(I,j)})}},"./src/async.js":function(g,m){var u=function(S,_,N,O){if(O=O||function(){},!S.length||_<=0)return O();var T=0,H=0,X=0;(function V(){if(T>=S.length)return O();for(;X<_&&H=S.length?O():V())})})()},h=function(S,_,N){var O=function T(H){_(function(X,V){X&&H/gi,"<$1Rule>"),a=a.replace(/<(\/?)Tags>/gi,"<$1Tag>");var C=e.Headers;C["Content-Type"]="application/xml",C["Content-MD5"]=c.b64(c.md5(a)),ae.call(this,{Action:"name/cos:PutBucketReplication",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:a,action:"replication",headers:C},function(y,D){if(y&&y.statusCode===204)return d(null,{statusCode:y.statusCode});if(y)return d(y);d(null,{statusCode:D.statusCode,headers:D.headers})})}function P(e,d){ae.call(this,{Action:"name/cos:GetBucketReplication",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},function(t,a){if(t){if(t.statusCode===404&&t.error&&(t.error==="Not Found"||t.error.Code==="ReplicationConfigurationnotFoundError")){var C={ReplicationConfiguration:{Rules:[]},statusCode:t.statusCode};t.headers&&(C.headers=t.headers),d(null,C)}else d(t);return}!a.ReplicationConfiguration&&(a.ReplicationConfiguration={}),a.ReplicationConfiguration.Rule&&(a.ReplicationConfiguration.Rules=c.makeArray(a.ReplicationConfiguration.Rule),delete a.ReplicationConfiguration.Rule),d(t,a)})}function K(e,d){ae.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},function(t,a){if(t&&t.statusCode===204)return d(null,{statusCode:t.statusCode});if(t)return d(t);d(null,{statusCode:a.statusCode,headers:a.headers})})}function z(e,d){if(!e.WebsiteConfiguration){d(c.error(new Error("missing param WebsiteConfiguration")));return}var t=c.clone(e.WebsiteConfiguration||{}),a=t.RoutingRules||t.RoutingRule||[];a=c.isArray(a)?a:[a],delete t.RoutingRule,delete t.RoutingRules,a.length&&(t.RoutingRules={RoutingRule:a});var C=c.json2xml({WebsiteConfiguration:t}),y=e.Headers;y["Content-Type"]="application/xml",y["Content-MD5"]=c.b64(c.md5(C)),ae.call(this,{Action:"name/cos:PutBucketWebsite",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:C,action:"website",headers:y},function(D,w){if(D&&D.statusCode===204)return d(null,{statusCode:D.statusCode});if(D)return d(D);d(null,{statusCode:w.statusCode,headers:w.headers})})}function $(e,d){ae.call(this,{Action:"name/cos:GetBucketWebsite",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"website"},function(t,a){if(t){if(t.statusCode===404&&t.error.Code==="NoSuchWebsiteConfiguration"){var C={WebsiteConfiguration:{},statusCode:t.statusCode};t.headers&&(C.headers=t.headers),d(null,C)}else d(t);return}var y=a.WebsiteConfiguration||{};if(y.RoutingRules){var D=c.clone(y.RoutingRules.RoutingRule||[]);D=c.makeArray(D),y.RoutingRules=D}d(null,{WebsiteConfiguration:y,statusCode:a.statusCode,headers:a.headers})})}function ne(e,d){ae.call(this,{Action:"name/cos:DeleteBucketWebsite",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"website"},function(t,a){if(t&&t.statusCode===204)return d(null,{statusCode:t.statusCode});if(t)return d(t);d(null,{statusCode:a.statusCode,headers:a.headers})})}function ce(e,d){if(!e.RefererConfiguration){d(c.error(new Error("missing param RefererConfiguration")));return}var t=c.clone(e.RefererConfiguration||{}),a=t.DomainList||{},C=a.Domains||a.Domain||[];C=c.isArray(C)?C:[C],C.length&&(t.DomainList={Domain:C});var y=c.json2xml({RefererConfiguration:t}),D=e.Headers;D["Content-Type"]="application/xml",D["Content-MD5"]=c.b64(c.md5(y)),ae.call(this,{Action:"name/cos:PutBucketReferer",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:y,action:"referer",headers:D},function(w,Z){if(w&&w.statusCode===204)return d(null,{statusCode:w.statusCode});if(w)return d(w);d(null,{statusCode:Z.statusCode,headers:Z.headers})})}function ie(e,d){ae.call(this,{Action:"name/cos:GetBucketReferer",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"referer"},function(t,a){if(t){if(t.statusCode===404&&t.error.Code==="NoSuchRefererConfiguration"){var C={WebsiteConfiguration:{},statusCode:t.statusCode};t.headers&&(C.headers=t.headers),d(null,C)}else d(t);return}var y=a.RefererConfiguration||{};if(y.DomainList){var D=c.makeArray(y.DomainList.Domain||[]);y.DomainList={Domains:D}}d(null,{RefererConfiguration:y,statusCode:a.statusCode,headers:a.headers})})}function ee(e,d){var t=e.DomainConfiguration||{},a=t.DomainRule||e.DomainRule||[];a=c.clone(a);var C=c.json2xml({DomainConfiguration:{DomainRule:a}}),y=e.Headers;y["Content-Type"]="application/xml",y["Content-MD5"]=c.b64(c.md5(C)),ae.call(this,{Action:"name/cos:PutBucketDomain",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:C,action:"domain",headers:y},function(D,w){if(D&&D.statusCode===204)return d(null,{statusCode:D.statusCode});if(D)return d(D);d(null,{statusCode:w.statusCode,headers:w.headers})})}function le(e,d){ae.call(this,{Action:"name/cos:GetBucketDomain",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain"},function(t,a){if(t)return d(t);var C=[];try{C=a.DomainConfiguration.DomainRule||[]}catch{}C=c.clone(c.isArray(C)?C:[C]),d(null,{DomainRule:C,statusCode:a.statusCode,headers:a.headers})})}function se(e,d){ae.call(this,{Action:"name/cos:DeleteBucketDomain",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain"},function(t,a){if(t&&t.statusCode===204)return d(null,{statusCode:t.statusCode});if(t)return d(t);d(null,{statusCode:a.statusCode,headers:a.headers})})}function ye(e,d){var t=e.OriginConfiguration||{},a=t.OriginRule||e.OriginRule||[];a=c.clone(a);var C=c.json2xml({OriginConfiguration:{OriginRule:a}}),y=e.Headers;y["Content-Type"]="application/xml",y["Content-MD5"]=c.b64(c.md5(C)),ae.call(this,{Action:"name/cos:PutBucketOrigin",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:C,action:"origin",headers:y},function(D,w){if(D&&D.statusCode===204)return d(null,{statusCode:D.statusCode});if(D)return d(D);d(null,{statusCode:w.statusCode,headers:w.headers})})}function Y(e,d){ae.call(this,{Action:"name/cos:GetBucketOrigin",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin"},function(t,a){if(t)return d(t);var C=[];try{C=a.OriginConfiguration.OriginRule||[]}catch{}C=c.clone(c.isArray(C)?C:[C]),d(null,{OriginRule:C,statusCode:a.statusCode,headers:a.headers})})}function te(e,d){ae.call(this,{Action:"name/cos:DeleteBucketOrigin",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin"},function(t,a){if(t&&t.statusCode===204)return d(null,{statusCode:t.statusCode});if(t)return d(t);d(null,{statusCode:a.statusCode,headers:a.headers})})}function pe(e,d){var t=c.json2xml({BucketLoggingStatus:e.BucketLoggingStatus||""}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=c.b64(c.md5(t)),ae.call(this,{Action:"name/cos:PutBucketLogging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:t,action:"logging",headers:a},function(C,y){if(C&&C.statusCode===204)return d(null,{statusCode:C.statusCode});if(C)return d(C);d(null,{statusCode:y.statusCode,headers:y.headers})})}function me(e,d){ae.call(this,{Action:"name/cos:GetBucketLogging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"logging"},function(t,a){if(t)return d(t);d(null,{BucketLoggingStatus:a.BucketLoggingStatus,statusCode:a.statusCode,headers:a.headers})})}function ge(e,d,t){var a=c.clone(d.InventoryConfiguration);if(a.OptionalFields){var C=a.OptionalFields||[];a.OptionalFields={Field:C}}if(a.Destination&&a.Destination.COSBucketDestination&&a.Destination.COSBucketDestination.Encryption){var y=a.Destination.COSBucketDestination.Encryption;Object.keys(y).indexOf("SSECOS")>-1&&(y["SSE-COS"]=y.SSECOS,delete y.SSECOS)}var D=c.json2xml({InventoryConfiguration:a}),w=d.Headers;w["Content-Type"]="application/xml",w["Content-MD5"]=c.b64(c.md5(D));var Z=e==="PUT"?"name/cos:PutBucketInventory":"name/cos:PostBucketInventory";ae.call(this,{Action:Z,method:e,Bucket:d.Bucket,Region:d.Region,body:D,action:"inventory",qs:{id:d.Id},headers:w},function(we,Ee){if(we&&we.statusCode===204)return t(null,{statusCode:we.statusCode});if(we)return t(we);t(null,{statusCode:Ee.statusCode,headers:Ee.headers})})}function ve(e,d){return ge.call(this,"PUT",e,d)}function Ce(e,d){return ge.call(this,"POST",e,d)}function De(e,d){ae.call(this,{Action:"name/cos:GetBucketInventory",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id}},function(t,a){if(t)return d(t);var C=a.InventoryConfiguration;if(C&&C.OptionalFields&&C.OptionalFields.Field){var y=C.OptionalFields.Field;c.isArray(y)||(y=[y]),C.OptionalFields=y}if(C.Destination&&C.Destination.COSBucketDestination&&C.Destination.COSBucketDestination.Encryption){var D=C.Destination.COSBucketDestination.Encryption;Object.keys(D).indexOf("SSE-COS")>-1&&(D.SSECOS=D["SSE-COS"],delete D["SSE-COS"])}d(null,{InventoryConfiguration:C,statusCode:a.statusCode,headers:a.headers})})}function be(e,d){ae.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(t,a){if(t)return d(t);var C=a.ListInventoryConfigurationResult,y=C.InventoryConfiguration||[];y=c.isArray(y)?y:[y],delete C.InventoryConfiguration,c.each(y,function(D){if(D&&D.OptionalFields&&D.OptionalFields.Field){var w=D.OptionalFields.Field;c.isArray(w)||(w=[w]),D.OptionalFields=w}if(D.Destination&&D.Destination.COSBucketDestination&&D.Destination.COSBucketDestination.Encryption){var Z=D.Destination.COSBucketDestination.Encryption;Object.keys(Z).indexOf("SSE-COS")>-1&&(Z.SSECOS=Z["SSE-COS"],delete Z["SSE-COS"])}}),C.InventoryConfigurations=y,c.extend(C,{statusCode:a.statusCode,headers:a.headers}),d(null,C)})}function Te(e,d){ae.call(this,{Action:"name/cos:DeleteBucketInventory",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id}},function(t,a){if(t&&t.statusCode===204)return d(null,{statusCode:t.statusCode});if(t)return d(t);d(null,{statusCode:a.statusCode,headers:a.headers})})}function ke(e,d){if(!e.AccelerateConfiguration){d(c.error(new Error("missing param AccelerateConfiguration")));return}var t={AccelerateConfiguration:e.AccelerateConfiguration||{}},a=c.json2xml(t),C={};C["Content-Type"]="application/xml",C["Content-MD5"]=c.b64(c.md5(a)),ae.call(this,{Action:"name/cos:PutBucketAccelerate",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:a,action:"accelerate",headers:C},function(y,D){if(y)return d(y);d(null,{statusCode:D.statusCode,headers:D.headers})})}function Fe(e,d){ae.call(this,{Action:"name/cos:GetBucketAccelerate",method:"GET",Bucket:e.Bucket,Region:e.Region,action:"accelerate"},function(t,a){t||!a.AccelerateConfiguration&&(a.AccelerateConfiguration={}),d(t,a)})}function Me(e,d){var t=e.ServerSideEncryptionConfiguration||{},a=t.Rule||t.Rules||[],C=c.json2xml({ServerSideEncryptionConfiguration:{Rule:a}}),y=e.Headers;y["Content-Type"]="application/xml",y["Content-MD5"]=c.b64(c.md5(C)),ae.call(this,{Action:"name/cos:PutBucketEncryption",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:C,action:"encryption",headers:y},function(D,w){if(D&&D.statusCode===204)return d(null,{statusCode:D.statusCode});if(D)return d(D);d(null,{statusCode:w.statusCode,headers:w.headers})})}function Pe(e,d){ae.call(this,{Action:"name/cos:GetBucketEncryption",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"encryption"},function(t,a){if(t){if(t.statusCode===404&&t.code==="NoSuchEncryptionConfiguration"){var C={EncryptionConfiguration:{Rules:[]},statusCode:t.statusCode};t.headers&&(C.headers=t.headers),d(null,C)}else d(t);return}var y=c.makeArray(a.EncryptionConfiguration&&a.EncryptionConfiguration.Rule||[]);a.EncryptionConfiguration={Rules:y},d(t,a)})}function oe(e,d){ae.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"encryption"},function(t,a){if(t&&t.statusCode===204)return d(null,{statusCode:t.statusCode});if(t)return d(t);d(null,{statusCode:a.statusCode,headers:a.headers})})}function s(e,d){ae.call(this,{Action:"name/cos:HeadObject",method:"HEAD",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers},function(t,a){if(t){var C=t.statusCode;return e.Headers["If-Modified-Since"]&&C&&C===304?d(null,{NotModified:!0,statusCode:C}):d(t)}a.ETag=c.attr(a.headers,"etag",""),d(null,a)})}function n(e,d){var t={};t.prefix=e.Prefix||"",t.delimiter=e.Delimiter,t["key-marker"]=e.KeyMarker,t["version-id-marker"]=e.VersionIdMarker,t["max-keys"]=e.MaxKeys,t["encoding-type"]=e.EncodingType,ae.call(this,{Action:"name/cos:GetBucketObjectVersions",ResourceKey:t.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:t,action:"versions"},function(a,C){if(a)return d(a);var y=C.ListVersionsResult||{},D=y.DeleteMarker||[];D=c.isArray(D)?D:[D];var w=y.Version||[];w=c.isArray(w)?w:[w];var Z=c.clone(y);delete Z.DeleteMarker,delete Z.Version,c.extend(Z,{DeleteMarkers:D,Versions:w,statusCode:C.statusCode,headers:C.headers}),d(null,Z)})}function r(e,d){var t=e.Query||{},a=e.QueryString||"",C=c.throttleOnProgress.call(this,0,e.onProgress),y=e.tracker;y&&y.setParams({signStartTime:new Date().getTime()}),t["response-content-type"]=e.ResponseContentType,t["response-content-language"]=e.ResponseContentLanguage,t["response-expires"]=e.ResponseExpires,t["response-cache-control"]=e.ResponseCacheControl,t["response-content-disposition"]=e.ResponseContentDisposition,t["response-content-encoding"]=e.ResponseContentEncoding,ae.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:t,qsStr:a,rawBody:!0,onDownloadProgress:C,tracker:y},function(D,w){if(C(null,!0),D){var Z=D.statusCode;return e.Headers["If-Modified-Since"]&&Z&&Z===304?d(null,{NotModified:!0}):d(D)}d(null,{Body:w.body,ETag:c.attr(w.headers,"etag",""),statusCode:w.statusCode,headers:w.headers})})}function o(e,d){var t=this,a=e.ContentLength,C=c.throttleOnProgress.call(t,a,e.onProgress),y=e.Headers;!y["Cache-Control"]&&!y["cache-control"]&&(y["Cache-Control"]=""),!y["Content-Type"]&&!y["content-type"]&&(y["Content-Type"]=e.Body&&e.Body.type||"");var D=e.UploadAddMetaMd5||t.options.UploadAddMetaMd5||t.options.UploadCheckContentMd5,w=e.tracker;D&&w&&w.setParams({md5StartTime:new Date().getTime()}),c.getBodyMd5(D,e.Body,function(Z){Z&&(w&&w.setParams({md5EndTime:new Date().getTime()}),t.options.UploadCheckContentMd5&&(y["Content-MD5"]=c.b64(Z)),(e.UploadAddMetaMd5||t.options.UploadAddMetaMd5)&&(y["x-cos-meta-md5"]=Z)),e.ContentLength!==void 0&&(y["Content-Length"]=e.ContentLength),C(null,!0),ae.call(t,{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:C,tracker:w},function(we,Ee){if(we)return C(null,!0),d(we);C({loaded:a,total:a},!0);var Ae=F({ForcePathStyle:t.options.ForcePathStyle,protocol:t.options.Protocol,domain:t.options.Domain,bucket:e.Bucket,region:t.options.UseAccelerate?"accelerate":e.Region,object:e.Key});Ae=Ae.substr(Ae.indexOf("://")+3),Ee.Location=Ae,Ee.ETag=c.attr(Ee.headers,"etag",""),d(null,Ee)})},e.onHashProgress)}function f(e,d){ae.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(t,a){if(t){var C=t.statusCode;return C&&C===404?d(null,{BucketNotFound:!0,statusCode:C}):d(t)}d(null,{statusCode:a.statusCode,headers:a.headers})})}function b(e,d){var t={};e.VersionId&&(t.versionId=e.VersionId),ae.call(this,{Action:"name/cos:GetObjectACL",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,qs:t,action:"acl"},function(a,C){if(a)return d(a);var y=C.AccessControlPolicy||{},D=y.Owner||{},w=y.AccessControlList&&y.AccessControlList.Grant||[];w=c.isArray(w)?w:[w];var Z=l(y);delete Z.GrantWrite,C.headers&&C.headers["x-cos-acl"]&&(Z.ACL=C.headers["x-cos-acl"]),Z=c.extend(Z,{Owner:D,Grants:w,statusCode:C.statusCode,headers:C.headers}),d(null,Z)})}function k(e,d){var t=e.Headers,a="";if(e.AccessControlPolicy){var C=c.clone(e.AccessControlPolicy||{}),y=C.Grants||C.Grant;y=c.isArray(y)?y:[y],delete C.Grant,delete C.Grants,C.AccessControlList={Grant:y},a=c.json2xml({AccessControlPolicy:C}),t["Content-Type"]="application/xml",t["Content-MD5"]=c.b64(c.md5(a))}c.each(t,function(D,w){w.indexOf("x-cos-grant-")===0&&(t[w]=E(t[w]))}),ae.call(this,{Action:"name/cos:PutObjectACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"acl",headers:t,body:a},function(D,w){if(D)return d(D);d(null,{statusCode:w.statusCode,headers:w.headers})})}function G(e,d){var t=e.Headers;t.Origin=e.Origin,t["Access-Control-Request-Method"]=e.AccessControlRequestMethod,t["Access-Control-Request-Headers"]=e.AccessControlRequestHeaders,ae.call(this,{Action:"name/cos:OptionsObject",method:"OPTIONS",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:t},function(a,C){if(a)return a.statusCode&&a.statusCode===403?d(null,{OptionsForbidden:!0,statusCode:a.statusCode}):d(a);var y=C.headers||{};d(null,{AccessControlAllowOrigin:y["access-control-allow-origin"],AccessControlAllowMethods:y["access-control-allow-methods"],AccessControlAllowHeaders:y["access-control-allow-headers"],AccessControlExposeHeaders:y["access-control-expose-headers"],AccessControlMaxAge:y["access-control-max-age"],statusCode:C.statusCode,headers:C.headers})})}function de(e,d){var t=this,a=e.Headers;!a["Cache-Control"]&&!a["cache-control"]&&(a["Cache-Control"]="");var C=e.CopySource||"",y=c.getSourceParams.call(this,C);if(!y){d(c.error(new Error("CopySource format error")));return}var D=y.Bucket,w=y.Region,Z=decodeURIComponent(y.Key);ae.call(this,{Scope:[{action:"name/cos:GetObject",bucket:D,region:w,prefix:Z},{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(we,Ee){if(we)return d(we);var Ae=c.clone(Ee.CopyObjectResult||{}),Be=F({ForcePathStyle:t.options.ForcePathStyle,protocol:t.options.Protocol,domain:t.options.Domain,bucket:e.Bucket,region:e.Region,object:e.Key,isLocation:!0});c.extend(Ae,{Location:Be,statusCode:Ee.statusCode,headers:Ee.headers}),d(null,Ae)})}function he(e,d){var t=e.CopySource||"",a=c.getSourceParams.call(this,t);if(!a){d(c.error(new Error("CopySource format error")));return}var C=a.Bucket,y=a.Region,D=decodeURIComponent(a.Key);ae.call(this,{Scope:[{action:"name/cos:GetObject",bucket:C,region:y,prefix:D},{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(w,Z){if(w)return d(w);var we=c.clone(Z.CopyPartResult||{});c.extend(we,{statusCode:Z.statusCode,headers:Z.headers}),d(null,we)})}function J(e,d){var t=e.Objects||[],a=e.Quiet;t=c.isArray(t)?t:[t];var C=c.json2xml({Delete:{Object:t,Quiet:a||!1}}),y=e.Headers;y["Content-Type"]="application/xml",y["Content-MD5"]=c.b64(c.md5(C));var D=c.map(t,function(w){return{action:"name/cos:DeleteObject",bucket:e.Bucket,region:e.Region,prefix:w.Key}});ae.call(this,{Scope:D,method:"POST",Bucket:e.Bucket,Region:e.Region,body:C,action:"delete",headers:y},function(w,Z){if(w)return d(w);var we=Z.DeleteResult||{},Ee=we.Deleted||[],Ae=we.Error||[];Ee=c.isArray(Ee)?Ee:[Ee],Ae=c.isArray(Ae)?Ae:[Ae];var Be=c.clone(we);c.extend(Be,{Error:Ae,Deleted:Ee,statusCode:Z.statusCode,headers:Z.headers}),d(null,Be)})}function Se(e,d){var t=e.Headers;if(!e.RestoreRequest){d(c.error(new Error("missing param RestoreRequest")));return}var a=e.RestoreRequest||{},C=c.json2xml({RestoreRequest:a});t["Content-Type"]="application/xml",t["Content-MD5"]=c.b64(c.md5(C)),ae.call(this,{Action:"name/cos:RestoreObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,body:C,action:"restore",headers:t},d)}function _e(e,d){var t=e.Tagging||{},a=t.TagSet||t.Tags||e.Tags||[];a=c.clone(c.isArray(a)?a:[a]);var C=c.json2xml({Tagging:{TagSet:{Tag:a}}}),y=e.Headers;y["Content-Type"]="application/xml",y["Content-MD5"]=c.b64(c.md5(C)),ae.call(this,{Action:"name/cos:PutObjectTagging",method:"PUT",Bucket:e.Bucket,Key:e.Key,Region:e.Region,body:C,action:"tagging",headers:y,VersionId:e.VersionId},function(D,w){if(D&&D.statusCode===204)return d(null,{statusCode:D.statusCode});if(D)return d(D);d(null,{statusCode:w.statusCode,headers:w.headers})})}function Ue(e,d){ae.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(t,a){if(t){if(t.statusCode===404&&t.error&&(t.error==="Not Found"||t.error.Code==="NoSuchTagSet")){var C={Tags:[],statusCode:t.statusCode};t.headers&&(C.headers=t.headers),d(null,C)}else d(t);return}var y=[];try{y=a.Tagging.TagSet.Tag||[]}catch{}y=c.clone(c.isArray(y)?y:[y]),d(null,{Tags:y,statusCode:a.statusCode,headers:a.headers})})}function Re(e,d){ae.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(t,a){if(t&&t.statusCode===204)return d(null,{statusCode:t.statusCode});if(t)return d(t);d(null,{statusCode:a.statusCode,headers:a.headers})})}function Le(e,d){var t=e.SelectType;if(!t)return d(c.error(new Error("missing param SelectType")));var a=e.SelectRequest||{},C=c.json2xml({SelectRequest:a}),y=e.Headers;y["Content-Type"]="application/xml",y["Content-MD5"]=c.b64(c.md5(C)),ae.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:C,DataType:"arraybuffer",rawBody:!0},function(D,w){if(D&&D.statusCode===204)return d(null,{statusCode:D.statusCode});if(D)return d(D);var Z=c.parseSelectPayload(w.body);d(null,{statusCode:w.statusCode,headers:w.headers,Body:Z.body,Payload:Z.payload})})}function ze(e,d){var t=this,a=e.Headers,C=e.tracker;!a["Cache-Control"]&&!a["cache-control"]&&(a["Cache-Control"]=""),!a["Content-Type"]&&!a["content-type"]&&(a["Content-Type"]=e.Body&&e.Body.type||"");var y=e.Body&&(e.UploadAddMetaMd5||t.options.UploadAddMetaMd5);y&&C&&C.setParams({md5StartTime:new Date().getTime()}),c.getBodyMd5(y,e.Body,function(D){D&&(e.Headers["x-cos-meta-md5"]=D),y&&C&&C.setParams({md5EndTime:new Date().getTime()}),ae.call(t,{Action:"name/cos:InitiateMultipartUpload",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"uploads",headers:e.Headers,qs:e.Query,tracker:C},function(w,Z){if(w)return C&&C.parent&&C.parent.setParams({errorNode:"multipartInit"}),d(w);if(Z=c.clone(Z||{}),Z&&Z.InitiateMultipartUploadResult)return d(null,c.extend(Z.InitiateMultipartUploadResult,{statusCode:Z.statusCode,headers:Z.headers}));d(null,Z)})},e.onHashProgress)}function Ve(e,d){var t=this;c.getFileSize("multipartUpload",e,function(){var a=e.tracker,C=t.options.UploadCheckContentMd5;C&&a&&a.setParams({md5StartTime:new Date().getTime()}),c.getBodyMd5(C,e.Body,function(y){y&&(e.Headers["Content-MD5"]=c.b64(y)),C&&a&&a.setParams({md5EndTime:new Date().getTime()}),a&&a.setParams({partNumber:e.PartNumber}),ae.call(t,{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:a},function(D,w){if(D)return a&&a.parent&&a.parent.setParams({errorNode:"multipartUpload"}),d(D);d(null,{ETag:c.attr(w.headers,"etag",""),statusCode:w.statusCode,headers:w.headers})})})})}function We(e,d){for(var t=this,a=e.UploadId,C=e.Parts,y=e.tracker,D=0,w=C.length;D-1?Ae(Ee.Authorization):"sign="+encodeURIComponent(Ee.Authorization)),Ee.SecurityToken&&(Be+="&x-cos-security-token="+Ee.SecurityToken),Ee.ClientIP&&(Be+="&clientIP="+Ee.ClientIP),Ee.ClientUA&&(Be+="&clientUA="+Ee.ClientUA),Ee.Token&&(Be+="&token="+Ee.Token),y&&(Be+="&"+y),setTimeout(function(){d(null,{Url:Be})})}});return Z?(D+="?"+Z.Authorization+(Z.SecurityToken?"&x-cos-security-token="+Z.SecurityToken:""),y&&(D+="&"+y)):y&&(D+="?"+y),D}function l(e){var d={GrantFullControl:[],GrantWrite:[],GrantRead:[],GrantReadAcp:[],GrantWriteAcp:[],ACL:""},t={FULL_CONTROL:"GrantFullControl",WRITE:"GrantWrite",READ:"GrantRead",READ_ACP:"GrantReadAcp",WRITE_ACP:"GrantWriteAcp"},a=e&&e.AccessControlList||{},C=a.Grant;C&&(C=c.isArray(C)?C:[C]);var y={READ:0,WRITE:0,FULL_CONTROL:0};return C&&C.length&&c.each(C,function(D){D.Grantee.ID==="qcs::cam::anyone:anyone"||D.Grantee.URI==="http://cam.qcloud.com/groups/global/AllUsers"?y[D.Permission]=1:D.Grantee.ID!==e.Owner.ID&&d[t[D.Permission]].push('id="'+D.Grantee.ID+'"')}),y.FULL_CONTROL||y.WRITE&&y.READ?d.ACL="public-read-write":y.READ?d.ACL="public-read":d.ACL="private",c.each(t,function(D){d[D]=E(d[D].join(","))}),d}function E(e){var d=e.split(","),t={},a,C;for(a=0;a-1?y="{Region}.myqcloud.com":y="cos.{Region}.myqcloud.com",e.ForcePathStyle||(y="{Bucket}."+y)),y=y.replace(/\{\{AppId\}\}/gi,C).replace(/\{\{Bucket\}\}/gi,a).replace(/\{\{Region\}\}/gi,d).replace(/\{\{.*?\}\}/gi,""),y=y.replace(/\{AppId\}/gi,C).replace(/\{BucketName\}/gi,a).replace(/\{Bucket\}/gi,t).replace(/\{Region\}/gi,d).replace(/\{.*?\}/gi,""),/^[a-zA-Z]+:\/\//.test(y)||(y=w+"//"+y),y.slice(-1)==="/"&&(y=y.slice(0,-1));var Z=y;return e.ForcePathStyle&&(Z+="/"+t),Z+="/",D&&(Z+=c.camSafeUrlEncode(D).replace(/%2F/g,"/")),e.isLocation&&(Z=Z.replace(/^https?:\/\//,"")),Z}var fe=function(d){if(!d.Bucket||!d.Region)return"";var t=d.UseAccelerate===void 0?this.options.UseAccelerate:d.UseAccelerate,a=d.Url||F({ForcePathStyle:this.options.ForcePathStyle,protocol:this.options.Protocol,domain:this.options.Domain,bucket:d.Bucket,region:t?"accelerate":d.Region}),C=a.replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1"),y=new RegExp("^([a-z\\d-]+-\\d+\\.)?(cos|cosv6|ci|pic)\\.([a-z\\d-]+)\\.myqcloud\\.com$");return y.test(C)?C:""};function xe(e,d){var t=c.clone(e.Headers),a="";c.each(t,function(Ie,Oe){(Ie===""||["content-type","cache-control","expires"].indexOf(Oe.toLowerCase())>-1)&&delete t[Oe],Oe.toLowerCase()==="host"&&(a=Ie)});var C=e.ForceSignHost!==!1;!a&&e.SignHost&&C&&(t.Host=e.SignHost);var y=!1,D=function(Oe,je){y||(y=!0,je&&je.XCosSecurityToken&&!je.SecurityToken&&(je=c.clone(je),je.SecurityToken=je.XCosSecurityToken,delete je.XCosSecurityToken),d&&d(Oe,je))},w=this,Z=e.Bucket||"",we=e.Region||"",Ee=e.Key||"";w.options.ForcePathStyle&&Z&&(Ee=Z+"/"+Ee);var Ae="/"+Ee,Be={},qe=e.Scope;if(!qe){var Ye=e.Action||"",it=e.ResourceKey||e.Key||"";qe=e.Scope||[{action:Ye,bucket:Z,region:we,prefix:it}]}var ot=c.md5(JSON.stringify(qe));w._StsCache=w._StsCache||[],function(){var Ie,Oe;for(Ie=w._StsCache.length-1;Ie>=0;Ie--){Oe=w._StsCache[Ie];var je=Math.round(c.getSkewTime(w.options.SystemClockOffset)/1e3)+30;if(Oe.StartTime&&je=Oe.ExpiredTime){w._StsCache.splice(Ie,1);continue}if(!Oe.ScopeLimit||Oe.ScopeLimit&&Oe.ScopeKey===ot){Be=Oe;break}}}();var Ze=function(){var Oe="";Be.StartTime&&e.Expires?Oe=Be.StartTime+";"+(Be.StartTime+e.Expires*1):Be.StartTime&&Be.ExpiredTime&&(Oe=Be.StartTime+";"+Be.ExpiredTime);var je=c.getAuth({SecretId:Be.TmpSecretId,SecretKey:Be.TmpSecretKey,Method:e.Method,Pathname:Ae,Query:e.Query,Headers:t,Expires:e.Expires,UseRawKey:w.options.UseRawKey,SystemClockOffset:w.options.SystemClockOffset,KeyTime:Oe,ForceSignHost:C}),He={Authorization:je,SecurityToken:Be.SecurityToken||Be.XCosSecurityToken||"",Token:Be.Token||"",ClientIP:Be.ClientIP||"",ClientUA:Be.ClientUA||""};D(null,He)},ut=function(Oe){if(Oe.Authorization){var je=!1,He=Oe.Authorization;if(He)if(He.indexOf(" ")>-1)je=!1;else if(He.indexOf("q-sign-algorithm=")>-1&&He.indexOf("q-ak=")>-1&&He.indexOf("q-sign-time=")>-1&&He.indexOf("q-key-time=")>-1&&He.indexOf("q-url-param-list=")>-1)je=!0;else try{He=atob(He),He.indexOf("a=")>-1&&He.indexOf("k=")>-1&&He.indexOf("t=")>-1&&He.indexOf("r=")>-1&&He.indexOf("b=")>-1&&(je=!0)}catch{}if(!je)return c.error(new Error("getAuthorization callback params format error"))}else{if(!Oe.TmpSecretId)return c.error(new Error('getAuthorization callback params missing "TmpSecretId"'));if(!Oe.TmpSecretKey)return c.error(new Error('getAuthorization callback params missing "TmpSecretKey"'));if(!Oe.SecurityToken&&!Oe.XCosSecurityToken)return c.error(new Error('getAuthorization callback params missing "SecurityToken"'));if(!Oe.ExpiredTime)return c.error(new Error('getAuthorization callback params missing "ExpiredTime"'));if(Oe.ExpiredTime&&Oe.ExpiredTime.toString().length!==10)return c.error(new Error('getAuthorization callback params "ExpiredTime" should be 10 digits'));if(Oe.StartTime&&Oe.StartTime.toString().length!==10)return c.error(new Error('getAuthorization callback params "StartTime" should be 10 StartTime'))}return!1};if(Be.ExpiredTime&&Be.ExpiredTime-c.getSkewTime(w.options.SystemClockOffset)/1e3>60)Ze();else if(w.options.getAuthorization)w.options.getAuthorization.call(w,{Bucket:Z,Region:we,Method:e.Method,Key:Ee,Pathname:Ae,Query:e.Query,Headers:t,Scope:qe,SystemClockOffset:w.options.SystemClockOffset,ForceSignHost:C},function(Ie){typeof Ie=="string"&&(Ie={Authorization:Ie});var Oe=ut(Ie);if(Oe)return D(Oe);Ie.Authorization?D(null,Ie):(Be=Ie||{},Be.Scope=qe,Be.ScopeKey=ot,w._StsCache.push(Be),Ze())});else if(w.options.getSTS)w.options.getSTS.call(w,{Bucket:Z,Region:we},function(Ie){Be=Ie||{},Be.Scope=qe,Be.ScopeKey=ot,Be.TmpSecretId||(Be.TmpSecretId=Be.SecretId),Be.TmpSecretKey||(Be.TmpSecretKey=Be.SecretKey);var Oe=ut(Be);if(Oe)return D(Oe);w._StsCache.push(Be),Ze()});else return function(){var Ie=c.getAuth({SecretId:e.SecretId||w.options.SecretId,SecretKey:e.SecretKey||w.options.SecretKey,Method:e.Method,Pathname:Ae,Query:e.Query,Headers:t,Expires:e.Expires,UseRawKey:w.options.UseRawKey,SystemClockOffset:w.options.SystemClockOffset,ForceSignHost:C}),Oe={Authorization:Ie,SecurityToken:w.options.SecurityToken||w.options.XCosSecurityToken};return D(null,Oe),Oe}();return""}function Ne(e){var d=!1,t=!1,a=e.headers&&(e.headers.date||e.headers.Date)||e.error&&e.error.ServerTime;try{var C=e.error.Code,y=e.error.Message;(C==="RequestTimeTooSkewed"||C==="AccessDenied"&&y==="Request has expired")&&(t=!0)}catch{}if(e)if(t&&a){var D=Date.parse(a);this.options.CorrectClockSkew&&Math.abs(c.getSkewTime(this.options.SystemClockOffset)-D)>=3e4&&(console.error("error: Local time is too skewed."),this.options.SystemClockOffset=D-Date.now(),d=!0)}else Math.floor(e.statusCode/100)===5&&(d=!0);return d}function ae(e,d){var t=this;!e.headers&&(e.headers={}),!e.qs&&(e.qs={}),e.VersionId&&(e.qs.versionId=e.VersionId),e.qs=c.clearKey(e.qs),e.headers&&(e.headers=c.clearKey(e.headers)),e.qs&&(e.qs=c.clearKey(e.qs));var a=c.clone(e.qs);e.action&&(a[e.action]="");var C=e.url||e.Url,y=e.SignHost||fe.call(this,{Bucket:e.Bucket,Region:e.Region,Url:C}),D=e.tracker,w=function Z(we){var Ee=t.options.SystemClockOffset;D&&D.setParams({signStartTime:new Date().getTime(),retryTimes:we-1}),xe.call(t,{Bucket:e.Bucket||"",Region:e.Region||"",Method:e.method,Key:e.Key,Query:a,Headers:e.headers,SignHost:y,Action:e.Action,ResourceKey:e.ResourceKey,Scope:e.Scope,ForceSignHost:t.options.ForceSignHost},function(Ae,Be){if(Ae){d(Ae);return}D&&D.setParams({signEndTime:new Date().getTime(),httpStartTime:new Date().getTime()}),e.AuthData=Be,Qe.call(t,e,function(qe,Ye){D&&D.setParams({httpEndTime:new Date().getTime()}),qe&&we<2&&(Ee!==t.options.SystemClockOffset||Ne.call(t,qe))?(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"]),Z(we+1)):d(qe,Ye)})})};w(1)}function Qe(e,d){var t=this,a=e.TaskId;if(!(a&&!t._isRunningTask(a))){var C=e.Bucket,y=e.Region,D=e.Key,w=e.method||"GET",Z=e.Url||e.url,we=e.body,Ee=e.rawBody;t.options.UseAccelerate&&(y="accelerate"),Z=Z||F({ForcePathStyle:t.options.ForcePathStyle,protocol:t.options.Protocol,domain:t.options.Domain,bucket:C,region:y,object:D}),e.action&&(Z=Z+"?"+(c.isIOS_QQ?"".concat(e.action,"="):e.action)),e.qsStr&&(Z.indexOf("?")>-1?Z=Z+"&"+e.qsStr:Z=Z+"?"+e.qsStr);var Ae={method:w,url:Z,headers:e.headers,qs:e.qs,body:we},Be="x-cos-security-token";if(c.isCIHost(Z)&&(Be="x-ci-security-token"),Ae.headers.Authorization=e.AuthData.Authorization,e.AuthData.Token&&(Ae.headers.token=e.AuthData.Token),e.AuthData.ClientIP&&(Ae.headers.clientIP=e.AuthData.ClientIP),e.AuthData.ClientUA&&(Ae.headers.clientUA=e.AuthData.ClientUA),e.AuthData.SecurityToken&&(Ae.headers[Be]=e.AuthData.SecurityToken),Ae.headers&&(Ae.headers=c.clearKey(Ae.headers)),Ae=c.clearKey(Ae),e.onProgress&&typeof e.onProgress=="function"){var qe=we&&(we.size||we.length)||0;Ae.onProgress=function(Ie){if(!(a&&!t._isRunningTask(a))){var Oe=Ie?Ie.loaded:0;e.onProgress({loaded:Oe,total:qe})}}}e.onDownloadProgress&&(Ae.onDownloadProgress=e.onDownloadProgress),e.DataType&&(Ae.dataType=e.DataType),this.options.Timeout&&(Ae.timeout=this.options.Timeout),t.options.ForcePathStyle&&(Ae.pathStyle=t.options.ForcePathStyle),t.emit("before-send",Ae);var Ye=Ae.url.includes("accelerate."),it=Ae.qs?Object.keys(Ae.qs).map(function(Ie){return"".concat(Ie,"=").concat(Ae.qs[Ie])}).join("&"):"",ot=it?Ae.url+"?"+it:Ae.url;e.tracker&&e.tracker.setParams({reqUrl:ot,accelerate:Ye?"Y":"N"}),e.tracker&&e.tracker.parent&&e.tracker.parent.setParams({reqUrl:ot,accelerate:Ye?"Y":"N"});var Ze=(t.options.Request||x)(Ae,function(Ie){if(!(Ie&&Ie.error==="abort")){var Oe={options:Ae,error:Ie&&Ie.error,statusCode:Ie&&Ie.statusCode||0,statusMessage:Ie&&Ie.statusMessage||"",headers:Ie&&Ie.headers||{},body:Ie&&Ie.body};t.emit("after-receive",Oe);var je=Oe.error,He=Oe.body,tt={statusCode:Oe.statusCode,statusMessage:Oe.statusMessage,headers:Oe.headers},pt,st=function(dt,ht){if(a&&t.off("inner-kill-task",ut),!pt){pt=!0;var ft={};tt&&tt.statusCode&&(ft.statusCode=tt.statusCode),tt&&tt.headers&&(ft.headers=tt.headers),dt?(dt=c.extend(dt||{},ft),d(dt,null)):(ht=c.extend(ht||{},ft),d(null,ht)),Ze=null}};if(je)return st(c.error(je));var ct=tt.statusCode,gt=Math.floor(ct/100)===2;if(Ee&>)return st(null,{body:He});var at;try{at=He&&He.indexOf("<")>-1&&He.indexOf(">")>-1&&c.xml2json(He)||{}}catch{at={}}var lt=at&&at.Error;gt?st(null,at):lt?st(c.error(new Error(lt.Message),{code:lt.Code,error:lt})):ct?st(c.error(new Error(tt.statusMessage),{code:""+ct})):ct&&st(c.error(new Error("statusCode error")))}}),ut=function Ie(Oe){Oe.TaskId===a&&(Ze&&Ze.abort&&Ze.abort(),t.off("inner-kill-task",Ie))};a&&t.on("inner-kill-task",ut)}}var Je={getService:S,putBucket:_,headBucket:N,getBucket:O,deleteBucket:T,putBucketAcl:H,getBucketAcl:X,putBucketCors:V,getBucketCors:U,deleteBucketCors:M,getBucketLocation:re,getBucketPolicy:ue,putBucketPolicy:Q,deleteBucketPolicy:R,putBucketTagging:A,getBucketTagging:v,deleteBucketTagging:W,putBucketLifecycle:p,getBucketLifecycle:q,deleteBucketLifecycle:j,putBucketVersioning:I,getBucketVersioning:L,putBucketReplication:B,getBucketReplication:P,deleteBucketReplication:K,putBucketWebsite:z,getBucketWebsite:$,deleteBucketWebsite:ne,putBucketReferer:ce,getBucketReferer:ie,putBucketDomain:ee,getBucketDomain:le,deleteBucketDomain:se,putBucketOrigin:ye,getBucketOrigin:Y,deleteBucketOrigin:te,putBucketLogging:pe,getBucketLogging:me,putBucketInventory:ve,postBucketInventory:Ce,getBucketInventory:De,listBucketInventory:be,deleteBucketInventory:Te,putBucketAccelerate:ke,getBucketAccelerate:Fe,putBucketEncryption:Me,getBucketEncryption:Pe,deleteBucketEncryption:oe,getObject:r,headObject:s,listObjectVersions:n,putObject:o,deleteObject:f,getObjectAcl:b,putObjectAcl:k,optionsObject:G,putObjectCopy:de,deleteMultipleObject:J,restoreObject:Se,putObjectTagging:_e,getObjectTagging:Ue,deleteObjectTagging:Re,selectObjectContent:Le,appendObject:et,uploadPartCopy:he,multipartInit:ze,multipartUpload:Ve,multipartComplete:We,multipartList:Ke,multipartListPart:Ge,multipartAbort:Xe,request:rt,getObjectUrl:i,getAuth:nt};function $e(e,d,t){c.each(["Cors","Acl"],function(a){if(e.slice(-a.length)===a){var C=e.slice(0,-a.length)+a.toUpperCase(),y=c.apiWrapper(e,d),D=!1;t[C]=function(){!D&&console.warn("warning: cos."+C+" has been deprecated. Please Use cos."+e+" instead."),D=!0,y.apply(this,arguments)}}})}g.exports.init=function(e,d){d.transferToTaskMethod(Je,"putObject"),c.each(Je,function(t,a){e.prototype[a]=c.apiWrapper(a,t),$e(a,t,e.prototype)})}},"./src/cos.js":function(g,m,u){var h=u("./src/util.js"),x=u("./src/event.js"),c=u("./src/task.js"),S=u("./src/base.js"),_=u("./src/advance.js"),N=u("./package.json"),O={AppId:"",SecretId:"",SecretKey:"",SecurityToken:"",ChunkRetryTimes:2,FileParallelLimit:3,ChunkParallelLimit:3,ChunkSize:1024*1024,SliceSize:1024*1024,CopyChunkParallelLimit:20,CopyChunkSize:1024*1024*10,CopySliceSize:1024*1024*10,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:""},T=function(X){this.options=h.extend(h.clone(O),X||{}),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(1024*1024,this.options.ChunkSize),this.options.CopyChunkParallelLimit=Math.max(1,this.options.CopyChunkParallelLimit),this.options.CopyChunkSize=Math.max(1024*1024,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&&console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g: "test-1250000000").'),this.options.SecretId&&this.options.SecretId.indexOf(" ")>-1&&(console.error("error: SecretId\u683C\u5F0F\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5"),console.error("error: SecretId format is incorrect. Please check")),this.options.SecretKey&&this.options.SecretKey.indexOf(" ")>-1&&(console.error("error: SecretKey\u683C\u5F0F\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5"),console.error("error: SecretKey format is incorrect. Please check")),h.isNode()&&(console.warn("warning: cos-js-sdk-v5 \u4E0D\u652F\u6301 nodejs \u73AF\u5883\u4F7F\u7528\uFF0C\u8BF7\u6539\u7528 cos-nodejs-sdk-v5\uFF0C\u53C2\u8003\u6587\u6863\uFF1A https://cloud.tencent.com/document/product/436/8629"),console.warn("warning: cos-js-sdk-v5 does not support nodejs environment. Please use cos-nodejs-sdk-v5 instead. See: https://cloud.tencent.com/document/product/436/8629")),x.init(this),c.init(this)};S.init(T,c),_.init(T,c),T.util={md5:h.md5,xml2json:h.xml2json,json2xml:h.json2xml,encodeBase64:h.encodeBase64},T.getAuthorization=h.getAuth,T.version=N.version,g.exports=T},"./src/event.js":function(g,m){var u=function(c){var S={},_=function(O){return!S[O]&&(S[O]=[]),S[O]};c.on=function(N,O){N==="task-list-update"&&console.warn('warning: Event "'+N+'" has been deprecated. Please use "list-update" instead.'),_(N).push(O)},c.off=function(N,O){for(var T=_(N),H=T.length-1;H>=0;H--)O===T[H]&&T.splice(H,1)},c.emit=function(N,O){for(var T=_(N).map(function(X){return X}),H=0;H=0;re--){var Q=S[re][2];(!Q||Q+c=0;Q--){var ue=S[Q];ue[0]===U&&ue[1]===M&&S.splice(Q,1)}S.unshift([U,M,Math.round(Date.now()/1e3)]),S.length>re&&S.splice(re),H()}},removeUploadId:function(U){T.call(this),delete X.using[U];for(var M=S.length-1;M>=0;M--)S[M][1]===U&&S.splice(M,1);H()}};g.exports=X},"./src/task.js":function(g,m,u){var h=u("./src/session.js"),x=u("./src/util.js"),c={},S=function(O,T){c[T]=O[T],O[T]=function(H,X){H.SkipTask?c[T].call(this,H,X):this._addTask(T,H,X)}},_=function(O){var T=[],H={},X=0,V=0,U=function(v){var W={id:v.id,Bucket:v.Bucket,Region:v.Region,Key:v.Key,FilePath:v.FilePath,state:v.state,loaded:v.loaded,size:v.size,speed:v.speed,percent:v.percent,hashPercent:v.hashPercent,error:v.error};return v.FilePath&&(W.FilePath=v.FilePath),v._custom&&(W._custom=v._custom),W},M=function(){var A,v=function(){A=0,O.emit("task-list-update",{list:x.map(T,U)}),O.emit("list-update",{list:x.map(T,U)})};return function(){A||(A=setTimeout(v))}}(),re=function(){if(!(T.length<=O.options.UploadQueueSize)){for(var v=0;vO.options.UploadQueueSize;){var W=T[v].state==="waiting"||T[v].state==="checking"||T[v].state==="uploading";!T[v]||!W?(H[T[v].id]&&delete H[T[v].id],T.splice(v,1),V--):v++}M()}},Q=function A(){if(!(X>=O.options.FileParallelLimit)){for(;T[V]&&T[V].state!=="waiting";)V++;if(!(V>=T.length)){var v=T[V];V++,X++,v.state="checking",v.params.onTaskStart&&v.params.onTaskStart(U(v)),!v.params.UploadData&&(v.params.UploadData={});var W=x.formatParams(v.api,v.params);c[v.api].call(O,W,function(p,q){!O._isRunningTask(v.id)||((v.state==="checking"||v.state==="uploading")&&(v.state=p?"error":"success",p&&(v.error=p),X--,M(),A(),v.callback&&v.callback(p,q),v.state==="success"&&(v.params&&(delete v.params.UploadData,delete v.params.Body,delete v.params),delete v.callback)),re())}),M(),setTimeout(A)}}},ue=function(v,W){var p=H[v];if(!!p){var q=p&&p.state==="waiting",j=p&&(p.state==="checking"||p.state==="uploading");if(W==="canceled"&&p.state!=="canceled"||W==="paused"&&q||W==="paused"&&j){if(W==="paused"&&p.params.Body&&typeof p.params.Body.pipe=="function"){console.error("stream not support pause");return}p.state=W,O.emit("inner-kill-task",{TaskId:v,toState:W});try{var I=p&&p.params&&p.params.UploadData.UploadId}catch{}W==="canceled"&&I&&h.removeUsing(I),M(),j&&(X--,Q()),W==="canceled"&&(p.params&&(delete p.params.UploadData,delete p.params.Body,delete p.params),delete p.callback)}re()}};O._addTasks=function(A){x.each(A,function(v){O._addTask(v.api,v.params,v.callback,!0)}),M()};var R=!0;O._addTask=function(A,v,W,p){v=x.formatParams(A,v);var q=x.uuid();v.TaskId=q,v.onTaskReady&&v.onTaskReady(q),v.TaskReady&&(v.TaskReady(q),R&&console.warn('warning: Param "TaskReady" has been deprecated. Please use "onTaskReady" instead.'),R=!1);var j={params:v,callback:W,api:A,index:T.length,id:q,Bucket:v.Bucket,Region:v.Region,Key:v.Key,FilePath:v.FilePath||"",state:"waiting",loaded:0,size:0,speed:0,percent:0,hashPercent:0,error:null,_custom:v._custom},I=v.onHashProgress;v.onHashProgress=function(B){!O._isRunningTask(j.id)||(j.hashPercent=B.percent,I&&I(B),M())};var L=v.onProgress;return v.onProgress=function(B){!O._isRunningTask(j.id)||(j.state==="checking"&&(j.state="uploading"),j.loaded=B.loaded,j.speed=B.speed,j.percent=B.percent,L&&L(B),M())},x.getFileSize(A,v,function(B,P){if(B)return W(x.error(B));H[q]=j,T.push(j),j.size=P,!p&&M(),Q(),re()}),q},O._isRunningTask=function(A){var v=H[A];return!!(v&&(v.state==="checking"||v.state==="uploading"))},O.getTaskList=function(){return x.map(T,U)},O.cancelTask=function(A){ue(A,"canceled")},O.pauseTask=function(A){ue(A,"paused")},O.restartTask=function(A){var v=H[A];v&&(v.state==="paused"||v.state==="error")&&(v.state="waiting",M(),V=Math.min(V,v.index),Q())},O.isUploadRunning=function(){return X||V=0||A.indexOf("wow32")>=0?"win32":A.indexOf("win64")>=0||A.indexOf("wow64")>=0?"win64":v?"mac":"unknown os"},isMobile:function(){var A=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i;return!!((typeof navigator=="undefined"?"undefined":c(navigator))==="object"&&navigator.userAgent.match(A))},isAndroid:function(){var A=/(Android|Adr|Linux)/i;return!!((typeof navigator=="undefined"?"undefined":c(navigator))==="object"&&navigator.userAgent.match(A))},isIOS:function(){var A=/(iPhone|iPod|iPad|iOS)/i;return!!((typeof navigator=="undefined"?"undefined":c(navigator))==="object"&&navigator.userAgent.match(A))},isOtherMobile:function(){return isMobile&&!isAndroid&&!isIOS},getDeviceName:function(){if((typeof navigator=="undefined"?"undefined":c(navigator))!=="object")return"unknown device";var A=navigator.userAgent.toLowerCase();if(A.includes("app/tencent_wemeet"))return"tencent_wemeet";if(A.indexOf("maxthon")>=0){var v=A.match(/maxthon\/([\d.]+)/),W=v&&v[1]||"";return"\u50B2\u6E38\u6D4F\u89C8\u5668 ".concat(W).trim()}if(A.indexOf("qqbrowser")>=0){var p=A.match(/qqbrowser\/([\d.]+)/),q=p&&p[1]||"";return"QQ\u6D4F\u89C8\u5668 ".concat(q).trim()}if(A.indexOf("se 2.x")>=0)return"\u641C\u72D7\u6D4F\u89C8\u5668";if(A.indexOf("wxwork")>=0)return"\u5FAE\u4FE1\u5185\u7F6E\u6D4F\u89C8\u5668";if(A.indexOf("msie")>=0){var j=A.match(/msie ([\d.]+)/),I=j&&j[1]||"";return"IE ".concat(I).trim()}if(A.indexOf("firefox")>=0){var L=A.match(/firefox\/([\d.]+)/),B=L&&L[1]||"";return"Firefox ".concat(B).trim()}if(A.indexOf("chrome")>=0){var P=A.match(/chrome\/([\d.]+)/),K=P&&P[1]||"";return"Chrome ".concat(K).trim()}if(A.indexOf("opera")>=0){var z=A.match(/opera.([\d.]+)/),$=z&&z[1]||"";return"Opera ".concat($).trim()}if(A.indexOf("safari")>=0){var ne=A.match(/version\/([\d.]+)/),ce=ne&&ne[1]||"";return"Safari ".concat(ce).trim()}if(A.indexOf("edge")>=0){var ie=A.match(/edge\/([\d.]+)/),ee=ie&&ie[1]||"";return"edge ".concat(ee).trim()}return A.substr(0,200)}},T={isMobile:O.isMobile(),isBrowser:!O.isMobile(),mobileOsType:O.isAndroid()?"android":O.isIOS?"ios":"other_mobile",pcOsType:O.getOsType()},H={deviceType:T.isMobile?"mobile":T.isBrowser?"browser":"unknown",devicePlatform:T.isMobile?T.mobileOsType:T.pcOsType,deviceName:O.getDeviceName()},X=["multipartInit","multipartUpload","multipartComplete","multipartList","multipartListPart","multipartAbort"],V=["putObject","postObject","appendObject","sliceUploadFile","uploadFile","uploadFiles"].concat(X),U=["getObject"];function M(R){return V.includes(R)?"cos_upload":U.includes(R)?"cos_download":"base_service"}function re(R){return R.replace(/([A-Z])/g,"_$1").toLowerCase()}function Q(R){var A={},v=["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"],W=["tracePlatform","cossdkVersion","region","bucket","appid","networkType","host","accelerate","requestPath","partNumber","size","name","result","tookTime","errorRequestId","retryTimes","reqUrl","customId","deviceType","devicePlatform","deviceName"],p=R.result==="Success"?W:v;for(var q in R)if(!!p.includes(q)){var j=re(q);A[j]=R[q]}return A}var ue=function(){function R(A){h(this,R);var v=A.parent,W=A.traceId,p=A.bucket,q=A.region,j=A.apiName,I=A.fileKey,L=A.fileSize,B=A.accelerate,P=A.customId,K=A.delay,z=A.deepTracker,$=p&&p.substr(p.lastIndexOf("-")+1)||"";this.parent=v,this.deepTracker=z,this.delay=K,this.params={cossdkVersion:S.version,region:q,networkType:"",host:"",accelerate:B?"Y":"N",requestPath:I||"",size:L||-1,httpMd5:0,httpSign:0,httpFull:0,name:j||"",result:"",tookTime:0,errorNode:"",errorCode:"",errorMessage:"",errorRequestId:"",errorStatusCode:0,errorServiceName:"",tracePlatform:"cos-js-sdk-v5",traceId:W||O.getUid(),bucket:p,appid:$,partNumber:0,retryTimes:0,reqUrl:"",customId:P||"",deviceType:H.deviceType,devicePlatform:H.devicePlatform,deviceName:H.deviceName,md5StartTime:0,md5EndTime:0,signStartTime:0,signEndTime:0,httpStartTime:0,httpEndTime:0,startTime:new Date().getTime(),endTime:0},this.beacon=N(K)}return x(R,[{key:"formatResult",value:function(v,W){var p,q,j,I,L,B,P=new Date().getTime(),K=P-this.params.startTime,z=O.getNetType(),$=v?(v==null?void 0:v.code)||(v==null||(p=v.error)===null||p===void 0?void 0:p.code)||(v==null||(q=v.error)===null||q===void 0?void 0:q.Code):"",ne=v?(v==null?void 0:v.message)||(v==null||(j=v.error)===null||j===void 0?void 0:j.message)||(v==null||(I=v.error)===null||I===void 0?void 0:I.Message):"",ce=v?(v==null?void 0:v.resource)||(v==null||(L=v.error)===null||L===void 0?void 0:L.resource)||(v==null||(B=v.error)===null||B===void 0?void 0:B.Resource):"",ie=v?v==null?void 0:v.statusCode:W.statusCode,ee=v?(v==null?void 0:v.headers)&&(v==null?void 0:v.headers["x-cos-request-id"]):(W==null?void 0:W.headers)&&(W==null?void 0:W.headers["x-cos-request-id"]),le=v?ee?"Server":"Client":"";if(Object.assign(this.params,{tookTime:K,networkType:z,httpMd5:this.params.md5EndTime-this.params.md5StartTime,httpSign:this.params.signEndTime-this.params.signStartTime,httpFull:this.params.httpEndTime-this.params.httpStartTime,result:v?"Fail":"Success",errorType:le,errorCode:$,errorStatusCode:ie,errorMessage:ne,errorServiceName:ce,errorRequestId:ee}),v&&(!$||!ne)&&(this.params.fullError=v?JSON.stringify(v):""),this.params.name==="getObject"&&(this.params.size=W?W.headers&&W.headers["content-length"]:-1),this.params.reqUrl)try{var se=/^http(s)?:\/\/(.*?)\//.exec(this.params.reqUrl);this.params.host=se[2]}catch{this.params.host=this.params.reqUrl}this.sendEvents()}},{key:"setParams",value:function(v){Object.assign(this.params,v)}},{key:"sendEvents",value:function(){if(!(X.includes(this.params.name)&&!this.deepTracker)){var v=M(this.params.name),W=Q(this.params);this.beacon||(this.beacon=N(this.delay||5e3)),this.delay===0?this.beacon&&this.beacon.onDirectUserAction(v,W):this.beacon&&this.beacon.onUserAction(v,W)}}},{key:"generateSubTracker",value:function(v){return Object.assign(v,{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 R(v)}}]),R}();g.exports=ue},"./src/util.js":function(g,m,u){(function(h){var x=u("./node_modules/@babel/runtime/helpers/typeof.js"),c=u("./lib/md5.js"),S=u("./lib/crypto.js"),_=u("./lib/xml2json.js"),N=u("./lib/json2xml.js"),O=u("./lib/base64.js"),T=u("./src/tracker.js");function H(oe){return encodeURIComponent(oe).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function X(oe,s){var n=[];for(var r in oe)oe.hasOwnProperty(r)&&n.push(s?H(r).toLowerCase():r);return n.sort(function(o,f){return o=o.toLowerCase(),f=f.toLowerCase(),o===f?0:o>f?1:-1})}var V=function(s,n){var r,o,f,b=[],k=X(s);for(r=0;r-1||U.indexOf(o)>-1)&&(n[r]=s[r])}return n},re=function(s){s=s||{};var n=s.SecretId,r=s.SecretKey,o=s.KeyTime,f=(s.method||s.Method||"get").toLowerCase(),b=P(s.Query||s.params||{}),k=M(P(s.Headers||s.headers||{})),G=s.Key||"",de;s.UseRawKey?de=s.Pathname||s.pathname||"/"+G:(de=s.Pathname||s.pathname||G,de.indexOf("/")!==0&&(de="/"+de));var he=s.ForceSignHost!==!1;if(!k.Host&&!k.host&&s.Bucket&&s.Region&&he&&(k.Host=s.Bucket+".cos."+s.Region+".myqcloud.com"),!n)throw new Error("missing param SecretId");if(!r)throw new Error("missing param SecretKey");var J=Math.round(ve(s.SystemClockOffset)/1e3)-1,Se=J,_e=s.Expires||s.expires;_e===void 0?Se+=900:Se+=_e*1||0;var Ue="sha1",Re=n,Le=o||J+";"+Se,ze=o||J+";"+Se,Ve=X(k,!0).join(";").toLowerCase(),We=X(b,!0).join(";").toLowerCase(),Ke=S.HmacSHA1(ze,r).toString(),Ge=[f,de,Pe.obj2str(b,!0),Pe.obj2str(k,!0),""].join(`
`),Xe=["sha1",Le,S.SHA1(Ge).toString(),""].join(`
`),rt=S.HmacSHA1(Xe,Ke).toString(),et=["q-sign-algorithm="+Ue,"q-ak="+Re,"q-sign-time="+Le,"q-key-time="+ze,"q-header-list="+Ve,"q-url-param-list="+We,"q-signature="+rt].join("&");return et},Q=function(s,n,r){var o=n/8,f=s.slice(r,r+o);return new Uint8Array(f).reverse(),new{8:Uint8Array,16:Uint16Array,32:Uint32Array}[n](f)[0]},ue=function(s,n,r,o){var f=s.slice(n,r),b="";return new Uint8Array(f).forEach(function(k){b+=String.fromCharCode(k)}),o&&(b=decodeURIComponent(escape(b))),b},R=function(s){for(var n={},r=ue(s),o={records:[]};s.byteLength;){var f=Q(s,32,0),b=Q(s,32,4),k=f-b-16,G=0,de;for(s=s.slice(12);GparseInt(o[f])?1:-1;return 0},s=function(r){if(!r)return!1;var o=(r.match(/Chrome\/([.\d]+)/)||[])[1],f=(r.match(/QBCore\/([.\d]+)/)||[])[1],b=(r.match(/QQBrowser\/([.\d]+)/)||[])[1],k=o&&oe(o,"53.0.2785.116")<0&&f&&oe(f,"3.53.991.400")<0&&b&&oe(b,"9.0.2524.400")<=0||!1;return k};return s(typeof navigator!="undefined"&&navigator.userAgent)}(),j=function(s,n,r,o,f){var b;if(s.slice?b=s.slice(n,r):s.mozSlice?b=s.mozSlice(n,r):s.webkitSlice&&(b=s.webkitSlice(n,r)),o&&q){var k=new FileReader;k.onload=function(G){b=null,f(new Blob([k.result]))},k.readAsArrayBuffer(b)}else f(b)},I=function(s,n,r,o){r=r||v,s?typeof n=="string"?r(Pe.md5(n,!0)):Blob&&n instanceof Blob?Pe.getFileMd5(n,function(f,b){r(b)},o):r():r()},L=1024*1024,B=function(s,n,r){var o=s.size,f=0,b=c.getCtx(),k=function G(de){if(de>=o){var he=b.digest("hex");n(null,he);return}var J=Math.min(o,de+L);Pe.fileSlice(s,de,J,!1,function(Se){p(Se,function(_e){Se=null,b=b.update(_e,!0),f+=_e.length,_e=null,r&&r({loaded:f,total:o,percent:Math.round(f/o*1e4)/1e4}),G(de+L)})})};k(0)};function P(oe){return ee(oe,function(s){return x(s)==="object"&&s!==null?P(s):s})}function K(oe,s,n){return oe&&s in oe?oe[s]:n}function z(oe,s){return ie(s,function(n,r){oe[r]=s[r]}),oe}function $(oe){return oe instanceof Array}function ne(oe,s){for(var n=!1,r=0;r-1,G=!b||typeof b=="string"&&b.indexOf("{Region}")>-1;if(s.indexOf("Bucket")>-1||s==="deleteMultipleObject"||s==="multipartList"||s==="listObjectVersions"){if(k&&!r)return"Bucket";if(G&&!o)return"Region"}else if(s.indexOf("Object")>-1||s.indexOf("multipart")>-1||s==="sliceUploadFile"||s==="abortUploadTask"){if(k&&!r)return"Bucket";if(G&&!o)return"Region";if(!f)return"Key"}return!1},te=function(s,n){if(n=z({},n),s!=="getAuth"&&s!=="getV4Auth"&&s!=="getObjectUrl"){var r=n.Headers||{};if(n&&x(n)==="object"){(function(){for(var f in n)n.hasOwnProperty(f)&&f.indexOf("x-cos-")>-1&&(r[f]=n[f])})();var o={"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","Pic-Operations":"PicOperations"};Pe.each(o,function(f,b){n[f]!==void 0&&(r[b]=n[f])}),n.Headers=W(r)}}return n},pe=function(s,n){return function(r,o){var f=this;typeof r=="function"&&(o=r,r={}),r=te(s,r);var b;if(f.options.EnableTracker)if(r.calledBySdk==="sliceUploadFile")b=r.tracker&&r.tracker.generateSubTracker({apiName:s});else if(["uploadFile","uploadFiles"].includes(s))b=null;else{var k=-1;r.Body&&(k=typeof r.Body=="string"?r.Body.length:r.Body.size||r.Body.byteLength||-1),b=new T({bucket:r.Bucket,region:r.Region,apiName:s,fileKey:r.Key,fileSize:k,deepTracker:f.options.DeepTracker,customId:f.options.CustomId,delay:f.options.TrackerDelay})}r.tracker=b;var G=function(Re){return Re&&Re.headers&&(Re.headers["x-cos-request-id"]&&(Re.RequestId=Re.headers["x-cos-request-id"]),Re.headers["x-ci-request-id"]&&(Re.RequestId=Re.headers["x-ci-request-id"]),Re.headers["x-cos-version-id"]&&(Re.VersionId=Re.headers["x-cos-version-id"]),Re.headers["x-cos-delete-marker"]&&(Re.DeleteMarker=Re.headers["x-cos-delete-marker"])),Re},de=function(Re,Le){b&&b.formatResult(Re,Le),o&&o(G(Re),G(Le))},he=function(){if(s!=="getService"&&s!=="abortUploadTask"){var Re=Y.call(f,s,r);if(Re)return"missing param "+Re;if(r.Region){if(f.options.CompatibilityMode){if(!/^([a-z\d-.]+)$/.test(r.Region))return"Region format error."}else{if(r.Region.indexOf("cos.")>-1)return'param Region should not be start with "cos."';if(!/^([a-z\d-]+)$/.test(r.Region))return"Region format error."}!f.options.CompatibilityMode&&r.Region.indexOf("-")===-1&&r.Region!=="yfb"&&r.Region!=="default"&&r.Region!=="accelerate"&&console.warn("warning: param Region format error, find help here: https://cloud.tencent.com/document/product/436/6224")}if(r.Bucket){if(!/^([a-z\d-]+)-(\d+)$/.test(r.Bucket))if(r.AppId)r.Bucket=r.Bucket+"-"+r.AppId;else if(f.options.AppId)r.Bucket=r.Bucket+"-"+f.options.AppId;else return'Bucket should format as "test-1250000000".';r.AppId&&(console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g Bucket:"test-1250000000" ).'),delete r.AppId)}!f.options.UseRawKey&&r.Key&&r.Key.substr(0,1)==="/"&&(r.Key=r.Key.substr(1))}},J=he(),Se=["getAuth","getObjectUrl"].includes(s);if(typeof Promise=="function"&&!Se&&!o)return new Promise(function(Ue,Re){if(o=function(ze,Ve){ze?Re(ze):Ue(Ve)},J)return de(Pe.error(new Error(J)));n.call(f,r,de)});if(J)return de(Pe.error(new Error(J)));var _e=n.call(f,r,de);if(Se)return _e}},me=function(s,n){var r=this,o=0,f=0,b=Date.now(),k,G;function de(){if(G=0,n&&typeof n=="function"){k=Date.now();var he=Math.max(0,Math.round((f-o)/((k-b)/1e3)*100)/100)||0,J;f===0&&s===0?J=1:J=Math.floor(f/s*100)/100||0,b=k,o=f;try{n({loaded:f,total:s,speed:he,percent:J})}catch{}}}return function(he,J){if(he&&(f=he.loaded,s=he.total),J)clearTimeout(G),de();else{if(G)return;G=setTimeout(de,r.options.ProgressInterval)}}},ge=function(s,n,r){var o;if(typeof n.Body=="string"?n.Body=new Blob([n.Body],{type:"text/plain"}):n.Body instanceof ArrayBuffer&&(n.Body=new Blob([n.Body])),n.Body&&(n.Body instanceof Blob||n.Body.toString()==="[object File]"||n.Body.toString()==="[object Blob]"))o=n.Body.size;else{r(Pe.error(new Error("params body format error, Only allow File|Blob|String.")));return}n.ContentLength=o,r(null,o)},ve=function(s){return Date.now()+(s||0)},Ce=function(s,n){var r=s;return s.message=s.message||null,typeof n=="string"?(s.error=n,s.message=n):x(n)==="object"&&n!==null&&(z(s,n),(n.code||n.name)&&(s.code=n.code||n.name),n.message&&(s.message=n.message),n.stack&&(s.stack=n.stack)),typeof Object.defineProperty=="function"&&(Object.defineProperty(s,"name",{writable:!0,enumerable:!1}),Object.defineProperty(s,"message",{enumerable:!0})),s.name=n&&n.name||s.name||s.code||"Error",s.code||(s.code=s.name),s.error||(s.error=P(r)),s},De=function(){return(typeof globalThis=="undefined"?"undefined":x(globalThis))==="object"&&(globalThis.constructor.name==="DedicatedWorkerGlobalScope"||globalThis.FileReaderSync)},be=function(){return(typeof window=="undefined"?"undefined":x(window))!=="object"&&(typeof h=="undefined"?"undefined":x(h))==="object"&&!0&&!De()},Te=function(s){return/^https?:\/\/([^/]+\.)?ci\.[^/]+/.test(s)},ke=function(){if((typeof navigator=="undefined"?"undefined":x(navigator))!=="object")return!1;var oe=navigator.userAgent,s=!!oe.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);return s}(),Fe=function(){return(typeof navigator=="undefined"?"undefined":x(navigator))!=="object"?!1:/\sQQ/i.test(navigator.userAgent)}(),Me=function(s,n){var r=O.encode(s);return n&&(r=r.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")),r},Pe={noop:v,formatParams:te,apiWrapper:pe,xml2json:_,json2xml:N,md5:c,clearKey:W,fileSlice:j,getBodyMd5:I,getFileMd5:B,b64:se,extend:z,isArray:$,isInArray:ne,makeArray:ce,each:ie,map:ee,filter:le,clone:P,attr:K,uuid:ye,camSafeUrlEncode:H,throttleOnProgress:me,getFileSize:ge,getSkewTime:ve,error:Ce,obj2str:V,getAuth:re,parseSelectPayload:R,getSourceParams:A,isBrowser:!0,isNode:be,isCIHost:Te,isIOS_QQ:ke&&Fe,encodeBase64:Me};g.exports=Pe}).call(this,u("./node_modules/process/browser.js"))}})})})(cosJsSdkV5);var COS=getDefaultExportFromCjs(cosJsSdkV5.exports);const ossSwitch="tencent",tencentBucket="daya-online-1303457149",getUploadSign=async(g,m=!1)=>{const{bucketName:u,filename:h,postData:x}=g,c=ossSwitch;let S=u,_=h,N={};return S=tencentBucket,_="klx/"+h,N={key:"klx/"+x.key},request.post(state.platformApi+"/open/getUploadSign",{hideLoading:m,data:{postData:N,pluginName:c,bucketName:S,filename:_},params:{pluginName:c}})},onOnlyFileUpload=async(g,m)=>{{let u="",h=null;if(await new COS({Domain:"https://oss.dayaedu.com",getAuthorization:async(c,S)=>{S({Authorization:m.signature})}}).uploadFile({Bucket:tencentBucket,Region:"ap-nanjing",Key:`klx/${m.name}`,Body:m.file,SliceSize:1024*1024*500}).then(c=>{var S;((S=c.Location)==null?void 0:S.indexOf("http"))>=0?u=c.Location:u="https://"+c.Location}).catch(c=>{h=c}),u)return u;throw new Error(h)}};export{getUploadSign as g,onOnlyFileUpload as o};