import{bb as commonjsGlobal,bc as getDefaultExportFromCjs,H as request,d as defineComponent,e as reactive,r as ref,f as createVNode,aB as NGrid,aC as NGi,x as NSpace,j as NButton,k as createTextVNode,S as nextTick,b as useMessage,A as watch,O as NUpload,l as NModal,m as modalClickMask}from"./index-efb66432-1734950731618.js";var cosJsSdkV5={exports:{}};(function(module,exports){(function(n,e){module.exports=e()})(commonjsGlobal,function(){return function(o){var n={};function e(t){if(n[t])return n[t].exports;var l=n[t]={i:t,l:!1,exports:{}};return o[t].call(l.exports,l,l.exports,e),l.l=!0,l.exports}return e.m=o,e.c=n,e.d=function(t,l,r){e.o(t,l)||Object.defineProperty(t,l,{enumerable:!0,get:r})},e.r=function(t){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,l){if(l&1&&(t=e(t)),l&8||l&4&&typeof t=="object"&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),l&2&&typeof t!="string")for(var u in t)e.d(r,u,(function(T){return t[T]}).bind(null,u));return r},e.n=function(t){var l=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(l,"a",l),l},e.o=function(t,l){return Object.prototype.hasOwnProperty.call(t,l)},e.p="/dist/",e(e.s="./index.js")}({"./index.js":function(o,n,e){var t=e("./src/cos.js");o.exports=t},"./lib/base64.js":function(o,n){var e=function(t){t=t||{};var l=t.Base64,r="2.1.9",u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",T=function(H){for(var K={},_=0,V=H.length;_>>6)+w(128|_&63):w(224|_>>>12&15)+w(128|_>>>6&63)+w(128|_&63)}else{var _=65536+(K.charCodeAt(0)-55296)*1024+(K.charCodeAt(1)-56320);return w(240|_>>>18&7)+w(128|_>>>12&63)+w(128|_>>>6&63)+w(128|_&63)}},S=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,A=function(K){return K.replace(S,x)},D=function(K){var _=[0,2,1][K.length%3],V=K.charCodeAt(0)<<16|(K.length>1?K.charCodeAt(1):0)<<8|(K.length>2?K.charCodeAt(2):0),X=[u.charAt(V>>>18),u.charAt(V>>>12&63),_>=2?"=":u.charAt(V>>>6&63),_>=1?"=":u.charAt(V&63)];return X.join("")},z=t.btoa?function(H){return t.btoa(H)}:function(H){return H.replace(/[\s\S]{1,3}/g,D)},P=function(H){return z(A(H))},L=function(K,_){return _?P(String(K)).replace(/[+\/]/g,function(V){return V=="+"?"-":"_"}).replace(/=/g,""):P(String(K))},Y=function(K){return L(K,!0)},W=new RegExp(["[À-ß][€-¿]","[à-ï][€-¿]{2}","[ð-÷][€-¿]{3}"].join("|"),"g"),ie=function(K){switch(K.length){case 4:var _=(7&K.charCodeAt(0))<<18|(63&K.charCodeAt(1))<<12|(63&K.charCodeAt(2))<<6|63&K.charCodeAt(3),V=_-65536;return w((V>>>10)+55296)+w((V&1023)+56320);case 3:return w((15&K.charCodeAt(0))<<12|(63&K.charCodeAt(1))<<6|63&K.charCodeAt(2));default:return w((31&K.charCodeAt(0))<<6|63&K.charCodeAt(1))}},B=function(K){return K.replace(W,ie)},E=function(K){var _=K.length,V=_%4,X=(_>0?T[K.charAt(0)]<<18:0)|(_>1?T[K.charAt(1)]<<12:0)|(_>2?T[K.charAt(2)]<<6:0)|(_>3?T[K.charAt(3)]:0),G=[w(X>>>16),w(X>>>8&255),w(X&255)];return G.length-=[0,0,2,1][V],G.join("")},C=t.atob?function(H){return t.atob(H)}:function(H){return H.replace(/[\s\S]{1,4}/g,E)},k=function(H){return B(C(H))},g=function(K){return k(String(K).replace(/[-_]/g,function(_){return _=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},U=function(){var K=t.Base64;return t.Base64=l,K},F={VERSION:r,atob:C,btoa:z,fromBase64:g,toBase64:L,utob:A,encode:L,encodeURI:Y,btou:B,decode:g,noConflict:U};return F}();o.exports=e},"./lib/beacon.min.js":function(o,n,e){var t,l,r=e("./node_modules/@babel/runtime/helpers/typeof.js");(function(u,T){r(n)=="object"&&typeof o<"u"?o.exports=T():(t=T,l=typeof t=="function"?t.call(n,e,n,o):t,l!==void 0&&(o.exports=l))})(this,function(){var u=function(c,a){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,m){d.__proto__=m}||function(d,m){for(var I in m)Object.prototype.hasOwnProperty.call(m,I)&&(d[I]=m[I])},u(c,a)},T=function(){return T=Object.assign||function(c){for(var a,d=1,m=arguments.length;d0&&m[m.length-1])||J[0]!==6&&J[0]!==2)){M=0;continue}if(J[0]===3&&(!m||J[1]>m[0]&&J[1]"u"?"3":"4",mainAppKey:this.appkey,appVersion:c,sdkVersion:a.sdkVersion,osVersion:a.userAgent,model:"",packageName:"",params:{A3:a.deviceId}}).then(function(I){if(I.data.ret==0)try{var M=JSON.parse(I.data.beaconConfig);M&&(m.processData(M),m.storage.setItem(P,I.data.beaconConfig))}catch(Q){}else m.processData(null),m.storage.setItem(P,"")}).catch(function(I){})},h.prototype.processData=function(c){var a,d,m,I,M;this.strategy.isEventUpOnOff=(a=c==null?void 0:c.isEventUpOnOff)!==null&&a!==void 0?a:this.strategy.isEventUpOnOff,this.strategy.httpsUploadUrl=(d=c==null?void 0:c.httpsUploadUrl)!==null&&d!==void 0?d:this.strategy.httpsUploadUrl,this.strategy.requestInterval=(m=c==null?void 0:c.requestInterval)!==null&&m!==void 0?m:this.strategy.requestInterval,this.strategy.blacklist=(I=c==null?void 0:c.blacklist)!==null&&I!==void 0?I:this.strategy.blacklist,this.strategy.samplelist=(M=c==null?void 0:c.samplelist)!==null&&M!==void 0?M:this.strategy.samplelist;for(var Q=0,de=this.strategy.samplelist;Q60*this.strategy.requestInterval*1e3},h.prototype.getUploadUrl=function(){return this.strategy.httpsUploadUrl+"?appkey="+this.appkey},h.prototype.isBlackEvent=function(c){return this.strategy.blacklist.indexOf(c)!=-1},h.prototype.isEventUpOnOff=function(){return this.strategy.isEventUpOnOff},h.prototype.isSampleEvent=function(c){return!!Object.prototype.hasOwnProperty.call(this.realSample,c)&&this.realSample[c]this.duration)return this.createSession();a=m.sessionId,d=m.sessionStart,this.getSessionStackDepth=0}catch(M){}return{sessionId:a,sessionStart:d}},h.prototype.createSession=function(){var c=Date.now(),a={sessionId:this.appkey+"_"+c.toString(),sessionStart:c};this.storage.setItem(U,JSON.stringify(a)),this.storage.setItem(D,c.toString());var d="is_new_user",m=this.storage.getItem(d);return this.getSessionStackDepth<=1&&this.beacon.onDirectUserAction("rqd_applaunched",{A21:m?"N":"Y"}),this.storage.setItem(d,JSON.stringify(!1)),a},h}();function H(){var h=navigator.userAgent,c=h.indexOf("compatible")>-1&&h.indexOf("MSIE")>-1,a=h.indexOf("Edge")>-1&&!c,d=h.indexOf("Trident")>-1&&h.indexOf("rv:11.0")>-1;if(c){new RegExp("MSIE (\\d+\\.\\d+);").test(h);var m=parseFloat(RegExp.$1);return m==7?7:m==8?8:m==9?9:m==10?10:6}return a?-2:d?11:-1}function K(h,c){var a,d;return(a="https://tun-cos-1258344701.file.myqcloud.com/fp.js",d===void 0&&(d=Date.now()+"-"+Math.random()),new Promise(function(m,I){if(document.getElementById(d))m(void 0);else{var M=document.getElementsByTagName("head")[0],Q=document.createElement("script");Q.onload=function(){return function(){Q.onload=null,m(void 0)}},Q.onerror=function(de){Q.onerror=null,M.removeChild(Q),I(de)},Q.src=a,Q.id=d,M.appendChild(Q)}})).then(function(){new Fingerprint().getQimei36(h,c)}).catch(function(m){}),""}var _=function(){return(_=Object.assign||function(c){for(var a,d=1,m=arguments.length;d0||!window.indexedDB||/X5Lite/.test(navigator.userAgent)?(this.store=new ue(a),this.dbEventCount=this.store.getCount()):(this.store=new re(c),this.getCount().then(function(m){d.dbEventCount=m}).catch(function(m){}))}return h.prototype.getCount=function(){return w(this,void 0,void 0,function(){return x(this,function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),[4,this.store.getCount()];case 1:return[2,c.sent()];case 2:return c.sent(),[2,Promise.reject()];case 3:return[2]}})})},h.prototype.insertEvent=function(c,a){return w(this,void 0,void 0,function(){var d,m;return x(this,function(I){switch(I.label){case 0:if(this.dbEventCount>=1e4)return[2,Promise.reject()];d=B(c.mapValue),I.label=1;case 1:return I.trys.push([1,3,,4]),this.dbEventCount++,[4,this.store.setItem(d,c)];case 2:return[2,I.sent()];case 3:return m=I.sent(),a&&a(m,c),this.dbEventCount--,[2,Promise.reject()];case 4:return[2]}})})},h.prototype.getEvents=function(){return w(this,void 0,void 0,function(){var c;return x(this,function(a){switch(a.label){case 0:c=[],a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.store.iterate(function(d){c.push(d)})];case 2:return a.sent(),[2,Promise.all(c)];case 3:return a.sent(),[2,Promise.all(c)];case 4:return[2]}})})},h.prototype.removeEvent=function(c){return w(this,void 0,void 0,function(){var a;return x(this,function(d){switch(d.label){case 0:a=B(c.mapValue),d.label=1;case 1:return d.trys.push([1,3,,4]),this.dbEventCount--,[4,this.store.removeItem(a)];case 2:return[2,d.sent()];case 3:return d.sent(),this.dbEventCount++,[2,Promise.reject()];case 4:return[2]}})})},h}(),ee=function(){return(ee=Object.assign||function(c){for(var a,d=1,m=arguments.length;d0&&m[m.length-1])||J[0]!==6&&J[0]!==2)){M=0;continue}if(J[0]===3&&(!m||J[1]>m[0]&&J[1]0&&M<8,d.isUnderIE8||(d.isUnderIE=M>0,a.needInitQimei&&K(a.appkey,function(Q){d.qimei36=Q.q36}),d.network=new De(a),d.storage=new He(a.appkey),d.initCommonInfo(a),d.store=new oe(a.appkey,d.storage),d.errorReport=new k(d.config,d.commonInfo,"web",d.network),d.strategy=new g(a.needQueryConfig==null||a.needQueryConfig,d.config,d.commonInfo,d.storage,d.network),d.logidStartTime=d.storage.getItem(Pe),d.logidStartTime||(d.logidStartTime=Date.now().toString(),d.storage.setItem(Pe,d.logidStartTime)),m=d.logidStartTime,I=Date.now()-Number.parseFloat(m),Math.floor(I/864e5)>=365&&d.storage.clear(),d.initSession(a),d.onDirectUserAction("rqd_js_init",{}),setTimeout(function(){return d.lifeCycle.emit("init")},0),d.initDelayTime=a.delay?a.delay:1e3,d.cycleTask(d.initDelayTime)),d}return function(a,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");function m(){this.constructor=a}u(a,d),a.prototype=d===null?Object.create(d):(m.prototype=d.prototype,new m)}(c,h),c.prototype.initSession=function(a){var d=18e5;a.sessionDuration&&a.sessionDuration>3e4&&(d=a.sessionDuration),this.beaconSession=new F(this.storage,d,this)},c.prototype.initCommonInfo=function(a){var d=Number(this.storage.getItem(D));try{var m=JSON.parse(this.storage.getItem(z));(Date.now()-d>3e4||!m)&&this.storage.setItem(z,JSON.stringify([]))}catch(M){}a.uploadUrl&&(this.uploadUrl=a.uploadUrl+"?appkey="+a.appkey);var I=[window.screen.width,window.screen.height];window.devicePixelRatio&&I.push(window.devicePixelRatio),this.commonInfo={deviceId:this.storage.createDeviceId(),language:navigator&&navigator.language||"zh_CN",query:window.location.search,userAgent:navigator.userAgent,pixel:I.join("*"),channelID:a.channelID?String(a.channelID):"",openid:a.openid?String(a.openid):"",unid:a.unionid?String(a.unionid):"",sdkVersion:se},this.config.appVersion=a.versionCode?String(a.versionCode):"",this.config.strictMode=a.strictMode},c.prototype.cycleTask=function(a){var d=this;this.intervalID=window.setInterval(function(){d.pauseSearching||d.store.getEvents().then(function(m){m.length==0&&(d.pauseSearching=!0);var I=[],M=JSON.parse(d.storage.getItem(z));M||(M=[]),m&&m.forEach(function(Q){var de=B(Q.mapValue);M.indexOf(de)==-1&&(I.push(Q),M.push(de))}),I.length!=0&&(d.storage.setItem(z,JSON.stringify(M)),d._normalLogPipeline(d.assembleData(I)))}).catch(function(m){})},a)},c.prototype.onReport=function(a,d,m){var I=this;if(this.isUnderIE8)this.errorReport.reportError("601","UnderIE8");else{this.pauseSearching=!1;var M=this.generateData(a,d,m);if(m&&this.delayTime==0&&!this.underWeakNet)this._normalLogPipeline(this.assembleData(M));else{var Q=M.shift();Q&&this.store.insertEvent(Q,function(de){de&&I.errorReport.reportError("604","insertEvent fail!")}).catch(function(de){I._normalLogPipeline(I.assembleData(M))})}}},c.prototype.onSendBeacon=function(a,d){if(this.isUnderIE)this.errorReport.reportError("605","UnderIE");else{this.pauseSearching=!1;var m=this.assembleData(this.generateData(a,d,!0));typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(this.uploadUrl||this.strategy.getUploadUrl(),JSON.stringify(m))}},c.prototype.generateData=function(a,d,m){var I=[],M="4.5.14-web_"+(m?"direct_log_id":"normal_log_id"),Q=Number(this.storage.getItem(M));return Q=Q||1,d=T(T({},d),{A99:m?"Y":"N",A100:Q.toString(),A72:se,A88:this.logidStartTime}),Q++,this.storage.setItem(M,Q.toString()),I.push({eventCode:a,eventTime:Date.now().toString(),mapValue:W(d,this.config.strictMode)}),I},c.prototype.assembleData=function(a){var d=this.beaconSession.getSession();return{appVersion:this.config.appVersion?ie(this.config.appVersion):"",sdkId:"js",sdkVersion:se,mainAppKey:this.config.appkey,platformId:3,common:W(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:d.sessionId,A101:this.commonInfo.userAgent,A102:window.location.href,A104:document.referrer,A119:this.commonInfo.query,A153:this.qimei36}),!1),events:a}},c.prototype.monitorUploadFailed=function(){this.uselessCycleTaskNum++,this.uselessCycleTaskNum>=5&&(window.clearInterval(this.intervalID),this.cycleTask(6e4),this.underWeakNet=!0)},c.prototype.doCustomCycleTask=function(){this.uselessCycleTaskNum>=5&&(window.clearInterval(this.intervalID),this.cycleTask(this.initDelayTime)),this.uselessCycleTaskNum=0,this.underWeakNet=!1},c}(C)})},"./lib/crypto.js":function(o,n,e){(function(t){var l=e("./node_modules/@babel/runtime/helpers/typeof.js"),r=r||function(u,T){var w={},x=w.lib={},S=function(){},A=x.Base={extend:function(E){S.prototype=this;var C=new S;return E&&C.mixIn(E),C.hasOwnProperty("init")||(C.init=function(){C.$super.init.apply(this,arguments)}),C.init.prototype=C,C.$super=this,C},create:function(){var E=this.extend();return E.init.apply(E,arguments),E},init:function(){},mixIn:function(E){for(var C in E)E.hasOwnProperty(C)&&(this[C]=E[C]);E.hasOwnProperty("toString")&&(this.toString=E.toString)},clone:function(){return this.init.prototype.extend(this)}},D=x.WordArray=A.extend({init:function(E,C){E=this.words=E||[],this.sigBytes=C!=T?C:4*E.length},toString:function(E){return(E||P).stringify(this)},concat:function(E){var C=this.words,k=E.words,g=this.sigBytes;if(E=E.sigBytes,this.clamp(),g%4)for(var U=0;U>>2]|=(k[U>>>2]>>>24-8*(U%4)&255)<<24-8*((g+U)%4);else if(65535>>2]=k[U>>>2];else C.push.apply(C,k);return this.sigBytes+=E,this},clamp:function(){var E=this.words,C=this.sigBytes;E[C>>>2]&=4294967295<<32-8*(C%4),E.length=u.ceil(C/4)},clone:function(){var E=A.clone.call(this);return E.words=this.words.slice(0),E},random:function(E){for(var C=[],k=0;k>>2]>>>24-8*(g%4)&255;k.push((U>>>4).toString(16)),k.push((U&15).toString(16))}return k.join("")},parse:function(E){for(var C=E.length,k=[],g=0;g>>3]|=parseInt(E.substr(g,2),16)<<24-4*(g%8);return new D.init(k,C/2)}},L=z.Latin1={stringify:function(E){var C=E.words;E=E.sigBytes;for(var k=[],g=0;g>>2]>>>24-8*(g%4)&255));return k.join("")},parse:function(E){for(var C=E.length,k=[],g=0;g>>2]|=(E.charCodeAt(g)&255)<<24-8*(g%4);return new D.init(k,C)}},Y=z.Utf8={stringify:function(E){try{return decodeURIComponent(escape(L.stringify(E)))}catch(C){throw Error("Malformed UTF-8 data")}},parse:function(E){return L.parse(unescape(encodeURIComponent(E)))}},W=x.BufferedBlockAlgorithm=A.extend({reset:function(){this._data=new D.init,this._nDataBytes=0},_append:function(E){typeof E=="string"&&(E=Y.parse(E)),this._data.concat(E),this._nDataBytes+=E.sigBytes},_process:function(E){var C=this._data,k=C.words,g=C.sigBytes,U=this.blockSize,F=g/(4*U),F=E?u.ceil(F):u.max((F|0)-this._minBufferSize,0);if(E=F*U,g=u.min(4*E,g),E){for(var H=0;HE;E++){if(16>E)x[E]=D[z+E]|0;else{var C=x[E-3]^x[E-8]^x[E-14]^x[E-16];x[E]=C<<1|C>>>31}C=(L<<5|L>>>27)+B+x[E],C=20>E?C+((Y&W|~Y&ie)+1518500249):40>E?C+((Y^W^ie)+1859775393):60>E?C+((Y&W|Y&ie|W&ie)-1894007588):C+((Y^W^ie)-899497514),B=ie,ie=W,W=Y<<30|Y>>>2,Y=L,L=C}P[0]=P[0]+L|0,P[1]=P[1]+Y|0,P[2]=P[2]+W|0,P[3]=P[3]+ie|0,P[4]=P[4]+B|0},_doFinalize:function(){var D=this._data,z=D.words,P=8*this._nDataBytes,L=8*D.sigBytes;return z[L>>>5]|=128<<24-L%32,z[(L+64>>>9<<4)+14]=Math.floor(P/4294967296),z[(L+64>>>9<<4)+15]=P,D.sigBytes=4*z.length,this._process(),this._hash},clone:function(){var D=w.clone.call(this);return D._hash=this._hash.clone(),D}});u.SHA1=w._createHelper(S),u.HmacSHA1=w._createHmacHelper(S)})(),function(){var u=r,T=u.enc.Utf8;u.algo.HMAC=u.lib.Base.extend({init:function(x,S){x=this._hasher=new x.init,typeof S=="string"&&(S=T.parse(S));var A=x.blockSize,D=4*A;S.sigBytes>D&&(S=x.finalize(S)),S.clamp();for(var z=this._oKey=S.clone(),P=this._iKey=S.clone(),L=z.words,Y=P.words,W=0;W>>2]>>>24-Y%4*8&255,ie=D[Y+1>>>2]>>>24-(Y+1)%4*8&255,B=D[Y+2>>>2]>>>24-(Y+2)%4*8&255,E=W<<16|ie<<8|B,C=0;C<4&&Y+C*.75>>6*(3-C)&63));var k=P.charAt(64);if(k)for(;L.length%4;)L.push(k);return L.join("")},parse:function(A){var D=A.length,z=this._map,P=z.charAt(64);if(P){var L=A.indexOf(P);L!=-1&&(D=L)}for(var Y=[],W=0,ie=0;ie>>6-ie%4*2;Y[W>>>2]|=(B|E)<<24-W%4*8,W++}return w.create(Y,W)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),l(t)==="object"?t.exports=r:window.CryptoJS=r}).call(this,e("./node_modules/webpack/buildin/module.js")(o))},"./lib/json2xml.js":function(o,n,e){var t=e("./node_modules/@babel/runtime/helpers/typeof.js"),l="a-zA-Z_À-ÖØ-öø-ÿͰ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿿、-퟿豈-﷏ﷰ-�",r="-.0-9·̀-ͯ‿⁀",u=new RegExp("^([^"+l+"])|^((x|X)(m|M)(l|L))|([^"+l+r+"])","g"),T=/[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm,w=function(z){var P=[];if(z instanceof Object)for(var L in z)z.hasOwnProperty(L)&&P.push(L);return P},x=function(z,P){var L=function(W,ie,B,E,C){var k=P.indent!==void 0?P.indent:" ",g=P.prettyPrint?"\n"+new Array(E).join(k):"";P.removeIllegalNameCharacters&&(W=W.replace(u,"_"));var U=[g,"<",W,B||""];return ie&&ie.length>0?(U.push(">"),U.push(ie),C&&U.push(g),U.push("")):U.push("/>"),U.join("")};return function Y(W,ie,B){var E=t(W);switch((Array.isArray?Array.isArray(W):W instanceof Array)?E="array":W instanceof Date&&(E="date"),E){case"array":var C=[];return W.map(function(F){C.push(Y(F,1,B+1))}),P.prettyPrint&&C.push("\n"),C.join("");case"date":return W.toJSON?W.toJSON():W+"";case"object":var k=[];for(var g in W)if(W.hasOwnProperty(g))if(W[g]instanceof Array)for(var U=0;U0&&k.push("\n"),k.join("");case"function":return W();default:return P.escape?A(W):""+W}}(z,0,0)},S=function(z){var P=['"),P.join("")};function A(D){return(""+D).replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""").replace(T,"")}o.exports=function(D,z){if(z||(z={xmlHeader:{standalone:!0},prettyPrint:!0,indent:" ",escape:!0}),typeof D=="string")try{D=JSON.parse(D.toString())}catch(W){return!1}var P="",L="";z&&(t(z)=="object"?(z.xmlHeader&&(P=S(!!z.xmlHeader.standalone)),typeof z.docType<"u"&&(L="")):P=S()),z=z||{};var Y=[P,z.prettyPrint&&L?"\n":"",L,x(D,z)];return Y.join("").replace(/\n{2,}/g,"\n").replace(/\s+$/g,"")}},"./lib/md5.js":function(module,exports,__webpack_require__){(function(process,global,module){var __WEBPACK_AMD_DEFINE_RESULT__,_typeof=__webpack_require__("./node_modules/@babel/runtime/helpers/typeof.js");(function(){var ERROR="input is invalid type",WINDOW=(typeof window>"u"?"undefined":_typeof(window))==="object",root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&(typeof self>"u"?"undefined":_typeof(self))==="object",NODE_JS=!root.JS_MD5_NO_NODE_JS&&(typeof process>"u"?"undefined":_typeof(process))==="object"&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&_typeof(module)==="object"&&module.exports,AMD=__webpack_require__("./node_modules/webpack/buildin/amd-options.js"),ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",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(o){return Object.prototype.toString.call(o)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(o){return _typeof(o)==="object"&&o.buffer&&o.buffer.constructor===ArrayBuffer});var createOutputMethod=function(n){return function(e,t){return new Md5(!0).update(e,t)[n]()}},createMethod=function(){var n=createOutputMethod("hex");NODE_JS&&(n=nodeWrap(n)),n.getCtx=n.create=function(){return new Md5},n.update=function(l){return n.create().update(l)};for(var e=0;e>6,T[l++]=128|e&63):e<55296||e>=57344?(T[l++]=224|e>>12,T[l++]=128|e>>6&63,T[l++]=128|e&63):(e=65536+((e&1023)<<10|o.charCodeAt(++t)&1023),T[l++]=240|e>>18,T[l++]=128|e>>12&63,T[l++]=128|e>>6&63,T[l++]=128|e&63);else for(l=this.start;t>2]|=e<>2]|=(192|e>>6)<>2]|=(128|e&63)<=57344?(u[l>>2]|=(224|e>>12)<>2]|=(128|e>>6&63)<>2]|=(128|e&63)<>2]|=(240|e>>18)<>2]|=(128|e>>12&63)<>2]|=(128|e>>6&63)<>2]|=(128|e&63)<=64?(this.start=l-64,this.hash(),this.hashed=!0):this.start=l}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 o=this.blocks,n=this.lastByteIndex;o[n>>2]|=EXTRA[n&3],n>=56&&(this.hashed||this.hash(),o[0]=o[16],o[16]=o[1]=o[2]=o[3]=o[4]=o[5]=o[6]=o[7]=o[8]=o[9]=o[10]=o[11]=o[12]=o[13]=o[14]=o[15]=0),o[14]=this.bytes<<3,o[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var o,n,e,t,l,r,u=this.blocks;this.first?(o=u[0]-680876937,o=(o<<7|o>>>25)-271733879<<0,t=(-1732584194^o&2004318071)+u[1]-117830708,t=(t<<12|t>>>20)+o<<0,e=(-271733879^t&(o^-271733879))+u[2]-1126478375,e=(e<<17|e>>>15)+t<<0,n=(o^e&(t^o))+u[3]-1316259209,n=(n<<22|n>>>10)+e<<0):(o=this.h0,n=this.h1,e=this.h2,t=this.h3,o+=(t^n&(e^t))+u[0]-680876936,o=(o<<7|o>>>25)+n<<0,t+=(e^o&(n^e))+u[1]-389564586,t=(t<<12|t>>>20)+o<<0,e+=(n^t&(o^n))+u[2]+606105819,e=(e<<17|e>>>15)+t<<0,n+=(o^e&(t^o))+u[3]-1044525330,n=(n<<22|n>>>10)+e<<0),o+=(t^n&(e^t))+u[4]-176418897,o=(o<<7|o>>>25)+n<<0,t+=(e^o&(n^e))+u[5]+1200080426,t=(t<<12|t>>>20)+o<<0,e+=(n^t&(o^n))+u[6]-1473231341,e=(e<<17|e>>>15)+t<<0,n+=(o^e&(t^o))+u[7]-45705983,n=(n<<22|n>>>10)+e<<0,o+=(t^n&(e^t))+u[8]+1770035416,o=(o<<7|o>>>25)+n<<0,t+=(e^o&(n^e))+u[9]-1958414417,t=(t<<12|t>>>20)+o<<0,e+=(n^t&(o^n))+u[10]-42063,e=(e<<17|e>>>15)+t<<0,n+=(o^e&(t^o))+u[11]-1990404162,n=(n<<22|n>>>10)+e<<0,o+=(t^n&(e^t))+u[12]+1804603682,o=(o<<7|o>>>25)+n<<0,t+=(e^o&(n^e))+u[13]-40341101,t=(t<<12|t>>>20)+o<<0,e+=(n^t&(o^n))+u[14]-1502002290,e=(e<<17|e>>>15)+t<<0,n+=(o^e&(t^o))+u[15]+1236535329,n=(n<<22|n>>>10)+e<<0,o+=(e^t&(n^e))+u[1]-165796510,o=(o<<5|o>>>27)+n<<0,t+=(n^e&(o^n))+u[6]-1069501632,t=(t<<9|t>>>23)+o<<0,e+=(o^n&(t^o))+u[11]+643717713,e=(e<<14|e>>>18)+t<<0,n+=(t^o&(e^t))+u[0]-373897302,n=(n<<20|n>>>12)+e<<0,o+=(e^t&(n^e))+u[5]-701558691,o=(o<<5|o>>>27)+n<<0,t+=(n^e&(o^n))+u[10]+38016083,t=(t<<9|t>>>23)+o<<0,e+=(o^n&(t^o))+u[15]-660478335,e=(e<<14|e>>>18)+t<<0,n+=(t^o&(e^t))+u[4]-405537848,n=(n<<20|n>>>12)+e<<0,o+=(e^t&(n^e))+u[9]+568446438,o=(o<<5|o>>>27)+n<<0,t+=(n^e&(o^n))+u[14]-1019803690,t=(t<<9|t>>>23)+o<<0,e+=(o^n&(t^o))+u[3]-187363961,e=(e<<14|e>>>18)+t<<0,n+=(t^o&(e^t))+u[8]+1163531501,n=(n<<20|n>>>12)+e<<0,o+=(e^t&(n^e))+u[13]-1444681467,o=(o<<5|o>>>27)+n<<0,t+=(n^e&(o^n))+u[2]-51403784,t=(t<<9|t>>>23)+o<<0,e+=(o^n&(t^o))+u[7]+1735328473,e=(e<<14|e>>>18)+t<<0,n+=(t^o&(e^t))+u[12]-1926607734,n=(n<<20|n>>>12)+e<<0,l=n^e,o+=(l^t)+u[5]-378558,o=(o<<4|o>>>28)+n<<0,t+=(l^o)+u[8]-2022574463,t=(t<<11|t>>>21)+o<<0,r=t^o,e+=(r^n)+u[11]+1839030562,e=(e<<16|e>>>16)+t<<0,n+=(r^e)+u[14]-35309556,n=(n<<23|n>>>9)+e<<0,l=n^e,o+=(l^t)+u[1]-1530992060,o=(o<<4|o>>>28)+n<<0,t+=(l^o)+u[4]+1272893353,t=(t<<11|t>>>21)+o<<0,r=t^o,e+=(r^n)+u[7]-155497632,e=(e<<16|e>>>16)+t<<0,n+=(r^e)+u[10]-1094730640,n=(n<<23|n>>>9)+e<<0,l=n^e,o+=(l^t)+u[13]+681279174,o=(o<<4|o>>>28)+n<<0,t+=(l^o)+u[0]-358537222,t=(t<<11|t>>>21)+o<<0,r=t^o,e+=(r^n)+u[3]-722521979,e=(e<<16|e>>>16)+t<<0,n+=(r^e)+u[6]+76029189,n=(n<<23|n>>>9)+e<<0,l=n^e,o+=(l^t)+u[9]-640364487,o=(o<<4|o>>>28)+n<<0,t+=(l^o)+u[12]-421815835,t=(t<<11|t>>>21)+o<<0,r=t^o,e+=(r^n)+u[15]+530742520,e=(e<<16|e>>>16)+t<<0,n+=(r^e)+u[2]-995338651,n=(n<<23|n>>>9)+e<<0,o+=(e^(n|~t))+u[0]-198630844,o=(o<<6|o>>>26)+n<<0,t+=(n^(o|~e))+u[7]+1126891415,t=(t<<10|t>>>22)+o<<0,e+=(o^(t|~n))+u[14]-1416354905,e=(e<<15|e>>>17)+t<<0,n+=(t^(e|~o))+u[5]-57434055,n=(n<<21|n>>>11)+e<<0,o+=(e^(n|~t))+u[12]+1700485571,o=(o<<6|o>>>26)+n<<0,t+=(n^(o|~e))+u[3]-1894986606,t=(t<<10|t>>>22)+o<<0,e+=(o^(t|~n))+u[10]-1051523,e=(e<<15|e>>>17)+t<<0,n+=(t^(e|~o))+u[1]-2054922799,n=(n<<21|n>>>11)+e<<0,o+=(e^(n|~t))+u[8]+1873313359,o=(o<<6|o>>>26)+n<<0,t+=(n^(o|~e))+u[15]-30611744,t=(t<<10|t>>>22)+o<<0,e+=(o^(t|~n))+u[6]-1560198380,e=(e<<15|e>>>17)+t<<0,n+=(t^(e|~o))+u[13]+1309151649,n=(n<<21|n>>>11)+e<<0,o+=(e^(n|~t))+u[4]-145523070,o=(o<<6|o>>>26)+n<<0,t+=(n^(o|~e))+u[11]-1120210379,t=(t<<10|t>>>22)+o<<0,e+=(o^(t|~n))+u[2]+718787259,e=(e<<15|e>>>17)+t<<0,n+=(t^(e|~o))+u[9]-343485551,n=(n<<21|n>>>11)+e<<0,this.first?(this.h0=o+1732584193<<0,this.h1=n-271733879<<0,this.h2=e-1732584194<<0,this.h3=t+271733878<<0,this.first=!1):(this.h0=this.h0+o<<0,this.h1=this.h1+n<<0,this.h2=this.h2+e<<0,this.h3=this.h3+t<<0)},Md5.prototype.hex=function(){this.finalize();var o=this.h0,n=this.h1,e=this.h2,t=this.h3;return HEX_CHARS[o>>4&15]+HEX_CHARS[o&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+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[e>>4&15]+HEX_CHARS[e&15]+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[t&15]+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]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(o){if(o==="hex")return this.hex();this.finalize();var n=this.h0,e=this.h1,t=this.h2,l=this.h3,r=[n&255,n>>8&255,n>>16&255,n>>24&255,e&255,e>>8&255,e>>16&255,e>>24&255,t&255,t>>8&255,t>>16&255,t>>24&255,l&255,l>>8&255,l>>16&255,l>>24&255];return r},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var o=new ArrayBuffer(16),n=new Uint32Array(o);return n[0]=this.h0,n[1]=this.h1,n[2]=this.h2,n[3]=this.h3,o},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var o,n,e,t="",l=this.array(),r=0;r<15;)o=l[r++],n=l[r++],e=l[r++],t+=BASE64_ENCODE_CHAR[o>>>2]+BASE64_ENCODE_CHAR[(o<<4|n>>>4)&63]+BASE64_ENCODE_CHAR[(n<<2|e>>>6)&63]+BASE64_ENCODE_CHAR[e&63];return o=l[r],t+=BASE64_ENCODE_CHAR[o>>>2]+BASE64_ENCODE_CHAR[o<<4&63]+"==",t};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),__WEBPACK_AMD_DEFINE_RESULT__!==void 0&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()}).call(this,__webpack_require__("./node_modules/process/browser.js"),__webpack_require__("./node_modules/webpack/buildin/global.js"),__webpack_require__("./node_modules/webpack/buildin/module.js")(module))},"./lib/request.js":function(o,n,e){var t=e("./node_modules/@babel/runtime/helpers/typeof.js"),l=function(S){switch(t(S)){case"string":return S;case"boolean":return S?"true":"false";case"number":return isFinite(S)?S:"";default:return""}},r=function(S,A,D,z){return A=A||"&",D=D||"=",S===null&&(S=void 0),t(S)==="object"?Object.keys(S).map(function(P){var L=encodeURIComponent(l(P))+D;return Array.isArray(S[P])?S[P].map(function(Y){return L+encodeURIComponent(l(Y))}).join(A):L+encodeURIComponent(l(S[P]))}).filter(Boolean).join(A):z?encodeURIComponent(l(z))+D+encodeURIComponent(l(S)):""},u=function(S,A,D){var z={};return A.getAllResponseHeaders().trim().split("\n").forEach(function(P){if(P){var L=P.indexOf(":"),Y=P.substr(0,L).trim().toLowerCase(),W=P.substr(L+1).trim();z[Y]=W}}),{error:S,statusCode:A.status,statusMessage:A.statusText,headers:z,body:D}},T=function(S,A){return!A&&A==="text"?S.responseText:S.response},w=function(S,A){var D=(S.method||"GET").toUpperCase(),z=S.url;if(S.qs){var P=r(S.qs);P&&(z+=(z.indexOf("?")===-1?"?":"&")+P)}var L=new XMLHttpRequest;if(L.open(D,z,!0),L.responseType=S.dataType||"text",S.xhrFields)for(var Y in S.xhrFields)L[Y]=S.xhrFields[Y];var W=S.headers;if(W)for(var ie in W)W.hasOwnProperty(ie)&&ie.toLowerCase()!=="content-length"&&ie.toLowerCase()!=="user-agent"&&ie.toLowerCase()!=="origin"&&ie.toLowerCase()!=="host"&&L.setRequestHeader(ie,W[ie]);return S.onProgress&&L.upload&&(L.upload.onprogress=S.onProgress),S.onDownloadProgress&&(L.onprogress=S.onDownloadProgress),S.timeout&&(L.timeout=S.timeout),L.ontimeout=function(B){var E=new Error("timeout");A(u(E,L))},L.onload=function(){A(u(null,L,T(L,S.dataType)))},L.onerror=function(B){var E=T(L,S.dataType);if(E)A(u(null,L,E));else{var C=L.statusText;!C&&L.status===0&&(C=new Error("CORS blocked or network error")),A(u(C,L,E))}},L.send(S.body||""),L};o.exports=w},"./lib/xml2json.js":function(o,n,e){var t=e("./node_modules/@xmldom/xmldom/lib/index.js").DOMParser,l=(function(){this.version="1.3.5";var u={mergeCDATA:!0,normalize:!0,stripElemPrefix:!0},T=new RegExp(/(?!xmlns)^.*:/);return this.grokType=function(w){return/^\s*$/.test(w)?null:/^(?:true|false)$/i.test(w)?w.toLowerCase()==="true":isFinite(w)?parseFloat(w):w},this.parseString=function(w,x){if(w){var S=this.stringToXML(w);return S.getElementsByTagName("parsererror").length?null:this.parseXML(S,x)}else return null},this.parseXML=function(w,x){for(var S in x)u[S]=x[S];var A={},D=0,z="",P=w.childNodes.length;if(P)for(var L,Y,W,ie=0;ie=E+C||E?new java.lang.String(B,E,C)+"":B}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(B){P.prototype[B]=function(){return null}});function ie(B,E){B.currentElement?B.currentElement.appendChild(E):B.doc.appendChild(E)}n.__DOMHandler=P,n.normalizeLineEndings=A,n.DOMParser=D},"./node_modules/@xmldom/xmldom/lib/dom.js":function(o,n,e){var t=e("./node_modules/@xmldom/xmldom/lib/conventions.js"),l=t.find,r=t.NAMESPACE;function u(f){return f!==""}function T(f){return f?f.split(/[\t\n\f\r ]+/).filter(u):[]}function w(f,v){return f.hasOwnProperty(v)||(f[v]=!0),f}function x(f){if(!f)return[];var v=T(f);return Object.keys(v.reduce(w,{}))}function S(f){return function(v){return f&&f.indexOf(v)!==-1}}function A(f,v){for(var N in f)Object.prototype.hasOwnProperty.call(f,N)&&(v[N]=f[N])}function D(f,v){var N=f.prototype;if(!(N instanceof v)){let q=function(){};q.prototype=v.prototype,q=new q,A(N,q),f.prototype=N=q}N.constructor!=f&&(typeof f!="function"&&console.error("unknown Class:"+f),N.constructor=f)}var z={},P=z.ELEMENT_NODE=1,L=z.ATTRIBUTE_NODE=2,Y=z.TEXT_NODE=3,W=z.CDATA_SECTION_NODE=4,ie=z.ENTITY_REFERENCE_NODE=5,B=z.ENTITY_NODE=6,E=z.PROCESSING_INSTRUCTION_NODE=7,C=z.COMMENT_NODE=8,k=z.DOCUMENT_NODE=9,g=z.DOCUMENT_TYPE_NODE=10,U=z.DOCUMENT_FRAGMENT_NODE=11,F=z.NOTATION_NODE=12,H={},K={};H.INDEX_SIZE_ERR=(K[1]="Index size error",1),H.DOMSTRING_SIZE_ERR=(K[2]="DOMString size error",2);var _=H.HIERARCHY_REQUEST_ERR=(K[3]="Hierarchy request error",3);H.WRONG_DOCUMENT_ERR=(K[4]="Wrong document",4),H.INVALID_CHARACTER_ERR=(K[5]="Invalid character",5),H.NO_DATA_ALLOWED_ERR=(K[6]="No data allowed",6),H.NO_MODIFICATION_ALLOWED_ERR=(K[7]="No modification allowed",7);var V=H.NOT_FOUND_ERR=(K[8]="Not found",8);H.NOT_SUPPORTED_ERR=(K[9]="Not supported",9);var X=H.INUSE_ATTRIBUTE_ERR=(K[10]="Attribute in use",10);H.INVALID_STATE_ERR=(K[11]="Invalid state",11),H.SYNTAX_ERR=(K[12]="Syntax error",12),H.INVALID_MODIFICATION_ERR=(K[13]="Invalid modification",13),H.NAMESPACE_ERR=(K[14]="Invalid namespace",14),H.INVALID_ACCESS_ERR=(K[15]="Invalid access",15);function G(f,v){if(v instanceof Error)var N=v;else N=this,Error.call(this,K[f]),this.message=K[f],Error.captureStackTrace&&Error.captureStackTrace(this,G);return N.code=f,v&&(this.message=this.message+": "+v),N}G.prototype=Error.prototype,A(H,G);function $(){}$.prototype={length:0,item:function(f){return this[f]||null},toString:function(f,v){for(var N=[],q=0;q=0){for(var fe=v.length-1;q0},lookupPrefix:function(f){for(var v=this;v;){var N=v._nsMap;if(N){for(var q in N)if(Object.prototype.hasOwnProperty.call(N,q)&&N[q]===f)return q}v=v.nodeType==L?v.ownerDocument:v.parentNode}return null},lookupNamespaceURI:function(f){for(var v=this;v;){var N=v._nsMap;if(N&&Object.prototype.hasOwnProperty.call(N,f))return N[f];v=v.nodeType==L?v.ownerDocument:v.parentNode}return null},isDefaultNamespace:function(f){var v=this.lookupPrefix(f);return v==null}};function ne(f){return f=="<"&&"<"||f==">"&&">"||f=="&"&&"&"||f=='"'&&"""||"&#"+f.charCodeAt()+";"}A(z,Z),A(z,Z.prototype);function ge(f,v){if(v(f))return!0;if(f=f.firstChild)do if(ge(f,v))return!0;while(f=f.nextSibling)}function me(){this.ownerDocument=this}function ve(f,v,N){f&&f._inc++;var q=N.namespaceURI;q===r.XMLNS&&(v._nsMap[N.prefix?N.localName:""]=N.value)}function ye(f,v,N,q){f&&f._inc++;var fe=N.namespaceURI;fe===r.XMLNS&&delete v._nsMap[N.prefix?N.localName:""]}function Ce(f,v,N){if(f&&f._inc){f._inc++;var q=v.childNodes;if(N)q[q.length++]=N;else{for(var fe=v.firstChild,Re=0;fe;)q[Re++]=fe,fe=fe.nextSibling;q.length=Re,delete q[q.length]}}}function Ee(f,v){var N=v.previousSibling,q=v.nextSibling;return N?N.nextSibling=q:f.firstChild=q,q?q.previousSibling=N:f.lastChild=N,v.parentNode=null,v.previousSibling=null,v.nextSibling=null,Ce(f.ownerDocument,f),v}function be(f){return f&&(f.nodeType===Z.DOCUMENT_NODE||f.nodeType===Z.DOCUMENT_FRAGMENT_NODE||f.nodeType===Z.ELEMENT_NODE)}function Oe(f){return f&&(De(f)||He(f)||we(f)||f.nodeType===Z.DOCUMENT_FRAGMENT_NODE||f.nodeType===Z.COMMENT_NODE||f.nodeType===Z.PROCESSING_INSTRUCTION_NODE)}function we(f){return f&&f.nodeType===Z.DOCUMENT_TYPE_NODE}function De(f){return f&&f.nodeType===Z.ELEMENT_NODE}function He(f){return f&&f.nodeType===Z.TEXT_NODE}function Pe(f,v){var N=f.childNodes||[];if(l(N,De)||we(v))return!1;var q=l(N,we);return!(v&&q&&N.indexOf(q)>N.indexOf(v))}function se(f,v){var N=f.childNodes||[];function q(Re){return De(Re)&&Re!==v}if(l(N,q))return!1;var fe=l(N,we);return!(v&&fe&&N.indexOf(fe)>N.indexOf(v))}function h(f,v,N){if(!be(f))throw new G(_,"Unexpected parent node type "+f.nodeType);if(N&&N.parentNode!==f)throw new G(V,"child not in parent");if(!Oe(v)||we(v)&&f.nodeType!==Z.DOCUMENT_NODE)throw new G(_,"Unexpected node type "+v.nodeType+" for parent node type "+f.nodeType)}function c(f,v,N){var q=f.childNodes||[],fe=v.childNodes||[];if(v.nodeType===Z.DOCUMENT_FRAGMENT_NODE){var Re=fe.filter(De);if(Re.length>1||l(fe,He))throw new G(_,"More than one element or text in fragment");if(Re.length===1&&!Pe(f,N))throw new G(_,"Element in fragment can not be inserted before doctype")}if(De(v)&&!Pe(f,N))throw new G(_,"Only one element can be added and only after doctype");if(we(v)){if(l(q,we))throw new G(_,"Only one doctype is allowed");var Me=l(q,De);if(N&&q.indexOf(Me)1||l(fe,He))throw new G(_,"More than one element or text in fragment");if(Re.length===1&&!se(f,N))throw new G(_,"Element in fragment can not be inserted before doctype")}if(De(v)&&!se(f,N))throw new G(_,"Only one element can be added and only after doctype");if(we(v)){if(l(q,function(Ye){return we(Ye)&&Ye!==N}))throw new G(_,"Only one doctype is allowed");var Me=l(q,De);if(N&&q.indexOf(Me)0&&ge(N.documentElement,function(fe){if(fe!==N&&fe.nodeType===P){var Re=fe.getAttribute("class");if(Re){var Me=f===Re;if(!Me){var le=x(Re);Me=v.every(S(le))}Me&&q.push(fe)}}}),q})},createElement:function(f){var v=new I;v.ownerDocument=this,v.nodeName=f,v.tagName=f,v.localName=f,v.childNodes=new $;var N=v.attributes=new oe;return N._ownerElement=v,v},createDocumentFragment:function(){var f=new Le;return f.ownerDocument=this,f.childNodes=new $,f},createTextNode:function(f){var v=new de;return v.ownerDocument=this,v.appendData(f),v},createComment:function(f){var v=new he;return v.ownerDocument=this,v.appendData(f),v},createCDATASection:function(f){var v=new J;return v.ownerDocument=this,v.appendData(f),v},createProcessingInstruction:function(f,v){var N=new Ve;return N.ownerDocument=this,N.tagName=N.target=f,N.nodeValue=N.data=v,N},createAttribute:function(f){var v=new M;return v.ownerDocument=this,v.name=f,v.nodeName=f,v.localName=f,v.specified=!0,v},createEntityReference:function(f){var v=new _e;return v.ownerDocument=this,v.nodeName=f,v},createElementNS:function(f,v){var N=new I,q=v.split(":"),fe=N.attributes=new oe;return N.childNodes=new $,N.ownerDocument=this,N.nodeName=v,N.tagName=v,N.namespaceURI=f,q.length==2?(N.prefix=q[0],N.localName=q[1]):N.localName=v,fe._ownerElement=N,N},createAttributeNS:function(f,v){var N=new M,q=v.split(":");return N.ownerDocument=this,N.nodeName=v,N.name=v,N.namespaceURI=f,N.specified=!0,q.length==2?(N.prefix=q[0],N.localName=q[1]):N.localName=v,N}},D(me,Z);function I(){this._nsMap={}}I.prototype={nodeType:P,hasAttribute:function(f){return this.getAttributeNode(f)!=null},getAttribute:function(f){var v=this.getAttributeNode(f);return v&&v.value||""},getAttributeNode:function(f){return this.attributes.getNamedItem(f)},setAttribute:function(f,v){var N=this.ownerDocument.createAttribute(f);N.value=N.nodeValue=""+v,this.setAttributeNode(N)},removeAttribute:function(f){var v=this.getAttributeNode(f);v&&this.removeAttributeNode(v)},appendChild:function(f){return f.nodeType===U?this.insertBefore(f,null):m(this,f)},setAttributeNode:function(f){return this.attributes.setNamedItem(f)},setAttributeNodeNS:function(f){return this.attributes.setNamedItemNS(f)},removeAttributeNode:function(f){return this.attributes.removeNamedItem(f.nodeName)},removeAttributeNS:function(f,v){var N=this.getAttributeNodeNS(f,v);N&&this.removeAttributeNode(N)},hasAttributeNS:function(f,v){return this.getAttributeNodeNS(f,v)!=null},getAttributeNS:function(f,v){var N=this.getAttributeNodeNS(f,v);return N&&N.value||""},setAttributeNS:function(f,v,N){var q=this.ownerDocument.createAttributeNS(f,v);q.value=q.nodeValue=""+N,this.setAttributeNode(q)},getAttributeNodeNS:function(f,v){return this.attributes.getNamedItemNS(f,v)},getElementsByTagName:function(f){return new re(this,function(v){var N=[];return ge(v,function(q){q!==v&&q.nodeType==P&&(f==="*"||q.tagName==f)&&N.push(q)}),N})},getElementsByTagNameNS:function(f,v){return new re(this,function(N){var q=[];return ge(N,function(fe){fe!==N&&fe.nodeType===P&&(f==="*"||fe.namespaceURI===f)&&(v==="*"||fe.localName==v)&&q.push(fe)}),q})}},me.prototype.getElementsByTagName=I.prototype.getElementsByTagName,me.prototype.getElementsByTagNameNS=I.prototype.getElementsByTagNameNS,D(I,Z);function M(){}M.prototype.nodeType=L,D(M,Z);function Q(){}Q.prototype={data:"",substringData:function(f,v){return this.data.substring(f,f+v)},appendData:function(f){f=this.data+f,this.nodeValue=this.data=f,this.length=f.length},insertData:function(f,v){this.replaceData(f,0,v)},appendChild:function(f){throw new Error(K[_])},deleteData:function(f,v){this.replaceData(f,v,"")},replaceData:function(f,v,N){var q=this.data.substring(0,f),fe=this.data.substring(f+v);N=q+N+fe,this.nodeValue=this.data=N,this.length=N.length}},D(Q,Z);function de(){}de.prototype={nodeName:"#text",nodeType:Y,splitText:function(f){var v=this.data,N=v.substring(f);v=v.substring(0,f),this.data=this.nodeValue=v,this.length=v.length;var q=this.ownerDocument.createTextNode(N);return this.parentNode&&this.parentNode.insertBefore(q,this.nextSibling),q}},D(de,Q);function he(){}he.prototype={nodeName:"#comment",nodeType:C},D(he,Q);function J(){}J.prototype={nodeName:"#cdata-section",nodeType:W},D(J,Q);function xe(){}xe.prototype.nodeType=g,D(xe,Z);function Be(){}Be.prototype.nodeType=F,D(Be,Z);function Ue(){}Ue.prototype.nodeType=B,D(Ue,Z);function _e(){}_e.prototype.nodeType=ie,D(_e,Z);function Le(){}Le.prototype.nodeName="#document-fragment",Le.prototype.nodeType=U,D(Le,Z);function Ve(){}Ve.prototype.nodeType=E,D(Ve,Z);function qe(){}qe.prototype.serializeToString=function(f,v,N){return Ge.call(f,v,N)},Z.prototype.toString=Ge;function Ge(f,v){var N=[],q=this.nodeType==9&&this.documentElement||this,fe=q.prefix,Re=q.namespaceURI;if(Re&&fe==null){var fe=q.lookupPrefix(Re);if(fe==null)var Me=[{namespace:Re,prefix:null}]}return Xe(this,N,f,v,Me),N.join("")}function Ke(f,v,N){var q=f.prefix||"",fe=f.namespaceURI;if(!fe||q==="xml"&&fe===r.XML||fe===r.XMLNS)return!1;for(var Re=N.length;Re--;){var Me=N[Re];if(Me.prefix===q)return Me.namespace!==fe}return!0}function We(f,v,N){f.push(" ",v,'="',N.replace(/[<>&"\t\n\r]/g,ne),'"')}function Xe(f,v,N,q,fe){if(fe||(fe=[]),q)if(f=q(f),f){if(typeof f=="string"){v.push(f);return}}else return;switch(f.nodeType){case P:var Re=f.attributes,Me=Re.length,O=f.firstChild,le=f.tagName;N=r.isHTML(f.namespaceURI)||N;var Ye=le;if(!N&&!f.prefix&&f.namespaceURI){for(var Qe,$e=0;$e=0;i--){var y=fe[i];if(y.prefix===""&&y.namespace===f.namespaceURI){Qe=y.namespace;break}}if(Qe!==f.namespaceURI)for(var i=fe.length-1;i>=0;i--){var y=fe[i];if(y.namespace===f.namespaceURI){y.prefix&&(Ye=y.prefix+":"+le);break}}}v.push("<",Ye);for(var s=0;s"),N&&/^script$/i.test(le))for(;O;)O.data?v.push(O.data):Xe(O,v,N,q,fe.slice()),O=O.nextSibling;else for(;O;)Xe(O,v,N,q,fe.slice()),O=O.nextSibling;v.push("")}else v.push("/>");return;case k:case U:for(var O=f.firstChild;O;)Xe(O,v,N,q,fe.slice()),O=O.nextSibling;return;case L:return We(v,f.name,f.value);case Y:return v.push(f.data.replace(/[<&>]/g,ne));case W:return v.push("");case C:return v.push("");case g:var j=f.publicId,te=f.systemId;if(v.push("");else if(te&&te!=".")v.push(" SYSTEM ",te,">");else{var ke=f.internalSubset;ke&&v.push(" [",ke,"]"),v.push(">")}return;case E:return v.push("");case ie:return v.push("&",f.nodeName,";");default:v.push("??",f.nodeName)}}function nt(f,v,N){var q;switch(v.nodeType){case P:q=v.cloneNode(!1),q.ownerDocument=f;case U:break;case L:N=!0;break}if(q||(q=v.cloneNode(!1)),q.ownerDocument=f,q.parentNode=null,N)for(var fe=v.firstChild;fe;)q.appendChild(nt(f,fe,N)),fe=fe.nextSibling;return q}function et(f,v,N){var q=new v.constructor;for(var fe in v)if(Object.prototype.hasOwnProperty.call(v,fe)){var Re=v[fe];typeof Re!="object"&&Re!=q[fe]&&(q[fe]=Re)}switch(v.childNodes&&(q.childNodes=new $),q.ownerDocument=f,q.nodeType){case P:var Me=v.attributes,le=q.attributes=new oe,Ye=Me.length;le._ownerElement=q;for(var Qe=0;Qe",lt:"<",quot:'"'}),n.HTML_ENTITIES=t({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:"♦"}),n.entityMap=n.HTML_ENTITIES},"./node_modules/@xmldom/xmldom/lib/index.js":function(o,n,e){var t=e("./node_modules/@xmldom/xmldom/lib/dom.js");n.DOMImplementation=t.DOMImplementation,n.XMLSerializer=t.XMLSerializer,n.DOMParser=e("./node_modules/@xmldom/xmldom/lib/dom-parser.js").DOMParser},"./node_modules/@xmldom/xmldom/lib/sax.js":function(o,n,e){var t=e("./node_modules/@xmldom/xmldom/lib/conventions.js").NAMESPACE,l=/[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]/,r=new RegExp("[\\-\\.0-9"+l.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),u=new RegExp("^"+l.source+r.source+"*(?::"+l.source+r.source+"*)?$"),T=0,w=1,x=2,S=3,A=4,D=5,z=6,P=7;function L(_,V){this.message=_,this.locator=V,Error.captureStackTrace&&Error.captureStackTrace(this,L)}L.prototype=new Error,L.prototype.name=L.name;function Y(){}Y.prototype={parse:function(_,V,X){var G=this.domBuilder;G.startDocument(),g(V,V={}),W(_,V,X,G,this.errorHandler),G.endDocument()}};function W(_,V,X,G,$){function re(I){if(I>65535){I-=65536;var M=55296+(I>>10),Q=56320+(I&1023);return String.fromCharCode(M,Q)}else return String.fromCharCode(I)}function ue(I){var M=I.slice(1,-1);return Object.hasOwnProperty.call(X,M)?X[M]:M.charAt(0)==="#"?re(parseInt(M.substr(1).replace("x","0x"))):($.error("entity not found:"+I),I)}function oe(I){if(I>me){var M=_.substring(me,I).replace(/&#?\w+;/g,ue);Z&&ee(me),G.characters(M,0,I-me),me=I}}function ee(I,M){for(;I>=ae&&(M=pe.exec(_));)ce=M.index,ae=ce+M[0].length,Z.lineNumber++;Z.columnNumber=I-ce+1}for(var ce=0,ae=0,pe=/.*(?:\r\n?|\n)|.*$/g,Z=G.locator,ne=[{currentNSMap:V}],ge={},me=0;;){try{var ve=_.indexOf("<",me);if(ve<0){if(!_.substr(me).match(/^\s*$/)){var ye=G.doc,Ce=ye.createTextNode(_.substr(me));ye.appendChild(Ce),G.currentElement=Ce}return}switch(ve>me&&oe(ve),_.charAt(ve+1)){case"/":var h=_.indexOf(">",ve+3),Ee=_.substring(ve+2,h).replace(/[ \t\n\r]+$/g,""),be=ne.pop();h<0?(Ee=_.substring(ve+2).replace(/[\s<].*/,""),$.error("end tag name: "+Ee+" is not complete:"+be.tagName),h=ve+1+Ee.length):Ee.match(/\sme?me=h:oe(Math.max(ve,me)+1)}}function ie(_,V){return V.lineNumber=_.lineNumber,V.columnNumber=_.columnNumber,V}function B(_,V,X,G,$,re){function ue(Z,ne,ge){X.attributeNames.hasOwnProperty(Z)&&re.fatalError("Attribute "+Z+" redefined"),X.addValue(Z,ne.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,$),ge)}for(var oe,ee,ce=++V,ae=T;;){var pe=_.charAt(ce);switch(pe){case"=":if(ae===w)oe=_.slice(V,ce),ae=S;else if(ae===x)ae=S;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(ae===S||ae===w)if(ae===w&&(re.warning('attribute value must after "="'),oe=_.slice(V,ce)),V=ce+1,ce=_.indexOf(pe,V),ce>0)ee=_.slice(V,ce),ue(oe,ee,V-1),ae=D;else throw new Error("attribute value no end '"+pe+"' match");else if(ae==A)ee=_.slice(V,ce),ue(oe,ee,V),re.warning('attribute "'+oe+'" missed start quot('+pe+")!!"),V=ce+1,ae=D;else throw new Error('attribute value must after "="');break;case"/":switch(ae){case T:X.setTagName(_.slice(V,ce));case D:case z:case P:ae=P,X.closed=!0;case A:case w:case x:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return re.error("unexpected end of input"),ae==T&&X.setTagName(_.slice(V,ce)),ce;case">":switch(ae){case T:X.setTagName(_.slice(V,ce));case D:case z:case P:break;case A:case w:ee=_.slice(V,ce),ee.slice(-1)==="/"&&(X.closed=!0,ee=ee.slice(0,-1));case x:ae===x&&(ee=oe),ae==A?(re.warning('attribute "'+ee+'" missed quot(")!'),ue(oe,ee,V)):((!t.isHTML(G[""])||!ee.match(/^(?:disabled|checked|selected)$/i))&&re.warning('attribute "'+ee+'" missed value!! "'+ee+'" instead!!'),ue(ee,ee,V));break;case S:throw new Error("attribute value missed!!")}return ce;case"€":pe=" ";default:if(pe<=" ")switch(ae){case T:X.setTagName(_.slice(V,ce)),ae=z;break;case w:oe=_.slice(V,ce),ae=x;break;case A:var ee=_.slice(V,ce);re.warning('attribute "'+ee+'" missed quot(")!!'),ue(oe,ee,V);case D:ae=z;break}else switch(ae){case x:X.tagName,(!t.isHTML(G[""])||!oe.match(/^(?:disabled|checked|selected)$/i))&&re.warning('attribute "'+oe+'" missed value!! "'+oe+'" instead2!!'),ue(oe,oe,V),V=ce,ae=w;break;case D:re.warning('attribute space is required"'+oe+'"!!');case z:ae=w,V=ce;break;case S:ae=A,V=ce;break;case P:throw new Error("elements closed character '/' and '>' must be connected to")}}ce++}}function E(_,V,X){for(var G=_.tagName,$=null,pe=_.length;pe--;){var re=_[pe],ue=re.qName,oe=re.value,Z=ue.indexOf(":");if(Z>0)var ee=re.prefix=ue.slice(0,Z),ce=ue.slice(Z+1),ae=ee==="xmlns"&&ce;else ce=ue,ee=null,ae=ue==="xmlns"&&"";re.localName=ce,ae!==!1&&($==null&&($={},g(X,X={})),X[ae]=$[ae]=oe,re.uri=t.XMLNS,V.startPrefixMapping(ae,oe))}for(var pe=_.length;pe--;){re=_[pe];var ee=re.prefix;ee&&(ee==="xml"&&(re.uri=t.XML),ee!=="xmlns"&&(re.uri=X[ee||""]))}var Z=G.indexOf(":");Z>0?(ee=_.prefix=G.slice(0,Z),ce=_.localName=G.slice(Z+1)):(ee=null,ce=_.localName=G);var ne=_.uri=X[ee||""];if(V.startElement(ne,ce,G,_),_.closed){if(V.endElement(ne,ce,G),$)for(ee in $)Object.prototype.hasOwnProperty.call($,ee)&&V.endPrefixMapping(ee)}else return _.currentNSMap=X,_.localNSMap=$,!0}function C(_,V,X,G,$){if(/^(?:script|textarea)$/i.test(X)){var re=_.indexOf("",V),ue=_.substring(V+1,re);if(/[&<]/.test(ue))return/^script$/i.test(X)?($.characters(ue,0,ue.length),re):(ue=ue.replace(/&#?\w+;/g,G),$.characters(ue,0,ue.length),re)}return V+1}function k(_,V,X,G){var $=G[X];return $==null&&($=_.lastIndexOf(""),$",V+4);return re>V?(X.comment(_,V+4,re-V-4),re+3):(G.error("Unclosed comment"),-1)}else return-1;default:if(_.substr(V+3,6)=="CDATA["){var re=_.indexOf("]]>",V+9);return X.startCDATA(),X.characters(_,V+9,re-V-9),X.endCDATA(),re+3}var ue=K(_,V),oe=ue.length;if(oe>1&&/!doctype/i.test(ue[0][0])){var ee=ue[1][0],ce=!1,ae=!1;oe>3&&(/^public$/i.test(ue[2][0])?(ce=ue[3][0],ae=oe>4&&ue[4][0]):/^system$/i.test(ue[2][0])&&(ae=ue[3][0]));var pe=ue[oe-1];return X.startDTD(ee,ce,ae),X.endDTD(),pe.index+pe[0].length}}return-1}function F(_,V,X){var G=_.indexOf("?>",V);if(G){var $=_.substring(V,G).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return $?($[0].length,X.processingInstruction($[1],$[2]),G+2):-1}return-1}function H(){this.attributeNames={}}H.prototype={setTagName:function(_){if(!u.test(_))throw new Error("invalid tagName:"+_);this.tagName=_},addValue:function(_,V,X){if(!u.test(_))throw new Error("invalid attribute:"+_);this.attributeNames[_]=this.length,this[this.length++]={qName:_,value:V,offset:X}},length:0,getLocalName:function(_){return this[_].localName},getLocator:function(_){return this[_].locator},getQName:function(_){return this[_].qName},getURI:function(_){return this[_].uri},getValue:function(_){return this[_].value}};function K(_,V){var X,G=[],$=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for($.lastIndex=V,$.exec(_);X=$.exec(_);)if(G.push(X),X[1])return G}n.XMLReader=Y,n.ParseError=L},"./node_modules/process/browser.js":function(o,n){var e=o.exports={},t,l;function r(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?t=setTimeout:t=r}catch(W){t=r}try{typeof clearTimeout=="function"?l=clearTimeout:l=u}catch(W){l=u}})();function T(W){if(t===setTimeout)return setTimeout(W,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(W,0);try{return t(W,0)}catch(ie){try{return t.call(null,W,0)}catch(B){return t.call(this,W,0)}}}function w(W){if(l===clearTimeout)return clearTimeout(W);if((l===u||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(W);try{return l(W)}catch(ie){try{return l.call(null,W)}catch(B){return l.call(this,W)}}}var x=[],S=!1,A,D=-1;function z(){!S||!A||(S=!1,A.length?x=A.concat(x):D=-1,x.length&&P())}function P(){if(!S){var W=T(z);S=!0;for(var ie=x.length;ie;){for(A=x,x=[];++D1)for(var B=1;Bue)return ge(null,!1);if(me>1){var ve=Math.max(ne[0].Size,ne[1].Size);if(ve!==re)return ge(null,!1)}var ye=function Ce(Ee){if(Ee=ge.length){pe.emit("has_and_check_upload_id",Z);return}var Ce=ge[ye];if(!T.isInArray(Z,Ce)){l.removeUploadId.call(X,Ce),ve(ye+1);return}if(l.using[Ce]){ve(ye+1);return}D.call(X,{Bucket:H,Region:K,Key:_,UploadId:Ce,tracker:g.tracker},function(Ee,be){X._isRunningTask(F)&&(Ee?(l.removeUploadId.call(X,Ce),ve(ye+1)):pe.emit("upload_id_available",{UploadId:Ce,PartList:be.PartList}))})};me(0)}),pe.on("get_remote_upload_id_list",function(){A.call(X,{Bucket:H,Region:K,Key:_,tracker:g.tracker},function(Z,ne){if(X._isRunningTask(F)){if(Z)return pe.emit("error",Z);var ge=T.filter(ne.UploadList,function(ye){return ye.Key===_&&(!V||ye.StorageClass.toUpperCase()===V.toUpperCase())}).reverse().map(function(ye){return ye.UploadId||ye.UploadID});if(ge.length)pe.emit("seek_local_avail_upload_id",ge);else{var me=l.getFileId(g.Body,g.ChunkSize,H,_),ve;me&&(ve=l.getUploadIdList.call(X,me))&&T.each(ve,function(ye){l.removeUploadId.call(X,ye)}),pe.emit("no_available_upload_id")}}})}),pe.emit("get_remote_upload_id_list")}function A(g,U){var F=this,H=[],K={Bucket:g.Bucket,Region:g.Region,Prefix:g.Key,calledBySdk:g.calledBySdk||"sliceUploadFile",tracker:g.tracker},_=function V(){F.multipartList(K,function(X,G){if(X)return U(X);H.push.apply(H,G.Upload||[]),G.IsTruncated==="true"?(K.KeyMarker=G.NextKeyMarker,K.UploadIdMarker=G.NextUploadIdMarker,V()):U(null,{UploadList:H})})};_()}function D(g,U){var F=this,H=[],K={Bucket:g.Bucket,Region:g.Region,Key:g.Key,UploadId:g.UploadId,calledBySdk:"sliceUploadFile",tracker:g.tracker},_=function V(){F.multipartListPart(K,function(X,G){if(X)return U(X);H.push.apply(H,G.Part||[]),G.IsTruncated==="true"?(K.PartNumberMarker=G.NextPartNumberMarker,V()):U(null,{PartList:H})})};_()}function z(g,U){var F=this,H=g.TaskId,K=g.Bucket,_=g.Region,V=g.Key,X=g.UploadData,G=g.FileSize,$=g.SliceSize,re=Math.min(g.AsyncLimit||F.options.ChunkParallelLimit||1,256),ue=g.Body,oe=Math.ceil(G/$),ee=0,ce=g.ServerSideEncryption,ae=g.Headers,pe=T.filter(X.PartList,function(ne){return ne.Uploaded&&(ee+=ne.PartNumber>=oe&&G%$||$),!ne.Uploaded}),Z=g.onProgress;r.eachLimit(pe,re,function(ne,ge){if(F._isRunningTask(H)){var me=ne.PartNumber,ve=Math.min(G,ne.PartNumber*$)-(ne.PartNumber-1)*$,ye=0;P.call(F,{TaskId:H,Bucket:K,Region:_,Key:V,SliceSize:$,FileSize:G,PartNumber:me,ServerSideEncryption:ce,Body:ue,UploadData:X,Headers:ae,onProgress:function(Ee){ee+=Ee.loaded-ye,ye=Ee.loaded,Z({loaded:ee,total:G})},tracker:g.tracker},function(Ce,Ee){F._isRunningTask(H)&&(!Ce&&!Ee.ETag&&(Ce='get ETag error, please add "ETag" to CORS ExposeHeader setting.( 获取ETag失败,请在CORS ExposeHeader设置中添加ETag,请参考文档:https://cloud.tencent.com/document/product/436/13318 )'),Ce?ee-=ye:(ee+=ve-ye,ne.ETag=Ee.ETag),Z({loaded:ee,total:G}),ge(Ce||null,Ee))})}},function(ne){if(F._isRunningTask(H)){if(ne)return U(ne);U(null,{UploadId:X.UploadId,SliceList:X.PartList})}})}function P(g,U){var F=this,H=g.TaskId,K=g.Bucket,_=g.Region,V=g.Key,X=g.FileSize,G=g.Body,$=g.PartNumber*1,re=g.SliceSize,ue=g.ServerSideEncryption,oe=g.UploadData,ee=g.Headers||{},ce=F.options.ChunkRetryTimes+1,ae=re*($-1),pe=re,Z=ae+re;Z>X&&(Z=X,pe=Z-ae);var ne=["x-cos-traffic-limit","x-cos-mime-limit"],ge={};T.each(ee,function(ve,ye){ne.indexOf(ye)>-1&&(ge[ye]=ve)});var me=oe.PartList[$-1];r.retry(ce,function(ve){F._isRunningTask(H)&&T.fileSlice(G,ae,Z,!0,function(ye){F.multipartUpload({TaskId:H,Bucket:K,Region:_,Key:V,ContentLength:pe,PartNumber:$,UploadId:oe.UploadId,ServerSideEncryption:ue,Body:ye,Headers:ge,onProgress:g.onProgress,calledBySdk:"sliceUploadFile",tracker:g.tracker},function(Ce,Ee){if(F._isRunningTask(H))return Ce?ve(Ce):(me.Uploaded=!0,ve(null,Ee))})})},function(ve,ye){if(F._isRunningTask(H))return U(ve,ye)})}function L(g,U){var F=g.Bucket,H=g.Region,K=g.Key,_=g.UploadId,V=g.SliceList,X=this,G=this.options.ChunkRetryTimes+1,$=g.Headers,re=V.map(function(ue){return{PartNumber:ue.PartNumber,ETag:ue.ETag}});r.retry(G,function(ue){X.multipartComplete({Bucket:F,Region:H,Key:K,UploadId:_,Parts:re,Headers:$,calledBySdk:"sliceUploadFile",tracker:g.tracker},ue)},function(ue,oe){U(ue,oe)})}function Y(g,U){var F=g.Bucket,H=g.Region,K=g.Key,_=g.UploadId,V=g.Level||"task",X=g.AsyncLimit,G=this,$=new u;if($.on("error",function(re){return U(re)}),$.on("get_abort_array",function(re){W.call(G,{Bucket:F,Region:H,Key:K,Headers:g.Headers,AsyncLimit:X,AbortArray:re},U)}),V==="bucket")A.call(G,{Bucket:F,Region:H,calledBySdk:"abortUploadTask"},function(re,ue){if(re)return U(re);$.emit("get_abort_array",ue.UploadList||[])});else if(V==="file"){if(!K)return U(T.error(new Error("abort_upload_task_no_key")));A.call(G,{Bucket:F,Region:H,Key:K,calledBySdk:"abortUploadTask"},function(re,ue){if(re)return U(re);$.emit("get_abort_array",ue.UploadList||[])})}else if(V==="task"){if(!_)return U(T.error(new Error("abort_upload_task_no_id")));if(!K)return U(T.error(new Error("abort_upload_task_no_key")));$.emit("get_abort_array",[{Key:K,UploadId:_}])}else return U(T.error(new Error("abort_unknown_level")))}function W(g,U){var F=g.Bucket,H=g.Region,K=g.Key,_=g.AbortArray,V=g.AsyncLimit||1,X=this,G=0,$=new Array(_.length);r.eachLimit(_,V,function(re,ue){var oe=G;if(K&&K!==re.Key){$[oe]={error:{KeyNotMatch:!0}},ue(null);return}var ee=re.UploadId||re.UploadID;X.multipartAbort({Bucket:F,Region:H,Key:re.Key,Headers:g.Headers,UploadId:ee},function(ce){var ae={Bucket:F,Region:H,Key:re.Key,UploadId:ee};$[oe]={error:ce,task:ae},ue(null)}),G++},function(re){if(re)return U(re);for(var ue=[],oe=[],ee=0,ce=$.length;eeH?"sliceUploadFile":"putObject",oe=g.onFileFinish,ee=function(ae,pe){g.tracker&&g.tracker.formatResult(ae,pe),oe&&oe(ae,pe,X),U&&U(ae,pe)};K.push({api:ue,params:g,callback:ee}),F._addTasks(K)}function B(g,U){var F=this,H=g.SliceSize===void 0?F.options.SliceSize:g.SliceSize,K=0,_=0,V=T.throttleOnProgress.call(F,_,g.onProgress),X=g.files.length,G=g.onFileFinish,$=Array(X),re=function(ee,ce,ae){V(null,!0),G&&G(ee,ce,ae),$[ae.Index]={options:ae,error:ee,data:ce},--X<=0&&U&&U(null,{files:$})},ue=[];T.each(g.files,function(oe,ee){(function(){var ce=oe.Body,ae=ce.size||ce.length||0,pe={Index:ee,TaskId:""};if(!F.options.UseRawKey&&oe.Key&&oe.Key.substr(0,1)==="/"&&(oe.Key=oe.Key.substr(1)),K+=ae,F.options.EnableTracker){var Z=F.options.UseAccelerate||typeof F.options.Domain=="string"&&F.options.Domain.includes("accelerate.");oe.tracker=new w({bucket:oe.Bucket,region:oe.Region,apiName:"uploadFiles",fileKey:oe.Key,fileSize:ae,accelerate:Z,deepTracker:F.options.DeepTracker,customId:F.options.CustomId,delay:F.options.TrackerDelay})}T.each(oe,function(Oe,we){t(Oe)!=="object"&&typeof Oe!="function"&&(pe[we]=Oe)});var ne=oe.onTaskReady,ge=function(we){pe.TaskId=we,ne&&ne(we)};oe.onTaskReady=ge;var me=0,ve=oe.onProgress,ye=function(we){_=_-me+we.loaded,me=we.loaded,ve&&ve(we),V({loaded:_,total:K})};oe.onProgress=ye;var Ce=ae>H?"sliceUploadFile":"putObject",Ee=oe.onFileFinish,be=function(we,De){oe.tracker&&oe.tracker.formatResult(we,De),Ee&&Ee(we,De),re&&re(we,De,pe)};ue.push({api:Ce,params:oe,callback:be})})()}),F._addTasks(ue)}function E(g,U){var F=new u,H=this,K=g.Bucket,_=g.Region,V=g.Key,X=g.CopySource,G=T.getSourceParams.call(this,X);if(!G){U(T.error(new Error("CopySource format error")));return}var $=G.Bucket,re=G.Region,ue=decodeURIComponent(G.Key),oe=g.CopySliceSize===void 0?H.options.CopySliceSize:g.CopySliceSize;oe=Math.max(0,oe);var ee=g.CopyChunkSize||this.options.CopyChunkSize,ce=this.options.CopyChunkParallelLimit,ae=this.options.ChunkRetryTimes+1,pe=0,Z=0,ne,ge,me={},ve={},ye={};F.on("copy_slice_complete",function(Ce){T.each(g.Headers,function(be,Oe){Oe.toLowerCase().indexOf("x-cos-meta-")});var Ee=T.map(Ce.PartList,function(be){return{PartNumber:be.PartNumber,ETag:be.ETag}});r.retry(ae,function(be){H.multipartComplete({Bucket:K,Region:_,Key:V,UploadId:Ce.UploadId,Parts:Ee,calledBySdk:"sliceCopyFile"},be)},function(be,Oe){if(l.removeUsing(Ce.UploadId),be)return ge(null,!0),U(be);l.removeUploadId(Ce.UploadId),ge({loaded:ne,total:ne},!0),U(null,Oe)})}),F.on("get_copy_data_finish",function(Ce){var Ee=l.getCopyFileId(X,me,ee,K,V);Ee&&l.saveUploadId(Ee,Ce.UploadId,H.options.UploadIdCacheLimit),l.setUsing(Ce.UploadId);var be=T.filter(Ce.PartList,function(Oe){return Oe.Uploaded&&(Z+=Oe.PartNumber>=pe&&ne%ee||ee),!Oe.Uploaded});r.eachLimit(be,ce,function(Oe,we){var De=Oe.PartNumber,He=Oe.CopySourceRange,Pe=Oe.end-Oe.start;r.retry(ae,function(se){C.call(H,{Bucket:K,Region:_,Key:V,CopySource:X,UploadId:Ce.UploadId,PartNumber:De,CopySourceRange:He},se)},function(se,h){if(se)return we(se);Z+=Pe,ge({loaded:Z,total:ne}),Oe.ETag=h.ETag,we(se||null,h)})},function(Oe){if(Oe)return l.removeUsing(Ce.UploadId),ge(null,!0),U(Oe);F.emit("copy_slice_complete",Ce)})}),F.on("get_chunk_size_finish",function(){var Ce=function(){H.multipartInit({Bucket:K,Region:_,Key:V,Headers:ye},function(De,He){if(De)return U(De);g.UploadId=He.UploadId,F.emit("get_copy_data_finish",{UploadId:g.UploadId,PartList:g.PartList})})},Ee=l.getCopyFileId(X,me,ee,K,V),be=l.getUploadIdList(Ee);if(!Ee||!be)return Ce();var Oe=function we(De){if(De>=be.length)return Ce();var He=be[De];if(l.using[He])return we(De+1);D.call(H,{Bucket:K,Region:_,Key:V,UploadId:He},function(Pe,se){if(Pe)l.removeUploadId(He),we(De+1);else{if(l.using[He])return we(De+1);var h={},c=0;T.each(se.PartList,function(a){var d=parseInt(a.Size),m=c+d-1;h[a.PartNumber+"|"+c+"|"+m]=a.ETag,c+=d}),T.each(g.PartList,function(a){var d=h[a.PartNumber+"|"+a.start+"|"+a.end];d&&(a.ETag=d,a.Uploaded=!0)}),F.emit("get_copy_data_finish",{UploadId:He,PartList:g.PartList})}})};Oe(0)}),F.on("get_file_size_finish",function(){if(function(){for(var Ee=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],be=1024*1024,Oe=0;OeDe.length&&(ve[we]=Oe)}),F.emit("get_file_size_finish")}})}function C(g,U){var F=g.TaskId,H=g.Bucket,K=g.Region,_=g.Key,V=g.CopySource,X=g.UploadId,G=g.PartNumber*1,$=g.CopySourceRange,re=this.options.ChunkRetryTimes+1,ue=this;r.retry(re,function(oe){ue.uploadPartCopy({TaskId:F,Bucket:H,Region:K,Key:_,CopySource:V,UploadId:X,PartNumber:G,CopySourceRange:$},function(ee,ce){oe(ee||null,ce)})},function(oe,ee){return U(oe,ee)})}var k={sliceUploadFile:x,abortUploadTask:Y,uploadFile:ie,uploadFiles:B,sliceCopyFile:E};o.exports.init=function(g,U){U.transferToTaskMethod(k,"sliceUploadFile"),T.each(k,function(F,H){g.prototype[H]=T.apiWrapper(H,F)})}},"./src/async.js":function(o,n){var e=function(u,T,w,x){if(x=x||function(){},!u.length||T<=0)return x();var S=0,A=0,D=0;(function z(){if(S>=u.length)return x();for(;D=u.length?x():z())})})()},t=function(u,T,w){var x=function S(A){T(function(D,z){D&&A"u"?"undefined":t(location))==="object"&&location.protocol==="http:"?"http:":"https:"),p=this.options.ServiceDomain,R=i.AppId||this.options.appId,b=i.Region;p?(p=p.replace(/\{\{AppId\}\}/gi,R||"").replace(/\{\{Region\}\}/gi,b||"").replace(/\{\{.*?\}\}/gi,""),/^[a-zA-Z]+:\/\//.test(p)||(p=s+"//"+p),p.slice(-1)==="/"&&(p=p.slice(0,-1))):b?p=s+"//cos."+b+".myqcloud.com":p=s+"//service.cos.myqcloud.com";var O="",j=b?"cos."+b+".myqcloud.com":"service.cos.myqcloud.com",te=p.replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1");j===te&&(O=j),le.call(this,{Action:"name/cos:GetService",url:p,method:"GET",headers:i.Headers,SignHost:O},function(ke,Te){if(ke)return y(ke);var Se=Te&&Te.ListAllMyBucketsResult&&Te.ListAllMyBucketsResult.Buckets&&Te.ListAllMyBucketsResult.Buckets.Bucket||[];Se=r.isArray(Se)?Se:[Se];var Ae=Te&&Te.ListAllMyBucketsResult&&Te.ListAllMyBucketsResult.Owner||{};y(null,{Buckets:Se,Owner:Ae,statusCode:Te.statusCode,headers:Te.headers})})}function T(i,y){var s=this,p="";if(i.BucketAZConfig){var R={BucketAZConfig:i.BucketAZConfig};p=r.json2xml({CreateBucketConfiguration:R})}le.call(this,{Action:"name/cos:PutBucket",method:"PUT",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,body:p},function(b,O){if(b)return y(b);var j=q({protocol:s.options.Protocol,domain:s.options.Domain,bucket:i.Bucket,region:i.Region,isLocation:!0});y(null,{Location:j,statusCode:O.statusCode,headers:O.headers})})}function w(i,y){le.call(this,{Action:"name/cos:HeadBucket",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,method:"HEAD"},y)}function x(i,y){var s={};s.prefix=i.Prefix||"",s.delimiter=i.Delimiter,s.marker=i.Marker,s["max-keys"]=i.MaxKeys,s["encoding-type"]=i.EncodingType,le.call(this,{Action:"name/cos:GetBucket",ResourceKey:s.prefix,method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,qs:s},function(p,R){if(p)return y(p);var b=R.ListBucketResult||{},O=b.Contents||[],j=b.CommonPrefixes||[];O=r.isArray(O)?O:[O],j=r.isArray(j)?j:[j];var te=r.clone(b);r.extend(te,{Contents:O,CommonPrefixes:j,statusCode:R.statusCode,headers:R.headers}),y(null,te)})}function S(i,y){le.call(this,{Action:"name/cos:DeleteBucket",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,method:"DELETE"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function A(i,y){var s=i.Headers,p="";if(i.AccessControlPolicy){var R=r.clone(i.AccessControlPolicy||{}),b=R.Grants||R.Grant;b=r.isArray(b)?b:[b],delete R.Grant,delete R.Grants,R.AccessControlList={Grant:b},p=r.json2xml({AccessControlPolicy:R}),s["Content-Type"]="application/xml",s["Content-MD5"]=r.b64(r.md5(p))}r.each(s,function(O,j){j.indexOf("x-cos-grant-")===0&&(s[j]=N(s[j]))}),le.call(this,{Action:"name/cos:PutBucketACL",method:"PUT",Bucket:i.Bucket,Region:i.Region,headers:s,action:"acl",body:p},function(O,j){if(O)return y(O);y(null,{statusCode:j.statusCode,headers:j.headers})})}function D(i,y){le.call(this,{Action:"name/cos:GetBucketACL",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"acl"},function(s,p){if(s)return y(s);var R=p.AccessControlPolicy||{},b=R.Owner||{},O=R.AccessControlList.Grant||[];O=r.isArray(O)?O:[O];var j=v(R);p.headers&&p.headers["x-cos-acl"]&&(j.ACL=p.headers["x-cos-acl"]),j=r.extend(j,{Owner:b,Grants:O,statusCode:p.statusCode,headers:p.headers}),y(null,j)})}function z(i,y){var s=i.CORSConfiguration||{},p=s.CORSRules||i.CORSRules||[];p=r.clone(r.isArray(p)?p:[p]),r.each(p,function(j){r.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],function(te){var ke=te+"s",Te=j[ke]||j[te]||[];delete j[ke],j[te]=r.isArray(Te)?Te:[Te]})});var R={CORSRule:p};i.ResponseVary&&(R.ResponseVary=i.ResponseVary);var b=r.json2xml({CORSConfiguration:R}),O=i.Headers;O["Content-Type"]="application/xml",O["Content-MD5"]=r.b64(r.md5(b)),le.call(this,{Action:"name/cos:PutBucketCORS",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:b,action:"cors",headers:O},function(j,te){if(j)return y(j);y(null,{statusCode:te.statusCode,headers:te.headers})})}function P(i,y){le.call(this,{Action:"name/cos:GetBucketCORS",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"cors"},function(s,p){if(s){if(s.statusCode===404&&s.error&&s.error.Code==="NoSuchCORSConfiguration"){var R={CORSRules:[],statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}var b=p.CORSConfiguration||{},O=b.CORSRules||b.CORSRule||[];O=r.clone(r.isArray(O)?O:[O]);var j=b.ResponseVary;r.each(O,function(te){r.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],function(ke){var Te=ke+"s",Se=te[Te]||te[ke]||[];delete te[ke],te[Te]=r.isArray(Se)?Se:[Se]})}),y(null,{CORSRules:O,ResponseVary:j,statusCode:p.statusCode,headers:p.headers})})}function L(i,y){le.call(this,{Action:"name/cos:DeleteBucketCORS",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"cors"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode||s.statusCode,headers:p.headers})})}function Y(i,y){le.call(this,{Action:"name/cos:GetBucketLocation",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"location"},y)}function W(i,y){var s=i.Policy;try{typeof s=="string"&&(s=JSON.parse(s))}catch(b){}if(!s||typeof s=="string")return y(r.error(new Error("Policy format error")));var p=JSON.stringify(s);s.version||(s.version="2.0");var R=i.Headers;R["Content-Type"]="application/json",R["Content-MD5"]=r.b64(r.md5(p)),le.call(this,{Action:"name/cos:PutBucketPolicy",method:"PUT",Bucket:i.Bucket,Region:i.Region,action:"policy",body:p,headers:R},function(b,O){if(b&&b.statusCode===204)return y(null,{statusCode:b.statusCode});if(b)return y(b);y(null,{statusCode:O.statusCode,headers:O.headers})})}function ie(i,y){le.call(this,{Action:"name/cos:GetBucketPolicy",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"policy",rawBody:!0},function(s,p){if(s)return s.statusCode&&s.statusCode===403?y(r.error(s,{ErrorStatus:"Access Denied"})):s.statusCode&&s.statusCode===405?y(r.error(s,{ErrorStatus:"Method Not Allowed"})):s.statusCode&&s.statusCode===404?y(r.error(s,{ErrorStatus:"Policy Not Found"})):y(s);var R={};try{R=JSON.parse(p.body)}catch(b){}y(null,{Policy:R,statusCode:p.statusCode,headers:p.headers})})}function B(i,y){le.call(this,{Action:"name/cos:DeleteBucketPolicy",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"policy"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode||s.statusCode,headers:p.headers})})}function E(i,y){var s=i.Tagging||{},p=s.TagSet||s.Tags||i.Tags||[];p=r.clone(r.isArray(p)?p:[p]);var R=r.json2xml({Tagging:{TagSet:{Tag:p}}}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:PutBucketTagging",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:R,action:"tagging",headers:b},function(O,j){if(O&&O.statusCode===204)return y(null,{statusCode:O.statusCode});if(O)return y(O);y(null,{statusCode:j.statusCode,headers:j.headers})})}function C(i,y){le.call(this,{Action:"name/cos:GetBucketTagging",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"tagging"},function(s,p){if(s){if(s.statusCode===404&&s.error&&(s.error==="Not Found"||s.error.Code==="NoSuchTagSet")){var R={Tags:[],statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}var b=[];try{b=p.Tagging.TagSet.Tag||[]}catch(O){}b=r.clone(r.isArray(b)?b:[b]),y(null,{Tags:b,statusCode:p.statusCode,headers:p.headers})})}function k(i,y){le.call(this,{Action:"name/cos:DeleteBucketTagging",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"tagging"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function g(i,y){var s=i.LifecycleConfiguration||{},p=s.Rules||i.Rules||[];p=r.clone(p);var R=r.json2xml({LifecycleConfiguration:{Rule:p}}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:PutBucketLifecycle",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:R,action:"lifecycle",headers:b},function(O,j){if(O&&O.statusCode===204)return y(null,{statusCode:O.statusCode});if(O)return y(O);y(null,{statusCode:j.statusCode,headers:j.headers})})}function U(i,y){le.call(this,{Action:"name/cos:GetBucketLifecycle",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"lifecycle"},function(s,p){if(s){if(s.statusCode===404&&s.error&&s.error.Code==="NoSuchLifecycleConfiguration"){var R={Rules:[],statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}var b=[];try{b=p.LifecycleConfiguration.Rule||[]}catch(O){}b=r.clone(r.isArray(b)?b:[b]),y(null,{Rules:b,statusCode:p.statusCode,headers:p.headers})})}function F(i,y){le.call(this,{Action:"name/cos:DeleteBucketLifecycle",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"lifecycle"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function H(i,y){if(!i.VersioningConfiguration){y(r.error(new Error("missing param VersioningConfiguration")));return}var s=i.VersioningConfiguration||{},p=r.json2xml({VersioningConfiguration:s}),R=i.Headers;R["Content-Type"]="application/xml",R["Content-MD5"]=r.b64(r.md5(p)),le.call(this,{Action:"name/cos:PutBucketVersioning",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:p,action:"versioning",headers:R},function(b,O){if(b&&b.statusCode===204)return y(null,{statusCode:b.statusCode});if(b)return y(b);y(null,{statusCode:O.statusCode,headers:O.headers})})}function K(i,y){le.call(this,{Action:"name/cos:GetBucketVersioning",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"versioning"},function(s,p){s||!p.VersioningConfiguration&&(p.VersioningConfiguration={}),y(s,p)})}function _(i,y){var s=r.clone(i.ReplicationConfiguration),p=r.json2xml({ReplicationConfiguration:s});p=p.replace(/<(\/?)Rules>/gi,"<$1Rule>"),p=p.replace(/<(\/?)Tags>/gi,"<$1Tag>");var R=i.Headers;R["Content-Type"]="application/xml",R["Content-MD5"]=r.b64(r.md5(p)),le.call(this,{Action:"name/cos:PutBucketReplication",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:p,action:"replication",headers:R},function(b,O){if(b&&b.statusCode===204)return y(null,{statusCode:b.statusCode});if(b)return y(b);y(null,{statusCode:O.statusCode,headers:O.headers})})}function V(i,y){le.call(this,{Action:"name/cos:GetBucketReplication",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"replication"},function(s,p){if(s){if(s.statusCode===404&&s.error&&(s.error==="Not Found"||s.error.Code==="ReplicationConfigurationnotFoundError")){var R={ReplicationConfiguration:{Rules:[]},statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}!p.ReplicationConfiguration&&(p.ReplicationConfiguration={}),p.ReplicationConfiguration.Rule&&(p.ReplicationConfiguration.Rules=r.makeArray(p.ReplicationConfiguration.Rule),delete p.ReplicationConfiguration.Rule),y(s,p)})}function X(i,y){le.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"replication"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function G(i,y){if(!i.WebsiteConfiguration){y(r.error(new Error("missing param WebsiteConfiguration")));return}var s=r.clone(i.WebsiteConfiguration||{}),p=s.RoutingRules||s.RoutingRule||[];p=r.isArray(p)?p:[p],delete s.RoutingRule,delete s.RoutingRules,p.length&&(s.RoutingRules={RoutingRule:p});var R=r.json2xml({WebsiteConfiguration:s}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:PutBucketWebsite",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:R,action:"website",headers:b},function(O,j){if(O&&O.statusCode===204)return y(null,{statusCode:O.statusCode});if(O)return y(O);y(null,{statusCode:j.statusCode,headers:j.headers})})}function $(i,y){le.call(this,{Action:"name/cos:GetBucketWebsite",method:"GET",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,action:"website"},function(s,p){if(s){if(s.statusCode===404&&s.error.Code==="NoSuchWebsiteConfiguration"){var R={WebsiteConfiguration:{},statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}var b=p.WebsiteConfiguration||{};if(b.RoutingRules){var O=r.clone(b.RoutingRules.RoutingRule||[]);O=r.makeArray(O),b.RoutingRules=O}y(null,{WebsiteConfiguration:b,statusCode:p.statusCode,headers:p.headers})})}function re(i,y){le.call(this,{Action:"name/cos:DeleteBucketWebsite",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"website"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function ue(i,y){if(!i.RefererConfiguration){y(r.error(new Error("missing param RefererConfiguration")));return}var s=r.clone(i.RefererConfiguration||{}),p=s.DomainList||{},R=p.Domains||p.Domain||[];R=r.isArray(R)?R:[R],R.length&&(s.DomainList={Domain:R});var b=r.json2xml({RefererConfiguration:s}),O=i.Headers;O["Content-Type"]="application/xml",O["Content-MD5"]=r.b64(r.md5(b)),le.call(this,{Action:"name/cos:PutBucketReferer",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:b,action:"referer",headers:O},function(j,te){if(j&&j.statusCode===204)return y(null,{statusCode:j.statusCode});if(j)return y(j);y(null,{statusCode:te.statusCode,headers:te.headers})})}function oe(i,y){le.call(this,{Action:"name/cos:GetBucketReferer",method:"GET",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,action:"referer"},function(s,p){if(s){if(s.statusCode===404&&s.error.Code==="NoSuchRefererConfiguration"){var R={WebsiteConfiguration:{},statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}var b=p.RefererConfiguration||{};if(b.DomainList){var O=r.makeArray(b.DomainList.Domain||[]);b.DomainList={Domains:O}}y(null,{RefererConfiguration:b,statusCode:p.statusCode,headers:p.headers})})}function ee(i,y){var s=i.DomainConfiguration||{},p=s.DomainRule||i.DomainRule||[];p=r.clone(p);var R=r.json2xml({DomainConfiguration:{DomainRule:p}}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:PutBucketDomain",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:R,action:"domain",headers:b},function(O,j){if(O&&O.statusCode===204)return y(null,{statusCode:O.statusCode});if(O)return y(O);y(null,{statusCode:j.statusCode,headers:j.headers})})}function ce(i,y){le.call(this,{Action:"name/cos:GetBucketDomain",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"domain"},function(s,p){if(s)return y(s);var R=[];try{R=p.DomainConfiguration.DomainRule||[]}catch(b){}R=r.clone(r.isArray(R)?R:[R]),y(null,{DomainRule:R,statusCode:p.statusCode,headers:p.headers})})}function ae(i,y){le.call(this,{Action:"name/cos:DeleteBucketDomain",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"domain"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function pe(i,y){var s=i.OriginConfiguration||{},p=s.OriginRule||i.OriginRule||[];p=r.clone(p);var R=r.json2xml({OriginConfiguration:{OriginRule:p}}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:PutBucketOrigin",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:R,action:"origin",headers:b},function(O,j){if(O&&O.statusCode===204)return y(null,{statusCode:O.statusCode});if(O)return y(O);y(null,{statusCode:j.statusCode,headers:j.headers})})}function Z(i,y){le.call(this,{Action:"name/cos:GetBucketOrigin",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"origin"},function(s,p){if(s)return y(s);var R=[];try{R=p.OriginConfiguration.OriginRule||[]}catch(b){}R=r.clone(r.isArray(R)?R:[R]),y(null,{OriginRule:R,statusCode:p.statusCode,headers:p.headers})})}function ne(i,y){le.call(this,{Action:"name/cos:DeleteBucketOrigin",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"origin"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function ge(i,y){var s=r.json2xml({BucketLoggingStatus:i.BucketLoggingStatus||""}),p=i.Headers;p["Content-Type"]="application/xml",p["Content-MD5"]=r.b64(r.md5(s)),le.call(this,{Action:"name/cos:PutBucketLogging",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:s,action:"logging",headers:p},function(R,b){if(R&&R.statusCode===204)return y(null,{statusCode:R.statusCode});if(R)return y(R);y(null,{statusCode:b.statusCode,headers:b.headers})})}function me(i,y){le.call(this,{Action:"name/cos:GetBucketLogging",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"logging"},function(s,p){if(s)return y(s);y(null,{BucketLoggingStatus:p.BucketLoggingStatus,statusCode:p.statusCode,headers:p.headers})})}function ve(i,y,s){var p=r.clone(y.InventoryConfiguration);if(p.OptionalFields){var R=p.OptionalFields||[];p.OptionalFields={Field:R}}if(p.Destination&&p.Destination.COSBucketDestination&&p.Destination.COSBucketDestination.Encryption){var b=p.Destination.COSBucketDestination.Encryption;Object.keys(b).indexOf("SSECOS")>-1&&(b["SSE-COS"]=b.SSECOS,delete b.SSECOS)}var O=r.json2xml({InventoryConfiguration:p}),j=y.Headers;j["Content-Type"]="application/xml",j["Content-MD5"]=r.b64(r.md5(O));var te=i==="PUT"?"name/cos:PutBucketInventory":"name/cos:PostBucketInventory";le.call(this,{Action:te,method:i,Bucket:y.Bucket,Region:y.Region,body:O,action:"inventory",qs:{id:y.Id},headers:j},function(ke,Te){if(ke&&ke.statusCode===204)return s(null,{statusCode:ke.statusCode});if(ke)return s(ke);s(null,{statusCode:Te.statusCode,headers:Te.headers})})}function ye(i,y){return ve.call(this,"PUT",i,y)}function Ce(i,y){return ve.call(this,"POST",i,y)}function Ee(i,y){le.call(this,{Action:"name/cos:GetBucketInventory",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"inventory",qs:{id:i.Id}},function(s,p){if(s)return y(s);var R=p.InventoryConfiguration;if(R&&R.OptionalFields&&R.OptionalFields.Field){var b=R.OptionalFields.Field;r.isArray(b)||(b=[b]),R.OptionalFields=b}if(R.Destination&&R.Destination.COSBucketDestination&&R.Destination.COSBucketDestination.Encryption){var O=R.Destination.COSBucketDestination.Encryption;Object.keys(O).indexOf("SSE-COS")>-1&&(O.SSECOS=O["SSE-COS"],delete O["SSE-COS"])}y(null,{InventoryConfiguration:R,statusCode:p.statusCode,headers:p.headers})})}function be(i,y){le.call(this,{Action:"name/cos:ListBucketInventory",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"inventory",qs:{"continuation-token":i.ContinuationToken}},function(s,p){if(s)return y(s);var R=p.ListInventoryConfigurationResult,b=R.InventoryConfiguration||[];b=r.isArray(b)?b:[b],delete R.InventoryConfiguration,r.each(b,function(O){if(O&&O.OptionalFields&&O.OptionalFields.Field){var j=O.OptionalFields.Field;r.isArray(j)||(j=[j]),O.OptionalFields=j}if(O.Destination&&O.Destination.COSBucketDestination&&O.Destination.COSBucketDestination.Encryption){var te=O.Destination.COSBucketDestination.Encryption;Object.keys(te).indexOf("SSE-COS")>-1&&(te.SSECOS=te["SSE-COS"],delete te["SSE-COS"])}}),R.InventoryConfigurations=b,r.extend(R,{statusCode:p.statusCode,headers:p.headers}),y(null,R)})}function Oe(i,y){le.call(this,{Action:"name/cos:DeleteBucketInventory",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"inventory",qs:{id:i.Id}},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function we(i,y){if(!i.AccelerateConfiguration){y(r.error(new Error("missing param AccelerateConfiguration")));return}var s={AccelerateConfiguration:i.AccelerateConfiguration||{}},p=r.json2xml(s),R={};R["Content-Type"]="application/xml",R["Content-MD5"]=r.b64(r.md5(p)),le.call(this,{Action:"name/cos:PutBucketAccelerate",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:p,action:"accelerate",headers:R},function(b,O){if(b)return y(b);y(null,{statusCode:O.statusCode,headers:O.headers})})}function De(i,y){le.call(this,{Action:"name/cos:GetBucketAccelerate",method:"GET",Bucket:i.Bucket,Region:i.Region,action:"accelerate"},function(s,p){s||!p.AccelerateConfiguration&&(p.AccelerateConfiguration={}),y(s,p)})}function He(i,y){var s=i.ServerSideEncryptionConfiguration||{},p=s.Rule||s.Rules||[],R=r.json2xml({ServerSideEncryptionConfiguration:{Rule:p}}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:PutBucketEncryption",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:R,action:"encryption",headers:b},function(O,j){if(O&&O.statusCode===204)return y(null,{statusCode:O.statusCode});if(O)return y(O);y(null,{statusCode:j.statusCode,headers:j.headers})})}function Pe(i,y){le.call(this,{Action:"name/cos:GetBucketEncryption",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"encryption"},function(s,p){if(s){if(s.statusCode===404&&s.code==="NoSuchEncryptionConfiguration"){var R={EncryptionConfiguration:{Rules:[]},statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}var b=r.makeArray(p.EncryptionConfiguration&&p.EncryptionConfiguration.Rule||[]);p.EncryptionConfiguration={Rules:b},y(s,p)})}function se(i,y){le.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"encryption"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function h(i,y){le.call(this,{Action:"name/cos:HeadObject",method:"HEAD",Bucket:i.Bucket,Region:i.Region,Key:i.Key,VersionId:i.VersionId,headers:i.Headers},function(s,p){if(s){var R=s.statusCode;return i.Headers["If-Modified-Since"]&&R&&R===304?y(null,{NotModified:!0,statusCode:R}):y(s)}p.ETag=r.attr(p.headers,"etag",""),y(null,p)})}function c(i,y){var s={};s.prefix=i.Prefix||"",s.delimiter=i.Delimiter,s["key-marker"]=i.KeyMarker,s["version-id-marker"]=i.VersionIdMarker,s["max-keys"]=i.MaxKeys,s["encoding-type"]=i.EncodingType,le.call(this,{Action:"name/cos:GetBucketObjectVersions",ResourceKey:s.prefix,method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,qs:s,action:"versions"},function(p,R){if(p)return y(p);var b=R.ListVersionsResult||{},O=b.DeleteMarker||[];O=r.isArray(O)?O:[O];var j=b.Version||[];j=r.isArray(j)?j:[j];var te=r.clone(b);delete te.DeleteMarker,delete te.Version,r.extend(te,{DeleteMarkers:O,Versions:j,statusCode:R.statusCode,headers:R.headers}),y(null,te)})}function a(i,y){var s=i.Query||{},p=i.QueryString||"",R=r.throttleOnProgress.call(this,0,i.onProgress),b=i.tracker;b&&b.setParams({signStartTime:new Date().getTime()}),s["response-content-type"]=i.ResponseContentType,s["response-content-language"]=i.ResponseContentLanguage,s["response-expires"]=i.ResponseExpires,s["response-cache-control"]=i.ResponseCacheControl,s["response-content-disposition"]=i.ResponseContentDisposition,s["response-content-encoding"]=i.ResponseContentEncoding,le.call(this,{Action:"name/cos:GetObject",method:"GET",Bucket:i.Bucket,Region:i.Region,Key:i.Key,VersionId:i.VersionId,DataType:i.DataType,headers:i.Headers,qs:s,qsStr:p,rawBody:!0,onDownloadProgress:R,tracker:b},function(O,j){if(R(null,!0),O){var te=O.statusCode;return i.Headers["If-Modified-Since"]&&te&&te===304?y(null,{NotModified:!0}):y(O)}y(null,{Body:j.body,ETag:r.attr(j.headers,"etag",""),statusCode:j.statusCode,headers:j.headers})})}function d(i,y){var s=this,p=i.ContentLength,R=r.throttleOnProgress.call(s,p,i.onProgress),b=i.Headers;!b["Cache-Control"]&&!b["cache-control"]&&(b["Cache-Control"]=""),!b["Content-Type"]&&!b["content-type"]&&(b["Content-Type"]=i.Body&&i.Body.type||"");var O=i.UploadAddMetaMd5||s.options.UploadAddMetaMd5||s.options.UploadCheckContentMd5,j=i.tracker;O&&j&&j.setParams({md5StartTime:new Date().getTime()}),r.getBodyMd5(O,i.Body,function(te){te&&(j&&j.setParams({md5EndTime:new Date().getTime()}),s.options.UploadCheckContentMd5&&(b["Content-MD5"]=r.b64(te)),(i.UploadAddMetaMd5||s.options.UploadAddMetaMd5)&&(b["x-cos-meta-md5"]=te)),i.ContentLength!==void 0&&(b["Content-Length"]=i.ContentLength),R(null,!0),le.call(s,{Action:"name/cos:PutObject",TaskId:i.TaskId,method:"PUT",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,qs:i.Query,body:i.Body,onProgress:R,tracker:j},function(ke,Te){if(ke)return R(null,!0),y(ke);R({loaded:p,total:p},!0);var Se=q({ForcePathStyle:s.options.ForcePathStyle,protocol:s.options.Protocol,domain:s.options.Domain,bucket:i.Bucket,region:s.options.UseAccelerate?"accelerate":i.Region,object:i.Key});Se=Se.substr(Se.indexOf("://")+3),Te.Location=Se,Te.ETag=r.attr(Te.headers,"etag",""),y(null,Te)})},i.onHashProgress)}function m(i,y){le.call(this,{Action:"name/cos:DeleteObject",method:"DELETE",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,VersionId:i.VersionId,action:i.Recursive?"recursive":""},function(s,p){if(s){var R=s.statusCode;return R&&R===404?y(null,{BucketNotFound:!0,statusCode:R}):y(s)}y(null,{statusCode:p.statusCode,headers:p.headers})})}function I(i,y){var s={};i.VersionId&&(s.versionId=i.VersionId),le.call(this,{Action:"name/cos:GetObjectACL",method:"GET",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,qs:s,action:"acl"},function(p,R){if(p)return y(p);var b=R.AccessControlPolicy||{},O=b.Owner||{},j=b.AccessControlList&&b.AccessControlList.Grant||[];j=r.isArray(j)?j:[j];var te=v(b);delete te.GrantWrite,R.headers&&R.headers["x-cos-acl"]&&(te.ACL=R.headers["x-cos-acl"]),te=r.extend(te,{Owner:O,Grants:j,statusCode:R.statusCode,headers:R.headers}),y(null,te)})}function M(i,y){var s=i.Headers,p="";if(i.AccessControlPolicy){var R=r.clone(i.AccessControlPolicy||{}),b=R.Grants||R.Grant;b=r.isArray(b)?b:[b],delete R.Grant,delete R.Grants,R.AccessControlList={Grant:b},p=r.json2xml({AccessControlPolicy:R}),s["Content-Type"]="application/xml",s["Content-MD5"]=r.b64(r.md5(p))}r.each(s,function(O,j){j.indexOf("x-cos-grant-")===0&&(s[j]=N(s[j]))}),le.call(this,{Action:"name/cos:PutObjectACL",method:"PUT",Bucket:i.Bucket,Region:i.Region,Key:i.Key,action:"acl",headers:s,body:p},function(O,j){if(O)return y(O);y(null,{statusCode:j.statusCode,headers:j.headers})})}function Q(i,y){var s=i.Headers;s.Origin=i.Origin,s["Access-Control-Request-Method"]=i.AccessControlRequestMethod,s["Access-Control-Request-Headers"]=i.AccessControlRequestHeaders,le.call(this,{Action:"name/cos:OptionsObject",method:"OPTIONS",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:s},function(p,R){if(p)return p.statusCode&&p.statusCode===403?y(null,{OptionsForbidden:!0,statusCode:p.statusCode}):y(p);var b=R.headers||{};y(null,{AccessControlAllowOrigin:b["access-control-allow-origin"],AccessControlAllowMethods:b["access-control-allow-methods"],AccessControlAllowHeaders:b["access-control-allow-headers"],AccessControlExposeHeaders:b["access-control-expose-headers"],AccessControlMaxAge:b["access-control-max-age"],statusCode:R.statusCode,headers:R.headers})})}function de(i,y){var s=this,p=i.Headers;!p["Cache-Control"]&&!p["cache-control"]&&(p["Cache-Control"]="");var R=i.CopySource||"",b=r.getSourceParams.call(this,R);if(!b){y(r.error(new Error("CopySource format error")));return}var O=b.Bucket,j=b.Region,te=decodeURIComponent(b.Key);le.call(this,{Scope:[{action:"name/cos:GetObject",bucket:O,region:j,prefix:te},{action:"name/cos:PutObject",bucket:i.Bucket,region:i.Region,prefix:i.Key}],method:"PUT",Bucket:i.Bucket,Region:i.Region,Key:i.Key,VersionId:i.VersionId,headers:i.Headers},function(ke,Te){if(ke)return y(ke);var Se=r.clone(Te.CopyObjectResult||{}),Ae=q({ForcePathStyle:s.options.ForcePathStyle,protocol:s.options.Protocol,domain:s.options.Domain,bucket:i.Bucket,region:i.Region,object:i.Key,isLocation:!0});r.extend(Se,{Location:Ae,statusCode:Te.statusCode,headers:Te.headers}),y(null,Se)})}function he(i,y){var s=i.CopySource||"",p=r.getSourceParams.call(this,s);if(!p){y(r.error(new Error("CopySource format error")));return}var R=p.Bucket,b=p.Region,O=decodeURIComponent(p.Key);le.call(this,{Scope:[{action:"name/cos:GetObject",bucket:R,region:b,prefix:O},{action:"name/cos:PutObject",bucket:i.Bucket,region:i.Region,prefix:i.Key}],method:"PUT",Bucket:i.Bucket,Region:i.Region,Key:i.Key,VersionId:i.VersionId,qs:{partNumber:i.PartNumber,uploadId:i.UploadId},headers:i.Headers},function(j,te){if(j)return y(j);var ke=r.clone(te.CopyPartResult||{});r.extend(ke,{statusCode:te.statusCode,headers:te.headers}),y(null,ke)})}function J(i,y){var s=i.Objects||[],p=i.Quiet;s=r.isArray(s)?s:[s];var R=r.json2xml({Delete:{Object:s,Quiet:p||!1}}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R));var O=r.map(s,function(j){return{action:"name/cos:DeleteObject",bucket:i.Bucket,region:i.Region,prefix:j.Key}});le.call(this,{Scope:O,method:"POST",Bucket:i.Bucket,Region:i.Region,body:R,action:"delete",headers:b},function(j,te){if(j)return y(j);var ke=te.DeleteResult||{},Te=ke.Deleted||[],Se=ke.Error||[];Te=r.isArray(Te)?Te:[Te],Se=r.isArray(Se)?Se:[Se];var Ae=r.clone(ke);r.extend(Ae,{Error:Se,Deleted:Te,statusCode:te.statusCode,headers:te.headers}),y(null,Ae)})}function xe(i,y){var s=i.Headers;if(!i.RestoreRequest){y(r.error(new Error("missing param RestoreRequest")));return}var p=i.RestoreRequest||{},R=r.json2xml({RestoreRequest:p});s["Content-Type"]="application/xml",s["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:RestoreObject",method:"POST",Bucket:i.Bucket,Region:i.Region,Key:i.Key,VersionId:i.VersionId,body:R,action:"restore",headers:s},y)}function Be(i,y){var s=i.Tagging||{},p=s.TagSet||s.Tags||i.Tags||[];p=r.clone(r.isArray(p)?p:[p]);var R=r.json2xml({Tagging:{TagSet:{Tag:p}}}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:PutObjectTagging",method:"PUT",Bucket:i.Bucket,Key:i.Key,Region:i.Region,body:R,action:"tagging",headers:b,VersionId:i.VersionId},function(O,j){if(O&&O.statusCode===204)return y(null,{statusCode:O.statusCode});if(O)return y(O);y(null,{statusCode:j.statusCode,headers:j.headers})})}function Ue(i,y){le.call(this,{Action:"name/cos:GetObjectTagging",method:"GET",Key:i.Key,Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"tagging",VersionId:i.VersionId},function(s,p){if(s){if(s.statusCode===404&&s.error&&(s.error==="Not Found"||s.error.Code==="NoSuchTagSet")){var R={Tags:[],statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}var b=[];try{b=p.Tagging.TagSet.Tag||[]}catch(O){}b=r.clone(r.isArray(b)?b:[b]),y(null,{Tags:b,statusCode:p.statusCode,headers:p.headers})})}function _e(i,y){le.call(this,{Action:"name/cos:DeleteObjectTagging",method:"DELETE",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,action:"tagging",VersionId:i.VersionId},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function Le(i,y){var s=i.SelectType;if(!s)return y(r.error(new Error("missing param SelectType")));var p=i.SelectRequest||{},R=r.json2xml({SelectRequest:p}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:GetObject",method:"POST",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,action:"select",qs:{"select-type":i.SelectType},VersionId:i.VersionId,body:R,DataType:"arraybuffer",rawBody:!0},function(O,j){if(O&&O.statusCode===204)return y(null,{statusCode:O.statusCode});if(O)return y(O);var te=r.parseSelectPayload(j.body);y(null,{statusCode:j.statusCode,headers:j.headers,Body:te.body,Payload:te.payload})})}function Ve(i,y){var s=this,p=i.Headers,R=i.tracker;!p["Cache-Control"]&&!p["cache-control"]&&(p["Cache-Control"]=""),!p["Content-Type"]&&!p["content-type"]&&(p["Content-Type"]=i.Body&&i.Body.type||"");var b=i.Body&&(i.UploadAddMetaMd5||s.options.UploadAddMetaMd5);b&&R&&R.setParams({md5StartTime:new Date().getTime()}),r.getBodyMd5(b,i.Body,function(O){O&&(i.Headers["x-cos-meta-md5"]=O),b&&R&&R.setParams({md5EndTime:new Date().getTime()}),le.call(s,{Action:"name/cos:InitiateMultipartUpload",method:"POST",Bucket:i.Bucket,Region:i.Region,Key:i.Key,action:"uploads",headers:i.Headers,qs:i.Query,tracker:R},function(j,te){if(j)return R&&R.parent&&R.parent.setParams({errorNode:"multipartInit"}),y(j);if(te=r.clone(te||{}),te&&te.InitiateMultipartUploadResult)return y(null,r.extend(te.InitiateMultipartUploadResult,{statusCode:te.statusCode,headers:te.headers}));y(null,te)})},i.onHashProgress)}function qe(i,y){var s=this;r.getFileSize("multipartUpload",i,function(){var p=i.tracker,R=s.options.UploadCheckContentMd5;R&&p&&p.setParams({md5StartTime:new Date().getTime()}),r.getBodyMd5(R,i.Body,function(b){b&&(i.Headers["Content-MD5"]=r.b64(b)),R&&p&&p.setParams({md5EndTime:new Date().getTime()}),p&&p.setParams({partNumber:i.PartNumber}),le.call(s,{Action:"name/cos:UploadPart",TaskId:i.TaskId,method:"PUT",Bucket:i.Bucket,Region:i.Region,Key:i.Key,qs:{partNumber:i.PartNumber,uploadId:i.UploadId},headers:i.Headers,onProgress:i.onProgress,body:i.Body||null,tracker:p},function(O,j){if(O)return p&&p.parent&&p.parent.setParams({errorNode:"multipartUpload"}),y(O);y(null,{ETag:r.attr(j.headers,"etag",""),statusCode:j.statusCode,headers:j.headers})})})})}function Ge(i,y){for(var s=this,p=i.UploadId,R=i.Parts,b=i.tracker,O=0,j=R.length;O-1?Se(Te.Authorization):"sign="+encodeURIComponent(Te.Authorization)),Te.SecurityToken&&(Ae+="&x-cos-security-token="+Te.SecurityToken),Te.ClientIP&&(Ae+="&clientIP="+Te.ClientIP),Te.ClientUA&&(Ae+="&clientUA="+Te.ClientUA),Te.Token&&(Ae+="&token="+Te.Token),b&&(Ae+="&"+b),setTimeout(function(){y(null,{Url:Ae})})}});return te?(O+="?"+te.Authorization+(te.SecurityToken?"&x-cos-security-token="+te.SecurityToken:""),b&&(O+="&"+b)):b&&(O+="?"+b),O}function v(i){var y={GrantFullControl:[],GrantWrite:[],GrantRead:[],GrantReadAcp:[],GrantWriteAcp:[],ACL:""},s={FULL_CONTROL:"GrantFullControl",WRITE:"GrantWrite",READ:"GrantRead",READ_ACP:"GrantReadAcp",WRITE_ACP:"GrantWriteAcp"},p=i&&i.AccessControlList||{},R=p.Grant;R&&(R=r.isArray(R)?R:[R]);var b={READ:0,WRITE:0,FULL_CONTROL:0};return R&&R.length&&r.each(R,function(O){O.Grantee.ID==="qcs::cam::anyone:anyone"||O.Grantee.URI==="http://cam.qcloud.com/groups/global/AllUsers"?b[O.Permission]=1:O.Grantee.ID!==i.Owner.ID&&y[s[O.Permission]].push('id="'+O.Grantee.ID+'"')}),b.FULL_CONTROL||b.WRITE&&b.READ?y.ACL="public-read-write":b.READ?y.ACL="public-read":y.ACL="private",r.each(s,function(O){y[O]=N(y[O].join(","))}),y}function N(i){var y=i.split(","),s={},p,R;for(p=0;p"u"?"undefined":t(location))==="object"&&location.protocol==="http:"?"http:":"https:");b||(["cn-south","cn-south-2","cn-north","cn-east","cn-southwest","sg"].indexOf(y)>-1?b="{Region}.myqcloud.com":b="cos.{Region}.myqcloud.com",i.ForcePathStyle||(b="{Bucket}."+b)),b=b.replace(/\{\{AppId\}\}/gi,R).replace(/\{\{Bucket\}\}/gi,p).replace(/\{\{Region\}\}/gi,y).replace(/\{\{.*?\}\}/gi,""),b=b.replace(/\{AppId\}/gi,R).replace(/\{BucketName\}/gi,p).replace(/\{Bucket\}/gi,s).replace(/\{Region\}/gi,y).replace(/\{.*?\}/gi,""),/^[a-zA-Z]+:\/\//.test(b)||(b=j+"//"+b),b.slice(-1)==="/"&&(b=b.slice(0,-1));var te=b;return i.ForcePathStyle&&(te+="/"+s),te+="/",O&&(te+=r.camSafeUrlEncode(O).replace(/%2F/g,"/")),i.isLocation&&(te=te.replace(/^https?:\/\//,"")),te}var fe=function(y){if(!y.Bucket||!y.Region)return"";var s=y.UseAccelerate===void 0?this.options.UseAccelerate:y.UseAccelerate,p=y.Url||q({ForcePathStyle:this.options.ForcePathStyle,protocol:this.options.Protocol,domain:this.options.Domain,bucket:y.Bucket,region:s?"accelerate":y.Region}),R=p.replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1"),b=new RegExp("^([a-z\\d-]+-\\d+\\.)?(cos|cosv6|ci|pic)\\.([a-z\\d-]+)\\.myqcloud\\.com$");return b.test(R)?R:""};function Re(i,y){var s=r.clone(i.Headers),p="";r.each(s,function(Ie,Ne){(Ie===""||["content-type","cache-control","expires"].indexOf(Ne.toLowerCase())>-1)&&delete s[Ne],Ne.toLowerCase()==="host"&&(p=Ie)});var R=i.ForceSignHost!==!1;!p&&i.SignHost&&R&&(s.Host=i.SignHost);var b=!1,O=function(Ne,je){b||(b=!0,je&&je.XCosSecurityToken&&!je.SecurityToken&&(je=r.clone(je),je.SecurityToken=je.XCosSecurityToken,delete je.XCosSecurityToken),y&&y(Ne,je))},j=this,te=i.Bucket||"",ke=i.Region||"",Te=i.Key||"";j.options.ForcePathStyle&&te&&(Te=te+"/"+Te);var Se="/"+Te,Ae={},Fe=i.Scope;if(!Fe){var Je=i.Action||"",ot=i.ResourceKey||i.Key||"";Fe=i.Scope||[{action:Je,bucket:te,region:ke,prefix:ot}]}var rt=r.md5(JSON.stringify(Fe));j._StsCache=j._StsCache||[],function(){var Ie,Ne;for(Ie=j._StsCache.length-1;Ie>=0;Ie--){Ne=j._StsCache[Ie];var je=Math.round(r.getSkewTime(j.options.SystemClockOffset)/1e3)+30;if(Ne.StartTime&&je=Ne.ExpiredTime){j._StsCache.splice(Ie,1);continue}if(!Ne.ScopeLimit||Ne.ScopeLimit&&Ne.ScopeKey===rt){Ae=Ne;break}}}();var Ze=function(){var Ne="";Ae.StartTime&&i.Expires?Ne=Ae.StartTime+";"+(Ae.StartTime+i.Expires*1):Ae.StartTime&&Ae.ExpiredTime&&(Ne=Ae.StartTime+";"+Ae.ExpiredTime);var je=r.getAuth({SecretId:Ae.TmpSecretId,SecretKey:Ae.TmpSecretKey,Method:i.Method,Pathname:Se,Query:i.Query,Headers:s,Expires:i.Expires,UseRawKey:j.options.UseRawKey,SystemClockOffset:j.options.SystemClockOffset,KeyTime:Ne,ForceSignHost:R}),ze={Authorization:je,SecurityToken:Ae.SecurityToken||Ae.XCosSecurityToken||"",Token:Ae.Token||"",ClientIP:Ae.ClientIP||"",ClientUA:Ae.ClientUA||""};O(null,ze)},st=function(Ne){if(Ne.Authorization){var je=!1,ze=Ne.Authorization;if(ze)if(ze.indexOf(" ")>-1)je=!1;else if(ze.indexOf("q-sign-algorithm=")>-1&&ze.indexOf("q-ak=")>-1&&ze.indexOf("q-sign-time=")>-1&&ze.indexOf("q-key-time=")>-1&&ze.indexOf("q-url-param-list=")>-1)je=!0;else try{ze=atob(ze),ze.indexOf("a=")>-1&&ze.indexOf("k=")>-1&&ze.indexOf("t=")>-1&&ze.indexOf("r=")>-1&&ze.indexOf("b=")>-1&&(je=!0)}catch(tt){}if(!je)return r.error(new Error("getAuthorization callback params format error"))}else{if(!Ne.TmpSecretId)return r.error(new Error('getAuthorization callback params missing "TmpSecretId"'));if(!Ne.TmpSecretKey)return r.error(new Error('getAuthorization callback params missing "TmpSecretKey"'));if(!Ne.SecurityToken&&!Ne.XCosSecurityToken)return r.error(new Error('getAuthorization callback params missing "SecurityToken"'));if(!Ne.ExpiredTime)return r.error(new Error('getAuthorization callback params missing "ExpiredTime"'));if(Ne.ExpiredTime&&Ne.ExpiredTime.toString().length!==10)return r.error(new Error('getAuthorization callback params "ExpiredTime" should be 10 digits'));if(Ne.StartTime&&Ne.StartTime.toString().length!==10)return r.error(new Error('getAuthorization callback params "StartTime" should be 10 StartTime'))}return!1};if(Ae.ExpiredTime&&Ae.ExpiredTime-r.getSkewTime(j.options.SystemClockOffset)/1e3>60)Ze();else if(j.options.getAuthorization)j.options.getAuthorization.call(j,{Bucket:te,Region:ke,Method:i.Method,Key:Te,Pathname:Se,Query:i.Query,Headers:s,Scope:Fe,SystemClockOffset:j.options.SystemClockOffset,ForceSignHost:R},function(Ie){typeof Ie=="string"&&(Ie={Authorization:Ie});var Ne=st(Ie);if(Ne)return O(Ne);Ie.Authorization?O(null,Ie):(Ae=Ie||{},Ae.Scope=Fe,Ae.ScopeKey=rt,j._StsCache.push(Ae),Ze())});else if(j.options.getSTS)j.options.getSTS.call(j,{Bucket:te,Region:ke},function(Ie){Ae=Ie||{},Ae.Scope=Fe,Ae.ScopeKey=rt,Ae.TmpSecretId||(Ae.TmpSecretId=Ae.SecretId),Ae.TmpSecretKey||(Ae.TmpSecretKey=Ae.SecretKey);var Ne=st(Ae);if(Ne)return O(Ne);j._StsCache.push(Ae),Ze()});else return function(){var Ie=r.getAuth({SecretId:i.SecretId||j.options.SecretId,SecretKey:i.SecretKey||j.options.SecretKey,Method:i.Method,Pathname:Se,Query:i.Query,Headers:s,Expires:i.Expires,UseRawKey:j.options.UseRawKey,SystemClockOffset:j.options.SystemClockOffset,ForceSignHost:R}),Ne={Authorization:Ie,SecurityToken:j.options.SecurityToken||j.options.XCosSecurityToken};return O(null,Ne),Ne}();return""}function Me(i){var y=!1,s=!1,p=i.headers&&(i.headers.date||i.headers.Date)||i.error&&i.error.ServerTime;try{var R=i.error.Code,b=i.error.Message;(R==="RequestTimeTooSkewed"||R==="AccessDenied"&&b==="Request has expired")&&(s=!0)}catch(j){}if(i)if(s&&p){var O=Date.parse(p);this.options.CorrectClockSkew&&Math.abs(r.getSkewTime(this.options.SystemClockOffset)-O)>=3e4&&(console.error("error: Local time is too skewed."),this.options.SystemClockOffset=O-Date.now(),y=!0)}else Math.floor(i.statusCode/100)===5&&(y=!0);return y}function le(i,y){var s=this;!i.headers&&(i.headers={}),!i.qs&&(i.qs={}),i.VersionId&&(i.qs.versionId=i.VersionId),i.qs=r.clearKey(i.qs),i.headers&&(i.headers=r.clearKey(i.headers)),i.qs&&(i.qs=r.clearKey(i.qs));var p=r.clone(i.qs);i.action&&(p[i.action]="");var R=i.url||i.Url,b=i.SignHost||fe.call(this,{Bucket:i.Bucket,Region:i.Region,Url:R}),O=i.tracker,j=function te(ke){var Te=s.options.SystemClockOffset;O&&O.setParams({signStartTime:new Date().getTime(),retryTimes:ke-1}),Re.call(s,{Bucket:i.Bucket||"",Region:i.Region||"",Method:i.method,Key:i.Key,Query:p,Headers:i.headers,SignHost:b,Action:i.Action,ResourceKey:i.ResourceKey,Scope:i.Scope,ForceSignHost:s.options.ForceSignHost},function(Se,Ae){if(Se){y(Se);return}O&&O.setParams({signEndTime:new Date().getTime(),httpStartTime:new Date().getTime()}),i.AuthData=Ae,Ye.call(s,i,function(Fe,Je){O&&O.setParams({httpEndTime:new Date().getTime()}),Fe&&ke<2&&(Te!==s.options.SystemClockOffset||Me.call(s,Fe))?(i.headers&&(delete i.headers.Authorization,delete i.headers.token,delete i.headers.clientIP,delete i.headers.clientUA,i.headers["x-cos-security-token"]&&delete i.headers["x-cos-security-token"],i.headers["x-ci-security-token"]&&delete i.headers["x-ci-security-token"]),te(ke+1)):y(Fe,Je)})})};j(1)}function Ye(i,y){var s=this,p=i.TaskId;if(!(p&&!s._isRunningTask(p))){var R=i.Bucket,b=i.Region,O=i.Key,j=i.method||"GET",te=i.Url||i.url,ke=i.body,Te=i.rawBody;s.options.UseAccelerate&&(b="accelerate"),te=te||q({ForcePathStyle:s.options.ForcePathStyle,protocol:s.options.Protocol,domain:s.options.Domain,bucket:R,region:b,object:O}),i.action&&(te=te+"?"+(r.isIOS_QQ?"".concat(i.action,"="):i.action)),i.qsStr&&(te.indexOf("?")>-1?te=te+"&"+i.qsStr:te=te+"?"+i.qsStr);var Se={method:j,url:te,headers:i.headers,qs:i.qs,body:ke},Ae="x-cos-security-token";if(r.isCIHost(te)&&(Ae="x-ci-security-token"),Se.headers.Authorization=i.AuthData.Authorization,i.AuthData.Token&&(Se.headers.token=i.AuthData.Token),i.AuthData.ClientIP&&(Se.headers.clientIP=i.AuthData.ClientIP),i.AuthData.ClientUA&&(Se.headers.clientUA=i.AuthData.ClientUA),i.AuthData.SecurityToken&&(Se.headers[Ae]=i.AuthData.SecurityToken),Se.headers&&(Se.headers=r.clearKey(Se.headers)),Se=r.clearKey(Se),i.onProgress&&typeof i.onProgress=="function"){var Fe=ke&&(ke.size||ke.length)||0;Se.onProgress=function(Ie){if(!(p&&!s._isRunningTask(p))){var Ne=Ie?Ie.loaded:0;i.onProgress({loaded:Ne,total:Fe})}}}i.onDownloadProgress&&(Se.onDownloadProgress=i.onDownloadProgress),i.DataType&&(Se.dataType=i.DataType),this.options.Timeout&&(Se.timeout=this.options.Timeout),s.options.ForcePathStyle&&(Se.pathStyle=s.options.ForcePathStyle),s.emit("before-send",Se);var Je=Se.url.includes("accelerate."),ot=Se.qs?Object.keys(Se.qs).map(function(Ie){return"".concat(Ie,"=").concat(Se.qs[Ie])}).join("&"):"",rt=ot?Se.url+"?"+ot:Se.url;i.tracker&&i.tracker.setParams({reqUrl:rt,accelerate:Je?"Y":"N"}),i.tracker&&i.tracker.parent&&i.tracker.parent.setParams({reqUrl:rt,accelerate:Je?"Y":"N"});var Ze=(s.options.Request||l)(Se,function(Ie){if(!(Ie&&Ie.error==="abort")){var Ne={options:Se,error:Ie&&Ie.error,statusCode:Ie&&Ie.statusCode||0,statusMessage:Ie&&Ie.statusMessage||"",headers:Ie&&Ie.headers||{},body:Ie&&Ie.body};s.emit("after-receive",Ne);var je=Ne.error,ze=Ne.body,tt={statusCode:Ne.statusCode,statusMessage:Ne.statusMessage,headers:Ne.headers},pt,at=function(dt,ht){if(p&&s.off("inner-kill-task",st),!pt){pt=!0;var ft={};tt&&tt.statusCode&&(ft.statusCode=tt.statusCode),tt&&tt.headers&&(ft.headers=tt.headers),dt?(dt=r.extend(dt||{},ft),y(dt,null)):(ht=r.extend(ht||{},ft),y(null,ht)),Ze=null}};if(je)return at(r.error(je));var ct=tt.statusCode,gt=Math.floor(ct/100)===2;if(Te&>)return at(null,{body:ze});var ut;try{ut=ze&&ze.indexOf("<")>-1&&ze.indexOf(">")>-1&&r.xml2json(ze)||{}}catch(vt){ut={}}var lt=ut&&ut.Error;gt?at(null,ut):lt?at(r.error(new Error(lt.Message),{code:lt.Code,error:lt})):ct?at(r.error(new Error(tt.statusMessage),{code:""+ct})):ct&&at(r.error(new Error("statusCode error")))}}),st=function Ie(Ne){Ne.TaskId===p&&(Ze&&Ze.abort&&Ze.abort(),s.off("inner-kill-task",Ie))};p&&s.on("inner-kill-task",st)}}var Qe={getService:u,putBucket:T,headBucket:w,getBucket:x,deleteBucket:S,putBucketAcl:A,getBucketAcl:D,putBucketCors:z,getBucketCors:P,deleteBucketCors:L,getBucketLocation:Y,getBucketPolicy:ie,putBucketPolicy:W,deleteBucketPolicy:B,putBucketTagging:E,getBucketTagging:C,deleteBucketTagging:k,putBucketLifecycle:g,getBucketLifecycle:U,deleteBucketLifecycle:F,putBucketVersioning:H,getBucketVersioning:K,putBucketReplication:_,getBucketReplication:V,deleteBucketReplication:X,putBucketWebsite:G,getBucketWebsite:$,deleteBucketWebsite:re,putBucketReferer:ue,getBucketReferer:oe,putBucketDomain:ee,getBucketDomain:ce,deleteBucketDomain:ae,putBucketOrigin:pe,getBucketOrigin:Z,deleteBucketOrigin:ne,putBucketLogging:ge,getBucketLogging:me,putBucketInventory:ye,postBucketInventory:Ce,getBucketInventory:Ee,listBucketInventory:be,deleteBucketInventory:Oe,putBucketAccelerate:we,getBucketAccelerate:De,putBucketEncryption:He,getBucketEncryption:Pe,deleteBucketEncryption:se,getObject:a,headObject:h,listObjectVersions:c,putObject:d,deleteObject:m,getObjectAcl:I,putObjectAcl:M,optionsObject:Q,putObjectCopy:de,deleteMultipleObject:J,restoreObject:xe,putObjectTagging:Be,getObjectTagging:Ue,deleteObjectTagging:_e,selectObjectContent:Le,appendObject:et,uploadPartCopy:he,multipartInit:Ve,multipartUpload:qe,multipartComplete:Ge,multipartList:Ke,multipartListPart:We,multipartAbort:Xe,request:nt,getObjectUrl:f,getAuth:it};function $e(i,y,s){r.each(["Cors","Acl"],function(p){if(i.slice(-p.length)===p){var R=i.slice(0,-p.length)+p.toUpperCase(),b=r.apiWrapper(i,y),O=!1;s[R]=function(){!O&&console.warn("warning: cos."+R+" has been deprecated. Please Use cos."+i+" instead."),O=!0,b.apply(this,arguments)}}})}o.exports.init=function(i,y){y.transferToTaskMethod(Qe,"putObject"),r.each(Qe,function(s,p){i.prototype[p]=r.apiWrapper(p,s),$e(p,s,i.prototype)})}},"./src/cos.js":function(o,n,e){var t=e("./src/util.js"),l=e("./src/event.js"),r=e("./src/task.js"),u=e("./src/base.js"),T=e("./src/advance.js"),w=e("./package.json"),x={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:""},S=function(D){this.options=t.extend(t.clone(x),D||{}),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格式错误,请检查"),console.error("error: SecretId format is incorrect. Please check")),this.options.SecretKey&&this.options.SecretKey.indexOf(" ")>-1&&(console.error("error: SecretKey格式错误,请检查"),console.error("error: SecretKey format is incorrect. Please check")),t.isNode()&&(console.warn("warning: cos-js-sdk-v5 不支持 nodejs 环境使用,请改用 cos-nodejs-sdk-v5,参考文档: 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")),l.init(this),r.init(this)};u.init(S,r),T.init(S,r),S.util={md5:t.md5,xml2json:t.xml2json,json2xml:t.json2xml,encodeBase64:t.encodeBase64},S.getAuthorization=t.getAuth,S.version=w.version,o.exports=S},"./src/event.js":function(o,n){var e=function(r){var u={},T=function(x){return!u[x]&&(u[x]=[]),u[x]};r.on=function(w,x){w==="task-list-update"&&console.warn('warning: Event "'+w+'" has been deprecated. Please use "list-update" instead.'),T(w).push(x)},r.off=function(w,x){for(var S=T(w),A=S.length-1;A>=0;A--)x===S[A]&&S.splice(A,1)},r.emit=function(w,x){for(var S=T(w).map(function(D){return D}),A=0;A=0;Y--){var W=u[Y][2];(!W||W+r=0;W--){var ie=u[W];ie[0]===P&&ie[1]===L&&u.splice(W,1)}u.unshift([P,L,Math.round(Date.now()/1e3)]),u.length>Y&&u.splice(Y),A()}},removeUploadId:function(P){S.call(this),delete D.using[P];for(var L=u.length-1;L>=0;L--)u[L][1]===P&&u.splice(L,1);A()}};o.exports=D},"./src/task.js":function(o,n,e){var t=e("./src/session.js"),l=e("./src/util.js"),r={},u=function(x,S){r[S]=x[S],x[S]=function(A,D){A.SkipTask?r[S].call(this,A,D):this._addTask(S,A,D)}},T=function(x){var S=[],A={},D=0,z=0,P=function(C){var k={id:C.id,Bucket:C.Bucket,Region:C.Region,Key:C.Key,FilePath:C.FilePath,state:C.state,loaded:C.loaded,size:C.size,speed:C.speed,percent:C.percent,hashPercent:C.hashPercent,error:C.error};return C.FilePath&&(k.FilePath=C.FilePath),C._custom&&(k._custom=C._custom),k},L=function(){var E,C=function(){E=0,x.emit("task-list-update",{list:l.map(S,P)}),x.emit("list-update",{list:l.map(S,P)})};return function(){E||(E=setTimeout(C))}}(),Y=function(){if(!(S.length<=x.options.UploadQueueSize)){for(var C=0;Cx.options.UploadQueueSize;){var k=S[C].state==="waiting"||S[C].state==="checking"||S[C].state==="uploading";!S[C]||!k?(A[S[C].id]&&delete A[S[C].id],S.splice(C,1),z--):C++}L()}},W=function E(){if(!(D>=x.options.FileParallelLimit)){for(;S[z]&&S[z].state!=="waiting";)z++;if(!(z>=S.length)){var C=S[z];z++,D++,C.state="checking",C.params.onTaskStart&&C.params.onTaskStart(P(C)),!C.params.UploadData&&(C.params.UploadData={});var k=l.formatParams(C.api,C.params);r[C.api].call(x,k,function(g,U){x._isRunningTask(C.id)&&((C.state==="checking"||C.state==="uploading")&&(C.state=g?"error":"success",g&&(C.error=g),D--,L(),E(),C.callback&&C.callback(g,U),C.state==="success"&&(C.params&&(delete C.params.UploadData,delete C.params.Body,delete C.params),delete C.callback)),Y())}),L(),setTimeout(E)}}},ie=function(C,k){var g=A[C];if(g){var U=g&&g.state==="waiting",F=g&&(g.state==="checking"||g.state==="uploading");if(k==="canceled"&&g.state!=="canceled"||k==="paused"&&U||k==="paused"&&F){if(k==="paused"&&g.params.Body&&typeof g.params.Body.pipe=="function"){console.error("stream not support pause");return}g.state=k,x.emit("inner-kill-task",{TaskId:C,toState:k});try{var H=g&&g.params&&g.params.UploadData.UploadId}catch(K){}k==="canceled"&&H&&t.removeUsing(H),L(),F&&(D--,W()),k==="canceled"&&(g.params&&(delete g.params.UploadData,delete g.params.Body,delete g.params),delete g.callback)}Y()}};x._addTasks=function(E){l.each(E,function(C){x._addTask(C.api,C.params,C.callback,!0)}),L()};var B=!0;x._addTask=function(E,C,k,g){C=l.formatParams(E,C);var U=l.uuid();C.TaskId=U,C.onTaskReady&&C.onTaskReady(U),C.TaskReady&&(C.TaskReady(U),B&&console.warn('warning: Param "TaskReady" has been deprecated. Please use "onTaskReady" instead.'),B=!1);var F={params:C,callback:k,api:E,index:S.length,id:U,Bucket:C.Bucket,Region:C.Region,Key:C.Key,FilePath:C.FilePath||"",state:"waiting",loaded:0,size:0,speed:0,percent:0,hashPercent:0,error:null,_custom:C._custom},H=C.onHashProgress;C.onHashProgress=function(_){x._isRunningTask(F.id)&&(F.hashPercent=_.percent,H&&H(_),L())};var K=C.onProgress;return C.onProgress=function(_){x._isRunningTask(F.id)&&(F.state==="checking"&&(F.state="uploading"),F.loaded=_.loaded,F.speed=_.speed,F.percent=_.percent,K&&K(_),L())},l.getFileSize(E,C,function(_,V){if(_)return k(l.error(_));A[U]=F,S.push(F),F.size=V,!g&&L(),W(),Y()}),U},x._isRunningTask=function(E){var C=A[E];return!!(C&&(C.state==="checking"||C.state==="uploading"))},x.getTaskList=function(){return l.map(S,P)},x.cancelTask=function(E){ie(E,"canceled")},x.pauseTask=function(E){ie(E,"paused")},x.restartTask=function(E){var C=A[E];C&&(C.state==="paused"||C.state==="error")&&(C.state="waiting",L(),z=Math.min(z,C.index),W())},x.isUploadRunning=function(){return D||z"u"?"undefined":r(navigator))==="object"){var E=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return(E==null?void 0:E.type)||(E==null?void 0:E.effectiveType)||"unknown"}return"unknown"},getOsType:function(){if((typeof navigator>"u"?"undefined":r(navigator))!=="object")return"unknown os";var E=navigator.userAgent.toLowerCase(),C=/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":C?"mac":"unknown os"},isMobile:function(){var E=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i;return!!((typeof navigator>"u"?"undefined":r(navigator))==="object"&&navigator.userAgent.match(E))},isAndroid:function(){var E=/(Android|Adr|Linux)/i;return!!((typeof navigator>"u"?"undefined":r(navigator))==="object"&&navigator.userAgent.match(E))},isIOS:function(){var E=/(iPhone|iPod|iPad|iOS)/i;return!!((typeof navigator>"u"?"undefined":r(navigator))==="object"&&navigator.userAgent.match(E))},isOtherMobile:function(){return isMobile&&!isAndroid&&!isIOS},getDeviceName:function(){if((typeof navigator>"u"?"undefined":r(navigator))!=="object")return"unknown device";var E=navigator.userAgent.toLowerCase();if(E.includes("app/tencent_wemeet"))return"tencent_wemeet";if(E.indexOf("maxthon")>=0){var C=E.match(/maxthon\/([\d.]+)/),k=C&&C[1]||"";return"傲游浏览器 ".concat(k).trim()}if(E.indexOf("qqbrowser")>=0){var g=E.match(/qqbrowser\/([\d.]+)/),U=g&&g[1]||"";return"QQ浏览器 ".concat(U).trim()}if(E.indexOf("se 2.x")>=0)return"搜狗浏览器";if(E.indexOf("wxwork")>=0)return"微信内置浏览器";if(E.indexOf("msie")>=0){var F=E.match(/msie ([\d.]+)/),H=F&&F[1]||"";return"IE ".concat(H).trim()}if(E.indexOf("firefox")>=0){var K=E.match(/firefox\/([\d.]+)/),_=K&&K[1]||"";return"Firefox ".concat(_).trim()}if(E.indexOf("chrome")>=0){var V=E.match(/chrome\/([\d.]+)/),X=V&&V[1]||"";return"Chrome ".concat(X).trim()}if(E.indexOf("opera")>=0){var G=E.match(/opera.([\d.]+)/),$=G&&G[1]||"";return"Opera ".concat($).trim()}if(E.indexOf("safari")>=0){var re=E.match(/version\/([\d.]+)/),ue=re&&re[1]||"";return"Safari ".concat(ue).trim()}if(E.indexOf("edge")>=0){var oe=E.match(/edge\/([\d.]+)/),ee=oe&&oe[1]||"";return"edge ".concat(ee).trim()}return E.substr(0,200)}},S={isMobile:x.isMobile(),isBrowser:!x.isMobile(),mobileOsType:x.isAndroid()?"android":x.isIOS?"ios":"other_mobile",pcOsType:x.getOsType()},A={deviceType:S.isMobile?"mobile":S.isBrowser?"browser":"unknown",devicePlatform:S.isMobile?S.mobileOsType:S.pcOsType,deviceName:x.getDeviceName()},D=["multipartInit","multipartUpload","multipartComplete","multipartList","multipartListPart","multipartAbort"],z=["putObject","postObject","appendObject","sliceUploadFile","uploadFile","uploadFiles"].concat(D),P=["getObject"];function L(B){return z.includes(B)?"cos_upload":P.includes(B)?"cos_download":"base_service"}function Y(B){return B.replace(/([A-Z])/g,"_$1").toLowerCase()}function W(B){var E={},C=["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"],k=["tracePlatform","cossdkVersion","region","bucket","appid","networkType","host","accelerate","requestPath","partNumber","size","name","result","tookTime","errorRequestId","retryTimes","reqUrl","customId","deviceType","devicePlatform","deviceName"],g=B.result==="Success"?k:C;for(var U in B)if(g.includes(U)){var F=Y(U);E[F]=B[U]}return E}var ie=function(){function B(E){t(this,B);var C=E.parent,k=E.traceId,g=E.bucket,U=E.region,F=E.apiName,H=E.fileKey,K=E.fileSize,_=E.accelerate,V=E.customId,X=E.delay,G=E.deepTracker,$=g&&g.substr(g.lastIndexOf("-")+1)||"";this.parent=C,this.deepTracker=G,this.delay=X,this.params={cossdkVersion:u.version,region:U,networkType:"",host:"",accelerate:_?"Y":"N",requestPath:H||"",size:K||-1,httpMd5:0,httpSign:0,httpFull:0,name:F||"",result:"",tookTime:0,errorNode:"",errorCode:"",errorMessage:"",errorRequestId:"",errorStatusCode:0,errorServiceName:"",tracePlatform:"cos-js-sdk-v5",traceId:k||x.getUid(),bucket:g,appid:$,partNumber:0,retryTimes:0,reqUrl:"",customId:V||"",deviceType:A.deviceType,devicePlatform:A.devicePlatform,deviceName:A.deviceName,md5StartTime:0,md5EndTime:0,signStartTime:0,signEndTime:0,httpStartTime:0,httpEndTime:0,startTime:new Date().getTime(),endTime:0},this.beacon=w(X)}return l(B,[{key:"formatResult",value:function(C,k){var g,U,F,H,K,_,V=new Date().getTime(),X=V-this.params.startTime,G=x.getNetType(),$=C?(C==null?void 0:C.code)||(C==null||(g=C.error)===null||g===void 0?void 0:g.code)||(C==null||(U=C.error)===null||U===void 0?void 0:U.Code):"",re=C?(C==null?void 0:C.message)||(C==null||(F=C.error)===null||F===void 0?void 0:F.message)||(C==null||(H=C.error)===null||H===void 0?void 0:H.Message):"",ue=C?(C==null?void 0:C.resource)||(C==null||(K=C.error)===null||K===void 0?void 0:K.resource)||(C==null||(_=C.error)===null||_===void 0?void 0:_.Resource):"",oe=C?C==null?void 0:C.statusCode:k.statusCode,ee=C?(C==null?void 0:C.headers)&&(C==null?void 0:C.headers["x-cos-request-id"]):(k==null?void 0:k.headers)&&(k==null?void 0:k.headers["x-cos-request-id"]),ce=C?ee?"Server":"Client":"";if(Object.assign(this.params,{tookTime:X,networkType:G,httpMd5:this.params.md5EndTime-this.params.md5StartTime,httpSign:this.params.signEndTime-this.params.signStartTime,httpFull:this.params.httpEndTime-this.params.httpStartTime,result:C?"Fail":"Success",errorType:ce,errorCode:$,errorStatusCode:oe,errorMessage:re,errorServiceName:ue,errorRequestId:ee}),C&&(!$||!re)&&(this.params.fullError=C?JSON.stringify(C):""),this.params.name==="getObject"&&(this.params.size=k?k.headers&&k.headers["content-length"]:-1),this.params.reqUrl)try{var ae=/^http(s)?:\/\/(.*?)\//.exec(this.params.reqUrl);this.params.host=ae[2]}catch(pe){this.params.host=this.params.reqUrl}this.sendEvents()}},{key:"setParams",value:function(C){Object.assign(this.params,C)}},{key:"sendEvents",value:function(){if(!(D.includes(this.params.name)&&!this.deepTracker)){var C=L(this.params.name),k=W(this.params);this.beacon||(this.beacon=w(this.delay||5e3)),this.delay===0?this.beacon&&this.beacon.onDirectUserAction(C,k):this.beacon&&this.beacon.onUserAction(C,k)}}},{key:"generateSubTracker",value:function(C){return Object.assign(C,{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 B(C)}}]),B}();o.exports=ie},"./src/util.js":function(o,n,e){(function(t){var l=e("./node_modules/@babel/runtime/helpers/typeof.js"),r=e("./lib/md5.js"),u=e("./lib/crypto.js"),T=e("./lib/xml2json.js"),w=e("./lib/json2xml.js"),x=e("./lib/base64.js"),S=e("./src/tracker.js");function A(se){return encodeURIComponent(se).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function D(se,h){var c=[];for(var a in se)se.hasOwnProperty(a)&&c.push(h?A(a).toLowerCase():a);return c.sort(function(d,m){return d=d.toLowerCase(),m=m.toLowerCase(),d===m?0:d>m?1:-1})}var z=function(h,c){var a,d,m,I=[],M=D(h);for(a=0;a-1||P.indexOf(d)>-1)&&(c[a]=h[a])}return c},Y=function(h){h=h||{};var c=h.SecretId,a=h.SecretKey,d=h.KeyTime,m=(h.method||h.Method||"get").toLowerCase(),I=V(h.Query||h.params||{}),M=L(V(h.Headers||h.headers||{})),Q=h.Key||"",de;h.UseRawKey?de=h.Pathname||h.pathname||"/"+Q:(de=h.Pathname||h.pathname||Q,de.indexOf("/")!==0&&(de="/"+de));var he=h.ForceSignHost!==!1;if(!M.Host&&!M.host&&h.Bucket&&h.Region&&he&&(M.Host=h.Bucket+".cos."+h.Region+".myqcloud.com"),!c)throw new Error("missing param SecretId");if(!a)throw new Error("missing param SecretKey");var J=Math.round(ye(h.SystemClockOffset)/1e3)-1,xe=J,Be=h.Expires||h.expires;Be===void 0?xe+=900:xe+=Be*1||0;var Ue="sha1",_e=c,Le=d||J+";"+xe,Ve=d||J+";"+xe,qe=D(M,!0).join(";").toLowerCase(),Ge=D(I,!0).join(";").toLowerCase(),Ke=u.HmacSHA1(Ve,a).toString(),We=[m,de,Pe.obj2str(I,!0),Pe.obj2str(M,!0),""].join("\n"),Xe=["sha1",Le,u.SHA1(We).toString(),""].join("\n"),nt=u.HmacSHA1(Xe,Ke).toString(),et=["q-sign-algorithm="+Ue,"q-ak="+_e,"q-sign-time="+Le,"q-key-time="+Ve,"q-header-list="+qe,"q-url-param-list="+Ge,"q-signature="+nt].join("&");return et},W=function(h,c,a){var d=c/8,m=h.slice(a,a+d);return new Uint8Array(m).reverse(),new{8:Uint8Array,16:Uint16Array,32:Uint32Array}[c](m)[0]},ie=function(h,c,a,d){var m=h.slice(c,a),I="";return new Uint8Array(m).forEach(function(M){I+=String.fromCharCode(M)}),d&&(I=decodeURIComponent(escape(I))),I},B=function(h){for(var c={},a=ie(h),d={records:[]};h.byteLength;){var m=W(h,32,0),I=W(h,32,4),M=m-I-16,Q=0,de;for(h=h.slice(12);QparseInt(d[m])?1:-1;return 0},h=function(a){if(!a)return!1;var d=(a.match(/Chrome\/([.\d]+)/)||[])[1],m=(a.match(/QBCore\/([.\d]+)/)||[])[1],I=(a.match(/QQBrowser\/([.\d]+)/)||[])[1],M=d&&se(d,"53.0.2785.116")<0&&m&&se(m,"3.53.991.400")<0&&I&&se(I,"9.0.2524.400")<=0||!1;return M};return h(typeof navigator<"u"&&navigator.userAgent)}(),F=function(h,c,a,d,m){var I;if(h.slice?I=h.slice(c,a):h.mozSlice?I=h.mozSlice(c,a):h.webkitSlice&&(I=h.webkitSlice(c,a)),d&&U){var M=new FileReader;M.onload=function(Q){I=null,m(new Blob([M.result]))},M.readAsArrayBuffer(I)}else m(I)},H=function(h,c,a,d){a=a||C,h?typeof c=="string"?a(Pe.md5(c,!0)):Blob&&c instanceof Blob?Pe.getFileMd5(c,function(m,I){a(I)},d):a():a()},K=1024*1024,_=function(h,c,a){var d=h.size,m=0,I=r.getCtx(),M=function Q(de){if(de>=d){var he=I.digest("hex");c(null,he);return}var J=Math.min(d,de+K);Pe.fileSlice(h,de,J,!1,function(xe){g(xe,function(Be){xe=null,I=I.update(Be,!0),m+=Be.length,Be=null,a&&a({loaded:m,total:d,percent:Math.round(m/d*1e4)/1e4}),Q(de+K)})})};M(0)};function V(se){return ee(se,function(h){return l(h)==="object"&&h!==null?V(h):h})}function X(se,h,c){return se&&h in se?se[h]:c}function G(se,h){return oe(h,function(c,a){se[a]=h[a]}),se}function $(se){return se instanceof Array}function re(se,h){for(var c=!1,a=0;a-1,Q=!I||typeof I=="string"&&I.indexOf("{Region}")>-1;if(h.indexOf("Bucket")>-1||h==="deleteMultipleObject"||h==="multipartList"||h==="listObjectVersions"){if(M&&!a)return"Bucket";if(Q&&!d)return"Region"}else if(h.indexOf("Object")>-1||h.indexOf("multipart")>-1||h==="sliceUploadFile"||h==="abortUploadTask"){if(M&&!a)return"Bucket";if(Q&&!d)return"Region";if(!m)return"Key"}return!1},ne=function(h,c){if(c=G({},c),h!=="getAuth"&&h!=="getV4Auth"&&h!=="getObjectUrl"){var a=c.Headers||{};if(c&&l(c)==="object"){(function(){for(var m in c)c.hasOwnProperty(m)&&m.indexOf("x-cos-")>-1&&(a[m]=c[m])})();var d={"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(d,function(m,I){c[m]!==void 0&&(a[I]=c[m])}),c.Headers=k(a)}}return c},ge=function(h,c){return function(a,d){var m=this;typeof a=="function"&&(d=a,a={}),a=ne(h,a);var I;if(m.options.EnableTracker)if(a.calledBySdk==="sliceUploadFile")I=a.tracker&&a.tracker.generateSubTracker({apiName:h});else if(["uploadFile","uploadFiles"].includes(h))I=null;else{var M=-1;a.Body&&(M=typeof a.Body=="string"?a.Body.length:a.Body.size||a.Body.byteLength||-1),I=new S({bucket:a.Bucket,region:a.Region,apiName:h,fileKey:a.Key,fileSize:M,deepTracker:m.options.DeepTracker,customId:m.options.CustomId,delay:m.options.TrackerDelay})}a.tracker=I;var Q=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},de=function(_e,Le){I&&I.formatResult(_e,Le),d&&d(Q(_e),Q(Le))},he=function(){if(h!=="getService"&&h!=="abortUploadTask"){var _e=Z.call(m,h,a);if(_e)return"missing param "+_e;if(a.Region){if(m.options.CompatibilityMode){if(!/^([a-z\d-.]+)$/.test(a.Region))return"Region format error."}else{if(a.Region.indexOf("cos.")>-1)return'param Region should not be start with "cos."';if(!/^([a-z\d-]+)$/.test(a.Region))return"Region format error."}!m.options.CompatibilityMode&&a.Region.indexOf("-")===-1&&a.Region!=="yfb"&&a.Region!=="default"&&a.Region!=="accelerate"&&console.warn("warning: param Region format error, find help here: https://cloud.tencent.com/document/product/436/6224")}if(a.Bucket){if(!/^([a-z\d-]+)-(\d+)$/.test(a.Bucket))if(a.AppId)a.Bucket=a.Bucket+"-"+a.AppId;else if(m.options.AppId)a.Bucket=a.Bucket+"-"+m.options.AppId;else return'Bucket should format as "test-1250000000".';a.AppId&&(console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g Bucket:"test-1250000000" ).'),delete a.AppId)}!m.options.UseRawKey&&a.Key&&a.Key.substr(0,1)==="/"&&(a.Key=a.Key.substr(1))}},J=he(),xe=["getAuth","getObjectUrl"].includes(h);if(typeof Promise=="function"&&!xe&&!d)return new Promise(function(Ue,_e){if(d=function(Ve,qe){Ve?_e(Ve):Ue(qe)},J)return de(Pe.error(new Error(J)));c.call(m,a,de)});if(J)return de(Pe.error(new Error(J)));var Be=c.call(m,a,de);if(xe)return Be}},me=function(h,c){var a=this,d=0,m=0,I=Date.now(),M,Q;function de(){if(Q=0,c&&typeof c=="function"){M=Date.now();var he=Math.max(0,Math.round((m-d)/((M-I)/1e3)*100)/100)||0,J;m===0&&h===0?J=1:J=Math.floor(m/h*100)/100||0,I=M,d=m;try{c({loaded:m,total:h,speed:he,percent:J})}catch(xe){}}}return function(he,J){if(he&&(m=he.loaded,h=he.total),J)clearTimeout(Q),de();else{if(Q)return;Q=setTimeout(de,a.options.ProgressInterval)}}},ve=function(h,c,a){var d;if(typeof c.Body=="string"?c.Body=new Blob([c.Body],{type:"text/plain"}):c.Body instanceof ArrayBuffer&&(c.Body=new Blob([c.Body])),c.Body&&(c.Body instanceof Blob||c.Body.toString()==="[object File]"||c.Body.toString()==="[object Blob]"))d=c.Body.size;else{a(Pe.error(new Error("params body format error, Only allow File|Blob|String.")));return}c.ContentLength=d,a(null,d)},ye=function(h){return Date.now()+(h||0)},Ce=function(h,c){var a=h;return h.message=h.message||null,typeof c=="string"?(h.error=c,h.message=c):l(c)==="object"&&c!==null&&(G(h,c),(c.code||c.name)&&(h.code=c.code||c.name),c.message&&(h.message=c.message),c.stack&&(h.stack=c.stack)),typeof Object.defineProperty=="function"&&(Object.defineProperty(h,"name",{writable:!0,enumerable:!1}),Object.defineProperty(h,"message",{enumerable:!0})),h.name=c&&c.name||h.name||h.code||"Error",h.code||(h.code=h.name),h.error||(h.error=V(a)),h},Ee=function(){return(typeof globalThis>"u"?"undefined":l(globalThis))==="object"&&(globalThis.constructor.name==="DedicatedWorkerGlobalScope"||globalThis.FileReaderSync)},be=function(){return(typeof window>"u"?"undefined":l(window))!=="object"&&(typeof t>"u"?"undefined":l(t))==="object"&&!0&&!Ee()},Oe=function(h){return/^https?:\/\/([^/]+\.)?ci\.[^/]+/.test(h)},we=function(){if((typeof navigator>"u"?"undefined":l(navigator))!=="object")return!1;var se=navigator.userAgent,h=!!se.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);return h}(),De=function(){return(typeof navigator>"u"?"undefined":l(navigator))!=="object"?!1:/\sQQ/i.test(navigator.userAgent)}(),He=function(h,c){var a=x.encode(h);return c&&(a=a.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")),a},Pe={noop:C,formatParams:ne,apiWrapper:ge,xml2json:T,json2xml:w,md5:r,clearKey:k,fileSlice:F,getBodyMd5:H,getFileMd5:_,b64:ae,extend:G,isArray:$,isInArray:re,makeArray:ue,each:oe,map:ee,filter:ce,clone:V,attr:X,uuid:pe,camSafeUrlEncode:A,throttleOnProgress:me,getFileSize:ve,getSkewTime:ye,error:Ce,obj2str:z,getAuth:Y,parseSelectPayload:B,getSourceParams:E,isBrowser:!0,isNode:be,isCIHost:Oe,isIOS_QQ:we&&De,encodeBase64:He};o.exports=Pe}).call(this,e("./node_modules/process/browser.js"))}})})})(cosJsSdkV5);var cosJsSdkV5Exports=cosJsSdkV5.exports;const COS=getDefaultExportFromCjs(cosJsSdkV5Exports),ossSwitch="tencent",tencentBucket="daya-online-1303457149",getUploadSign=async o=>{const{bucketName:n,filename:e,postData:t}=o,l=ossSwitch;let r=n,u=e,T={};return r=tencentBucket,u="ktyq/"+e,T={key:"ktyq/"+t.key},request.post("/edu-app/open/getUploadSign",{data:{postData:T,pluginName:l,bucketName:r,filename:u},params:{pluginName:l}})},onFileUpload=({file:o,action:n,data:e,onProgress:t,onFinish:l,onError:r})=>{new COS({Domain:"https://oss.dayaedu.com",Protocol:"https",getAuthorization:async(T,w)=>{w({Authorization:e.signature})}}).uploadFile({Bucket:tencentBucket,Region:"ap-nanjing",Key:"ktyq/".concat(e.name),Body:e.file.file,SliceSize:1024*1024*500,onProgress:function(T){t({percent:Math.ceil((T.percent||0)*100)})}}).then(T=>{var w;((w=T.Location)==null?void 0:w.indexOf("http"))>=0?o.url=T.Location:o.url="https://"+T.Location,l()}).catch(T=>{console.log(T,"error"),r()})},onOnlyFileUpload=async(o,n)=>{{let e="",t=null;if(await new COS({Domain:"https://oss.dayaedu.com",Protocol:"https",getAuthorization:async(r,u)=>{u({Authorization:n.signature})}}).uploadFile({Bucket:tencentBucket,Region:"ap-nanjing",Key:"ktyq/".concat(n.name),Body:n.file,SliceSize:1024*1024*500}).then(r=>{var u;((u=r.Location)==null?void 0:u.indexOf("http"))>=0?e=r.Location:e="https://"+r.Location}).catch(r=>{t=r}),e)return e;throw new Error(t)}};/*! * Cropper.js v1.5.13 * https://fengyuanchen.github.io/cropperjs * * Copyright 2015-present Chen Fengyuan * Released under the MIT license * * Date: 2022-11-20T05:30:46.114Z */function ownKeys(o,n){var e=Object.keys(o);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(o);n&&(t=t.filter(function(l){return Object.getOwnPropertyDescriptor(o,l).enumerable})),e.push.apply(e,t)}return e}function _objectSpread2(o){for(var n=1;no.length)&&(n=o.length);for(var e=0,t=new Array(n);e
',isNaN=Number.isNaN||WINDOW.isNaN;function isNumber(o){return typeof o=="number"&&!isNaN(o)}var isPositiveNumber=function o(n){return n>0&&n<1/0};function isUndefined(o){return typeof o>"u"}function isObject(o){return _typeof(o)==="object"&&o!==null}var hasOwnProperty=Object.prototype.hasOwnProperty;function isPlainObject(o){if(!isObject(o))return!1;try{var n=o.constructor,e=n.prototype;return n&&e&&hasOwnProperty.call(e,"isPrototypeOf")}catch(t){return!1}}function isFunction(o){return typeof o=="function"}var slice=Array.prototype.slice;function toArray(o){return Array.from?Array.from(o):slice.call(o)}function forEach(o,n){return o&&isFunction(n)&&(Array.isArray(o)||isNumber(o.length)?toArray(o).forEach(function(e,t){n.call(o,e,t,o)}):isObject(o)&&Object.keys(o).forEach(function(e){n.call(o,o[e],e,o)})),o}var assign=Object.assign||function o(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),l=1;l0&&t.forEach(function(r){isObject(r)&&Object.keys(r).forEach(function(u){n[u]=r[u]})}),n},REGEXP_DECIMALS=/\.\d*(?:0|9){12}\d*$/;function normalizeDecimalNumber(o){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return REGEXP_DECIMALS.test(o)?Math.round(o*n)/n:o}var REGEXP_SUFFIX=/^width|height|left|top|marginLeft|marginTop$/;function setStyle(o,n){var e=o.style;forEach(n,function(t,l){REGEXP_SUFFIX.test(l)&&isNumber(t)&&(t="".concat(t,"px")),e[l]=t})}function hasClass(o,n){return o.classList?o.classList.contains(n):o.className.indexOf(n)>-1}function addClass(o,n){if(n){if(isNumber(o.length)){forEach(o,function(t){addClass(t,n)});return}if(o.classList){o.classList.add(n);return}var e=o.className.trim();e?e.indexOf(n)<0&&(o.className="".concat(e," ").concat(n)):o.className=n}}function removeClass(o,n){if(n){if(isNumber(o.length)){forEach(o,function(e){removeClass(e,n)});return}if(o.classList){o.classList.remove(n);return}o.className.indexOf(n)>=0&&(o.className=o.className.replace(n,""))}}function toggleClass(o,n,e){if(n){if(isNumber(o.length)){forEach(o,function(t){toggleClass(t,n,e)});return}e?addClass(o,n):removeClass(o,n)}}var REGEXP_CAMEL_CASE=/([a-z\d])([A-Z])/g;function toParamCase(o){return o.replace(REGEXP_CAMEL_CASE,"$1-$2").toLowerCase()}function getData(o,n){return isObject(o[n])?o[n]:o.dataset?o.dataset[n]:o.getAttribute("data-".concat(toParamCase(n)))}function setData(o,n,e){isObject(e)?o[n]=e:o.dataset?o.dataset[n]=e:o.setAttribute("data-".concat(toParamCase(n)),e)}function removeData(o,n){if(isObject(o[n]))try{delete o[n]}catch(e){o[n]=void 0}else if(o.dataset)try{delete o.dataset[n]}catch(e){o.dataset[n]=void 0}else o.removeAttribute("data-".concat(toParamCase(n)))}var REGEXP_SPACES=/\s\s*/,onceSupported=function(){var o=!1;if(IS_BROWSER){var n=!1,e=function(){},t=Object.defineProperty({},"once",{get:function(){return o=!0,n},set:function(r){n=r}});WINDOW.addEventListener("test",e,t),WINDOW.removeEventListener("test",e,t)}return o}();function removeListener(o,n,e){var t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=e;n.trim().split(REGEXP_SPACES).forEach(function(r){if(!onceSupported){var u=o.listeners;u&&u[r]&&u[r][e]&&(l=u[r][e],delete u[r][e],Object.keys(u[r]).length===0&&delete u[r],Object.keys(u).length===0&&delete o.listeners)}o.removeEventListener(r,l,t)})}function addListener(o,n,e){var t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=e;n.trim().split(REGEXP_SPACES).forEach(function(r){if(t.once&&!onceSupported){var u=o.listeners,T=u===void 0?{}:u;l=function(){delete T[r][e],o.removeEventListener(r,l,t);for(var x=arguments.length,S=new Array(x),A=0;AMath.abs(e)&&(e=D)})}),e}function getPointer(o,n){var e=o.pageX,t=o.pageY,l={endX:e,endY:t};return n?l:_objectSpread2({startX:e,startY:t},l)}function getPointersCenter(o){var n=0,e=0,t=0;return forEach(o,function(l){var r=l.startX,u=l.startY;n+=r,e+=u,t+=1}),n/=t,e/=t,{pageX:n,pageY:e}}function getAdjustedSizes(o){var n=o.aspectRatio,e=o.height,t=o.width,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",r=isPositiveNumber(t),u=isPositiveNumber(e);if(r&&u){var T=e*n;l==="contain"&&T>t||l==="cover"&&T90?{width:w,height:T}:{width:T,height:w}}function getSourceCanvas(o,n,e,t){var l=n.aspectRatio,r=n.naturalWidth,u=n.naturalHeight,T=n.rotate,w=T===void 0?0:T,x=n.scaleX,S=x===void 0?1:x,A=n.scaleY,D=A===void 0?1:A,z=e.aspectRatio,P=e.naturalWidth,L=e.naturalHeight,Y=t.fillColor,W=Y===void 0?"transparent":Y,ie=t.imageSmoothingEnabled,B=ie===void 0?!0:ie,E=t.imageSmoothingQuality,C=E===void 0?"low":E,k=t.maxWidth,g=k===void 0?1/0:k,U=t.maxHeight,F=U===void 0?1/0:U,H=t.minWidth,K=H===void 0?0:H,_=t.minHeight,V=_===void 0?0:_,X=document.createElement("canvas"),G=X.getContext("2d"),$=getAdjustedSizes({aspectRatio:z,width:g,height:F}),re=getAdjustedSizes({aspectRatio:z,width:K,height:V},"cover"),ue=Math.min($.width,Math.max(re.width,P)),oe=Math.min($.height,Math.max(re.height,L)),ee=getAdjustedSizes({aspectRatio:l,width:g,height:F}),ce=getAdjustedSizes({aspectRatio:l,width:K,height:V},"cover"),ae=Math.min(ee.width,Math.max(ce.width,r)),pe=Math.min(ee.height,Math.max(ce.height,u)),Z=[-ae/2,-pe/2,ae,pe];return X.width=normalizeDecimalNumber(ue),X.height=normalizeDecimalNumber(oe),G.fillStyle=W,G.fillRect(0,0,ue,oe),G.save(),G.translate(ue/2,oe/2),G.rotate(w*Math.PI/180),G.scale(S,D),G.imageSmoothingEnabled=B,G.imageSmoothingQuality=C,G.drawImage.apply(G,[o].concat(_toConsumableArray(Z.map(function(ne){return Math.floor(normalizeDecimalNumber(ne))})))),G.restore(),X}var fromCharCode=String.fromCharCode;function getStringFromCharCode(o,n,e){var t="";e+=n;for(var l=n;l0;)e.push(fromCharCode.apply(null,toArray(l.subarray(0,t)))),l=l.subarray(t);return"data:".concat(n,";base64,").concat(btoa(e.join("")))}function resetAndGetOrientation(o){var n=new DataView(o),e;try{var t,l,r;if(n.getUint8(0)===255&&n.getUint8(1)===216)for(var u=n.byteLength,T=2;T+1=8&&(r=x+A)}}}if(r){var D=n.getUint16(r,t),z,P;for(P=0;P=0?r:MIN_CONTAINER_WIDTH),height:Math.max(t.offsetHeight,u>=0?u:MIN_CONTAINER_HEIGHT)};this.containerData=T,setStyle(l,{width:T.width,height:T.height}),addClass(n,CLASS_HIDDEN),removeClass(l,CLASS_HIDDEN)},initCanvas:function o(){var n=this.containerData,e=this.imageData,t=this.options.viewMode,l=Math.abs(e.rotate)%180===90,r=l?e.naturalHeight:e.naturalWidth,u=l?e.naturalWidth:e.naturalHeight,T=r/u,w=n.width,x=n.height;n.height*T>n.width?t===3?w=n.height*T:x=n.width/T:t===3?x=n.width/T:w=n.height*T;var S={aspectRatio:T,naturalWidth:r,naturalHeight:u,width:w,height:x};this.canvasData=S,this.limited=t===1||t===2,this.limitCanvas(!0,!0),S.width=Math.min(Math.max(S.width,S.minWidth),S.maxWidth),S.height=Math.min(Math.max(S.height,S.minHeight),S.maxHeight),S.left=(n.width-S.width)/2,S.top=(n.height-S.height)/2,S.oldLeft=S.left,S.oldTop=S.top,this.initialCanvasData=assign({},S)},limitCanvas:function o(n,e){var t=this.options,l=this.containerData,r=this.canvasData,u=this.cropBoxData,T=t.viewMode,w=r.aspectRatio,x=this.cropped&&u;if(n){var S=Number(t.minCanvasWidth)||0,A=Number(t.minCanvasHeight)||0;T>1?(S=Math.max(S,l.width),A=Math.max(A,l.height),T===3&&(A*w>S?S=A*w:A=S/w)):T>0&&(S?S=Math.max(S,x?u.width:0):A?A=Math.max(A,x?u.height:0):x&&(S=u.width,A=u.height,A*w>S?S=A*w:A=S/w));var D=getAdjustedSizes({aspectRatio:w,width:S,height:A});S=D.width,A=D.height,r.minWidth=S,r.minHeight=A,r.maxWidth=1/0,r.maxHeight=1/0}if(e)if(T>(x?0:1)){var z=l.width-r.width,P=l.height-r.height;r.minLeft=Math.min(0,z),r.minTop=Math.min(0,P),r.maxLeft=Math.max(0,z),r.maxTop=Math.max(0,P),x&&this.limited&&(r.minLeft=Math.min(u.left,u.left+(u.width-r.width)),r.minTop=Math.min(u.top,u.top+(u.height-r.height)),r.maxLeft=u.left,r.maxTop=u.top,T===2&&(r.width>=l.width&&(r.minLeft=Math.min(0,z),r.maxLeft=Math.max(0,z)),r.height>=l.height&&(r.minTop=Math.min(0,P),r.maxTop=Math.max(0,P))))}else r.minLeft=-r.width,r.minTop=-r.height,r.maxLeft=l.width,r.maxTop=l.height},renderCanvas:function o(n,e){var t=this.canvasData,l=this.imageData;if(e){var r=getRotatedSizes({width:l.naturalWidth*Math.abs(l.scaleX||1),height:l.naturalHeight*Math.abs(l.scaleY||1),degree:l.rotate||0}),u=r.width,T=r.height,w=t.width*(u/t.naturalWidth),x=t.height*(T/t.naturalHeight);t.left-=(w-t.width)/2,t.top-=(x-t.height)/2,t.width=w,t.height=x,t.aspectRatio=u/T,t.naturalWidth=u,t.naturalHeight=T,this.limitCanvas(!0,!1)}(t.width>t.maxWidth||t.widtht.maxHeight||t.heighte.width?r.height=r.width/t:r.width=r.height*t),this.cropBoxData=r,this.limitCropBox(!0,!0),r.width=Math.min(Math.max(r.width,r.minWidth),r.maxWidth),r.height=Math.min(Math.max(r.height,r.minHeight),r.maxHeight),r.width=Math.max(r.minWidth,r.width*l),r.height=Math.max(r.minHeight,r.height*l),r.left=e.left+(e.width-r.width)/2,r.top=e.top+(e.height-r.height)/2,r.oldLeft=r.left,r.oldTop=r.top,this.initialCropBoxData=assign({},r)},limitCropBox:function o(n,e){var t=this.options,l=this.containerData,r=this.canvasData,u=this.cropBoxData,T=this.limited,w=t.aspectRatio;if(n){var x=Number(t.minCropBoxWidth)||0,S=Number(t.minCropBoxHeight)||0,A=T?Math.min(l.width,r.width,r.width+r.left,l.width-r.left):l.width,D=T?Math.min(l.height,r.height,r.height+r.top,l.height-r.top):l.height;x=Math.min(x,l.width),S=Math.min(S,l.height),w&&(x&&S?S*w>x?S=x/w:x=S*w:x?S=x/w:S&&(x=S*w),D*w>A?D=A/w:A=D*w),u.minWidth=Math.min(x,A),u.minHeight=Math.min(S,D),u.maxWidth=A,u.maxHeight=D}e&&(T?(u.minLeft=Math.max(0,r.left),u.minTop=Math.max(0,r.top),u.maxLeft=Math.min(l.width,r.left+r.width)-u.width,u.maxTop=Math.min(l.height,r.top+r.height)-u.height):(u.minLeft=0,u.minTop=0,u.maxLeft=l.width-u.width,u.maxTop=l.height-u.height))},renderCropBox:function o(){var n=this.options,e=this.containerData,t=this.cropBoxData;(t.width>t.maxWidth||t.widtht.maxHeight||t.height=e.width&&t.height>=e.height?ACTION_MOVE:ACTION_ALL),setStyle(this.cropBox,assign({width:t.width,height:t.height},getTransforms({translateX:t.left,translateY:t.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function o(){this.preview(),dispatchEvent(this.element,EVENT_CROP,this.getData())}},preview={initPreview:function o(){var n=this.element,e=this.crossOrigin,t=this.options.preview,l=e?this.crossOriginUrl:this.url,r=n.alt||"The image to preview",u=document.createElement("img");if(e&&(u.crossOrigin=e),u.src=l,u.alt=r,this.viewBox.appendChild(u),this.viewBoxImage=u,!!t){var T=t;typeof t=="string"?T=n.ownerDocument.querySelectorAll(t):t.querySelector&&(T=[t]),this.previews=T,forEach(T,function(w){var x=document.createElement("img");setData(w,DATA_PREVIEW,{width:w.offsetWidth,height:w.offsetHeight,html:w.innerHTML}),e&&(x.crossOrigin=e),x.src=l,x.alt=r,x.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',w.innerHTML="",w.appendChild(x)})}},resetPreview:function o(){forEach(this.previews,function(n){var e=getData(n,DATA_PREVIEW);setStyle(n,{width:e.width,height:e.height}),n.innerHTML=e.html,removeData(n,DATA_PREVIEW)})},preview:function o(){var n=this.imageData,e=this.canvasData,t=this.cropBoxData,l=t.width,r=t.height,u=n.width,T=n.height,w=t.left-e.left-n.left,x=t.top-e.top-n.top;!this.cropped||this.disabled||(setStyle(this.viewBoxImage,assign({width:u,height:T},getTransforms(assign({translateX:-w,translateY:-x},n)))),forEach(this.previews,function(S){var A=getData(S,DATA_PREVIEW),D=A.width,z=A.height,P=D,L=z,Y=1;l&&(Y=D/l,L=r*Y),r&&L>z&&(Y=z/r,P=l*Y,L=z),setStyle(S,{width:P,height:L}),setStyle(S.getElementsByTagName("img")[0],assign({width:u*Y,height:T*Y},getTransforms(assign({translateX:-w*Y,translateY:-x*Y},n))))}))}},events={bind:function o(){var n=this.element,e=this.options,t=this.cropper;isFunction(e.cropstart)&&addListener(n,EVENT_CROP_START,e.cropstart),isFunction(e.cropmove)&&addListener(n,EVENT_CROP_MOVE,e.cropmove),isFunction(e.cropend)&&addListener(n,EVENT_CROP_END,e.cropend),isFunction(e.crop)&&addListener(n,EVENT_CROP,e.crop),isFunction(e.zoom)&&addListener(n,EVENT_ZOOM,e.zoom),addListener(t,EVENT_POINTER_DOWN,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&addListener(t,EVENT_WHEEL,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&addListener(t,EVENT_DBLCLICK,this.onDblclick=this.dblclick.bind(this)),addListener(n.ownerDocument,EVENT_POINTER_MOVE,this.onCropMove=this.cropMove.bind(this)),addListener(n.ownerDocument,EVENT_POINTER_UP,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&addListener(window,EVENT_RESIZE,this.onResize=this.resize.bind(this))},unbind:function o(){var n=this.element,e=this.options,t=this.cropper;isFunction(e.cropstart)&&removeListener(n,EVENT_CROP_START,e.cropstart),isFunction(e.cropmove)&&removeListener(n,EVENT_CROP_MOVE,e.cropmove),isFunction(e.cropend)&&removeListener(n,EVENT_CROP_END,e.cropend),isFunction(e.crop)&&removeListener(n,EVENT_CROP,e.crop),isFunction(e.zoom)&&removeListener(n,EVENT_ZOOM,e.zoom),removeListener(t,EVENT_POINTER_DOWN,this.onCropStart),e.zoomable&&e.zoomOnWheel&&removeListener(t,EVENT_WHEEL,this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&removeListener(t,EVENT_DBLCLICK,this.onDblclick),removeListener(n.ownerDocument,EVENT_POINTER_MOVE,this.onCropMove),removeListener(n.ownerDocument,EVENT_POINTER_UP,this.onCropEnd),e.responsive&&removeListener(window,EVENT_RESIZE,this.onResize)}},handlers={resize:function o(){if(!this.disabled){var n=this.options,e=this.container,t=this.containerData,l=e.offsetWidth/t.width,r=e.offsetHeight/t.height,u=Math.abs(l-1)>Math.abs(r-1)?l:r;if(u!==1){var T,w;n.restore&&(T=this.getCanvasData(),w=this.getCropBoxData()),this.render(),n.restore&&(this.setCanvasData(forEach(T,function(x,S){T[S]=x*u})),this.setCropBoxData(forEach(w,function(x,S){w[S]=x*u})))}}},dblclick:function o(){this.disabled||this.options.dragMode===DRAG_MODE_NONE||this.setDragMode(hasClass(this.dragBox,CLASS_CROP)?DRAG_MODE_MOVE:DRAG_MODE_CROP)},wheel:function o(n){var e=this,t=Number(this.options.wheelZoomRatio)||.1,l=1;this.disabled||(n.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){e.wheeling=!1},50),n.deltaY?l=n.deltaY>0?1:-1:n.wheelDelta?l=-n.wheelDelta/120:n.detail&&(l=n.detail>0?1:-1),this.zoom(-l*t,n)))},cropStart:function o(n){var e=n.buttons,t=n.button;if(!(this.disabled||(n.type==="mousedown"||n.type==="pointerdown"&&n.pointerType==="mouse")&&(isNumber(e)&&e!==1||isNumber(t)&&t!==0||n.ctrlKey))){var l=this.options,r=this.pointers,u;n.changedTouches?forEach(n.changedTouches,function(T){r[T.identifier]=getPointer(T)}):r[n.pointerId||0]=getPointer(n),Object.keys(r).length>1&&l.zoomable&&l.zoomOnTouch?u=ACTION_ZOOM:u=getData(n.target,DATA_ACTION),REGEXP_ACTIONS.test(u)&&dispatchEvent(this.element,EVENT_CROP_START,{originalEvent:n,action:u})!==!1&&(n.preventDefault(),this.action=u,this.cropping=!1,u===ACTION_CROP&&(this.cropping=!0,addClass(this.dragBox,CLASS_MODAL)))}},cropMove:function o(n){var e=this.action;if(!(this.disabled||!e)){var t=this.pointers;n.preventDefault(),dispatchEvent(this.element,EVENT_CROP_MOVE,{originalEvent:n,action:e})!==!1&&(n.changedTouches?forEach(n.changedTouches,function(l){assign(t[l.identifier]||{},getPointer(l,!0))}):assign(t[n.pointerId||0]||{},getPointer(n,!0)),this.change(n))}},cropEnd:function o(n){if(!this.disabled){var e=this.action,t=this.pointers;n.changedTouches?forEach(n.changedTouches,function(l){delete t[l.identifier]}):delete t[n.pointerId||0],e&&(n.preventDefault(),Object.keys(t).length||(this.action=""),this.cropping&&(this.cropping=!1,toggleClass(this.dragBox,CLASS_MODAL,this.cropped&&this.options.modal)),dispatchEvent(this.element,EVENT_CROP_END,{originalEvent:n,action:e}))}}},change={change:function o(n){var e=this.options,t=this.canvasData,l=this.containerData,r=this.cropBoxData,u=this.pointers,T=this.action,w=e.aspectRatio,x=r.left,S=r.top,A=r.width,D=r.height,z=x+A,P=S+D,L=0,Y=0,W=l.width,ie=l.height,B=!0,E;!w&&n.shiftKey&&(w=A&&D?A/D:1),this.limited&&(L=r.minLeft,Y=r.minTop,W=L+Math.min(l.width,t.width,t.left+t.width),ie=Y+Math.min(l.height,t.height,t.top+t.height));var C=u[Object.keys(u)[0]],k={x:C.endX-C.startX,y:C.endY-C.startY},g=function(F){switch(F){case ACTION_EAST:z+k.x>W&&(k.x=W-z);break;case ACTION_WEST:x+k.xie&&(k.y=ie-P);break}};switch(T){case ACTION_ALL:x+=k.x,S+=k.y;break;case ACTION_EAST:if(k.x>=0&&(z>=W||w&&(S<=Y||P>=ie))){B=!1;break}g(ACTION_EAST),A+=k.x,A<0&&(T=ACTION_WEST,A=-A,x-=A),w&&(D=A/w,S+=(r.height-D)/2);break;case ACTION_NORTH:if(k.y<=0&&(S<=Y||w&&(x<=L||z>=W))){B=!1;break}g(ACTION_NORTH),D-=k.y,S+=k.y,D<0&&(T=ACTION_SOUTH,D=-D,S-=D),w&&(A=D*w,x+=(r.width-A)/2);break;case ACTION_WEST:if(k.x<=0&&(x<=L||w&&(S<=Y||P>=ie))){B=!1;break}g(ACTION_WEST),A-=k.x,x+=k.x,A<0&&(T=ACTION_EAST,A=-A,x-=A),w&&(D=A/w,S+=(r.height-D)/2);break;case ACTION_SOUTH:if(k.y>=0&&(P>=ie||w&&(x<=L||z>=W))){B=!1;break}g(ACTION_SOUTH),D+=k.y,D<0&&(T=ACTION_NORTH,D=-D,S-=D),w&&(A=D*w,x+=(r.width-A)/2);break;case ACTION_NORTH_EAST:if(w){if(k.y<=0&&(S<=Y||z>=W)){B=!1;break}g(ACTION_NORTH),D-=k.y,S+=k.y,A=D*w}else g(ACTION_NORTH),g(ACTION_EAST),k.x>=0?zY&&(D-=k.y,S+=k.y):(D-=k.y,S+=k.y);A<0&&D<0?(T=ACTION_SOUTH_WEST,D=-D,A=-A,S-=D,x-=A):A<0?(T=ACTION_NORTH_WEST,A=-A,x-=A):D<0&&(T=ACTION_SOUTH_EAST,D=-D,S-=D);break;case ACTION_NORTH_WEST:if(w){if(k.y<=0&&(S<=Y||x<=L)){B=!1;break}g(ACTION_NORTH),D-=k.y,S+=k.y,A=D*w,x+=r.width-A}else g(ACTION_NORTH),g(ACTION_WEST),k.x<=0?x>L?(A-=k.x,x+=k.x):k.y<=0&&S<=Y&&(B=!1):(A-=k.x,x+=k.x),k.y<=0?S>Y&&(D-=k.y,S+=k.y):(D-=k.y,S+=k.y);A<0&&D<0?(T=ACTION_SOUTH_EAST,D=-D,A=-A,S-=D,x-=A):A<0?(T=ACTION_NORTH_EAST,A=-A,x-=A):D<0&&(T=ACTION_SOUTH_WEST,D=-D,S-=D);break;case ACTION_SOUTH_WEST:if(w){if(k.x<=0&&(x<=L||P>=ie)){B=!1;break}g(ACTION_WEST),A-=k.x,x+=k.x,D=A/w}else g(ACTION_SOUTH),g(ACTION_WEST),k.x<=0?x>L?(A-=k.x,x+=k.x):k.y>=0&&P>=ie&&(B=!1):(A-=k.x,x+=k.x),k.y>=0?P=0&&(z>=W||P>=ie)){B=!1;break}g(ACTION_EAST),A+=k.x,D=A/w}else g(ACTION_SOUTH),g(ACTION_EAST),k.x>=0?z=0&&P>=ie&&(B=!1):A+=k.x,k.y>=0?P0?T=k.y>0?ACTION_SOUTH_EAST:ACTION_NORTH_EAST:k.x<0&&(x-=A,T=k.y>0?ACTION_SOUTH_WEST:ACTION_NORTH_WEST),k.y<0&&(S-=D),this.cropped||(removeClass(this.cropBox,CLASS_HIDDEN),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}B&&(r.width=A,r.height=D,r.left=x,r.top=S,this.action=T,this.renderCropBox()),forEach(u,function(U){U.startX=U.endX,U.startY=U.endY})}},methods={crop:function o(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&addClass(this.dragBox,CLASS_MODAL),removeClass(this.cropBox,CLASS_HIDDEN),this.setCropBoxData(this.initialCropBoxData)),this},reset:function o(){return this.ready&&!this.disabled&&(this.imageData=assign({},this.initialImageData),this.canvasData=assign({},this.initialCanvasData),this.cropBoxData=assign({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function o(){return this.cropped&&!this.disabled&&(assign(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),removeClass(this.dragBox,CLASS_MODAL),addClass(this.cropBox,CLASS_HIDDEN)),this},replace:function o(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&n&&(this.isImg&&(this.element.src=n),e?(this.url=n,this.image.src=n,this.ready&&(this.viewBoxImage.src=n,forEach(this.previews,function(t){t.getElementsByTagName("img")[0].src=n}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(n))),this},enable:function o(){return this.ready&&this.disabled&&(this.disabled=!1,removeClass(this.cropper,CLASS_DISABLED)),this},disable:function o(){return this.ready&&!this.disabled&&(this.disabled=!0,addClass(this.cropper,CLASS_DISABLED)),this},destroy:function o(){var n=this.element;return n[NAMESPACE]?(n[NAMESPACE]=void 0,this.isImg&&this.replaced&&(n.src=this.originalUrl),this.uncreate(),this):this},move:function o(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n,t=this.canvasData,l=t.left,r=t.top;return this.moveTo(isUndefined(n)?n:l+Number(n),isUndefined(e)?e:r+Number(e))},moveTo:function o(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n,t=this.canvasData,l=!1;return n=Number(n),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(isNumber(n)&&(t.left=n,l=!0),isNumber(e)&&(t.top=e,l=!0),l&&this.renderCanvas(!0)),this},zoom:function o(n,e){var t=this.canvasData;return n=Number(n),n<0?n=1/(1-n):n=1+n,this.zoomTo(t.width*n/t.naturalWidth,null,e)},zoomTo:function o(n,e,t){var l=this.options,r=this.canvasData,u=r.width,T=r.height,w=r.naturalWidth,x=r.naturalHeight;if(n=Number(n),n>=0&&this.ready&&!this.disabled&&l.zoomable){var S=w*n,A=x*n;if(dispatchEvent(this.element,EVENT_ZOOM,{ratio:n,oldRatio:u/w,originalEvent:t})===!1)return this;if(t){var D=this.pointers,z=getOffset(this.cropper),P=D&&Object.keys(D).length?getPointersCenter(D):{pageX:t.pageX,pageY:t.pageY};r.left-=(S-u)*((P.pageX-z.left-r.left)/u),r.top-=(A-T)*((P.pageY-z.top-r.top)/T)}else isPlainObject(e)&&isNumber(e.x)&&isNumber(e.y)?(r.left-=(S-u)*((e.x-r.left)/u),r.top-=(A-T)*((e.y-r.top)/T)):(r.left-=(S-u)/2,r.top-=(A-T)/2);r.width=S,r.height=A,this.renderCanvas(!0)}return this},rotate:function o(n){return this.rotateTo((this.imageData.rotate||0)+Number(n))},rotateTo:function o(n){return n=Number(n),isNumber(n)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=n%360,this.renderCanvas(!0,!0)),this},scaleX:function o(n){var e=this.imageData.scaleY;return this.scale(n,isNumber(e)?e:1)},scaleY:function o(n){var e=this.imageData.scaleX;return this.scale(isNumber(e)?e:1,n)},scale:function o(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n,t=this.imageData,l=!1;return n=Number(n),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(isNumber(n)&&(t.scaleX=n,l=!0),isNumber(e)&&(t.scaleY=e,l=!0),l&&this.renderCanvas(!0,!0)),this},getData:function o(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.options,t=this.imageData,l=this.canvasData,r=this.cropBoxData,u;if(this.ready&&this.cropped){u={x:r.left-l.left,y:r.top-l.top,width:r.width,height:r.height};var T=t.width/t.naturalWidth;if(forEach(u,function(S,A){u[A]=S/T}),n){var w=Math.round(u.y+u.height),x=Math.round(u.x+u.width);u.x=Math.round(u.x),u.y=Math.round(u.y),u.width=x-u.x,u.height=w-u.y}}else u={x:0,y:0,width:0,height:0};return e.rotatable&&(u.rotate=t.rotate||0),e.scalable&&(u.scaleX=t.scaleX||1,u.scaleY=t.scaleY||1),u},setData:function o(n){var e=this.options,t=this.imageData,l=this.canvasData,r={};if(this.ready&&!this.disabled&&isPlainObject(n)){var u=!1;e.rotatable&&isNumber(n.rotate)&&n.rotate!==t.rotate&&(t.rotate=n.rotate,u=!0),e.scalable&&(isNumber(n.scaleX)&&n.scaleX!==t.scaleX&&(t.scaleX=n.scaleX,u=!0),isNumber(n.scaleY)&&n.scaleY!==t.scaleY&&(t.scaleY=n.scaleY,u=!0)),u&&this.renderCanvas(!0,!0);var T=t.width/t.naturalWidth;isNumber(n.x)&&(r.left=n.x*T+l.left),isNumber(n.y)&&(r.top=n.y*T+l.top),isNumber(n.width)&&(r.width=n.width*T),isNumber(n.height)&&(r.height=n.height*T),this.setCropBoxData(r)}return this},getContainerData:function o(){return this.ready?assign({},this.containerData):{}},getImageData:function o(){return this.sized?assign({},this.imageData):{}},getCanvasData:function o(){var n=this.canvasData,e={};return this.ready&&forEach(["left","top","width","height","naturalWidth","naturalHeight"],function(t){e[t]=n[t]}),e},setCanvasData:function o(n){var e=this.canvasData,t=e.aspectRatio;return this.ready&&!this.disabled&&isPlainObject(n)&&(isNumber(n.left)&&(e.left=n.left),isNumber(n.top)&&(e.top=n.top),isNumber(n.width)?(e.width=n.width,e.height=n.width/t):isNumber(n.height)&&(e.height=n.height,e.width=n.height*t),this.renderCanvas(!0)),this},getCropBoxData:function o(){var n=this.cropBoxData,e;return this.ready&&this.cropped&&(e={left:n.left,top:n.top,width:n.width,height:n.height}),e||{}},setCropBoxData:function o(n){var e=this.cropBoxData,t=this.options.aspectRatio,l,r;return this.ready&&this.cropped&&!this.disabled&&isPlainObject(n)&&(isNumber(n.left)&&(e.left=n.left),isNumber(n.top)&&(e.top=n.top),isNumber(n.width)&&n.width!==e.width&&(l=!0,e.width=n.width),isNumber(n.height)&&n.height!==e.height&&(r=!0,e.height=n.height),t&&(l?e.height=e.width/t:r&&(e.width=e.height*t)),this.renderCropBox()),this},getCroppedCanvas:function o(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e=this.canvasData,t=getSourceCanvas(this.image,this.imageData,e,n);if(!this.cropped)return t;var l=this.getData(),r=l.x,u=l.y,T=l.width,w=l.height,x=t.width/Math.floor(e.naturalWidth);x!==1&&(r*=x,u*=x,T*=x,w*=x);var S=T/w,A=getAdjustedSizes({aspectRatio:S,width:n.maxWidth||1/0,height:n.maxHeight||1/0}),D=getAdjustedSizes({aspectRatio:S,width:n.minWidth||0,height:n.minHeight||0},"cover"),z=getAdjustedSizes({aspectRatio:S,width:n.width||(x!==1?t.width:T),height:n.height||(x!==1?t.height:w)}),P=z.width,L=z.height;P=Math.min(A.width,Math.max(D.width,P)),L=Math.min(A.height,Math.max(D.height,L));var Y=document.createElement("canvas"),W=Y.getContext("2d");Y.width=normalizeDecimalNumber(P),Y.height=normalizeDecimalNumber(L),W.fillStyle=n.fillColor||"transparent",W.fillRect(0,0,P,L);var ie=n.imageSmoothingEnabled,B=ie===void 0?!0:ie,E=n.imageSmoothingQuality;W.imageSmoothingEnabled=B,E&&(W.imageSmoothingQuality=E);var C=t.width,k=t.height,g=r,U=u,F,H,K,_,V,X;g<=-T||g>C?(g=0,F=0,K=0,V=0):g<=0?(K=-g,g=0,F=Math.min(C,T+g),V=F):g<=C&&(K=0,F=Math.min(T,C-g),V=F),F<=0||U<=-w||U>k?(U=0,H=0,_=0,X=0):U<=0?(_=-U,U=0,H=Math.min(k,w+U),X=H):U<=k&&(_=0,H=Math.min(w,k-U),X=H);var G=[g,U,F,H];if(V>0&&X>0){var $=P/T;G.push(K*$,_*$,V*$,X*$)}return W.drawImage.apply(W,[t].concat(_toConsumableArray(G.map(function(re){return Math.floor(normalizeDecimalNumber(re))})))),Y},setAspectRatio:function o(n){var e=this.options;return!this.disabled&&!isUndefined(n)&&(e.aspectRatio=Math.max(0,n)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function o(n){var e=this.options,t=this.dragBox,l=this.face;if(this.ready&&!this.disabled){var r=n===DRAG_MODE_CROP,u=e.movable&&n===DRAG_MODE_MOVE;n=r||u?n:DRAG_MODE_NONE,e.dragMode=n,setData(t,DATA_ACTION,n),toggleClass(t,CLASS_CROP,r),toggleClass(t,CLASS_MOVE,u),e.cropBoxMovable||(setData(l,DATA_ACTION,n),toggleClass(l,CLASS_CROP,r),toggleClass(l,CLASS_MOVE,u))}return this}},AnotherCropper=WINDOW.Cropper,Cropper=function(){function o(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(_classCallCheck(this,o),!n||!REGEXP_TAG_NAME.test(n.tagName))throw new Error("The first argument is required and must be an or element.");this.element=n,this.options=assign({},DEFAULTS,isPlainObject(e)&&e),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return _createClass(o,[{key:"init",value:function(){var e=this.element,t=e.tagName.toLowerCase(),l;if(!e[NAMESPACE]){if(e[NAMESPACE]=this,t==="img"){if(this.isImg=!0,l=e.getAttribute("src")||"",this.originalUrl=l,!l)return;l=e.src}else t==="canvas"&&window.HTMLCanvasElement&&(l=e.toDataURL());this.load(l)}}},{key:"load",value:function(e){var t=this;if(e){this.url=e,this.imageData={};var l=this.element,r=this.options;if(!r.rotatable&&!r.scalable&&(r.checkOrientation=!1),!r.checkOrientation||!window.ArrayBuffer){this.clone();return}if(REGEXP_DATA_URL.test(e)){REGEXP_DATA_URL_JPEG.test(e)?this.read(dataURLToArrayBuffer(e)):this.clone();return}var u=new XMLHttpRequest,T=this.clone.bind(this);this.reloading=!0,this.xhr=u,u.onabort=T,u.onerror=T,u.ontimeout=T,u.onprogress=function(){u.getResponseHeader("content-type")!==MIME_TYPE_JPEG&&u.abort()},u.onload=function(){t.read(u.response)},u.onloadend=function(){t.reloading=!1,t.xhr=null},r.checkCrossOrigin&&isCrossOriginURL(e)&&l.crossOrigin&&(e=addTimestamp(e)),u.open("GET",e,!0),u.responseType="arraybuffer",u.withCredentials=l.crossOrigin==="use-credentials",u.send()}}},{key:"read",value:function(e){var t=this.options,l=this.imageData,r=resetAndGetOrientation(e),u=0,T=1,w=1;if(r>1){this.url=arrayBufferToDataURL(e,MIME_TYPE_JPEG);var x=parseOrientation(r);u=x.rotate,T=x.scaleX,w=x.scaleY}t.rotatable&&(l.rotate=u),t.scalable&&(l.scaleX=T,l.scaleY=w),this.clone()}},{key:"clone",value:function(){var e=this.element,t=this.url,l=e.crossOrigin,r=t;this.options.checkCrossOrigin&&isCrossOriginURL(t)&&(l||(l="anonymous"),r=addTimestamp(t)),this.crossOrigin=l,this.crossOriginUrl=r;var u=document.createElement("img");l&&(u.crossOrigin=l),u.src=r||t,u.alt=e.alt||"The image to crop",this.image=u,u.onload=this.start.bind(this),u.onerror=this.stop.bind(this),addClass(u,CLASS_HIDE),e.parentNode.insertBefore(u,e.nextSibling)}},{key:"start",value:function(){var e=this,t=this.image;t.onload=null,t.onerror=null,this.sizing=!0;var l=WINDOW.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent),r=function(x,S){assign(e.imageData,{naturalWidth:x,naturalHeight:S,aspectRatio:x/S}),e.initialImageData=assign({},e.imageData),e.sizing=!1,e.sized=!0,e.build()};if(t.naturalWidth&&!l){r(t.naturalWidth,t.naturalHeight);return}var u=document.createElement("img"),T=document.body||document.documentElement;this.sizingImage=u,u.onload=function(){r(u.width,u.height),l||T.removeChild(u)},u.src=t.src,l||(u.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",T.appendChild(u))}},{key:"stop",value:function(){var e=this.image;e.onload=null,e.onerror=null,e.parentNode.removeChild(e),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var e=this.element,t=this.options,l=this.image,r=e.parentNode,u=document.createElement("div");u.innerHTML=TEMPLATE;var T=u.querySelector(".".concat(NAMESPACE,"-container")),w=T.querySelector(".".concat(NAMESPACE,"-canvas")),x=T.querySelector(".".concat(NAMESPACE,"-drag-box")),S=T.querySelector(".".concat(NAMESPACE,"-crop-box")),A=S.querySelector(".".concat(NAMESPACE,"-face"));this.container=r,this.cropper=T,this.canvas=w,this.dragBox=x,this.cropBox=S,this.viewBox=T.querySelector(".".concat(NAMESPACE,"-view-box")),this.face=A,w.appendChild(l),addClass(e,CLASS_HIDDEN),r.insertBefore(T,e.nextSibling),removeClass(l,CLASS_HIDE),this.initPreview(),this.bind(),t.initialAspectRatio=Math.max(0,t.initialAspectRatio)||NaN,t.aspectRatio=Math.max(0,t.aspectRatio)||NaN,t.viewMode=Math.max(0,Math.min(3,Math.round(t.viewMode)))||0,addClass(S,CLASS_HIDDEN),t.guides||addClass(S.getElementsByClassName("".concat(NAMESPACE,"-dashed")),CLASS_HIDDEN),t.center||addClass(S.getElementsByClassName("".concat(NAMESPACE,"-center")),CLASS_HIDDEN),t.background&&addClass(T,"".concat(NAMESPACE,"-bg")),t.highlight||addClass(A,CLASS_INVISIBLE),t.cropBoxMovable&&(addClass(A,CLASS_MOVE),setData(A,DATA_ACTION,ACTION_ALL)),t.cropBoxResizable||(addClass(S.getElementsByClassName("".concat(NAMESPACE,"-line")),CLASS_HIDDEN),addClass(S.getElementsByClassName("".concat(NAMESPACE,"-point")),CLASS_HIDDEN)),this.render(),this.ready=!0,this.setDragMode(t.dragMode),t.autoCrop&&this.crop(),this.setData(t.data),isFunction(t.ready)&&addListener(e,EVENT_READY,t.ready,{once:!0}),dispatchEvent(e,EVENT_READY)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var e=this.cropper.parentNode;e&&e.removeChild(this.cropper),removeClass(this.element,CLASS_HIDDEN)}}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=AnotherCropper,o}},{key:"setDefaults",value:function(e){assign(DEFAULTS,isPlainObject(e)&&e)}}]),o}();assign(Cropper.prototype,render,preview,events,handlers,change,methods);const cropper="",Copper=defineComponent({name:"copper-image",emits:["close","cropperNo","cropperOk"],setup(o,{emit:n,expose:e}){const t=reactive({visible:!1,img:null,confirmLoading:!1,options:{img:"",autoCrop:!0,autoCropWidth:180,autoCropHeight:180,fixedBox:!0,full:!1,enlarge:1,previewsCircle:!0,centerBox:!0,outputType:"png",title:"修改头像",name:null},previews:{},url:{upload:"/sys/common/saveToImgByStr"},myCropper:null}),l=ref(),r=x=>{const{options:S}=t;t.visible=!0,t.options=Object.assign({},S,x),nextTick(()=>{u()})},u=()=>{t.myCropper=new Cropper(l.value,{viewMode:1,dragMode:"move",aspectRatio:t.options.autoCropWidth/t.options.autoCropHeight,initialAspectRatio:1,autoCropArea:1,cropBoxMovable:!0,cropBoxResizable:!1,background:!0,movable:!0,modal:!0,preview:".before"})},T=x=>{switch(x){case"left":t.myCropper.rotate(90);break;case"right":t.myCropper.rotate(-90);break;case"zoomIn":t.myCropper.zoom(.1);break;case"zoomOut":t.myCropper.zoom(-.1);break}},w=()=>{t.confirmLoading=!0,t.myCropper.getCroppedCanvas({imageSmoothingQuality:"high"}).toBlob(x=>{console.log(x,"1212"),n("cropperOk",x),t.confirmLoading=!1})};return e({edit:r}),()=>createVNode("div",null,[createVNode(NGrid,{cols:2,xGap:24,style:{paddingTop:"12px"}},{default:()=>[createVNode(NGi,null,{default:()=>{var x,S;return[createVNode("div",{style:"width: 100%; height: 300px"},[((x=t.options)==null?void 0:x.img)&&createVNode("img",{ref:l,src:(S=t.options)==null?void 0:S.img,alt:""},null)]),createVNode(NSpace,{justify:"center",style:{paddingTop:"12px"}},{default:()=>[createVNode(NButton,{type:"primary",size:"small",onClick:()=>T("left")},{default:()=>[createTextVNode("逆时针旋转")]}),createVNode(NButton,{type:"primary",size:"small",onClick:()=>T("right")},{default:()=>[createTextVNode("顺时针旋转")]}),createVNode(NButton,{type:"primary",size:"small",onClick:()=>T("zoomIn")},{default:()=>[createTextVNode("放大")]}),createVNode(NButton,{type:"primary",size:"small",onClick:()=>T("zoomOut")},{default:()=>[createTextVNode("缩小")]})]})]}}),createVNode(NGi,null,{default:()=>[createVNode("span",{style:{fontSize:"15px",fontWeight:600,paddingBottom:"8px",display:"inline-block"}},[createTextVNode("预览图片")]),createVNode("div",{class:"before",style:{width:t.options.autoCropWidth+"px",height:t.options.autoCropHeight+"px",overflow:"hidden"}},null)]})]}),createVNode(NSpace,{justify:"end"},{default:()=>[createVNode(NButton,{type:"default",onClick:()=>{t.confirmLoading=!1,n("close"),n("cropperNo")}},{default:()=>[createTextVNode("取消")]}),createVNode(NButton,{type:"primary",loading:t.confirmLoading,onClick:w},{default:()=>[createTextVNode("确认")]})]})])}}),UploadFile=defineComponent({name:"upload-file",props:{fileList:{type:String,default:""},imageList:{type:Array,default:()=>[]},accept:{type:String,default:".jpg,.png,.jpeg,.gif"},listType:{type:String,default:"image-card"},showType:{type:String,default:"default"},showFileList:{type:Boolean,default:!0},text:{type:String,default:"上传文件"},size:{type:Number,default:5},max:{type:Number,default:1},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},tips:{type:String,default:""},bucketName:{type:String,default:"gyt"},path:{type:String,default:""},fileName:{type:String,default:""},cropper:{type:Boolean,default:!1},options:{type:Object,default:()=>({viewMode:0,autoCrop:!0,enlarge:1,autoCropWidth:200,autoCropHeight:200,fixedBox:!1,previewsCircle:!0,title:"上传图片"})}},emits:["update:fileList","close","readFileInputEventAsArrayBuffer","remove"],setup(o,{emit:n,expose:e,slots:t}){const l="https://".concat(o.bucketName,".ks3-cn-beijing.ksyuncs.com/"),r=useMessage(),u=ref(!1),T=ref(!1);ref();const w=ref(),x=reactive([]),S=ref([]),A=()=>{if(o.fileList){const E=o.fileList.split("/");S.value=[{id:new Date().getTime().toString(),name:E[E.length-1],status:"finished",url:o.fileList}]}else if(Array.isArray(o.imageList)){const E=[];o.imageList.forEach(C=>{const k=C.split("/");E.push({id:Date.now().toString(),name:k[k.length-1],status:"finished",url:C})}),S.value=E}else S.value=[]};A(),watch(()=>o.imageList,()=>{A()}),watch(()=>o.fileList,()=>{A()}),e({handleClearFile:()=>{var E;(E=w.value)==null||E.clear(),console.log("清空",w.value)}});const z=ref(),P=async E=>{const C=E.file;let k=!0;if(o.size&&(k=C.file.size/1024/1024{const U=Object.assign({},o.options,{img:g,name:C.file.name});u.value=!0,setTimeout(()=>{var F;(F=z.value)==null||F.edit(U),console.log(z.value,"cropper")},100)}),!1;try{T.value=!0,console.log(o.path,C.file);const g=C.file.name,U=g.slice(g.lastIndexOf(".")),F="".concat(o.path).concat(o.fileName||Date.now()+U),H={filename:F,bucketName:o.bucketName,postData:{filename:F,acl:"public-read",key:F,unknowValueField:[]}},{data:K}=await getUploadSign(H);x.push({id:C.id,tempFiileBuffer:C.file,policy:K.policy,signature:K.signature,acl:"public-read",key:F,KSSAccessKeyId:K.kssAccessKeyId,name:F})}catch(g){return T.value=!1,!1}return!0},L=async(E,C)=>{const k=new FileReader;k.addEventListener("load",()=>C(k.result)),k.readAsDataURL(E)},Y=E=>{const C=x.find(k=>k.id==E.file.id);n("update:fileList",E.file.url),n("readFileInputEventAsArrayBuffer",C.tempFiileBuffer),u.value=!1,T.value=!1},W=async E=>{console.log("🚀 ~ options",E),n("update:fileList",""),n("remove"),T.value=!1},ie=({file:E,action:C,onFinish:k,onError:g,onProgress:U})=>{const F=x.find(H=>H.id==E.id);F.file=E,onFileUpload({file:E,action:C,data:F,onProgress:U,onFinish:k,onError:g})},B=async E=>{try{const C="".concat(o.path).concat(o.fileName||new Date().getTime()+".png"),k={filename:C,bucketName:o.bucketName,postData:{filename:C,acl:"public-read",key:C,unknowValueField:[]}},{data:g}=await getUploadSign(k),U={policy:g.policy,signature:g.signature,acl:"public-read",key:C,KSSAccessKeyId:g.kssAccessKeyId,name:C,file:E},F=await onOnlyFileUpload(l,U);console.log(F,"upload"),n("update:fileList",F),u.value=!1}catch(C){return!1}};return()=>createVNode("div",null,[createVNode(NUpload,{ref:w,action:l,customRequest:ie,fileList:S.value,"onUpdate:fileList":E=>S.value=E,listType:o.listType,accept:o.accept,multiple:o.multiple,max:o.max,disabled:o.disabled,showFileList:o.showFileList,showPreviewButton:!0,onBeforeUpload:E=>P(E),onFinish:E=>Y(E),onRemove:E=>W(E)},{default:()=>[o.showType==="default"&&o.listType==="image"&&createVNode(NButton,{loading:T.value,type:"primary"},{default:()=>[o.text]}),o.showType==="custom"&&t.custom&&t.custom()]}),o.tips&&createVNode("p",{style:"font-size: 13px; color: #666; padding-top: 4px;"},[o.tips]),createVNode(NModal,{maskClosable:modalClickMask,show:u.value,"onUpdate:show":E=>u.value=E,preset:"dialog",showIcon:!1,class:["modalTitle background"],title:"上传图片",style:{width:"800px"}},{default:()=>[createVNode(Copper,{ref:z,onClose:()=>u.value=!1,onCropperOk:B},null)]})])}});export{Cropper as C,UploadFile as U,onOnlyFileUpload as a,getUploadSign as g,onFileUpload as o};