123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- (function(){System.register(["./index-legacy-f8e66744-1725962701482.js"],(function(exports,module){"use strict";var commonjsGlobal,getDefaultExportFromCjs,request,defineComponent,reactive,ref,createVNode,NGrid,NGi,NSpace,NButton,createTextVNode,nextTick,useMessage,watch,NUpload,NModal,modalClickMask;return{setters:[e=>{commonjsGlobal=e.b6,getDefaultExportFromCjs=e.b7,request=e.H,defineComponent=e.d,reactive=e.e,ref=e.r,createVNode=e.f,NGrid=e.aA,NGi=e.aB,NSpace=e.x,NButton=e.j,createTextVNode=e.k,nextTick=e.S,useMessage=e.b,watch=e.A,NUpload=e.O,NModal=e.l,modalClickMask=e.m}],execute:function(){var __vite_style__=document.createElement("style");__vite_style__.textContent='/*!\n * Cropper.js v1.5.13\n * https://fengyuanchen.github.io/cropperjs\n *\n * Copyright 2015-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2022-11-20T05:30:43.444Z\n */.cropper-container{direction:ltr;font-size:0;line-height:0;position:relative;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cropper-container img{-webkit-backface-visibility:hidden;backface-visibility:hidden;display:block;height:100%;image-orientation:0deg;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.cropper-wrap-box,.cropper-canvas,.cropper-drag-box,.cropper-crop-box,.cropper-modal{bottom:0;left:0;position:absolute;right:0;top:0}.cropper-wrap-box,.cropper-canvas{overflow:hidden}.cropper-drag-box{background-color:#fff;opacity:0}.cropper-modal{background-color:#000;opacity:.5}.cropper-view-box{display:block;height:100%;outline:1px solid #39f;outline-color:rgba(51,153,255,.75);overflow:hidden;width:100%}.cropper-dashed{border:0 dashed #eee;display:block;opacity:.5;position:absolute}.cropper-dashed.dashed-h{border-bottom-width:1px;border-top-width:1px;height:calc(100% / 3);left:0;top:calc(100% / 3);width:100%}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;height:100%;left:calc(100% / 3);top:0;width:calc(100% / 3)}.cropper-center{display:block;height:0;left:50%;opacity:.75;position:absolute;top:50%;width:0}.cropper-center:before,.cropper-center:after{background-color:#eee;content:" ";display:block;position:absolute}.cropper-center:before{height:1px;left:-.15625vw;top:0;width:.36458333vw}.cropper-center:after{height:.36458333vw;left:0;top:-.15625vw;width:1px}.cropper-face,.cropper-line,.cropper-point{display:block;height:100%;opacity:.1;position:absolute;width:100%}.cropper-face{background-color:#fff;left:0;top:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;right:-.15625vw;top:0;width:.26041667vw}.cropper-line.line-n{cursor:ns-resize;height:.26041667vw;left:0;top:-.15625vw}.cropper-line.line-w{cursor:ew-resize;left:-.15625vw;top:0;width:.26041667vw}.cropper-line.line-s{bottom:-.15625vw;cursor:ns-resize;height:.26041667vw;left:0}.cropper-point{background-color:#39f;height:.26041667vw;opacity:.75;width:.26041667vw}.cropper-point.point-e{cursor:ew-resize;margin-top:-.15625vw;right:-.15625vw;top:50%}.cropper-point.point-n{cursor:ns-resize;left:50%;margin-left:-.15625vw;top:-.15625vw}.cropper-point.point-w{cursor:ew-resize;left:-.15625vw;margin-top:-.15625vw;top:50%}.cropper-point.point-s{bottom:-.15625vw;cursor:s-resize;left:50%;margin-left:-.15625vw}.cropper-point.point-ne{cursor:nesw-resize;right:-.15625vw;top:-.15625vw}.cropper-point.point-nw{cursor:nwse-resize;left:-.15625vw;top:-.15625vw}.cropper-point.point-sw{bottom:-.15625vw;cursor:nesw-resize;left:-.15625vw}.cropper-point.point-se{bottom:-.15625vw;cursor:nwse-resize;height:1.04166667vw;opacity:1;right:-.15625vw;width:1.04166667vw}@media (min-width: 768px){.cropper-point.point-se{height:.78125vw;width:.78125vw}}@media (min-width: 992px){.cropper-point.point-se{height:.52083333vw;width:.52083333vw}}@media (min-width: 1200px){.cropper-point.point-se{height:.26041667vw;opacity:.75;width:.26041667vw}}.cropper-point.point-se:before{background-color:#39f;bottom:-50%;content:" ";display:block;height:200%;opacity:0;position:absolute;right:-50%;width:200%}.cropper-invisible{opacity:0}.cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-hide{display:block;height:0;position:absolute;width:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}\n',document.head.appendChild(__vite_style__);var cosJsSdkV5={exports:{}};(function(module,exports){var factory;factory=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist/",n(n.s="./index.js")}({"./index.js":
- /*!******************!*\
- !*** ./index.js ***!
- \******************/
- /*! no static exports found */function(e,t,n){var r=n(/*! ./src/cos */"./src/cos.js");e.exports=r},"./lib/base64.js":
- /*!***********************!*\
- !*** ./lib/base64.js ***!
- \***********************/
- /*! no static exports found */function(e,t){var n=function(e){var t=(e=e||{}).Base64,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=function(e){for(var t={},n=0,r=e.length;n<r;n++)t[e.charAt(n)]=n;return t}(n),o=String.fromCharCode,i=function(e){if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?o(192|t>>>6)+o(128|63&t):o(224|t>>>12&15)+o(128|t>>>6&63)+o(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return o(240|t>>>18&7)+o(128|t>>>12&63)+o(128|t>>>6&63)+o(128|63&t)},a=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,s=function(e){return e.replace(a,i)},c=function(e){var t=[0,2,1][e.length%3],r=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[n.charAt(r>>>18),n.charAt(r>>>12&63),t>=2?"=":n.charAt(r>>>6&63),t>=1?"=":n.charAt(63&r)].join("")},u=e.btoa?function(t){return e.btoa(t)}:function(e){return e.replace(/[\s\S]{1,3}/g,c)},l=function(e){return u(s(e))},d=function(e,t){return t?l(String(e)).replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"})).replace(/=/g,""):l(String(e))},h=new RegExp(["[À-ß][-¿]","[à-ï][-¿]{2}","[ð-÷][-¿]{3}"].join("|"),"g"),p=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return o(55296+(t>>>10))+o(56320+(1023&t));case 3:return o((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return o((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},f=function(e){return e.replace(h,p)},m=function(e){var t=e.length,n=t%4,i=(t>0?r[e.charAt(0)]<<18:0)|(t>1?r[e.charAt(1)]<<12:0)|(t>2?r[e.charAt(2)]<<6:0)|(t>3?r[e.charAt(3)]:0),a=[o(i>>>16),o(i>>>8&255),o(255&i)];return a.length-=[0,0,2,1][n],a.join("")},g=e.atob?function(t){return e.atob(t)}:function(e){return e.replace(/[\s\S]{1,4}/g,m)},y=function(e){return function(e){return f(g(e))}(String(e).replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,""))};return{VERSION:"2.1.9",atob:g,btoa:u,fromBase64:y,toBase64:d,utob:s,encode:d,encodeURI:function(e){return d(e,!0)},btou:f,decode:y,noConflict:function(){var n=e.Base64;return e.Base64=t,n}}}();e.exports=n},"./lib/beacon.min.js":
- /*!***************************!*\
- !*** ./lib/beacon.min.js ***!
- \***************************/
- /*! no static exports found */function(e,t,n){var r,o,i,a=n(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js");i=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function r(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var o="__BEACON_",i="__BEACON_deviceId",a="last_report_time",s="sending_event_ids",c="beacon_config",u="beacon_config_request_time",l=function(){function e(){var e=this;this.emit=function(t,n){if(e){var r,o=e.__EventsList[t];if(null==o?void 0:o.length){o=o.slice();for(var i=0;i<o.length;i++){r=o[i];try{var a=r.callback.apply(e,[n]);if(1===r.type&&e.remove(t,r.callback),!1===a)break}catch(e){throw e}}}return e}},this.__EventsList={}}return e.prototype.indexOf=function(e,t){for(var n=0;n<e.length;n++)if(e[n].callback===t)return n;return-1},e.prototype.on=function(e,t,n){if(void 0===n&&(n=0),this){var r=this.__EventsList[e];if(r||(r=this.__EventsList[e]=[]),-1===this.indexOf(r,t)){var o={name:e,type:n||0,callback:t};return r.push(o),this}return this}},e.prototype.one=function(e,t){this.on(e,t,1)},e.prototype.remove=function(e,t){if(this){var n=this.__EventsList[e];if(!n)return null;if(!t){try{delete this.__EventsList[e]}catch(e){}return null}if(n.length){var r=this.indexOf(n,t);n.splice(r,1)}return this}},e}();function d(e,t){for(var n={},r=0,o=Object.keys(e);r<o.length;r++){var i=o[r],a=e[i];if("string"==typeof a)n[h(i)]=h(a);else{if(t)throw new Error("value mast be string !!!!");n[h(String(i))]=h(String(a))}}return n}function h(e){if("string"!=typeof e)return e;try{return e.replace(new RegExp("\\|","g"),"%7C").replace(new RegExp("\\&","g"),"%26").replace(new RegExp("\\=","g"),"%3D").replace(new RegExp("\\+","g"),"%2B")}catch(e){return""}}function p(e){return String(e.A99)+String(e.A100)}var f=function(){},m=function(){function e(e){var n=this;this.lifeCycle=new l,this.uploadJobQueue=[],this.additionalParams={},this.delayTime=0,this._normalLogPipeline=function(e){if(!e||!e.reduce||!e.length)throw new TypeError("createPipeline 方法需要传入至少有一个 pipe 的数组");return 1===e.length?function(t,n){e[0](t,n||f)}:e.reduce((function(e,t){return function(n,r){return void 0===r&&(r=f),e(n,(function(e){return null==t?void 0:t(e,r)}))}}))}([function(e){n.send({url:n.strategy.getUploadUrl(),data:e,method:"post",contentType:"application/json;charset=UTF-8"},(function(){var t=n.config.onReportSuccess;"function"==typeof t&&t(JSON.stringify(e.events))}),(function(){var t=n.config.onReportFail;"function"==typeof t&&t(JSON.stringify(e.events))}))}]),function(e,t){if(!e)throw t instanceof Error?t:new Error(t)}(Boolean(e.appkey),"appkey must be initial"),this.config=t({},e)}return e.prototype.onUserAction=function(e,t){this.preReport(e,t,!1)},e.prototype.onDirectUserAction=function(e,t){this.preReport(e,t,!0)},e.prototype.preReport=function(e,t,n){e?this.strategy.isEventUpOnOff()&&(this.strategy.isBlackEvent(e)||this.strategy.isSampleEvent(e)||this.onReport(e,t,n)):this.errorReport.reportError("602"," no eventCode")},e.prototype.addAdditionalParams=function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];this.additionalParams[r]=e[r]}},e.prototype.setChannelId=function(e){this.commonInfo.channelID=String(e)},e.prototype.setOpenId=function(e){this.commonInfo.openid=String(e)},e.prototype.setUnionid=function(e){this.commonInfo.unid=String(e)},e.prototype.getDeviceId=function(){return this.commonInfo.deviceId},e.prototype.getCommonInfo=function(){return this.commonInfo},e.prototype.removeSendingId=function(e){try{var t=JSON.parse(this.storage.getItem(s)),n=t.indexOf(e);-1!=n&&(t.splice(n,1),this.storage.setItem(s,JSON.stringify(t)))}catch(e){}},e}(),g=function(){function e(e,t,n,r){this.requestParams={},this.network=r,this.requestParams.attaid="00400014144",this.requestParams.token="6478159937",this.requestParams.product_id=e.appkey,this.requestParams.platform=n,this.requestParams.uin=t.deviceId,this.requestParams.model="",this.requestParams.os=n,this.requestParams.app_version=e.appVersion,this.requestParams.sdk_version=t.sdkVersion,this.requestParams.error_stack="",this.uploadUrl=e.isOversea?"https://htrace.wetvinfo.com/kv":"https://h.trace.qq.com/kv"}return e.prototype.reportError=function(e,t){this.requestParams._dc=Math.random(),this.requestParams.error_msg=t,this.requestParams.error_code=e,this.network.get(this.uploadUrl,{params:this.requestParams}).catch((function(e){}))},e}(),y=function(){function e(e,t,n,r,o){this.strategy={isEventUpOnOff:!0,httpsUploadUrl:"https://otheve.beacon.qq.com/analytics/v2_upload",requestInterval:30,blacklist:[],samplelist:[]},this.realSample={},this.appkey="",this.needQueryConfig=!0,this.appkey=t.appkey,this.storage=r,this.needQueryConfig=e;try{var i=JSON.parse(this.storage.getItem(c));i&&this.processData(i)}catch(e){}t.isOversea&&(this.strategy.httpsUploadUrl="https://svibeacon.onezapp.com/analytics/v2_upload"),!t.isOversea&&this.needRequestConfig()&&this.requestConfig(t.appVersion,n,o)}return e.prototype.requestConfig=function(e,t,n){var r=this;this.storage.setItem(u,Date.now().toString()),n.post("https://oth.str.beacon.qq.com/trpc.beacon.configserver.BeaconConfigService/QueryConfig",{platformId:"undefined"==typeof wx?"3":"4",mainAppKey:this.appkey,appVersion:e,sdkVersion:t.sdkVersion,osVersion:t.userAgent,model:"",packageName:"",params:{A3:t.deviceId}}).then((function(e){if(0==e.data.ret)try{var t=JSON.parse(e.data.beaconConfig);t&&(r.processData(t),r.storage.setItem(c,e.data.beaconConfig))}catch(e){}else r.processData(null),r.storage.setItem(c,"")})).catch((function(e){}))},e.prototype.processData=function(e){var t,n,r,o,i;this.strategy.isEventUpOnOff=null!==(t=null==e?void 0:e.isEventUpOnOff)&&void 0!==t?t:this.strategy.isEventUpOnOff,this.strategy.httpsUploadUrl=null!==(n=null==e?void 0:e.httpsUploadUrl)&&void 0!==n?n:this.strategy.httpsUploadUrl,this.strategy.requestInterval=null!==(r=null==e?void 0:e.requestInterval)&&void 0!==r?r:this.strategy.requestInterval,this.strategy.blacklist=null!==(o=null==e?void 0:e.blacklist)&&void 0!==o?o:this.strategy.blacklist,this.strategy.samplelist=null!==(i=null==e?void 0:e.samplelist)&&void 0!==i?i:this.strategy.samplelist;for(var a=0,s=this.strategy.samplelist;a<s.length;a++){var c=s[a].split(",");2==c.length&&(this.realSample[c[0]]=c[1])}},e.prototype.needRequestConfig=function(){if(!this.needQueryConfig)return!1;var e=Number(this.storage.getItem(u));return Date.now()-e>60*this.strategy.requestInterval*1e3},e.prototype.getUploadUrl=function(){return this.strategy.httpsUploadUrl+"?appkey="+this.appkey},e.prototype.isBlackEvent=function(e){return-1!=this.strategy.blacklist.indexOf(e)},e.prototype.isEventUpOnOff=function(){return this.strategy.isEventUpOnOff},e.prototype.isSampleEvent=function(e){return!!Object.prototype.hasOwnProperty.call(this.realSample,e)&&this.realSample[e]<Math.floor(Math.random()*Math.floor(1e4))},e}(),v="session_storage_key",C=function(){function e(e,t,n){this.getSessionStackDepth=0,this.beacon=n,this.storage=e,this.duration=t,this.appkey=n.config.appkey}return e.prototype.getSession=function(){this.getSessionStackDepth+=1;var e=this.storage.getItem(v);if(!e)return this.createSession();var t="",n=0;try{var r=JSON.parse(e)||{sessionId:void 0,sessionStart:void 0};if(!r.sessionId||!r.sessionStart)return this.createSession();var o=Number(this.storage.getItem(a));if(Date.now()-o>this.duration)return this.createSession();t=r.sessionId,n=r.sessionStart,this.getSessionStackDepth=0}catch(e){}return{sessionId:t,sessionStart:n}},e.prototype.createSession=function(){var e=Date.now(),t={sessionId:this.appkey+"_"+e.toString(),sessionStart:e};this.storage.setItem(v,JSON.stringify(t)),this.storage.setItem(a,e.toString());var n="is_new_user",r=this.storage.getItem(n);return this.getSessionStackDepth<=1&&this.beacon.onDirectUserAction("rqd_applaunched",{A21:r?"N":"Y"}),this.storage.setItem(n,JSON.stringify(!1)),t},e}();function b(){var e=navigator.userAgent,t=e.indexOf("compatible")>-1&&e.indexOf("MSIE")>-1,n=e.indexOf("Edge")>-1&&!t,r=e.indexOf("Trident")>-1&&e.indexOf("rv:11.0")>-1;if(t){new RegExp("MSIE (\\d+\\.\\d+);").test(e);var o=parseFloat(RegExp.$1);return 7==o?7:8==o?8:9==o?9:10==o?10:6}return n?-2:r?11:-1}var S,E,T=function(){return(T=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},k=function(){function e(e,t){void 0===t&&(t={}),this.reportOptions={},this.config=e,this.reportOptions=t}return e.canUseDB=function(){return!!(null===window||void 0===window?void 0:window.indexedDB)},e.prototype.openDB=function(){var t=this;return new Promise((function(n,r){if(!e.canUseDB())return r({message:"当前不支持 indexeddb"});var o=t.config,i=o.name,a=o.version,s=o.stores,c=indexedDB.open(i,a);c.onsuccess=function(){t.db=c.result,n(),T({result:1,func:"open",params:JSON.stringify(t.config)},t.reportOptions)},c.onerror=function(e){var n,o;r(e),T({result:0,func:"open",params:JSON.stringify(t.config),error_msg:null===(o=null===(n=e.target)||void 0===n?void 0:n.error)||void 0===o?void 0:o.message},t.reportOptions)},c.onupgradeneeded=function(){t.db=c.result;try{null==s||s.forEach((function(e){t.createStore(e)}))}catch(e){T({result:0,func:"open",params:JSON.stringify(t.config),error_msg:e.message},t.reportOptions),r(e)}}}))},e.prototype.useStore=function(e){return this.storeName=e,this},e.prototype.deleteDB=function(){var e=this;return this.closeDB(),new Promise((function(t,n){var r=indexedDB.deleteDatabase(e.config.name);r.onsuccess=function(){return t()},r.onerror=n}))},e.prototype.closeDB=function(){var e;null===(e=this.db)||void 0===e||e.close(),this.db=null},e.prototype.getStoreCount=function(){var e=this;return new Promise((function(t,n){var r=e.getStore("readonly").count();r.onsuccess=function(){return t(r.result)},r.onerror=n}))},e.prototype.clearStore=function(){var e=this;return new Promise((function(t,n){var r=e.getStore("readwrite").clear();r.onsuccess=function(){return t()},r.onerror=n}))},e.prototype.add=function(e,t){var n=this;return new Promise((function(r,o){var i=n.getStore("readwrite").add(e,t);i.onsuccess=function(){r(i.result)},i.onerror=o}))},e.prototype.put=function(e,t){var n=this;return new Promise((function(r,o){var i=n.getStore("readwrite").put(e,t);i.onsuccess=function(){r(i.result)},i.onerror=o}))},e.prototype.getStoreAllData=function(){var e=this;return new Promise((function(t,n){var r=e.getStore("readonly").openCursor(),o=[];r.onsuccess=function(){var e;if(null===(e=r.result)||void 0===e?void 0:e.value){var n=r.result.value;o.push(n),r.result.continue()}else t(o)},r.onerror=n}))},e.prototype.getDataRangeByIndex=function(e,t,n,r,o){var i=this;return new Promise((function(a,s){var c=i.getStore().index(e),u=IDBKeyRange.bound(t,n,r,o),l=[],d=c.openCursor(u);d.onsuccess=function(){var e;(null===(e=null==d?void 0:d.result)||void 0===e?void 0:e.value)?(l.push(null==d?void 0:d.result.value),null==d||d.result.continue()):a(l)},d.onerror=s}))},e.prototype.removeDataByIndex=function(e,t,n,r,o){var i=this;return new Promise((function(a,s){var c=i.getStore("readwrite").index(e),u=IDBKeyRange.bound(t,n,r,o),l=c.openCursor(u),d=0;l.onsuccess=function(e){var t=e.target.result;t?(d+=1,t.delete(),t.continue()):a(d)},l.onerror=s}))},e.prototype.createStore=function(e){var t=e.name,n=e.indexes,r=void 0===n?[]:n,o=e.options;if(this.db){this.db.objectStoreNames.contains(t)&&this.db.deleteObjectStore(t);var i=this.db.createObjectStore(t,o);r.forEach((function(e){i.createIndex(e.indexName,e.keyPath,e.options)}))}},e.prototype.getStore=function(e){var t;return void 0===e&&(e="readonly"),null===(t=this.db)||void 0===t?void 0:t.transaction(this.storeName,e).objectStore(this.storeName)},e}(),w="event_table_v3",A="eventId",x=function(){function e(e){this.isReady=!1,this.taskQueue=Promise.resolve(),this.db=new k({name:"Beacon_"+e+"_V3",version:1,stores:[{name:w,options:{keyPath:A},indexes:[{indexName:A,keyPath:A,options:{unique:!0}}]}]}),this.open()}return e.prototype.getCount=function(){var e=this;return this.readyExec((function(){return e.db.getStoreCount()}))},e.prototype.setItem=function(e,t){var n=this;return this.readyExec((function(){return n.db.add({eventId:e,value:t})}))},e.prototype.getItem=function(e){return n(this,void 0,void 0,(function(){var t=this;return r(this,(function(n){return[2,this.readyExec((function(){return t.db.getDataRangeByIndex(A,e,e)}))]}))}))},e.prototype.removeItem=function(e){var t=this;return this.readyExec((function(){return t.db.removeDataByIndex(A,e,e)}))},e.prototype.updateItem=function(e,t){var n=this;return this.readyExec((function(){return n.db.put({eventId:e,value:t})}))},e.prototype.iterate=function(e){var t=this;return this.readyExec((function(){return t.db.getStoreAllData().then((function(t){t.forEach((function(t){e(t.value)}))}))}))},e.prototype.open=function(){return n(this,void 0,void 0,(function(){var e=this;return r(this,(function(t){switch(t.label){case 0:return this.taskQueue=this.taskQueue.then((function(){return e.db.openDB()})),[4,this.taskQueue];case 1:return t.sent(),this.isReady=!0,this.db.useStore(w),[2]}}))}))},e.prototype.readyExec=function(e){return this.isReady?e():(this.taskQueue=this.taskQueue.then((function(){return e()})),this.taskQueue)},e}(),_=function(){function e(e){this.keyObject={},this.storage=e}return e.prototype.getCount=function(){return this.storage.getStoreCount()},e.prototype.removeItem=function(e){this.storage.removeItem(e),delete this.keyObject[e]},e.prototype.setItem=function(e,t){var n=JSON.stringify(t);this.storage.setItem(e,n),this.keyObject[e]=t},e.prototype.iterate=function(e){for(var t=Object.keys(this.keyObject),n=0;n<t.length;n++){var r=this.storage.getItem(t[n]);e(JSON.parse(r))}},e}(),O=function(){function e(e,t){var n=this;this.dbEventCount=0,b()>0||!window.indexedDB||/X5Lite/.test(navigator.userAgent)?(this.store=new _(t),this.dbEventCount=this.store.getCount()):(this.store=new x(e),this.getCount().then((function(e){n.dbEventCount=e})).catch((function(e){})))}return e.prototype.getCount=function(){return n(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.store.getCount()];case 1:return[2,e.sent()];case 2:return e.sent(),[2,Promise.reject()];case 3:return[2]}}))}))},e.prototype.insertEvent=function(e,t){return n(this,void 0,void 0,(function(){var n,o;return r(this,(function(r){switch(r.label){case 0:if(this.dbEventCount>=1e4)return[2,Promise.reject()];n=p(e.mapValue),r.label=1;case 1:return r.trys.push([1,3,,4]),this.dbEventCount++,[4,this.store.setItem(n,e)];case 2:return[2,r.sent()];case 3:return o=r.sent(),t&&t(o,e),this.dbEventCount--,[2,Promise.reject()];case 4:return[2]}}))}))},e.prototype.getEvents=function(){return n(this,void 0,void 0,(function(){var e;return r(this,(function(t){switch(t.label){case 0:e=[],t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.store.iterate((function(t){e.push(t)}))];case 2:case 3:return t.sent(),[2,Promise.all(e)];case 4:return[2]}}))}))},e.prototype.removeEvent=function(e){return n(this,void 0,void 0,(function(){var t;return r(this,(function(n){switch(n.label){case 0:t=p(e.mapValue),n.label=1;case 1:return n.trys.push([1,3,,4]),this.dbEventCount--,[4,this.store.removeItem(t)];case 2:return[2,n.sent()];case 3:return n.sent(),this.dbEventCount++,[2,Promise.reject()];case 4:return[2]}}))}))},e}(),N=function(){return(N=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function R(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function I(e,t){var n=[null,void 0,"",NaN].includes(e);if(t.isSkipEmpty&&n)return null;var r=!t.isSkipEmpty&&n?"":e;try{return t.encode?encodeURIComponent(r):r}catch(e){return null}}function D(e,t){return new Promise((function(n,r){if(t&&document.querySelectorAll("script[data-tag="+t+"]").length)return n();var o=document.createElement("script"),i=N({type:"text/javascript",charset:"utf-8"},e);Object.keys(i).forEach((function(e){return function(e,t,n){if(e)return void 0===n?e.getAttribute(t):e.setAttribute(t,n)}(o,e,i[e])})),t&&(o.dataset.tag=t),o.onload=function(){return n()},o.onreadystatechange=function(){var e=o.readyState;["complete","loaded"].includes(e)&&(o.onreadystatechange=null,n())},o.onerror=r,document.body.appendChild(o)}))}(E=S||(S={}))[E.equal=0]="equal",E[E.low=-1]="low",E[E.high=1]="high";var B=function(){return(B=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function P(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function M(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var U=function(){function e(){this.interceptors=[]}return e.prototype.use=function(e,t){return this.interceptors.push({resolved:e,rejected:t}),this.interceptors.length-1},e.prototype.traverse=function(e,t){void 0===t&&(t=!1);var n=Promise.resolve(e);return(t?Array.prototype.reduceRight:Array.prototype.reduce).call(this.interceptors,(function(e,t){if(t){var r=t.resolved,o=t.rejected;n=n.then(r,o)}return e}),""),n},e.prototype.eject=function(e){this.interceptors[e]&&(this.interceptors[e]=null)},e}(),L={defaults:{timeout:0,method:"GET",mode:"cors",redirect:"follow",credentials:"same-origin"},headers:{common:{Accept:"application/json, text/plain, */*"},POST:{"Content-Type":"application/x-www-form-urlencoded"},PUT:{"Content-Type":"application/x-www-form-urlencoded"},PATCH:{"Content-Type":"application/x-www-form-urlencoded"}},baseURL:"",polyfillUrl:"https://vm.gtimg.cn/comps/script/fetch.min.js",interceptors:{request:new U,response:new U}},H=/^([a-z][a-z\d+\-.]*:)?\/\//i,j=Object.prototype.toString;function F(e){return P(this,void 0,void 0,(function(){var t;return M(this,(function(n){switch(n.label){case 0:if(window.fetch)return[2];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,D({src:e})];case 2:return n.sent(),[3,4];case 3:throw t=n.sent(),new Error("加载 polyfill "+e+" 失败: "+t.message);case 4:return[2]}}))}))}function z(e){return P(this,void 0,void 0,(function(){var t,n,r,o,i,a,s,c,u,l,d,h,p,f,m,g,y;return M(this,(function(v){switch(v.label){case 0:return t=L.baseURL,n=L.defaults,r=L.interceptors,[4,F(L.polyfillUrl)];case 1:return v.sent(),(o=B(B({},n),e)).headers||(o.headers=function(e){void 0===e&&(e="GET");var t=L.headers[e]||{};return B(B({},L.headers.common),t)}(o.method)),function(e){["Accept","Content-Type"].forEach((function(t){return n=t,void((r=e.headers)&&Object.keys(r).forEach((function(e){e!==n&&e.toUpperCase()===n.toUpperCase()&&(r[n]=r[e],delete r[e])})));var n,r})),function(e){if("[object Object]"!==j.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}(e.body)&&(e.body=JSON.stringify(e.body),e.headers&&(e.headers["Content-Type"]="application/json;charset=utf-8"))}(o),[4,r.request.traverse(o,!0)];case 2:if((i=v.sent())instanceof Error)throw i;return i.url=function(e,t){return!e||H.test(t)?t:e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,"")}(t,i.url),a=i.url,s=i.timeout,c=i.params,u=i.method,l=["GET","DELETE","OPTIONS","HEAD"].includes(void 0===u?"GET":u)&&!!c,d=l?function(e,t){void 0===t&&(t={encode:!0,isSkipEmpty:!1});var n=e.url,r=e.query,o=void 0===r?{}:r,i=e.hash,a=n.split("#"),s=a[0],c=a[1],u=void 0===c?"":c,l=s.split("?")[0],d=[],h=I(i||u,t),p=N(N({},function(e){var t=e.split("#"),n=t[0],r=t[1],o=void 0===r?"":r,i=n.split("?"),a=i[0],s=i[1],c=void 0===s?"":s,u=R(o),l=Object.create(null);return c.split("&").forEach((function(e){var t=e.split("="),n=t[0],r=t[1],o=void 0===r?"":r,i=R(n),a=R(o);null===i||null===a||""===i&&""===a||l[i]||(l[i]=a)})),{url:a,query:l,hash:u}}(n).query),o);return Object.keys(p).forEach((function(e){var n=I(e,t),r=I(p[e],t);null!==n&&null!==r&&d.push(n+"="+r)})),l+(d.length?"?"+d.join("&"):"")+(h?"#"+h:"")}({url:a,query:c}):a,h=[],s&&!i.signal&&(m=new Promise((function(e){p=setTimeout((function(){e(new Error("timeout"))}),s)})),h.push(m),f=new AbortController,i.signal=f.signal),h.push(fetch(d,i).catch((function(e){return e}))),[4,Promise.race(h)];case 3:return g=v.sent(),p&&clearTimeout(p),[4,r.response.traverse(g)];case 4:if((y=v.sent())instanceof Error)throw null==f||f.abort(),y;return[2,y]}}))}))}var K=function(){function e(e){L.interceptors.request.use((function(n){var r=n.url,o=n.method,i=n.body,a=i;if(e.onReportBeforeSend){var s=e.onReportBeforeSend({url:r,method:o,data:i?JSON.parse(i):null});a=(null==s?void 0:s.data)?JSON.stringify(s.data):null}return"GET"!=o&&a?t(t({},n),{body:a}):n}))}return e.prototype.get=function(e,o){return n(this,void 0,void 0,(function(){var n,i;return r(this,(function(r){switch(r.label){case 0:return[4,z(t({url:e},o))];case 1:return[4,(n=r.sent()).json()];case 2:return i=r.sent(),[2,Promise.resolve({data:i,status:n.status,statusText:n.statusText,headers:n.headers})]}}))}))},e.prototype.post=function(e,o,i){return n(this,void 0,void 0,(function(){var n,a;return r(this,(function(r){switch(r.label){case 0:return[4,z(t({url:e,body:o,method:"POST"},i))];case 1:return[4,(n=r.sent()).json()];case 2:return a=r.sent(),[2,Promise.resolve({data:a,status:n.status,statusText:n.statusText,headers:n.headers})]}}))}))},e}(),V=function(){function e(e){this.appkey=e}return e.prototype.getItem=function(e){try{return window.localStorage.getItem(this.getStoreKey(e))}catch(e){return""}},e.prototype.removeItem=function(e){try{window.localStorage.removeItem(this.getStoreKey(e))}catch(e){}},e.prototype.setItem=function(e,t){try{window.localStorage.setItem(this.getStoreKey(e),t)}catch(e){}},e.prototype.setSessionItem=function(e,t){try{window.sessionStorage.setItem(this.getStoreKey(e),t)}catch(e){}},e.prototype.getSessionItem=function(e){try{return window.sessionStorage.getItem(this.getStoreKey(e))}catch(e){return""}},e.prototype.getStoreKey=function(e){return o+this.appkey+"_"+e},e.prototype.createDeviceId=function(){try{var e=window.localStorage.getItem(i);return e||(e=function(e){for(var t="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz0123456789",n="",r=0;r<32;r++)n+=t.charAt(Math.floor(51*Math.random()));return n}(),window.localStorage.setItem(i,e)),e}catch(e){return""}},e.prototype.clear=function(){try{for(var e=window.localStorage.length,t=0;t<e;t++){var n=window.localStorage.key(t);(null==n?void 0:n.substr(0,9))==o&&window.localStorage.removeItem(n)}}catch(e){}},e.prototype.getStoreCount=function(){var e=0;try{e=window.localStorage.length}catch(e){}return e},e}(),q="logid_start",W="4.5.14-web";return function(n){function r(e){var t=n.call(this,e)||this;t.qimei36="",t.uselessCycleTaskNum=0,t.underWeakNet=!1,t.pauseSearching=!1,t.send=function(e,n,r){t.storage.setItem(a,Date.now().toString()),t.network.post(t.uploadUrl||t.strategy.getUploadUrl(),e.data).then((function(r){var o;100==(null===(o=null==r?void 0:r.data)||void 0===o?void 0:o.result)?t.delayTime=1e3*r.data.delayTime:t.delayTime=0,n&&n(e.data),e.data.events.forEach((function(e){t.store.removeEvent(e).then((function(){t.removeSendingId(p(e.mapValue))}))})),t.doCustomCycleTask()})).catch((function(n){var o=e.data.events;t.errorReport.reportError(n.code?n.code.toString():"600",n.message),r&&r(e.data);var i=JSON.parse(t.storage.getItem(s));o.forEach((function(e){i&&-1!=i.indexOf(p(e))&&t.store.insertEvent(e,(function(e,n){e&&t.errorReport.reportError("604","insertEvent fail!")})),t.removeSendingId(p(e))})),t.monitorUploadFailed()}))};var r,o,i=b();return t.isUnderIE8=i>0&&i<8,t.isUnderIE8||(t.isUnderIE=i>0,e.needInitQimei&&function(e,t){var n;(void 0===n&&(n=Date.now()+"-"+Math.random()),new Promise((function(e,t){if(document.getElementById(n))e(void 0);else{var r=document.getElementsByTagName("head")[0],o=document.createElement("script");o.onload=function(){return function(){o.onload=null,e(void 0)}},o.onerror=function(e){o.onerror=null,r.removeChild(o),t(e)},o.src="https://tun-cos-1258344701.file.myqcloud.com/fp.js",o.id=n,r.appendChild(o)}}))).then((function(){(new Fingerprint).getQimei36(e,t)})).catch((function(e){}))}(e.appkey,(function(e){t.qimei36=e.q36})),t.network=new K(e),t.storage=new V(e.appkey),t.initCommonInfo(e),t.store=new O(e.appkey,t.storage),t.errorReport=new g(t.config,t.commonInfo,"web",t.network),t.strategy=new y(null==e.needQueryConfig||e.needQueryConfig,t.config,t.commonInfo,t.storage,t.network),t.logidStartTime=t.storage.getItem(q),t.logidStartTime||(t.logidStartTime=Date.now().toString(),t.storage.setItem(q,t.logidStartTime)),r=t.logidStartTime,o=Date.now()-Number.parseFloat(r),Math.floor(o/864e5)>=365&&t.storage.clear(),t.initSession(e),t.onDirectUserAction("rqd_js_init",{}),setTimeout((function(){return t.lifeCycle.emit("init")}),0),t.initDelayTime=e.delay?e.delay:1e3,t.cycleTask(t.initDelayTime)),t}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(r,n),r.prototype.initSession=function(e){var t=18e5;e.sessionDuration&&e.sessionDuration>3e4&&(t=e.sessionDuration),this.beaconSession=new C(this.storage,t,this)},r.prototype.initCommonInfo=function(e){var t=Number(this.storage.getItem(a));try{var n=JSON.parse(this.storage.getItem(s));(Date.now()-t>3e4||!n)&&this.storage.setItem(s,JSON.stringify([]))}catch(e){}e.uploadUrl&&(this.uploadUrl=e.uploadUrl+"?appkey="+e.appkey);var r=[window.screen.width,window.screen.height];window.devicePixelRatio&&r.push(window.devicePixelRatio),this.commonInfo={deviceId:this.storage.createDeviceId(),language:navigator&&navigator.language||"zh_CN",query:window.location.search,userAgent:navigator.userAgent,pixel:r.join("*"),channelID:e.channelID?String(e.channelID):"",openid:e.openid?String(e.openid):"",unid:e.unionid?String(e.unionid):"",sdkVersion:W},this.config.appVersion=e.versionCode?String(e.versionCode):"",this.config.strictMode=e.strictMode},r.prototype.cycleTask=function(e){var t=this;this.intervalID=window.setInterval((function(){t.pauseSearching||t.store.getEvents().then((function(e){0==e.length&&(t.pauseSearching=!0);var n=[],r=JSON.parse(t.storage.getItem(s));r||(r=[]),e&&e.forEach((function(e){var t=p(e.mapValue);-1==r.indexOf(t)&&(n.push(e),r.push(t))})),0!=n.length&&(t.storage.setItem(s,JSON.stringify(r)),t._normalLogPipeline(t.assembleData(n)))})).catch((function(e){}))}),e)},r.prototype.onReport=function(e,t,n){var r=this;if(this.isUnderIE8)this.errorReport.reportError("601","UnderIE8");else{this.pauseSearching=!1;var o=this.generateData(e,t,n);if(n&&0==this.delayTime&&!this.underWeakNet)this._normalLogPipeline(this.assembleData(o));else{var i=o.shift();i&&this.store.insertEvent(i,(function(e){e&&r.errorReport.reportError("604","insertEvent fail!")})).catch((function(e){r._normalLogPipeline(r.assembleData(o))}))}}},r.prototype.onSendBeacon=function(e,t){if(this.isUnderIE)this.errorReport.reportError("605","UnderIE");else{this.pauseSearching=!1;var n=this.assembleData(this.generateData(e,t,!0));"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(this.uploadUrl||this.strategy.getUploadUrl(),JSON.stringify(n))}},r.prototype.generateData=function(e,n,r){var o=[],i="4.5.14-web_"+(r?"direct_log_id":"normal_log_id"),a=Number(this.storage.getItem(i));return a=a||1,n=t(t({},n),{A99:r?"Y":"N",A100:a.toString(),A72:W,A88:this.logidStartTime}),a++,this.storage.setItem(i,a.toString()),o.push({eventCode:e,eventTime:Date.now().toString(),mapValue:d(n,this.config.strictMode)}),o},r.prototype.assembleData=function(e){var n=this.beaconSession.getSession();return{appVersion:this.config.appVersion?h(this.config.appVersion):"",sdkId:"js",sdkVersion:W,mainAppKey:this.config.appkey,platformId:3,common:d(t(t({},this.additionalParams),{A2:this.commonInfo.deviceId,A8:this.commonInfo.openid,A12:this.commonInfo.language,A17:this.commonInfo.pixel,A23:this.commonInfo.channelID,A50:this.commonInfo.unid,A76:n.sessionId,A101:this.commonInfo.userAgent,A102:window.location.href,A104:document.referrer,A119:this.commonInfo.query,A153:this.qimei36}),!1),events:e}},r.prototype.monitorUploadFailed=function(){this.uselessCycleTaskNum++,this.uselessCycleTaskNum>=5&&(window.clearInterval(this.intervalID),this.cycleTask(6e4),this.underWeakNet=!0)},r.prototype.doCustomCycleTask=function(){this.uselessCycleTaskNum>=5&&(window.clearInterval(this.intervalID),this.cycleTask(this.initDelayTime)),this.uselessCycleTaskNum=0,this.underWeakNet=!1},r}(m)},"object"==a(t)&&void 0!==e?e.exports=i():void 0===(o="function"==typeof(r=i)?r.call(t,n,t,e):r)||(e.exports=o)},"./lib/crypto.js":
- /*!***********************!*\
- !*** ./lib/crypto.js ***!
- \***********************/
- /*! no static exports found */function(e,t,n){(function(e){var t,r,o,i,a,s,c,u=n(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js"),l=l||function(e,t){var n={},r=n.lib={},o=function(){},i=r.Base={extend:function(e){o.prototype=this;var t=new o;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},a=r.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes;if(e=e.sigBytes,this.clamp(),r%4)for(var o=0;o<e;o++)t[r+o>>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(r+o)%4*8;else if(65535<n.length)for(o=0;o<e;o+=4)t[r+o>>>2]=n[o>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;r<t;r+=4)n.push(4294967296*e.random()|0);return new a.init(n,t)}}),s=n.enc={},c=s.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r<e;r++){var o=t[r>>>2]>>>24-r%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new a.init(n,t/2)}},u=s.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r<e;r++)n.push(String.fromCharCode(t[r>>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new a.init(n,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(t){throw Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},d=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,o=n.sigBytes,i=this.blockSize,s=o/(4*i);if(t=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*i,o=e.min(4*t,o),t){for(var c=0;c<t;c+=i)this._doProcessBlock(r,c);c=r.splice(0,t),n.sigBytes-=o}return new a.init(c,o)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});r.Hasher=d.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new h.HMAC.init(e,n).finalize(t)}}});var h=n.algo={};return n}(Math);r=(a=(t=l).lib).WordArray,o=a.Hasher,i=[],a=t.algo.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],o=n[1],a=n[2],s=n[3],c=n[4],u=0;80>u;u++){if(16>u)i[u]=0|e[t+u];else{var l=i[u-3]^i[u-8]^i[u-14]^i[u-16];i[u]=l<<1|l>>>31}l=(r<<5|r>>>27)+c+i[u],l=20>u?l+(1518500249+(o&a|~o&s)):40>u?l+(1859775393+(o^a^s)):60>u?l+((o&a|o&s|a&s)-1894007588):l+((o^a^s)-899497514),c=s,s=a,a=o<<30|o>>>2,o=r,r=l}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+s|0,n[4]=n[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA1=o._createHelper(a),t.HmacSHA1=o._createHmacHelper(a),function(){var e=l,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,o=4*r;n.sigBytes>o&&(n=e.finalize(n)),n.clamp();for(var i=this._oKey=n.clone(),a=this._iKey=n.clone(),s=i.words,c=a.words,u=0;u<r;u++)s[u]^=1549556828,c[u]^=909522486;i.sigBytes=a.sigBytes=o,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})}(),c=(s=l).lib.WordArray,s.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var o=[],i=0;i<n;i+=3)for(var a=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s<n;s++)o.push(r.charAt(a>>>6*(3-s)&63));var c=r.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,n=this._map,r=n.charAt(64);if(r){var o=e.indexOf(r);-1!=o&&(t=o)}for(var i=[],a=0,s=0;s<t;s++)if(s%4){var u=n.indexOf(e.charAt(s-1))<<s%4*2,l=n.indexOf(e.charAt(s))>>>6-s%4*2;i[a>>>2]|=(u|l)<<24-a%4*8,a++}return c.create(i,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},"object"===u(e)?e.exports=l:window.CryptoJS=l}).call(this,n(/*! ./../node_modules/webpack/buildin/module.js */"./node_modules/webpack/buildin/module.js")(e))},"./lib/json2xml.js":
- /*!*************************!*\
- !*** ./lib/json2xml.js ***!
- \*************************/
- /*! no static exports found */function(e,t,n){var r=n(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js"),o="a-zA-Z_À-ÖØ-öø-ÿͰ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�",i=new RegExp("^([^"+o+"])|^((x|X)(m|M)(l|L))|([^"+o+"-.0-9·̀-ͯ‿⁀])","g"),a=/[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm,s=function(e){var t=[];if(e instanceof Object)for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t},c=function(e,t){var n=function(e,n,r,o,a){var s=void 0!==t.indent?t.indent:"\t",c=t.prettyPrint?"\n"+new Array(o).join(s):"";t.removeIllegalNameCharacters&&(e=e.replace(i,"_"));var u=[c,"<",e,r||""];return n&&n.length>0?(u.push(">"),u.push(n),a&&u.push(c),u.push("</"),u.push(e),u.push(">")):u.push("/>"),u.join("")};return function e(o,i,c){var u=r(o);switch((Array.isArray?Array.isArray(o):o instanceof Array)?u="array":o instanceof Date&&(u="date"),u){case"array":var l=[];return o.map((function(t){l.push(e(t,0,c+1))})),t.prettyPrint&&l.push("\n"),l.join("");case"date":return o.toJSON?o.toJSON():o+"";case"object":var d=[];for(var h in o)if(o.hasOwnProperty(h))if(o[h]instanceof Array)for(var p=0;p<o[h].length;p++)o[h].hasOwnProperty(p)&&d.push(n(h,e(o[h][p],0,c+1),null,c+1,s(o[h][p]).length));else d.push(n(h,e(o[h],0,c+1),null,c+1));return t.prettyPrint&&d.length>0&&d.push("\n"),d.join("");case"function":return o();default:return t.escape?(""+o).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(a,""):""+o}}(e,0,0)},u=function(e){var t=['<?xml version="1.0" encoding="UTF-8"'];return e&&t.push(' standalone="yes"'),t.push("?>"),t.join("")};e.exports=function(e,t){if(t||(t={xmlHeader:{standalone:!0},prettyPrint:!0,indent:" ",escape:!0}),"string"==typeof e)try{e=JSON.parse(e.toString())}catch(i){return!1}var n="",o="";return t&&("object"==r(t)?(t.xmlHeader&&(n=u(!!t.xmlHeader.standalone)),void 0!==t.docType&&(o="<!DOCTYPE "+t.docType+">")):n=u()),[n,(t=t||{}).prettyPrint&&o?"\n":"",o,c(e,t)].join("").replace(/\n{2,}/g,"\n").replace(/\s+$/g,"")}},"./lib/md5.js":
- /*!********************!*\
- !*** ./lib/md5.js ***!
- \********************/
- /*! no static exports found */function(module,exports,__webpack_require__){(function(process,global,module){var __WEBPACK_AMD_DEFINE_RESULT__,_typeof=__webpack_require__(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js");(function(){var ERROR="input is invalid type",WINDOW="object"===("undefined"==typeof window?"undefined":_typeof(window)),root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"===("undefined"==typeof self?"undefined":_typeof(self)),NODE_JS=!root.JS_MD5_NO_NODE_JS&&"object"===(void 0===process?"undefined":_typeof(process))&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&"object"===_typeof(module)&&module.exports,AMD=__webpack_require__(/*! !webpack amd options */"./node_modules/webpack/buildin/amd-options.js"),ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}!root.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===_typeof(e)&&e.buffer&&e.buffer.constructor===ArrayBuffer});var createOutputMethod=function(e){return function(t,n){return new Md5(!0).update(t,n)[e]()}},createMethod=function(){var e=createOutputMethod("hex");NODE_JS&&(e=nodeWrap(e)),e.getCtx=e.create=function(){return new Md5},e.update=function(t){return e.create().update(t)};for(var t=0;t<OUTPUT_TYPES.length;++t){var n=OUTPUT_TYPES[t];e[n]=createOutputMethod(n)}return e},nodeWrap=function nodeWrap(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(e){if("string"==typeof e)return crypto.createHash("md5").update(e,"utf8").digest("hex");if(null==e)throw ERROR;return e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),Array.isArray(e)||ArrayBuffer.isView(e)||e.constructor===Buffer?crypto.createHash("md5").update(new Buffer(e)).digest("hex"):method(e)};return nodeMethod};function Md5(e){if(e)blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks,this.buffer8=buffer8;else if(ARRAY_BUFFER){var t=new ArrayBuffer(68);this.buffer8=new Uint8Array(t),this.blocks=new Uint32Array(t)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}Md5.prototype.update=function(e,t){if(!this.finalized){for(var n,r,o=0,i=e.length,a=this.blocks,s=this.buffer8;o<i;){if(this.hashed&&(this.hashed=!1,a[0]=a[16],a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),ARRAY_BUFFER)for(r=this.start;o<i&&r<64;++o)n=e.charCodeAt(o),t||n<128?s[r++]=n:n<2048?(s[r++]=192|n>>6,s[r++]=128|63&n):n<55296||n>=57344?(s[r++]=224|n>>12,s[r++]=128|n>>6&63,s[r++]=128|63&n):(n=65536+((1023&n)<<10|1023&e.charCodeAt(++o)),s[r++]=240|n>>18,s[r++]=128|n>>12&63,s[r++]=128|n>>6&63,s[r++]=128|63&n);else for(r=this.start;o<i&&r<64;++o)n=e.charCodeAt(o),t||n<128?a[r>>2]|=n<<SHIFT[3&r++]:n<2048?(a[r>>2]|=(192|n>>6)<<SHIFT[3&r++],a[r>>2]|=(128|63&n)<<SHIFT[3&r++]):n<55296||n>=57344?(a[r>>2]|=(224|n>>12)<<SHIFT[3&r++],a[r>>2]|=(128|n>>6&63)<<SHIFT[3&r++],a[r>>2]|=(128|63&n)<<SHIFT[3&r++]):(n=65536+((1023&n)<<10|1023&e.charCodeAt(++o)),a[r>>2]|=(240|n>>18)<<SHIFT[3&r++],a[r>>2]|=(128|n>>12&63)<<SHIFT[3&r++],a[r>>2]|=(128|n>>6&63)<<SHIFT[3&r++],a[r>>2]|=(128|63&n)<<SHIFT[3&r++]);this.lastByteIndex=r,this.bytes+=r-this.start,r>=64?(this.start=r-64,this.hash(),this.hashed=!0):this.start=r}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>2]|=EXTRA[3&t],t>=56&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var e,t,n,r,o,i,a=this.blocks;this.first?t=((t=((e=((e=a[0]-680876937)<<7|e>>>25)-271733879<<0)^(n=((n=(-271733879^(r=((r=(-1732584194^2004318071&e)+a[1]-117830708)<<12|r>>>20)+e<<0)&(-271733879^e))+a[2]-1126478375)<<17|n>>>15)+r<<0)&(r^e))+a[3]-1316259209)<<22|t>>>10)+n<<0:(e=this.h0,t=this.h1,n=this.h2,t=((t+=((e=((e+=((r=this.h3)^t&(n^r))+a[0]-680876936)<<7|e>>>25)+t<<0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+a[1]-389564586)<<12|r>>>20)+e<<0)&(e^t))+a[2]+606105819)<<17|n>>>15)+r<<0)&(r^e))+a[3]-1044525330)<<22|t>>>10)+n<<0),t=((t+=((e=((e+=(r^t&(n^r))+a[4]-176418897)<<7|e>>>25)+t<<0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+a[5]+1200080426)<<12|r>>>20)+e<<0)&(e^t))+a[6]-1473231341)<<17|n>>>15)+r<<0)&(r^e))+a[7]-45705983)<<22|t>>>10)+n<<0,t=((t+=((e=((e+=(r^t&(n^r))+a[8]+1770035416)<<7|e>>>25)+t<<0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+a[9]-1958414417)<<12|r>>>20)+e<<0)&(e^t))+a[10]-42063)<<17|n>>>15)+r<<0)&(r^e))+a[11]-1990404162)<<22|t>>>10)+n<<0,t=((t+=((e=((e+=(r^t&(n^r))+a[12]+1804603682)<<7|e>>>25)+t<<0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+a[13]-40341101)<<12|r>>>20)+e<<0)&(e^t))+a[14]-1502002290)<<17|n>>>15)+r<<0)&(r^e))+a[15]+1236535329)<<22|t>>>10)+n<<0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+a[1]-165796510)<<5|e>>>27)+t<<0)^t))+a[6]-1069501632)<<9|r>>>23)+e<<0)^e&((n=((n+=(e^t&(r^e))+a[11]+643717713)<<14|n>>>18)+r<<0)^r))+a[0]-373897302)<<20|t>>>12)+n<<0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+a[5]-701558691)<<5|e>>>27)+t<<0)^t))+a[10]+38016083)<<9|r>>>23)+e<<0)^e&((n=((n+=(e^t&(r^e))+a[15]-660478335)<<14|n>>>18)+r<<0)^r))+a[4]-405537848)<<20|t>>>12)+n<<0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+a[9]+568446438)<<5|e>>>27)+t<<0)^t))+a[14]-1019803690)<<9|r>>>23)+e<<0)^e&((n=((n+=(e^t&(r^e))+a[3]-187363961)<<14|n>>>18)+r<<0)^r))+a[8]+1163531501)<<20|t>>>12)+n<<0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+a[13]-1444681467)<<5|e>>>27)+t<<0)^t))+a[2]-51403784)<<9|r>>>23)+e<<0)^e&((n=((n+=(e^t&(r^e))+a[7]+1735328473)<<14|n>>>18)+r<<0)^r))+a[12]-1926607734)<<20|t>>>12)+n<<0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+a[5]-378558)<<4|e>>>28)+t<<0))+a[8]-2022574463)<<11|r>>>21)+e<<0)^e)^(n=((n+=(i^t)+a[11]+1839030562)<<16|n>>>16)+r<<0))+a[14]-35309556)<<23|t>>>9)+n<<0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+a[1]-1530992060)<<4|e>>>28)+t<<0))+a[4]+1272893353)<<11|r>>>21)+e<<0)^e)^(n=((n+=(i^t)+a[7]-155497632)<<16|n>>>16)+r<<0))+a[10]-1094730640)<<23|t>>>9)+n<<0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+a[13]+681279174)<<4|e>>>28)+t<<0))+a[0]-358537222)<<11|r>>>21)+e<<0)^e)^(n=((n+=(i^t)+a[3]-722521979)<<16|n>>>16)+r<<0))+a[6]+76029189)<<23|t>>>9)+n<<0,t=((t+=((i=(r=((r+=((o=t^n)^(e=((e+=(o^r)+a[9]-640364487)<<4|e>>>28)+t<<0))+a[12]-421815835)<<11|r>>>21)+e<<0)^e)^(n=((n+=(i^t)+a[15]+530742520)<<16|n>>>16)+r<<0))+a[2]-995338651)<<23|t>>>9)+n<<0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+a[0]-198630844)<<6|e>>>26)+t<<0)|~n))+a[7]+1126891415)<<10|r>>>22)+e<<0)^((n=((n+=(e^(r|~t))+a[14]-1416354905)<<15|n>>>17)+r<<0)|~e))+a[5]-57434055)<<21|t>>>11)+n<<0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+a[12]+1700485571)<<6|e>>>26)+t<<0)|~n))+a[3]-1894986606)<<10|r>>>22)+e<<0)^((n=((n+=(e^(r|~t))+a[10]-1051523)<<15|n>>>17)+r<<0)|~e))+a[1]-2054922799)<<21|t>>>11)+n<<0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+a[8]+1873313359)<<6|e>>>26)+t<<0)|~n))+a[15]-30611744)<<10|r>>>22)+e<<0)^((n=((n+=(e^(r|~t))+a[6]-1560198380)<<15|n>>>17)+r<<0)|~e))+a[13]+1309151649)<<21|t>>>11)+n<<0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+a[4]-145523070)<<6|e>>>26)+t<<0)|~n))+a[11]-1120210379)<<10|r>>>22)+e<<0)^((n=((n+=(e^(r|~t))+a[2]+718787259)<<15|n>>>17)+r<<0)|~e))+a[9]-343485551)<<21|t>>>11)+n<<0,this.first?(this.h0=e+1732584193<<0,this.h1=t-271733879<<0,this.h2=n-1732584194<<0,this.h3=r+271733878<<0,this.first=!1):(this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+n<<0,this.h3=this.h3+r<<0)},Md5.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(e){if("hex"===e)return this.hex();this.finalize();var t=this.h0,n=this.h1,r=this.h2,o=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255,255&o,o>>8&255,o>>16&255,o>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var e,t,n,r="",o=this.array(),i=0;i<15;)e=o[i++],t=o[i++],n=o[i++],r+=BASE64_ENCODE_CHAR[e>>>2]+BASE64_ENCODE_CHAR[63&(e<<4|t>>>4)]+BASE64_ENCODE_CHAR[63&(t<<2|n>>>6)]+BASE64_ENCODE_CHAR[63&n];return e=o[i],r+=BASE64_ENCODE_CHAR[e>>>2]+BASE64_ENCODE_CHAR[e<<4&63]+"=="};var exports=createMethod();COMMON_JS?module.exports=exports:(root.md5=exports,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()}).call(this,__webpack_require__(/*! ./../node_modules/process/browser.js */"./node_modules/process/browser.js"),__webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"),__webpack_require__(/*! ./../node_modules/webpack/buildin/module.js */"./node_modules/webpack/buildin/module.js")(module))},"./lib/request.js":
- /*!************************!*\
- !*** ./lib/request.js ***!
- \************************/
- /*! no static exports found */function(e,t,n){var r=n(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js"),o=function(e){switch(r(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},i=function(e,t,n){var r={};return t.getAllResponseHeaders().trim().split("\n").forEach((function(e){if(e){var t=e.indexOf(":"),n=e.substr(0,t).trim().toLowerCase(),o=e.substr(t+1).trim();r[n]=o}})),{error:e,statusCode:t.status,statusMessage:t.statusText,headers:r,body:n}},a=function(e,t){return t||"text"!==t?e.response:e.responseText};e.exports=function(e,t){var n,s,c,u,l=(e.method||"GET").toUpperCase(),d=e.url;if(e.qs){var h=(n=e.qs,s=s||"&",c=c||"=",null===n&&(n=void 0),"object"===r(n)?Object.keys(n).map((function(e){var t=encodeURIComponent(o(e))+c;return Array.isArray(n[e])?n[e].map((function(e){return t+encodeURIComponent(o(e))})).join(s):t+encodeURIComponent(o(n[e]))})).filter(Boolean).join(s):u?encodeURIComponent(o(u))+c+encodeURIComponent(o(n)):"");h&&(d+=(-1===d.indexOf("?")?"?":"&")+h)}var p=new XMLHttpRequest;if(p.open(l,d,!0),p.responseType=e.dataType||"text",e.xhrFields)for(var f in e.xhrFields)p[f]=e.xhrFields[f];var m=e.headers;if(m)for(var g in m)m.hasOwnProperty(g)&&"content-length"!==g.toLowerCase()&&"user-agent"!==g.toLowerCase()&&"origin"!==g.toLowerCase()&&"host"!==g.toLowerCase()&&p.setRequestHeader(g,m[g]);return e.onProgress&&p.upload&&(p.upload.onprogress=e.onProgress),e.onDownloadProgress&&(p.onprogress=e.onDownloadProgress),e.timeout&&(p.timeout=e.timeout),p.ontimeout=function(e){var n=new Error("timeout");t(i(n,p))},p.onload=function(){t(i(null,p,a(p,e.dataType)))},p.onerror=function(n){var r=a(p,e.dataType);if(r)t(i(null,p,r));else{var o=p.statusText;o||0!==p.status||(o=new Error("CORS blocked or network error")),t(i(o,p,r))}},p.send(e.body||""),p}},"./lib/xml2json.js":
- /*!*************************!*\
- !*** ./lib/xml2json.js ***!
- \*************************/
- /*! no static exports found */function(e,t,n){var r=n(/*! @xmldom/xmldom */"./node_modules/@xmldom/xmldom/lib/index.js").DOMParser,o=function(){this.version="1.3.5";var e={mergeCDATA:!0,normalize:!0,stripElemPrefix:!0},t=new RegExp(/(?!xmlns)^.*:/);return this.grokType=function(e){return/^\s*$/.test(e)?null:/^(?:true|false)$/i.test(e)?"true"===e.toLowerCase():isFinite(e)?parseFloat(e):e},this.parseString=function(e,t){if(e){var n=this.stringToXML(e);return n.getElementsByTagName("parsererror").length?null:this.parseXML(n,t)}return null},this.parseXML=function(n,r){for(var i in r)e[i]=r[i];var a={},s=0,c="";if(n.childNodes.length)for(var u,l,d,h=0;h<n.childNodes.length;h++)4===(u=n.childNodes.item(h)).nodeType?e.mergeCDATA&&(c+=u.nodeValue):3===u.nodeType?c+=u.nodeValue:1===u.nodeType&&(0===s&&(a={}),l=e.stripElemPrefix?u.nodeName.replace(t,""):u.nodeName,d=o.parseXML(u),a.hasOwnProperty(l)?(a[l].constructor!==Array&&(a[l]=[a[l]]),a[l].push(d)):(a[l]=d,s++));return Object.keys(a).length||(a=c||""),a},this.xmlToString=function(e){try{return e.xml?e.xml:(new XMLSerializer).serializeToString(e)}catch(t){return null}},this.stringToXML=function(e){try{var t=null;return window.DOMParser?t=(new r).parseFromString(e,"text/xml"):((t=new ActiveXObject("Microsoft.XMLDOM")).async=!1,t.loadXML(e),t)}catch(n){return null}},this}.call({});e.exports=function(e){return o.parseString(e)}},"./node_modules/@babel/runtime/helpers/classCallCheck.js":
- /*!***************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
- \***************************************************************/
- /*! no static exports found */function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},"./node_modules/@babel/runtime/helpers/createClass.js":
- /*!************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
- \************************************************************/
- /*! no static exports found */function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},"./node_modules/@babel/runtime/helpers/typeof.js":
- /*!*******************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
- \*******************************************************/
- /*! no static exports found */function(e,t){function n(t){return e.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,n(t)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},"./node_modules/@xmldom/xmldom/lib/conventions.js":
- /*!********************************************************!*\
- !*** ./node_modules/@xmldom/xmldom/lib/conventions.js ***!
- \********************************************************/
- /*! no static exports found */function(e,t,n){function r(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}var o=r({HTML:"text/html",isHTML:function(e){return e===o.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),i=r({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===i.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});t.assign=function(e,t){if(null===e||"object"!=typeof e)throw new TypeError("target is not an object");for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},t.find=function(e,t,n){if(void 0===n&&(n=Array.prototype),e&&"function"==typeof n.find)return n.find.call(e,t);for(var r=0;r<e.length;r++)if(Object.prototype.hasOwnProperty.call(e,r)){var o=e[r];if(t.call(void 0,o,r,e))return o}},t.freeze=r,t.MIME_TYPE=o,t.NAMESPACE=i},"./node_modules/@xmldom/xmldom/lib/dom-parser.js":
- /*!*******************************************************!*\
- !*** ./node_modules/@xmldom/xmldom/lib/dom-parser.js ***!
- \*******************************************************/
- /*! no static exports found */function(e,t,n){var r=n(/*! ./conventions */"./node_modules/@xmldom/xmldom/lib/conventions.js"),o=n(/*! ./dom */"./node_modules/@xmldom/xmldom/lib/dom.js"),i=n(/*! ./entities */"./node_modules/@xmldom/xmldom/lib/entities.js"),a=n(/*! ./sax */"./node_modules/@xmldom/xmldom/lib/sax.js"),s=o.DOMImplementation,c=r.NAMESPACE,u=a.ParseError,l=a.XMLReader;function d(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function h(e){this.options=e||{locator:{}}}function p(){this.cdata=!1}function f(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function m(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function g(e,t,n){return"string"==typeof e?e.substr(t,n):e.length>=t+n||t?new java.lang.String(e,t,n)+"":e}function y(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}h.prototype.parseFromString=function(e,t){var n=this.options,r=new l,o=n.domBuilder||new p,a=n.errorHandler,s=n.locator,u=n.xmlns||{},h=/\/x?html?$/.test(t),f=h?i.HTML_ENTITIES:i.XML_ENTITIES;s&&o.setDocumentLocator(s),r.errorHandler=function(e,t,n){if(!e){if(t instanceof p)return t;e=t}var r={},o=e instanceof Function;function i(t){var i=e[t];!i&&o&&(i=2==e.length?function(n){e(t,n)}:e),r[t]=i&&function(e){i("[xmldom "+t+"]\t"+e+m(n))}||function(){}}return n=n||{},i("warning"),i("error"),i("fatalError"),r}(a,o,s),r.domBuilder=n.domBuilder||o,h&&(u[""]=c.HTML),u.xml=u.xml||c.XML;var g=n.normalizeLineEndings||d;return e&&"string"==typeof e?r.parse(g(e),u,f):r.errorHandler.error("invalid doc source"),o.doc},p.prototype={startDocument:function(){this.doc=(new s).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,r){var o=this.doc,i=o.createElementNS(e,n||t),a=r.length;y(this,i),this.currentElement=i,this.locator&&f(this.locator,i);for(var s=0;s<a;s++){e=r.getURI(s);var c=r.getValue(s),u=(n=r.getQName(s),o.createAttributeNS(e,n));this.locator&&f(r.getLocator(s),u),u.value=u.nodeValue=c,i.setAttributeNode(u)}},endElement:function(e,t,n){var r=this.currentElement;r.tagName,this.currentElement=r.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var n=this.doc.createProcessingInstruction(e,t);this.locator&&f(this.locator,n),y(this,n)},ignorableWhitespace:function(e,t,n){},characters:function(e,t,n){if(e=g.apply(this,arguments)){if(this.cdata)var r=this.doc.createCDATASection(e);else r=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(e)&&this.doc.appendChild(r),this.locator&&f(this.locator,r)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,n){e=g.apply(this,arguments);var r=this.doc.createComment(e);this.locator&&f(this.locator,r),y(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,n){var r=this.doc.implementation;if(r&&r.createDocumentType){var o=r.createDocumentType(e,t,n);this.locator&&f(this.locator,o),y(this,o),this.doc.doctype=o}},warning:function(e){console.warn("[xmldom warning]\t"+e,m(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,m(this.locator))},fatalError:function(e){throw new u(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){p.prototype[e]=function(){return null}})),t.__DOMHandler=p,t.normalizeLineEndings=d,t.DOMParser=h},"./node_modules/@xmldom/xmldom/lib/dom.js":
- /*!************************************************!*\
- !*** ./node_modules/@xmldom/xmldom/lib/dom.js ***!
- \************************************************/
- /*! no static exports found */function(e,t,n){var r=n(/*! ./conventions */"./node_modules/@xmldom/xmldom/lib/conventions.js"),o=r.find,i=r.NAMESPACE;function a(e){return""!==e}function s(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function c(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(a):[]}(e);return Object.keys(t.reduce(s,{}))}function u(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}function l(e,t){var n=e.prototype;if(!(n instanceof t)){function r(){}r.prototype=t.prototype,u(n,r=new r),e.prototype=n=r}n.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),n.constructor=e)}var d={},h=d.ELEMENT_NODE=1,p=d.ATTRIBUTE_NODE=2,f=d.TEXT_NODE=3,m=d.CDATA_SECTION_NODE=4,g=d.ENTITY_REFERENCE_NODE=5,y=d.ENTITY_NODE=6,v=d.PROCESSING_INSTRUCTION_NODE=7,C=d.COMMENT_NODE=8,b=d.DOCUMENT_NODE=9,S=d.DOCUMENT_TYPE_NODE=10,E=d.DOCUMENT_FRAGMENT_NODE=11,T=d.NOTATION_NODE=12,k={},w={};k.INDEX_SIZE_ERR=(w[1]="Index size error",1),k.DOMSTRING_SIZE_ERR=(w[2]="DOMString size error",2);var A=k.HIERARCHY_REQUEST_ERR=(w[3]="Hierarchy request error",3);k.WRONG_DOCUMENT_ERR=(w[4]="Wrong document",4),k.INVALID_CHARACTER_ERR=(w[5]="Invalid character",5),k.NO_DATA_ALLOWED_ERR=(w[6]="No data allowed",6),k.NO_MODIFICATION_ALLOWED_ERR=(w[7]="No modification allowed",7);var x=k.NOT_FOUND_ERR=(w[8]="Not found",8);k.NOT_SUPPORTED_ERR=(w[9]="Not supported",9);var _=k.INUSE_ATTRIBUTE_ERR=(w[10]="Attribute in use",10);function O(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,w[e]),this.message=w[e],Error.captureStackTrace&&Error.captureStackTrace(this,O);return n.code=e,t&&(this.message=this.message+": "+t),n}function N(){}function R(e,t){this._node=e,this._refresh=t,I(this)}function I(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var n=e._refresh(e._node);Ce(e,"length",n.length),u(n,e),e._inc=t}}function D(){}function B(e,t){for(var n=e.length;n--;)if(e[n]===t)return n}function P(e,t,n,r){if(r?t[B(t,r)]=n:t[t.length++]=n,e){n.ownerElement=e;var o=e.ownerDocument;o&&(r&&z(o,e,r),function(e,t,n){e&&e._inc++;var r=n.namespaceURI;r===i.XMLNS&&(t._nsMap[n.prefix?n.localName:""]=n.value)}(o,e,n))}}function M(e,t,n){var r=B(t,n);if(!(r>=0))throw new O(x,new Error(e.tagName+"@"+n));for(var o=t.length-1;r<o;)t[r]=t[++r];if(t.length=o,e){var i=e.ownerDocument;i&&(z(i,e,n),n.ownerElement=null)}}function U(){}function L(){}function H(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function j(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(j(e,t))return!0}while(e=e.nextSibling)}function F(){this.ownerDocument=this}function z(e,t,n,r){e&&e._inc++,n.namespaceURI===i.XMLNS&&delete t._nsMap[n.prefix?n.localName:""]}function K(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n)r[r.length++]=n;else{for(var o=t.firstChild,i=0;o;)r[i++]=o,o=o.nextSibling;r.length=i,delete r[r.length]}}}function V(e,t){var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,K(e.ownerDocument,e),t}function q(e){return e&&e.nodeType===L.DOCUMENT_TYPE_NODE}function W(e){return e&&e.nodeType===L.ELEMENT_NODE}function G(e){return e&&e.nodeType===L.TEXT_NODE}function X(e,t){var n=e.childNodes||[];if(o(n,W)||q(t))return!1;var r=o(n,q);return!(t&&r&&n.indexOf(r)>n.indexOf(t))}function Y(e,t){var n=e.childNodes||[];if(o(n,(function(e){return W(e)&&e!==t})))return!1;var r=o(n,q);return!(t&&r&&n.indexOf(r)>n.indexOf(t))}function Q(e,t,n){if(!function(e){return e&&(e.nodeType===L.DOCUMENT_NODE||e.nodeType===L.DOCUMENT_FRAGMENT_NODE||e.nodeType===L.ELEMENT_NODE)}(e))throw new O(A,"Unexpected parent node type "+e.nodeType);if(n&&n.parentNode!==e)throw new O(x,"child not in parent");if(!function(e){return e&&(W(e)||G(e)||q(e)||e.nodeType===L.DOCUMENT_FRAGMENT_NODE||e.nodeType===L.COMMENT_NODE||e.nodeType===L.PROCESSING_INSTRUCTION_NODE)}(t)||q(t)&&e.nodeType!==L.DOCUMENT_NODE)throw new O(A,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function J(e,t,n){var r=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===L.DOCUMENT_FRAGMENT_NODE){var a=i.filter(W);if(a.length>1||o(i,G))throw new O(A,"More than one element or text in fragment");if(1===a.length&&!X(e,n))throw new O(A,"Element in fragment can not be inserted before doctype")}if(W(t)&&!X(e,n))throw new O(A,"Only one element can be added and only after doctype");if(q(t)){if(o(r,q))throw new O(A,"Only one doctype is allowed");var s=o(r,W);if(n&&r.indexOf(s)<r.indexOf(n))throw new O(A,"Doctype can only be inserted before an element");if(!n&&s)throw new O(A,"Doctype can not be appended since element is present")}}function $(e,t,n){var r=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===L.DOCUMENT_FRAGMENT_NODE){var a=i.filter(W);if(a.length>1||o(i,G))throw new O(A,"More than one element or text in fragment");if(1===a.length&&!Y(e,n))throw new O(A,"Element in fragment can not be inserted before doctype")}if(W(t)&&!Y(e,n))throw new O(A,"Only one element can be added and only after doctype");if(q(t)){function c(e){return q(e)&&e!==n}if(o(r,c))throw new O(A,"Only one doctype is allowed");var s=o(r,W);if(n&&r.indexOf(s)<r.indexOf(n))throw new O(A,"Doctype can only be inserted before an element")}}function Z(e,t,n,r){Q(e,t,n),e.nodeType===L.DOCUMENT_NODE&&(r||J)(e,t,n);var o=t.parentNode;if(o&&o.removeChild(t),t.nodeType===E){var i=t.firstChild;if(null==i)return t;var a=t.lastChild}else i=a=t;var s=n?n.previousSibling:e.lastChild;i.previousSibling=s,a.nextSibling=n,s?s.nextSibling=i:e.firstChild=i,null==n?e.lastChild=a:n.previousSibling=a;do{i.parentNode=e}while(i!==a&&(i=i.nextSibling));return K(e.ownerDocument||e,e),t.nodeType==E&&(t.firstChild=t.lastChild=null),t}function ee(){this._nsMap={}}function te(){}function ne(){}function re(){}function oe(){}function ie(){}function ae(){}function se(){}function ce(){}function ue(){}function le(){}function de(){}function he(){}function pe(e,t){var n=[],r=9==this.nodeType&&this.documentElement||this,o=r.prefix,i=r.namespaceURI;if(i&&null==o&&null==(o=r.lookupPrefix(i)))var a=[{namespace:i,prefix:null}];return ge(this,n,e,t,a),n.join("")}function fe(e,t,n){var r=e.prefix||"",o=e.namespaceURI;if(!o)return!1;if("xml"===r&&o===i.XML||o===i.XMLNS)return!1;for(var a=n.length;a--;){var s=n[a];if(s.prefix===r)return s.namespace!==o}return!0}function me(e,t,n){e.push(" ",t,'="',n.replace(/[<>&"\t\n\r]/g,H),'"')}function ge(e,t,n,r,o){if(o||(o=[]),r){if(!(e=r(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case h:var a=e.attributes,s=a.length,c=e.firstChild,u=e.tagName,l=u;if(!(n=i.isHTML(e.namespaceURI)||n)&&!e.prefix&&e.namespaceURI){for(var d,y=0;y<a.length;y++)if("xmlns"===a.item(y).name){d=a.item(y).value;break}if(!d)for(var T=o.length-1;T>=0;T--)if(""===(k=o[T]).prefix&&k.namespace===e.namespaceURI){d=k.namespace;break}if(d!==e.namespaceURI)for(T=o.length-1;T>=0;T--){var k;if((k=o[T]).namespace===e.namespaceURI){k.prefix&&(l=k.prefix+":"+u);break}}}t.push("<",l);for(var w=0;w<s;w++)"xmlns"==(A=a.item(w)).prefix?o.push({prefix:A.localName,namespace:A.value}):"xmlns"==A.nodeName&&o.push({prefix:"",namespace:A.value});for(w=0;w<s;w++){var A,x,_;fe(A=a.item(w),0,o)&&(me(t,(x=A.prefix||"")?"xmlns:"+x:"xmlns",_=A.namespaceURI),o.push({prefix:x,namespace:_})),ge(A,t,n,r,o)}if(u===l&&fe(e,0,o)&&(me(t,(x=e.prefix||"")?"xmlns:"+x:"xmlns",_=e.namespaceURI),o.push({prefix:x,namespace:_})),c||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(u)){if(t.push(">"),n&&/^script$/i.test(u))for(;c;)c.data?t.push(c.data):ge(c,t,n,r,o.slice()),c=c.nextSibling;else for(;c;)ge(c,t,n,r,o.slice()),c=c.nextSibling;t.push("</",l,">")}else t.push("/>");return;case b:case E:for(c=e.firstChild;c;)ge(c,t,n,r,o.slice()),c=c.nextSibling;return;case p:return me(t,e.name,e.value);case f:return t.push(e.data.replace(/[<&>]/g,H));case m:return t.push("<![CDATA[",e.data,"]]>");case C:return t.push("\x3c!--",e.data,"--\x3e");case S:var O=e.publicId,N=e.systemId;if(t.push("<!DOCTYPE ",e.name),O)t.push(" PUBLIC ",O),N&&"."!=N&&t.push(" ",N),t.push(">");else if(N&&"."!=N)t.push(" SYSTEM ",N,">");else{var R=e.internalSubset;R&&t.push(" [",R,"]"),t.push(">")}return;case v:return t.push("<?",e.target," ",e.data,"?>");case g:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function ye(e,t,n){var r;switch(t.nodeType){case h:(r=t.cloneNode(!1)).ownerDocument=e;case E:break;case p:n=!0}if(r||(r=t.cloneNode(!1)),r.ownerDocument=e,r.parentNode=null,n)for(var o=t.firstChild;o;)r.appendChild(ye(e,o,n)),o=o.nextSibling;return r}function ve(e,t,n){var r=new t.constructor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var i=t[o];"object"!=typeof i&&i!=r[o]&&(r[o]=i)}switch(t.childNodes&&(r.childNodes=new N),r.ownerDocument=e,r.nodeType){case h:var a=t.attributes,s=r.attributes=new D,c=a.length;s._ownerElement=r;for(var u=0;u<c;u++)r.setAttributeNode(ve(e,a.item(u),!0));break;case p:n=!0}if(n)for(var l=t.firstChild;l;)r.appendChild(ve(e,l,n)),l=l.nextSibling;return r}function Ce(e,t,n){e[t]=n}k.INVALID_STATE_ERR=(w[11]="Invalid state",11),k.SYNTAX_ERR=(w[12]="Syntax error",12),k.INVALID_MODIFICATION_ERR=(w[13]="Invalid modification",13),k.NAMESPACE_ERR=(w[14]="Invalid namespace",14),k.INVALID_ACCESS_ERR=(w[15]="Invalid access",15),O.prototype=Error.prototype,u(k,O),N.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var n=[],r=0;r<this.length;r++)ge(this[r],n,e,t);return n.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},R.prototype.item=function(e){return I(this),this[e]},l(R,N),D.prototype={length:0,item:N.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var n=this[t];if(n.nodeName==e)return n}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new O(_);var n=this.getNamedItem(e.nodeName);return P(this._ownerElement,this,e,n),n},setNamedItemNS:function(e){var t,n=e.ownerElement;if(n&&n!=this._ownerElement)throw new O(_);return t=this.getNamedItemNS(e.namespaceURI,e.localName),P(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return M(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var n=this.getNamedItemNS(e,t);return M(this._ownerElement,this,n),n},getNamedItemNS:function(e,t){for(var n=this.length;n--;){var r=this[n];if(r.localName==t&&r.namespaceURI==e)return r}return null}},U.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,n){var r=new F;if(r.implementation=this,r.childNodes=new N,r.doctype=n||null,n&&r.appendChild(n),t){var o=r.createElementNS(e,t);r.appendChild(o)}return r},createDocumentType:function(e,t,n){var r=new ae;return r.name=e,r.nodeName=e,r.publicId=t||"",r.systemId=n||"",r}},L.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return Z(this,e,t)},replaceChild:function(e,t){Z(this,e,t,$),t&&this.removeChild(t)},removeChild:function(e){return V(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return ve(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==f&&e.nodeType==f?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n)for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)&&n[r]===e)return r;t=t.nodeType==p?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&Object.prototype.hasOwnProperty.call(n,e))return n[e];t=t.nodeType==p?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},u(d,L),u(d,L.prototype),F.prototype={nodeName:"#document",nodeType:b,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==E){for(var n=e.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,t),n=r}return e}return Z(this,e,t),e.ownerDocument=this,null===this.documentElement&&e.nodeType===h&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),V(this,e)},replaceChild:function(e,t){Z(this,e,t,$),e.ownerDocument=this,t&&this.removeChild(t),W(e)&&(this.documentElement=e)},importNode:function(e,t){return ye(this,e,t)},getElementById:function(e){var t=null;return j(this.documentElement,(function(n){if(n.nodeType==h&&n.getAttribute("id")==e)return t=n,!0})),t},getElementsByClassName:function(e){var t=c(e);return new R(this,(function(n){var r=[];return t.length>0&&j(n.documentElement,(function(o){if(o!==n&&o.nodeType===h){var i=o.getAttribute("class");if(i){var a=e===i;if(!a){var s=c(i);a=t.every((u=s,function(e){return u&&-1!==u.indexOf(e)}))}a&&r.push(o)}}var u})),r}))},createElement:function(e){var t=new ee;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new N,(t.attributes=new D)._ownerElement=t,t},createDocumentFragment:function(){var e=new le;return e.ownerDocument=this,e.childNodes=new N,e},createTextNode:function(e){var t=new re;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new oe;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new ie;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new de;return n.ownerDocument=this,n.tagName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new te;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new ue;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new ee,r=t.split(":"),o=n.attributes=new D;return n.childNodes=new N,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,o._ownerElement=n,n},createAttributeNS:function(e,t){var n=new te,r=t.split(":");return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,n}},l(F,L),ee.prototype={nodeType:h,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===E?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,K(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||""},setAttributeNS:function(e,t,n){var r=this.ownerDocument.createAttributeNS(e,t);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new R(this,(function(t){var n=[];return j(t,(function(r){r===t||r.nodeType!=h||"*"!==e&&r.tagName!=e||n.push(r)})),n}))},getElementsByTagNameNS:function(e,t){return new R(this,(function(n){var r=[];return j(n,(function(o){o===n||o.nodeType!==h||"*"!==e&&o.namespaceURI!==e||"*"!==t&&o.localName!=t||r.push(o)})),r}))}},F.prototype.getElementsByTagName=ee.prototype.getElementsByTagName,F.prototype.getElementsByTagNameNS=ee.prototype.getElementsByTagNameNS,l(ee,L),te.prototype.nodeType=p,l(te,L),ne.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(w[A])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,n){n=this.data.substring(0,e)+n+this.data.substring(e+t),this.nodeValue=this.data=n,this.length=n.length}},l(ne,L),re.prototype={nodeName:"#text",nodeType:f,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},l(re,ne),oe.prototype={nodeName:"#comment",nodeType:C},l(oe,ne),ie.prototype={nodeName:"#cdata-section",nodeType:m},l(ie,ne),ae.prototype.nodeType=S,l(ae,L),se.prototype.nodeType=T,l(se,L),ce.prototype.nodeType=y,l(ce,L),ue.prototype.nodeType=g,l(ue,L),le.prototype.nodeName="#document-fragment",le.prototype.nodeType=E,l(le,L),de.prototype.nodeType=v,l(de,L),he.prototype.serializeToString=function(e,t,n){return pe.call(e,t,n)},L.prototype.toString=pe;try{if(Object.defineProperty){function Se(e){switch(e.nodeType){case h:case E:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(Se(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(R.prototype,"length",{get:function(){return I(this),this.$$length}}),Object.defineProperty(L.prototype,"textContent",{get:function(){return Se(this)},set:function(e){switch(this.nodeType){case h:case E:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),Ce=function(e,t,n){e["$$"+t]=n}}}catch(be){}t.DocumentType=ae,t.DOMException=O,t.DOMImplementation=U,t.Element=ee,t.Node=L,t.NodeList=N,t.XMLSerializer=he},"./node_modules/@xmldom/xmldom/lib/entities.js":
- /*!*****************************************************!*\
- !*** ./node_modules/@xmldom/xmldom/lib/entities.js ***!
- \*****************************************************/
- /*! no static exports found */function(e,t,n){var r=n(/*! ./conventions */"./node_modules/@xmldom/xmldom/lib/conventions.js").freeze;t.XML_ENTITIES=r({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=r({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),t.entityMap=t.HTML_ENTITIES},"./node_modules/@xmldom/xmldom/lib/index.js":
- /*!**************************************************!*\
- !*** ./node_modules/@xmldom/xmldom/lib/index.js ***!
- \**************************************************/
- /*! no static exports found */function(e,t,n){var r=n(/*! ./dom */"./node_modules/@xmldom/xmldom/lib/dom.js");t.DOMImplementation=r.DOMImplementation,t.XMLSerializer=r.XMLSerializer,t.DOMParser=n(/*! ./dom-parser */"./node_modules/@xmldom/xmldom/lib/dom-parser.js").DOMParser},"./node_modules/@xmldom/xmldom/lib/sax.js":
- /*!************************************************!*\
- !*** ./node_modules/@xmldom/xmldom/lib/sax.js ***!
- \************************************************/
- /*! no static exports found */function(e,t,n){var r=n(/*! ./conventions */"./node_modules/@xmldom/xmldom/lib/conventions.js").NAMESPACE,o=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,i=new RegExp("[\\-\\.0-9"+o.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),a=new RegExp("^"+o.source+i.source+"*(?::"+o.source+i.source+"*)?$"),s=0,c=1,u=2,l=3,d=4,h=5,p=6,f=7;function m(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,m)}function g(){}function y(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function v(e,t,n,o,i,a){function m(e,t,r){n.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),n.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),r)}for(var g,y=++t,v=s;;){var C=e.charAt(y);switch(C){case"=":if(v===c)g=e.slice(t,y),v=l;else{if(v!==u)throw new Error("attribute equal must after attrName");v=l}break;case"'":case'"':if(v===l||v===c){if(v===c&&(a.warning('attribute value must after "="'),g=e.slice(t,y)),t=y+1,!((y=e.indexOf(C,t))>0))throw new Error("attribute value no end '"+C+"' match");m(g,b=e.slice(t,y),t-1),v=h}else{if(v!=d)throw new Error('attribute value must after "="');m(g,b=e.slice(t,y),t),a.warning('attribute "'+g+'" missed start quot('+C+")!!"),t=y+1,v=h}break;case"/":switch(v){case s:n.setTagName(e.slice(t,y));case h:case p:case f:v=f,n.closed=!0;case d:case c:case u:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),v==s&&n.setTagName(e.slice(t,y)),y;case">":switch(v){case s:n.setTagName(e.slice(t,y));case h:case p:case f:break;case d:case c:"/"===(b=e.slice(t,y)).slice(-1)&&(n.closed=!0,b=b.slice(0,-1));case u:v===u&&(b=g),v==d?(a.warning('attribute "'+b+'" missed quot(")!'),m(g,b,t)):(r.isHTML(o[""])&&b.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+b+'" missed value!! "'+b+'" instead!!'),m(b,b,t));break;case l:throw new Error("attribute value missed!!")}return y;case"":C=" ";default:if(C<=" ")switch(v){case s:n.setTagName(e.slice(t,y)),v=p;break;case c:g=e.slice(t,y),v=u;break;case d:var b=e.slice(t,y);a.warning('attribute "'+b+'" missed quot(")!!'),m(g,b,t);case h:v=p}else switch(v){case u:n.tagName,r.isHTML(o[""])&&g.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+g+'" missed value!! "'+g+'" instead2!!'),m(g,g,t),t=y,v=c;break;case h:a.warning('attribute space is required"'+g+'"!!');case p:v=c,t=y;break;case l:v=d,t=y;break;case f:throw new Error("elements closed character '/' and '>' must be connected to")}}y++}}function C(e,t,n){for(var o=e.tagName,i=null,a=e.length;a--;){var s=e[a],c=s.qName,u=s.value;if((p=c.indexOf(":"))>0)var l=s.prefix=c.slice(0,p),d=c.slice(p+1),h="xmlns"===l&&d;else d=c,l=null,h="xmlns"===c&&"";s.localName=d,!1!==h&&(null==i&&(i={},E(n,n={})),n[h]=i[h]=u,s.uri=r.XMLNS,t.startPrefixMapping(h,u))}for(a=e.length;a--;)(l=(s=e[a]).prefix)&&("xml"===l&&(s.uri=r.XML),"xmlns"!==l&&(s.uri=n[l||""]));var p;(p=o.indexOf(":"))>0?(l=e.prefix=o.slice(0,p),d=e.localName=o.slice(p+1)):(l=null,d=e.localName=o);var f=e.uri=n[l||""];if(t.startElement(f,d,o,e),!e.closed)return e.currentNSMap=n,e.localNSMap=i,!0;if(t.endElement(f,d,o),i)for(l in i)Object.prototype.hasOwnProperty.call(i,l)&&t.endPrefixMapping(l)}function b(e,t,n,r,o){if(/^(?:script|textarea)$/i.test(n)){var i=e.indexOf("</"+n+">",t),a=e.substring(t+1,i);if(/[&<]/.test(a))return/^script$/i.test(n)?(o.characters(a,0,a.length),i):(a=a.replace(/&#?\w+;/g,r),o.characters(a,0,a.length),i)}return t+1}function S(e,t,n,r){var o=r[n];return null==o&&((o=e.lastIndexOf("</"+n+">"))<t&&(o=e.lastIndexOf("</"+n)),r[n]=o),o<t}function E(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}function T(e,t,n,r){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(o=e.indexOf("--\x3e",t+4))>t?(n.comment(e,t+4,o-t-4),o+3):(r.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var o=e.indexOf("]]>",t+9);return n.startCDATA(),n.characters(e,t+9,o-t-9),n.endCDATA(),o+3}var i=function(e,t){var n,r=[],o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(o.lastIndex=t,o.exec(e);n=o.exec(e);)if(r.push(n),n[1])return r}(e,t),a=i.length;if(a>1&&/!doctype/i.test(i[0][0])){var s=i[1][0],c=!1,u=!1;a>3&&(/^public$/i.test(i[2][0])?(c=i[3][0],u=a>4&&i[4][0]):/^system$/i.test(i[2][0])&&(u=i[3][0]));var l=i[a-1];return n.startDTD(s,c,u),n.endDTD(),l.index+l[0].length}return-1}function k(e,t,n){var r=e.indexOf("?>",t);if(r){var o=e.substring(t,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return o?(o[0].length,n.processingInstruction(o[1],o[2]),r+2):-1}return-1}function w(){this.attributeNames={}}m.prototype=new Error,m.prototype.name=m.name,g.prototype={parse:function(e,t,n){var o=this.domBuilder;o.startDocument(),E(t,t={}),function(e,t,n,o,i){function a(e){if(e>65535){var t=55296+((e-=65536)>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function s(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(n,t)?n[t]:"#"===t.charAt(0)?a(parseInt(t.substr(1).replace("x","0x"))):(i.error("entity not found:"+e),e)}function c(t){if(t>E){var n=e.substring(E,t).replace(/&#?\w+;/g,s);p&&u(E),o.characters(n,0,t-E),E=t}}function u(t,n){for(;t>=d&&(n=h.exec(e));)l=n.index,d=l+n[0].length,p.lineNumber++;p.columnNumber=t-l+1}for(var l=0,d=0,h=/.*(?:\r\n?|\n)|.*$/g,p=o.locator,f=[{currentNSMap:t}],g={},E=0;;){try{var A=e.indexOf("<",E);if(A<0){if(!e.substr(E).match(/^\s*$/)){var x=o.doc,_=x.createTextNode(e.substr(E));x.appendChild(_),o.currentElement=_}return}switch(A>E&&c(A),e.charAt(A+1)){case"/":var O=e.indexOf(">",A+3),N=e.substring(A+2,O).replace(/[ \t\n\r]+$/g,""),R=f.pop();O<0?(N=e.substring(A+2).replace(/[\s<].*/,""),i.error("end tag name: "+N+" is not complete:"+R.tagName),O=A+1+N.length):N.match(/\s</)&&(N=N.replace(/[\s<].*/,""),i.error("end tag name: "+N+" maybe not complete"),O=A+1+N.length);var I=R.localNSMap,D=R.tagName==N;if(D||R.tagName&&R.tagName.toLowerCase()==N.toLowerCase()){if(o.endElement(R.uri,R.localName,N),I)for(var B in I)Object.prototype.hasOwnProperty.call(I,B)&&o.endPrefixMapping(B);D||i.fatalError("end tag name: "+N+" is not match the current start tagName:"+R.tagName)}else f.push(R);O++;break;case"?":p&&u(A),O=k(e,A,o);break;case"!":p&&u(A),O=T(e,A,o,i);break;default:p&&u(A);var P=new w,M=f[f.length-1].currentNSMap,U=(O=v(e,A,P,M,s,i),P.length);if(!P.closed&&S(e,O,P.tagName,g)&&(P.closed=!0,n.nbsp||i.warning("unclosed xml attribute")),p&&U){for(var L=y(p,{}),H=0;H<U;H++){var j=P[H];u(j.offset),j.locator=y(p,{})}o.locator=L,C(P,o,M)&&f.push(P),o.locator=p}else C(P,o,M)&&f.push(P);r.isHTML(P.uri)&&!P.closed?O=b(e,O,P.tagName,s,o):O++}}catch(F){if(F instanceof m)throw F;i.error("element parse error: "+F),O=-1}O>E?E=O:c(Math.max(A,E)+1)}}(e,t,n,o,this.errorHandler),o.endDocument()}},w.prototype={setTagName:function(e){if(!a.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,n){if(!a.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},t.XMLReader=g,t.ParseError=m},"./node_modules/process/browser.js":
- /*!*****************************************!*\
- !*** ./node_modules/process/browser.js ***!
- \*****************************************/
- /*! no static exports found */function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c,u=[],l=!1,d=-1;function h(){l&&c&&(l=!1,c.length?u=c.concat(u):d=-1,u.length&&p())}function p(){if(!l){var e=s(h);l=!0;for(var t=u.length;t;){for(c=u,u=[];++d<t;)c&&c[d].run();d=-1,t=u.length}c=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new f(e,t)),1!==u.length||l||s(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},"./node_modules/webpack/buildin/amd-options.js":
- /*!****************************************!*\
- !*** (webpack)/buildin/amd-options.js ***!
- \****************************************/
- /*! no static exports found */function(e,t){(function(t){e.exports=t}).call(this,{})},"./node_modules/webpack/buildin/global.js":
- /*!***********************************!*\
- !*** (webpack)/buildin/global.js ***!
- \***********************************/
- /*! no static exports found */function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(r){"object"==typeof window&&(n=window)}e.exports=n},"./node_modules/webpack/buildin/module.js":
- /*!***********************************!*\
- !*** (webpack)/buildin/module.js ***!
- \***********************************/
- /*! no static exports found */function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},"./package.json":
- /*!**********************!*\
- !*** ./package.json ***!
- \**********************/
- /*! exports provided: name, version, description, main, types, scripts, repository, keywords, author, license, bugs, homepage, dependencies, devDependencies, default */function(e){e.exports=JSON.parse('{"name":"cos-js-sdk-v5","version":"1.4.20","description":"JavaScript SDK for [腾讯云对象存储](https://cloud.tencent.com/product/cos)","main":"dist/cos-js-sdk-v5.js","types":"index.d.ts","scripts":{"prettier":"prettier --write src demo/demo.js test/test.js server/sts.js index.d.ts","server":"node server/sts.js","dev":"cross-env NODE_ENV=development webpack -w --mode=development","build":"cross-env NODE_ENV=production webpack --mode=production","cos-auth.min.js":"uglifyjs ./demo/common/cos-auth.js -o ./demo/common/cos-auth.min.js -c -m","test":"jest --runInBand --coverage"},"repository":{"type":"git","url":"git+https://github.com/tencentyun/cos-js-sdk-v5.git"},"keywords":[],"author":"carsonxu","license":"ISC","bugs":{"url":"https://github.com/tencentyun/cos-js-sdk-v5/issues"},"homepage":"https://github.com/tencentyun/cos-js-sdk-v5#readme","dependencies":{"@xmldom/xmldom":"^0.8.6"},"devDependencies":{"@babel/core":"7.17.9","@babel/plugin-transform-runtime":"7.18.10","@babel/preset-env":"7.16.11","babel-loader":"8.2.5","body-parser":"^1.18.3","cross-env":"^5.2.0","express":"^4.16.4","jest":"^29.3.1","jest-environment-jsdom":"^29.3.1","prettier":"^3.0.1","qcloud-cos-sts":"^3.0.2","request":"^2.87.0","terser-webpack-plugin":"4.2.3","uglifyjs":"^2.4.11","webpack":"4.46.0","webpack-cli":"4.10.0"}}')},"./src/advance.js":
- /*!************************!*\
- !*** ./src/advance.js ***!
- \************************/
- /*! no static exports found */function(e,t,n){var r=n(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js"),o=n(/*! ./session */"./src/session.js"),i=n(/*! ./async */"./src/async.js"),a=n(/*! ./event */"./src/event.js").EventProxy,s=n(/*! ./util */"./src/util.js"),c=n(/*! ./tracker */"./src/tracker.js");function u(e,t){var n=e.TaskId,r=e.Bucket,c=e.Region,u=e.Key,h=e.StorageClass,p=this,f={},m=e.FileSize,g=e.SliceSize,y=Math.ceil(m/g),v=0,C=s.throttleOnProgress.call(p,m,e.onHashProgress),b=function(t,n){var r=t.length;return 0===r?n(null,!0):r>y||r>1&&Math.max(t[0].Size,t[1].Size)!==g?n(null,!1):void function o(i){if(i<r){var a=t[i];!function(t,n){var r=g*(t-1),o=Math.min(r+g,m),i=o-r;f[t]?n(null,{PartNumber:t,ETag:f[t],Size:i}):s.fileSlice(e.Body,r,o,!1,(function(e){s.getFileMd5(e,(function(e,r){if(e)return n(s.error(e));var o='"'+r+'"';f[t]=o,C({loaded:v+=i,total:m}),n(null,{PartNumber:t,ETag:o,Size:i})}))}))}(a.PartNumber,(function(e,t){t&&t.ETag===a.ETag&&t.Size===a.Size?o(i+1):n(null,!1)}))}else n(null,!0)}(0)},S=new a;S.on("error",(function(e){if(p._isRunningTask(n))return t(e)})),S.on("upload_id_available",(function(e){var n={},r=[];s.each(e.PartList,(function(e){n[e.PartNumber]=e}));for(var o=1;o<=y;o++){var i=n[o];i?(i.PartNumber=o,i.Uploaded=!0):i={PartNumber:o,ETag:null,Uploaded:!1},r.push(i)}e.PartList=r,t(null,e)})),S.on("no_available_upload_id",(function(){if(p._isRunningTask(n)){var o=s.extend({Bucket:r,Region:c,Key:u,Query:s.clone(e.Query),StorageClass:h,Body:e.Body,calledBySdk:"sliceUploadFile",tracker:e.tracker},e),i=s.clone(e.Headers);delete i["x-cos-mime-limit"],o.Headers=i,p.multipartInit(o,(function(e,r){if(p._isRunningTask(n)){if(e)return S.emit("error",e);var o=r.UploadId;if(!o)return t(s.error(new Error("no such upload id")));S.emit("upload_id_available",{UploadId:o,PartList:[]})}}))}})),S.on("has_and_check_upload_id",(function(t){t=t.reverse(),i.eachLimit(t,1,(function(t,i){p._isRunningTask(n)&&(o.using[t]?i():d.call(p,{Bucket:r,Region:c,Key:u,UploadId:t,tracker:e.tracker},(function(e,r){if(p._isRunningTask(n)){if(e)return o.removeUsing(t),S.emit("error",e);var a=r.PartList;a.forEach((function(e){e.PartNumber*=1,e.Size*=1,e.ETag=e.ETag||""})),b(a,(function(e,r){if(p._isRunningTask(n))return e?S.emit("error",e):void(r?i({UploadId:t,PartList:a}):i())}))}})))}),(function(e){p._isRunningTask(n)&&(C(null,!0),e&&e.UploadId?S.emit("upload_id_available",e):S.emit("no_available_upload_id"))}))})),S.on("seek_local_avail_upload_id",(function(t){var i=o.getFileId(e.Body,e.ChunkSize,r,u),a=o.getUploadIdList.call(p,i);i&&a?function i(l){if(l>=a.length)S.emit("has_and_check_upload_id",t);else{var h=a[l];if(!s.isInArray(t,h))return o.removeUploadId.call(p,h),void i(l+1);o.using[h]?i(l+1):d.call(p,{Bucket:r,Region:c,Key:u,UploadId:h,tracker:e.tracker},(function(e,t){p._isRunningTask(n)&&(e?(o.removeUploadId.call(p,h),i(l+1)):S.emit("upload_id_available",{UploadId:h,PartList:t.PartList}))}))}}(0):S.emit("has_and_check_upload_id",t)})),S.on("get_remote_upload_id_list",(function(){l.call(p,{Bucket:r,Region:c,Key:u,tracker:e.tracker},(function(t,i){if(p._isRunningTask(n)){if(t)return S.emit("error",t);var a=s.filter(i.UploadList,(function(e){return e.Key===u&&(!h||e.StorageClass.toUpperCase()===h.toUpperCase())})).reverse().map((function(e){return e.UploadId||e.UploadID}));if(a.length)S.emit("seek_local_avail_upload_id",a);else{var c,l=o.getFileId(e.Body,e.ChunkSize,r,u);l&&(c=o.getUploadIdList.call(p,l))&&s.each(c,(function(e){o.removeUploadId.call(p,e)})),S.emit("no_available_upload_id")}}}))})),S.emit("get_remote_upload_id_list")}function l(e,t){var n=this,r=[],o={Bucket:e.Bucket,Region:e.Region,Prefix:e.Key,calledBySdk:e.calledBySdk||"sliceUploadFile",tracker:e.tracker};!function e(){n.multipartList(o,(function(n,i){if(n)return t(n);r.push.apply(r,i.Upload||[]),"true"===i.IsTruncated?(o.KeyMarker=i.NextKeyMarker,o.UploadIdMarker=i.NextUploadIdMarker,e()):t(null,{UploadList:r})}))}()}function d(e,t){var n=this,r=[],o={Bucket:e.Bucket,Region:e.Region,Key:e.Key,UploadId:e.UploadId,calledBySdk:"sliceUploadFile",tracker:e.tracker};!function e(){n.multipartListPart(o,(function(n,i){if(n)return t(n);r.push.apply(r,i.Part||[]),"true"===i.IsTruncated?(o.PartNumberMarker=i.NextPartNumberMarker,e()):t(null,{PartList:r})}))}()}function h(e,t){var n=this,r=e.TaskId,o=e.Bucket,a=e.Region,c=e.Key,u=e.UploadData,l=e.FileSize,d=e.SliceSize,h=Math.min(e.AsyncLimit||n.options.ChunkParallelLimit||1,256),f=e.Body,m=Math.ceil(l/d),g=0,y=e.ServerSideEncryption,v=e.Headers,C=s.filter(u.PartList,(function(e){return e.Uploaded&&(g+=e.PartNumber>=m&&l%d||d),!e.Uploaded})),b=e.onProgress;i.eachLimit(C,h,(function(t,i){if(n._isRunningTask(r)){var s=t.PartNumber,h=Math.min(l,t.PartNumber*d)-(t.PartNumber-1)*d,m=0;p.call(n,{TaskId:r,Bucket:o,Region:a,Key:c,SliceSize:d,FileSize:l,PartNumber:s,ServerSideEncryption:y,Body:f,UploadData:u,Headers:v,onProgress:function(e){g+=e.loaded-m,m=e.loaded,b({loaded:g,total:l})},tracker:e.tracker},(function(e,o){n._isRunningTask(r)&&(e||o.ETag||(e='get ETag error, please add "ETag" to CORS ExposeHeader setting.( 获取ETag失败,请在CORS ExposeHeader设置中添加ETag,请参考文档:https://cloud.tencent.com/document/product/436/13318 )'),e?g-=m:(g+=h-m,t.ETag=o.ETag),b({loaded:g,total:l}),i(e||null,o))}))}}),(function(e){if(n._isRunningTask(r))return e?t(e):void t(null,{UploadId:u.UploadId,SliceList:u.PartList})}))}function p(e,t){var n=this,r=e.TaskId,o=e.Bucket,a=e.Region,c=e.Key,u=e.FileSize,l=e.Body,d=1*e.PartNumber,h=e.SliceSize,p=e.ServerSideEncryption,f=e.UploadData,m=e.Headers||{},g=n.options.ChunkRetryTimes+1,y=h*(d-1),v=h,C=y+h;C>u&&(v=(C=u)-y);var b=["x-cos-traffic-limit","x-cos-mime-limit"],S={};s.each(m,(function(e,t){b.indexOf(t)>-1&&(S[t]=e)}));var E=f.PartList[d-1];i.retry(g,(function(t){n._isRunningTask(r)&&s.fileSlice(l,y,C,!0,(function(i){n.multipartUpload({TaskId:r,Bucket:o,Region:a,Key:c,ContentLength:v,PartNumber:d,UploadId:f.UploadId,ServerSideEncryption:p,Body:i,Headers:S,onProgress:e.onProgress,calledBySdk:"sliceUploadFile",tracker:e.tracker},(function(e,o){if(n._isRunningTask(r))return e?t(e):(E.Uploaded=!0,t(null,o))}))}))}),(function(e,o){if(n._isRunningTask(r))return t(e,o)}))}function f(e,t){var n=e.Bucket,r=e.Region,o=e.Key,a=e.UploadId,s=e.SliceList,c=this,u=this.options.ChunkRetryTimes+1,l=e.Headers,d=s.map((function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}}));i.retry(u,(function(t){c.multipartComplete({Bucket:n,Region:r,Key:o,UploadId:a,Parts:d,Headers:l,calledBySdk:"sliceUploadFile",tracker:e.tracker},t)}),(function(e,n){t(e,n)}))}function m(e,t){var n=e.Bucket,r=e.Region,o=e.Key,a=e.AbortArray,s=e.AsyncLimit||1,c=this,u=0,l=new Array(a.length);i.eachLimit(a,s,(function(t,i){var a=u;if(o&&o!==t.Key)return l[a]={error:{KeyNotMatch:!0}},void i(null);var s=t.UploadId||t.UploadID;c.multipartAbort({Bucket:n,Region:r,Key:t.Key,Headers:e.Headers,UploadId:s},(function(e){var o={Bucket:n,Region:r,Key:t.Key,UploadId:s};l[a]={error:e,task:o},i(null)})),u++}),(function(e){if(e)return t(e);for(var n=[],r=[],o=0,i=l.length;o<i;o++){var a=l[o];a.task&&(a.error?r.push(a.task):n.push(a.task))}return t(null,{successList:n,errorList:r})}))}function g(e,t){var n=e.TaskId,r=e.Bucket,o=e.Region,a=e.Key,s=e.CopySource,c=e.UploadId,u=1*e.PartNumber,l=e.CopySourceRange,d=this.options.ChunkRetryTimes+1,h=this;i.retry(d,(function(e){h.uploadPartCopy({TaskId:n,Bucket:r,Region:o,Key:a,CopySource:s,UploadId:c,PartNumber:u,CopySourceRange:l},(function(t,n){e(t||null,n)}))}),(function(e,n){return t(e,n)}))}var y={sliceUploadFile:function(e,t){var n,r,i=this,c=new a,l=e.TaskId,d=e.Bucket,p=e.Region,m=e.Key,g=e.Body,y=e.ChunkSize||e.SliceSize||i.options.ChunkSize,v=e.AsyncLimit,C=e.StorageClass,b=e.ServerSideEncryption,S=e.onHashProgress,E=e.tracker;E&&E.setParams({chunkSize:y}),c.on("error",(function(n){if(i._isRunningTask(l))return n.UploadId=e.UploadData.UploadId||"",t(n)})),c.on("upload_complete",(function(n){var r=s.extend({UploadId:e.UploadData.UploadId||""},n);t(null,r)})),c.on("upload_slice_complete",(function(t){var a={};s.each(e.Headers,(function(e,t){var n=t.toLowerCase();0!==n.indexOf("x-cos-meta-")&&"pic-operations"!==n||(a[t]=e)})),f.call(i,{Bucket:d,Region:p,Key:m,UploadId:t.UploadId,SliceList:t.SliceList,Headers:a,tracker:E},(function(e,a){if(i._isRunningTask(l)){if(o.removeUsing(t.UploadId),e)return r(null,!0),c.emit("error",e);o.removeUploadId.call(i,t.UploadId),r({loaded:n,total:n},!0),c.emit("upload_complete",a)}}))})),c.on("get_upload_data_finish",(function(t){var a=o.getFileId(g,e.ChunkSize,d,m);a&&o.saveUploadId.call(i,a,t.UploadId,i.options.UploadIdCacheLimit),o.setUsing(t.UploadId),r(null,!0),h.call(i,{TaskId:l,Bucket:d,Region:p,Key:m,Body:g,FileSize:n,SliceSize:y,AsyncLimit:v,ServerSideEncryption:b,UploadData:t,Headers:e.Headers,onProgress:r,tracker:E},(function(e,t){if(i._isRunningTask(l))return e?(r(null,!0),c.emit("error",e)):void c.emit("upload_slice_complete",t)}))})),c.on("get_file_size_finish",(function(){if(r=s.throttleOnProgress.call(i,n,e.onProgress),e.UploadData.UploadId)c.emit("get_upload_data_finish",e.UploadData);else{var t=s.extend({TaskId:l,Bucket:d,Region:p,Key:m,Headers:e.Headers,StorageClass:C,Body:g,FileSize:n,SliceSize:y,onHashProgress:S,tracker:E},e);u.call(i,t,(function(t,n){if(i._isRunningTask(l)){if(t)return c.emit("error",t);e.UploadData.UploadId=n.UploadId,e.UploadData.PartList=n.PartList,c.emit("get_upload_data_finish",e.UploadData)}}))}})),n=e.ContentLength,delete e.ContentLength,!e.Headers&&(e.Headers={}),s.each(e.Headers,(function(t,n){"content-length"===n.toLowerCase()&&delete e.Headers[n]})),function(){for(var t=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],r=1048576,o=0;o<t.length&&!(n/(r=1024*t[o]*1024)<=i.options.MaxPartNumber);o++);e.ChunkSize=e.SliceSize=y=Math.max(y,r)}(),0===n?(e.Body="",e.ContentLength=0,e.SkipTask=!0,i.putObject(e,t)):c.emit("get_file_size_finish")},abortUploadTask:function(e,t){var n=e.Bucket,r=e.Region,o=e.Key,i=e.UploadId,c=e.Level||"task",u=e.AsyncLimit,d=this,h=new a;if(h.on("error",(function(e){return t(e)})),h.on("get_abort_array",(function(i){m.call(d,{Bucket:n,Region:r,Key:o,Headers:e.Headers,AsyncLimit:u,AbortArray:i},t)})),"bucket"===c)l.call(d,{Bucket:n,Region:r,calledBySdk:"abortUploadTask"},(function(e,n){if(e)return t(e);h.emit("get_abort_array",n.UploadList||[])}));else if("file"===c){if(!o)return t(s.error(new Error("abort_upload_task_no_key")));l.call(d,{Bucket:n,Region:r,Key:o,calledBySdk:"abortUploadTask"},(function(e,n){if(e)return t(e);h.emit("get_abort_array",n.UploadList||[])}))}else{if("task"!==c)return t(s.error(new Error("abort_unknown_level")));if(!i)return t(s.error(new Error("abort_upload_task_no_id")));if(!o)return t(s.error(new Error("abort_upload_task_no_key")));h.emit("get_abort_array",[{Key:o,UploadId:i}])}},uploadFile:function(e,t){var n=this,o=void 0===e.SliceSize?n.options.SliceSize:e.SliceSize,i=[],a=e.Body,u=a.size||a.length||0,l={TaskId:""};if(n.options.EnableTracker){var d=n.options.UseAccelerate||"string"==typeof n.options.Domain&&n.options.Domain.includes("accelerate.");e.tracker=new c({bucket:e.Bucket,region:e.Region,apiName:"uploadFile",fileKey:e.Key,fileSize:u,accelerate:d,deepTracker:n.options.DeepTracker,customId:n.options.CustomId,delay:n.options.TrackerDelay})}s.each(e,(function(e,t){"object"!==r(e)&&"function"!=typeof e&&(l[t]=e)}));var h=e.onTaskReady;e.onTaskReady=function(e){l.TaskId=e,h&&h(e)};var p=u>o?"sliceUploadFile":"putObject",f=e.onFileFinish;i.push({api:p,params:e,callback:function(n,r){e.tracker&&e.tracker.formatResult(n,r),f&&f(n,r,l),t&&t(n,r)}}),n._addTasks(i)},uploadFiles:function(e,t){var n=this,o=void 0===e.SliceSize?n.options.SliceSize:e.SliceSize,i=0,a=0,u=s.throttleOnProgress.call(n,a,e.onProgress),l=e.files.length,d=e.onFileFinish,h=Array(l),p=function(e,n,r){u(null,!0),d&&d(e,n,r),h[r.Index]={options:r,error:e,data:n},--l<=0&&t&&t(null,{files:h})},f=[];s.each(e.files,(function(e,t){!function(){var l=e.Body,d=l.size||l.length||0,h={Index:t,TaskId:""};if(!n.options.UseRawKey&&e.Key&&"/"===e.Key.substr(0,1)&&(e.Key=e.Key.substr(1)),i+=d,n.options.EnableTracker){var m=n.options.UseAccelerate||"string"==typeof n.options.Domain&&n.options.Domain.includes("accelerate.");e.tracker=new c({bucket:e.Bucket,region:e.Region,apiName:"uploadFiles",fileKey:e.Key,fileSize:d,accelerate:m,deepTracker:n.options.DeepTracker,customId:n.options.CustomId,delay:n.options.TrackerDelay})}s.each(e,(function(e,t){"object"!==r(e)&&"function"!=typeof e&&(h[t]=e)}));var g=e.onTaskReady;e.onTaskReady=function(e){h.TaskId=e,g&&g(e)};var y=0,v=e.onProgress;e.onProgress=function(e){a=a-y+e.loaded,y=e.loaded,v&&v(e),u({loaded:a,total:i})};var C=d>o?"sliceUploadFile":"putObject",b=e.onFileFinish;f.push({api:C,params:e,callback:function(t,n){e.tracker&&e.tracker.formatResult(t,n),b&&b(t,n),p&&p(t,n,h)}})}()})),n._addTasks(f)},sliceCopyFile:function(e,t){var n=new a,r=this,c=e.Bucket,u=e.Region,l=e.Key,h=e.CopySource,p=s.getSourceParams.call(this,h);if(p){var f=p.Bucket,m=p.Region,y=decodeURIComponent(p.Key),v=void 0===e.CopySliceSize?r.options.CopySliceSize:e.CopySliceSize;v=Math.max(0,v);var C,b,S=e.CopyChunkSize||this.options.CopyChunkSize,E=this.options.CopyChunkParallelLimit,T=this.options.ChunkRetryTimes+1,k=0,w=0,A={},x={},_={};n.on("copy_slice_complete",(function(n){s.each(e.Headers,(function(e,t){t.toLowerCase().indexOf("x-cos-meta-")}));var a=s.map(n.PartList,(function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}}));i.retry(T,(function(e){r.multipartComplete({Bucket:c,Region:u,Key:l,UploadId:n.UploadId,Parts:a,calledBySdk:"sliceCopyFile"},e)}),(function(e,r){if(o.removeUsing(n.UploadId),e)return b(null,!0),t(e);o.removeUploadId(n.UploadId),b({loaded:C,total:C},!0),t(null,r)}))})),n.on("get_copy_data_finish",(function(e){var a=o.getCopyFileId(h,A,S,c,l);a&&o.saveUploadId(a,e.UploadId,r.options.UploadIdCacheLimit),o.setUsing(e.UploadId);var d=s.filter(e.PartList,(function(e){return e.Uploaded&&(w+=e.PartNumber>=k&&C%S||S),!e.Uploaded}));i.eachLimit(d,E,(function(t,n){var o=t.PartNumber,a=t.CopySourceRange,s=t.end-t.start;i.retry(T,(function(t){g.call(r,{Bucket:c,Region:u,Key:l,CopySource:h,UploadId:e.UploadId,PartNumber:o,CopySourceRange:a},t)}),(function(e,r){if(e)return n(e);b({loaded:w+=s,total:C}),t.ETag=r.ETag,n(e||null,r)}))}),(function(r){if(r)return o.removeUsing(e.UploadId),b(null,!0),t(r);n.emit("copy_slice_complete",e)}))})),n.on("get_chunk_size_finish",(function(){var i=function(){r.multipartInit({Bucket:c,Region:u,Key:l,Headers:_},(function(r,o){if(r)return t(r);e.UploadId=o.UploadId,n.emit("get_copy_data_finish",{UploadId:e.UploadId,PartList:e.PartList})}))},a=o.getCopyFileId(h,A,S,c,l),p=o.getUploadIdList(a);if(!a||!p)return i();!function t(a){if(a>=p.length)return i();var h=p[a];if(o.using[h])return t(a+1);d.call(r,{Bucket:c,Region:u,Key:l,UploadId:h},(function(r,i){if(r)o.removeUploadId(h),t(a+1);else{if(o.using[h])return t(a+1);var c={},u=0;s.each(i.PartList,(function(e){var t=parseInt(e.Size),n=u+t-1;c[e.PartNumber+"|"+u+"|"+n]=e.ETag,u+=t})),s.each(e.PartList,(function(e){var t=c[e.PartNumber+"|"+e.start+"|"+e.end];t&&(e.ETag=t,e.Uploaded=!0)})),n.emit("get_copy_data_finish",{UploadId:h,PartList:e.PartList})}}))}(0)})),n.on("get_file_size_finish",(function(){if(function(){for(var t=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],n=1048576,o=0;o<t.length&&!(C/(n=1024*t[o]*1024)<=r.options.MaxPartNumber);o++);e.ChunkSize=S=Math.max(S,n),k=Math.ceil(C/S);for(var i=[],a=1;a<=k;a++){var s=(a-1)*S,c=a*S<C?a*S-1:C-1,u={PartNumber:a,start:s,end:c,CopySourceRange:"bytes="+s+"-"+c};i.push(u)}e.PartList=i}(),(_="Replaced"===e.Headers["x-cos-metadata-directive"]?e.Headers:x)["x-cos-storage-class"]=e.Headers["x-cos-storage-class"]||x["x-cos-storage-class"],_=s.clearKey(_),"ARCHIVE"===x["x-cos-storage-class"]||"DEEP_ARCHIVE"===x["x-cos-storage-class"]){var o=x["x-cos-restore"];if(!o||'ongoing-request="true"'===o)return void t(s.error(new Error("Unrestored archive object is not allowed to be copied")))}delete _["x-cos-copy-source"],delete _["x-cos-metadata-directive"],delete _["x-cos-copy-source-If-Modified-Since"],delete _["x-cos-copy-source-If-Unmodified-Since"],delete _["x-cos-copy-source-If-Match"],delete _["x-cos-copy-source-If-None-Match"],n.emit("get_chunk_size_finish")})),r.headObject({Bucket:f,Region:m,Key:y},(function(o,i){if(o)o.statusCode&&404===o.statusCode?t(s.error(o,{ErrorStatus:y+" Not Exist"})):t(o);else if(void 0!==(C=e.FileSize=i.headers["content-length"])&&C)if(b=s.throttleOnProgress.call(r,C,e.onProgress),C<=v)e.Headers["x-cos-metadata-directive"]||(e.Headers["x-cos-metadata-directive"]="Copy"),r.putObjectCopy(e,(function(e,n){if(e)return b(null,!0),t(e);b({loaded:C,total:C},!0),t(e,n)}));else{var a=i.headers;A=a,x={"Cache-Control":a["cache-control"],"Content-Disposition":a["content-disposition"],"Content-Encoding":a["content-encoding"],"Content-Type":a["content-type"],Expires:a.expires,"x-cos-storage-class":a["x-cos-storage-class"]},s.each(a,(function(e,t){var n="x-cos-meta-";0===t.indexOf(n)&&t.length>11&&(x[t]=e)})),n.emit("get_file_size_finish")}else t(s.error(new Error('get Content-Length error, please add "Content-Length" to CORS ExposeHeader setting.( 获取Content-Length失败,请在CORS ExposeHeader设置中添加Content-Length,请参考文档:https://cloud.tencent.com/document/product/436/13318 )')))}))}else t(s.error(new Error("CopySource format error")))}};e.exports.init=function(e,t){t.transferToTaskMethod(y,"sliceUploadFile"),s.each(y,(function(t,n){e.prototype[n]=s.apiWrapper(n,t)}))}},"./src/async.js":
- /*!**********************!*\
- !*** ./src/async.js ***!
- \**********************/
- /*! no static exports found */function(e,t){var n={eachLimit:function(e,t,n,r){if(r=r||function(){},!e.length||t<=0)return r();var o=0,i=0,a=0;!function s(){if(o>=e.length)return r();for(;a<t&&i<e.length;)a+=1,n(e[(i+=1)-1],(function(t){t?(r(t),r=function(){}):(a-=1,(o+=1)>=e.length?r():s())}))}()},retry:function(e,t,n){e<1?n():function r(o){t((function(t,i){t&&o<e?r(o+1):n(t,i)}))}(1)}};e.exports=n},"./src/base.js":
- /*!*********************!*\
- !*** ./src/base.js ***!
- \*********************/
- /*! no static exports found */function(e,t,n){var r=n(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js"),o=n(/*! ../lib/request */"./lib/request.js"),i=n(/*! ./util */"./src/util.js");function a(e,t,n){var r=i.clone(t.InventoryConfiguration);if(r.OptionalFields){var o=r.OptionalFields||[];r.OptionalFields={Field:o}}if(r.Destination&&r.Destination.COSBucketDestination&&r.Destination.COSBucketDestination.Encryption){var a=r.Destination.COSBucketDestination.Encryption;Object.keys(a).indexOf("SSECOS")>-1&&(a["SSE-COS"]=a.SSECOS,delete a.SSECOS)}var s=i.json2xml({InventoryConfiguration:r}),c=t.Headers;c["Content-Type"]="application/xml",c["Content-MD5"]=i.b64(i.md5(s));var u="PUT"===e?"name/cos:PutBucketInventory":"name/cos:PostBucketInventory";p.call(this,{Action:u,method:e,Bucket:t.Bucket,Region:t.Region,body:s,action:"inventory",qs:{id:t.Id},headers:c},(function(e,t){return e&&204===e.statusCode?n(null,{statusCode:e.statusCode}):e?n(e):void n(null,{statusCode:t.statusCode,headers:t.headers})}))}function s(e){var t={GrantFullControl:[],GrantWrite:[],GrantRead:[],GrantReadAcp:[],GrantWriteAcp:[],ACL:""},n={FULL_CONTROL:"GrantFullControl",WRITE:"GrantWrite",READ:"GrantRead",READ_ACP:"GrantReadAcp",WRITE_ACP:"GrantWriteAcp"},r=(e&&e.AccessControlList||{}).Grant;r&&(r=i.isArray(r)?r:[r]);var o={READ:0,WRITE:0,FULL_CONTROL:0};return r&&r.length&&i.each(r,(function(r){"qcs::cam::anyone:anyone"===r.Grantee.ID||"http://cam.qcloud.com/groups/global/AllUsers"===r.Grantee.URI?o[r.Permission]=1:r.Grantee.ID!==e.Owner.ID&&t[n[r.Permission]].push('id="'+r.Grantee.ID+'"')})),o.FULL_CONTROL||o.WRITE&&o.READ?t.ACL="public-read-write":o.READ?t.ACL="public-read":t.ACL="private",i.each(n,(function(e){t[e]=c(t[e].join(","))})),t}function c(e){var t,n,r=e.split(","),o={};for(t=0;t<r.length;)o[n=r[t].trim()]?r.splice(t,1):(o[n]=!0,r[t]=n,t++);return r.join(",")}function u(e){var t=e.region||"",n=e.bucket||"",o=n.substr(0,n.lastIndexOf("-")),a=n.substr(n.lastIndexOf("-")+1),s=e.domain,c=e.object;"function"==typeof s&&(s=s({Bucket:n,Region:t})),["http","https"].includes(e.protocol)&&(e.protocol=e.protocol+":");var u=e.protocol||(i.isBrowser&&"object"===("undefined"==typeof location?"undefined":r(location))&&"http:"===location.protocol?"http:":"https:");s||(s=["cn-south","cn-south-2","cn-north","cn-east","cn-southwest","sg"].indexOf(t)>-1?"{Region}.myqcloud.com":"cos.{Region}.myqcloud.com",e.ForcePathStyle||(s="{Bucket}."+s)),s=(s=s.replace(/\{\{AppId\}\}/gi,a).replace(/\{\{Bucket\}\}/gi,o).replace(/\{\{Region\}\}/gi,t).replace(/\{\{.*?\}\}/gi,"")).replace(/\{AppId\}/gi,a).replace(/\{BucketName\}/gi,o).replace(/\{Bucket\}/gi,n).replace(/\{Region\}/gi,t).replace(/\{.*?\}/gi,""),/^[a-zA-Z]+:\/\//.test(s)||(s=u+"//"+s),"/"===s.slice(-1)&&(s=s.slice(0,-1));var l=s;return e.ForcePathStyle&&(l+="/"+n),l+="/",c&&(l+=i.camSafeUrlEncode(c).replace(/%2F/g,"/")),e.isLocation&&(l=l.replace(/^https?:\/\//,"")),l}var l=function(e){if(!e.Bucket||!e.Region)return"";var t=void 0===e.UseAccelerate?this.options.UseAccelerate:e.UseAccelerate,n=(e.Url||u({ForcePathStyle:this.options.ForcePathStyle,protocol:this.options.Protocol,domain:this.options.Domain,bucket:e.Bucket,region:t?"accelerate":e.Region})).replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1");return new RegExp("^([a-z\\d-]+-\\d+\\.)?(cos|cosv6|ci|pic)\\.([a-z\\d-]+)\\.myqcloud\\.com$").test(n)?n:""};function d(e,t){var n=i.clone(e.Headers),r="";i.each(n,(function(e,t){(""===e||["content-type","cache-control","expires"].indexOf(t.toLowerCase())>-1)&&delete n[t],"host"===t.toLowerCase()&&(r=e)}));var o=!1!==e.ForceSignHost;!r&&e.SignHost&&o&&(n.Host=e.SignHost);var a=!1,s=function(e,n){a||(a=!0,n&&n.XCosSecurityToken&&!n.SecurityToken&&((n=i.clone(n)).SecurityToken=n.XCosSecurityToken,delete n.XCosSecurityToken),t&&t(e,n))},c=this,u=e.Bucket||"",l=e.Region||"",d=e.Key||"";c.options.ForcePathStyle&&u&&(d=u+"/"+d);var h="/"+d,p={},f=e.Scope;if(!f){var m=e.Action||"",g=e.ResourceKey||e.Key||"";f=e.Scope||[{action:m,bucket:u,region:l,prefix:g}]}var y=i.md5(JSON.stringify(f));c._StsCache=c._StsCache||[],function(){var e,t;for(e=c._StsCache.length-1;e>=0;e--){t=c._StsCache[e];var n=Math.round(i.getSkewTime(c.options.SystemClockOffset)/1e3)+30;if(t.StartTime&&n<t.StartTime||n>=t.ExpiredTime)c._StsCache.splice(e,1);else if(!t.ScopeLimit||t.ScopeLimit&&t.ScopeKey===y){p=t;break}}}();var v,C=function(){var t="";p.StartTime&&e.Expires?t=p.StartTime+";"+(p.StartTime+1*e.Expires):p.StartTime&&p.ExpiredTime&&(t=p.StartTime+";"+p.ExpiredTime);var r={Authorization:i.getAuth({SecretId:p.TmpSecretId,SecretKey:p.TmpSecretKey,Method:e.Method,Pathname:h,Query:e.Query,Headers:n,Expires:e.Expires,UseRawKey:c.options.UseRawKey,SystemClockOffset:c.options.SystemClockOffset,KeyTime:t,ForceSignHost:o}),SecurityToken:p.SecurityToken||p.XCosSecurityToken||"",Token:p.Token||"",ClientIP:p.ClientIP||"",ClientUA:p.ClientUA||""};s(null,r)},b=function(e){if(e.Authorization){var t=!1,n=e.Authorization;if(n)if(n.indexOf(" ")>-1)t=!1;else if(n.indexOf("q-sign-algorithm=")>-1&&n.indexOf("q-ak=")>-1&&n.indexOf("q-sign-time=")>-1&&n.indexOf("q-key-time=")>-1&&n.indexOf("q-url-param-list=")>-1)t=!0;else try{(n=atob(n)).indexOf("a=")>-1&&n.indexOf("k=")>-1&&n.indexOf("t=")>-1&&n.indexOf("r=")>-1&&n.indexOf("b=")>-1&&(t=!0)}catch(r){}if(!t)return i.error(new Error("getAuthorization callback params format error"))}else{if(!e.TmpSecretId)return i.error(new Error('getAuthorization callback params missing "TmpSecretId"'));if(!e.TmpSecretKey)return i.error(new Error('getAuthorization callback params missing "TmpSecretKey"'));if(!e.SecurityToken&&!e.XCosSecurityToken)return i.error(new Error('getAuthorization callback params missing "SecurityToken"'));if(!e.ExpiredTime)return i.error(new Error('getAuthorization callback params missing "ExpiredTime"'));if(e.ExpiredTime&&10!==e.ExpiredTime.toString().length)return i.error(new Error('getAuthorization callback params "ExpiredTime" should be 10 digits'));if(e.StartTime&&10!==e.StartTime.toString().length)return i.error(new Error('getAuthorization callback params "StartTime" should be 10 StartTime'))}return!1};if(p.ExpiredTime&&p.ExpiredTime-i.getSkewTime(c.options.SystemClockOffset)/1e3>60)C();else if(c.options.getAuthorization)c.options.getAuthorization.call(c,{Bucket:u,Region:l,Method:e.Method,Key:d,Pathname:h,Query:e.Query,Headers:n,Scope:f,SystemClockOffset:c.options.SystemClockOffset,ForceSignHost:o},(function(e){"string"==typeof e&&(e={Authorization:e});var t=b(e);if(t)return s(t);e.Authorization?s(null,e):((p=e||{}).Scope=f,p.ScopeKey=y,c._StsCache.push(p),C())}));else{if(!c.options.getSTS)return v={Authorization:i.getAuth({SecretId:e.SecretId||c.options.SecretId,SecretKey:e.SecretKey||c.options.SecretKey,Method:e.Method,Pathname:h,Query:e.Query,Headers:n,Expires:e.Expires,UseRawKey:c.options.UseRawKey,SystemClockOffset:c.options.SystemClockOffset,ForceSignHost:o}),SecurityToken:c.options.SecurityToken||c.options.XCosSecurityToken},s(null,v),v;c.options.getSTS.call(c,{Bucket:u,Region:l},(function(e){(p=e||{}).Scope=f,p.ScopeKey=y,p.TmpSecretId||(p.TmpSecretId=p.SecretId),p.TmpSecretKey||(p.TmpSecretKey=p.SecretKey);var t=b(p);if(t)return s(t);c._StsCache.push(p),C()}))}return""}function h(e){var t=!1,n=!1,r=e.headers&&(e.headers.date||e.headers.Date)||e.error&&e.error.ServerTime;try{var o=e.error.Code,a=e.error.Message;("RequestTimeTooSkewed"===o||"AccessDenied"===o&&"Request has expired"===a)&&(n=!0)}catch(c){}if(e)if(n&&r){var s=Date.parse(r);this.options.CorrectClockSkew&&Math.abs(i.getSkewTime(this.options.SystemClockOffset)-s)>=3e4&&(console.error("error: Local time is too skewed."),this.options.SystemClockOffset=s-Date.now(),t=!0)}else 5===Math.floor(e.statusCode/100)&&(t=!0);return t}function p(e,t){var n=this;!e.headers&&(e.headers={}),!e.qs&&(e.qs={}),e.VersionId&&(e.qs.versionId=e.VersionId),e.qs=i.clearKey(e.qs),e.headers&&(e.headers=i.clearKey(e.headers)),e.qs&&(e.qs=i.clearKey(e.qs));var r=i.clone(e.qs);e.action&&(r[e.action]="");var o=e.url||e.Url,a=e.SignHost||l.call(this,{Bucket:e.Bucket,Region:e.Region,Url:o}),s=e.tracker;!function o(i){var c=n.options.SystemClockOffset;s&&s.setParams({signStartTime:(new Date).getTime(),retryTimes:i-1}),d.call(n,{Bucket:e.Bucket||"",Region:e.Region||"",Method:e.method,Key:e.Key,Query:r,Headers:e.headers,SignHost:a,Action:e.Action,ResourceKey:e.ResourceKey,Scope:e.Scope,ForceSignHost:n.options.ForceSignHost},(function(r,a){r?t(r):(s&&s.setParams({signEndTime:(new Date).getTime(),httpStartTime:(new Date).getTime()}),e.AuthData=a,f.call(n,e,(function(r,a){s&&s.setParams({httpEndTime:(new Date).getTime()}),r&&i<2&&(c!==n.options.SystemClockOffset||h.call(n,r))?(e.headers&&(delete e.headers.Authorization,delete e.headers.token,delete e.headers.clientIP,delete e.headers.clientUA,e.headers["x-cos-security-token"]&&delete e.headers["x-cos-security-token"],e.headers["x-ci-security-token"]&&delete e.headers["x-ci-security-token"]),o(i+1)):t(r,a)})))}))}(1)}function f(e,t){var n=this,r=e.TaskId;if(!r||n._isRunningTask(r)){var a=e.Bucket,s=e.Region,c=e.Key,l=e.method||"GET",d=e.Url||e.url,h=e.body,p=e.rawBody;n.options.UseAccelerate&&(s="accelerate"),d=d||u({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:a,region:s,object:c}),e.action&&(d=d+"?"+(i.isIOS_QQ?"".concat(e.action,"="):e.action)),e.qsStr&&(d=d.indexOf("?")>-1?d+"&"+e.qsStr:d+"?"+e.qsStr);var f={method:l,url:d,headers:e.headers,qs:e.qs,body:h},m="x-cos-security-token";if(i.isCIHost(d)&&(m="x-ci-security-token"),f.headers.Authorization=e.AuthData.Authorization,e.AuthData.Token&&(f.headers.token=e.AuthData.Token),e.AuthData.ClientIP&&(f.headers.clientIP=e.AuthData.ClientIP),e.AuthData.ClientUA&&(f.headers.clientUA=e.AuthData.ClientUA),e.AuthData.SecurityToken&&(f.headers[m]=e.AuthData.SecurityToken),f.headers&&(f.headers=i.clearKey(f.headers)),f=i.clearKey(f),e.onProgress&&"function"==typeof e.onProgress){var g=h&&(h.size||h.length)||0;f.onProgress=function(t){if(!r||n._isRunningTask(r)){var o=t?t.loaded:0;e.onProgress({loaded:o,total:g})}}}e.onDownloadProgress&&(f.onDownloadProgress=e.onDownloadProgress),e.DataType&&(f.dataType=e.DataType),this.options.Timeout&&(f.timeout=this.options.Timeout),n.options.ForcePathStyle&&(f.pathStyle=n.options.ForcePathStyle),n.emit("before-send",f);var y=f.url.includes("accelerate."),v=f.qs?Object.keys(f.qs).map((function(e){return"".concat(e,"=").concat(f.qs[e])})).join("&"):"",C=v?f.url+"?"+v:f.url;e.tracker&&e.tracker.setParams({reqUrl:C,accelerate:y?"Y":"N"}),e.tracker&&e.tracker.parent&&e.tracker.parent.setParams({reqUrl:C,accelerate:y?"Y":"N"});var b=(n.options.Request||o)(f,(function(e){if(!e||"abort"!==e.error){var o={options:f,error:e&&e.error,statusCode:e&&e.statusCode||0,statusMessage:e&&e.statusMessage||"",headers:e&&e.headers||{},body:e&&e.body};n.emit("after-receive",o);var a,s=o.error,c=o.body,u={statusCode:o.statusCode,statusMessage:o.statusMessage,headers:o.headers},l=function(e,o){if(r&&n.off("inner-kill-task",S),!a){a=!0;var s={};u&&u.statusCode&&(s.statusCode=u.statusCode),u&&u.headers&&(s.headers=u.headers),e?(e=i.extend(e||{},s),t(e,null)):(o=i.extend(o||{},s),t(null,o)),b=null}};if(s)return l(i.error(s));var d,h=u.statusCode,m=2===Math.floor(h/100);if(p&&m)return l(null,{body:c});try{d=c&&c.indexOf("<")>-1&&c.indexOf(">")>-1&&i.xml2json(c)||{}}catch(y){d={}}var g=d&&d.Error;m?l(null,d):g?l(i.error(new Error(g.Message),{code:g.Code,error:g})):h?l(i.error(new Error(u.statusMessage),{code:""+h})):h&&l(i.error(new Error("statusCode error")))}})),S=function e(t){t.TaskId===r&&(b&&b.abort&&b.abort(),n.off("inner-kill-task",e))};r&&n.on("inner-kill-task",S)}}var m={getService:function(e,t){"function"==typeof e&&(t=e,e={});var n=this.options.Protocol||(i.isBrowser&&"object"===("undefined"==typeof location?"undefined":r(location))&&"http:"===location.protocol?"http:":"https:"),o=this.options.ServiceDomain,a=e.AppId||this.options.appId,s=e.Region;o?(o=o.replace(/\{\{AppId\}\}/gi,a||"").replace(/\{\{Region\}\}/gi,s||"").replace(/\{\{.*?\}\}/gi,""),/^[a-zA-Z]+:\/\//.test(o)||(o=n+"//"+o),"/"===o.slice(-1)&&(o=o.slice(0,-1))):o=s?n+"//cos."+s+".myqcloud.com":n+"//service.cos.myqcloud.com";var c="",u=s?"cos."+s+".myqcloud.com":"service.cos.myqcloud.com";u===o.replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1")&&(c=u),p.call(this,{Action:"name/cos:GetService",url:o,method:"GET",headers:e.Headers,SignHost:c},(function(e,n){if(e)return t(e);var r=n&&n.ListAllMyBucketsResult&&n.ListAllMyBucketsResult.Buckets&&n.ListAllMyBucketsResult.Buckets.Bucket||[];r=i.isArray(r)?r:[r];var o=n&&n.ListAllMyBucketsResult&&n.ListAllMyBucketsResult.Owner||{};t(null,{Buckets:r,Owner:o,statusCode:n.statusCode,headers:n.headers})}))},putBucket:function(e,t){var n=this,r="";if(e.BucketAZConfig){var o={BucketAZConfig:e.BucketAZConfig};r=i.json2xml({CreateBucketConfiguration:o})}p.call(this,{Action:"name/cos:PutBucket",method:"PUT",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,body:r},(function(r,o){if(r)return t(r);var i=u({protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,isLocation:!0});t(null,{Location:i,statusCode:o.statusCode,headers:o.headers})}))},headBucket:function(e,t){p.call(this,{Action:"name/cos:HeadBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"HEAD"},t)},getBucket:function(e,t){var n={};n.prefix=e.Prefix||"",n.delimiter=e.Delimiter,n.marker=e.Marker,n["max-keys"]=e.MaxKeys,n["encoding-type"]=e.EncodingType,p.call(this,{Action:"name/cos:GetBucket",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n},(function(e,n){if(e)return t(e);var r=n.ListBucketResult||{},o=r.Contents||[],a=r.CommonPrefixes||[];o=i.isArray(o)?o:[o],a=i.isArray(a)?a:[a];var s=i.clone(r);i.extend(s,{Contents:o,CommonPrefixes:a,statusCode:n.statusCode,headers:n.headers}),t(null,s)}))},deleteBucket:function(e,t){p.call(this,{Action:"name/cos:DeleteBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"DELETE"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketAcl:function(e,t){var n=e.Headers,r="";if(e.AccessControlPolicy){var o=i.clone(e.AccessControlPolicy||{}),a=o.Grants||o.Grant;a=i.isArray(a)?a:[a],delete o.Grant,delete o.Grants,o.AccessControlList={Grant:a},r=i.json2xml({AccessControlPolicy:o}),n["Content-Type"]="application/xml",n["Content-MD5"]=i.b64(i.md5(r))}i.each(n,(function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=c(n[t]))})),p.call(this,{Action:"name/cos:PutBucketACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,headers:n,action:"acl",body:r},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketAcl:function(e,t){p.call(this,{Action:"name/cos:GetBucketACL",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"acl"},(function(e,n){if(e)return t(e);var r=n.AccessControlPolicy||{},o=r.Owner||{},a=r.AccessControlList.Grant||[];a=i.isArray(a)?a:[a];var c=s(r);n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=i.extend(c,{Owner:o,Grants:a,statusCode:n.statusCode,headers:n.headers}),t(null,c)}))},putBucketCors:function(e,t){var n=(e.CORSConfiguration||{}).CORSRules||e.CORSRules||[];n=i.clone(i.isArray(n)?n:[n]),i.each(n,(function(e){i.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],(function(t){var n=t+"s",r=e[n]||e[t]||[];delete e[n],e[t]=i.isArray(r)?r:[r]}))}));var r={CORSRule:n};e.ResponseVary&&(r.ResponseVary=e.ResponseVary);var o=i.json2xml({CORSConfiguration:r}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=i.b64(i.md5(o)),p.call(this,{Action:"name/cos:PutBucketCORS",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:o,action:"cors",headers:a},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketCors:function(e,t){p.call(this,{Action:"name/cos:GetBucketCORS",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors"},(function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchCORSConfiguration"===e.error.Code){var r={CORSRules:[],statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var o=n.CORSConfiguration||{},a=o.CORSRules||o.CORSRule||[];a=i.clone(i.isArray(a)?a:[a]);var s=o.ResponseVary;i.each(a,(function(e){i.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],(function(t){var n=t+"s",r=e[n]||e[t]||[];delete e[t],e[n]=i.isArray(r)?r:[r]}))})),t(null,{CORSRules:a,ResponseVary:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketCors:function(e,t){p.call(this,{Action:"name/cos:DeleteBucketCORS",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode||e.statusCode,headers:n.headers})}))},getBucketLocation:function(e,t){p.call(this,{Action:"name/cos:GetBucketLocation",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"location"},t)},getBucketPolicy:function(e,t){p.call(this,{Action:"name/cos:GetBucketPolicy",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy",rawBody:!0},(function(e,n){if(e)return e.statusCode&&403===e.statusCode?t(i.error(e,{ErrorStatus:"Access Denied"})):e.statusCode&&405===e.statusCode?t(i.error(e,{ErrorStatus:"Method Not Allowed"})):e.statusCode&&404===e.statusCode?t(i.error(e,{ErrorStatus:"Policy Not Found"})):t(e);var r={};try{r=JSON.parse(n.body)}catch(o){}t(null,{Policy:r,statusCode:n.statusCode,headers:n.headers})}))},putBucketPolicy:function(e,t){var n=e.Policy;try{"string"==typeof n&&(n=JSON.parse(n))}catch(a){}if(!n||"string"==typeof n)return t(i.error(new Error("Policy format error")));var r=JSON.stringify(n);n.version||(n.version="2.0");var o=e.Headers;o["Content-Type"]="application/json",o["Content-MD5"]=i.b64(i.md5(r)),p.call(this,{Action:"name/cos:PutBucketPolicy",method:"PUT",Bucket:e.Bucket,Region:e.Region,action:"policy",body:r,headers:o},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},deleteBucketPolicy:function(e,t){p.call(this,{Action:"name/cos:DeleteBucketPolicy",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode||e.statusCode,headers:n.headers})}))},putBucketTagging:function(e,t){var n=e.Tagging||{},r=n.TagSet||n.Tags||e.Tags||[];r=i.clone(i.isArray(r)?r:[r]);var o=i.json2xml({Tagging:{TagSet:{Tag:r}}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=i.b64(i.md5(o)),p.call(this,{Action:"name/cos:PutBucketTagging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:o,action:"tagging",headers:a},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketTagging:function(e,t){p.call(this,{Action:"name/cos:GetBucketTagging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging"},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"NoSuchTagSet"!==e.error.Code)t(e);else{var r={Tags:[],statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else{var o=[];try{o=n.Tagging.TagSet.Tag||[]}catch(a){}o=i.clone(i.isArray(o)?o:[o]),t(null,{Tags:o,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketTagging:function(e,t){p.call(this,{Action:"name/cos:DeleteBucketTagging",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketLifecycle:function(e,t){var n=(e.LifecycleConfiguration||{}).Rules||e.Rules||[];n=i.clone(n);var r=i.json2xml({LifecycleConfiguration:{Rule:n}}),o=e.Headers;o["Content-Type"]="application/xml",o["Content-MD5"]=i.b64(i.md5(r)),p.call(this,{Action:"name/cos:PutBucketLifecycle",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"lifecycle",headers:o},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketLifecycle:function(e,t){p.call(this,{Action:"name/cos:GetBucketLifecycle",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle"},(function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchLifecycleConfiguration"===e.error.Code){var r={Rules:[],statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var o=[];try{o=n.LifecycleConfiguration.Rule||[]}catch(a){}o=i.clone(i.isArray(o)?o:[o]),t(null,{Rules:o,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketLifecycle:function(e,t){p.call(this,{Action:"name/cos:DeleteBucketLifecycle",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketVersioning:function(e,t){if(e.VersioningConfiguration){var n=e.VersioningConfiguration||{},r=i.json2xml({VersioningConfiguration:n}),o=e.Headers;o["Content-Type"]="application/xml",o["Content-MD5"]=i.b64(i.md5(r)),p.call(this,{Action:"name/cos:PutBucketVersioning",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"versioning",headers:o},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t(i.error(new Error("missing param VersioningConfiguration")))},getBucketVersioning:function(e,t){p.call(this,{Action:"name/cos:GetBucketVersioning",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"versioning"},(function(e,n){e||!n.VersioningConfiguration&&(n.VersioningConfiguration={}),t(e,n)}))},putBucketReplication:function(e,t){var n=i.clone(e.ReplicationConfiguration),r=i.json2xml({ReplicationConfiguration:n});r=(r=r.replace(/<(\/?)Rules>/gi,"<$1Rule>")).replace(/<(\/?)Tags>/gi,"<$1Tag>");var o=e.Headers;o["Content-Type"]="application/xml",o["Content-MD5"]=i.b64(i.md5(r)),p.call(this,{Action:"name/cos:PutBucketReplication",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"replication",headers:o},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketReplication:function(e,t){p.call(this,{Action:"name/cos:GetBucketReplication",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"ReplicationConfigurationnotFoundError"!==e.error.Code)t(e);else{var r={ReplicationConfiguration:{Rules:[]},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else!n.ReplicationConfiguration&&(n.ReplicationConfiguration={}),n.ReplicationConfiguration.Rule&&(n.ReplicationConfiguration.Rules=i.makeArray(n.ReplicationConfiguration.Rule),delete n.ReplicationConfiguration.Rule),t(e,n)}))},deleteBucketReplication:function(e,t){p.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketWebsite:function(e,t){if(e.WebsiteConfiguration){var n=i.clone(e.WebsiteConfiguration||{}),r=n.RoutingRules||n.RoutingRule||[];r=i.isArray(r)?r:[r],delete n.RoutingRule,delete n.RoutingRules,r.length&&(n.RoutingRules={RoutingRule:r});var o=i.json2xml({WebsiteConfiguration:n}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=i.b64(i.md5(o)),p.call(this,{Action:"name/cos:PutBucketWebsite",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:o,action:"website",headers:a},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t(i.error(new Error("missing param WebsiteConfiguration")))},getBucketWebsite:function(e,t){p.call(this,{Action:"name/cos:GetBucketWebsite",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"website"},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchWebsiteConfiguration"===e.error.Code){var r={WebsiteConfiguration:{},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var o=n.WebsiteConfiguration||{};if(o.RoutingRules){var a=i.clone(o.RoutingRules.RoutingRule||[]);a=i.makeArray(a),o.RoutingRules=a}t(null,{WebsiteConfiguration:o,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketWebsite:function(e,t){p.call(this,{Action:"name/cos:DeleteBucketWebsite",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"website"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketReferer:function(e,t){if(e.RefererConfiguration){var n=i.clone(e.RefererConfiguration||{}),r=n.DomainList||{},o=r.Domains||r.Domain||[];(o=i.isArray(o)?o:[o]).length&&(n.DomainList={Domain:o});var a=i.json2xml({RefererConfiguration:n}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=i.b64(i.md5(a)),p.call(this,{Action:"name/cos:PutBucketReferer",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:a,action:"referer",headers:s},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t(i.error(new Error("missing param RefererConfiguration")))},getBucketReferer:function(e,t){p.call(this,{Action:"name/cos:GetBucketReferer",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"referer"},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchRefererConfiguration"===e.error.Code){var r={WebsiteConfiguration:{},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var o=n.RefererConfiguration||{};if(o.DomainList){var a=i.makeArray(o.DomainList.Domain||[]);o.DomainList={Domains:a}}t(null,{RefererConfiguration:o,statusCode:n.statusCode,headers:n.headers})}}))},putBucketDomain:function(e,t){var n=(e.DomainConfiguration||{}).DomainRule||e.DomainRule||[];n=i.clone(n);var r=i.json2xml({DomainConfiguration:{DomainRule:n}}),o=e.Headers;o["Content-Type"]="application/xml",o["Content-MD5"]=i.b64(i.md5(r)),p.call(this,{Action:"name/cos:PutBucketDomain",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"domain",headers:o},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketDomain:function(e,t){p.call(this,{Action:"name/cos:GetBucketDomain",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain"},(function(e,n){if(e)return t(e);var r=[];try{r=n.DomainConfiguration.DomainRule||[]}catch(o){}r=i.clone(i.isArray(r)?r:[r]),t(null,{DomainRule:r,statusCode:n.statusCode,headers:n.headers})}))},deleteBucketDomain:function(e,t){p.call(this,{Action:"name/cos:DeleteBucketDomain",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketOrigin:function(e,t){var n=(e.OriginConfiguration||{}).OriginRule||e.OriginRule||[];n=i.clone(n);var r=i.json2xml({OriginConfiguration:{OriginRule:n}}),o=e.Headers;o["Content-Type"]="application/xml",o["Content-MD5"]=i.b64(i.md5(r)),p.call(this,{Action:"name/cos:PutBucketOrigin",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"origin",headers:o},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketOrigin:function(e,t){p.call(this,{Action:"name/cos:GetBucketOrigin",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin"},(function(e,n){if(e)return t(e);var r=[];try{r=n.OriginConfiguration.OriginRule||[]}catch(o){}r=i.clone(i.isArray(r)?r:[r]),t(null,{OriginRule:r,statusCode:n.statusCode,headers:n.headers})}))},deleteBucketOrigin:function(e,t){p.call(this,{Action:"name/cos:DeleteBucketOrigin",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketLogging:function(e,t){var n=i.json2xml({BucketLoggingStatus:e.BucketLoggingStatus||""}),r=e.Headers;r["Content-Type"]="application/xml",r["Content-MD5"]=i.b64(i.md5(n)),p.call(this,{Action:"name/cos:PutBucketLogging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:n,action:"logging",headers:r},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketLogging:function(e,t){p.call(this,{Action:"name/cos:GetBucketLogging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"logging"},(function(e,n){if(e)return t(e);t(null,{BucketLoggingStatus:n.BucketLoggingStatus,statusCode:n.statusCode,headers:n.headers})}))},putBucketInventory:function(e,t){return a.call(this,"PUT",e,t)},postBucketInventory:function(e,t){return a.call(this,"POST",e,t)},getBucketInventory:function(e,t){p.call(this,{Action:"name/cos:GetBucketInventory",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id}},(function(e,n){if(e)return t(e);var r=n.InventoryConfiguration;if(r&&r.OptionalFields&&r.OptionalFields.Field){var o=r.OptionalFields.Field;i.isArray(o)||(o=[o]),r.OptionalFields=o}if(r.Destination&&r.Destination.COSBucketDestination&&r.Destination.COSBucketDestination.Encryption){var a=r.Destination.COSBucketDestination.Encryption;Object.keys(a).indexOf("SSE-COS")>-1&&(a.SSECOS=a["SSE-COS"],delete a["SSE-COS"])}t(null,{InventoryConfiguration:r,statusCode:n.statusCode,headers:n.headers})}))},listBucketInventory:function(e,t){p.call(this,{Action:"name/cos:ListBucketInventory",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{"continuation-token":e.ContinuationToken}},(function(e,n){if(e)return t(e);var r=n.ListInventoryConfigurationResult,o=r.InventoryConfiguration||[];o=i.isArray(o)?o:[o],delete r.InventoryConfiguration,i.each(o,(function(e){if(e&&e.OptionalFields&&e.OptionalFields.Field){var t=e.OptionalFields.Field;i.isArray(t)||(t=[t]),e.OptionalFields=t}if(e.Destination&&e.Destination.COSBucketDestination&&e.Destination.COSBucketDestination.Encryption){var n=e.Destination.COSBucketDestination.Encryption;Object.keys(n).indexOf("SSE-COS")>-1&&(n.SSECOS=n["SSE-COS"],delete n["SSE-COS"])}})),r.InventoryConfigurations=o,i.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)}))},deleteBucketInventory:function(e,t){p.call(this,{Action:"name/cos:DeleteBucketInventory",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id}},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketAccelerate:function(e,t){if(e.AccelerateConfiguration){var n={AccelerateConfiguration:e.AccelerateConfiguration||{}},r=i.json2xml(n),o={"Content-Type":"application/xml"};o["Content-MD5"]=i.b64(i.md5(r)),p.call(this,{Action:"name/cos:PutBucketAccelerate",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"accelerate",headers:o},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t(i.error(new Error("missing param AccelerateConfiguration")))},getBucketAccelerate:function(e,t){p.call(this,{Action:"name/cos:GetBucketAccelerate",method:"GET",Bucket:e.Bucket,Region:e.Region,action:"accelerate"},(function(e,n){e||!n.AccelerateConfiguration&&(n.AccelerateConfiguration={}),t(e,n)}))},putBucketEncryption:function(e,t){var n=e.ServerSideEncryptionConfiguration||{},r=n.Rule||n.Rules||[],o=i.json2xml({ServerSideEncryptionConfiguration:{Rule:r}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=i.b64(i.md5(o)),p.call(this,{Action:"name/cos:PutBucketEncryption",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:o,action:"encryption",headers:a},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketEncryption:function(e,t){p.call(this,{Action:"name/cos:GetBucketEncryption",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"encryption"},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchEncryptionConfiguration"===e.code){var r={EncryptionConfiguration:{Rules:[]},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var o=i.makeArray(n.EncryptionConfiguration&&n.EncryptionConfiguration.Rule||[]);n.EncryptionConfiguration={Rules:o},t(e,n)}}))},deleteBucketEncryption:function(e,t){p.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"encryption"},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getObject:function(e,t){var n=e.Query||{},r=e.QueryString||"",o=i.throttleOnProgress.call(this,0,e.onProgress),a=e.tracker;a&&a.setParams({signStartTime:(new Date).getTime()}),n["response-content-type"]=e.ResponseContentType,n["response-content-language"]=e.ResponseContentLanguage,n["response-expires"]=e.ResponseExpires,n["response-cache-control"]=e.ResponseCacheControl,n["response-content-disposition"]=e.ResponseContentDisposition,n["response-content-encoding"]=e.ResponseContentEncoding,p.call(this,{Action:"name/cos:GetObject",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,DataType:e.DataType,headers:e.Headers,qs:n,qsStr:r,rawBody:!0,onDownloadProgress:o,tracker:a},(function(n,r){if(o(null,!0),n){var a=n.statusCode;return e.Headers["If-Modified-Since"]&&a&&304===a?t(null,{NotModified:!0}):t(n)}t(null,{Body:r.body,ETag:i.attr(r.headers,"etag",""),statusCode:r.statusCode,headers:r.headers})}))},headObject:function(e,t){p.call(this,{Action:"name/cos:HeadObject",method:"HEAD",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers},(function(n,r){if(n){var o=n.statusCode;return e.Headers["If-Modified-Since"]&&o&&304===o?t(null,{NotModified:!0,statusCode:o}):t(n)}r.ETag=i.attr(r.headers,"etag",""),t(null,r)}))},listObjectVersions:function(e,t){var n={};n.prefix=e.Prefix||"",n.delimiter=e.Delimiter,n["key-marker"]=e.KeyMarker,n["version-id-marker"]=e.VersionIdMarker,n["max-keys"]=e.MaxKeys,n["encoding-type"]=e.EncodingType,p.call(this,{Action:"name/cos:GetBucketObjectVersions",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,action:"versions"},(function(e,n){if(e)return t(e);var r=n.ListVersionsResult||{},o=r.DeleteMarker||[];o=i.isArray(o)?o:[o];var a=r.Version||[];a=i.isArray(a)?a:[a];var s=i.clone(r);delete s.DeleteMarker,delete s.Version,i.extend(s,{DeleteMarkers:o,Versions:a,statusCode:n.statusCode,headers:n.headers}),t(null,s)}))},putObject:function(e,t){var n=this,r=e.ContentLength,o=i.throttleOnProgress.call(n,r,e.onProgress),a=e.Headers;a["Cache-Control"]||a["cache-control"]||(a["Cache-Control"]=""),a["Content-Type"]||a["content-type"]||(a["Content-Type"]=e.Body&&e.Body.type||"");var s=e.UploadAddMetaMd5||n.options.UploadAddMetaMd5||n.options.UploadCheckContentMd5,c=e.tracker;s&&c&&c.setParams({md5StartTime:(new Date).getTime()}),i.getBodyMd5(s,e.Body,(function(s){s&&(c&&c.setParams({md5EndTime:(new Date).getTime()}),n.options.UploadCheckContentMd5&&(a["Content-MD5"]=i.b64(s)),(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5)&&(a["x-cos-meta-md5"]=s)),void 0!==e.ContentLength&&(a["Content-Length"]=e.ContentLength),o(null,!0),p.call(n,{Action:"name/cos:PutObject",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,qs:e.Query,body:e.Body,onProgress:o,tracker:c},(function(a,s){if(a)return o(null,!0),t(a);o({loaded:r,total:r},!0);var c=u({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:n.options.UseAccelerate?"accelerate":e.Region,object:e.Key});c=c.substr(c.indexOf("://")+3),s.Location=c,s.ETag=i.attr(s.headers,"etag",""),t(null,s)}))}),e.onHashProgress)},deleteObject:function(e,t){p.call(this,{Action:"name/cos:DeleteObject",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,VersionId:e.VersionId,action:e.Recursive?"recursive":""},(function(e,n){if(e){var r=e.statusCode;return r&&404===r?t(null,{BucketNotFound:!0,statusCode:r}):t(e)}t(null,{statusCode:n.statusCode,headers:n.headers})}))},getObjectAcl:function(e,t){var n={};e.VersionId&&(n.versionId=e.VersionId),p.call(this,{Action:"name/cos:GetObjectACL",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,qs:n,action:"acl"},(function(e,n){if(e)return t(e);var r=n.AccessControlPolicy||{},o=r.Owner||{},a=r.AccessControlList&&r.AccessControlList.Grant||[];a=i.isArray(a)?a:[a];var c=s(r);delete c.GrantWrite,n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=i.extend(c,{Owner:o,Grants:a,statusCode:n.statusCode,headers:n.headers}),t(null,c)}))},putObjectAcl:function(e,t){var n=e.Headers,r="";if(e.AccessControlPolicy){var o=i.clone(e.AccessControlPolicy||{}),a=o.Grants||o.Grant;a=i.isArray(a)?a:[a],delete o.Grant,delete o.Grants,o.AccessControlList={Grant:a},r=i.json2xml({AccessControlPolicy:o}),n["Content-Type"]="application/xml",n["Content-MD5"]=i.b64(i.md5(r))}i.each(n,(function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=c(n[t]))})),p.call(this,{Action:"name/cos:PutObjectACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"acl",headers:n,body:r},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},optionsObject:function(e,t){var n=e.Headers;n.Origin=e.Origin,n["Access-Control-Request-Method"]=e.AccessControlRequestMethod,n["Access-Control-Request-Headers"]=e.AccessControlRequestHeaders,p.call(this,{Action:"name/cos:OptionsObject",method:"OPTIONS",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:n},(function(e,n){if(e)return e.statusCode&&403===e.statusCode?t(null,{OptionsForbidden:!0,statusCode:e.statusCode}):t(e);var r=n.headers||{};t(null,{AccessControlAllowOrigin:r["access-control-allow-origin"],AccessControlAllowMethods:r["access-control-allow-methods"],AccessControlAllowHeaders:r["access-control-allow-headers"],AccessControlExposeHeaders:r["access-control-expose-headers"],AccessControlMaxAge:r["access-control-max-age"],statusCode:n.statusCode,headers:n.headers})}))},putObjectCopy:function(e,t){var n=this,r=e.Headers;r["Cache-Control"]||r["cache-control"]||(r["Cache-Control"]="");var o=e.CopySource||"",a=i.getSourceParams.call(this,o);if(a){var s=a.Bucket,c=a.Region,l=decodeURIComponent(a.Key);p.call(this,{Scope:[{action:"name/cos:GetObject",bucket:s,region:c,prefix:l},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers},(function(r,o){if(r)return t(r);var a=i.clone(o.CopyObjectResult||{}),s=u({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,object:e.Key,isLocation:!0});i.extend(a,{Location:s,statusCode:o.statusCode,headers:o.headers}),t(null,a)}))}else t(i.error(new Error("CopySource format error")))},deleteMultipleObject:function(e,t){var n=e.Objects||[],r=e.Quiet;n=i.isArray(n)?n:[n];var o=i.json2xml({Delete:{Object:n,Quiet:r||!1}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=i.b64(i.md5(o));var s=i.map(n,(function(t){return{action:"name/cos:DeleteObject",bucket:e.Bucket,region:e.Region,prefix:t.Key}}));p.call(this,{Scope:s,method:"POST",Bucket:e.Bucket,Region:e.Region,body:o,action:"delete",headers:a},(function(e,n){if(e)return t(e);var r=n.DeleteResult||{},o=r.Deleted||[],a=r.Error||[];o=i.isArray(o)?o:[o],a=i.isArray(a)?a:[a];var s=i.clone(r);i.extend(s,{Error:a,Deleted:o,statusCode:n.statusCode,headers:n.headers}),t(null,s)}))},restoreObject:function(e,t){var n=e.Headers;if(e.RestoreRequest){var r=e.RestoreRequest||{},o=i.json2xml({RestoreRequest:r});n["Content-Type"]="application/xml",n["Content-MD5"]=i.b64(i.md5(o)),p.call(this,{Action:"name/cos:RestoreObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,body:o,action:"restore",headers:n},t)}else t(i.error(new Error("missing param RestoreRequest")))},putObjectTagging:function(e,t){var n=e.Tagging||{},r=n.TagSet||n.Tags||e.Tags||[];r=i.clone(i.isArray(r)?r:[r]);var o=i.json2xml({Tagging:{TagSet:{Tag:r}}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=i.b64(i.md5(o)),p.call(this,{Action:"name/cos:PutObjectTagging",method:"PUT",Bucket:e.Bucket,Key:e.Key,Region:e.Region,body:o,action:"tagging",headers:a,VersionId:e.VersionId},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getObjectTagging:function(e,t){p.call(this,{Action:"name/cos:GetObjectTagging",method:"GET",Key:e.Key,Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging",VersionId:e.VersionId},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"NoSuchTagSet"!==e.error.Code)t(e);else{var r={Tags:[],statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else{var o=[];try{o=n.Tagging.TagSet.Tag||[]}catch(a){}o=i.clone(i.isArray(o)?o:[o]),t(null,{Tags:o,statusCode:n.statusCode,headers:n.headers})}}))},deleteObjectTagging:function(e,t){p.call(this,{Action:"name/cos:DeleteObjectTagging",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"tagging",VersionId:e.VersionId},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},selectObjectContent:function(e,t){if(!e.SelectType)return t(i.error(new Error("missing param SelectType")));var n=e.SelectRequest||{},r=i.json2xml({SelectRequest:n}),o=e.Headers;o["Content-Type"]="application/xml",o["Content-MD5"]=i.b64(i.md5(r)),p.call(this,{Action:"name/cos:GetObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"select",qs:{"select-type":e.SelectType},VersionId:e.VersionId,body:r,DataType:"arraybuffer",rawBody:!0},(function(e,n){if(e&&204===e.statusCode)return t(null,{statusCode:e.statusCode});if(e)return t(e);var r=i.parseSelectPayload(n.body);t(null,{statusCode:n.statusCode,headers:n.headers,Body:r.body,Payload:r.payload})}))},appendObject:function(e,t){var n=e.Headers;n["Cache-Control"]||n["cache-control"]||(n["Cache-Control"]=""),n["Content-Type"]||n["content-type"]||(n["Content-Type"]=e.Body&&e.Body.type||""),p.call(this,{Action:"name/cos:AppendObject",method:"POST",Bucket:e.Bucket,Region:e.Region,action:"append",Key:e.Key,body:e.Body,qs:{position:e.Position},headers:e.Headers},(function(e,n){if(e)return t(e);t(null,n)}))},uploadPartCopy:function(e,t){var n=e.CopySource||"",r=i.getSourceParams.call(this,n);if(r){var o=r.Bucket,a=r.Region,s=decodeURIComponent(r.Key);p.call(this,{Scope:[{action:"name/cos:GetObject",bucket:o,region:a,prefix:s},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers},(function(e,n){if(e)return t(e);var r=i.clone(n.CopyPartResult||{});i.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)}))}else t(i.error(new Error("CopySource format error")))},multipartInit:function(e,t){var n=this,r=e.Headers,o=e.tracker;r["Cache-Control"]||r["cache-control"]||(r["Cache-Control"]=""),r["Content-Type"]||r["content-type"]||(r["Content-Type"]=e.Body&&e.Body.type||"");var a=e.Body&&(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5);a&&o&&o.setParams({md5StartTime:(new Date).getTime()}),i.getBodyMd5(a,e.Body,(function(r){r&&(e.Headers["x-cos-meta-md5"]=r),a&&o&&o.setParams({md5EndTime:(new Date).getTime()}),p.call(n,{Action:"name/cos:InitiateMultipartUpload",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"uploads",headers:e.Headers,qs:e.Query,tracker:o},(function(e,n){return e?(o&&o.parent&&o.parent.setParams({errorNode:"multipartInit"}),t(e)):(n=i.clone(n||{}))&&n.InitiateMultipartUploadResult?t(null,i.extend(n.InitiateMultipartUploadResult,{statusCode:n.statusCode,headers:n.headers})):void t(null,n)}))}),e.onHashProgress)},multipartUpload:function(e,t){var n=this;i.getFileSize("multipartUpload",e,(function(){var r=e.tracker,o=n.options.UploadCheckContentMd5;o&&r&&r.setParams({md5StartTime:(new Date).getTime()}),i.getBodyMd5(o,e.Body,(function(a){a&&(e.Headers["Content-MD5"]=i.b64(a)),o&&r&&r.setParams({md5EndTime:(new Date).getTime()}),r&&r.setParams({partNumber:e.PartNumber}),p.call(n,{Action:"name/cos:UploadPart",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers,onProgress:e.onProgress,body:e.Body||null,tracker:r},(function(e,n){if(e)return r&&r.parent&&r.parent.setParams({errorNode:"multipartUpload"}),t(e);t(null,{ETag:i.attr(n.headers,"etag",""),statusCode:n.statusCode,headers:n.headers})}))}))}))},multipartComplete:function(e,t){for(var n=this,r=e.UploadId,o=e.Parts,a=e.tracker,s=0,c=o.length;s<c;s++)o[s].ETag&&0===o[s].ETag.indexOf('"')||(o[s].ETag='"'+o[s].ETag+'"');var l=i.json2xml({CompleteMultipartUpload:{Part:o}});l=l.replace(/\n\s*/g,"");var d=e.Headers;d["Content-Type"]="application/xml",d["Content-MD5"]=i.b64(i.md5(l)),p.call(this,{Action:"name/cos:CompleteMultipartUpload",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,qs:{uploadId:r},body:l,headers:d,tracker:a},(function(r,o){if(r)return a&&a.parent&&a.parent.setParams({errorNode:"multipartComplete"}),t(r);var s=u({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,object:e.Key,isLocation:!0}),c=o.CompleteMultipartUploadResult||{};c.ProcessResults&&c&&c.ProcessResults&&(c.UploadResult={OriginalInfo:{Key:c.Key,Location:s,ETag:c.ETag,ImageInfo:c.ImageInfo},ProcessResults:c.ProcessResults},delete c.ImageInfo,delete c.ProcessResults);var l=i.extend(c,{Location:s,statusCode:o.statusCode,headers:o.headers});t(null,l)}))},multipartList:function(e,t){var n={};n.delimiter=e.Delimiter,n["encoding-type"]=e.EncodingType,n.prefix=e.Prefix||"",n["max-uploads"]=e.MaxUploads,n["key-marker"]=e.KeyMarker,n["upload-id-marker"]=e.UploadIdMarker,n=i.clearKey(n);var r=e.tracker;r&&r.setParams({signStartTime:(new Date).getTime()}),p.call(this,{Action:"name/cos:ListMultipartUploads",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,action:"uploads",tracker:r},(function(e,n){if(e)return r&&r.parent&&r.parent.setParams({errorNode:"multipartList"}),t(e);if(n&&n.ListMultipartUploadsResult){var o=n.ListMultipartUploadsResult.Upload||[];o=i.isArray(o)?o:[o],n.ListMultipartUploadsResult.Upload=o}var a=i.clone(n.ListMultipartUploadsResult||{});i.extend(a,{statusCode:n.statusCode,headers:n.headers}),t(null,a)}))},multipartListPart:function(e,t){var n={},r=e.tracker;n.uploadId=e.UploadId,n["encoding-type"]=e.EncodingType,n["max-parts"]=e.MaxParts,n["part-number-marker"]=e.PartNumberMarker,p.call(this,{Action:"name/cos:ListParts",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,qs:n},(function(e,n){if(e)return r&&r.parent&&r.parent.setParams({errorNode:"multipartListPart"}),t(e);var o=n.ListPartsResult||{},a=o.Part||[];a=i.isArray(a)?a:[a],o.Part=a;var s=i.clone(o);i.extend(s,{statusCode:n.statusCode,headers:n.headers}),t(null,s)}))},multipartAbort:function(e,t){var n={};n.uploadId=e.UploadId,p.call(this,{Action:"name/cos:AbortMultipartUpload",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,qs:n},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},request:function(e,t){p.call(this,{method:e.Method,Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:e.Action,headers:e.Headers,qs:e.Query,body:e.Body,Url:e.Url,rawBody:e.RawBody,DataType:e.DataType},(function(e,n){if(e)return t(e);n&&n.body&&(n.Body=n.body,delete n.body),t(e,n)}))},getObjectUrl:function(e,t){var n=this,r=void 0===e.UseAccelerate?n.options.UseAccelerate:e.UseAccelerate,o=u({ForcePathStyle:n.options.ForcePathStyle,protocol:e.Protocol||n.options.Protocol,domain:e.Domain||n.options.Domain,bucket:e.Bucket,region:r?"accelerate":e.Region,object:e.Key}),a="";e.Query&&(a+=i.obj2str(e.Query)),e.QueryString&&(a+=(a?"&":"")+e.QueryString);var s=o;if(void 0!==e.Sign&&!e.Sign)return a&&(s+="?"+a),t(null,{Url:s}),s;var c=l.call(this,{Bucket:e.Bucket,Region:e.Region,UseAccelerate:e.UseAccelerate,Url:o}),h=d.call(this,{Action:"PUT"===(e.Method||"").toUpperCase()?"name/cos:PutObject":"name/cos:GetObject",Bucket:e.Bucket||"",Region:e.Region||"",Method:e.Method||"get",Key:e.Key,Expires:e.Expires,Headers:e.Headers,Query:e.Query,SignHost:c,ForceSignHost:!1!==e.ForceSignHost&&n.options.ForceSignHost},(function(e,n){if(t)if(e)t(e);else{var r=o;r+="?"+(n.Authorization.indexOf("q-signature")>-1?function(e){var t=e.match(/q-url-param-list.*?(?=&)/g)[0],n="q-url-param-list="+encodeURIComponent(t.replace(/q-url-param-list=/,"")).toLowerCase(),r=new RegExp(t,"g");return e.replace(r,n)}(n.Authorization):"sign="+encodeURIComponent(n.Authorization)),n.SecurityToken&&(r+="&x-cos-security-token="+n.SecurityToken),n.ClientIP&&(r+="&clientIP="+n.ClientIP),n.ClientUA&&(r+="&clientUA="+n.ClientUA),n.Token&&(r+="&token="+n.Token),a&&(r+="&"+a),setTimeout((function(){t(null,{Url:r})}))}}));return h?(s+="?"+h.Authorization+(h.SecurityToken?"&x-cos-security-token="+h.SecurityToken:""),a&&(s+="&"+a)):a&&(s+="?"+a),s},getAuth:function(e){return i.getAuth({SecretId:e.SecretId||this.options.SecretId||"",SecretKey:e.SecretKey||this.options.SecretKey||"",Bucket:e.Bucket,Region:e.Region,Method:e.Method,Key:e.Key,Query:e.Query,Headers:e.Headers,Expires:e.Expires,UseRawKey:this.options.UseRawKey,SystemClockOffset:this.options.SystemClockOffset})}};e.exports.init=function(e,t){t.transferToTaskMethod(m,"putObject"),i.each(m,(function(t,n){e.prototype[n]=i.apiWrapper(n,t),function(e,t,n){i.each(["Cors","Acl"],(function(r){if(e.slice(-r.length)===r){var o=e.slice(0,-r.length)+r.toUpperCase(),a=i.apiWrapper(e,t),s=!1;n[o]=function(){!s&&console.warn("warning: cos."+o+" has been deprecated. Please Use cos."+e+" instead."),s=!0,a.apply(this,arguments)}}}))}(n,t,e.prototype)}))}},"./src/cos.js":
- /*!********************!*\
- !*** ./src/cos.js ***!
- \********************/
- /*! no static exports found */function(e,t,n){var r=n(/*! ./util */"./src/util.js"),o=n(/*! ./event */"./src/event.js"),i=n(/*! ./task */"./src/task.js"),a=n(/*! ./base */"./src/base.js"),s=n(/*! ./advance */"./src/advance.js"),c=n(/*! ../package.json */"./package.json"),u={AppId:"",SecretId:"",SecretKey:"",SecurityToken:"",ChunkRetryTimes:2,FileParallelLimit:3,ChunkParallelLimit:3,ChunkSize:1048576,SliceSize:1048576,CopyChunkParallelLimit:20,CopyChunkSize:10485760,CopySliceSize:10485760,MaxPartNumber:1e4,ProgressInterval:1e3,Domain:"",ServiceDomain:"",Protocol:"",CompatibilityMode:!1,ForcePathStyle:!1,UseRawKey:!1,Timeout:0,CorrectClockSkew:!0,SystemClockOffset:0,UploadCheckContentMd5:!1,UploadQueueSize:1e4,UploadAddMetaMd5:!1,UploadIdCacheLimit:50,UseAccelerate:!1,ForceSignHost:!0,EnableTracker:!1,DeepTracker:!1,TrackerDelay:5e3,CustomId:""},l=function(e){this.options=r.extend(r.clone(u),e||{}),this.options.FileParallelLimit=Math.max(1,this.options.FileParallelLimit),this.options.ChunkParallelLimit=Math.max(1,this.options.ChunkParallelLimit),this.options.ChunkRetryTimes=Math.max(0,this.options.ChunkRetryTimes),this.options.ChunkSize=Math.max(1048576,this.options.ChunkSize),this.options.CopyChunkParallelLimit=Math.max(1,this.options.CopyChunkParallelLimit),this.options.CopyChunkSize=Math.max(1048576,this.options.CopyChunkSize),this.options.CopySliceSize=Math.max(0,this.options.CopySliceSize),this.options.MaxPartNumber=Math.max(1024,Math.min(1e4,this.options.MaxPartNumber)),this.options.Timeout=Math.max(0,this.options.Timeout),this.options.AppId&&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")),r.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")),o.init(this),i.init(this)};a.init(l,i),s.init(l,i),l.util={md5:r.md5,xml2json:r.xml2json,json2xml:r.json2xml,encodeBase64:r.encodeBase64},l.getAuthorization=r.getAuth,l.version=c.version,e.exports=l},"./src/event.js":
- /*!**********************!*\
- !*** ./src/event.js ***!
- \**********************/
- /*! no static exports found */function(e,t){var n=function(e){var t={},n=function(e){return!t[e]&&(t[e]=[]),t[e]};e.on=function(e,t){"task-list-update"===e&&console.warn('warning: Event "'+e+'" has been deprecated. Please use "list-update" instead.'),n(e).push(t)},e.off=function(e,t){for(var r=n(e),o=r.length-1;o>=0;o--)t===r[o]&&r.splice(o,1)},e.emit=function(e,t){for(var r=n(e).map((function(e){return e})),o=0;o<r.length;o++)r[o](t)}};e.exports.init=n,e.exports.EventProxy=function(){n(this)}},"./src/session.js":
- /*!************************!*\
- !*** ./src/session.js ***!
- \************************/
- /*! no static exports found */function(e,t,n){var r,o,i=n(/*! ./util */"./src/util.js"),a="cos_sdk_upload_cache",s=function(){try{var e=JSON.parse(localStorage.getItem(a))}catch(t){}e||(e=[]),r=e},c=function(){try{r.length?localStorage.setItem(a,JSON.stringify(r)):localStorage.removeItem(a)}catch(e){}},u=function(){if(!r){s.call(this);for(var e=!1,t=Math.round(Date.now()/1e3),n=r.length-1;n>=0;n--){var o=r[n][2];(!o||o+2592e3<t)&&(r.splice(n,1),e=!0)}e&&c()}},l=function(){o||(o=setTimeout((function(){c(),o=null}),400))},d={using:{},setUsing:function(e){d.using[e]=!0},removeUsing:function(e){delete d.using[e]},getFileId:function(e,t,n,r){return e.name&&e.size&&e.lastModifiedDate&&t?i.md5([e.name,e.size,e.lastModifiedDate,t,n,r].join("::")):null},getCopyFileId:function(e,t,n,r,o){var a=t["content-length"],s=t.etag||"",c=t["last-modified"];return e&&n?i.md5([e,a,s,c,n,r,o].join("::")):null},getUploadIdList:function(e){if(!e)return null;u.call(this);for(var t=[],n=0;n<r.length;n++)r[n][0]===e&&t.push(r[n][1]);return t.length?t:null},saveUploadId:function(e,t,n){if(u.call(this),e){for(var o=r.length-1;o>=0;o--){var i=r[o];i[0]===e&&i[1]===t&&r.splice(o,1)}r.unshift([e,t,Math.round(Date.now()/1e3)]),r.length>n&&r.splice(n),l()}},removeUploadId:function(e){u.call(this),delete d.using[e];for(var t=r.length-1;t>=0;t--)r[t][1]===e&&r.splice(t,1);l()}};e.exports=d},"./src/task.js":
- /*!*********************!*\
- !*** ./src/task.js ***!
- \*********************/
- /*! no static exports found */function(e,t,n){var r=n(/*! ./session */"./src/session.js"),o=n(/*! ./util */"./src/util.js"),i={};e.exports.transferToTaskMethod=function(e,t){i[t]=e[t],e[t]=function(e,n){e.SkipTask?i[t].call(this,e,n):this._addTask(t,e,n)}},e.exports.init=function(e){var t,n,a=[],s={},c=0,u=0,l=function(e){var t={id:e.id,Bucket:e.Bucket,Region:e.Region,Key:e.Key,FilePath:e.FilePath,state:e.state,loaded:e.loaded,size:e.size,speed:e.speed,percent:e.percent,hashPercent:e.hashPercent,error:e.error};return e.FilePath&&(t.FilePath=e.FilePath),e._custom&&(t._custom=e._custom),t},d=(n=function(){t=0,e.emit("task-list-update",{list:o.map(a,l)}),e.emit("list-update",{list:o.map(a,l)})},function(){t||(t=setTimeout(n))}),h=function(){if(!(a.length<=e.options.UploadQueueSize)){for(var t=0;t<u&&t<a.length&&a.length>e.options.UploadQueueSize;){var n="waiting"===a[t].state||"checking"===a[t].state||"uploading"===a[t].state;a[t]&&n?t++:(s[a[t].id]&&delete s[a[t].id],a.splice(t,1),u--)}d()}},p=function t(){if(!(c>=e.options.FileParallelLimit)){for(;a[u]&&"waiting"!==a[u].state;)u++;if(!(u>=a.length)){var n=a[u];u++,c++,n.state="checking",n.params.onTaskStart&&n.params.onTaskStart(l(n)),!n.params.UploadData&&(n.params.UploadData={});var r=o.formatParams(n.api,n.params);i[n.api].call(e,r,(function(r,o){e._isRunningTask(n.id)&&("checking"!==n.state&&"uploading"!==n.state||(n.state=r?"error":"success",r&&(n.error=r),c--,d(),t(),n.callback&&n.callback(r,o),"success"===n.state&&(n.params&&(delete n.params.UploadData,delete n.params.Body,delete n.params),delete n.callback)),h())})),d(),setTimeout(t)}}},f=function(t,n){var o=s[t];if(o){var i=o&&"waiting"===o.state,a=o&&("checking"===o.state||"uploading"===o.state);if("canceled"===n&&"canceled"!==o.state||"paused"===n&&i||"paused"===n&&a){if("paused"===n&&o.params.Body&&"function"==typeof o.params.Body.pipe)return void console.error("stream not support pause");o.state=n,e.emit("inner-kill-task",{TaskId:t,toState:n});try{var u=o&&o.params&&o.params.UploadData.UploadId}catch(l){}"canceled"===n&&u&&r.removeUsing(u),d(),a&&(c--,p()),"canceled"===n&&(o.params&&(delete o.params.UploadData,delete o.params.Body,delete o.params),delete o.callback)}h()}};e._addTasks=function(t){o.each(t,(function(t){e._addTask(t.api,t.params,t.callback,!0)})),d()};var m=!0;e._addTask=function(t,n,r,i){n=o.formatParams(t,n);var c=o.uuid();n.TaskId=c,n.onTaskReady&&n.onTaskReady(c),n.TaskReady&&(n.TaskReady(c),m&&console.warn('warning: Param "TaskReady" has been deprecated. Please use "onTaskReady" instead.'),m=!1);var u={params:n,callback:r,api:t,index:a.length,id:c,Bucket:n.Bucket,Region:n.Region,Key:n.Key,FilePath:n.FilePath||"",state:"waiting",loaded:0,size:0,speed:0,percent:0,hashPercent:0,error:null,_custom:n._custom},l=n.onHashProgress;n.onHashProgress=function(t){e._isRunningTask(u.id)&&(u.hashPercent=t.percent,l&&l(t),d())};var f=n.onProgress;return n.onProgress=function(t){e._isRunningTask(u.id)&&("checking"===u.state&&(u.state="uploading"),u.loaded=t.loaded,u.speed=t.speed,u.percent=t.percent,f&&f(t),d())},o.getFileSize(t,n,(function(e,t){if(e)return r(o.error(e));s[c]=u,a.push(u),u.size=t,!i&&d(),p(),h()})),c},e._isRunningTask=function(e){var t=s[e];return!(!t||"checking"!==t.state&&"uploading"!==t.state)},e.getTaskList=function(){return o.map(a,l)},e.cancelTask=function(e){f(e,"canceled")},e.pauseTask=function(e){f(e,"paused")},e.restartTask=function(e){var t=s[e];!t||"paused"!==t.state&&"error"!==t.state||(t.state="waiting",d(),u=Math.min(u,t.index),p())},e.isUploadRunning=function(){return c||u<a.length}}},"./src/tracker.js":
- /*!************************!*\
- !*** ./src/tracker.js ***!
- \************************/
- /*! no static exports found */function(e,t,n){var r=n(/*! @babel/runtime/helpers/classCallCheck */"./node_modules/@babel/runtime/helpers/classCallCheck.js"),o=n(/*! @babel/runtime/helpers/createClass */"./node_modules/@babel/runtime/helpers/createClass.js"),i=n(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js"),a=n(/*! ../package.json */"./package.json"),s=null,c=function(e){if(!s){var t=n(/*! ../lib/beacon.min */"./lib/beacon.min.js");s=new t({appkey:"0AND0VEVB24UBGDU",versionCode:a.version,channelID:"js_sdk",openid:"openid",unionid:"unid",strictMode:!1,delay:e,sessionDuration:6e4})}return s},u=function(){var e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},l=function(){if("object"===("undefined"==typeof navigator?"undefined":i(navigator))){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return(null==e?void 0:e.type)||(null==e?void 0:e.effectiveType)||"unknown"}return"unknown"},d=function(){if("object"!==("undefined"==typeof navigator?"undefined":i(navigator)))return"unknown os";var e=navigator.userAgent.toLowerCase(),t=/macintosh|mac os x/i.test(navigator.userAgent);return e.indexOf("win32")>=0||e.indexOf("wow32")>=0?"win32":e.indexOf("win64")>=0||e.indexOf("wow64")>=0?"win64":t?"mac":"unknown os"},h=function(){return!("object"!==("undefined"==typeof navigator?"undefined":i(navigator))||!navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))},p=function(){return!("object"!==("undefined"==typeof navigator?"undefined":i(navigator))||!navigator.userAgent.match(/(Android|Adr|Linux)/i))},f=function(){return!("object"!==("undefined"==typeof navigator?"undefined":i(navigator))||!navigator.userAgent.match(/(iPhone|iPod|iPad|iOS)/i))},m=function(){if("object"!==("undefined"==typeof navigator?"undefined":i(navigator)))return"unknown device";var e=navigator.userAgent.toLowerCase();if(e.includes("app/tencent_wemeet"))return"tencent_wemeet";if(e.indexOf("maxthon")>=0){var t=e.match(/maxthon\/([\d.]+)/),n=t&&t[1]||"";return"傲游浏览器 ".concat(n).trim()}if(e.indexOf("qqbrowser")>=0){var r=e.match(/qqbrowser\/([\d.]+)/),o=r&&r[1]||"";return"QQ浏览器 ".concat(o).trim()}if(e.indexOf("se 2.x")>=0)return"搜狗浏览器";if(e.indexOf("wxwork")>=0)return"微信内置浏览器";if(e.indexOf("msie")>=0){var a=e.match(/msie ([\d.]+)/),s=a&&a[1]||"";return"IE ".concat(s).trim()}if(e.indexOf("firefox")>=0){var c=e.match(/firefox\/([\d.]+)/),u=c&&c[1]||"";return"Firefox ".concat(u).trim()}if(e.indexOf("chrome")>=0){var l=e.match(/chrome\/([\d.]+)/),d=l&&l[1]||"";return"Chrome ".concat(d).trim()}if(e.indexOf("opera")>=0){var h=e.match(/opera.([\d.]+)/),p=h&&h[1]||"";return"Opera ".concat(p).trim()}if(e.indexOf("safari")>=0){var f=e.match(/version\/([\d.]+)/),m=f&&f[1]||"";return"Safari ".concat(m).trim()}if(e.indexOf("edge")>=0){var g=e.match(/edge\/([\d.]+)/),y=g&&g[1]||"";return"edge ".concat(y).trim()}return e.substr(0,200)},g={isMobile:h(),isBrowser:!h(),mobileOsType:p()?"android":f?"ios":"other_mobile",pcOsType:d()},y={deviceType:g.isMobile?"mobile":g.isBrowser?"browser":"unknown",devicePlatform:g.isMobile?g.mobileOsType:g.pcOsType,deviceName:m()},v=["multipartInit","multipartUpload","multipartComplete","multipartList","multipartListPart","multipartAbort"],C=["putObject","postObject","appendObject","sliceUploadFile","uploadFile","uploadFiles"].concat(v),b=["getObject"];function S(e){return e.replace(/([A-Z])/g,"_$1").toLowerCase()}var E=function(){function e(t){r(this,e);var n=t.parent,o=t.traceId,i=t.bucket,s=t.region,l=t.apiName,d=t.fileKey,h=t.fileSize,p=t.accelerate,f=t.customId,m=t.delay,g=t.deepTracker,v=i&&i.substr(i.lastIndexOf("-")+1)||"";this.parent=n,this.deepTracker=g,this.delay=m,this.params={cossdkVersion:a.version,region:s,networkType:"",host:"",accelerate:p?"Y":"N",requestPath:d||"",size:h||-1,httpMd5:0,httpSign:0,httpFull:0,name:l||"",result:"",tookTime:0,errorNode:"",errorCode:"",errorMessage:"",errorRequestId:"",errorStatusCode:0,errorServiceName:"",tracePlatform:"cos-js-sdk-v5",traceId:o||u(),bucket:i,appid:v,partNumber:0,retryTimes:0,reqUrl:"",customId:f||"",deviceType:y.deviceType,devicePlatform:y.devicePlatform,deviceName:y.deviceName,md5StartTime:0,md5EndTime:0,signStartTime:0,signEndTime:0,httpStartTime:0,httpEndTime:0,startTime:(new Date).getTime(),endTime:0},this.beacon=c(m)}return o(e,[{key:"formatResult",value:function(e,t){var n,r,o,i,a,s,c=(new Date).getTime()-this.params.startTime,u=l(),d=e?(null==e?void 0:e.code)||(null==e||null===(n=e.error)||void 0===n?void 0:n.code)||(null==e||null===(r=e.error)||void 0===r?void 0:r.Code):"",h=e?(null==e?void 0:e.message)||(null==e||null===(o=e.error)||void 0===o?void 0:o.message)||(null==e||null===(i=e.error)||void 0===i?void 0:i.Message):"",p=e?(null==e?void 0:e.resource)||(null==e||null===(a=e.error)||void 0===a?void 0:a.resource)||(null==e||null===(s=e.error)||void 0===s?void 0:s.Resource):"",f=e?null==e?void 0:e.statusCode:t.statusCode,m=e?(null==e?void 0:e.headers)&&(null==e?void 0:e.headers["x-cos-request-id"]):(null==t?void 0:t.headers)&&(null==t?void 0:t.headers["x-cos-request-id"]),g=e?m?"Server":"Client":"";if(Object.assign(this.params,{tookTime:c,networkType:u,httpMd5:this.params.md5EndTime-this.params.md5StartTime,httpSign:this.params.signEndTime-this.params.signStartTime,httpFull:this.params.httpEndTime-this.params.httpStartTime,result:e?"Fail":"Success",errorType:g,errorCode:d,errorStatusCode:f,errorMessage:h,errorServiceName:p,errorRequestId:m}),!e||d&&h||(this.params.fullError=e?JSON.stringify(e):""),"getObject"===this.params.name&&(this.params.size=t?t.headers&&t.headers["content-length"]:-1),this.params.reqUrl)try{var y=/^http(s)?:\/\/(.*?)\//.exec(this.params.reqUrl);this.params.host=y[2]}catch(v){this.params.host=this.params.reqUrl}this.sendEvents()}},{key:"setParams",value:function(e){Object.assign(this.params,e)}},{key:"sendEvents",value:function(){if(!v.includes(this.params.name)||this.deepTracker){var e,t=(e=this.params.name,C.includes(e)?"cos_upload":b.includes(e)?"cos_download":"base_service"),n=function(e){var t={},n="Success"===e.result?["tracePlatform","cossdkVersion","region","bucket","appid","networkType","host","accelerate","requestPath","partNumber","size","name","result","tookTime","errorRequestId","retryTimes","reqUrl","customId","deviceType","devicePlatform","deviceName"]:["tracePlatform","cossdkVersion","region","networkType","host","accelerate","requestPath","size","httpMd5","httpSign","httpFull","name","result","tookTime","errorNode","errorCode","errorMessage","errorRequestId","errorStatusCode","errorServiceName","errorType","traceId","bucket","appid","partNumber","retryTimes","reqUrl","customId","fullError","deviceType","devicePlatform","deviceName"];for(var r in e)n.includes(r)&&(t[S(r)]=e[r]);return t}(this.params);this.beacon||(this.beacon=c(this.delay||5e3)),0===this.delay?this.beacon&&this.beacon.onDirectUserAction(t,n):this.beacon&&this.beacon.onUserAction(t,n)}}},{key:"generateSubTracker",value:function(t){return Object.assign(t,{parent:this,deepTracker:this.deepTracker,traceId:this.params.traceId,bucket:this.params.bucket,region:this.params.region,fileKey:this.params.requestPath,customId:this.params.customId,delay:this.delay}),new e(t)}}]),e}();e.exports=E},"./src/util.js":
- /*!*********************!*\
- !*** ./src/util.js ***!
- \*********************/
- /*! no static exports found */function(e,t,n){(function(t){var r=n(/*! @babel/runtime/helpers/typeof */"./node_modules/@babel/runtime/helpers/typeof.js"),o=n(/*! ../lib/md5 */"./lib/md5.js"),i=n(/*! ../lib/crypto */"./lib/crypto.js"),a=n(/*! ../lib/xml2json */"./lib/xml2json.js"),s=n(/*! ../lib/json2xml */"./lib/json2xml.js"),c=n(/*! ../lib/base64 */"./lib/base64.js"),u=n(/*! ./tracker */"./src/tracker.js");function l(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function d(e,t){var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(t?l(r).toLowerCase():r);return n.sort((function(e,t){return(e=e.toLowerCase())===(t=t.toLowerCase())?0:e>t?1:-1}))}var h,p=["cache-control","content-disposition","content-encoding","content-length","content-md5","expect","expires","host","if-match","if-modified-since","if-none-match","if-unmodified-since","origin","range","transfer-encoding"],f=function(e,t,n){var r=t/8,o=e.slice(n,n+r);return new Uint8Array(o).reverse(),new{8:Uint8Array,16:Uint16Array,32:Uint32Array}[t](o)[0]},m=function(e,t,n,r){var o=e.slice(t,n),i="";return new Uint8Array(o).forEach((function(e){i+=String.fromCharCode(e)})),r&&(i=decodeURIComponent(escape(i))),i},g=function(){},y=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&void 0!==e[n]&&null!==e[n]&&(t[n]=e[n]);return t},v=(h=function(e,t){e=e.split("."),t=t.split(".");for(var n=0;n<t.length;n++)if(e[n]!==t[n])return parseInt(e[n])>parseInt(t[n])?1:-1;return 0},function(e){if(!e)return!1;var t=(e.match(/Chrome\/([.\d]+)/)||[])[1],n=(e.match(/QBCore\/([.\d]+)/)||[])[1],r=(e.match(/QQBrowser\/([.\d]+)/)||[])[1];return t&&h(t,"53.0.2785.116")<0&&n&&h(n,"3.53.991.400")<0&&r&&h(r,"9.0.2524.400")<=0||!1}("undefined"!=typeof navigator&&navigator.userAgent)),C=1048576;function b(e){return k(e,(function(e){return"object"===r(e)&&null!==e?b(e):e}))}function S(e,t){return T(t,(function(n,r){e[r]=t[r]})),e}function E(e){return e instanceof Array}function T(e,t){for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)}function k(e,t){var n=E(e)?[]:{};for(var r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r],r));return n}var w=function(e,t){var n=t.Bucket,r=t.Region,o=t.Key,i=this.options.Domain,a=!i||"string"==typeof i&&i.indexOf("{Bucket}")>-1,s=!i||"string"==typeof i&&i.indexOf("{Region}")>-1;if(e.indexOf("Bucket")>-1||"deleteMultipleObject"===e||"multipartList"===e||"listObjectVersions"===e){if(a&&!n)return"Bucket";if(s&&!r)return"Region"}else if(e.indexOf("Object")>-1||e.indexOf("multipart")>-1||"sliceUploadFile"===e||"abortUploadTask"===e){if(a&&!n)return"Bucket";if(s&&!r)return"Region";if(!o)return"Key"}return!1},A=function(e,t){if(t=S({},t),"getAuth"!==e&&"getV4Auth"!==e&&"getObjectUrl"!==e){var n=t.Headers||{};t&&"object"===r(t)&&(!function(){for(var e in t)t.hasOwnProperty(e)&&e.indexOf("x-cos-")>-1&&(n[e]=t[e])}(),N.each({"x-cos-mfa":"MFA","Content-MD5":"ContentMD5","Content-Length":"ContentLength","Content-Type":"ContentType",Expect:"Expect",Expires:"Expires","Cache-Control":"CacheControl","Content-Disposition":"ContentDisposition","Content-Encoding":"ContentEncoding",Range:"Range","If-Modified-Since":"IfModifiedSince","If-Unmodified-Since":"IfUnmodifiedSince","If-Match":"IfMatch","If-None-Match":"IfNoneMatch","x-cos-copy-source":"CopySource","x-cos-copy-source-Range":"CopySourceRange","x-cos-metadata-directive":"MetadataDirective","x-cos-copy-source-If-Modified-Since":"CopySourceIfModifiedSince","x-cos-copy-source-If-Unmodified-Since":"CopySourceIfUnmodifiedSince","x-cos-copy-source-If-Match":"CopySourceIfMatch","x-cos-copy-source-If-None-Match":"CopySourceIfNoneMatch","x-cos-acl":"ACL","x-cos-grant-read":"GrantRead","x-cos-grant-write":"GrantWrite","x-cos-grant-full-control":"GrantFullControl","x-cos-grant-read-acp":"GrantReadAcp","x-cos-grant-write-acp":"GrantWriteAcp","x-cos-storage-class":"StorageClass","x-cos-traffic-limit":"TrafficLimit","x-cos-mime-limit":"MimeLimit","x-cos-server-side-encryption-customer-algorithm":"SSECustomerAlgorithm","x-cos-server-side-encryption-customer-key":"SSECustomerKey","x-cos-server-side-encryption-customer-key-MD5":"SSECustomerKeyMD5","x-cos-server-side-encryption":"ServerSideEncryption","x-cos-server-side-encryption-cos-kms-key-id":"SSEKMSKeyId","x-cos-server-side-encryption-context":"SSEContext","Pic-Operations":"PicOperations"},(function(e,r){void 0!==t[e]&&(n[r]=t[e])})),t.Headers=y(n))}return t},x=function(e){return Date.now()+(e||0)},_="object"===("undefined"==typeof navigator?"undefined":r(navigator))&&!!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),O="object"===("undefined"==typeof navigator?"undefined":r(navigator))&&/\sQQ/i.test(navigator.userAgent),N={noop:g,formatParams:A,apiWrapper:function(e,t){return function(n,r){var o,i=this;if("function"==typeof n&&(r=n,n={}),n=A(e,n),i.options.EnableTracker)if("sliceUploadFile"===n.calledBySdk)o=n.tracker&&n.tracker.generateSubTracker({apiName:e});else if(["uploadFile","uploadFiles"].includes(e))o=null;else{var a=-1;n.Body&&(a="string"==typeof n.Body?n.Body.length:n.Body.size||n.Body.byteLength||-1),o=new u({bucket:n.Bucket,region:n.Region,apiName:e,fileKey:n.Key,fileSize:a,deepTracker:i.options.DeepTracker,customId:i.options.CustomId,delay:i.options.TrackerDelay})}n.tracker=o;var s=function(e){return e&&e.headers&&(e.headers["x-cos-request-id"]&&(e.RequestId=e.headers["x-cos-request-id"]),e.headers["x-ci-request-id"]&&(e.RequestId=e.headers["x-ci-request-id"]),e.headers["x-cos-version-id"]&&(e.VersionId=e.headers["x-cos-version-id"]),e.headers["x-cos-delete-marker"]&&(e.DeleteMarker=e.headers["x-cos-delete-marker"])),e},c=function(e,t){o&&o.formatResult(e,t),r&&r(s(e),s(t))},l=function(){if("getService"!==e&&"abortUploadTask"!==e){var t=w.call(i,e,n);if(t)return"missing param "+t;if(n.Region){if(i.options.CompatibilityMode){if(!/^([a-z\d-.]+)$/.test(n.Region))return"Region format error."}else{if(n.Region.indexOf("cos.")>-1)return'param Region should not be start with "cos."';if(!/^([a-z\d-]+)$/.test(n.Region))return"Region format error."}i.options.CompatibilityMode||-1!==n.Region.indexOf("-")||"yfb"===n.Region||"default"===n.Region||"accelerate"===n.Region||console.warn("warning: param Region format error, find help here: https://cloud.tencent.com/document/product/436/6224")}if(n.Bucket){if(!/^([a-z\d-]+)-(\d+)$/.test(n.Bucket))if(n.AppId)n.Bucket=n.Bucket+"-"+n.AppId;else{if(!i.options.AppId)return'Bucket should format as "test-1250000000".';n.Bucket=n.Bucket+"-"+i.options.AppId}n.AppId&&(console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g Bucket:"test-1250000000" ).'),delete n.AppId)}!i.options.UseRawKey&&n.Key&&"/"===n.Key.substr(0,1)&&(n.Key=n.Key.substr(1))}}(),d=["getAuth","getObjectUrl"].includes(e);if("function"==typeof Promise&&!d&&!r)return new Promise((function(e,o){if(r=function(t,n){t?o(t):e(n)},l)return c(N.error(new Error(l)));t.call(i,n,c)}));if(l)return c(N.error(new Error(l)));var h=t.call(i,n,c);return d?h:void 0}},xml2json:a,json2xml:s,md5:o,clearKey:y,fileSlice:function(e,t,n,r,o){var i;if(e.slice?i=e.slice(t,n):e.mozSlice?i=e.mozSlice(t,n):e.webkitSlice&&(i=e.webkitSlice(t,n)),r&&v){var a=new FileReader;a.onload=function(e){i=null,o(new Blob([a.result]))},a.readAsArrayBuffer(i)}else o(i)},getBodyMd5:function(e,t,n,r){n=n||g,e?"string"==typeof t?n(N.md5(t,!0)):Blob&&t instanceof Blob?N.getFileMd5(t,(function(e,t){n(t)}),r):n():n()},getFileMd5:function(e,t,n){var r=e.size,i=0,a=o.getCtx();!function o(s){if(s>=r){var c=a.digest("hex");t(null,c)}else{var u=Math.min(r,s+C);N.fileSlice(e,s,u,!1,(function(e){!function(e,t){var n,r=new FileReader;FileReader.prototype.readAsBinaryString?(n=FileReader.prototype.readAsBinaryString,r.onload=function(){t(this.result)}):FileReader.prototype.readAsArrayBuffer?n=function(e){var n="",r=new FileReader;r.onload=function(e){for(var o=new Uint8Array(r.result),i=o.byteLength,a=0;a<i;a++)n+=String.fromCharCode(o[a]);t(n)},r.readAsArrayBuffer(e)}:console.error("FileReader not support readAsBinaryString"),n.call(r,e)}(e,(function(t){e=null,a=a.update(t,!0),i+=t.length,t=null,n&&n({loaded:i,total:r,percent:Math.round(i/r*1e4)/1e4}),o(s+C)}))}))}}(0)},b64:function(e){var t,n,r,o="";for(t=0,n=e.length/2;t<n;t++)r=parseInt(e[2*t]+e[2*t+1],16),o+=String.fromCharCode(r);return btoa(o)},extend:S,isArray:E,isInArray:function(e,t){for(var n=!1,r=0;r<e.length;r++)if(t===e[r]){n=!0;break}return n},makeArray:function(e){return E(e)?e:[e]},each:T,map:k,filter:function(e,t){var n=E(e),r=n?[]:{};for(var o in e)e.hasOwnProperty(o)&&t(e[o],o)&&(n?r.push(e[o]):r[o]=e[o]);return r},clone:b,attr:function(e,t,n){return e&&t in e?e[t]:n},uuid:function(){var e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},camSafeUrlEncode:l,throttleOnProgress:function(e,t){var n,r,o=this,i=0,a=0,s=Date.now();function c(){if(r=0,t&&"function"==typeof t){n=Date.now();var o,c=Math.max(0,Math.round((a-i)/((n-s)/1e3)*100)/100)||0;o=0===a&&0===e?1:Math.floor(a/e*100)/100||0,s=n,i=a;try{t({loaded:a,total:e,speed:c,percent:o})}catch(u){}}}return function(t,n){if(t&&(a=t.loaded,e=t.total),n)clearTimeout(r),c();else{if(r)return;r=setTimeout(c,o.options.ProgressInterval)}}},getFileSize:function(e,t,n){var r;"string"==typeof t.Body?t.Body=new Blob([t.Body],{type:"text/plain"}):t.Body instanceof ArrayBuffer&&(t.Body=new Blob([t.Body])),t.Body&&(t.Body instanceof Blob||"[object File]"===t.Body.toString()||"[object Blob]"===t.Body.toString())?(r=t.Body.size,t.ContentLength=r,n(null,r)):n(N.error(new Error("params body format error, Only allow File|Blob|String.")))},getSkewTime:x,error:function(e,t){var n=e;return e.message=e.message||null,"string"==typeof t?(e.error=t,e.message=t):"object"===r(t)&&null!==t&&(S(e,t),(t.code||t.name)&&(e.code=t.code||t.name),t.message&&(e.message=t.message),t.stack&&(e.stack=t.stack)),"function"==typeof Object.defineProperty&&(Object.defineProperty(e,"name",{writable:!0,enumerable:!1}),Object.defineProperty(e,"message",{enumerable:!0})),e.name=t&&t.name||e.name||e.code||"Error",e.code||(e.code=e.name),e.error||(e.error=b(n)),e},obj2str:function(e,t){var n,r,o,i=[],a=d(e);for(n=0;n<a.length;n++)o=void 0===e[r=a[n]]||null===e[r]?"":""+e[r],r=t?l(r).toLowerCase():l(r),o=l(o)||"",i.push(r+"="+o);return i.join("&")},getAuth:function(e){var t,n=(e=e||{}).SecretId,r=e.SecretKey,o=e.KeyTime,a=(e.method||e.Method||"get").toLowerCase(),s=b(e.Query||e.params||{}),c=function(e){var t={};for(var n in e){var r=n.toLowerCase();(r.indexOf("x-cos-")>-1||p.indexOf(r)>-1)&&(t[n]=e[n])}return t}(b(e.Headers||e.headers||{})),u=e.Key||"";e.UseRawKey?t=e.Pathname||e.pathname||"/"+u:0!==(t=e.Pathname||e.pathname||u).indexOf("/")&&(t="/"+t);var l=!1!==e.ForceSignHost;if(!c.Host&&!c.host&&e.Bucket&&e.Region&&l&&(c.Host=e.Bucket+".cos."+e.Region+".myqcloud.com"),!n)throw new Error("missing param SecretId");if(!r)throw new Error("missing param SecretKey");var h=Math.round(x(e.SystemClockOffset)/1e3)-1,f=h,m=e.Expires||e.expires;f+=void 0===m?900:1*m||0;var g=n,y=o||h+";"+f,v=o||h+";"+f,C=d(c,!0).join(";").toLowerCase(),S=d(s,!0).join(";").toLowerCase(),E=i.HmacSHA1(v,r).toString(),T=[a,t,N.obj2str(s,!0),N.obj2str(c,!0),""].join("\n"),k=["sha1",y,i.SHA1(T).toString(),""].join("\n");return["q-sign-algorithm=sha1","q-ak="+g,"q-sign-time="+y,"q-key-time="+v,"q-header-list="+C,"q-url-param-list="+S,"q-signature="+i.HmacSHA1(k,E).toString()].join("&")},parseSelectPayload:function(e){for(var t={},n=m(e),r={records:[]};e.byteLength;){var o,i=f(e,32,0),a=f(e,32,4),s=i-a-16,c=0;for(e=e.slice(12);c<a;){var u=f(e,8,c),l=m(e,c+1,c+1+u),d=f(e,16,c+u+2),h=m(e,c+u+4,c+u+4+d);t[l]=h,c+=u+4+d}if("Records"===t[":event-type"])o=m(e,c,c+s,!0),r.records.push(o);else if("Stats"===t[":event-type"])o=m(e,c,c+s,!0),r.stats=N.xml2json(o).Stats;else if("error"===t[":event-type"]){var p=t[":error-code"],g=t[":error-message"],y=new Error(g);y.message=g,y.name=y.code=p,r.error=y}e=e.slice(c+s+4)}return{payload:r.records.join(""),body:n}},getSourceParams:function(e){var t=this.options.CopySourceParser;if(t)return t(e);var n=e.match(/^([^.]+-\d+)\.cos(v6|-cdc|-cdz|-internal)?\.([^.]+)\.((myqcloud\.com)|(tencentcos\.cn))\/(.+)$/);return n?{Bucket:n[1],Region:n[3],Key:n[7]}:null},isBrowser:!0,isNode:function(){return"object"!==("undefined"==typeof window?"undefined":r(window))&&"object"===(void 0===t?"undefined":r(t))&&!("object"===("undefined"==typeof globalThis?"undefined":r(globalThis))&&("DedicatedWorkerGlobalScope"===globalThis.constructor.name||globalThis.FileReaderSync))},isCIHost:function(e){return/^https?:\/\/([^/]+\.)?ci\.[^/]+/.test(e)},isIOS_QQ:_&&O,encodeBase64:function(e,t){var n=c.encode(e);return t&&(n=n.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")),n}};e.exports=N}).call(this,n(/*! ./../node_modules/process/browser.js */"./node_modules/process/browser.js"))}})},module.exports=factory()})(cosJsSdkV5);var cosJsSdkV5Exports=cosJsSdkV5.exports;const COS=getDefaultExportFromCjs(cosJsSdkV5Exports),ossSwitch="tencent",tencentBucket="daya-online-1303457149",getUploadSign=exports("g",(async e=>{const{bucketName:t,filename:n,postData:r}=e,o=ossSwitch;let i=t,a=n,s={};return i=tencentBucket,a="ktyq/"+n,s={key:"ktyq/"+r.key},request.post("/edu-app/open/getUploadSign",{data:{postData:s,pluginName:o,bucketName:i,filename:a},params:{pluginName:o}})})),onFileUpload=exports("o",(({file:e,action:t,data:n,onProgress:r,onFinish:o,onError:i})=>{new COS({Domain:"https://oss.dayaedu.com",Protocol:"https",getAuthorization:async(e,t)=>{t({Authorization:n.signature})}}).uploadFile({Bucket:tencentBucket,Region:"ap-nanjing",Key:`ktyq/${n.name}`,Body:n.file.file,SliceSize:524288e3,onProgress:function(e){r({percent:Math.ceil(100*(e.percent||0))})}}).then((t=>{t.Location?.indexOf("http")>=0?e.url=t.Location:e.url="https://"+t.Location,o()})).catch((e=>{console.log(e,"error"),i()}))})),onOnlyFileUpload=exports("a",(async(e,t)=>{{let e="",n=null;const r=new COS({Domain:"https://oss.dayaedu.com",Protocol:"https",getAuthorization:async(e,n)=>{n({Authorization:t.signature})}});if(await r.uploadFile({Bucket:tencentBucket,Region:"ap-nanjing",Key:`ktyq/${t.name}`,Body:t.file,SliceSize:524288e3}).then((t=>{e=t.Location?.indexOf("http")>=0?t.Location:"https://"+t.Location})).catch((e=>{n=e})),e)return e;throw new Error(n)}}));
- /*!
- * 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(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach((function(t){_defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var IS_BROWSER="undefined"!=typeof window&&void 0!==window.document,WINDOW=IS_BROWSER?window:{},IS_TOUCH_DEVICE=!(!IS_BROWSER||!WINDOW.document.documentElement)&&"ontouchstart"in WINDOW.document.documentElement,HAS_POINTER_EVENT=!!IS_BROWSER&&"PointerEvent"in WINDOW,NAMESPACE="cropper",ACTION_ALL="all",ACTION_CROP="crop",ACTION_MOVE="move",ACTION_ZOOM="zoom",ACTION_EAST="e",ACTION_WEST="w",ACTION_SOUTH="s",ACTION_NORTH="n",ACTION_NORTH_EAST="ne",ACTION_NORTH_WEST="nw",ACTION_SOUTH_EAST="se",ACTION_SOUTH_WEST="sw",CLASS_CROP="".concat(NAMESPACE,"-crop"),CLASS_DISABLED="".concat(NAMESPACE,"-disabled"),CLASS_HIDDEN="".concat(NAMESPACE,"-hidden"),CLASS_HIDE="".concat(NAMESPACE,"-hide"),CLASS_INVISIBLE="".concat(NAMESPACE,"-invisible"),CLASS_MODAL="".concat(NAMESPACE,"-modal"),CLASS_MOVE="".concat(NAMESPACE,"-move"),DATA_ACTION="".concat(NAMESPACE,"Action"),DATA_PREVIEW="".concat(NAMESPACE,"Preview"),DRAG_MODE_CROP="crop",DRAG_MODE_MOVE="move",DRAG_MODE_NONE="none",EVENT_CROP="crop",EVENT_CROP_END="cropend",EVENT_CROP_MOVE="cropmove",EVENT_CROP_START="cropstart",EVENT_DBLCLICK="dblclick",EVENT_TOUCH_START=IS_TOUCH_DEVICE?"touchstart":"mousedown",EVENT_TOUCH_MOVE=IS_TOUCH_DEVICE?"touchmove":"mousemove",EVENT_TOUCH_END=IS_TOUCH_DEVICE?"touchend touchcancel":"mouseup",EVENT_POINTER_DOWN=HAS_POINTER_EVENT?"pointerdown":EVENT_TOUCH_START,EVENT_POINTER_MOVE=HAS_POINTER_EVENT?"pointermove":EVENT_TOUCH_MOVE,EVENT_POINTER_UP=HAS_POINTER_EVENT?"pointerup pointercancel":EVENT_TOUCH_END,EVENT_READY="ready",EVENT_RESIZE="resize",EVENT_WHEEL="wheel",EVENT_ZOOM="zoom",MIME_TYPE_JPEG="image/jpeg",REGEXP_ACTIONS=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,REGEXP_DATA_URL=/^data:/,REGEXP_DATA_URL_JPEG=/^data:image\/jpeg;base64,/,REGEXP_TAG_NAME=/^img|canvas$/i,MIN_CONTAINER_WIDTH=200,MIN_CONTAINER_HEIGHT=100,DEFAULTS={viewMode:0,dragMode:DRAG_MODE_CROP,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:MIN_CONTAINER_WIDTH,minContainerHeight:MIN_CONTAINER_HEIGHT,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},TEMPLATE='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',isNaN=Number.isNaN||WINDOW.isNaN;function isNumber(e){return"number"==typeof e&&!isNaN(e)}var isPositiveNumber=function(e){return e>0&&e<1/0};function isUndefined(e){return void 0===e}function isObject(e){return"object"===_typeof(e)&&null!==e}var hasOwnProperty=Object.prototype.hasOwnProperty;function isPlainObject(e){if(!isObject(e))return!1;try{var t=e.constructor,n=t.prototype;return t&&n&&hasOwnProperty.call(n,"isPrototypeOf")}catch(r){return!1}}function isFunction(e){return"function"==typeof e}var slice=Array.prototype.slice;function toArray(e){return Array.from?Array.from(e):slice.call(e)}function forEach(e,t){return e&&isFunction(t)&&(Array.isArray(e)||isNumber(e.length)?toArray(e).forEach((function(n,r){t.call(e,n,r,e)})):isObject(e)&&Object.keys(e).forEach((function(n){t.call(e,e[n],n,e)}))),e}var assign=Object.assign||function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return isObject(e)&&n.length>0&&n.forEach((function(t){isObject(t)&&Object.keys(t).forEach((function(n){e[n]=t[n]}))})),e},REGEXP_DECIMALS=/\.\d*(?:0|9){12}\d*$/;function normalizeDecimalNumber(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return REGEXP_DECIMALS.test(e)?Math.round(e*t)/t:e}var REGEXP_SUFFIX=/^width|height|left|top|marginLeft|marginTop$/;function setStyle(e,t){var n=e.style;forEach(t,(function(e,t){REGEXP_SUFFIX.test(t)&&isNumber(e)&&(e="".concat(e,"px")),n[t]=e}))}function hasClass(e,t){return e.classList?e.classList.contains(t):e.className.indexOf(t)>-1}function addClass(e,t){if(t)if(isNumber(e.length))forEach(e,(function(e){addClass(e,t)}));else if(e.classList)e.classList.add(t);else{var n=e.className.trim();n?n.indexOf(t)<0&&(e.className="".concat(n," ").concat(t)):e.className=t}}function removeClass(e,t){t&&(isNumber(e.length)?forEach(e,(function(e){removeClass(e,t)})):e.classList?e.classList.remove(t):e.className.indexOf(t)>=0&&(e.className=e.className.replace(t,"")))}function toggleClass(e,t,n){t&&(isNumber(e.length)?forEach(e,(function(e){toggleClass(e,t,n)})):n?addClass(e,t):removeClass(e,t))}var REGEXP_CAMEL_CASE=/([a-z\d])([A-Z])/g;function toParamCase(e){return e.replace(REGEXP_CAMEL_CASE,"$1-$2").toLowerCase()}function getData(e,t){return isObject(e[t])?e[t]:e.dataset?e.dataset[t]:e.getAttribute("data-".concat(toParamCase(t)))}function setData(e,t,n){isObject(n)?e[t]=n:e.dataset?e.dataset[t]=n:e.setAttribute("data-".concat(toParamCase(t)),n)}function removeData(e,t){if(isObject(e[t]))try{delete e[t]}catch(n){e[t]=void 0}else if(e.dataset)try{delete e.dataset[t]}catch(n){e.dataset[t]=void 0}else e.removeAttribute("data-".concat(toParamCase(t)))}var REGEXP_SPACES=/\s\s*/,onceSupported=function(){var e=!1;if(IS_BROWSER){var t=!1,n=function(){},r=Object.defineProperty({},"once",{get:function(){return e=!0,t},set:function(e){t=e}});WINDOW.addEventListener("test",n,r),WINDOW.removeEventListener("test",n,r)}return e}();function removeListener(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n;t.trim().split(REGEXP_SPACES).forEach((function(t){if(!onceSupported){var i=e.listeners;i&&i[t]&&i[t][n]&&(o=i[t][n],delete i[t][n],0===Object.keys(i[t]).length&&delete i[t],0===Object.keys(i).length&&delete e.listeners)}e.removeEventListener(t,o,r)}))}function addListener(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n;t.trim().split(REGEXP_SPACES).forEach((function(t){if(r.once&&!onceSupported){var i=e.listeners,a=void 0===i?{}:i;o=function(){delete a[t][n],e.removeEventListener(t,o,r);for(var i=arguments.length,s=new Array(i),c=0;c<i;c++)s[c]=arguments[c];n.apply(e,s)},a[t]||(a[t]={}),a[t][n]&&e.removeEventListener(t,a[t][n],r),a[t][n]=o,e.listeners=a}e.addEventListener(t,o,r)}))}function dispatchEvent(e,t,n){var r;return isFunction(Event)&&isFunction(CustomEvent)?r=new CustomEvent(t,{detail:n,bubbles:!0,cancelable:!0}):(r=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n),e.dispatchEvent(r)}function getOffset(e){var t=e.getBoundingClientRect();return{left:t.left+(window.pageXOffset-document.documentElement.clientLeft),top:t.top+(window.pageYOffset-document.documentElement.clientTop)}}var location$1=WINDOW.location,REGEXP_ORIGINS=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function isCrossOriginURL(e){var t=e.match(REGEXP_ORIGINS);return null!==t&&(t[1]!==location$1.protocol||t[2]!==location$1.hostname||t[3]!==location$1.port)}function addTimestamp(e){var t="timestamp=".concat((new Date).getTime());return e+(-1===e.indexOf("?")?"?":"&")+t}function getTransforms(e){var t=e.rotate,n=e.scaleX,r=e.scaleY,o=e.translateX,i=e.translateY,a=[];isNumber(o)&&0!==o&&a.push("translateX(".concat(o,"px)")),isNumber(i)&&0!==i&&a.push("translateY(".concat(i,"px)")),isNumber(t)&&0!==t&&a.push("rotate(".concat(t,"deg)")),isNumber(n)&&1!==n&&a.push("scaleX(".concat(n,")")),isNumber(r)&&1!==r&&a.push("scaleY(".concat(r,")"));var s=a.length?a.join(" "):"none";return{WebkitTransform:s,msTransform:s,transform:s}}function getMaxZoomRatio(e){var t=_objectSpread2({},e),n=0;return forEach(e,(function(e,r){delete t[r],forEach(t,(function(t){var r=Math.abs(e.startX-t.startX),o=Math.abs(e.startY-t.startY),i=Math.abs(e.endX-t.endX),a=Math.abs(e.endY-t.endY),s=Math.sqrt(r*r+o*o),c=(Math.sqrt(i*i+a*a)-s)/s;Math.abs(c)>Math.abs(n)&&(n=c)}))})),n}function getPointer(e,t){var n=e.pageX,r=e.pageY,o={endX:n,endY:r};return t?o:_objectSpread2({startX:n,startY:r},o)}function getPointersCenter(e){var t=0,n=0,r=0;return forEach(e,(function(e){var o=e.startX,i=e.startY;t+=o,n+=i,r+=1})),{pageX:t/=r,pageY:n/=r}}function getAdjustedSizes(e){var t=e.aspectRatio,n=e.height,r=e.width,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",i=isPositiveNumber(r),a=isPositiveNumber(n);if(i&&a){var s=n*t;"contain"===o&&s>r||"cover"===o&&s<r?n=r/t:r=n*t}else i?n=r/t:a&&(r=n*t);return{width:r,height:n}}function getRotatedSizes(e){var t=e.width,n=e.height,r=e.degree;if(90===(r=Math.abs(r)%180))return{width:n,height:t};var o=r%90*Math.PI/180,i=Math.sin(o),a=Math.cos(o),s=t*a+n*i,c=t*i+n*a;return r>90?{width:c,height:s}:{width:s,height:c}}function getSourceCanvas(e,t,n,r){var o=t.aspectRatio,i=t.naturalWidth,a=t.naturalHeight,s=t.rotate,c=void 0===s?0:s,u=t.scaleX,l=void 0===u?1:u,d=t.scaleY,h=void 0===d?1:d,p=n.aspectRatio,f=n.naturalWidth,m=n.naturalHeight,g=r.fillColor,y=void 0===g?"transparent":g,v=r.imageSmoothingEnabled,C=void 0===v||v,b=r.imageSmoothingQuality,S=void 0===b?"low":b,E=r.maxWidth,T=void 0===E?1/0:E,k=r.maxHeight,w=void 0===k?1/0:k,A=r.minWidth,x=void 0===A?0:A,_=r.minHeight,O=void 0===_?0:_,N=document.createElement("canvas"),R=N.getContext("2d"),I=getAdjustedSizes({aspectRatio:p,width:T,height:w}),D=getAdjustedSizes({aspectRatio:p,width:x,height:O},"cover"),B=Math.min(I.width,Math.max(D.width,f)),P=Math.min(I.height,Math.max(D.height,m)),M=getAdjustedSizes({aspectRatio:o,width:T,height:w}),U=getAdjustedSizes({aspectRatio:o,width:x,height:O},"cover"),L=Math.min(M.width,Math.max(U.width,i)),H=Math.min(M.height,Math.max(U.height,a)),j=[-L/2,-H/2,L,H];return N.width=normalizeDecimalNumber(B),N.height=normalizeDecimalNumber(P),R.fillStyle=y,R.fillRect(0,0,B,P),R.save(),R.translate(B/2,P/2),R.rotate(c*Math.PI/180),R.scale(l,h),R.imageSmoothingEnabled=C,R.imageSmoothingQuality=S,R.drawImage.apply(R,[e].concat(_toConsumableArray(j.map((function(e){return Math.floor(normalizeDecimalNumber(e))}))))),R.restore(),N}var fromCharCode=String.fromCharCode;function getStringFromCharCode(e,t,n){var r="";n+=t;for(var o=t;o<n;o+=1)r+=fromCharCode(e.getUint8(o));return r}var REGEXP_DATA_URL_HEAD=/^data:.*,/;function dataURLToArrayBuffer(e){var t=e.replace(REGEXP_DATA_URL_HEAD,""),n=atob(t),r=new ArrayBuffer(n.length),o=new Uint8Array(r);return forEach(o,(function(e,t){o[t]=n.charCodeAt(t)})),r}function arrayBufferToDataURL(e,t){for(var n=[],r=new Uint8Array(e);r.length>0;)n.push(fromCharCode.apply(null,toArray(r.subarray(0,8192)))),r=r.subarray(8192);return"data:".concat(t,";base64,").concat(btoa(n.join("")))}function resetAndGetOrientation(e){var t,n=new DataView(e);try{var r,o,i;if(255===n.getUint8(0)&&216===n.getUint8(1))for(var a=n.byteLength,s=2;s+1<a;){if(255===n.getUint8(s)&&225===n.getUint8(s+1)){o=s;break}s+=1}if(o){var c=o+10;if("Exif"===getStringFromCharCode(n,o+4,4)){var u=n.getUint16(c);if(((r=18761===u)||19789===u)&&42===n.getUint16(c+2,r)){var l=n.getUint32(c+4,r);l>=8&&(i=c+l)}}}if(i){var d,h,p=n.getUint16(i,r);for(h=0;h<p;h+=1)if(d=i+12*h+2,274===n.getUint16(d,r)){d+=8,t=n.getUint16(d,r),n.setUint16(d,1,r);break}}}catch(f){t=1}return t}function parseOrientation(e){var t=0,n=1,r=1;switch(e){case 2:n=-1;break;case 3:t=-180;break;case 4:r=-1;break;case 5:t=90,r=-1;break;case 6:t=90;break;case 7:t=90,n=-1;break;case 8:t=-90}return{rotate:t,scaleX:n,scaleY:r}}var render={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var e=this.element,t=this.options,n=this.container,r=this.cropper,o=Number(t.minContainerWidth),i=Number(t.minContainerHeight);addClass(r,CLASS_HIDDEN),removeClass(e,CLASS_HIDDEN);var a={width:Math.max(n.offsetWidth,o>=0?o:MIN_CONTAINER_WIDTH),height:Math.max(n.offsetHeight,i>=0?i:MIN_CONTAINER_HEIGHT)};this.containerData=a,setStyle(r,{width:a.width,height:a.height}),addClass(e,CLASS_HIDDEN),removeClass(r,CLASS_HIDDEN)},initCanvas:function(){var e=this.containerData,t=this.imageData,n=this.options.viewMode,r=Math.abs(t.rotate)%180==90,o=r?t.naturalHeight:t.naturalWidth,i=r?t.naturalWidth:t.naturalHeight,a=o/i,s=e.width,c=e.height;e.height*a>e.width?3===n?s=e.height*a:c=e.width/a:3===n?c=e.width/a:s=e.height*a;var u={aspectRatio:a,naturalWidth:o,naturalHeight:i,width:s,height:c};this.canvasData=u,this.limited=1===n||2===n,this.limitCanvas(!0,!0),u.width=Math.min(Math.max(u.width,u.minWidth),u.maxWidth),u.height=Math.min(Math.max(u.height,u.minHeight),u.maxHeight),u.left=(e.width-u.width)/2,u.top=(e.height-u.height)/2,u.oldLeft=u.left,u.oldTop=u.top,this.initialCanvasData=assign({},u)},limitCanvas:function(e,t){var n=this.options,r=this.containerData,o=this.canvasData,i=this.cropBoxData,a=n.viewMode,s=o.aspectRatio,c=this.cropped&&i;if(e){var u=Number(n.minCanvasWidth)||0,l=Number(n.minCanvasHeight)||0;a>1?(u=Math.max(u,r.width),l=Math.max(l,r.height),3===a&&(l*s>u?u=l*s:l=u/s)):a>0&&(u?u=Math.max(u,c?i.width:0):l?l=Math.max(l,c?i.height:0):c&&(u=i.width,(l=i.height)*s>u?u=l*s:l=u/s));var d=getAdjustedSizes({aspectRatio:s,width:u,height:l});u=d.width,l=d.height,o.minWidth=u,o.minHeight=l,o.maxWidth=1/0,o.maxHeight=1/0}if(t)if(a>(c?0:1)){var h=r.width-o.width,p=r.height-o.height;o.minLeft=Math.min(0,h),o.minTop=Math.min(0,p),o.maxLeft=Math.max(0,h),o.maxTop=Math.max(0,p),c&&this.limited&&(o.minLeft=Math.min(i.left,i.left+(i.width-o.width)),o.minTop=Math.min(i.top,i.top+(i.height-o.height)),o.maxLeft=i.left,o.maxTop=i.top,2===a&&(o.width>=r.width&&(o.minLeft=Math.min(0,h),o.maxLeft=Math.max(0,h)),o.height>=r.height&&(o.minTop=Math.min(0,p),o.maxTop=Math.max(0,p))))}else o.minLeft=-o.width,o.minTop=-o.height,o.maxLeft=r.width,o.maxTop=r.height},renderCanvas:function(e,t){var n=this.canvasData,r=this.imageData;if(t){var o=getRotatedSizes({width:r.naturalWidth*Math.abs(r.scaleX||1),height:r.naturalHeight*Math.abs(r.scaleY||1),degree:r.rotate||0}),i=o.width,a=o.height,s=n.width*(i/n.naturalWidth),c=n.height*(a/n.naturalHeight);n.left-=(s-n.width)/2,n.top-=(c-n.height)/2,n.width=s,n.height=c,n.aspectRatio=i/a,n.naturalWidth=i,n.naturalHeight=a,this.limitCanvas(!0,!1)}(n.width>n.maxWidth||n.width<n.minWidth)&&(n.left=n.oldLeft),(n.height>n.maxHeight||n.height<n.minHeight)&&(n.top=n.oldTop),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),this.limitCanvas(!1,!0),n.left=Math.min(Math.max(n.left,n.minLeft),n.maxLeft),n.top=Math.min(Math.max(n.top,n.minTop),n.maxTop),n.oldLeft=n.left,n.oldTop=n.top,setStyle(this.canvas,assign({width:n.width,height:n.height},getTransforms({translateX:n.left,translateY:n.top}))),this.renderImage(e),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(e){var t=this.canvasData,n=this.imageData,r=n.naturalWidth*(t.width/t.naturalWidth),o=n.naturalHeight*(t.height/t.naturalHeight);assign(n,{width:r,height:o,left:(t.width-r)/2,top:(t.height-o)/2}),setStyle(this.image,assign({width:n.width,height:n.height},getTransforms(assign({translateX:n.left,translateY:n.top},n)))),e&&this.output()},initCropBox:function(){var e=this.options,t=this.canvasData,n=e.aspectRatio||e.initialAspectRatio,r=Number(e.autoCropArea)||.8,o={width:t.width,height:t.height};n&&(t.height*n>t.width?o.height=o.width/n:o.width=o.height*n),this.cropBoxData=o,this.limitCropBox(!0,!0),o.width=Math.min(Math.max(o.width,o.minWidth),o.maxWidth),o.height=Math.min(Math.max(o.height,o.minHeight),o.maxHeight),o.width=Math.max(o.minWidth,o.width*r),o.height=Math.max(o.minHeight,o.height*r),o.left=t.left+(t.width-o.width)/2,o.top=t.top+(t.height-o.height)/2,o.oldLeft=o.left,o.oldTop=o.top,this.initialCropBoxData=assign({},o)},limitCropBox:function(e,t){var n=this.options,r=this.containerData,o=this.canvasData,i=this.cropBoxData,a=this.limited,s=n.aspectRatio;if(e){var c=Number(n.minCropBoxWidth)||0,u=Number(n.minCropBoxHeight)||0,l=a?Math.min(r.width,o.width,o.width+o.left,r.width-o.left):r.width,d=a?Math.min(r.height,o.height,o.height+o.top,r.height-o.top):r.height;c=Math.min(c,r.width),u=Math.min(u,r.height),s&&(c&&u?u*s>c?u=c/s:c=u*s:c?u=c/s:u&&(c=u*s),d*s>l?d=l/s:l=d*s),i.minWidth=Math.min(c,l),i.minHeight=Math.min(u,d),i.maxWidth=l,i.maxHeight=d}t&&(a?(i.minLeft=Math.max(0,o.left),i.minTop=Math.max(0,o.top),i.maxLeft=Math.min(r.width,o.left+o.width)-i.width,i.maxTop=Math.min(r.height,o.top+o.height)-i.height):(i.minLeft=0,i.minTop=0,i.maxLeft=r.width-i.width,i.maxTop=r.height-i.height))},renderCropBox:function(){var e=this.options,t=this.containerData,n=this.cropBoxData;(n.width>n.maxWidth||n.width<n.minWidth)&&(n.left=n.oldLeft),(n.height>n.maxHeight||n.height<n.minHeight)&&(n.top=n.oldTop),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),this.limitCropBox(!1,!0),n.left=Math.min(Math.max(n.left,n.minLeft),n.maxLeft),n.top=Math.min(Math.max(n.top,n.minTop),n.maxTop),n.oldLeft=n.left,n.oldTop=n.top,e.movable&&e.cropBoxMovable&&setData(this.face,DATA_ACTION,n.width>=t.width&&n.height>=t.height?ACTION_MOVE:ACTION_ALL),setStyle(this.cropBox,assign({width:n.width,height:n.height},getTransforms({translateX:n.left,translateY:n.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),dispatchEvent(this.element,EVENT_CROP,this.getData())}},preview={initPreview:function(){var e=this.element,t=this.crossOrigin,n=this.options.preview,r=t?this.crossOriginUrl:this.url,o=e.alt||"The image to preview",i=document.createElement("img");if(t&&(i.crossOrigin=t),i.src=r,i.alt=o,this.viewBox.appendChild(i),this.viewBoxImage=i,n){var a=n;"string"==typeof n?a=e.ownerDocument.querySelectorAll(n):n.querySelector&&(a=[n]),this.previews=a,forEach(a,(function(e){var n=document.createElement("img");setData(e,DATA_PREVIEW,{width:e.offsetWidth,height:e.offsetHeight,html:e.innerHTML}),t&&(n.crossOrigin=t),n.src=r,n.alt=o,n.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;"',e.innerHTML="",e.appendChild(n)}))}},resetPreview:function(){forEach(this.previews,(function(e){var t=getData(e,DATA_PREVIEW);setStyle(e,{width:t.width,height:t.height}),e.innerHTML=t.html,removeData(e,DATA_PREVIEW)}))},preview:function(){var e=this.imageData,t=this.canvasData,n=this.cropBoxData,r=n.width,o=n.height,i=e.width,a=e.height,s=n.left-t.left-e.left,c=n.top-t.top-e.top;this.cropped&&!this.disabled&&(setStyle(this.viewBoxImage,assign({width:i,height:a},getTransforms(assign({translateX:-s,translateY:-c},e)))),forEach(this.previews,(function(t){var n=getData(t,DATA_PREVIEW),u=n.width,l=n.height,d=u,h=l,p=1;r&&(h=o*(p=u/r)),o&&h>l&&(d=r*(p=l/o),h=l),setStyle(t,{width:d,height:h}),setStyle(t.getElementsByTagName("img")[0],assign({width:i*p,height:a*p},getTransforms(assign({translateX:-s*p,translateY:-c*p},e))))})))}},events={bind:function(){var e=this.element,t=this.options,n=this.cropper;isFunction(t.cropstart)&&addListener(e,EVENT_CROP_START,t.cropstart),isFunction(t.cropmove)&&addListener(e,EVENT_CROP_MOVE,t.cropmove),isFunction(t.cropend)&&addListener(e,EVENT_CROP_END,t.cropend),isFunction(t.crop)&&addListener(e,EVENT_CROP,t.crop),isFunction(t.zoom)&&addListener(e,EVENT_ZOOM,t.zoom),addListener(n,EVENT_POINTER_DOWN,this.onCropStart=this.cropStart.bind(this)),t.zoomable&&t.zoomOnWheel&&addListener(n,EVENT_WHEEL,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&addListener(n,EVENT_DBLCLICK,this.onDblclick=this.dblclick.bind(this)),addListener(e.ownerDocument,EVENT_POINTER_MOVE,this.onCropMove=this.cropMove.bind(this)),addListener(e.ownerDocument,EVENT_POINTER_UP,this.onCropEnd=this.cropEnd.bind(this)),t.responsive&&addListener(window,EVENT_RESIZE,this.onResize=this.resize.bind(this))},unbind:function(){var e=this.element,t=this.options,n=this.cropper;isFunction(t.cropstart)&&removeListener(e,EVENT_CROP_START,t.cropstart),isFunction(t.cropmove)&&removeListener(e,EVENT_CROP_MOVE,t.cropmove),isFunction(t.cropend)&&removeListener(e,EVENT_CROP_END,t.cropend),isFunction(t.crop)&&removeListener(e,EVENT_CROP,t.crop),isFunction(t.zoom)&&removeListener(e,EVENT_ZOOM,t.zoom),removeListener(n,EVENT_POINTER_DOWN,this.onCropStart),t.zoomable&&t.zoomOnWheel&&removeListener(n,EVENT_WHEEL,this.onWheel,{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&removeListener(n,EVENT_DBLCLICK,this.onDblclick),removeListener(e.ownerDocument,EVENT_POINTER_MOVE,this.onCropMove),removeListener(e.ownerDocument,EVENT_POINTER_UP,this.onCropEnd),t.responsive&&removeListener(window,EVENT_RESIZE,this.onResize)}},handlers={resize:function(){if(!this.disabled){var e,t,n=this.options,r=this.container,o=this.containerData,i=r.offsetWidth/o.width,a=r.offsetHeight/o.height,s=Math.abs(i-1)>Math.abs(a-1)?i:a;if(1!==s)n.restore&&(e=this.getCanvasData(),t=this.getCropBoxData()),this.render(),n.restore&&(this.setCanvasData(forEach(e,(function(t,n){e[n]=t*s}))),this.setCropBoxData(forEach(t,(function(e,n){t[n]=e*s}))))}},dblclick:function(){this.disabled||this.options.dragMode===DRAG_MODE_NONE||this.setDragMode(hasClass(this.dragBox,CLASS_CROP)?DRAG_MODE_MOVE:DRAG_MODE_CROP)},wheel:function(e){var t=this,n=Number(this.options.wheelZoomRatio)||.1,r=1;this.disabled||(e.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout((function(){t.wheeling=!1}),50),e.deltaY?r=e.deltaY>0?1:-1:e.wheelDelta?r=-e.wheelDelta/120:e.detail&&(r=e.detail>0?1:-1),this.zoom(-r*n,e)))},cropStart:function(e){var t=e.buttons,n=e.button;if(!(this.disabled||("mousedown"===e.type||"pointerdown"===e.type&&"mouse"===e.pointerType)&&(isNumber(t)&&1!==t||isNumber(n)&&0!==n||e.ctrlKey))){var r,o=this.options,i=this.pointers;e.changedTouches?forEach(e.changedTouches,(function(e){i[e.identifier]=getPointer(e)})):i[e.pointerId||0]=getPointer(e),r=Object.keys(i).length>1&&o.zoomable&&o.zoomOnTouch?ACTION_ZOOM:getData(e.target,DATA_ACTION),REGEXP_ACTIONS.test(r)&&!1!==dispatchEvent(this.element,EVENT_CROP_START,{originalEvent:e,action:r})&&(e.preventDefault(),this.action=r,this.cropping=!1,r===ACTION_CROP&&(this.cropping=!0,addClass(this.dragBox,CLASS_MODAL)))}},cropMove:function(e){var t=this.action;if(!this.disabled&&t){var n=this.pointers;e.preventDefault(),!1!==dispatchEvent(this.element,EVENT_CROP_MOVE,{originalEvent:e,action:t})&&(e.changedTouches?forEach(e.changedTouches,(function(e){assign(n[e.identifier]||{},getPointer(e,!0))})):assign(n[e.pointerId||0]||{},getPointer(e,!0)),this.change(e))}},cropEnd:function(e){if(!this.disabled){var t=this.action,n=this.pointers;e.changedTouches?forEach(e.changedTouches,(function(e){delete n[e.identifier]})):delete n[e.pointerId||0],t&&(e.preventDefault(),Object.keys(n).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:e,action:t}))}}},change={change:function(e){var t,n=this.options,r=this.canvasData,o=this.containerData,i=this.cropBoxData,a=this.pointers,s=this.action,c=n.aspectRatio,u=i.left,l=i.top,d=i.width,h=i.height,p=u+d,f=l+h,m=0,g=0,y=o.width,v=o.height,C=!0;!c&&e.shiftKey&&(c=d&&h?d/h:1),this.limited&&(m=i.minLeft,g=i.minTop,y=m+Math.min(o.width,r.width,r.left+r.width),v=g+Math.min(o.height,r.height,r.top+r.height));var b=a[Object.keys(a)[0]],S={x:b.endX-b.startX,y:b.endY-b.startY},E=function(e){switch(e){case ACTION_EAST:p+S.x>y&&(S.x=y-p);break;case ACTION_WEST:u+S.x<m&&(S.x=m-u);break;case ACTION_NORTH:l+S.y<g&&(S.y=g-l);break;case ACTION_SOUTH:f+S.y>v&&(S.y=v-f)}};switch(s){case ACTION_ALL:u+=S.x,l+=S.y;break;case ACTION_EAST:if(S.x>=0&&(p>=y||c&&(l<=g||f>=v))){C=!1;break}E(ACTION_EAST),(d+=S.x)<0&&(s=ACTION_WEST,u-=d=-d),c&&(h=d/c,l+=(i.height-h)/2);break;case ACTION_NORTH:if(S.y<=0&&(l<=g||c&&(u<=m||p>=y))){C=!1;break}E(ACTION_NORTH),h-=S.y,l+=S.y,h<0&&(s=ACTION_SOUTH,l-=h=-h),c&&(d=h*c,u+=(i.width-d)/2);break;case ACTION_WEST:if(S.x<=0&&(u<=m||c&&(l<=g||f>=v))){C=!1;break}E(ACTION_WEST),d-=S.x,u+=S.x,d<0&&(s=ACTION_EAST,u-=d=-d),c&&(h=d/c,l+=(i.height-h)/2);break;case ACTION_SOUTH:if(S.y>=0&&(f>=v||c&&(u<=m||p>=y))){C=!1;break}E(ACTION_SOUTH),(h+=S.y)<0&&(s=ACTION_NORTH,l-=h=-h),c&&(d=h*c,u+=(i.width-d)/2);break;case ACTION_NORTH_EAST:if(c){if(S.y<=0&&(l<=g||p>=y)){C=!1;break}E(ACTION_NORTH),h-=S.y,l+=S.y,d=h*c}else E(ACTION_NORTH),E(ACTION_EAST),S.x>=0?p<y?d+=S.x:S.y<=0&&l<=g&&(C=!1):d+=S.x,S.y<=0?l>g&&(h-=S.y,l+=S.y):(h-=S.y,l+=S.y);d<0&&h<0?(s=ACTION_SOUTH_WEST,l-=h=-h,u-=d=-d):d<0?(s=ACTION_NORTH_WEST,u-=d=-d):h<0&&(s=ACTION_SOUTH_EAST,l-=h=-h);break;case ACTION_NORTH_WEST:if(c){if(S.y<=0&&(l<=g||u<=m)){C=!1;break}E(ACTION_NORTH),h-=S.y,l+=S.y,d=h*c,u+=i.width-d}else E(ACTION_NORTH),E(ACTION_WEST),S.x<=0?u>m?(d-=S.x,u+=S.x):S.y<=0&&l<=g&&(C=!1):(d-=S.x,u+=S.x),S.y<=0?l>g&&(h-=S.y,l+=S.y):(h-=S.y,l+=S.y);d<0&&h<0?(s=ACTION_SOUTH_EAST,l-=h=-h,u-=d=-d):d<0?(s=ACTION_NORTH_EAST,u-=d=-d):h<0&&(s=ACTION_SOUTH_WEST,l-=h=-h);break;case ACTION_SOUTH_WEST:if(c){if(S.x<=0&&(u<=m||f>=v)){C=!1;break}E(ACTION_WEST),d-=S.x,u+=S.x,h=d/c}else E(ACTION_SOUTH),E(ACTION_WEST),S.x<=0?u>m?(d-=S.x,u+=S.x):S.y>=0&&f>=v&&(C=!1):(d-=S.x,u+=S.x),S.y>=0?f<v&&(h+=S.y):h+=S.y;d<0&&h<0?(s=ACTION_NORTH_EAST,l-=h=-h,u-=d=-d):d<0?(s=ACTION_SOUTH_EAST,u-=d=-d):h<0&&(s=ACTION_NORTH_WEST,l-=h=-h);break;case ACTION_SOUTH_EAST:if(c){if(S.x>=0&&(p>=y||f>=v)){C=!1;break}E(ACTION_EAST),h=(d+=S.x)/c}else E(ACTION_SOUTH),E(ACTION_EAST),S.x>=0?p<y?d+=S.x:S.y>=0&&f>=v&&(C=!1):d+=S.x,S.y>=0?f<v&&(h+=S.y):h+=S.y;d<0&&h<0?(s=ACTION_NORTH_WEST,l-=h=-h,u-=d=-d):d<0?(s=ACTION_SOUTH_WEST,u-=d=-d):h<0&&(s=ACTION_NORTH_EAST,l-=h=-h);break;case ACTION_MOVE:this.move(S.x,S.y),C=!1;break;case ACTION_ZOOM:this.zoom(getMaxZoomRatio(a),e),C=!1;break;case ACTION_CROP:if(!S.x||!S.y){C=!1;break}t=getOffset(this.cropper),u=b.startX-t.left,l=b.startY-t.top,d=i.minWidth,h=i.minHeight,S.x>0?s=S.y>0?ACTION_SOUTH_EAST:ACTION_NORTH_EAST:S.x<0&&(u-=d,s=S.y>0?ACTION_SOUTH_WEST:ACTION_NORTH_WEST),S.y<0&&(l-=h),this.cropped||(removeClass(this.cropBox,CLASS_HIDDEN),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}C&&(i.width=d,i.height=h,i.left=u,i.top=l,this.action=s,this.renderCropBox()),forEach(a,(function(e){e.startX=e.endX,e.startY=e.endY}))}},methods={crop:function(){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(){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(){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(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&e&&(this.isImg&&(this.element.src=e),t?(this.url=e,this.image.src=e,this.ready&&(this.viewBoxImage.src=e,forEach(this.previews,(function(t){t.getElementsByTagName("img")[0].src=e})))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(e))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,removeClass(this.cropper,CLASS_DISABLED)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,addClass(this.cropper,CLASS_DISABLED)),this},destroy:function(){var e=this.element;return e[NAMESPACE]?(e[NAMESPACE]=void 0,this.isImg&&this.replaced&&(e.src=this.originalUrl),this.uncreate(),this):this},move:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=this.canvasData,r=n.left,o=n.top;return this.moveTo(isUndefined(e)?e:r+Number(e),isUndefined(t)?t:o+Number(t))},moveTo:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=this.canvasData,r=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.movable&&(isNumber(e)&&(n.left=e,r=!0),isNumber(t)&&(n.top=t,r=!0),r&&this.renderCanvas(!0)),this},zoom:function(e,t){var n=this.canvasData;return e=(e=Number(e))<0?1/(1-e):1+e,this.zoomTo(n.width*e/n.naturalWidth,null,t)},zoomTo:function(e,t,n){var r=this.options,o=this.canvasData,i=o.width,a=o.height,s=o.naturalWidth,c=o.naturalHeight;if((e=Number(e))>=0&&this.ready&&!this.disabled&&r.zoomable){var u=s*e,l=c*e;if(!1===dispatchEvent(this.element,EVENT_ZOOM,{ratio:e,oldRatio:i/s,originalEvent:n}))return this;if(n){var d=this.pointers,h=getOffset(this.cropper),p=d&&Object.keys(d).length?getPointersCenter(d):{pageX:n.pageX,pageY:n.pageY};o.left-=(u-i)*((p.pageX-h.left-o.left)/i),o.top-=(l-a)*((p.pageY-h.top-o.top)/a)}else isPlainObject(t)&&isNumber(t.x)&&isNumber(t.y)?(o.left-=(u-i)*((t.x-o.left)/i),o.top-=(l-a)*((t.y-o.top)/a)):(o.left-=(u-i)/2,o.top-=(l-a)/2);o.width=u,o.height=l,this.renderCanvas(!0)}return this},rotate:function(e){return this.rotateTo((this.imageData.rotate||0)+Number(e))},rotateTo:function(e){return isNumber(e=Number(e))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=e%360,this.renderCanvas(!0,!0)),this},scaleX:function(e){var t=this.imageData.scaleY;return this.scale(e,isNumber(t)?t:1)},scaleY:function(e){var t=this.imageData.scaleX;return this.scale(isNumber(t)?t:1,e)},scale:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=this.imageData,r=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.scalable&&(isNumber(e)&&(n.scaleX=e,r=!0),isNumber(t)&&(n.scaleY=t,r=!0),r&&this.renderCanvas(!0,!0)),this},getData:function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.options,r=this.imageData,o=this.canvasData,i=this.cropBoxData;if(this.ready&&this.cropped){e={x:i.left-o.left,y:i.top-o.top,width:i.width,height:i.height};var a=r.width/r.naturalWidth;if(forEach(e,(function(t,n){e[n]=t/a})),t){var s=Math.round(e.y+e.height),c=Math.round(e.x+e.width);e.x=Math.round(e.x),e.y=Math.round(e.y),e.width=c-e.x,e.height=s-e.y}}else e={x:0,y:0,width:0,height:0};return n.rotatable&&(e.rotate=r.rotate||0),n.scalable&&(e.scaleX=r.scaleX||1,e.scaleY=r.scaleY||1),e},setData:function(e){var t=this.options,n=this.imageData,r=this.canvasData,o={};if(this.ready&&!this.disabled&&isPlainObject(e)){var i=!1;t.rotatable&&isNumber(e.rotate)&&e.rotate!==n.rotate&&(n.rotate=e.rotate,i=!0),t.scalable&&(isNumber(e.scaleX)&&e.scaleX!==n.scaleX&&(n.scaleX=e.scaleX,i=!0),isNumber(e.scaleY)&&e.scaleY!==n.scaleY&&(n.scaleY=e.scaleY,i=!0)),i&&this.renderCanvas(!0,!0);var a=n.width/n.naturalWidth;isNumber(e.x)&&(o.left=e.x*a+r.left),isNumber(e.y)&&(o.top=e.y*a+r.top),isNumber(e.width)&&(o.width=e.width*a),isNumber(e.height)&&(o.height=e.height*a),this.setCropBoxData(o)}return this},getContainerData:function(){return this.ready?assign({},this.containerData):{}},getImageData:function(){return this.sized?assign({},this.imageData):{}},getCanvasData:function(){var e=this.canvasData,t={};return this.ready&&forEach(["left","top","width","height","naturalWidth","naturalHeight"],(function(n){t[n]=e[n]})),t},setCanvasData:function(e){var t=this.canvasData,n=t.aspectRatio;return this.ready&&!this.disabled&&isPlainObject(e)&&(isNumber(e.left)&&(t.left=e.left),isNumber(e.top)&&(t.top=e.top),isNumber(e.width)?(t.width=e.width,t.height=e.width/n):isNumber(e.height)&&(t.height=e.height,t.width=e.height*n),this.renderCanvas(!0)),this},getCropBoxData:function(){var e,t=this.cropBoxData;return this.ready&&this.cropped&&(e={left:t.left,top:t.top,width:t.width,height:t.height}),e||{}},setCropBoxData:function(e){var t,n,r=this.cropBoxData,o=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&isPlainObject(e)&&(isNumber(e.left)&&(r.left=e.left),isNumber(e.top)&&(r.top=e.top),isNumber(e.width)&&e.width!==r.width&&(t=!0,r.width=e.width),isNumber(e.height)&&e.height!==r.height&&(n=!0,r.height=e.height),o&&(t?r.height=r.width/o:n&&(r.width=r.height*o)),this.renderCropBox()),this},getCroppedCanvas:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var t=this.canvasData,n=getSourceCanvas(this.image,this.imageData,t,e);if(!this.cropped)return n;var r=this.getData(),o=r.x,i=r.y,a=r.width,s=r.height,c=n.width/Math.floor(t.naturalWidth);1!==c&&(o*=c,i*=c,a*=c,s*=c);var u=a/s,l=getAdjustedSizes({aspectRatio:u,width:e.maxWidth||1/0,height:e.maxHeight||1/0}),d=getAdjustedSizes({aspectRatio:u,width:e.minWidth||0,height:e.minHeight||0},"cover"),h=getAdjustedSizes({aspectRatio:u,width:e.width||(1!==c?n.width:a),height:e.height||(1!==c?n.height:s)}),p=h.width,f=h.height;p=Math.min(l.width,Math.max(d.width,p)),f=Math.min(l.height,Math.max(d.height,f));var m=document.createElement("canvas"),g=m.getContext("2d");m.width=normalizeDecimalNumber(p),m.height=normalizeDecimalNumber(f),g.fillStyle=e.fillColor||"transparent",g.fillRect(0,0,p,f);var y=e.imageSmoothingEnabled,v=void 0===y||y,C=e.imageSmoothingQuality;g.imageSmoothingEnabled=v,C&&(g.imageSmoothingQuality=C);var b,S,E,T,k,w,A=n.width,x=n.height,_=o,O=i;_<=-a||_>A?(_=0,b=0,E=0,k=0):_<=0?(E=-_,_=0,k=b=Math.min(A,a+_)):_<=A&&(E=0,k=b=Math.min(a,A-_)),b<=0||O<=-s||O>x?(O=0,S=0,T=0,w=0):O<=0?(T=-O,O=0,w=S=Math.min(x,s+O)):O<=x&&(T=0,w=S=Math.min(s,x-O));var N=[_,O,b,S];if(k>0&&w>0){var R=p/a;N.push(E*R,T*R,k*R,w*R)}return g.drawImage.apply(g,[n].concat(_toConsumableArray(N.map((function(e){return Math.floor(normalizeDecimalNumber(e))}))))),m},setAspectRatio:function(e){var t=this.options;return this.disabled||isUndefined(e)||(t.aspectRatio=Math.max(0,e)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(e){var t=this.options,n=this.dragBox,r=this.face;if(this.ready&&!this.disabled){var o=e===DRAG_MODE_CROP,i=t.movable&&e===DRAG_MODE_MOVE;e=o||i?e:DRAG_MODE_NONE,t.dragMode=e,setData(n,DATA_ACTION,e),toggleClass(n,CLASS_CROP,o),toggleClass(n,CLASS_MOVE,i),t.cropBoxMovable||(setData(r,DATA_ACTION,e),toggleClass(r,CLASS_CROP,o),toggleClass(r,CLASS_MOVE,i))}return this}},AnotherCropper=WINDOW.Cropper,Cropper=exports("C",function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(_classCallCheck(this,e),!t||!REGEXP_TAG_NAME.test(t.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=t,this.options=assign({},DEFAULTS,isPlainObject(n)&&n),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(e,[{key:"init",value:function(){var e,t=this.element,n=t.tagName.toLowerCase();if(!t[NAMESPACE]){if(t[NAMESPACE]=this,"img"===n){if(this.isImg=!0,e=t.getAttribute("src")||"",this.originalUrl=e,!e)return;e=t.src}else"canvas"===n&&window.HTMLCanvasElement&&(e=t.toDataURL());this.load(e)}}},{key:"load",value:function(e){var t=this;if(e){this.url=e,this.imageData={};var n=this.element,r=this.options;if(r.rotatable||r.scalable||(r.checkOrientation=!1),r.checkOrientation&&window.ArrayBuffer)if(REGEXP_DATA_URL.test(e))REGEXP_DATA_URL_JPEG.test(e)?this.read(dataURLToArrayBuffer(e)):this.clone();else{var o=new XMLHttpRequest,i=this.clone.bind(this);this.reloading=!0,this.xhr=o,o.onabort=i,o.onerror=i,o.ontimeout=i,o.onprogress=function(){o.getResponseHeader("content-type")!==MIME_TYPE_JPEG&&o.abort()},o.onload=function(){t.read(o.response)},o.onloadend=function(){t.reloading=!1,t.xhr=null},r.checkCrossOrigin&&isCrossOriginURL(e)&&n.crossOrigin&&(e=addTimestamp(e)),o.open("GET",e,!0),o.responseType="arraybuffer",o.withCredentials="use-credentials"===n.crossOrigin,o.send()}else this.clone()}}},{key:"read",value:function(e){var t=this.options,n=this.imageData,r=resetAndGetOrientation(e),o=0,i=1,a=1;if(r>1){this.url=arrayBufferToDataURL(e,MIME_TYPE_JPEG);var s=parseOrientation(r);o=s.rotate,i=s.scaleX,a=s.scaleY}t.rotatable&&(n.rotate=o),t.scalable&&(n.scaleX=i,n.scaleY=a),this.clone()}},{key:"clone",value:function(){var e=this.element,t=this.url,n=e.crossOrigin,r=t;this.options.checkCrossOrigin&&isCrossOriginURL(t)&&(n||(n="anonymous"),r=addTimestamp(t)),this.crossOrigin=n,this.crossOriginUrl=r;var o=document.createElement("img");n&&(o.crossOrigin=n),o.src=r||t,o.alt=e.alt||"The image to crop",this.image=o,o.onload=this.start.bind(this),o.onerror=this.stop.bind(this),addClass(o,CLASS_HIDE),e.parentNode.insertBefore(o,e.nextSibling)}},{key:"start",value:function(){var e=this,t=this.image;t.onload=null,t.onerror=null,this.sizing=!0;var n=WINDOW.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent),r=function(t,n){assign(e.imageData,{naturalWidth:t,naturalHeight:n,aspectRatio:t/n}),e.initialImageData=assign({},e.imageData),e.sizing=!1,e.sized=!0,e.build()};if(!t.naturalWidth||n){var o=document.createElement("img"),i=document.body||document.documentElement;this.sizingImage=o,o.onload=function(){r(o.width,o.height),n||i.removeChild(o)},o.src=t.src,n||(o.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;",i.appendChild(o))}else r(t.naturalWidth,t.naturalHeight)}},{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,n=this.image,r=e.parentNode,o=document.createElement("div");o.innerHTML=TEMPLATE;var i=o.querySelector(".".concat(NAMESPACE,"-container")),a=i.querySelector(".".concat(NAMESPACE,"-canvas")),s=i.querySelector(".".concat(NAMESPACE,"-drag-box")),c=i.querySelector(".".concat(NAMESPACE,"-crop-box")),u=c.querySelector(".".concat(NAMESPACE,"-face"));this.container=r,this.cropper=i,this.canvas=a,this.dragBox=s,this.cropBox=c,this.viewBox=i.querySelector(".".concat(NAMESPACE,"-view-box")),this.face=u,a.appendChild(n),addClass(e,CLASS_HIDDEN),r.insertBefore(i,e.nextSibling),removeClass(n,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(c,CLASS_HIDDEN),t.guides||addClass(c.getElementsByClassName("".concat(NAMESPACE,"-dashed")),CLASS_HIDDEN),t.center||addClass(c.getElementsByClassName("".concat(NAMESPACE,"-center")),CLASS_HIDDEN),t.background&&addClass(i,"".concat(NAMESPACE,"-bg")),t.highlight||addClass(u,CLASS_INVISIBLE),t.cropBoxMovable&&(addClass(u,CLASS_MOVE),setData(u,DATA_ACTION,ACTION_ALL)),t.cropBoxResizable||(addClass(c.getElementsByClassName("".concat(NAMESPACE,"-line")),CLASS_HIDDEN),addClass(c.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,e}},{key:"setDefaults",value:function(e){assign(DEFAULTS,isPlainObject(e)&&e)}}]),e}());assign(Cropper.prototype,render,preview,events,handlers,change,methods);const cropper="",Copper=defineComponent({name:"copper-image",emits:["close","cropperNo","cropperOk"],setup(e,{emit:t,expose:n}){const r=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}),o=ref(),i=()=>{r.myCropper=new Cropper(o.value,{viewMode:1,dragMode:"move",aspectRatio:r.options.autoCropWidth/r.options.autoCropHeight,initialAspectRatio:1,autoCropArea:1,cropBoxMovable:!0,cropBoxResizable:!1,background:!0,movable:!0,modal:!0,preview:".before"})},a=e=>{switch(e){case"left":r.myCropper.rotate(90);break;case"right":r.myCropper.rotate(-90);break;case"zoomIn":r.myCropper.zoom(.1);break;case"zoomOut":r.myCropper.zoom(-.1)}},s=()=>{r.confirmLoading=!0,r.myCropper.getCroppedCanvas({imageSmoothingQuality:"high"}).toBlob((e=>{console.log(e,"1212"),t("cropperOk",e),r.confirmLoading=!1}))};return n({edit:e=>{const{options:t}=r;r.visible=!0,r.options=Object.assign({},t,e),nextTick((()=>{i()}))}}),()=>createVNode("div",null,[createVNode(NGrid,{cols:2,xGap:24,style:{paddingTop:"12px"}},{default:()=>[createVNode(NGi,null,{default:()=>[createVNode("div",{style:"width: 100%; height: 300px"},[r.options?.img&&createVNode("img",{ref:o,src:r.options?.img,alt:""},null)]),createVNode(NSpace,{justify:"center",style:{paddingTop:"12px"}},{default:()=>[createVNode(NButton,{type:"primary",size:"small",onClick:()=>a("left")},{default:()=>[createTextVNode("逆时针旋转")]}),createVNode(NButton,{type:"primary",size:"small",onClick:()=>a("right")},{default:()=>[createTextVNode("顺时针旋转")]}),createVNode(NButton,{type:"primary",size:"small",onClick:()=>a("zoomIn")},{default:()=>[createTextVNode("放大")]}),createVNode(NButton,{type:"primary",size:"small",onClick:()=>a("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:r.options.autoCropWidth+"px",height:r.options.autoCropHeight+"px",overflow:"hidden"}},null)]})]}),createVNode(NSpace,{justify:"end"},{default:()=>[createVNode(NButton,{type:"default",onClick:()=>{r.confirmLoading=!1,t("close"),t("cropperNo")}},{default:()=>[createTextVNode("取消")]}),createVNode(NButton,{type:"primary",loading:r.confirmLoading,onClick:s},{default:()=>[createTextVNode("确认")]})]})])}}),UploadFile=exports("U",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(e,{emit:t,expose:n,slots:r}){const o=`https://${e.bucketName}.ks3-cn-beijing.ksyuncs.com/`,i=useMessage(),a=ref(!1),s=ref(!1);ref();const c=ref(),u=reactive([]),l=ref([]),d=()=>{if(e.fileList){const t=e.fileList.split("/");l.value=[{id:(new Date).getTime().toString(),name:t[t.length-1],status:"finished",url:e.fileList}]}else if(Array.isArray(e.imageList)){const t=[];e.imageList.forEach((e=>{const n=e.split("/");t.push({id:Date.now().toString(),name:n[n.length-1],status:"finished",url:e})})),l.value=t}else l.value=[]};d(),watch((()=>e.imageList),(()=>{d()})),watch((()=>e.fileList),(()=>{d()}));n({handleClearFile:()=>{c.value?.clear(),console.log("清空",c.value)}});const h=ref(),p=async(e,t)=>{const n=new FileReader;n.addEventListener("load",(()=>t(n.result))),n.readAsDataURL(e)},f=({file:e,action:t,onFinish:n,onError:r,onProgress:o})=>{const i=u.find((t=>t.id==e.id));i.file=e,onFileUpload({file:e,action:t,data:i,onProgress:o,onFinish:n,onError:r})},m=async n=>{try{const r=`${e.path}${e.fileName||(new Date).getTime()+".png"}`,i={filename:r,bucketName:e.bucketName,postData:{filename:r,acl:"public-read",key:r,unknowValueField:[]}},{data:s}=await getUploadSign(i),c={policy:s.policy,signature:s.signature,acl:"public-read",key:r,KSSAccessKeyId:s.kssAccessKeyId,name:r,file:n},u=await onOnlyFileUpload(o,c);console.log(u,"upload"),t("update:fileList",u),a.value=!1}catch{return!1}};return()=>createVNode("div",null,[createVNode(NUpload,{ref:c,action:o,customRequest:f,fileList:l.value,"onUpdate:fileList":e=>l.value=e,listType:e.listType,accept:e.accept,multiple:e.multiple,max:e.max,disabled:e.disabled,showFileList:e.showFileList,showPreviewButton:!0,onBeforeUpload:t=>(async t=>{const n=t.file;let r=!0;if(e.size&&(r=n.file.size/1024/1024<e.size,!r))return i.error(`文件大小不能超过${e.size}M`),!1;if(!r)return r;if(e.cropper)return p(n.file,(t=>{const r=Object.assign({},e.options,{img:t,name:n.file.name});a.value=!0,setTimeout((()=>{h.value?.edit(r),console.log(h.value,"cropper")}),100)})),!1;try{s.value=!0,console.log(e.path,n.file);const t=n.file.name,r=t.slice(t.lastIndexOf(".")),o=`${e.path}${e.fileName||Date.now()+r}`,i={filename:o,bucketName:e.bucketName,postData:{filename:o,acl:"public-read",key:o,unknowValueField:[]}},{data:a}=await getUploadSign(i);u.push({id:n.id,tempFiileBuffer:n.file,policy:a.policy,signature:a.signature,acl:"public-read",key:o,KSSAccessKeyId:a.kssAccessKeyId,name:o})}catch{return s.value=!1,!1}return!0})(t),onFinish:e=>(e=>{const n=u.find((t=>t.id==e.file.id));t("update:fileList",e.file.url),t("readFileInputEventAsArrayBuffer",n.tempFiileBuffer),a.value=!1,s.value=!1})(e),onRemove:e=>(async e=>{console.log("🚀 ~ options",e),t("update:fileList",""),t("remove"),s.value=!1})(e)},{default:()=>["default"===e.showType&&"image"===e.listType&&createVNode(NButton,{loading:s.value,type:"primary"},{default:()=>[e.text]}),"custom"===e.showType&&r.custom&&r.custom()]}),e.tips&&createVNode("p",{style:"font-size: 13px; color: #666; padding-top: 4px;"},[e.tips]),createVNode(NModal,{maskClosable:modalClickMask,show:a.value,"onUpdate:show":e=>a.value=e,preset:"dialog",showIcon:!1,class:["modalTitle background"],title:"上传图片",style:{width:"800px"}},{default:()=>[createVNode(Copper,{ref:h,onClose:()=>a.value=!1,onCropperOk:m},null)]})])}}))}}}))})();
|